DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
fix(overlays): Worktree 弹窗/定时任务 flyout/右键菜单全部改走官方 primitives (#661)
hairyf533b909b33c4
diff --git a/packages/dsh-tauri-panel-scheduler/src/client/components/menu.cssr.ts b/packages/dsh-tauri-panel-scheduler/src/client/components/menu.cssr.tsdeleted file mode 100644index f37c2abb..00000000--- a/packages/dsh-tauri-panel-scheduler/src/client/components/menu.cssr.ts+++ /dev/null@@ -1,22 +0,0 @@-import { cssr, styles as sharedStyles } from 'dsh-tauri-ui/client'--const { c } = cssr-const { secondary } = sharedStyles-/** menu 基础设施(menu.tsx,照搬 dsh-automation menu 样式值)。 */-export default c([- c('.dshp-scheduler__menu-row', { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '12px', width: '100%', padding: '8px 10px', border: '0', borderRadius: '10px', background: 'transparent', color: 'inherit', textAlign: 'left', cursor: 'pointer', fontSize: '13px', whiteSpace: 'nowrap' }),- c('.dshp-scheduler__menu-row:hover, .dshp-scheduler__menu-row.is-on', { background: 'var(--dsw-alias-interactive-bg-hover, rgba(255,255,255,.06))' }),- c('.dshp-scheduler__menu-row.is-kv .dshp-scheduler__menu-row-main', { flex: 'none' }),- c('.dshp-scheduler__menu-row.is-kv .dshp-scheduler__menu-row-side', { flex: '1', justifyContent: 'flex-end', minWidth: '0' }),- c('.dshp-scheduler__menu-row-main', { display: 'flex', alignItems: 'center', gap: '8px', minWidth: '0' }),- c('.dshp-scheduler__menu-row-side', { display: 'flex', alignItems: 'center', gap: '8px', flex: 'none' }),- c('.dshp-scheduler__menu-tick', { flex: 'none', width: '8px', height: '8px', borderRadius: '50%', background: 'var(--dsw-alias-brand-primary)' }),- c('.dshp-scheduler__menu-next', { flex: 'none', width: '6px', height: '6px', transform: 'rotate(45deg)', borderTop: '1.5px solid currentColor', borderRight: '1.5px solid currentColor' }),- c('.dshp-scheduler__menu-float', { position: 'absolute', zIndex: '1200', boxSizing: 'border-box' }),- c('.dshp-scheduler__menu-select', { position: 'relative', minWidth: '0', flex: 'none' }),- c('.dshp-scheduler__menu-select-btn', { display: 'flex', alignItems: 'center', gap: '6px', minHeight: '28px', height: '28px', padding: '0 8px', border: '0', borderRadius: '8px', background: 'transparent', color: secondary, fontSize: '13px', fontWeight: '500', whiteSpace: 'nowrap', cursor: 'pointer' }),- c('.dshp-scheduler__menu-select-btn:hover', { background: 'rgba(255,255,255,.06)', color: 'var(--dsw-alias-label-primary)' }),- c('.dshp-scheduler__menu-select-menu', { zIndex: '30', width: 'min(240px, calc(100vw - 32px))', maxHeight: 'min(360px, calc(100vh - 96px))', overflowY: 'auto', padding: '4px', border: '1px solid var(--dsw-alias-border-l2)', borderRadius: '12px', background: 'var(--dsw-specific-menu, var(--dsw-alias-bg-base))', boxShadow: 'var(--dsw-shadow-lv3)' }),- c('.dshp-scheduler__chip-btn', { display: 'inline-flex', alignItems: 'center', gap: '6px', minHeight: '28px', height: '28px', padding: '0 8px', border: '0', borderRadius: '8px', background: 'transparent', color: secondary, fontSize: '13px', fontWeight: '500', whiteSpace: 'nowrap', cursor: 'pointer' }),- c('.dshp-scheduler__chip-btn:hover', { background: 'rgba(255,255,255,.06)', color: 'var(--dsw-alias-label-primary)' }),-])diff --git a/packages/dsh-tauri-panel-scheduler/src/client/components/menu.tsx b/packages/dsh-tauri-panel-scheduler/src/client/components/menu.tsxdeleted file mode 100644index 92f78dd3..00000000--- a/packages/dsh-tauri-panel-scheduler/src/client/components/menu.tsx+++ /dev/null@@ -1,164 +0,0 @@-import type { CSSProperties, ReactNode, RefObject } from 'react'-import { useMountStyle } from 'dsh-tauri-ui/client'-import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'-import { createPortal } from 'react-dom'-import { MENU_STYLE_ID } from '../constants'-import menuStyle from './menu.cssr'--const MenuHostContext = createContext<HTMLElement | null>(null)--function useMenuOpen(): {- readonly open: boolean- readonly setOpen: (value: boolean | ((current: boolean) => boolean)) => void- readonly root: React.RefObject<HTMLDivElement | null>- readonly menu: React.RefObject<HTMLDivElement | null>-} {- const [open, setOpen] = useState(false)- const root = useRef<HTMLDivElement>(null)- const menu = useRef<HTMLDivElement>(null)-- useEffect(() => {- if (!open)- return- const close = (event: MouseEvent): void => {- const target = event.target as Node- if (root.current !== null && root.current.contains(target))- return- if (menu.current !== null && menu.current.contains(target))- return- setOpen(false)- }- document.addEventListener('mousedown', close)- return () => {- document.removeEventListener('mousedown', close)- }- }, [open])-- return { open, setOpen, root, menu }-}--function flyoutStyle(anchor: HTMLElement, host: HTMLElement, up?: boolean, end?: boolean): CSSProperties {- const box = anchor.getBoundingClientRect()- const frame = host.getBoundingClientRect()- const gap = 6- return {- position: 'absolute',- zIndex: 1200,- top: up === true ? 'auto' : `${box.bottom - frame.top + gap}px`,- bottom: up === true ? `${frame.bottom - box.top + gap}px` : 'auto',- left: end === true ? 'auto' : `${box.left - frame.left}px`,- right: end === true ? `${frame.right - box.right}px` : 'auto',- }-}--export function MenuPopup({- open,- anchor,- menuRef,- up,- end,- className,- ariaLabel,- children,- onClick,-}: {- readonly open: boolean- readonly anchor: RefObject<HTMLElement | null>- readonly menuRef: RefObject<HTMLDivElement | null>- readonly up?: boolean | undefined- readonly end?: boolean | undefined- readonly className: string- readonly ariaLabel?: string- readonly children: ReactNode- readonly onClick?: () => void-}) {- const host = useContext(MenuHostContext)- const [style, setStyle] = useState<CSSProperties>({})-- useLayoutEffect(() => {- if (!open || anchor.current === null || host === null)- return- const update = (): void => {- if (anchor.current !== null)- setStyle(flyoutStyle(anchor.current, host, up, end))- }- update()- window.addEventListener('resize', update)- document.addEventListener('scroll', update, true)- return () => {- window.removeEventListener('resize', update)- document.removeEventListener('scroll', update, true)- }- }, [open, anchor, host, up, end])-- if (!open)- return null-- const node = (- <div- ref={menuRef}- className={`${className}${host !== null ? ` ${'dshp-scheduler__menu-float'}` : ''}`}- role="menu"- aria-label={ariaLabel}- style={host !== null ? style : undefined}- onMouseDown={event => event.stopPropagation()}- onClick={(event) => {- event.stopPropagation()- onClick?.()- }}- >- {children}- </div>- )-- if (host !== null)- return createPortal(node, host)- return node-}--export function MenuHostProvider({- host,- children,-}: {- readonly host: HTMLElement | null- readonly children: ReactNode-}) {- useMountStyle(menuStyle, MENU_STYLE_ID)- return <MenuHostContext.Provider value={host}>{children}</MenuHostContext.Provider>-}--export function MenuRow({- icon,- label,- hint,- active,- chevron,- kv,- onClick,-}: {- readonly icon?: ReactNode- readonly label: ReactNode- readonly hint?: ReactNode- readonly active?: boolean- readonly chevron?: boolean- readonly kv?: boolean- readonly onClick: () => void-}) {- return (- <button type="button" className={`${'dshp-scheduler__menu-row'}${active === true ? ' is-on' : ''}${kv === true ? ' is-kv' : ''}`} onClick={onClick}>- <span className="dshp-scheduler__menu-row-main">- {icon}- <span>{label}</span>- </span>- <span className="dshp-scheduler__menu-row-side">- {hint}- {active === true && chevron !== true && <i className="dshp-scheduler__menu-tick" />}- {chevron === true && <i className="dshp-scheduler__menu-next" />}- </span>- </button>- )-}--export function useMenuState(): ReturnType<typeof useMenuOpen> {- return useMenuOpen()-}diff --git a/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.cssr.ts b/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.cssr.tsindex 067dd00f..583f5c4a 100644--- a/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.cssr.ts+++ b/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.cssr.ts@@ -1,9 +1,9 @@import { cssr, styles as sharedStyles } from 'dsh-tauri-ui/client'const { c } = cssr-const { primary, secondary, tertiary, borderL2: border, hover } = sharedStyles+const { primary, secondary, tertiary, hover } = sharedStyles-/** ModelPicker(model-picker.tsx,照搬 dsh-automation create-modal ModelPicker)。 */+/** ModelPicker(model-picker.tsx):只保留触发控件与官方 `Menu` 行内节点的样式。 */export default c([c('.dshp-scheduler__model-select', { position: 'relative', zIndex: '1', minWidth: '0', flex: 'none', height: '28px' }),c('.dshp-scheduler__model-select--open', { zIndex: '30' }),@@ -13,18 +13,10 @@ export default c([c('.dshp-scheduler__model-trigger-effort', { flex: 'none', color: tertiary, whiteSpace: 'nowrap' }),c('.dshp-scheduler__model-trigger-chevron', { flex: 'none', transition: 'transform .16s ease' }),c('.dshp-scheduler__model-trigger-chevron--open', { transform: 'rotate(180deg)' }),- c('.dshp-scheduler__model-select-menu', { zIndex: '30', width: 'min(240px, calc(100vw - 32px))', maxHeight: 'min(360px, calc(100vh - 96px))', overflowY: 'auto', padding: '4px', border: `1px solid ${border}`, borderRadius: '12px', background: 'var(--dsw-specific-menu, var(--dsw-alias-bg-base))', boxShadow: 'var(--dsw-shadow-lv3)' }),- c('.dshp-scheduler__model-select-menu--float', { position: 'absolute', zIndex: '1200', boxSizing: 'border-box' }),- c('.dshp-scheduler__model-select-menu .dshp-scheduler__menu-row', { minHeight: '40px', padding: '0 10px', borderRadius: '10px', fontSize: '14px' }),- c('.dshp-scheduler__model-select-menu .dshp-scheduler__menu-row.is-kv .dshp-scheduler__menu-row-side', { fontSize: '13px', color: tertiary }),- c('.dshp-scheduler__model-group + .dshp-scheduler__model-group', { marginTop: '4px' }),- c('.dshp-scheduler__model-group-title', { position: 'sticky', top: '0', zIndex: '1', padding: '5px 8px 3px', background: 'var(--dsw-specific-menu, var(--dsw-alias-bg-base))', color: tertiary, fontSize: '12px', fontWeight: '500', lineHeight: '18px' }),- c('.dshp-scheduler__model-option', { display: 'flex', width: '100%', minHeight: '38px', alignItems: 'center', gap: '8px', padding: '6px 8px', border: '0', borderRadius: '10px', background: 'transparent', color: primary, textAlign: 'left', cursor: 'pointer' }),- c('.dshp-scheduler__model-option:hover, .dshp-scheduler__model-option:focus-visible', { background: hover, outline: 'none' }),+ c('.dshp-scheduler__model-row', { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '12px', width: '100%' }),+ c('.dshp-scheduler__model-row-label', { flex: 'none' }),+ c('.dshp-scheduler__model-row-hint', { flex: '1', minWidth: '0', overflow: 'hidden', color: tertiary, textAlign: 'right', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }),c('.dshp-scheduler__model-option-copy', { display: 'flex', minWidth: '0', flex: '1', flexDirection: 'column' }),c('.dshp-scheduler__model-name', { overflow: 'hidden', fontSize: '14px', fontWeight: '500', lineHeight: '20px', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }),c('.dshp-scheduler__model-description', { overflow: 'hidden', color: tertiary, fontSize: '12px', lineHeight: '18px', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }),- c('.dshp-scheduler__model-check', { display: 'grid', flex: '0 0 18px', placeItems: 'center', color: primary }),- c('.dshp-scheduler__model-warning', { margin: '4px', padding: '8px', borderRadius: '8px', background: 'var(--dsw-alias-interactive-bg-hover-danger, rgba(248,81,73,.1))', color: 'var(--dsw-alias-state-error-primary, #f85149)', fontSize: '12px', lineHeight: '18px' }),- c('.dshp-scheduler__model-empty', { padding: '14px 12px', color: tertiary, fontSize: '12px', textAlign: 'center' }),])diff --git a/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.tsx b/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.tsxindex 4f69f802..6640e70c 100644--- a/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.tsx+++ b/packages/dsh-tauri-panel-scheduler/src/client/components/model-picker.tsx@@ -1,18 +1,39 @@/*** components/model-picker.tsx — 模型选择器(对齐 dsh-automation create-modal 的 ModelPicker:- * root / model / effort 三 pane + provider 分组)。+ * root / model / effort 三 pane + provider 分组),弹层走官方 primitives `Menu`。*/+import type { MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives'+import type { ReactElement } from 'react'import type { Translate } from '../locales/index.types'import type { ModelCatalogFailure, ModelOption } from '../types'-import { IconCheckOutline16 as Check, IconChevronDownOutline14 as ChevronDown } from '@deepseek-ai/dsh-client-ui-primitives'+import { IconChevronDownOutline14 as ChevronDown, Menu } from '@deepseek-ai/dsh-client-ui-primitives'import { Icon, useMountStyle } from 'dsh-tauri-ui/client'import { groupBy } from 'dsh-tauri/client'import { useEffect, useState } from 'react'import { MODEL_PICKER_STYLE_ID } from '../constants'-import { MenuPopup, MenuRow, useMenuState } from './menu'import modelPickerStyle from './model-picker.cssr'+type Pane = 'root' | 'model' | 'effort'++function optionCopy(label: string, description?: string): ReactElement {+ return (+ <span className="dshp-scheduler__model-option-copy">+ <span className="dshp-scheduler__model-name">{label}</span>+ {description !== undefined && <span className="dshp-scheduler__model-description">{description}</span>}+ </span>+ )+}++function paneRow(label: string, hint: string): ReactElement {+ return (+ <span className="dshp-scheduler__model-row">+ <span className="dshp-scheduler__model-row-label">{label}</span>+ <span className="dshp-scheduler__model-row-hint">{hint}</span>+ </span>+ )+}+export function ModelPicker({t,models,@@ -29,8 +50,8 @@ export function ModelPicker({readonly onSelection: (modelKey: string, reasoningEffort: string) => void}) {useMountStyle(modelPickerStyle, MODEL_PICKER_STYLE_ID)- const menu = useMenuState()- const [pane, setPane] = useState<'root' | 'model' | 'effort'>('root')+ const [open, setOpen] = useState(false)+ const [pane, setPane] = useState<Pane>('root')const selected = models.find(item => `${item.provider}::${item.model}` === modelKey)const reasoning = selected?.reasoningconst effectiveEffort = reasoningEffort === 'none'@@ -48,8 +69,10 @@ export function ModelPicker({models: group,}))+ // 弹层打开时的 Escape 一律由本组件消费:子 pane 回 root,root 关闭弹层。+ // 必须拦在 capture 阶段,否则事件会同时触达外层 Modal 的 Escape(连带关掉对话框)。useEffect(() => {- if (!menu.open)+ if (!open)returnconst onKey = (event: KeyboardEvent): void => {if (event.key !== 'Escape')@@ -57,145 +80,125 @@ export function ModelPicker({event.preventDefault()event.stopPropagation()event.stopImmediatePropagation()- if (pane !== 'root')+ if (pane !== 'root') {setPane('root')- else menu.setOpen(false)+ return+ }+ setOpen(false)}window.addEventListener('keydown', onKey, true)return () => {window.removeEventListener('keydown', onKey, true)}- }, [menu.open, menu.setOpen, pane])+ }, [open, pane])- const selectModel = (item: ModelOption): void => {- onSelection(- `${item.provider}::${item.model}`,- item.reasoning?.defaultEffort ?? 'none',- )- menu.setOpen(false)+ const selectModel = (value: string): void => {+ const item = models.find(model => `${model.provider}::${model.model}` === value)+ onSelection(value, item?.reasoning?.defaultEffort ?? 'none')+ setOpen(false)setPane('root')}const selectEffort = (effort: string): void => {onSelection(modelKey, effort)- menu.setOpen(false)+ setOpen(false)setPane('root')}+ const rootItems: MenuEntry[] = [+ { id: 'pane:model', label: paneRow(t('menu.model'), selected?.label ?? t('trigger.fallback')) },+ ]+ if (reasoning !== undefined)+ rootItems.push({ id: 'pane:effort', label: paneRow(t('menu.effort'), effortLabel ?? t('effort.providerDefault')) })++ const modelItems: MenuEntry[] = failures.map(failure => ({+ type: 'label',+ id: `warning:${failure.provider}`,+ text: t('warning.groupLoad', { name: failure.providerLabel, message: failure.message }),+ }))+ for (const group of modelGroups) {+ modelItems.push({ type: 'label', id: `group:${group.provider}`, text: group.label })+ for (const item of group.models)+ modelItems.push({ id: `model:${item.provider}::${item.model}`, label: optionCopy(item.label, item.description) })+ }+ if (modelItems.length === 0)+ modelItems.push({ type: 'label', id: 'empty:models', text: t('empty.models') })++ const effortItems: MenuEntry[] = []+ if (reasoning !== undefined) {+ if (reasoning.defaultEffort === undefined)+ effortItems.push({ id: 'effort:none', label: optionCopy(t('effort.providerDefault')) })+ for (const item of reasoning.efforts)+ effortItems.push({ id: `effort:${item.id}`, label: optionCopy(item.name, item.description) })+ if (effortItems.length === 0)+ effortItems.push({ type: 'label', id: 'empty:efforts', text: t('empty.efforts') })+ }++ const items = pane === 'root' ? rootItems : pane === 'model' ? modelItems : effortItems+ const selectedId = pane === 'model'+ ? `model:${modelKey}`+ : pane === 'effort'+ ? `effort:${effectiveEffort ?? 'none'}`+ : undefined++ const onSelect = (id: string): void => {+ if (id === 'pane:model') {+ setPane('model')+ return+ }+ if (id === 'pane:effort') {+ setPane('effort')+ return+ }+ if (id.startsWith('model:')) {+ selectModel(id.slice('model:'.length))+ return+ }+ if (id.startsWith('effort:'))+ selectEffort(id.slice('effort:'.length))+ }+return (- <div className={`${'dshp-scheduler__model-select'}${menu.open ? ` ${'dshp-scheduler__model-select--open'}` : ''}`} ref={menu.root}>- <button- type="button"- className="dshp-scheduler__model-trigger"- aria-label={selected === undefined- ? t('trigger.selectAria')- : effortLabel === undefined- ? t('trigger.aria', { model: selected.label })- : t('trigger.ariaEffort', { model: selected.label, effort: effortLabel })}- onMouseDown={event => event.stopPropagation()}- onClick={() => {- if (menu.open) {- menu.setOpen(false)- return- }- setPane('root')- menu.setOpen(true)- }}- >- <span>{trigger}</span>- {effortLabel !== undefined && <span className="dshp-scheduler__model-trigger-effort">{effortLabel}</span>}- <Icon as={ChevronDown} className={`${'dshp-scheduler__model-trigger-chevron'}${menu.open ? ` ${'dshp-scheduler__model-trigger-chevron--open'}` : ''}`} />- </button>- <MenuPopup open={menu.open} anchor={menu.root} menuRef={menu.menu} up end className={`${'dshp-scheduler__model-select-menu'} is-up is-end`} ariaLabel={t('menu.aria')}>- {pane === 'root' && (- <>- <MenuRow- kv- label={t('menu.model')}- hint={selected?.label ?? t('trigger.fallback')}- chevron- onClick={() => setPane('model')}- />- {reasoning !== undefined && (- <MenuRow- kv- label={t('menu.effort')}- hint={effortLabel ?? t('effort.providerDefault')}- chevron- onClick={() => setPane('effort')}- />- )}- </>- )}- {pane === 'model' && (- <>- {failures.map(failure => (- <div key={failure.provider} className="dshp-scheduler__model-warning">- {t('warning.groupLoad', { name: failure.providerLabel, message: failure.message })}- </div>- ))}- {modelGroups.map(group => (- <section key={group.provider} role="group" aria-label={group.label} className="dshp-scheduler__model-group">- <div className="dshp-scheduler__model-group-title">{group.label}</div>- {group.models.map((item) => {- const value = `${item.provider}::${item.model}`- return (- <button- key={value}- type="button"- role="menuitemradio"- aria-checked={value === modelKey}- className="dshp-scheduler__model-option"- title={item.label}- onClick={() => selectModel(item)}- >- <span className="dshp-scheduler__model-option-copy">- <span className="dshp-scheduler__model-name">{item.label}</span>- {item.description !== undefined && <span className="dshp-scheduler__model-description">{item.description}</span>}- </span>- <span className="dshp-scheduler__model-check">{value === modelKey && <Icon as={Check} />}</span>- </button>- )- })}- </section>- ))}- {modelGroups.length === 0 && failures.length === 0 && <div className="dshp-scheduler__model-empty">{t('empty.models')}</div>}- </>- )}- {pane === 'effort' && reasoning !== undefined && (- <>- {reasoning.defaultEffort === undefined && (- <button- type="button"- role="menuitemradio"- aria-checked={reasoningEffort === 'none'}- className="dshp-scheduler__model-option"- onClick={() => selectEffort('none')}- >- <span className="dshp-scheduler__model-option-copy"><span className="dshp-scheduler__model-name">{t('effort.providerDefault')}</span></span>- <span className="dshp-scheduler__model-check">{reasoningEffort === 'none' && <Icon as={Check} />}</span>- </button>- )}- {reasoning.efforts.map(item => (- <button- key={item.id}- type="button"- role="menuitemradio"- aria-checked={effectiveEffort === item.id}- className="dshp-scheduler__model-option"- onClick={() => selectEffort(item.id)}- >- <span className="dshp-scheduler__model-option-copy">- <span className="dshp-scheduler__model-name">{item.name}</span>- {item.description !== undefined && <span className="dshp-scheduler__model-description">{item.description}</span>}- </span>- <span className="dshp-scheduler__model-check">{effectiveEffort === item.id && <Icon as={Check} />}</span>- </button>- ))}- {reasoning.efforts.length === 0 && reasoning.defaultEffort !== undefined && <div className="dshp-scheduler__model-empty">{t('empty.efforts')}</div>}- </>- )}- </MenuPopup>- </div>+ <Menu+ open={open}+ autoFocus+ portal+ side="top"+ align="end"+ className={`${'dshp-scheduler__model-select'}${open ? ` ${'dshp-scheduler__model-select--open'}` : ''}`}+ items={items}+ selectedId={selectedId}+ onSelect={onSelect}+ onClose={() => {+ setOpen(false)+ setPane('root')+ }}+ anchor={(+ <button+ type="button"+ className="dshp-scheduler__model-trigger"+ aria-label={selected === undefined+ ? t('trigger.selectAria')+ : effortLabel === undefined+ ? t('trigger.aria', { model: selected.label })+ : t('trigger.ariaEffort', { model: selected.label, effort: effortLabel })}+ aria-haspopup="menu"+ aria-expanded={open}+ onMouseDown={event => event.stopPropagation()}+ onClick={() => {+ if (open) {+ setOpen(false)+ return+ }+ setPane('root')+ setOpen(true)+ }}+ >+ <span>{trigger}</span>+ {effortLabel !== undefined && <span className="dshp-scheduler__model-trigger-effort">{effortLabel}</span>}+ <Icon as={ChevronDown} className={`${'dshp-scheduler__model-trigger-chevron'}${open ? ` ${'dshp-scheduler__model-trigger-chevron--open'}` : ''}`} />+ </button>+ )}+ />)}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.tsxindex 2452d47a..6d4a571d 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@@ -19,7 +19,6 @@ import { useRef, useState } from 'react'import { SCHEDULE_KINDS } from '../../shared/constants'import { TASK_CREATE_DIALOG_STYLE_ID } from '../constants'import { createTask, updateTask } from '../service/scheduler'-import { MenuHostProvider } from './menu'import { ModelPicker } from './model-picker'import taskCreateDialogStyle from './task-create-dialog.cssr'@@ -111,7 +110,6 @@ export function TaskCreateDialog({ t, options, onClose, taskId, initial }: TaskC})const [saving, setSaving] = useState(false)const [error, setError] = useState('')- const [menuHost, setMenuHost] = useState<HTMLDivElement | null>(null)// 保存中禁止关闭(Esc / 遮罩 / 关闭按钮):用 ref 供稳定闭包读取最新值。const savingRef = useRef(false)savingRef.current = saving@@ -173,101 +171,89 @@ export function TaskCreateDialog({ t, options, onClose, taskId, initial }: TaskCconst modelKey = form.provider && form.model ? `${form.provider}::${form.model}` : 'default'return (- <MenuHostProvider host={menuHost}>- <Modal- open- onClose={closeSafe}- title={taskId ? t('editDialogTitle') : t('createDialogTitle')}- description={t('dialogHint')}- closeLabel={t('close')}- className="dshp-scheduler__modal"- footer={(- <>- <button className="dshp-scheduler__btn" type="button" disabled={saving} onClick={closeSafe}>{t('cancel')}</button>- <button className={`${'dshp-scheduler__btn'} ${'dshp-scheduler__btn--primary'}`} type="button" disabled={saving} onClick={() => void onSave()}>- {t('save')}- </button>- </>- )}- >- <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>- <label className="dshp-scheduler__field">- <span className="dshp-scheduler__field-label">{t('taskName')}</span>- <input- className="dshp-scheduler__input"- type="text"- value={form.name}- placeholder={t('taskNamePlaceholder')}- onChange={event => setForm(state => ({ ...state, name: event.target.value }))}- />- </label>+ <Modal+ open+ onClose={closeSafe}+ title={taskId ? t('editDialogTitle') : t('createDialogTitle')}+ description={t('dialogHint')}+ closeLabel={t('close')}+ className="dshp-scheduler__modal"+ footer={(+ <>+ <button className="dshp-scheduler__btn" type="button" disabled={saving} onClick={closeSafe}>{t('cancel')}</button>+ <button className={`${'dshp-scheduler__btn'} ${'dshp-scheduler__btn--primary'}`} type="button" disabled={saving} onClick={() => void onSave()}>+ {t('save')}+ </button>+ </>+ )}+ >+ <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>+ <label className="dshp-scheduler__field">+ <span className="dshp-scheduler__field-label">{t('taskName')}</span>+ <input+ className="dshp-scheduler__input"+ type="text"+ value={form.name}+ placeholder={t('taskNamePlaceholder')}+ onChange={event => setForm(state => ({ ...state, name: event.target.value }))}+ />+ </label>- <div className="dshp-scheduler__field">- <span className="dshp-scheduler__field-label">{t('schedule')}</span>- <div className="dshp-scheduler__inline">- <select- className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select'}`}- value={scheduleKind}- aria-label={t('schedule')}- onChange={event => setForm(state => ({ ...state, schedule: defaultScheduleFor(event.target.value as ScheduleForm['kind']) }))}- >- {SCHEDULE_KINDS.map(kind => (- <option key={kind} value={kind}>{t(SCHEDULE_KIND_KEYS[kind])}</option>- ))}- </select>+ <div className="dshp-scheduler__field">+ <span className="dshp-scheduler__field-label">{t('schedule')}</span>+ <div className="dshp-scheduler__inline">+ <select+ className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select'}`}+ value={scheduleKind}+ aria-label={t('schedule')}+ onChange={event => setForm(state => ({ ...state, schedule: defaultScheduleFor(event.target.value as ScheduleForm['kind']) }))}+ >+ {SCHEDULE_KINDS.map(kind => (+ <option key={kind} value={kind}>{t(SCHEDULE_KIND_KEYS[kind])}</option>+ ))}+ </select>- {scheduleKind === 'once'- ? <input className="dshp-scheduler__input dshp-scheduler__schedule-once" type="datetime-local" value={String(form.schedule.at).slice(0, 16)} onChange={event => setSchedule({ kind: 'once', at: new Date(event.target.value).toISOString() })} />- : scheduleKind === 'hourly'- ? <select className="dshp-scheduler__input" value={form.schedule.minute} onChange={event => setSchedule({ kind: 'hourly', minute: Number(event.target.value) })}>{Array.from({ length: 60 }, (_, minute) => <option key={minute} value={minute}>{`: ${String(minute).padStart(2, '0')}`}</option>)}</select>- : scheduleKind === 'monthly'+ {scheduleKind === 'once'+ ? <input className="dshp-scheduler__input dshp-scheduler__schedule-once" type="datetime-local" value={String(form.schedule.at).slice(0, 16)} onChange={event => setSchedule({ kind: 'once', at: new Date(event.target.value).toISOString() })} />+ : scheduleKind === 'hourly'+ ? <select className="dshp-scheduler__input" value={form.schedule.minute} onChange={event => setSchedule({ kind: 'hourly', minute: Number(event.target.value) })}>{Array.from({ length: 60 }, (_, minute) => <option key={minute} value={minute}>{`: ${String(minute).padStart(2, '0')}`}</option>)}</select>+ : scheduleKind === 'monthly'+ ? (+ <>+ <input className="dshp-scheduler__input dshp-scheduler__inline-select--auto" type="number" min={1} max={31} value={form.schedule.kind === 'monthly' ? form.schedule.day : 1} aria-label={t('scheduleMonthDay')} onChange={event => setSchedule({ kind: 'monthly', day: Number(event.target.value), time: currentTime })} />+ <select className="dshp-scheduler__input dshp-scheduler__select-input dshp-scheduler__inline-select--auto" value={currentTime} aria-label={t('scheduleTime')} onChange={event => setSchedule({ kind: 'monthly', day: form.schedule.kind === 'monthly' ? form.schedule.day : 1, time: event.target.value })}>{TIME_OPTIONS.map(time => <option key={time} value={time}>{time}</option>)}</select>+ </>+ )+ : scheduleKind === 'custom'? (<>- <input className="dshp-scheduler__input dshp-scheduler__inline-select--auto" type="number" min={1} max={31} value={form.schedule.kind === 'monthly' ? form.schedule.day : 1} aria-label={t('scheduleMonthDay')} onChange={event => setSchedule({ kind: 'monthly', day: Number(event.target.value), time: currentTime })} />- <select className="dshp-scheduler__input dshp-scheduler__select-input dshp-scheduler__inline-select--auto" value={currentTime} aria-label={t('scheduleTime')} onChange={event => setSchedule({ kind: 'monthly', day: form.schedule.kind === 'monthly' ? form.schedule.day : 1, time: event.target.value })}>{TIME_OPTIONS.map(time => <option key={time} value={time}>{time}</option>)}</select>+ <input className="dshp-scheduler__input dshp-scheduler__inline-select--auto" type="number" min={1} max={366} value={form.schedule.kind === 'custom' ? form.schedule.everyDays : 1} aria-label={t('scheduleEveryDays')} onChange={event => setSchedule({ kind: 'custom', everyDays: Number(event.target.value), time: currentTime })} />+ <span>{t('dayShort')}</span>+ <select className="dshp-scheduler__input dshp-scheduler__select-input dshp-scheduler__inline-select--auto" value={currentTime} aria-label={t('scheduleTime')} onChange={event => setSchedule({ kind: 'custom', everyDays: form.schedule.kind === 'custom' ? form.schedule.everyDays : 1, time: event.target.value })}>{TIME_OPTIONS.map(time => <option key={time} value={time}>{time}</option>)}</select></>)- : scheduleKind === 'custom'+ : scheduleKind === 'interval'? (- <>- <input className="dshp-scheduler__input dshp-scheduler__inline-select--auto" type="number" min={1} max={366} value={form.schedule.kind === 'custom' ? form.schedule.everyDays : 1} aria-label={t('scheduleEveryDays')} onChange={event => setSchedule({ kind: 'custom', everyDays: Number(event.target.value), time: currentTime })} />- <span>{t('dayShort')}</span>- <select className="dshp-scheduler__input dshp-scheduler__select-input dshp-scheduler__inline-select--auto" value={currentTime} aria-label={t('scheduleTime')} onChange={event => setSchedule({ kind: 'custom', everyDays: form.schedule.kind === 'custom' ? form.schedule.everyDays : 1, time: event.target.value })}>{TIME_OPTIONS.map(time => <option key={time} value={time}>{time}</option>)}</select>- </>+ <select+ className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select--auto'}`}+ value={currentEveryMinutes}+ aria-label={t('scheduleEveryMinutes')}+ onChange={event => setSchedule({ kind: 'interval', everyMinutes: Number(event.target.value), anchor: form.schedule.kind === 'interval' ? form.schedule.anchor : undefined })}+ >+ {INTERVAL_OPTIONS.map(minutes => <option key={minutes} value={minutes}>{`${minutes} ${t('minuteShort')}`}</option>)}+ </select>)- : scheduleKind === 'interval'+ : scheduleKind === 'weekly'? (- <select- className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select--auto'}`}- value={currentEveryMinutes}- aria-label={t('scheduleEveryMinutes')}- onChange={event => setSchedule({ kind: 'interval', everyMinutes: Number(event.target.value), anchor: form.schedule.kind === 'interval' ? form.schedule.anchor : undefined })}- >- {INTERVAL_OPTIONS.map(minutes => <option key={minutes} value={minutes}>{`${minutes} ${t('minuteShort')}`}</option>)}- </select>- )- : scheduleKind === 'weekly'- ? (- <>- <select- className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select--auto'}`}- value={currentWeekday}- aria-label={t('scheduleWeekdays')}- onChange={event => setSchedule({ kind: 'weekly', weekdays: [event.target.value as Weekday], time: currentTime })}- >- {WEEKDAYS.map(day => <option key={day} value={day}>{t(WEEKDAY_KEYS[day])}</option>)}- </select>- <select- className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select--auto'}`}- value={currentTime}- aria-label={t('scheduleTime')}- onChange={event => setSchedule({ ...form.schedule, time: event.target.value } as ScheduleForm)}- >- {TIME_OPTIONS.map(time => <option key={time} value={time}>{time}</option>)}- </select>- </>- )- : (+ <>+ <select+ className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select--auto'}`}+ value={currentWeekday}+ aria-label={t('scheduleWeekdays')}+ onChange={event => setSchedule({ kind: 'weekly', weekdays: [event.target.value as Weekday], time: currentTime })}+ >+ {WEEKDAYS.map(day => <option key={day} value={day}>{t(WEEKDAY_KEYS[day])}</option>)}+ </select><selectclassName={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select--auto'}`}value={currentTime}@@ -276,63 +262,72 @@ export function TaskCreateDialog({ t, options, onClose, taskId, initial }: TaskC>{TIME_OPTIONS.map(time => <option key={time} value={time}>{time}</option>)}</select>- )}- </div>+ </>+ )+ : (+ <select+ className={`${'dshp-scheduler__input'} ${'dshp-scheduler__select-input'} ${'dshp-scheduler__inline-select--auto'}`}+ value={currentTime}+ aria-label={t('scheduleTime')}+ onChange={event => setSchedule({ ...form.schedule, time: event.target.value } as ScheduleForm)}+ >+ {TIME_OPTIONS.map(time => <option key={time} value={time}>{time}</option>)}+ </select>+ )}</div>+ </div>- <div className="dshp-scheduler__field">- <span className="dshp-scheduler__field-label">{t('schedulePrompt')}</span>- <div className="dshp-scheduler__prompt-wrap">- <textarea- className="dshp-scheduler__textarea"- value={form.prompt}- placeholder={t('schedulePromptPlaceholder')}- onChange={event => setForm(state => ({ ...state, prompt: event.target.value }))}+ <div className="dshp-scheduler__field">+ <span className="dshp-scheduler__field-label">{t('schedulePrompt')}</span>+ <div className="dshp-scheduler__prompt-wrap">+ <textarea+ className="dshp-scheduler__textarea"+ value={form.prompt}+ placeholder={t('schedulePromptPlaceholder')}+ 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 }))}+ />+ <MenuSelect+ variant="pill"+ label={t('permission')}+ value={form.permission}+ options={permissionOptions}+ onSelect={id => setForm(state => ({ ...state, permission: id }))}+ />+ <div style={{ flex: 1 }} />+ <ModelPicker+ t={t}+ models={options.models ?? []}+ failures={options.failures ?? []}+ modelKey={modelKey}+ reasoningEffort={form.reasoningEffort === '' ? 'none' : form.reasoningEffort}+ onSelection={(nextKey, effort) => {+ // 照搬 dsh-automation:modelKey = `${provider}::${model}`;'default' 仅在+ // 目录无默认模型时出现(trigger 显示官方 fallback「选择模型」)。+ const sep = nextKey.indexOf('::')+ const provider = sep >= 0 ? nextKey.slice(0, sep) : ''+ const model = sep >= 0 ? nextKey.slice(sep + 2) : ''+ setForm(state => ({+ ...state,+ provider,+ model,+ // 'none' = 提供商默认 → 落库空串。+ reasoningEffort: effort === 'none' ? '' : effort,+ }))+ }}/>- <div className="dshp-scheduler__composer">- <MenuSelect- variant="pill"- label={t('workspace')}- value={form.workspaceId}- options={workspaceOptions}- onSelect={id => setForm(state => ({ ...state, workspaceId: id }))}- />- <MenuSelect- variant="pill"- label={t('permission')}- value={form.permission}- options={permissionOptions}- onSelect={id => setForm(state => ({ ...state, permission: id }))}- />- <div style={{ flex: 1 }} />- <ModelPicker- t={t}- models={options.models ?? []}- failures={options.failures ?? []}- modelKey={modelKey}- reasoningEffort={form.reasoningEffort === '' ? 'none' : form.reasoningEffort}- onSelection={(nextKey, effort) => {- // 照搬 dsh-automation:modelKey = `${provider}::${model}`;'default' 仅在- // 目录无默认模型时出现(trigger 显示官方 fallback「选择模型」)。- const sep = nextKey.indexOf('::')- const provider = sep >= 0 ? nextKey.slice(0, sep) : ''- const model = sep >= 0 ? nextKey.slice(sep + 2) : ''- setForm(state => ({- ...state,- provider,- model,- // 'none' = 提供商默认 → 落库空串。- reasoningEffort: effort === 'none' ? '' : effort,- }))- }}- />- </div></div></div></div>- {error ? <p className="dshp-scheduler__error" role="alert">{error}</p> : null}- <div className="dshp-scheduler__flyout-root" ref={setMenuHost} />- </Modal>- </MenuHostProvider>+ </div>+ {error ? <p className="dshp-scheduler__error" role="alert">{error}</p> : null}+ </Modal>)}diff --git a/packages/dsh-tauri-panel-scheduler/src/client/constants/index.ts b/packages/dsh-tauri-panel-scheduler/src/client/constants/index.tsindex 9c7de556..0300d7ee 100644--- a/packages/dsh-tauri-panel-scheduler/src/client/constants/index.ts+++ b/packages/dsh-tauri-panel-scheduler/src/client/constants/index.ts@@ -16,7 +16,6 @@ export const TASK_CARD_STYLE_ID = `${PLUGIN_ID}-task-card-styles`export const RUNS_TAB_STYLE_ID = `${PLUGIN_ID}-runs-tab-styles`export const RECOMMENDATIONS_STYLE_ID = `${PLUGIN_ID}-recommendations-styles`export const MODEL_PICKER_STYLE_ID = `${PLUGIN_ID}-model-picker-styles`-export const MENU_STYLE_ID = `${PLUGIN_ID}-menu-styles`export const TASK_CREATE_DIALOG_STYLE_ID = `${PLUGIN_ID}-task-create-dialog-styles`export const SESSION_ICON_STYLE_ID = `${PLUGIN_ID}-session-clock-icon`diff --git a/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.ts b/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.tsindex 0a64cfc9..a58a2ec9 100644--- a/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.ts+++ b/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.ts@@ -78,8 +78,6 @@ export default c([c('.dshp-scheduler__selector:hover', { background: hover }),c('.dshp-scheduler__selector-chevron', { flex: 'none' }),c('.dshp-scheduler__selector-effort', { color: tertiary, fontSize: '12px', maxWidth: '120px', overflow: 'hidden', textOverflow: 'ellipsis' }),- c('.dshp-scheduler__flyout-root', { position: 'absolute', inset: '0', zIndex: '1200', overflow: 'visible', pointerEvents: 'none' }),- c('.dshp-scheduler__flyout-root .dshp-scheduler__menu-select-menu, .dshp-scheduler__flyout-root .dshp-scheduler__model-select-menu', { pointerEvents: 'auto' }),// —— 侧边栏会话行时钟图标补丁(配合 register/session-icons.ts 的 DOM 观察器)——c(`[${SESSION_ICON_ATTRIBUTE}]`, {width: '16px',diff --git a/packages/dsh-tauri-rightclick/src/client/constants/index.ts b/packages/dsh-tauri-rightclick/src/client/constants/index.tsindex 7769e1e4..83e7be96 100644--- a/packages/dsh-tauri-rightclick/src/client/constants/index.ts+++ b/packages/dsh-tauri-rightclick/src/client/constants/index.ts@@ -3,18 +3,8 @@ import { PLUGIN_ID } from '../../shared/constants'export { PLUGIN_ID } from '../../shared/constants'export const LOCALE_EFFECT = `${PLUGIN_ID}: locale`-export const STYLES_EFFECT = `${PLUGIN_ID}: styles`export const CONTEXT_MENU_EFFECT = `${PLUGIN_ID}: context menu`-export const MENU_STYLE_ID = `${PLUGIN_ID}-menu-styles`--export const MENU_BLOCK = 'dshp-menu'-export const MENU_ITEM_CLASS = `${MENU_BLOCK}__item`-export const MENU_ITEM_DANGER_CLASS = `${MENU_ITEM_CLASS}--danger`-export const MENU_SHORTCUT_CLASS = `${MENU_BLOCK}__shortcut`-export const MENU_SEPARATOR_CLASS = `${MENU_BLOCK}__separator`-export const TOAST_CLASS = 'dshp-toast'-export const TREE_ITEM_SELECTOR = '[role="treeitem"]'export const TREE_ITEM_EXPANDED_SELECTOR = '[role="treeitem"][aria-expanded]'export const ACTION_BUTTON_SELECTOR = 'button[aria-label]'@@ -30,4 +20,3 @@ export const EXTENSIONS_REGISTRY_KEY = 'dsh.rightclick-menu.extensions'export const CONTEXT_MENU_EVENT = 'dsh:rightclick-menu'export const TOAST_DURATION_MS = 1800-export const MENU_VIEWPORT_MARGIN = 6diff --git a/packages/dsh-tauri-rightclick/src/client/index.ts b/packages/dsh-tauri-rightclick/src/client/index.tsindex cfa435a8..123dc21b 100644--- a/packages/dsh-tauri-rightclick/src/client/index.ts+++ b/packages/dsh-tauri-rightclick/src/client/index.ts@@ -1,8 +1,7 @@import type { ClientContext } from 'dsh-tauri/client'-import { CONTEXT_MENU_EFFECT, LOCALE_EFFECT, PLUGIN_ID, STYLES_EFFECT } from './constants'+import { CONTEXT_MENU_EFFECT, LOCALE_EFFECT, PLUGIN_ID } from './constants'import { locale } from './locales'import { contextMenuFeature } from './register/context-menu'-import { stylesFeature } from './register/styles'export const name = PLUGIN_ID@@ -10,6 +9,5 @@ export const inject = ['locale', 'sessions', 'workspaces']export function apply(ctx: ClientContext): void {ctx.effect(locale.registerLocale, LOCALE_EFFECT)- ctx.effect(stylesFeature, STYLES_EFFECT)ctx.effect(contextMenuFeature, CONTEXT_MENU_EFFECT)}diff --git a/packages/dsh-tauri-rightclick/src/client/register/context-menu.ts b/packages/dsh-tauri-rightclick/src/client/register/context-menu.tsxsimilarity index 53%rename from packages/dsh-tauri-rightclick/src/client/register/context-menu.tsrename to packages/dsh-tauri-rightclick/src/client/register/context-menu.tsxindex b4b5783c..b7271495 100644--- a/packages/dsh-tauri-rightclick/src/client/register/context-menu.ts+++ b/packages/dsh-tauri-rightclick/src/client/register/context-menu.tsx@@ -1,15 +1,12 @@+import type { MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives'import type { ClientContext } from 'dsh-tauri/client'+import type { ReactNode } from 'react'import type { ActionOutcome, SessionsRuntimeLike, WorkspacesRuntimeLike } from '../types'import type { MenuComposer, OfficialSelectOptions } from './context-menu.types'+import { Menu, Toast } from '@deepseek-ai/dsh-client-ui-primitives'import { defineRegister } from 'dsh-tauri/client'-import {- CONTEXT_MENU_EVENT,- LINK_SELECTOR,- MENU_ITEM_SELECTOR,- MENU_SEPARATOR_CLASS,- TOAST_CLASS,- TOAST_DURATION_MS,-} from '../constants'+import { createRoot } from 'react-dom/client'+import { CONTEXT_MENU_EVENT, LINK_SELECTOR, TOAST_DURATION_MS } from '../constants'import { locale } from '../locales'import { loadRegistry } from '../service/registry'import { writeClipboard } from '../utils/clipboard'@@ -31,31 +28,66 @@ import {workspaceForSession,workspaceFrom,} from './locate'-import { createMenuItem, createMenuRoot, createSeparator, positionMenu } from './menu-dom'++/** 带快捷键提示的官方菜单项文案:官方 `Menu` 只吃 ReactNode,提示与标签同行两端对齐。 */+function menuLabel(label: string, shortcut: string): ReactNode {+ if (shortcut === '')+ return label+ return (+ <span style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 16, width: '100%' }}>+ <span>{label}</span>+ <span style={{ color: 'var(--dsw-alias-label-tertiary)', fontSize: 11 }}>{shortcut}</span>+ </span>+ )+}/*** 右键菜单特性:解析右键目标 → 组装菜单 → 动作经 `service/` 收口。- * 官方会话/工作区操作全部转交官方组件,插件只补充宿主能力与扩展项。+ * 弹层(菜单与 toast)一律走官方 primitives,插件只补充宿主能力与扩展项。*/export const contextMenuFeature = defineRegister<ClientContext>((controller, _ctx, adapter) => {const sessions = adapter.sessions as unknown as SessionsRuntimeLikeconst workspaces = adapter.workspaces as unknown as WorkspacesRuntimeLikeconst registry = loadRegistry()- let menu: HTMLElement | null = null+ let host: HTMLDivElement | null = null+ let root: ReturnType<typeof createRoot> | null = null+ let toastHost: HTMLDivElement | null = null+ let toastRoot: ReturnType<typeof createRoot> | null = null+ let toastSeq = 0+ let cursor = { x: 0, y: 0 }const close = (): void => {- menu?.remove()- menu = null+ if (root === null)+ return+ const current = root+ const currentHost = host+ root = null+ host = null+ current.unmount()+ currentHost?.remove()}const toast = (message: string): void => {- document.querySelector(`.${TOAST_CLASS}`)?.remove()- const node = document.createElement('div')- node.className = TOAST_CLASS- node.textContent = message- document.body.appendChild(node)- controller.timeout(() => node.remove(), TOAST_DURATION_MS)+ if (typeof document === 'undefined')+ return+ if (toastRoot === null) {+ toastHost = document.createElement('div')+ document.body.appendChild(toastHost)+ toastRoot = createRoot(toastHost)+ }+ const seq = ++toastSeq+ toastRoot.render(+ <Toast+ key={seq}+ text={message}+ holdMs={TOAST_DURATION_MS}+ onDone={() => {+ if (seq === toastSeq)+ toastRoot?.render(null)+ }}+ />,+ )}const copyText = async (value: string, message: string): Promise<void> => {@@ -64,38 +96,30 @@ export const contextMenuFeature = defineRegister<ClientContext>((controller, _cttoast(message)}- const createComposer = (root: HTMLElement): MenuComposer => {+ const createComposer = (): { composer: MenuComposer, actions: Map<string, () => Promise<ActionOutcome | void> | void>, entries: MenuEntry[] } => {+ const actions = new Map<string, () => Promise<ActionOutcome | void> | void>()+ const entries: MenuEntry[] = []+ let seq = 0+const add = (label: string,action: () => Promise<ActionOutcome | void> | void,shortcut = '',danger = false,): void => {- root.appendChild(createMenuItem({- label,- shortcut,- danger,- onClick: async () => {- close()- try {- const outcome = await action()- if (outcome && !outcome.ok)- toast(outcome.error || locale.text('unknownError'))- }- catch (error) {- toast(error instanceof Error ? error.message : String(error))- }- },- }))+ const id = `item:${seq++}`+ actions.set(id, action)+ entries.push({ id, label: menuLabel(label, shortcut), danger })}const split = (): void => {- if (!root.childElementCount || root.lastElementChild?.classList.contains(MENU_SEPARATOR_CLASS))+ const last = entries.at(-1)+ if (last === undefined || ('type' in last && last.type === 'separator'))return- root.appendChild(createSeparator())+ entries.push({ type: 'separator', id: `separator:${seq++}` })}- return {+ const composer: MenuComposer = {sessions,workspaces,add,@@ -109,6 +133,22 @@ export const contextMenuFeature = defineRegister<ClientContext>((controller, _ctonFailure: toast,}),}+ return { composer, actions, entries }+ }++ const runAction = async (actions: Map<string, () => Promise<ActionOutcome | void> | void>, id: string): Promise<void> => {+ const action = actions.get(id)+ close()+ if (action === undefined)+ return+ try {+ const outcome = await action()+ if (outcome && !outcome.ok)+ toast(outcome.error || locale.text('unknownError'))+ }+ catch (error) {+ toast(error instanceof Error ? error.message : String(error))+ }}const onContextMenu = (event: MouseEvent): void => {@@ -134,9 +174,6 @@ export const contextMenuFeature = defineRegister<ClientContext>((controller, _ctevent.preventDefault()event.stopPropagation()close()- const root = createMenuRoot()- document.body.appendChild(root)- menu = rootconst extensions = registry.list()globalThis.dispatchEvent(new CustomEvent(CONTEXT_MENU_EVENT, {@@ -152,7 +189,7 @@ export const contextMenuFeature = defineRegister<ClientContext>((controller, _ct},}))- const composer = createComposer(root)+ const { composer, actions, entries } = createComposer()if (row)buildSessionMenu(composer, row, session, sessionWorkspace, extensions)else if (ungroupedRow)@@ -163,42 +200,36 @@ export const contextMenuFeature = defineRegister<ClientContext>((controller, _ctbuildEditableMenu(composer, editable, selection)elsebuildSelectionMenu(composer, selection, link, surface)-- positionMenu(root, event.clientX, event.clientY)- }-- const onPointerDown = (event: PointerEvent): void => {- if (menu && !menu.contains(event.target as Node))- close()- }-- const onKeyDown = (event: KeyboardEvent): void => {- if (!menu)- return- if (event.key === 'Escape') {- close()+ if (entries.length === 0)return- }- const items = [...menu.querySelectorAll<HTMLElement>(MENU_ITEM_SELECTOR)]- const current = items.indexOf(document.activeElement as HTMLElement)- let next: Element | null = null- if (event.key === 'ArrowDown')- next = items[(current + 1 + items.length) % items.length]- else if (event.key === 'ArrowUp')- next = items[(current - 1 + items.length) % items.length]- else if (event.key === 'Home')- next = items[0]- else if (event.key === 'End')- next = items.at(-1) ?? null- if (next) {- event.preventDefault()- ;(next as HTMLElement).focus()- }++ cursor = { x: event.clientX, y: event.clientY }+ host = document.createElement('div')+ document.body.appendChild(host)+ const current = createRoot(host)+ root = current+ current.render(+ <Menu+ open+ autoFocus+ portal+ align="start"+ items={entries}+ anchor={<span />}+ getAnchorRect={() => new DOMRect(cursor.x, cursor.y, 0, 0)}+ onSelect={id => void runAction(actions, id)}+ onClose={close}+ />,+ )}controller.add(registry.hold())controller.add(close)+ controller.add(() => {+ toastRoot?.unmount()+ toastHost?.remove()+ toastRoot = null+ toastHost = null+ })controller.listen('contextmenu', onContextMenu, { capture: true })- controller.listen('pointerdown', onPointerDown, { capture: true })- controller.listen('keydown', onKeyDown, { capture: true })})diff --git a/packages/dsh-tauri-rightclick/src/client/register/context-menu.types.ts b/packages/dsh-tauri-rightclick/src/client/register/context-menu.types.tsindex a1a9bb13..da904a7f 100644--- a/packages/dsh-tauri-rightclick/src/client/register/context-menu.types.ts+++ b/packages/dsh-tauri-rightclick/src/client/register/context-menu.types.ts@@ -1,12 +1,5 @@import type { ActionOutcome, SessionsRuntimeLike, WorkspacesRuntimeLike } from '../types'-export interface MenuItemOptions {- label: string- shortcut?: string- danger?: boolean- onClick: () => void | Promise<void>-}-/** 官方菜单项转交所需的调度器与失败回调(副作用一律经 controller 托管)。 */export interface OfficialSelectOptions {workspace?: boolean@@ -14,7 +7,7 @@ export interface OfficialSelectOptions {onFailure: (message: string) => void}-/** 菜单组装面:builder 只声明「有哪些项」,DOM 构建与副作用留在 feature 内。 */+/** 菜单组装面:builder 只声明「有哪些项」,官方 `Menu` 的渲染与副作用留在 feature 内。 */export interface MenuComposer {sessions: SessionsRuntimeLikeworkspaces: WorkspacesRuntimeLikediff --git a/packages/dsh-tauri-rightclick/src/client/register/menu-dom.ts b/packages/dsh-tauri-rightclick/src/client/register/menu-dom.tsdeleted file mode 100644index 710560d1..00000000--- a/packages/dsh-tauri-rightclick/src/client/register/menu-dom.ts+++ /dev/null@@ -1,55 +0,0 @@-import type { MenuItemOptions } from './context-menu.types'-import { clamp } from 'dsh-tauri/client'-import {- MENU_BLOCK,- MENU_ITEM_CLASS,- MENU_ITEM_DANGER_CLASS,- MENU_SEPARATOR_CLASS,- MENU_SHORTCUT_CLASS,- MENU_VIEWPORT_MARGIN,-} from '../constants'--export function createMenuRoot(): HTMLDivElement {- const root = document.createElement('div')- root.className = MENU_BLOCK- root.setAttribute('role', 'menu')- root.style.visibility = 'hidden'- return root-}--export function createMenuItem(options: MenuItemOptions): HTMLButtonElement {- const button = document.createElement('button')- button.type = 'button'- button.className = options.danger ? `${MENU_ITEM_CLASS} ${MENU_ITEM_DANGER_CLASS}` : MENU_ITEM_CLASS- button.setAttribute('role', 'menuitem')- button.tabIndex = -1- const label = document.createElement('span')- label.textContent = options.label- button.appendChild(label)- if (options.shortcut) {- const hint = document.createElement('span')- hint.className = MENU_SHORTCUT_CLASS- hint.textContent = options.shortcut- button.appendChild(hint)- }- button.onclick = () => {- options.onClick()- }- return button-}--export function createSeparator(): HTMLDivElement {- const node = document.createElement('div')- node.className = MENU_SEPARATOR_CLASS- node.setAttribute('role', 'separator')- return node-}--/** 限制在视口内(最小边距 6px),定位后显示并聚焦首个菜单项。 */-export function positionMenu(root: HTMLElement, x: number, y: number): void {- const rect = root.getBoundingClientRect()- root.style.left = `${clamp(x, MENU_VIEWPORT_MARGIN, innerWidth - rect.width - MENU_VIEWPORT_MARGIN)}px`- root.style.top = `${clamp(y, MENU_VIEWPORT_MARGIN, innerHeight - rect.height - MENU_VIEWPORT_MARGIN)}px`- root.style.visibility = 'visible'- root.querySelector('button')?.focus()-}diff --git a/packages/dsh-tauri-rightclick/src/client/register/styles.ts b/packages/dsh-tauri-rightclick/src/client/register/styles.tsdeleted file mode 100644index 35a3ab6e..00000000--- a/packages/dsh-tauri-rightclick/src/client/register/styles.ts+++ /dev/null@@ -1,8 +0,0 @@-import { mountStyle } from 'dsh-tauri-ui/client'-import { defineRegister } from 'dsh-tauri/client'-import { MENU_STYLE_ID } from '../constants'-import menuStyle from '../styles/index.cssr'--export const stylesFeature = defineRegister((controller) => {- controller.add(mountStyle(menuStyle, MENU_STYLE_ID))-})diff --git a/packages/dsh-tauri-rightclick/src/client/styles/index.cssr.ts b/packages/dsh-tauri-rightclick/src/client/styles/index.cssr.tsdeleted file mode 100644index 95d24904..00000000--- a/packages/dsh-tauri-rightclick/src/client/styles/index.cssr.ts+++ /dev/null@@ -1,70 +0,0 @@-import { cssr } from 'dsh-tauri-ui/client'--const { c, bem: { b, e, m } } = cssr--/** 右键菜单与动作反馈 toast(DOM 补丁样式,无 React 组件面)。 */--export default c([- b('menu', {- position: 'fixed',- zIndex: 2147483647,- width: 'max-content',- minWidth: '148px',- maxWidth: '260px',- padding: '4px',- background: 'var(--dsw-alias-bg-layer-2, #fff)',- color: 'var(--dsw-alias-label-primary, #161616)',- border: '1px solid var(--dsw-alias-border-l2, #ddd)',- borderRadius: '7px',- boxShadow: '0 5px 16px #00000029',- font: '13px/18px system-ui, sans-serif',- }, [- e('item', {- boxSizing: 'border-box',- width: '100%',- height: '30px',- padding: '0 8px',- textAlign: 'left',- whiteSpace: 'nowrap',- color: 'inherit',- background: 'transparent',- border: '0',- borderRadius: '5px',- cursor: 'pointer',- display: 'flex',- gap: '16px',- alignItems: 'center',- justifyContent: 'space-between',- }, [- c('&:hover, &:focus-visible', {- background: 'var(--dsw-alias-interactive-bg-hover, #0000000f)',- outline: 'none',- }),- m('danger', {- color: 'var(--dsw-alias-state-error-primary, #d93025)',- }),- ]),- e('shortcut', {- color: 'var(--dsw-alias-label-tertiary, #777)',- fontSize: '11px',- }),- e('separator', {- height: '1px',- margin: '4px -4px',- background: 'var(--dsw-alias-border-l2, #ddd)',- }),- ]),- b('toast', {- position: 'fixed',- zIndex: 2147483647,- left: '50%',- bottom: '28px',- transform: 'translateX(-50%)',- padding: '7px 12px',- borderRadius: '7px',- background: '#222',- color: '#fff',- font: '13px/18px system-ui, sans-serif',- boxShadow: '0 6px 20px #0003',- }),-])diff --git a/packages/dsh-tauri-worktree/package.json b/packages/dsh-tauri-worktree/package.jsonindex 485a119c..249fd6fc 100644--- a/packages/dsh-tauri-worktree/package.json+++ b/packages/dsh-tauri-worktree/package.json@@ -34,6 +34,7 @@"client": {"inject": ["@deepseek-ai/dsh-client-ui-layout",+ "@deepseek-ai/dsh-client-ui-primitives","dsh-tauri","dsh-tauri-ui"],diff --git a/packages/dsh-tauri-worktree/src/client/components/dialog.cssr.ts b/packages/dsh-tauri-worktree/src/client/components/dialog.cssr.tsindex 7799cdba..c6d8694a 100644--- a/packages/dsh-tauri-worktree/src/client/components/dialog.cssr.ts+++ b/packages/dsh-tauri-worktree/src/client/components/dialog.cssr.ts@@ -1,30 +1,13 @@import { cssr } from 'dsh-tauri-ui/client'-const { bem: { b, e, m } } = cssr+const { bem: { b, e } } = cssr+/**+ * 工作树对话框只用官方 primitives `Modal` 之外的字段与路径行样式:+ * 遮罩、卡片、标题、页脚与关闭行为由 `Modal` 承担。+ */export default b('worktree', [- e('modal', {- position: 'absolute',- inset: 0,- zIndex: 1000,- display: 'grid',- placeItems: 'center',- background: 'rgba(0,0,0,0.4)',- }),- e('dialog-card', {- boxSizing: 'border-box',- width: 'min(460px, calc(100vw - 48px))',- padding: '20px 22px',- borderRadius: '16px',- background: 'var(--dsw-alias-bg-base)',- color: 'var(--dsw-alias-label-primary)',- boxShadow: '0 24px 64px rgba(0,0,0,0.28)',- display: 'flex',- flexDirection: 'column',- gap: '14px',- }),- e('dialog-title', { fontSize: '16px', fontWeight: 600, lineHeight: '24px', margin: 0 }),- e('dialog-body', { fontSize: '13px', lineHeight: '20px', color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))', margin: 0 }),+ e('dialog-form', { display: 'flex', flexDirection: 'column', gap: '14px' }),e('dialog-field', { display: 'flex', flexDirection: 'column', gap: '6px' }),e('dialog-field-label', { fontSize: '12px', lineHeight: '18px', color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))' }),e('dialog-input-wrap', {@@ -52,21 +35,4 @@ export default b('worktree', [e('dialog-path-key', { flex: 'none', color: 'var(--dsw-alias-label-secondary, var(--dsw-alias-label-primary))' }),e('dialog-path-value', { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', fontFamily: 'monospace' }),e('dialog-error', { fontSize: '12px', lineHeight: '18px', color: '#c0392b' }),- e('dialog-footer', { display: 'flex', justifyContent: 'flex-end', gap: '10px', marginTop: '4px' }),- e('dialog-button', {- boxSizing: 'border-box',- height: '36px',- padding: '0 16px',- border: 'none',- borderRadius: '10px',- fontFamily: 'inherit',- fontSize: '13px',- cursor: 'pointer',- whiteSpace: 'nowrap',- }, [- m('ghost', { color: 'var(--dsw-alias-label-primary)', background: 'var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,0.08))' }),- m('primary', { color: '#fff', background: 'var(--dsw-alias-bg-accent, #2f6feb)' }),- m('danger', { color: '#fff', background: '#c0392b' }),- m('disabled', { opacity: 0.5, cursor: 'not-allowed' }),- ]),])diff --git a/packages/dsh-tauri-worktree/src/client/components/dialog.tsx b/packages/dsh-tauri-worktree/src/client/components/dialog.tsxindex 3c81ee3e..8c65ba7b 100644--- a/packages/dsh-tauri-worktree/src/client/components/dialog.tsx+++ b/packages/dsh-tauri-worktree/src/client/components/dialog.tsx@@ -1,9 +1,9 @@import type { ReactElement } from 'react'import type { SessionsRuntime, WorkspacesRuntime } from '../service/session-switch.types'import type { WorktreeDialogProps } from './dialog.types'+import { Button, Modal } from '@deepseek-ai/dsh-client-ui-primitives'import { useMountStyle } from 'dsh-tauri-ui/client'-import { find, useEventListener } from 'dsh-tauri/client'-import { useRef } from 'react'+import { find } from 'dsh-tauri/client'import { DIALOG_STYLE_ID } from '../constants'import { useCurrentSession } from '../hooks/use-current-session'import { useDiscard } from '../hooks/use-discard'@@ -25,44 +25,34 @@ export function WorktreeDialog({ workspacesRuntime, sessionsRuntime }: WorktreeDconst abandonOpen = state.abandonOpenconst closeAll = (): void => store.worktree.patch(sessionId, { checkoutOpen: false, abandonOpen: false })- const documentRef = useRef<Document | null | undefined>(- typeof document === 'undefined' ? undefined : document,- )- useEventListener(documentRef, 'keydown', (event: KeyboardEvent) => {- if ((checkoutOpen || abandonOpen) && event.key === 'Escape')- closeAll()- })-if (!sessionId || (!checkoutOpen && !abandonOpen))return nullreturn (- <div className="dshp-worktree">- <div className="dshp-worktree__modal" data-dsh-worktree-dialog="1" onClick={closeAll}>- {checkoutOpen && (- <CheckoutDialog- sessionId={sessionId}- worktreeKey={state.worktreeKey}- projectPath={state.projectPath}- branchName={state.branchName}- error={state.error}- workspacesRuntime={workspacesRuntime}- sessionsRuntime={sessionsRuntime}- onCancel={closeAll}- />- )}- {abandonOpen && (- <AbandonDialog- sessionId={sessionId}- worktreeKey={state.worktreeKey}- error={state.error}- workspacesRuntime={workspacesRuntime}- discardWorktree={discardWorktree}- onCancel={closeAll}- />- )}- </div>- </div>+ <>+ {checkoutOpen && (+ <CheckoutDialog+ sessionId={sessionId}+ worktreeKey={state.worktreeKey}+ projectPath={state.projectPath}+ branchName={state.branchName}+ error={state.error}+ workspacesRuntime={workspacesRuntime}+ sessionsRuntime={sessionsRuntime}+ onCancel={closeAll}+ />+ )}+ {abandonOpen && (+ <AbandonDialog+ sessionId={sessionId}+ worktreeKey={state.worktreeKey}+ error={state.error}+ workspacesRuntime={workspacesRuntime}+ discardWorktree={discardWorktree}+ onCancel={closeAll}+ />+ )}+ </>)}@@ -114,47 +104,44 @@ function CheckoutDialog(props: {}return (- <div- className="dshp-worktree__dialog-card"- role="dialog"- aria-modal="true"- aria-label={locale.text('checkoutTitle')}- onClick={event => event.stopPropagation()}+ <Modal+ open+ onClose={onCancel}+ title={locale.text('checkoutTitle')}+ closeLabel={locale.text('close')}+ footer={(+ <>+ <Button variant="outline" onClick={onCancel}>{locale.text('checkoutCancel')}</Button>+ <Button variant="primary" disabled={disabled} onClick={() => void confirm()}>+ {locale.text('checkoutConfirm')}+ </Button>+ </>+ )}>- <h2 className="dshp-worktree__dialog-title">{locale.text('checkoutTitle')}</h2>- <div className="dshp-worktree__dialog-field">- <label className="dshp-worktree__dialog-field-label" htmlFor="wt-checkout-branch">{locale.text('checkoutBranchLabel')}</label>- <div className="dshp-worktree__dialog-input-wrap">- <input- id="wt-checkout-branch"- className="dshp-worktree__dialog-input"- value={branchName}- placeholder={locale.text('branchPlaceholder')}- onChange={event => updateBranch(event.target.value)}- />+ <div className="dshp-worktree__dialog-form">+ <div className="dshp-worktree__dialog-field">+ <label className="dshp-worktree__dialog-field-label" htmlFor="wt-checkout-branch">{locale.text('checkoutBranchLabel')}</label>+ <div className="dshp-worktree__dialog-input-wrap">+ <input+ id="wt-checkout-branch"+ className="dshp-worktree__dialog-input"+ value={branchName}+ placeholder={locale.text('branchPlaceholder')}+ onChange={event => updateBranch(event.target.value)}+ />+ </div></div>+ <div className="dshp-worktree__dialog-path-row">+ <span className="dshp-worktree__dialog-path-key">{locale.text('checkoutCurrentPath')}</span>+ <span className="dshp-worktree__dialog-path-value">{worktreeKey || '—'}</span>+ </div>+ <div className="dshp-worktree__dialog-path-row">+ <span className="dshp-worktree__dialog-path-key">{locale.text('checkoutTargetPath')}</span>+ <span className="dshp-worktree__dialog-path-value">{projectPath.replaceAll('\\', '/') || '—'}</span>+ </div>+ {props.error && <div className="dshp-worktree__dialog-error">{props.error}</div>}</div>- <div className="dshp-worktree__dialog-path-row">- <span className="dshp-worktree__dialog-path-key">{locale.text('checkoutCurrentPath')}</span>- <span className="dshp-worktree__dialog-path-value">{worktreeKey || '—'}</span>- </div>- <div className="dshp-worktree__dialog-path-row">- <span className="dshp-worktree__dialog-path-key">{locale.text('checkoutTargetPath')}</span>- <span className="dshp-worktree__dialog-path-value">{projectPath.replaceAll('\\', '/') || '—'}</span>- </div>- {props.error && <div className="dshp-worktree__dialog-error">{props.error}</div>}- <div className="dshp-worktree__dialog-footer">- <button type="button" className={`${'dshp-worktree__dialog-button'} ${'dshp-worktree__dialog-button--ghost'}`} onClick={onCancel}>{locale.text('checkoutCancel')}</button>- <button- type="button"- className={`${'dshp-worktree__dialog-button'} ${'dshp-worktree__dialog-button--primary'} ${disabled ? 'dshp-worktree__dialog-button--disabled' : ''}`}- disabled={disabled}- onClick={() => void confirm()}- >- {locale.text('checkoutConfirm')}- </button>- </div>- </div>+ </Modal>)}@@ -174,26 +161,22 @@ function AbandonDialog(props: {await workspacesRuntime.archiveSession(sessionId)}return (- <div- className="dshp-worktree__dialog-card"- role="dialog"- aria-modal="true"- aria-label={locale.text('abandonTitle')}- onClick={event => event.stopPropagation()}+ <Modal+ open+ onClose={onCancel}+ title={locale.text('abandonTitle')}+ description={locale.text('abandonBody')}+ closeLabel={locale.text('close')}+ footer={(+ <>+ <Button variant="outline" onClick={onCancel}>{locale.text('abandonCancel')}</Button>+ <Button variant="primary" onClick={() => void abandon()}>+ {locale.text('abandonConfirm')}+ </Button>+ </>+ )}>- <h2 className="dshp-worktree__dialog-title">{locale.text('abandonTitle')}</h2>- <p className="dshp-worktree__dialog-body">{locale.text('abandonBody')}</p>- {props.error && <div className="dshp-worktree__dialog-error">{props.error}</div>}- <div className="dshp-worktree__dialog-footer">- <button type="button" className={`${'dshp-worktree__dialog-button'} ${'dshp-worktree__dialog-button--ghost'}`} onClick={onCancel}>{locale.text('abandonCancel')}</button>- <button- type="button"- className={`${'dshp-worktree__dialog-button'} ${'dshp-worktree__dialog-button--danger'}`}- onClick={() => void abandon()}- >- {locale.text('abandonConfirm')}- </button>- </div>- </div>+ {props.error === '' ? undefined : <div className="dshp-worktree__dialog-error">{props.error}</div>}+ </Modal>)}diff --git a/packages/dsh-tauri-worktree/src/client/locales/index.ts b/packages/dsh-tauri-worktree/src/client/locales/index.tsindex 273a7d1f..e3255776 100644--- a/packages/dsh-tauri-worktree/src/client/locales/index.ts+++ b/packages/dsh-tauri-worktree/src/client/locales/index.ts@@ -2,6 +2,7 @@ import { defineLocale } from 'dsh-tauri/client'import { PLUGIN_ID } from '../constants'const zh = {+ close: '关闭',modeLabel: '工作模式',modeLocal: '本地',modeWorktree: '工作树',@@ -35,6 +36,7 @@ const zh = {} as constconst en: Record<keyof typeof zh, string> = {+ close: 'Close',modeLabel: 'Mode',modeLocal: 'Local',modeWorktree: 'Worktree',diff --git a/test/e2e/support/browser.ts b/test/e2e/support/browser.tsindex 11d57ada..3de8ed44 100644--- a/test/e2e/support/browser.ts+++ b/test/e2e/support/browser.ts@@ -37,7 +37,6 @@ export const SCHEDULER_ICON = '[data-dsh-scheduler-icon]'export const WORKTREE_ICON = '[data-dsh-worktree-icon]'export const WORKTREE_MODE_ANCHOR = '[data-dsh-tauri-worktree-mode-anchor]'export const WORKTREE_SURFACE = '[data-dsh-worktree-surface]'-export const WORKTREE_DIALOG = '[data-dsh-worktree-dialog="1"]'export const SESSION_ARCHIVE_ITEM = '[data-dsh-tauri-session-archive-item]'export const SESSION_ARCHIVE_MENU_PATCHED = '[data-dsh-tauri-session-archive-menu-patched="1"]'export const TURNREWIND_CARD = '[data-turnrewind-card]'