Skip to content

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

refactor(ui): 组件层收敛为 Button/IconButton/Chip/Tag,并完成 components/ 与 ui/ 分家

hairyff55aaf27a0f2
diff --git a/packages/dsh-tauri-panel-scheduler/src/client/components/task-create-dialog.tsx b/packages/dsh-tauri-panel-scheduler/src/client/components/task-create-dialog.tsx
index 6d4a571d..b385fdd4 100644
--- a/packages/dsh-tauri-panel-scheduler/src/client/components/task-create-dialog.tsx
+++ b/packages/dsh-tauri-panel-scheduler/src/client/components/task-create-dialog.tsx
@@ -4,8 +4,7 @@
* 外壳用官方 primitives `Modal`(居中弹层 + 标题/描述/关闭按钮/页脚),
* 字段控件复刻官方样式:名称 = input 类;计划下拉 = input + selectInput 类;
* 任务指令 = textarea 类;底部 composer 的 workspace / permission / 模型 三个
- * 选择器 = pill 触发按钮 + primitives `Menu`(官方 selector 模式,
- * 见 components/menu-select.tsx)。
+ * 选择器 = selector 触发按钮 + 官方 `Menu`。
* 计划动态参数保持 #307 语义:每天/工作日=时间段;间隔=时长;每周=星期+时间段。
*/
@@ -13,7 +12,7 @@ import type { ReactElement } from 'react'
import type { LocaleKey, Translate } from '../locales/index.types'
import type { ScheduleForm, ScheduleKind, SchedulerOptions, TaskFormState, TaskInput, Weekday } from '../types'
import { Modal } from '@deepseek-ai/dsh-client-ui-primitives'
-import { MenuSelect, useMountStyle } from 'dsh-tauri-ui/client'
+import { ChevronDown, Chip, Icon, Menu, useMountStyle } from 'dsh-tauri-ui/client'
import { isEmpty, map, omitBy, pick, range } from 'dsh-tauri/client'
import { useRef, useState } from 'react'
import { SCHEDULE_KINDS } from '../../shared/constants'
@@ -110,6 +109,8 @@ export function TaskCreateDialog({ t, options, onClose, taskId, initial }: TaskC
})
const [saving, setSaving] = useState(false)
const [error, setError] = useState('')
+ const [openWorkspace, setOpenWorkspace] = useState(false)
+ const [openPermission, setOpenPermission] = useState(false)
// 保存中禁止关闭(Esc / 遮罩 / 关闭按钮):用 ref 供稳定闭包读取最新值。
const savingRef = useRef(false)
savingRef.current = saving
@@ -287,19 +288,53 @@ export function TaskCreateDialog({ t, options, onClose, taskId, initial }: TaskC
onChange={event => setForm(state => ({ ...state, prompt: event.target.value }))}
/>
<div className="dshp-scheduler__composer">
- <MenuSelect
- variant="pill"
- label={t('workspace')}
- value={form.workspaceId}
- options={workspaceOptions}
- onSelect={id => setForm(state => ({ ...state, workspaceId: id }))}
+ <Menu
+ open={openWorkspace}
+ onClose={() => setOpenWorkspace(false)}
+ onSelect={(id) => {
+ setOpenWorkspace(false)
+ setForm(state => ({ ...state, workspaceId: id }))
+ }}
+ items={workspaceOptions}
+ selectedId={form.workspaceId}
+ portal
+ align="end"
+ anchor={(
+ <Chip
+ variant="selector"
+ aria-label={t('workspace')}
+ aria-haspopup="menu"
+ aria-expanded={openWorkspace}
+ onClick={() => setOpenWorkspace(openState => !openState)}
+ chevron={<Icon as={ChevronDown} />}
+ >
+ <span>{workspaceOptions.find(option => option.id === form.workspaceId)?.label ?? form.workspaceId}</span>
+ </Chip>
+ )}
/>
- <MenuSelect
- variant="pill"
- label={t('permission')}
- value={form.permission}
- options={permissionOptions}
- onSelect={id => setForm(state => ({ ...state, permission: id }))}
+ <Menu
+ open={openPermission}
+ onClose={() => setOpenPermission(false)}
+ onSelect={(id) => {
+ setOpenPermission(false)
+ setForm(state => ({ ...state, permission: id }))
+ }}
+ items={permissionOptions}
+ selectedId={form.permission}
+ portal
+ align="end"
+ anchor={(
+ <Chip
+ variant="selector"
+ aria-label={t('permission')}
+ aria-haspopup="menu"
+ aria-expanded={openPermission}
+ onClick={() => setOpenPermission(openState => !openState)}
+ chevron={<Icon as={ChevronDown} />}
+ >
+ <span>{permissionOptions.find(option => option.id === form.permission)?.label ?? form.permission}</span>
+ </Chip>
+ )}
/>
<div style={{ flex: 1 }} />
<ModelPicker
diff --git a/packages/dsh-tauri-panel-scheduler/src/client/register/session-icons.ts b/packages/dsh-tauri-panel-scheduler/src/client/register/session-icons.ts
index fff17ed8..d46bad50 100644
--- a/packages/dsh-tauri-panel-scheduler/src/client/register/session-icons.ts
+++ b/packages/dsh-tauri-panel-scheduler/src/client/register/session-icons.ts
@@ -1,10 +1,21 @@
+import type { Root } from 'react-dom/client'
import type { ClientContext } from 'dsh-tauri/client'
-import { clockSvg, mountStyle } from 'dsh-tauri-ui/client'
+import { createElement } from 'react'
+import { createRoot } from 'react-dom/client'
+import { Clock, Icon, mountStyle } from 'dsh-tauri-ui/client'
import { compact, defineRegister, map } from 'dsh-tauri/client'
import { SESSION_ICON_ATTRIBUTE, SESSION_ICON_STYLE_ID, SIDEBAR_SELECTOR } from '../constants'
import { store } from '../store'
import sessionIconStyle from '../styles/index.cssr'
+const ICON_ROOTS = new WeakMap<Element, Root>()
+
+function removeIcon(icon: Element): void {
+ ICON_ROOTS.get(icon)?.unmount()
+ ICON_ROOTS.delete(icon)
+ icon.remove()
+}
+
interface FiberLike {
key?: unknown
return?: FiberLike | null
@@ -44,7 +55,9 @@ function applyIcon(row: Element): void {
const icon = document.createElement('span')
icon.setAttribute(SESSION_ICON_ATTRIBUTE, '1')
- icon.innerHTML = clockSvg(12)
+ const root = createRoot(icon)
+ root.render(createElement(Icon, { as: Clock, size: 12 }))
+ ICON_ROOTS.set(icon, root)
row.insertBefore(icon, time)
}
@@ -56,8 +69,8 @@ function scan(): void {
if (!icon)
applyIcon(row)
}
- else {
- icon?.remove()
+ else if (icon) {
+ removeIcon(icon)
}
}
}
diff --git a/packages/dsh-tauri-session/src/client/components/archive-panel.cssr.ts b/packages/dsh-tauri-session/src/client/components/archive-panel.cssr.ts
index 0a3d5bab..b4eca90e 100644
--- a/packages/dsh-tauri-session/src/client/components/archive-panel.cssr.ts
+++ b/packages/dsh-tauri-session/src/client/components/archive-panel.cssr.ts
@@ -47,7 +47,7 @@ export default c([
flex: '1 1 220px',
minWidth: 0,
}),
- // 官方风格下拉触发器(MenuSelect):对齐官方「通用设置」Select 的 pill 规格
+ // 官方风格下拉触发器(Chip variant="selector"):对齐官方「通用设置」Select 规格
// (36px 高、全圆角、无边框、bg-module-platform 底、hover 换 interactive 底)。
c(`.dshp-session__menu-select`, {
display: 'inline-flex',
diff --git a/packages/dsh-tauri-session/src/client/components/archive-panel.tsx b/packages/dsh-tauri-session/src/client/components/archive-panel.tsx
index b893f003..2f515b46 100644
--- a/packages/dsh-tauri-session/src/client/components/archive-panel.tsx
+++ b/packages/dsh-tauri-session/src/client/components/archive-panel.tsx
@@ -2,8 +2,8 @@ import type { MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives'
import type { ReactElement } from 'react'
import type { ArchiveSort } from '../store/modules/archive.types'
import type { ArchivePanelProps, DeleteConfirm } from './archive-panel.types'
-import { Button, Input, Menu, Modal, Toast } from '@deepseek-ai/dsh-client-ui-primitives'
-import { Ellipsis, FolderOpen, Icon, Magnifier, MenuSelect, TrashBin, useMountStyle } from 'dsh-tauri-ui/client'
+import { Button, Input, Modal, Toast } from '@deepseek-ai/dsh-client-ui-primitives'
+import { ChevronDown, Chip, Ellipsis, FolderOpen, Icon, Magnifier, Menu, TrashBin, useMountStyle } from 'dsh-tauri-ui/client'
import { isEmpty, useWatchImmediate } from 'dsh-tauri/client'
import { useCallback, useState } from 'react'
import { SESSION_STYLE_ID } from '../constants'
@@ -29,6 +29,8 @@ export function ArchivePanel(props: ArchivePanelProps): ReactElement | null {
const [confirm, setConfirm] = useState<DeleteConfirm>(null)
const [openGroupMenu, setOpenGroupMenu] = useState<string | null>(null)
const [openPathError, setOpenPathError] = useState<string | null>(null)
+ const [openSort, setOpenSort] = useState(false)
+ const [openProjectFilter, setOpenProjectFilter] = useState(false)
// 进入分区或宿主归档集合规模变化时刷新归档载荷(meta:createdAt/cwd)。
useWatchImmediate((props.workspacesRuntime.list.getSnapshot().archivedSessionIds ?? []).length, () => {
@@ -57,6 +59,17 @@ export function ArchivePanel(props: ArchivePanelProps): ReactElement | null {
setOpenPathError(result.ok ? null : result.error ?? '')
}
+ const sortOptions = [
+ { id: 'updatedAt', label: locale.text('sortUpdatedAt') },
+ { id: 'createdAt', label: locale.text('sortCreatedAt') },
+ { id: 'title', label: locale.text('sortTitle') },
+ ]
+ const projectFilterOptions = [
+ { id: 'all', label: locale.text('allProjects') },
+ ...projectOptions(rows),
+ ...(rows.some(row => !row.workspaceId) ? [{ id: 'ungrouped', label: locale.text('ungrouped') }] : []),
+ ]
+
const footer = (
<>
<Button variant="ghost" onClick={() => setConfirm(null)}>{locale.text('cancel')}</Button>
@@ -97,33 +110,59 @@ export function ArchivePanel(props: ArchivePanelProps): ReactElement | null {
icon={<Icon as={Magnifier} />}
onChange={event => store.archive.setQuery(event.target.value)}
/>
- <MenuSelect
- variant="default"
- triggerClassName="dshp-session__menu-select"
- labelClassName="dshp-session__menu-select-label"
- chevronClassName="dshp-session__menu-select-chevron"
- label={locale.text('sortLabel')}
- value={ui.sort}
- onSelect={id => store.archive.setSort(id as ArchiveSort)}
- options={[
- { id: 'updatedAt', label: locale.text('sortUpdatedAt') },
- { id: 'createdAt', label: locale.text('sortCreatedAt') },
- { id: 'title', label: locale.text('sortTitle') },
- ]}
+ <Menu
+ open={openSort}
+ onClose={() => setOpenSort(false)}
+ onSelect={(id) => {
+ setOpenSort(false)
+ store.archive.setSort(id as ArchiveSort)
+ }}
+ items={sortOptions}
+ selectedId={ui.sort}
+ portal
+ align="end"
+ anchor={(
+ <Chip
+ variant="selector"
+ className="dshp-session__menu-select"
+ aria-label={locale.text('sortLabel')}
+ aria-haspopup="menu"
+ aria-expanded={openSort}
+ onClick={() => setOpenSort(openState => !openState)}
+ chevron={<Icon as={ChevronDown} className="dshp-session__menu-select-chevron" />}
+ >
+ <span className="dshp-session__menu-select-label">
+ {sortOptions.find(option => option.id === ui.sort)?.label ?? ui.sort}
+ </span>
+ </Chip>
+ )}
/>
- <MenuSelect
- variant="default"
- triggerClassName="dshp-session__menu-select"
- labelClassName="dshp-session__menu-select-label"
- chevronClassName="dshp-session__menu-select-chevron"
- label={locale.text('allProjects')}
- value={ui.workspaceId}
- onSelect={workspaceId => store.archive.setWorkspaceFilter(workspaceId)}
- options={[
- { id: 'all', label: locale.text('allProjects') },
- ...projectOptions(rows),
- ...(rows.some(row => !row.workspaceId) ? [{ id: 'ungrouped', label: locale.text('ungrouped') }] : []),
- ]}
+ <Menu
+ open={openProjectFilter}
+ onClose={() => setOpenProjectFilter(false)}
+ onSelect={(id) => {
+ setOpenProjectFilter(false)
+ store.archive.setWorkspaceFilter(id)
+ }}
+ items={projectFilterOptions}
+ selectedId={ui.workspaceId}
+ portal
+ align="end"
+ anchor={(
+ <Chip
+ variant="selector"
+ className="dshp-session__menu-select"
+ aria-label={locale.text('allProjects')}
+ aria-haspopup="menu"
+ aria-expanded={openProjectFilter}
+ onClick={() => setOpenProjectFilter(openState => !openState)}
+ chevron={<Icon as={ChevronDown} className="dshp-session__menu-select-chevron" />}
+ >
+ <span className="dshp-session__menu-select-label">
+ {projectFilterOptions.find(option => option.id === ui.workspaceId)?.label ?? ui.workspaceId}
+ </span>
+ </Chip>
+ )}
/>
</div>
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
deleted file mode 100644
index 8cd20deb..00000000
--- a/packages/dsh-tauri-ui/src/client/components/add-button.cssr.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index 24fe3907..00000000
--- a/packages/dsh-tauri-ui/src/client/components/add-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 8f009cd8..00000000
--- a/packages/dsh-tauri-ui/src/client/components/add-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { ButtonHTMLAttributes, ReactNode } from 'react'
-
-export interface AddButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
- icon?: ReactNode
-}
diff --git a/packages/dsh-tauri-ui/src/client/components/button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/button.cssr.ts
new file mode 100644
index 00000000..edcfe77b
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/button.cssr.ts
@@ -0,0 +1,88 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b, m } } = cssr
+const { borderL3, error, primary, primaryFill, primaryFg, primaryHover } = sharedStyles
+
+export default b('button', {}, [
+ m('elevated', {
+ 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',
+ }),
+ ]),
+ m('add', {
+ 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',
+ }),
+ ]),
+ // 上游 `.danger` 是 token 重绑:本地覆盖 --dsw-alias-interactive-bg-hover,让 hover 洗色变红。
+ m('danger', {
+ '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',
+ }),
+ c('&.dshp-button--sm', {
+ height: '28px',
+ padding: '0 10px',
+ fontSize: '12px',
+ lineHeight: '18px',
+ borderRadius: '14px',
+ }),
+ ]),
+])
diff --git a/packages/dsh-tauri-ui/src/client/components/button.tsx b/packages/dsh-tauri-ui/src/client/components/button.tsx
new file mode 100644
index 00000000..6631d67a
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/button.tsx
@@ -0,0 +1,40 @@
+import type { ReactElement } from 'react'
+import type { ButtonProps, ButtonSize } from './button.types'
+import { Button as PrimitiveButton } from '@deepseek-ai/dsh-client-ui-primitives'
+import { compact } from 'dsh-tauri/client'
+import { useMountStyle } from '../hooks/use-mount-style'
+import buttonStyle from './button.cssr'
+
+const BUTTON_STYLE_ID = 'dsh-tauri-ui-button-styles'
+
+function isLocalVariant(variant: ButtonProps['variant']): variant is 'elevated' | 'add' | 'danger' {
+ return variant === 'elevated' || variant === 'add' || variant === 'danger'
+}
+
+// elevated / add 是上游固定几何,size 对其无效;danger 沿用官方 outline 的 md / sm 两档。
+function LocalButton({
+ variant,
+ size,
+ icon,
+ className,
+ children,
+ ...rest
+}: ButtonProps & { variant: 'elevated' | 'add' | 'danger', size: ButtonSize }): ReactElement {
+ useMountStyle(buttonStyle, BUTTON_STYLE_ID)
+ return (
+ <button
+ type="button"
+ className={compact(['dshp-button', `dshp-button--${variant}`, `dshp-button--${size}`, className]).join(' ')}
+ {...rest}
+ >
+ {icon}
+ {children}
+ </button>
+ )
+}
+
+export function Button({ variant = 'ghost', size = 'md', icon, className, children, ...rest }: ButtonProps): ReactElement {
+ if (isLocalVariant(variant))
+ return <LocalButton variant={variant} size={size} icon={icon} className={className} {...rest}>{children}</LocalButton>
+ return <PrimitiveButton variant={variant} size={size} icon={icon} className={className} {...rest}>{children}</PrimitiveButton>
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/button.types.ts b/packages/dsh-tauri-ui/src/client/components/button.types.ts
new file mode 100644
index 00000000..079e540d
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/button.types.ts
@@ -0,0 +1,19 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export type ButtonVariant
+ = | 'primary'
+ | 'ghost'
+ | 'outline'
+ | 'toolbar'
+ | 'elevated'
+ | 'add'
+ | 'danger'
+
+export type ButtonSize = 'sm' | 'md'
+
+export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
+ variant?: ButtonVariant
+ size?: ButtonSize
+ icon?: ReactNode
+ children?: ReactNode
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/checkbox.tsx b/packages/dsh-tauri-ui/src/client/components/checkbox.tsx
index 4dab916a..740b725e 100644
--- a/packages/dsh-tauri-ui/src/client/components/checkbox.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/checkbox.tsx
@@ -1,6 +1,6 @@
import type { ReactElement } from 'react'
import type { CheckboxProps } from './checkbox.types'
-import { CHECKBOX_STYLE_ID } from '../constants'
+export const CHECKBOX_STYLE_ID = 'dsh-tauri-ui-checkbox-styles'
import { useMountStyle } from '../hooks/use-mount-style'
import checkboxStyle from './checkbox.cssr'
diff --git a/packages/dsh-tauri-ui/src/client/components/chip.cssr.ts b/packages/dsh-tauri-ui/src/client/components/chip.cssr.ts
new file mode 100644
index 00000000..ed88a6b1
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/chip.cssr.ts
@@ -0,0 +1,93 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b, e, m } } = cssr
+const { dimmed, focusRing, hover, modulePlatform, primary, secondary } = sharedStyles
+
+export default b('chip', {}, [
+ m('seat', {
+ 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)',
+ }),
+ ]),
+ m('composerTrigger', {
+ 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)' }),
+ ]),
+ ]),
+ m('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/chip.tsx b/packages/dsh-tauri-ui/src/client/components/chip.tsx
new file mode 100644
index 00000000..714e0732
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/chip.tsx
@@ -0,0 +1,24 @@
+import type { ReactElement } from 'react'
+import type { ChipProps } from './chip.types'
+import { compact } from 'dsh-tauri/client'
+import { useMountStyle } from '../hooks/use-mount-style'
+import chipStyle from './chip.cssr'
+
+const CHIP_STYLE_ID = 'dsh-tauri-ui-chip-styles'
+
+export function Chip({ variant, icon, chevron, open, className, children, ...rest }: ChipProps): ReactElement {
+ useMountStyle(chipStyle, CHIP_STYLE_ID)
+ return (
+ <button
+ type="button"
+ className={compact(['dshp-chip', `dshp-chip--${variant}`, className]).join(' ')}
+ {...rest}
+ >
+ {icon}
+ {children}
+ {chevron === undefined
+ ? null
+ : <span className="dshp-chip__chevron" data-open={open === true ? 'true' : undefined}>{chevron}</span>}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/chip.types.ts b/packages/dsh-tauri-ui/src/client/components/chip.types.ts
new file mode 100644
index 00000000..64e339c2
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/chip.types.ts
@@ -0,0 +1,11 @@
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+export type ChipVariant = 'seat' | 'composerTrigger' | 'selector'
+
+export interface ChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
+ variant: ChipVariant
+ icon?: ReactNode
+ chevron?: ReactNode
+ open?: boolean
+ children?: 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
deleted file mode 100644
index c514f6cd..00000000
--- a/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.cssr.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-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
deleted file mode 100644
index a2e396d6..00000000
--- a/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-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
deleted file mode 100644
index 1d3cd884..00000000
--- a/packages/dsh-tauri-ui/src/client/components/composer-trigger-chip.types.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-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
deleted file mode 100644
index fdae1167..00000000
--- a/packages/dsh-tauri-ui/src/client/components/danger-outline-button.cssr.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-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
deleted file mode 100644
index 97623940..00000000
--- a/packages/dsh-tauri-ui/src/client/components/danger-outline-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 714da55e..00000000
--- a/packages/dsh-tauri-ui/src/client/components/danger-outline-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index ad76f6f7..00000000
--- a/packages/dsh-tauri-ui/src/client/components/help-icon-button.cssr.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index 8dd109d0..00000000
--- a/packages/dsh-tauri-ui/src/client/components/help-icon-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 338d9b35..00000000
--- a/packages/dsh-tauri-ui/src/client/components/help-icon-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { ButtonHTMLAttributes, ReactNode } from 'react'
-
-export interface HelpIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
- icon?: ReactNode
-}
diff --git a/packages/dsh-tauri-ui/src/client/components/icon-button.cssr.ts b/packages/dsh-tauri-ui/src/client/components/icon-button.cssr.ts
new file mode 100644
index 00000000..2eeff093
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/icon-button.cssr.ts
@@ -0,0 +1,160 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b, m } } = cssr
+const { brand, focusRing, hover, primary, secondary, tertiary } = sharedStyles
+
+export default b('icon-button', {}, [
+ m('search', {
+ 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 }),
+ ]),
+ m('toolbar', {
+ 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',
+ }),
+ ]),
+ m('model', {
+ 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 }),
+ ]),
+ m('round', {
+ 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',
+ }),
+ ]),
+ m('row', {
+ 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',
+ }),
+ ]),
+ m('help', {
+ 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',
+ }),
+ ]),
+ m('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/icon-button.tsx b/packages/dsh-tauri-ui/src/client/components/icon-button.tsx
new file mode 100644
index 00000000..5f2bebf8
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/icon-button.tsx
@@ -0,0 +1,30 @@
+import type { ReactElement } from 'react'
+import type { ButtonHTMLAttributes, ReactNode } from 'react'
+
+import { compact } from 'dsh-tauri/client'
+import { useMountStyle } from '../hooks/use-mount-style'
+import iconButtonStyle from './icon-button.cssr'
+
+export type IconButtonVariant = 'search' | 'toolbar' | 'model' | 'round' | 'row' | 'help' | 'action'
+
+export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
+ variant: IconButtonVariant
+ icon?: ReactNode
+ children?: ReactNode
+}
+
+const ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-icon-button-styles'
+
+export function IconButton({ variant, icon, className, children, ...rest }: IconButtonProps): ReactElement {
+ useMountStyle(iconButtonStyle, ICON_BUTTON_STYLE_ID)
+ return (
+ <button
+ type="button"
+ className={compact(['dshp-icon-button', `dshp-icon-button--${variant}`, className]).join(' ')}
+ {...rest}
+ >
+ {icon}
+ {children}
+ </button>
+ )
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/icon.tsx b/packages/dsh-tauri-ui/src/client/components/icon.tsx
index 980c8226..3c26f5ac 100644
--- a/packages/dsh-tauri-ui/src/client/components/icon.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/icon.tsx
@@ -1,13 +1,5 @@
-import type { ComponentType, ReactElement, SVGProps } from 'react'
-
-export type IconComponent = ComponentType<SVGProps<SVGSVGElement>>
-
-export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'as'> {
- as: IconComponent
- size?: number
-}
-
-export type SharedIconProps = Omit<SVGProps<SVGSVGElement>, 'as'> & { size?: number }
+import type { ReactElement } from 'react'
+import type { IconProps } from './icon.types'
export function Icon({ as: Component, size = 16, ...props }: IconProps): ReactElement {
return <Component {...props} width={size} height={size} />
diff --git a/packages/dsh-tauri-ui/src/client/components/icon.types.ts b/packages/dsh-tauri-ui/src/client/components/icon.types.ts
new file mode 100644
index 00000000..df99e27b
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/icon.types.ts
@@ -0,0 +1,10 @@
+import type { ComponentType, SVGProps } from 'react'
+
+export type IconComponent = ComponentType<SVGProps<SVGSVGElement>>
+
+export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'as'> {
+ as: IconComponent
+ size?: number
+}
+
+export type SharedIconProps = Omit<SVGProps<SVGSVGElement>, 'as'> & { size?: number }
diff --git a/packages/dsh-tauri-ui/src/client/components/index.ts b/packages/dsh-tauri-ui/src/client/components/index.ts
index b2f8cf6f..11d05348 100644
--- a/packages/dsh-tauri-ui/src/client/components/index.ts
+++ b/packages/dsh-tauri-ui/src/client/components/index.ts
@@ -1,43 +1,15 @@
-export * from './add-button'
-export type * from './add-button.types'
+export * from './button'
+export type * from './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 './chip'
+export type * from './chip.types'
export * from './icon'
-export type * from './icon'
+export * from './icon-button'
+export type * from './icon.types'
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'
+export type * from './registry.types'
+export * from './tag'
+export type * from './tag.types'
diff --git a/packages/dsh-tauri-ui/src/client/components/menu-select.cssr.ts b/packages/dsh-tauri-ui/src/client/components/menu-select.cssr.ts
deleted file mode 100644
index 0602cf4a..00000000
--- a/packages/dsh-tauri-ui/src/client/components/menu-select.cssr.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import { styles as sharedStyles } from '../constants/theme'
-import { cssr } from '../utils/cssr'
-
-const { c, bem: { b, m } } = cssr
-const { primary, secondary, hover, modulePlatform } = sharedStyles
-
-export default b('menu-select', {
- display: 'inline-flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- gap: '10px',
- minHeight: '36px',
- padding: '0 14px',
- border: 'none',
- borderRadius: '18px',
- background: modulePlatform,
- color: primary,
- cursor: 'pointer',
- font: 'inherit',
- fontSize: '14px',
- lineHeight: '22px',
- whiteSpace: 'nowrap',
-}, [
- c('&:hover', { background: hover }),
- c('& > span', {
- minWidth: 0,
- overflow: 'hidden',
- textOverflow: 'ellipsis',
- }),
- c('& > svg', { flex: 'none' }),
- m('pill', {
- minHeight: '28px',
- height: '28px',
- padding: '0 8px',
- borderRadius: '8px',
- background: 'transparent',
- color: secondary,
- fontSize: '13px',
- fontWeight: '500',
- gap: '6px',
- }, [
- c('&:hover', {
- background: hover,
- color: primary,
- }),
- ]),
-])
diff --git a/packages/dsh-tauri-ui/src/client/components/menu-select.tsx b/packages/dsh-tauri-ui/src/client/components/menu-select.tsx
deleted file mode 100644
index 00398d4c..00000000
--- a/packages/dsh-tauri-ui/src/client/components/menu-select.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import type { MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives'
-import type { ReactElement } from 'react'
-import type { MenuSelectProps } from './menu-select.types'
-import { Menu } from '@deepseek-ai/dsh-client-ui-primitives'
-import { compact } from 'dsh-tauri/client'
-import { useState } from 'react'
-import { MENU_SELECT_STYLE_ID } from '../constants'
-import { useMountStyle } from '../hooks/use-mount-style'
-import { Icon } from './icon'
-import { ChevronDown } from './icons'
-import menuSelectStyle from './menu-select.cssr'
-
-export function MenuSelect({
- value,
- options,
- onSelect,
- label,
- variant = 'default',
- triggerClassName,
- labelClassName,
- chevronClassName,
-}: MenuSelectProps): ReactElement {
- const [open, setOpen] = useState(false)
- useMountStyle(menuSelectStyle, MENU_SELECT_STYLE_ID)
- const current = options.find(option => option.id === value)
- const items: MenuEntry[] = options.map(option => ({ id: option.id, label: option.label }))
- const triggerClass = compact([
- 'dshp-menu-select',
- variant === 'pill' && 'dshp-menu-select--pill',
- triggerClassName,
- ]).join(' ')
-
- return (
- <Menu
- open={open}
- onClose={() => setOpen(false)}
- onSelect={(id) => {
- setOpen(false)
- onSelect(id)
- }}
- items={items}
- selectedId={value}
- portal
- align="end"
- anchor={(
- <button
- type="button"
- className={triggerClass}
- aria-label={label}
- aria-haspopup="menu"
- aria-expanded={open}
- onClick={() => setOpen(openState => !openState)}
- >
- <span className={labelClassName}>{current?.label ?? value}</span>
- <Icon as={ChevronDown} className={chevronClassName} />
- </button>
- )}
- />
- )
-}
diff --git a/packages/dsh-tauri-ui/src/client/components/menu-select.types.ts b/packages/dsh-tauri-ui/src/client/components/menu-select.types.ts
deleted file mode 100644
index 23c0bbd0..00000000
--- a/packages/dsh-tauri-ui/src/client/components/menu-select.types.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-export interface MenuSelectOption {
- id: string
- label: string
-}
-
-export interface MenuSelectProps {
- value: string
- options: readonly MenuSelectOption[]
- onSelect: (id: string) => void
- label: string
- variant?: 'pill' | 'default'
- triggerClassName?: string
- labelClassName?: string
- chevronClassName?: string
-}
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
deleted file mode 100644
index 8b522bd0..00000000
--- a/packages/dsh-tauri-ui/src/client/components/message-icon-action.cssr.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-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
deleted file mode 100644
index 80b56339..00000000
--- a/packages/dsh-tauri-ui/src/client/components/message-icon-action.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 8b277431..00000000
--- a/packages/dsh-tauri-ui/src/client/components/message-icon-action.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index f12e59d8..00000000
--- a/packages/dsh-tauri-ui/src/client/components/model-icon-button.cssr.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index 5ada1a52..00000000
--- a/packages/dsh-tauri-ui/src/client/components/model-icon-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 7bb72f4b..00000000
--- a/packages/dsh-tauri-ui/src/client/components/model-icon-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 6775f23c..00000000
--- a/packages/dsh-tauri-ui/src/client/components/new-session-button.cssr.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-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
deleted file mode 100644
index a766090a..00000000
--- a/packages/dsh-tauri-ui/src/client/components/new-session-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 73f7dd8d..00000000
--- a/packages/dsh-tauri-ui/src/client/components/new-session-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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 a458b5b7..f221e6ce 100644
--- a/packages/dsh-tauri-ui/src/client/components/official.tsx
+++ b/packages/dsh-tauri-ui/src/client/components/official.tsx
@@ -7,6 +7,9 @@
* 仅 0.1.7 才有的组件必须在本目录 refork(`checkbox`、`segmented-control` 就是先例),
* 否则在 0.1.5 内核上取到 `undefined` 并触发 React #130(`Element type is invalid …`)。
*
+ * `Button` / `Tag` 已由本目录的 `button.tsx` / `tag.tsx` 接管(单组件内分发:官方 variant
+ * 继续走官方实现,本地 variant 走 refork 样式),故不在此转发。
+ *
* 不在此转发官方 icons 桶:两代导出名不同(`IconXxx16` → `IconXxxRegular`),图标
* 统一走 `@gravity-ui/icons`(见 `icons.tsx`)。也不转发 `ReferenceIcon` / `LinkIcon`:
* 0.1.7 已删除这两个名字,改为 `ReferenceIcon{Regular,Medium}` / `LinkIcon{Regular,Medium}`。
@@ -14,7 +17,6 @@
export {
BrandWordmark,
- Button,
classifyFileType,
classifyLinkPath,
CodeBlock,
@@ -50,7 +52,6 @@ export {
SearchBlock,
StateDot,
Switch,
- Tag,
TerminalBlock,
Toast,
Tooltip,
@@ -61,7 +62,6 @@ export {
export type {
AnchoredPositionOptions,
BrandWordmarkProps,
- ButtonVariant,
CodeBlockProps,
ConnectionIndicatorState,
DiffBlockLabels,
@@ -101,7 +101,6 @@ export type {
SearchMatchesBlockProps,
SearchPathsBlockProps,
StateDotState,
- TagTone,
TerminalBlockLabels,
TerminalBlockProps,
TooltipSide,
diff --git a/packages/dsh-tauri-ui/src/client/components/registry.ts b/packages/dsh-tauri-ui/src/client/components/registry.ts
index 0ea89360..9eff54b6 100644
--- a/packages/dsh-tauri-ui/src/client/components/registry.ts
+++ b/packages/dsh-tauri-ui/src/client/components/registry.ts
@@ -1,18 +1,4 @@
-export interface UiComponentSource {
- kind: 'reexport' | 'refork'
- component: string
- package: string
- version: string
- availableAt: readonly string[]
- upstreamPath: string
- mappedClass?: string
-}
-
-export interface UiComponentEntry {
- id: string
- title: string
- source: UiComponentSource
-}
+import type { UiComponentEntry, UiComponentSource } from './registry.types'
const PRIMITIVES = '@deepseek-ai/dsh-client-ui-primitives'
const VERSION = '0.1.7-alpha.1'
@@ -38,13 +24,18 @@ function primitives(component: string, file: string): UiComponentEntry {
}
}
-function refork(component: string, source: Omit<UiComponentSource, 'kind' | 'component' | 'version'>): UiComponentEntry {
+function reforkVariant(
+ component: string,
+ variant: string,
+ source: Omit<UiComponentSource, 'kind' | 'component' | 'variant' | 'version'>,
+): UiComponentEntry {
return {
- id: slug(component),
- title: component,
+ id: `${slug(component)}-${slug(variant)}`,
+ title: `${component} · ${variant}`,
source: {
kind: 'refork',
component,
+ variant,
version: VERSION,
...source,
},
@@ -81,79 +72,91 @@ export const UI_COMPONENT_REGISTRY: readonly UiComponentEntry[] = [
primitives('FISH_LOGO_PATH', 'FishLogo'),
primitives('FISH_LOGO_VIEWBOX', 'FishLogo'),
- refork('NewSessionButton', {
+ reforkVariant('Button', 'elevated', {
package: '@deepseek-ai/dsh-client-ui-sidebar',
availableAt: AVAILABLE_BOTH,
upstreamPath: 'packages/client/ui-sidebar/src/client/SidebarRoot.module.css',
mappedClass: 'newSession',
}),
- refork('SearchIconButton', {
- package: '@deepseek-ai/dsh-client-ui-workspace',
- availableAt: AVAILABLE_BOTH,
- upstreamPath: 'packages/client/ui-workspace/src/client/rows/WorkspaceBrowser.module.css',
- mappedClass: 'searchButton',
- }),
- refork('ToolbarIconButton', {
+ reforkVariant('Button', 'add', {
package: '@deepseek-ai/dsh-client-ui-plugin-manager',
availableAt: AVAILABLE_LATEST,
upstreamPath: 'packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css',
- mappedClass: 'iconButton',
+ mappedClass: 'addButton',
}),
- refork('AddButton', {
+ reforkVariant('Button', 'danger', {
package: '@deepseek-ai/dsh-client-ui-plugin-manager',
availableAt: AVAILABLE_LATEST,
upstreamPath: 'packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css',
- mappedClass: 'addButton',
+ mappedClass: 'danger',
+ }),
+ reforkVariant('IconButton', 'search', {
+ package: '@deepseek-ai/dsh-client-ui-workspace',
+ availableAt: AVAILABLE_BOTH,
+ upstreamPath: 'packages/client/ui-workspace/src/client/rows/WorkspaceBrowser.module.css',
+ mappedClass: 'searchButton',
}),
- refork('DangerOutlineButton', {
+ reforkVariant('IconButton', 'toolbar', {
package: '@deepseek-ai/dsh-client-ui-plugin-manager',
availableAt: AVAILABLE_LATEST,
upstreamPath: 'packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css',
- mappedClass: 'danger',
+ mappedClass: 'iconButton',
+ }),
+ reforkVariant('IconButton', 'model', {
+ package: '@deepseek-ai/dsh-client-ui-settings-models',
+ availableAt: AVAILABLE_BOTH,
+ upstreamPath: 'packages/client/ui-settings-models/src/client/ModelsSection.module.css',
+ mappedClass: 'iconButton',
+ }),
+ reforkVariant('IconButton', 'round', {
+ package: '@deepseek-ai/dsh-client-ui-sidebar',
+ availableAt: AVAILABLE_BOTH,
+ upstreamPath: 'packages/client/ui-sidebar/src/client/SidebarRoot.module.css',
+ mappedClass: 'iconButton',
}),
- refork('RowIconButton', {
+ reforkVariant('IconButton', 'row', {
package: '@deepseek-ai/dsh-client-ui-workspace',
availableAt: AVAILABLE_BOTH,
upstreamPath: 'packages/client/ui-workspace/src/client/rows/Rows.module.css',
mappedClass: 'iconButton',
}),
- refork('HelpIconButton', {
+ reforkVariant('IconButton', 'help', {
package: PRIMITIVES,
availableAt: AVAILABLE_LATEST,
upstreamPath: 'packages/client/ui-primitives/src/settings-form/fields.module.css',
mappedClass: 'helpButton',
}),
- refork('SeatChip', {
+ reforkVariant('IconButton', 'action', {
+ package: '@deepseek-ai/dsh-client-ui-chat',
+ availableAt: AVAILABLE_BOTH,
+ upstreamPath: 'packages/client/ui-chat/src/client/chat/MessageIconActions.module.css',
+ mappedClass: 'action',
+ }),
+ reforkVariant('Chip', 'seat', {
package: '@deepseek-ai/dsh-client-ui-agent-preset',
availableAt: AVAILABLE_BOTH,
upstreamPath: 'packages/client/ui-agent-preset/src/client/AgentPresetSeat.module.css',
mappedClass: 'seat',
}),
- refork('ComposerTriggerChip', {
+ reforkVariant('Chip', 'composerTrigger', {
package: '@deepseek-ai/dsh-client-ui-permission-presets',
availableAt: AVAILABLE_LATEST,
upstreamPath: 'packages/client/ui-permission-presets/src/client/PermissionSelect.module.css',
mappedClass: 'trigger',
}),
- refork('MessageIconAction', {
- package: '@deepseek-ai/dsh-client-ui-chat',
- availableAt: AVAILABLE_BOTH,
- upstreamPath: 'packages/client/ui-chat/src/client/chat/MessageIconActions.module.css',
- mappedClass: 'action',
- }),
- refork('SettingsSelector', {
+ reforkVariant('Chip', 'selector', {
package: '@deepseek-ai/dsh-client-ui-permission-presets',
availableAt: AVAILABLE_BOTH,
upstreamPath: 'packages/client/ui-permission-presets/src/client/PermissionRow.module.css',
mappedClass: 'selector',
}),
- refork('VersionTag', {
+ reforkVariant('Tag', 'version', {
package: '@deepseek-ai/dsh-client-ui-plugin-manager',
availableAt: AVAILABLE_LATEST,
upstreamPath: 'packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css',
mappedClass: 'versionTag',
}),
- refork('StatusTag', {
+ reforkVariant('Tag', 'status', {
package: '@deepseek-ai/dsh-client-ui-plugin-manager',
availableAt: AVAILABLE_LATEST,
upstreamPath: 'packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css',
diff --git a/packages/dsh-tauri-ui/src/client/components/registry.types.ts b/packages/dsh-tauri-ui/src/client/components/registry.types.ts
new file mode 100644
index 00000000..efb5c47f
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/registry.types.ts
@@ -0,0 +1,16 @@
+export interface UiComponentSource {
+ kind: 'reexport' | 'refork'
+ component: string
+ variant?: string
+ package: string
+ version: string
+ availableAt: readonly string[]
+ upstreamPath: string
+ mappedClass?: string
+}
+
+export interface UiComponentEntry {
+ id: string
+ title: string
+ source: UiComponentSource
+}
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
deleted file mode 100644
index 107fc9e0..00000000
--- a/packages/dsh-tauri-ui/src/client/components/round-icon-button.cssr.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-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
deleted file mode 100644
index 1cf4bb11..00000000
--- a/packages/dsh-tauri-ui/src/client/components/round-icon-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 568e869c..00000000
--- a/packages/dsh-tauri-ui/src/client/components/round-icon-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 306d7589..00000000
--- a/packages/dsh-tauri-ui/src/client/components/row-icon-button.cssr.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-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
deleted file mode 100644
index b37b0525..00000000
--- a/packages/dsh-tauri-ui/src/client/components/row-icon-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index df2be515..00000000
--- a/packages/dsh-tauri-ui/src/client/components/row-icon-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 1fb60a4b..00000000
--- a/packages/dsh-tauri-ui/src/client/components/search-icon-button.cssr.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-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
deleted file mode 100644
index c1b97973..00000000
--- a/packages/dsh-tauri-ui/src/client/components/search-icon-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index abd36022..00000000
--- a/packages/dsh-tauri-ui/src/client/components/search-icon-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 63705372..00000000
--- a/packages/dsh-tauri-ui/src/client/components/seat-chip.cssr.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-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
deleted file mode 100644
index e9760b8c..00000000
--- a/packages/dsh-tauri-ui/src/client/components/seat-chip.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index f1d3aecf..00000000
--- a/packages/dsh-tauri-ui/src/client/components/seat-chip.types.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-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
deleted file mode 100644
index 848ed0f3..00000000
--- a/packages/dsh-tauri-ui/src/client/components/settings-selector.cssr.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index 115dbbda..00000000
--- a/packages/dsh-tauri-ui/src/client/components/settings-selector.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index d602d0cb..00000000
--- a/packages/dsh-tauri-ui/src/client/components/settings-selector.types.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-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/special-icons.tsx b/packages/dsh-tauri-ui/src/client/components/special-icons.tsx
deleted file mode 100644
index 6649b65a..00000000
--- a/packages/dsh-tauri-ui/src/client/components/special-icons.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import type { ReactElement, SVGProps } from 'react'
-
-export function FishMark({ width = 24, height = 24, ...props }: SVGProps<SVGSVGElement> = {}): ReactElement {
- return (
- <svg {...props} width={width} height={height} viewBox="0 0 24 24" fill="none" aria-hidden="true">
- <path d="M4 12c3-4.5 9-6 16-6 0 7-13 9-16 6Zm0 0c3 2.5 16 4.5 16-6" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
- <circle cx="15.5" cy="9.5" r="1" fill="currentColor" />
- </svg>
- )
-}
-
-export function PanelLeftOutline({ width = 16, height = 16, ...props }: SVGProps<SVGSVGElement> = {}): ReactElement {
- return (
- <svg {...props} width={width} height={height} viewBox="0 0 16 16" fill="none" aria-hidden="true">
- <rect x="2" y="3" width="12" height="10" rx="1.5" stroke="currentColor" strokeWidth="1.2" />
- <path d="M6.5 3v10" stroke="currentColor" strokeWidth="1.2" />
- </svg>
- )
-}
-
-export function IconPlaceholder({ width = 24, height = 24, ...props }: SVGProps<SVGSVGElement> = {}): ReactElement {
- return (
- <svg {...props} width={width} height={height} viewBox="0 0 24 24" fill="none" aria-hidden="true">
- <path fill="currentColor" d="M13 12.6V9q0-.425-.288-.712T12 8t-.712.288T11 9v3.975q0 .2.075.388t.225.337l2.8 2.8q.275.275.7.275t.7-.275t.275-.7t-.275-.7zm-4.512 8.688q-1.638-.713-2.85-1.925t-1.925-2.85T3 13t.713-3.512t1.924-2.85t2.85-1.925T12 4t3.513.713t2.85 1.925T21 13t-.712 3.513t-1.925 2.85t-2.85 1.925T12 22t-3.512-.712M2.05 7.3q-.275-.275-.275-.7t.275-.7L4.9 3.05q.275-.275.7-.275t.7.275t.275.7t-.275.7L3.45 7.3q-.275.275-.7.275t-.7-.275m19.9 0q-.275.275-.7.275t-.7-.275L17.7 4.45q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l2.85 2.85q.275.275.275.7t-.275.7M12 20q2.925 0 4.963-2.037T19 13t-2.037-4.962T12 6T7.038 8.038T5 13t2.038 4.963T12 20" />
- </svg>
- )
-}
-
-const CIRCLE_TREE_PATH = 'M2.327.504A.75.75 0 0 1 3 1.25V2a1.5 1.5 0 0 0 1.5 1.5h2.588A3.25 3.25 0 0 1 10.25 1l.167.004A3.25 3.25 0 0 1 13.5 4.25l-.004.167A3.25 3.25 0 0 1 10.25 7.5l-.167-.004A3.25 3.25 0 0 1 7.088 5H4.5c-.547 0-1.058-.15-1.5-.405V10a1.5 1.5 0 0 0 1.5 1.5h2.588a3.25 3.25 0 1 1 0 1.5H4.5a3 3 0 0 1-3-3V1.25A.75.75 0 0 1 2.25.5zM10.25 10.5a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5m0-8a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5'
-
-export function clockSvg(size: number): string {
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 16 16" fill="none"><path fill="currentColor" fill-rule="evenodd" d="M13.5 8a5.5 5.5 0 1 1-11 0 5.5 5.5 0 1 1 11 0M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0M8.75 4.5a.75.75 0 0 0-1.5 0V8a.75.75 0 0 0 .3.6l2 1.5a.75.75 0 1 0 .9-1.2l-1.7-1.275z" clip-rule="evenodd"/></svg>`
-}
-
-export function circleTreeSvg(size: number): string {
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="none" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="${CIRCLE_TREE_PATH}" clip-rule="evenodd"/></svg>`
-}
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
deleted file mode 100644
index 0592d25d..00000000
--- a/packages/dsh-tauri-ui/src/client/components/status-tag.cssr.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-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
deleted file mode 100644
index da41c514..00000000
--- a/packages/dsh-tauri-ui/src/client/components/status-tag.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index c96165d4..00000000
--- a/packages/dsh-tauri-ui/src/client/components/status-tag.types.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-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/tag.cssr.ts b/packages/dsh-tauri-ui/src/client/components/tag.cssr.ts
new file mode 100644
index 00000000..e1e1516b
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/tag.cssr.ts
@@ -0,0 +1,55 @@
+import { styles as sharedStyles } from '../constants/theme'
+import { cssr } from '../utils/cssr'
+
+const { c, bem: { b, m } } = cssr
+const { borderL4, business, error, modulePlatform, secondary, tertiary } = sharedStyles
+
+export default b('tag', {}, [
+ m('version', {
+ 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,
+ }),
+ ]),
+ m('status', {
+ 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/tag.tsx b/packages/dsh-tauri-ui/src/client/components/tag.tsx
new file mode 100644
index 00000000..a0ff449d
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/tag.tsx
@@ -0,0 +1,27 @@
+import type { ReactElement } from 'react'
+import type { TagProps } from './tag.types'
+import { Tag as PrimitiveTag } from '@deepseek-ai/dsh-client-ui-primitives'
+import { compact } from 'dsh-tauri/client'
+import { useMountStyle } from '../hooks/use-mount-style'
+import tagStyle from './tag.cssr'
+
+const TAG_STYLE_ID = 'dsh-tauri-ui-tag-styles'
+
+function LocalTag({ variant, tone = 'outline', className, children, ...rest }: TagProps & { variant: 'version' | 'status' }): ReactElement {
+ useMountStyle(tagStyle, TAG_STYLE_ID)
+ return (
+ <span
+ className={compact(['dshp-tag', `dshp-tag--${variant}`, className]).join(' ')}
+ data-tone={tone}
+ {...rest}
+ >
+ {children}
+ </span>
+ )
+}
+
+export function Tag({ variant = 'default', tone = 'outline', className, children, ...rest }: TagProps): ReactElement {
+ if (variant === 'default')
+ return <PrimitiveTag tone={tone} className={className}>{children}</PrimitiveTag>
+ return <LocalTag variant={variant} tone={tone} className={className} {...rest}>{children}</LocalTag>
+}
diff --git a/packages/dsh-tauri-ui/src/client/components/tag.types.ts b/packages/dsh-tauri-ui/src/client/components/tag.types.ts
new file mode 100644
index 00000000..92b3a4e4
--- /dev/null
+++ b/packages/dsh-tauri-ui/src/client/components/tag.types.ts
@@ -0,0 +1,11 @@
+import type { HTMLAttributes, ReactNode } from 'react'
+
+export type TagVariant = 'default' | 'version' | 'status'
+
+export type TagTone = 'outline' | 'solid' | 'neutral' | 'quiet' | 'success' | 'info' | 'warning' | 'danger'
+
+export interface TagProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
+ variant?: TagVariant
+ tone?: TagTone
+ children?: ReactNode
+}
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
deleted file mode 100644
index 33fd6146..00000000
--- a/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.cssr.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-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
deleted file mode 100644
index f855ac3d..00000000
--- a/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index ba8be670..00000000
--- a/packages/dsh-tauri-ui/src/client/components/toolbar-icon-button.types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 50d92525..00000000
--- a/packages/dsh-tauri-ui/src/client/components/version-tag.cssr.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-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
deleted file mode 100644
index 75e374e6..00000000
--- a/packages/dsh-tauri-ui/src/client/components/version-tag.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index 037473b2..00000000
--- a/packages/dsh-tauri-ui/src/client/components/version-tag.types.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-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 1db192e9..4e79172c 100644
--- a/packages/dsh-tauri-ui/src/client/constants/index.ts
+++ b/packages/dsh-tauri-ui/src/client/constants/index.ts
@@ -13,34 +13,6 @@ export const SETTINGS_ONBOARDING_SLOT = 'settings.onboarding'
export const SETTINGS_SIDEBAR_ID = 'dsh-tauri-ui-settings'
export const SETTINGS_SIDEBAR_CLASS = 'dshp-settings-sidebar'
-export const SETTINGS_STYLE_ID = 'dsh-tauri-ui-settings-sidebar-styles'
-export const SETTINGS_TRIGGER_STYLE_ID = 'dsh-tauri-ui-settings-trigger-styles'
-export const SETTINGS_NAV_ICON_STYLE_ID = 'dsh-tauri-ui-settings-nav-icon-styles'
-export const MENU_SELECT_STYLE_ID = 'dsh-tauri-ui-menu-select-styles'
-export const HERO_WORKSPACE_STYLE_ID = 'dsh-tauri-ui-hero-workspace-styles'
-export const TURN_NAVIGATION_STYLE_ID = 'dsh-tauri-ui-turn-navigation-styles'
-export const GLOBAL_STYLE_ID = 'dsh-tauri-ui-global-styles'
-export const SEGMENTED_CONTROL_STYLE_ID = 'dsh-tauri-ui-segmented-control-styles'
-export const CHECKBOX_STYLE_ID = 'dsh-tauri-ui-checkbox-styles'
-export const MODEL_EXTRAS_STYLE_ID = 'dsh-tauri-ui-model-extras-styles'
-export const MODEL_CONFIG_TOOLBAR_STYLE_ID = 'dsh-tauri-ui-model-config-toolbar-styles'
-export const MODEL_COMPAT_FIELDS_STYLE_ID = 'dsh-tauri-ui-model-compat-fields-styles'
-export const NEW_SESSION_BUTTON_STYLE_ID = 'dsh-tauri-ui-new-session-button-styles'
-export const SEARCH_ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-search-icon-button-styles'
-export const TOOLBAR_ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-toolbar-icon-button-styles'
-export const ADD_BUTTON_STYLE_ID = 'dsh-tauri-ui-add-button-styles'
-export const DANGER_OUTLINE_BUTTON_STYLE_ID = 'dsh-tauri-ui-danger-outline-button-styles'
-export const ROW_ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-row-icon-button-styles'
-export const HELP_ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-help-icon-button-styles'
-export const SEAT_CHIP_STYLE_ID = 'dsh-tauri-ui-seat-chip-styles'
-export const COMPOSER_TRIGGER_CHIP_STYLE_ID = 'dsh-tauri-ui-composer-trigger-chip-styles'
-export const MESSAGE_ICON_ACTION_STYLE_ID = 'dsh-tauri-ui-message-icon-action-styles'
-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 组件」调试面板。
*
@@ -50,9 +22,8 @@ export const ROUND_ICON_BUTTON_STYLE_ID = 'dsh-tauri-ui-round-icon-button-styles
*/
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`)。 */
+/** 接管后的英雄区工作区选择控件(官方 chip 由样式隐藏,见 `ui/hero-workspace.cssr.ts`)。 */
export const HERO_WORKSPACE_CHIP_CLASS = 'dshp-hero-workspace'
/**
diff --git a/packages/dsh-tauri-ui/src/client/index.ts b/packages/dsh-tauri-ui/src/client/index.ts
index b8c01e41..864a8390 100644
--- a/packages/dsh-tauri-ui/src/client/index.ts
+++ b/packages/dsh-tauri-ui/src/client/index.ts
@@ -15,9 +15,6 @@ import { registerSettings } from './register/settings'
import { registerStyles } from './register/styles'
export * from './components'
-export type * from './components/menu-select.types'
-export type * from './components/sidebar.types'
-export type * from './components/trigger.types'
export * from './constants/theme'
export * from './hooks/use-mount-style'
export * from './service/editor'
@@ -32,6 +29,12 @@ export type * from './store/modules/settings.types'
export * from './types/remotes'
export type * from './types/sections'
export type * from './types/selector'
+export * from './ui/model-extras'
+export * from './ui/panel-page'
+export * from './ui/segmented-control'
+export type * from './ui/segmented-control.types'
+export type * from './ui/sidebar.types'
+export type * from './ui/trigger.types'
export * from './utils/cssr'
export * from './utils/style'
diff --git a/packages/dsh-tauri-ui/src/client/register/components-playground.tsx b/packages/dsh-tauri-ui/src/client/register/components-playground.tsx
index 265240a4..ab845161 100644
--- a/packages/dsh-tauri-ui/src/client/register/components-playground.tsx
+++ b/packages/dsh-tauri-ui/src/client/register/components-playground.tsx
@@ -2,7 +2,7 @@ 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 { PanelPage } from '../ui/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'
diff --git a/packages/dsh-tauri-ui/src/client/register/hero-workspace.test.ts b/packages/dsh-tauri-ui/src/client/register/hero-workspace.test.ts
index d0fbed58..69d9de46 100644
--- a/packages/dsh-tauri-ui/src/client/register/hero-workspace.test.ts
+++ b/packages/dsh-tauri-ui/src/client/register/hero-workspace.test.ts
@@ -23,7 +23,7 @@ const mocks = vi.hoisted(() => ({
vi.mock('../service/ungrouped-session', () => ({ startUngroupedSession: mocks.startUngroupedSession }))
// 组件树会拉起官方 primitives(含 `.module.css`,node 环境下不可加载):这里只验注册契约,替身即可。
-vi.mock('../components/hero-workspace', () => ({ HeroWorkspace: () => null }))
+vi.mock('../ui/hero-workspace', () => ({ HeroWorkspace: () => null }))
vi.mock('dsh-tauri/client', () => ({
defineRegister: (ctxOrSetup: unknown, maybeSetup?: unknown) => {
diff --git a/packages/dsh-tauri-ui/src/client/register/hero-workspace.ts b/packages/dsh-tauri-ui/src/client/register/hero-workspace.ts
index 717096e7..75cb2e39 100644
--- a/packages/dsh-tauri-ui/src/client/register/hero-workspace.ts
+++ b/packages/dsh-tauri-ui/src/client/register/hero-workspace.ts
@@ -1,13 +1,13 @@
import type { AdapterWorkspaces, ClientAdapter, ClientContext } from 'dsh-tauri/client'
import { defineRegister } from 'dsh-tauri/client'
import { PLUGIN_ID } from '../../shared/constants'
-import { HeroWorkspace } from '../components/hero-workspace'
import {
HERO_WORKSPACE_FLOW_SLOT,
HERO_WORKSPACE_PRIORITY,
HERO_WORKSPACE_SLOT,
} from '../constants'
import { startUngroupedSession } from '../service/ungrouped-session'
+import { HeroWorkspace } from '../ui/hero-workspace'
/**
* 接管官方 `conversation.hero.workspace`(single/root):按更低 priority 顶掉官方 `WorkspacePicker`,
diff --git a/packages/dsh-tauri-ui/src/client/register/im-panel.tsx b/packages/dsh-tauri-ui/src/client/register/im-panel.tsx
index 2c913d02..d3b77423 100644
--- a/packages/dsh-tauri-ui/src/client/register/im-panel.tsx
+++ b/packages/dsh-tauri-ui/src/client/register/im-panel.tsx
@@ -2,7 +2,7 @@ import type { ClientContext } from 'dsh-tauri/client'
import { definePanel, defineRegister } from 'dsh-tauri/client'
import { Icon } from '../components/icon'
import { Comments } from '../components/icons'
-import { PanelPage } from '../components/panel-page'
+import { PanelPage } from '../ui/panel-page'
import { DSH_IM_CLIENT_SERVICE } from '../constants'
import { locale } from '../locales'
import { readDshImClient } from '../service/dsh-im'
diff --git a/packages/dsh-tauri-ui/src/client/register/seat.ts b/packages/dsh-tauri-ui/src/client/register/seat.ts
index 5fc2d975..08e458c9 100644
--- a/packages/dsh-tauri-ui/src/client/register/seat.ts
+++ b/packages/dsh-tauri-ui/src/client/register/seat.ts
@@ -1,11 +1,11 @@
import type { ClientContext } from 'dsh-tauri/client'
import { defineRegister } from 'dsh-tauri/client'
-import { TauriUiSeat } from '../components/seat'
import {
SETTINGS_REGISTRANT,
SETTINGS_SHELL_OVERLAY_SLOT,
SETTINGS_SHELL_SEAT_ID,
} from '../constants'
+import { TauriUiSeat } from '../ui/seat'
export const registerShellSeat = defineRegister<ClientContext>((controller, ctx) => {
controller.add(
diff --git a/packages/dsh-tauri-ui/src/client/register/settings.ts b/packages/dsh-tauri-ui/src/client/register/settings.ts
index d4ce8fe0..ca18b2dc 100644
--- a/packages/dsh-tauri-ui/src/client/register/settings.ts
+++ b/packages/dsh-tauri-ui/src/client/register/settings.ts
@@ -1,8 +1,6 @@
import type { ClientContext } from 'dsh-tauri/client'
import { SlotOutlet } from '@deepseek-ai/dsh-client-ui-renderer'
import { defineRegister } from 'dsh-tauri/client'
-import { SettingsSidebar } from '../components/sidebar'
-import { SettingsTrigger } from '../components/trigger'
import {
SETTINGS_REGISTRANT,
SETTINGS_SHELL_OVERLAY_SLOT,
@@ -10,6 +8,8 @@ import {
SETTINGS_SIDEBAR_SLOT,
SETTINGS_TRIGGER_PRIORITY,
} from '../constants'
+import { SettingsSidebar } from '../ui/sidebar'
+import { SettingsTrigger } from '../ui/trigger'
export const registerSettings = defineRegister<ClientContext>((controller, ctx) => {
if (typeof SlotOutlet !== 'function') {
diff --git a/packages/dsh-tauri-ui/src/client/register/styles.ts b/packages/dsh-tauri-ui/src/client/register/styles.ts
index 4659b4cf..e6854f93 100644
--- a/packages/dsh-tauri-ui/src/client/register/styles.ts
+++ b/packages/dsh-tauri-ui/src/client/register/styles.ts
@@ -1,19 +1,14 @@
import type { ClientContext } from 'dsh-tauri/client'
import { defineRegister } from 'dsh-tauri/client'
import checkboxStyle from '../components/checkbox.cssr'
-import { configEditorStyle } from '../components/model-extras/config-editor.cssr'
-import modelCompatFieldsStyle from '../components/model-extras/model-compat-fields.cssr'
-import modelExtrasStyle from '../components/model-extras/model-extras.cssr'
-import segmentedControlStyle from '../components/segmented-control.cssr'
-import {
- CHECKBOX_STYLE_ID,
- GLOBAL_STYLE_ID,
- MODEL_COMPAT_FIELDS_STYLE_ID,
- MODEL_CONFIG_TOOLBAR_STYLE_ID,
- MODEL_EXTRAS_STYLE_ID,
- SEGMENTED_CONTROL_STYLE_ID,
- TURN_NAVIGATION_STYLE_ID,
-} from '../constants'
+import { configEditorStyle, MODEL_CONFIG_TOOLBAR_STYLE_ID } from '../ui/model-extras/config-editor.cssr'
+import modelCompatFieldsStyle, { MODEL_COMPAT_FIELDS_STYLE_ID } from '../ui/model-extras/model-compat-fields.cssr'
+import modelExtrasStyle, { MODEL_EXTRAS_STYLE_ID } from '../ui/model-extras/model-extras.cssr'
+import segmentedControlStyle from '../ui/segmented-control.cssr'
+import { CHECKBOX_STYLE_ID } from '../components/checkbox'
+import { GLOBAL_STYLE_ID } from '../styles/global.cssr'
+import { TURN_NAVIGATION_STYLE_ID } from '../styles/index.cssr'
+import { SEGMENTED_CONTROL_STYLE_ID } from '../ui/segmented-control'
import globalStyle from '../styles/global.cssr'
import turnNavigationStyle from '../styles/index.cssr'
import { mountStyle } from '../utils/style'
diff --git a/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts b/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts
index 506f8355..da3961ff 100644
--- a/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/styles/global.cssr.ts
@@ -1,5 +1,7 @@
import { cssr } from '../utils/cssr'
+export const GLOBAL_STYLE_ID = 'dsh-tauri-ui-global-styles'
+
const { c } = cssr
export default c([
diff --git a/packages/dsh-tauri-ui/src/client/styles/index.cssr.ts b/packages/dsh-tauri-ui/src/client/styles/index.cssr.ts
index 82c892ee..bfbcddc5 100644
--- a/packages/dsh-tauri-ui/src/client/styles/index.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/styles/index.cssr.ts
@@ -1,6 +1,8 @@
import { TURN_NAVIGATION_SLOT_SELECTOR } from '../constants'
import { cssr } from '../utils/cssr'
+export const TURN_NAVIGATION_STYLE_ID = 'dsh-tauri-ui-turn-navigation-styles'
+
const { c } = cssr
export default c(TURN_NAVIGATION_SLOT_SELECTOR, {
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
index d283606c..d4579dfe 100644
--- 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
@@ -1,29 +1,18 @@
import type { ReactElement } from 'react'
-import type { UiComponentEntry } from '../../components/registry'
+import type { UiComponentEntry } from '../../components/registry.types'
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 { Button } from '../../components/button'
+import { Chip } from '../../components/chip'
import { Icon } from '../../components/icon'
+import { IconButton } from '../../components/icon-button'
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 { Input, Pill, Switch } 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 { Tag } from '../../components/tag'
import { useMountStyle } from '../../hooks/use-mount-style'
import uiComponentsStyle from './ui-components.cssr'
+const UI_COMPONENTS_STYLE_ID = 'dsh-tauri-ui-components-styles'
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
@@ -37,7 +26,11 @@ function SourceCard({ entry }: { entry: UiComponentEntry }): ReactElement {
<span className="dshp-ui-components__badge">{source.kind}</span>
</div>
<div className="dshp-ui-components__meta">
- <span>{`映射组件:${source.component}`}</span>
+ <span>
+ {source.variant === undefined
+ ? `映射组件:${source.component}`
+ : `映射组件:${source.component} · ${source.variant}`}
+ </span>
<span className="dshp-ui-components__code">{source.package}</span>
<span>{`版本:${source.availableAt.join(' / ')}`}</span>
{source.mappedClass === undefined
@@ -92,39 +85,45 @@ export function UiComponentsPanel(): ReactElement {
</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>
+ <Button icon={<Plus width={16} height={16} />} variant="elevated">新建会话</Button>
+ <Button disabled icon={<Plus width={16} height={16} />} variant="elevated">禁用态</Button>
+ <Button icon={<Plus width={16} height={16} />} variant="add">添加模型</Button>
+ <Button icon={<TrashBin width={16} height={16} />} variant="danger">删除</Button>
+ <Button icon={<TrashBin width={16} height={16} />} size="sm" variant="danger">删除 / sm</Button>
</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} />} />
+ <IconButton aria-label="搜索" icon={<Magnifier width={16} height={16} />} variant="search" />
+ <IconButton aria-label="工具栏" icon={<Gear width={16} height={16} />} variant="toolbar" />
+ <IconButton aria-label="模型" icon={<Puzzle width={16} height={16} />} variant="model" />
+ <IconButton aria-label="圆形" icon={<Plus width={16} height={16} />} variant="round" />
+ <IconButton aria-label="行内" icon={<TrashBin width={16} height={16} />} variant="row" />
+ <IconButton aria-expanded aria-label="帮助" icon={<Person width={16} height={16} />} variant="help" />
+ <IconButton aria-label="消息动作" icon={<Comments width={16} height={16} />} variant="action" />
</div>
<div className="dshp-ui-components__sample">
- <SeatChip chevron={<ChevronDown width={12} height={12} />} icon={<Person width={14} height={14} />}>
+ <Chip chevron={<ChevronDown width={12} height={12} />} icon={<Person width={14} height={14} />} variant="seat">
默认
- </SeatChip>
- <ComposerTriggerChip
+ </Chip>
+ <Chip
chevron={<ChevronDown width={12} height={12} />}
icon={<Gear width={14} height={14} />}
open
+ variant="composerTrigger"
>
默认权限
- </ComposerTriggerChip>
- <ComposerTriggerChip chevron={<ChevronDown width={12} height={12} />} icon={<Gear width={14} height={14} />}>
+ </Chip>
+ <Chip
+ chevron={<ChevronDown width={12} height={12} />}
+ icon={<Gear width={14} height={14} />}
+ variant="composerTrigger"
+ >
收起态
- </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>
+ </Chip>
+ <Chip chevron={<ChevronDown width={12} height={12} />} variant="selector">跟随系统</Chip>
+ <Tag variant="version">1.0.0</Tag>
+ <Tag tone="neutral" variant="version">1.0.0</Tag>
+ <Tag tone="outline" variant="status">outline</Tag>
+ <Tag tone="info" variant="status">info</Tag>
+ <Tag tone="danger" variant="status">danger</Tag>
</div>
</section>
diff --git a/packages/dsh-tauri-ui/src/client/components/controls.test.tsx b/packages/dsh-tauri-ui/src/client/ui/controls.test.tsx
similarity index 98%
rename from packages/dsh-tauri-ui/src/client/components/controls.test.tsx
rename to packages/dsh-tauri-ui/src/client/ui/controls.test.tsx
index 485ae034..772fc782 100644
--- a/packages/dsh-tauri-ui/src/client/components/controls.test.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/controls.test.tsx
@@ -1,7 +1,7 @@
import type { SegmentedControlOption } from './segmented-control.types'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
-import { Checkbox } from './checkbox'
+import { Checkbox } from '../components/checkbox'
import { SegmentedControl, stepSegment } from './segmented-control'
const OPTIONS: SegmentedControlOption[] = [
diff --git a/packages/dsh-tauri-ui/src/client/components/hero-workspace.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/hero-workspace.cssr.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/hero-workspace.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/hero-workspace.cssr.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/hero-workspace.tsx b/packages/dsh-tauri-ui/src/client/ui/hero-workspace.tsx
similarity index 98%
rename from packages/dsh-tauri-ui/src/client/components/hero-workspace.tsx
rename to packages/dsh-tauri-ui/src/client/ui/hero-workspace.tsx
index 4024c6f2..37394292 100644
--- a/packages/dsh-tauri-ui/src/client/components/hero-workspace.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/hero-workspace.tsx
@@ -13,15 +13,16 @@ import {
} from '@deepseek-ai/dsh-client-ui-primitives'
import { SlotOutlet } from '@deepseek-ai/dsh-client-ui-renderer'
import { useCallback, useRef, useState } from 'react'
+import { ChevronDown, Folder as FolderClose, FolderOpen, Plus } from '../components/icons'
import {
HERO_WORKSPACE_CHIP_CLASS,
HERO_WORKSPACE_FLOW_SLOT,
- HERO_WORKSPACE_STYLE_ID,
} from '../constants'
import { useMountStyle } from '../hooks/use-mount-style'
import { locale } from '../locales'
import heroWorkspaceStyle from './hero-workspace.cssr'
-import { ChevronDown, Folder as FolderClose, FolderOpen, Plus } from './icons'
+
+const HERO_WORKSPACE_STYLE_ID = 'dsh-tauri-ui-hero-workspace-styles'
/** 官方 `WorkspacePickFlow` 的「添加工作区」条目 id,逐字复用以免与官方菜单语义分叉。 */
const ADD_WORKSPACE_ID = '::add-workspace'
diff --git a/packages/dsh-tauri-ui/src/client/components/hero-workspace.types.ts b/packages/dsh-tauri-ui/src/client/ui/hero-workspace.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/hero-workspace.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/hero-workspace.types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/auto-config-all-button.tsx b/packages/dsh-tauri-ui/src/client/ui/model-extras/auto-config-all-button.tsx
similarity index 91%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/auto-config-all-button.tsx
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/auto-config-all-button.tsx
index 52080837..e9b8b16a 100644
--- a/packages/dsh-tauri-ui/src/client/components/model-extras/auto-config-all-button.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/model-extras/auto-config-all-button.tsx
@@ -1,8 +1,7 @@
import type { ReactElement } from 'react'
import type { AutoConfigAllButtonProps } from './auto-config-all-button.types'
-import { MODEL_EXTRAS_STYLE_ID } from '../../constants'
import { useMountStyle } from '../../hooks/use-mount-style'
-import modelExtrasStyle from './model-extras.cssr'
+import modelExtrasStyle, { MODEL_EXTRAS_STYLE_ID } from './model-extras.cssr'
import { useModelConfigFetch } from './use-model-config-fetch'
export function AutoConfigAllButton({ t, models, probe, operations, disabled, onApply }: AutoConfigAllButtonProps): ReactElement {
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/auto-config-all-button.types.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/auto-config-all-button.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/auto-config-all-button.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/auto-config-all-button.types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/config-editor.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/config-editor.cssr.ts
similarity index 98%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/config-editor.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/config-editor.cssr.ts
index 7403f172..cb7683a6 100644
--- a/packages/dsh-tauri-ui/src/client/components/model-extras/config-editor.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/ui/model-extras/config-editor.cssr.ts
@@ -1,5 +1,7 @@
import { cssr } from '../../utils/cssr'
+export const MODEL_CONFIG_TOOLBAR_STYLE_ID = 'dsh-tauri-ui-model-config-toolbar-styles'
+
const { c } = cssr
const vscode = '<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="100" height="100"><path fill-rule="evenodd" clip-rule="evenodd" d="M70.9119 99.3171C72.4869 99.9307 74.2828 99.8914 75.8725 99.1264L96.4608 89.2197C98.6242 88.1787 100 85.9892 100 83.5872V16.4133C100 14.0113 98.6243 11.8218 96.4609 10.7808L75.8725 0.873756C73.7862 -0.130129 71.3446 0.11576 69.5135 1.44695C69.252 1.63711 69.0028 1.84943 68.769 2.08341L29.3551 38.0415L12.1872 25.0096C10.589 23.7965 8.35363 23.8959 6.86933 25.2461L1.36303 30.2549C-0.452552 31.9064 -0.454633 34.7627 1.35853 36.417L16.2471 50.0001L1.35853 63.5832C-0.454633 65.2374 -0.452552 68.0938 1.36303 69.7453L6.86933 74.7541C8.35363 76.1043 10.589 76.2037 12.1872 74.9905L29.3551 61.9587L68.769 97.9167C69.3925 98.5406 70.1246 99.0104 70.9119 99.3171ZM75.0152 27.2989L45.1091 50.0001L75.0152 72.7012V27.2989Z" fill="white"/></mask><g mask="url(#mask0)"><path d="M96.4614 10.7962L75.8569 0.875542C73.4719 -0.272773 70.6217 0.211611 68.75 2.08333L1.29858 63.5832C-0.515693 65.2373 -0.513607 68.0937 1.30308 69.7452L6.81272 74.754C8.29793 76.1042 10.5347 76.2036 12.1338 74.9905L93.3609 13.3699C96.086 11.3026 100 13.2462 100 16.6667V16.4275C100 14.0265 98.6246 11.8378 96.4614 10.7962Z" fill="#0065A9"/><g filter="url(#filter0_d)"><path d="M96.4614 89.2038L75.8569 99.1245C73.4719 100.273 70.6217 99.7884 68.75 97.9167L1.29858 36.4169C-0.515693 34.7627 -0.513607 31.9063 1.30308 30.2548L6.81272 25.246C8.29793 23.8958 10.5347 23.7964 12.1338 25.0095L93.3609 86.6301C96.086 88.6974 100 86.7538 100 83.3334V83.5726C100 85.9735 98.6246 88.1622 96.4614 89.2038Z" fill="#007ACC"/></g><g filter="url(#filter1_d)"><path d="M75.8578 99.1263C73.4721 100.274 70.6219 99.7885 68.75 97.9166C71.0564 100.223 75 98.5895 75 95.3278V4.67213C75 1.41039 71.0564 -0.223106 68.75 2.08329C70.6219 0.211402 73.4721 -0.273666 75.8578 0.873633L96.4587 10.7807C98.6234 11.8217 100 14.0112 100 16.4132V83.5871C100 85.9891 98.6234 88.1786 96.4586 89.2196L75.8578 99.1263Z" fill="#1F9CF0"/></g><g style="mix-blend-mode:overlay" opacity="0.25"><path fill-rule="evenodd" clip-rule="evenodd" d="M70.8511 99.3171C72.4261 99.9306 74.2221 99.8913 75.8117 99.1264L96.4 89.2197C98.5634 88.1787 99.9392 85.9892 99.9392 83.5871V16.4133C99.9392 14.0112 98.5635 11.8217 96.4001 10.7807L75.8117 0.873695C73.7255 -0.13019 71.2838 0.115699 69.4527 1.44688C69.1912 1.63705 68.942 1.84937 68.7082 2.08335L29.2943 38.0414L12.1264 25.0096C10.5283 23.7964 8.29285 23.8959 6.80855 25.246L1.30225 30.2548C-0.513334 31.9064 -0.515415 34.7627 1.29775 36.4169L16.1863 50L1.29775 63.5832C-0.515415 65.2374 -0.513334 68.0937 1.30225 69.7452L6.80855 74.754C8.29285 76.1042 10.5283 76.2036 12.1264 74.9905L29.2943 61.9586L68.7082 97.9167C69.3317 98.5405 70.0638 99.0104 70.8511 99.3171ZM74.9544 27.2989L45.0483 50L74.9544 72.7012V27.2989Z" fill="url(#paint0_linear)"/></g></g><defs><filter id="filter0_d" x="-8.39411" y="15.8291" width="116.727" height="92.2456" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset/><feGaussianBlur stdDeviation="4.16667"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend mode="overlay" in2="BackgroundImageFix" result="effect1_dropShadow"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/></filter><filter id="filter1_d" x="60.4167" y="-8.07558" width="47.9167" height="116.151" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset/><feGaussianBlur stdDeviation="4.16667"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend mode="overlay" in2="BackgroundImageFix" result="effect1_dropShadow"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/></filter><linearGradient id="paint0_linear" x1="49.9392" y1="0.257812" x2="49.9392" y2="99.7423" gradientUnits="userSpaceOnUse"><stop stop-color="white"/><stop offset="1" stop-color="white" stop-opacity="0"/></linearGradient></defs></svg>'
const cursor = '<svg id="Ebene_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 466.73 532.09"><defs><style>\n .st0 {\n fill: #26251e;\n }\n </style></defs><path class="st0" d="M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"/></svg>'
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/index.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/index.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/index.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/index.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.cssr.ts
similarity index 94%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.cssr.ts
index f7519dfc..58f7868d 100644
--- a/packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.cssr.ts
@@ -1,6 +1,8 @@
import { styles as sharedStyles } from '../../constants/theme'
import { cssr } from '../../utils/cssr'
+export const MODEL_COMPAT_FIELDS_STYLE_ID = 'dsh-tauri-ui-model-compat-fields-styles'
+
const { c } = cssr
const { secondary, tertiary, borderL3, brand, focusRing } = sharedStyles
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.test.tsx b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.test.tsx
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.test.tsx
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.test.tsx
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.tsx b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.tsx
similarity index 96%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.tsx
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.tsx
index 7e7319c7..e48655b6 100644
--- a/packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.tsx
@@ -1,7 +1,6 @@
import type { ReactElement } from 'react'
import type { ModelCompatFieldsProps } from './model-compat-fields.types'
import { Switch } from '@deepseek-ai/dsh-client-ui-primitives'
-import { MODEL_COMPAT_FIELDS_STYLE_ID } from '../../constants'
import { useMountStyle } from '../../hooks/use-mount-style'
import {
declaredThinkingLevels,
@@ -13,7 +12,7 @@ import {
thinkingEffortsOf,
toggleThinkingLevel,
} from '../../service/model-compat'
-import modelCompatFieldsStyle from './model-compat-fields.cssr'
+import modelCompatFieldsStyle, { MODEL_COMPAT_FIELDS_STYLE_ID } from './model-compat-fields.cssr'
export function ModelCompatFields({
t,
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.types.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-compat-fields.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-compat-fields.types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-config-toolbar.tsx b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-config-toolbar.tsx
similarity index 96%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-config-toolbar.tsx
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-config-toolbar.tsx
index 98ebbb3a..a911b382 100644
--- a/packages/dsh-tauri-ui/src/client/components/model-extras/model-config-toolbar.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-config-toolbar.tsx
@@ -3,13 +3,12 @@ import type { ReactElement } from 'react'
import type { ModelConfigToolbarProps } from './model-config-toolbar.types'
import { Button, Menu, Modal } from '@deepseek-ai/dsh-client-ui-primitives'
import { useState } from 'react'
-import { MODEL_CONFIG_TOOLBAR_STYLE_ID, MODEL_EXTRAS_STYLE_ID } from '../../constants'
+import { ChevronDown } from '../../components/icons'
import { useMountStyle } from '../../hooks/use-mount-style'
import { loadEditor, saveEditor } from '../../service/editor'
import { withDetail } from '../../service/model-config.utils'
-import { ChevronDown } from '../icons'
-import { configEditorStyle } from './config-editor.cssr'
-import modelExtrasStyle from './model-extras.cssr'
+import { configEditorStyle, MODEL_CONFIG_TOOLBAR_STYLE_ID } from './config-editor.cssr'
+import modelExtrasStyle, { MODEL_EXTRAS_STYLE_ID } from './model-extras.cssr'
const SEPARATOR: MenuEntry = { id: 'separator', type: 'separator' }
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-config-toolbar.types.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-config-toolbar.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-config-toolbar.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-config-toolbar.types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-extras.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-extras.cssr.ts
similarity index 97%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-extras.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-extras.cssr.ts
index 150d10b5..e5bf62eb 100644
--- a/packages/dsh-tauri-ui/src/client/components/model-extras/model-extras.cssr.ts
+++ b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-extras.cssr.ts
@@ -1,6 +1,8 @@
import { styles as sharedStyles } from '../../constants/theme'
import { cssr } from '../../utils/cssr'
+export const MODEL_EXTRAS_STYLE_ID = 'dsh-tauri-ui-model-extras-styles'
+
const { c } = cssr
const { primary, secondary, tertiary, error, success, hover, borderL4, layer1, modulePlatform, focusRing } = sharedStyles
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-extras.test.tsx b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-extras.test.tsx
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-extras.test.tsx
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-extras.test.tsx
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-fetch-config-button.tsx b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-fetch-config-button.tsx
similarity index 92%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-fetch-config-button.tsx
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-fetch-config-button.tsx
index 5e8f2bb1..27cffd61 100644
--- a/packages/dsh-tauri-ui/src/client/components/model-extras/model-fetch-config-button.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-fetch-config-button.tsx
@@ -1,9 +1,8 @@
import type { ReactElement } from 'react'
import type { ModelFetchConfigButtonProps } from './model-fetch-config-button.types'
-import { MODEL_EXTRAS_STYLE_ID } from '../../constants'
import { useMountStyle } from '../../hooks/use-mount-style'
import { hasModelConfig } from '../../service/model-config.utils'
-import modelExtrasStyle from './model-extras.cssr'
+import modelExtrasStyle, { MODEL_EXTRAS_STYLE_ID } from './model-extras.cssr'
import { useModelConfigFetch } from './use-model-config-fetch'
export function ModelFetchConfigButton({
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/model-fetch-config-button.types.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/model-fetch-config-button.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/model-fetch-config-button.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/model-fetch-config-button.types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/translate.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/translate.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/translate.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/translate.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/types.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/types.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/model-extras/use-model-config-fetch.ts b/packages/dsh-tauri-ui/src/client/ui/model-extras/use-model-config-fetch.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/model-extras/use-model-config-fetch.ts
rename to packages/dsh-tauri-ui/src/client/ui/model-extras/use-model-config-fetch.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/nav-icon.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/nav-icon.cssr.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/nav-icon.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/nav-icon.cssr.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/nav-icon.tsx b/packages/dsh-tauri-ui/src/client/ui/nav-icon.tsx
similarity index 69%
rename from packages/dsh-tauri-ui/src/client/components/nav-icon.tsx
rename to packages/dsh-tauri-ui/src/client/ui/nav-icon.tsx
index 3fdd758b..0d1a9275 100644
--- a/packages/dsh-tauri-ui/src/client/components/nav-icon.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/nav-icon.tsx
@@ -1,10 +1,10 @@
import type { ReactElement } from 'react'
-import type { IconComponent } from './icon'
+import type { IconComponent } from '../components/icon.types'
import { get } from 'dsh-tauri/client'
-import { SETTINGS_NAV_ICON_STYLE_ID } from '../constants'
+import { Icon } from '../components/icon'
+import { Database, Gear, Person, Puzzle } from '../components/icons'
+const SETTINGS_NAV_ICON_STYLE_ID = 'dsh-tauri-ui-settings-nav-icon-styles'
import { useMountStyle } from '../hooks/use-mount-style'
-import { Icon } from './icon'
-import { Database, Gear, Person, Puzzle } from './icons'
import settingsNavIconStyle from './nav-icon.cssr'
const NAV_ICONS: Record<string, IconComponent> = {
diff --git a/packages/dsh-tauri-ui/src/client/components/panel-page.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/panel-page.cssr.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/panel-page.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/panel-page.cssr.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/panel-page.tsx b/packages/dsh-tauri-ui/src/client/ui/panel-page.tsx
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/panel-page.tsx
rename to packages/dsh-tauri-ui/src/client/ui/panel-page.tsx
diff --git a/packages/dsh-tauri-ui/src/client/components/seat.ts b/packages/dsh-tauri-ui/src/client/ui/seat.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/seat.ts
rename to packages/dsh-tauri-ui/src/client/ui/seat.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/segmented-control.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/segmented-control.cssr.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/segmented-control.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/segmented-control.cssr.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/segmented-control.tsx b/packages/dsh-tauri-ui/src/client/ui/segmented-control.tsx
similarity index 97%
rename from packages/dsh-tauri-ui/src/client/components/segmented-control.tsx
rename to packages/dsh-tauri-ui/src/client/ui/segmented-control.tsx
index e29fee96..a4e46101 100644
--- a/packages/dsh-tauri-ui/src/client/components/segmented-control.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/segmented-control.tsx
@@ -1,7 +1,7 @@
import type { ReactElement } from 'react'
import type { SegmentedControlProps } from './segmented-control.types'
import { useRef } from 'react'
-import { SEGMENTED_CONTROL_STYLE_ID } from '../constants'
+export const SEGMENTED_CONTROL_STYLE_ID = 'dsh-tauri-ui-segmented-control-styles'
import { useMountStyle } from '../hooks/use-mount-style'
import segmentedControlStyle from './segmented-control.cssr'
diff --git a/packages/dsh-tauri-ui/src/client/components/segmented-control.types.ts b/packages/dsh-tauri-ui/src/client/ui/segmented-control.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/segmented-control.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/segmented-control.types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/sidebar.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/sidebar.cssr.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/sidebar.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/sidebar.cssr.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/sidebar.tsx b/packages/dsh-tauri-ui/src/client/ui/sidebar.tsx
similarity index 97%
rename from packages/dsh-tauri-ui/src/client/components/sidebar.tsx
rename to packages/dsh-tauri-ui/src/client/ui/sidebar.tsx
index 84257ea9..7740382c 100644
--- a/packages/dsh-tauri-ui/src/client/components/sidebar.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/sidebar.tsx
@@ -3,22 +3,23 @@ import type { SettingsSidebarProps } from './sidebar.types'
import { SlotOutlet } from '@deepseek-ai/dsh-client-ui-renderer'
import { clamp, isEmpty, useEventListener, useStore } from 'dsh-tauri/client'
import { useEffect, useRef, useState } from 'react'
+import { Icon } from '../components/icon'
+import { ArrowLeft } from '../components/icons'
import {
RAIL_WIDTH_DEFAULT,
RAIL_WIDTH_MAX,
RAIL_WIDTH_MIN,
SETTINGS_SECTION_SLOT,
SETTINGS_SIDEBAR_CLASS,
- SETTINGS_STYLE_ID,
} from '../constants'
import { useMountStyle } from '../hooks/use-mount-style'
import { locale } from '../locales'
import { store } from '../store'
-import { Icon } from './icon'
-import { ArrowLeft } from './icons'
import { SettingsNavIcon } from './nav-icon'
import settingsSidebarStyle from './sidebar.cssr'
+const SETTINGS_STYLE_ID = 'dsh-tauri-ui-settings-sidebar-styles'
+
export function SettingsSidebar(_props: SettingsSidebarProps): ReactElement | null {
const ui = useStore(store.settings, { sync: true })
const { rows } = useStore(store.sections)
diff --git a/packages/dsh-tauri-ui/src/client/components/sidebar.types.ts b/packages/dsh-tauri-ui/src/client/ui/sidebar.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/sidebar.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/sidebar.types.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/trigger.cssr.ts b/packages/dsh-tauri-ui/src/client/ui/trigger.cssr.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/trigger.cssr.ts
rename to packages/dsh-tauri-ui/src/client/ui/trigger.cssr.ts
diff --git a/packages/dsh-tauri-ui/src/client/components/trigger.tsx b/packages/dsh-tauri-ui/src/client/ui/trigger.tsx
similarity index 97%
rename from packages/dsh-tauri-ui/src/client/components/trigger.tsx
rename to packages/dsh-tauri-ui/src/client/ui/trigger.tsx
index 6684a2f2..f0f27a78 100644
--- a/packages/dsh-tauri-ui/src/client/components/trigger.tsx
+++ b/packages/dsh-tauri-ui/src/client/ui/trigger.tsx
@@ -6,12 +6,13 @@ import { useCallback, useEffect, useState } from 'react'
import {
SETTINGS_ONBOARDING_SLOT,
SETTINGS_TRIGGER_SLOT,
- SETTINGS_TRIGGER_STYLE_ID,
} from '../constants'
import { useMountStyle } from '../hooks/use-mount-style'
import { store } from '../store'
import settingsTriggerStyle from './trigger.cssr'
+const SETTINGS_TRIGGER_STYLE_ID = 'dsh-tauri-ui-settings-trigger-styles'
+
interface RetainedSessionLike {
retainedBy?: Readonly<Record<string, number | undefined>>
}
diff --git a/packages/dsh-tauri-ui/src/client/components/trigger.types.ts b/packages/dsh-tauri-ui/src/client/ui/trigger.types.ts
similarity index 100%
rename from packages/dsh-tauri-ui/src/client/components/trigger.types.ts
rename to packages/dsh-tauri-ui/src/client/ui/trigger.types.ts
diff --git a/packages/dsh-tauri-worktree/src/client/register/session-icons.ts b/packages/dsh-tauri-worktree/src/client/register/session-icons.ts
index f305222d..655622e3 100644
--- a/packages/dsh-tauri-worktree/src/client/register/session-icons.ts
+++ b/packages/dsh-tauri-worktree/src/client/register/session-icons.ts
@@ -1,5 +1,8 @@
+import type { Root } from 'react-dom/client'
import type { ClientContext } from 'dsh-tauri/client'
-import { circleTreeSvg, mountStyle } from 'dsh-tauri-ui/client'
+import { createElement } from 'react'
+import { createRoot } from 'react-dom/client'
+import { CircleTree, Icon, mountStyle } from 'dsh-tauri-ui/client'
import { defineRegister, findKey } from 'dsh-tauri/client'
import {
SESSION_ICON_ATTRIBUTE,
@@ -9,6 +12,14 @@ import {
import { store } from '../store'
import sessionIconStyle from '../styles/index.cssr'
+const ICON_ROOTS = new WeakMap<Element, Root>()
+
+function removeIcon(icon: Element): void {
+ ICON_ROOTS.get(icon)?.unmount()
+ ICON_ROOTS.delete(icon)
+ icon.remove()
+}
+
export const sessionIconsFeature = defineRegister<ClientContext>((controller) => {
if (typeof document === 'undefined')
return
@@ -44,7 +55,9 @@ export const sessionIconsFeature = defineRegister<ClientContext>((controller) =>
const icon = document.createElement('span')
icon.setAttribute(SESSION_ICON_ATTRIBUTE, '1')
icon.style.marginRight = '5px'
- icon.innerHTML = circleTreeSvg(12)
+ const root = createRoot(icon)
+ root.render(createElement(Icon, { as: CircleTree, size: 12 }))
+ ICON_ROOTS.set(icon, root)
row.insertBefore(icon, time)
}
@@ -57,8 +70,8 @@ export const sessionIconsFeature = defineRegister<ClientContext>((controller) =>
if (!icon)
applyIcon(row)
}
- else {
- icon?.remove()
+ else if (icon) {
+ removeIcon(icon)
}
})
}
diff --git a/test/e2e/plugins/dsh-tauri-ui.e2e.ts b/test/e2e/plugins/dsh-tauri-ui.e2e.ts
index 904eaa2b..cc19c496 100644
--- a/test/e2e/plugins/dsh-tauri-ui.e2e.ts
+++ b/test/e2e/plugins/dsh-tauri-ui.e2e.ts
@@ -31,7 +31,7 @@ function headers(): Record<string, string> {
return { 'cookie': inject('dshCookie'), 'content-type': 'application/json' }
}
-/** 插件接管后的英雄区工作区 chip(`components/hero-workspace.tsx` 渲染)。 */
+/** 插件接管后的英雄区工作区 chip(`ui/hero-workspace.tsx` 渲染)。 */
const HERO_WORKSPACE_CHIP = '.dshp-hero-workspace'
/**
diff --git a/test/e2e/support/selectors.ts b/test/e2e/support/selectors.ts
index 5e7f879f..d99211f4 100644
--- a/test/e2e/support/selectors.ts
+++ b/test/e2e/support/selectors.ts
@@ -44,5 +44,5 @@ export const SETUP_PREINSTALL_SKIP = '[data-testid="dsh-setup-preinstall-skip"]'
/** 内嵌 dsh 页面的 iframe 宿主文档由用例 `page.route` 提供,见 `browser.ts`。 */
export const EMBEDDED_DOCUMENT = '[id="dsh"]'
-/** 设置侧栏根(`packages/dsh-tauri-ui/src/client/components/sidebar.tsx:92`,插件包属性)。 */
+/** 设置侧栏根(`packages/dsh-tauri-ui/src/client/ui/sidebar.tsx:92`,插件包属性)。 */
export const SETTINGS_SIDEBAR_ATTRIBUTE = '[data-slot-sidebar="dsh-tauri-ui"]'