Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(desktop): unify Select on shared parts and menu glide highlight
kirozenge26bca38a211
diff --git a/apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx b/apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsxindex 63db923517..cc708f4410 100644--- a/apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx+++ b/apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx@@ -6,7 +6,7 @@* 颜色全走主题 token(规则 16):trigger 用 settings-input,下拉面板用 model-dropdown。*/-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { Check, ChevronDown, ChevronRight } from 'lucide-react';import { useState } from 'react';import { useTranslation } from 'react-i18next';@@ -42,7 +42,7 @@ function LimitItem({ value, label }: { value: string; label: string }): React.Rereturn (<Select.Itemvalue={value}- className="flex cursor-pointer items-center justify-between gap-3 rounded-[8px] px-2.5 py-1.5 text-12 outline-none data-[highlighted]:bg-[var(--model-item-hover)]"+ className="flex cursor-pointer items-center justify-between gap-3 rounded-[8px] px-2.5 py-1.5 text-12 outline-none"style={{ color: 'var(--model-item-text)' }}><Select.ItemText>{label}</Select.ItemText>@@ -88,7 +88,7 @@ function LimitSelect({<Select.Contentposition="popper"sideOffset={4}- className="z-[10002] overflow-hidden rounded-[12px] border p-1"+ className="z-[10002] overflow-hidden rounded-[12px] border p-1.5"style={{// 宽度严格跟随 trigger(radix popper 暴露的变量),避免 popup 按内容宽度自适应。width: 'var(--radix-select-trigger-width)',diff --git a/apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx b/apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsxindex 867660c88d..01404c024c 100644--- a/apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx+++ b/apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx@@ -3,7 +3,7 @@import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { Check, ChevronDown } from 'lucide-react';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { OneshotModelPinPicker } from '@/cindy-brain/OneshotModelPinPicker';import { useAuth } from '@/contexts/AuthContext';@@ -183,7 +183,7 @@ export function AuxiliaryModelSection() {className={cn('flex h-9 w-[220px] max-w-full min-w-0 shrink items-center justify-between gap-3 rounded-full border px-3.5 text-13 outline-none transition-colors','border-[var(--settings-input-border)] bg-[var(--settings-input-bg)] text-[var(--settings-input-text)]',- 'hover:bg-[var(--settings-menu-bg-hover)] focus:ring-2 focus:ring-[var(--focus-ring-soft)]',+ 'hover:bg-[var(--settings-menu-bg-hover)] focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]','disabled:cursor-not-allowed disabled:opacity-55',)}>@@ -205,7 +205,7 @@ export function AuxiliaryModelSection() {align="start"sideOffset={6}className={cn(- 'z-[10010] w-[var(--radix-select-trigger-width)] min-w-[220px] overflow-hidden rounded-xl p-2',+ 'z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl p-2','border border-[var(--settings-input-border)] bg-[var(--settings-theme-card-bg)]',)}>@@ -216,8 +216,8 @@ export function AuxiliaryModelSection() {value={option}className={cn('flex h-9 w-full cursor-pointer select-none items-center justify-between gap-3 rounded-[8px] px-3 text-left text-13 outline-none transition-colors',- 'text-[var(--settings-input-text)] data-[highlighted]:bg-[var(--settings-menu-bg-hover)]',- 'data-[state=checked]:bg-[var(--settings-menu-bg-selected)] data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]',+ 'text-[var(--settings-input-text)]',+ 'data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]',)}><Select.ItemText className="min-w-0 flex-1 whitespace-nowrap">diff --git a/apps/desktop/src/renderer/components/settings/LanguageSection.tsx b/apps/desktop/src/renderer/components/settings/LanguageSection.tsxindex a178131ce9..d39a7c7cf6 100644--- a/apps/desktop/src/renderer/components/settings/LanguageSection.tsx+++ b/apps/desktop/src/renderer/components/settings/LanguageSection.tsx@@ -6,7 +6,7 @@import { useTranslation } from 'react-i18next';import { Check, ChevronDown } from 'lucide-react';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { cn } from '@/lib/utils';import { useLocale } from '@/hooks/useLocale';@@ -54,7 +54,7 @@ export function LanguageSection() {className={cn('flex h-9 w-[320px] max-w-full shrink-0 items-center justify-between gap-3 rounded-full border px-3.5 text-13 outline-none transition-colors','border-[var(--settings-input-border)] bg-[var(--settings-input-bg)] text-[var(--settings-input-text)]',- 'hover:bg-[var(--settings-menu-bg-hover)] focus:ring-2 focus:ring-[var(--focus-ring-soft)]',+ 'hover:bg-[var(--settings-menu-bg-hover)] focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]',)}><span className="min-w-0 truncate text-left">@@ -75,9 +75,8 @@ export function LanguageSection() {align="start"sideOffset={6}className={cn(- 'z-[10010] max-h-[18rem] w-[var(--radix-select-trigger-width)] min-w-[220px] overflow-y-auto rounded-xl p-2',+ 'z-[10010] max-h-[min(18rem,var(--radix-select-content-available-height))] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl p-2','border border-[var(--settings-input-border)] bg-[var(--settings-theme-card-bg)]',- 'shadow-[var(--shadow-menu)]',)}><Select.Viewport className="flex flex-col gap-[2px]">@@ -87,8 +86,8 @@ export function LanguageSection() {value={opt}className={cn('flex h-9 w-full cursor-pointer select-none items-center justify-between gap-3 rounded-[8px] px-3 text-left text-13 outline-none transition-colors',- 'text-[var(--settings-input-text)] data-[highlighted]:bg-[var(--settings-menu-bg-hover)]',- 'data-[state=checked]:bg-[var(--settings-menu-bg-selected)] data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]',+ 'text-[var(--settings-input-text)]',+ 'data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]',)}><Select.ItemText className="min-w-0 truncate">diff --git a/apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx b/apps/desktop/src/renderer/components/settings/StorageManagementCard.tsxindex 0b2a5850ae..fba4a4fe84 100644--- a/apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx+++ b/apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx@@ -20,7 +20,7 @@ import { useEffect, useId, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { Check, ChevronDown, RefreshCw } from 'lucide-react';import * as AlertDialog from '@radix-ui/react-alert-dialog';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { cn } from '@/lib/utils';import { toast } from '@/lib/toast';@@ -947,8 +947,8 @@ function DatabaseSlimmingSection({align="end"sideOffset={6}className={cn(- 'z-[10010] min-w-[var(--radix-select-trigger-width)] rounded-xl p-1.5',- 'border border-[var(--settings-input-border)] bg-[var(--settings-theme-card-bg)] shadow-[var(--shadow-menu)]',+ 'z-[10010] w-[var(--radix-select-trigger-width)] rounded-xl p-1.5',+ 'border border-[var(--settings-input-border)] bg-[var(--settings-theme-card-bg)]',)}><Select.Viewport className="flex flex-col gap-0.5">@@ -958,8 +958,8 @@ function DatabaseSlimmingSection({value={String(age)}className={cn('flex h-8 cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-2.5 text-12 outline-none transition-colors',- 'text-[var(--settings-input-text)] data-[highlighted]:bg-[var(--settings-menu-bg-hover)]',- 'data-[state=checked]:bg-[var(--settings-menu-bg-selected)] data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]',+ 'text-[var(--settings-input-text)]',+ 'data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]',)}><Select.ItemText>diff --git a/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx b/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsxindex c972e1d8d2..0b25d3cbe6 100644--- a/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx+++ b/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx@@ -17,7 +17,7 @@*/import { useCallback, useEffect, useMemo, useState } from 'react';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { Check, ChevronDown, ChevronUp } from 'lucide-react';import { useTranslation } from 'react-i18next';@@ -137,7 +137,7 @@ export function TerminalShellSection() {className={cn('flex h-9 w-full min-w-0 items-center justify-between gap-2 rounded-full border px-3 text-12 outline-none','bg-[var(--settings-input-bg)] text-[var(--settings-input-text)]',- 'border-[var(--settings-input-border)] focus:ring-2 focus:ring-[var(--focus-ring-soft)]',+ 'border-[var(--settings-input-border)] focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]','data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60',)}>@@ -155,7 +155,7 @@ export function TerminalShellSection() {align="start"sideOffset={4}className={cn(- 'z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border p-1',+ 'z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border p-1.5','max-h-[min(15rem,var(--radix-select-content-available-height))]','border-[var(--cmd-palette-border)] bg-[var(--cmd-palette-bg)]',)}@@ -203,7 +203,7 @@ function ShellOption({value={value}className={cn('flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-12 outline-none',- 'text-[var(--settings-input-text)] data-[highlighted]:bg-[var(--surface-hover)]',+ 'text-[var(--settings-input-text)]',unavailable && 'text-[var(--settings-section-desc)]',)}>diff --git a/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx b/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsxindex 4af3a79f4a..8925639142 100644--- a/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx+++ b/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx@@ -22,7 +22,7 @@ import {} from 'lucide-react';import { useTranslation } from 'react-i18next';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { Switch } from '@/components/ui/switch';import { useCodexMicroGuard } from '@/hooks/useCodexMicroGuard';import { useWorkLouderCodex } from '@/hooks/useWorkLouderCodex';@@ -1278,7 +1278,7 @@ function SelectControl({className={cn('flex h-9 min-w-[150px] items-center justify-between gap-2 rounded-full border px-3 text-12','border-[var(--settings-input-border)] bg-[var(--settings-input-bg)] text-[var(--settings-input-text)]',- 'outline-none focus:ring-2 focus:ring-[var(--focus-ring-soft)]',+ 'outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]','data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',className,)}@@ -1321,7 +1321,6 @@ function SelectControl({className={cn('flex w-full cursor-pointer select-none items-center gap-2 rounded-[8px] px-2.5 py-1.5 text-left text-12 outline-none','text-[var(--text-primary)]',- 'data-[highlighted]:bg-[var(--surface-hover)]','data-[state=checked]:font-medium','data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',)}diff --git a/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx b/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsxindex 5a9a5df1c1..60cc47dfad 100644--- a/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx+++ b/apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx@@ -14,7 +14,7 @@ import {} from 'lucide-react';import { useTranslation } from 'react-i18next';import * as Dialog from '@radix-ui/react-dialog';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { Switch } from '@/components/ui/switch';import { useXboxGamepad } from '@/hooks/useXboxGamepad';@@ -654,7 +654,7 @@ function SelectControl({className={cn('flex h-9 min-w-[150px] items-center justify-between gap-2 rounded-full border px-3 text-12','border-[var(--settings-input-border)] bg-[var(--settings-input-bg)] text-[var(--settings-input-text)]',- 'outline-none focus:ring-2 focus:ring-[var(--focus-ring-soft)]',+ 'outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]','data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',className,)}@@ -696,7 +696,6 @@ function SelectControl({className={cn('flex w-full cursor-pointer select-none items-center gap-2 rounded-[8px] px-2.5 py-1.5 text-left text-12 outline-none','text-[var(--text-primary)]',- 'data-[highlighted]:bg-[var(--surface-hover)]','data-[state=checked]:font-medium',)}>diff --git a/apps/desktop/src/renderer/components/settings/usage/UsageDeviceSelect.tsx b/apps/desktop/src/renderer/components/settings/usage/UsageDeviceSelect.tsxindex 9e9493bf78..3011b6536d 100644--- a/apps/desktop/src/renderer/components/settings/usage/UsageDeviceSelect.tsx+++ b/apps/desktop/src/renderer/components/settings/usage/UsageDeviceSelect.tsx@@ -8,7 +8,7 @@import React from 'react';import { useTranslation } from 'react-i18next';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { Check, ChevronDown } from 'lucide-react';import type { UsageHistoryDevice } from '@/hooks/useUsageHistory';@@ -67,7 +67,7 @@ const STATUS_KEY: Record<Exclude<UsageHistoryDevice['status'], 'ok' | 'syncing'>};const itemClassName =- 'flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[highlighted]:bg-[var(--surface-hover)] data-[state=checked]:bg-[var(--settings-menu-bg-selected)] data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]';+ 'flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]';export function UsageDeviceSelect({value,@@ -113,7 +113,7 @@ export function UsageDeviceSelect({<Select.Root value={value} onValueChange={onValueChange}><Select.Triggeraria-label={t('usageHistory.device.ariaLabel')}- className="flex h-9 w-[190px] items-center justify-between gap-2 rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 text-13 text-[var(--text-primary)] outline-none focus:ring-2 focus:ring-[var(--focus-ring-soft)]"+ className="flex h-9 w-[190px] items-center justify-between gap-2 rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 text-13 text-[var(--text-primary)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]"><span className="min-w-0 truncate"><Select.Value />@@ -128,7 +128,7 @@ export function UsageDeviceSelect({side="bottom"align="end"sideOffset={4}- className="z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-1"+ className="z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-1.5"><Select.Viewport>{options.map((option) => {diff --git a/apps/desktop/src/renderer/components/settings/usage/UsageFilterSelect.tsx b/apps/desktop/src/renderer/components/settings/usage/UsageFilterSelect.tsxindex 256404e4d8..090b995f32 100644--- a/apps/desktop/src/renderer/components/settings/usage/UsageFilterSelect.tsx+++ b/apps/desktop/src/renderer/components/settings/usage/UsageFilterSelect.tsx@@ -5,7 +5,7 @@*/import React from 'react';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { Check, ChevronDown } from 'lucide-react';import { cn } from '@/lib/utils';@@ -18,7 +18,7 @@ export interface UsageFilterOption {}const itemClassName =- 'flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[highlighted]:bg-[var(--surface-hover)] data-[state=checked]:bg-[var(--settings-menu-bg-selected)] data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)] data-[disabled]:cursor-default data-[disabled]:opacity-50';+ 'flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)] data-[disabled]:cursor-default data-[disabled]:opacity-50';export function UsageFilterSelect({value,@@ -41,7 +41,7 @@ export function UsageFilterSelect({<Select.Triggeraria-label={ariaLabel}className={cn(- 'flex h-9 w-[190px] max-w-full items-center justify-between gap-2 rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 text-13 text-[var(--text-primary)] outline-none focus:ring-2 focus:ring-[var(--focus-ring-soft)] disabled:cursor-default disabled:opacity-50',+ 'flex h-9 w-[190px] max-w-full items-center justify-between gap-2 rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 text-13 text-[var(--text-primary)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)] disabled:cursor-default disabled:opacity-50',className,)}>@@ -58,7 +58,7 @@ export function UsageFilterSelect({side="bottom"align="end"sideOffset={4}- className="z-[10010] max-h-[var(--radix-select-content-available-height)] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-1"+ className="z-[10010] max-h-[var(--radix-select-content-available-height)] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-1.5"><Select.Viewport>{options.map((option) => (diff --git a/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx b/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsxindex 47dc8f495b..a491216e34 100644--- a/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx+++ b/apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx@@ -23,7 +23,7 @@ import './usageCharts.css';import React, { useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { Check, ChevronDown, RefreshCw } from 'lucide-react';import { Spinner } from '@/components/ui/spinner';@@ -203,7 +203,7 @@ export function UsageHistorySection(): React.JSX.Element {<Select.Root value={range} onValueChange={handleRangeChange}><Select.Triggeraria-label={t('usageHistory.range.ariaLabel')}- className="flex h-9 w-[190px] items-center justify-between gap-2 rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 text-13 text-[var(--text-primary)] outline-none focus:ring-2 focus:ring-[var(--focus-ring-soft)]"+ className="flex h-9 w-[190px] items-center justify-between gap-2 rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-3 text-13 text-[var(--text-primary)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]"><Select.Value /><Select.Icon asChild>@@ -216,14 +216,14 @@ export function UsageHistorySection(): React.JSX.Element {side="bottom"align="end"sideOffset={4}- className="z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-1"+ className="z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-1.5"><Select.Viewport>{(['all', '30d', '7d', 'today'] as const).map((option) => (<Select.Itemkey={option}value={option}- className="flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[highlighted]:bg-[var(--surface-hover)] data-[state=checked]:bg-[var(--settings-menu-bg-selected)] data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]"+ className="flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]"><Select.ItemText>{t(`usageHistory.range.${option}`)}</Select.ItemText><Select.ItemIndicator>@@ -234,7 +234,7 @@ export function UsageHistorySection(): React.JSX.Element {{range.startsWith('day:') && selectedDay ? (<Select.Itemvalue={range}- className="flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[highlighted]:bg-[var(--surface-hover)] data-[state=checked]:bg-[var(--settings-menu-bg-selected)] data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]"+ className="flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-lg px-3 py-2 text-left text-13 text-[var(--text-primary)] outline-none data-[state=checked]:font-medium data-[state=checked]:text-[var(--settings-menu-text-selected)]"><Select.ItemText>{rangeLabel}</Select.ItemText><Select.ItemIndicator>diff --git a/apps/desktop/src/renderer/components/ui/__tests__/select.test.tsx b/apps/desktop/src/renderer/components/ui/__tests__/select.test.tsxnew file mode 100644index 0000000000..2f2eccb16b--- /dev/null+++ b/apps/desktop/src/renderer/components/ui/__tests__/select.test.tsx@@ -0,0 +1,177 @@+// @vitest-environment jsdom+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { Select, SelectParts } from '../select';++beforeEach(() => {+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe() {}+ unobserve() {}+ disconnect() {}+ },+ );+ vi.stubGlobal(+ 'PointerEvent',+ class extends MouseEvent {+ pointerType: string;+ constructor(type: string, options: PointerEventInit = {}) {+ super(type, options);+ this.pointerType = options.pointerType ?? 'mouse';+ }+ },+ );+ Element.prototype.scrollIntoView = vi.fn();+ Element.prototype.hasPointerCapture = vi.fn(() => false);+ Element.prototype.releasePointerCapture = vi.fn();+ vi.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockImplementation(function (+ this: HTMLElement,+ ) {+ return Number(this.dataset.width ?? 200);+ });+ vi.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(function (+ this: HTMLElement,+ ) {+ return Number(this.dataset.height ?? 32);+ });+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (+ this: HTMLElement,+ ) {+ const group = this.parentElement?.closest<HTMLElement>('[data-positioned-group]');+ return new DOMRect(+ 100 + Number(this.dataset.x ?? 0) + Number(group?.dataset.x ?? 0),+ 50 + Number(this.dataset.y ?? 0) + Number(group?.dataset.y ?? 0),+ Number(this.dataset.width ?? 200),+ Number(this.dataset.height ?? 32),+ );+ });+});++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+ vi.unstubAllGlobals();+});++const options = [+ { value: 'a', label: 'Alpha' },+ { value: 'b', label: 'Beta', disabled: true },+ { value: 'c', label: 'Gamma' },+];++describe('shared Select interaction', () => {+ it('switches focus feedback between keyboard and mouse without dropping restored focus', async () => {+ const change = vi.fn();+ render(<Select label="Language" value="a" options={options} onValueChange={change} />);+ const trigger = screen.getByRole('combobox');+ fireEvent.keyDown(trigger, { key: 'Enter' });+ const alpha = await screen.findByRole('option', { name: 'Alpha' });+ await waitFor(() => expect(document.activeElement).toBe(alpha));+ fireEvent.keyDown(alpha, { key: 'Escape' });+ await waitFor(() => expect(document.activeElement).toBe(trigger));+ expect(trigger.hasAttribute('data-pointer-focus')).toBe(false);++ fireEvent.pointerDown(trigger, { pointerType: 'mouse', button: 0, ctrlKey: false });+ await screen.findByRole('listbox');+ await waitFor(() => expect(document.activeElement).not.toBe(trigger));+ fireEvent.pointerDown(document.body, { pointerType: 'mouse', button: 0 });+ await waitFor(() => expect(document.activeElement).toBe(trigger));+ expect(trigger.getAttribute('data-pointer-focus')).toBe('true');++ fireEvent.keyDown(trigger, { key: 'Enter' });+ const reopened = await screen.findByRole('listbox');+ fireEvent.keyDown(reopened, { key: 'Escape' });+ await waitFor(() => expect(document.activeElement).toBe(trigger));+ expect(trigger.hasAttribute('data-pointer-focus')).toBe(false);+ expect(change).not.toHaveBeenCalled();+ });++ it('browses past disabled options without saving, then commits once and returns focus', async () => {+ const change = vi.fn();+ render(<Select label="Language" value="a" options={options} onValueChange={change} />);+ const trigger = screen.getByRole('combobox');+ fireEvent.keyDown(trigger, { key: 'Enter' });+ const alpha = await screen.findByRole('option', { name: 'Alpha' });+ await waitFor(() => expect(document.activeElement).toBe(alpha));+ fireEvent.keyDown(alpha, { key: 'ArrowDown' });+ const gamma = screen.getByRole('option', { name: 'Gamma' });+ await waitFor(() => expect(document.activeElement).toBe(gamma));+ expect(change).not.toHaveBeenCalled();+ expect(screen.getByRole('option', { name: 'Beta' }).getAttribute('aria-disabled')).toBe('true');+ fireEvent.keyDown(gamma, { key: 'Enter' });+ await waitFor(() => expect(document.activeElement).toBe(trigger));+ expect(change).toHaveBeenCalledExactlyOnceWith('c');+ expect(screen.queryByRole('listbox')).toBeNull();+ });++ it('pointer browsing and Esc preserve the selected value; disabled items cannot commit', async () => {+ const change = vi.fn();+ render(<Select label="Language" value="a" options={options} onValueChange={change} />);+ const trigger = screen.getByRole('combobox');+ fireEvent.keyDown(trigger, { key: 'Enter' });+ const gamma = await screen.findByRole('option', { name: 'Gamma' });+ fireEvent.pointerMove(gamma, { pointerType: 'mouse' });+ await waitFor(() => expect(document.activeElement).toBe(gamma));+ fireEvent.click(screen.getByRole('option', { name: 'Beta' }));+ fireEvent.keyDown(gamma, { key: 'Escape' });+ await waitFor(() => expect(document.activeElement).toBe(trigger));+ expect(change).not.toHaveBeenCalled();+ expect(trigger.textContent).toContain('Alpha');+ expect(trigger.className).toContain('focus-visible:ring-2');+ expect(trigger.className).not.toMatch(/(?:^|\s)focus:ring-/);+ });++ it('joins the shared menu glide highlight and keeps the check on the saved value', async () => {+ render(+ <SelectParts.Root defaultValue="a">+ <SelectParts.Trigger aria-label="Device">+ <SelectParts.Value />+ </SelectParts.Trigger>+ <SelectParts.Portal>+ <SelectParts.Content>+ <SelectParts.Viewport>+ <SelectParts.Group>+ <SelectParts.Label>Computers</SelectParts.Label>+ <SelectParts.Item value="a">+ <SelectParts.ItemText>Local</SelectParts.ItemText>+ <SelectParts.ItemIndicator>Saved</SelectParts.ItemIndicator>+ </SelectParts.Item>+ <SelectParts.Item value="c">+ <SelectParts.ItemText>Remote</SelectParts.ItemText>+ <span>Last synchronized today</span>+ </SelectParts.Item>+ <SelectParts.Item value="d" className="data-[highlighted]:bg-[var(--surface-hover)]">+ <SelectParts.ItemText>Custom</SelectParts.ItemText>+ </SelectParts.Item>+ </SelectParts.Group>+ </SelectParts.Viewport>+ </SelectParts.Content>+ </SelectParts.Portal>+ </SelectParts.Root>,+ );+ fireEvent.keyDown(screen.getByRole('combobox'), { key: 'Enter' });+ const local = await screen.findByRole('option', { name: 'Local' });+ await waitFor(() => expect(document.activeElement).toBe(local));+ const layers = document.querySelectorAll<HTMLElement>('[data-menu-highlight-layer]');+ expect(layers).toHaveLength(1);+ const layer = layers[0];+ expect(layer.parentElement?.hasAttribute('data-menu-panel')).toBe(true);+ await waitFor(() => expect(layer.dataset.row).toBe('0'));+ expect(layer.dataset.visible).toBe('true');++ const remote = screen.getByRole('option', { name: 'Remote' });+ fireEvent.keyDown(local, { key: 'ArrowDown' });+ await waitFor(() => expect(document.activeElement).toBe(remote));+ await waitFor(() => expect(layer.dataset.row).toBe('1'));+ expect(remote.hasAttribute('data-menu-active')).toBe(true);+ expect(local.getAttribute('data-state')).toBe('checked');+ expect(remote.getAttribute('data-state')).toBe('unchecked');++ const custom = screen.getByRole('option', { name: 'Custom' });+ expect(custom.hasAttribute('data-menu-own-highlight')).toBe(true);+ fireEvent.keyDown(remote, { key: 'ArrowDown' });+ await waitFor(() => expect(document.activeElement).toBe(custom));+ await waitFor(() => expect(layer.dataset.visible).toBeUndefined());+ });+});diff --git a/apps/desktop/src/renderer/components/ui/select-parts.tsx b/apps/desktop/src/renderer/components/ui/select-parts.tsxnew file mode 100644index 0000000000..4d25fac32b--- /dev/null+++ b/apps/desktop/src/renderer/components/ui/select-parts.tsx@@ -0,0 +1,179 @@+import * as SelectPrimitive from '@radix-ui/react-select';+import {+ forwardRef,+ createContext,+ useContext,+ useState,+ type ComponentPropsWithoutRef,+} from 'react';++import { cn } from '@/lib/utils';+import {+ MENU_OWN_HIGHLIGHT_ATTR,+ MENU_ROW_ATTR,+ hasOwnHighlight,+} from './dropdown-menu-highlight';+import { MenuHighlightLayer, menuPanelAttrs, useMenuPanel } from './menu-row';+import './select.css';++interface SelectFocusSource {+ pointer: boolean;+ setPointer(pointer: boolean): void;+}+const FocusSource = createContext<SelectFocusSource>({ pointer: false, setPointer: () => {} });++function Root(props: ComponentPropsWithoutRef<typeof SelectPrimitive.Root>) {+ const [pointer, setPointer] = useState(false);+ return (+ <FocusSource.Provider value={{ pointer, setPointer }}>+ <SelectPrimitive.Root {...props} />+ </FocusSource.Provider>+ );+}++const Trigger = forwardRef<+ HTMLButtonElement,+ ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>+>(({ className, asChild, onPointerDownCapture, onKeyDownCapture, onBlur, ...props }, ref) => {+ const focus = useContext(FocusSource);+ return (+ <SelectPrimitive.Trigger+ {...props}+ asChild={asChild}+ ref={ref}+ data-pointer-focus={focus.pointer || undefined}+ onPointerDownCapture={(event) => {+ focus.setPointer(true);+ onPointerDownCapture?.(event);+ }}+ onKeyDownCapture={(event) => {+ focus.setPointer(false);+ onKeyDownCapture?.(event);+ }}+ onBlur={(event) => {+ // Keep the source while focus visits the portal; clear it when leaving the closed field.+ if (event.currentTarget.dataset.state !== 'open') focus.setPointer(false);+ onBlur?.(event);+ }}+ className={cn(+ 'cindy-select-trigger',+ // An asChild Button already owns its focus/error ring; do not override it.+ !asChild && 'outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]',+ className,+ )}+ />+ );+});+Trigger.displayName = 'SelectTrigger';++const Content = forwardRef<+ HTMLDivElement,+ ComponentPropsWithoutRef<typeof SelectPrimitive.Content>+>(+ (+ {+ className,+ onPointerDownCapture,+ onKeyDownCapture,+ onPointerDownOutside,+ onEscapeKeyDown,+ ...props+ },+ ref,+ ) => {+ const focus = useContext(FocusSource);+ return (+ <SelectPrimitive.Content+ position="popper"+ sideOffset={4}+ collisionPadding={8}+ {...props}+ ref={ref}+ onPointerDownCapture={(event) => {+ focus.setPointer(true);+ onPointerDownCapture?.(event);+ }}+ onPointerDownOutside={(event) => {+ focus.setPointer(true);+ onPointerDownOutside?.(event);+ }}+ onKeyDownCapture={(event) => {+ focus.setPointer(false);+ onKeyDownCapture?.(event);+ }}+ onEscapeKeyDown={(event) => {+ focus.setPointer(false);+ onEscapeKeyDown?.(event);+ }}+ className={cn(+ 'cindy-select-content z-[10010] w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)] overflow-hidden rounded-xl p-1.5',+ 'data-[state=open]:animate-float-in data-[state=closed]:animate-float-out',+ className,+ )}+ />+ );+ },+);+Content.displayName = 'SelectContent';++// Radix highlights the focused option, including the saved one when the menu opens.+const highlightedOption = (rows: readonly HTMLElement[]) =>+ rows.find((row) => row.hasAttribute('data-highlighted'));++/** The scrolling viewport hosts the shared menu glide highlight (menu-row.tsx). */+const Viewport = forwardRef<+ HTMLDivElement,+ ComponentPropsWithoutRef<typeof SelectPrimitive.Viewport>+>(({ className, children, ...props }, forwardedRef) => {+ const ref = useMenuPanel(forwardedRef, {+ lockWidth: false,+ options: { current: highlightedOption },+ });+ return (+ <SelectPrimitive.Viewport+ {...props}+ {...menuPanelAttrs}+ ref={ref}+ className={className}+ >+ <MenuHighlightLayer />+ {children}+ </SelectPrimitive.Viewport>+ );+});+Viewport.displayName = 'SelectViewport';++const Item = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof SelectPrimitive.Item>>(+ ({ className, ...props }, ref) => (+ <SelectPrimitive.Item+ {...props}+ ref={ref}+ {...{ [MENU_ROW_ATTR]: '' }}+ {...(hasOwnHighlight(className) ? { [MENU_OWN_HIGHLIGHT_ATTR]: '' } : {})}+ className={cn('relative shrink-0', className)}+ />+ ),+);+Item.displayName = 'SelectItem';++/** Compound form of the same Select for grouped/rich legacy options.+ * Keep local theme aliases and business handlers; share focus, elevation, motion and the+ * menu glide highlight.+ */+export const SelectParts = {+ Root,+ Trigger,+ Value: SelectPrimitive.Value,+ Icon: SelectPrimitive.Icon,+ Portal: SelectPrimitive.Portal,+ Content,+ Viewport,+ Item,+ ItemText: SelectPrimitive.ItemText,+ ItemIndicator: SelectPrimitive.ItemIndicator,+ Group: SelectPrimitive.Group,+ Label: SelectPrimitive.Label,+ Separator: SelectPrimitive.Separator,+ ScrollUpButton: SelectPrimitive.ScrollUpButton,+ ScrollDownButton: SelectPrimitive.ScrollDownButton,+};diff --git a/apps/desktop/src/renderer/components/ui/select.css b/apps/desktop/src/renderer/components/ui/select.cssnew file mode 100644index 0000000000..c6257eaa75--- /dev/null+++ b/apps/desktop/src/renderer/components/ui/select.css@@ -0,0 +1,22 @@+.cindy-select-content {+ box-shadow: var(--shadow-menu);+ transform-origin: var(--radix-select-content-transform-origin);+}++/* Radix prevents the trigger's native mousedown, then restores focus by script.+ Chromium may inherit a previous keyboard ring even after a mouse dismissal.+ Keep focus in place; only suppress that inherited ring until keyboard input or blur. */+.cindy-select-trigger[data-pointer-focus]:focus-visible {+ box-shadow: none;+}++.cindy-select-content[data-state='closed'] {+ /* Radix's dismissable layer writes an inline pointer-events value. */+ pointer-events: none !important;+}++@media (prefers-reduced-motion: reduce) {+ .cindy-select-content[data-state] {+ animation: none;+ }+}diff --git a/apps/desktop/src/renderer/components/ui/select.tsx b/apps/desktop/src/renderer/components/ui/select.tsxindex 138a6bce4c..9d2785bda4 100644--- a/apps/desktop/src/renderer/components/ui/select.tsx+++ b/apps/desktop/src/renderer/components/ui/select.tsx@@ -1,4 +1,5 @@-import * as SelectPrimitive from '@radix-ui/react-select';+import { SelectParts as SelectPrimitive } from './select-parts';+export { SelectParts } from './select-parts';import { Check, ChevronDown, ChevronUp } from 'lucide-react';import { cn } from '@/lib/utils';import type { AriaAttributes, ReactNode } from 'react';@@ -109,7 +110,7 @@ export function Select({value={option.value}disabled={option.disabled}title={option.title ?? (truncateOptions ? option.label : undefined)}- className="relative flex min-h-8 cursor-pointer select-none items-center rounded-lg py-1 pl-2 pr-6 outline-none [overflow-wrap:anywhere] data-[state=checked]:bg-[var(--surface-chip)] data-[highlighted]:bg-[var(--surface-hover)] data-[disabled]:opacity-60"+ className="relative flex min-h-8 cursor-pointer select-none items-center rounded-lg py-1 pl-2 pr-6 outline-none [overflow-wrap:anywhere] data-[disabled]:opacity-60">{truncateOptions ? (<span className="min-w-0 flex-1 truncate">diff --git a/apps/desktop/src/renderer/features/skillhub/PublishDialog.tsx b/apps/desktop/src/renderer/features/skillhub/PublishDialog.tsxindex e9b2597f7c..a12f8f8d32 100644--- a/apps/desktop/src/renderer/features/skillhub/PublishDialog.tsx+++ b/apps/desktop/src/renderer/features/skillhub/PublishDialog.tsx@@ -19,7 +19,7 @@ import { useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'rimport { useNavigate } from 'react-router-dom';import { useTranslation } from 'react-i18next';import * as Dialog from '@radix-ui/react-dialog';-import * as Select from '@radix-ui/react-select';+import { SelectParts as Select } from '@/components/ui/select';import { X, CloudUpload, Globe, Users, Lock, RefreshCw, CircleAlert, Check, ChevronDown, ChevronUp } from 'lucide-react';import { cn } from '@/lib/utils';@@ -339,7 +339,7 @@ export function SelectInput({'flex h-10 w-full items-center justify-between gap-2 rounded-full border px-3 text-sm','bg-[var(--settings-input-bg)] text-[var(--settings-input-text)]','border-[var(--settings-input-border)]',- 'focus:outline-none focus:ring-2 focus:ring-[var(--focus-ring-soft)] focus:border-transparent',+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]','transition-colors data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60','data-[placeholder]:text-[var(--settings-input-placeholder)]',)}@@ -358,10 +358,9 @@ export function SelectInput({align="start"sideOffset={4}className={cn(- 'z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border p-1',+ 'z-[10010] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border p-1.5','max-h-[min(15rem,var(--radix-select-content-available-height))]','border-[var(--cmd-palette-border)] bg-[var(--cmd-palette-bg)]',- '[box-shadow:var(--cmd-palette-shadow)]',)}><Select.ScrollUpButton className="flex h-5 items-center justify-center text-[var(--settings-section-desc)]">@@ -376,7 +375,6 @@ export function SelectInput({className={cn('flex w-full cursor-pointer select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm outline-none','text-[var(--msg-assistant-text)] transition-colors',- 'data-[highlighted]:bg-[var(--surface-hover)]','data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60',)}>diff --git a/docs/design-evidence/2026-10-18/select.md b/docs/design-evidence/2026-10-18/select.mdnew file mode 100644index 0000000000..8ee3acbf1e--- /dev/null+++ b/docs/design-evidence/2026-10-18/select.md@@ -0,0 +1,44 @@+# Select:焦点、菜单层次与连续高亮++- 日期:2026-10-18。初版在 `2681b5b892d8` 上完成并实机检查;提交前对齐最新 main,高亮改为复用 main 已有的菜单共用滑动高亮(见下文「对齐 main 的修订」)。+- 依据:用户本轮组件级意见;`DESIGN.md` §4 Select & Dropdown、§5、§14.4。+- 参考:<https://www.fluidfunctionalism.com/docs/select>;已实际打开并操作。用户随后明确要求同步网站;Select 页已于 2026-10-18 发布本次组件修订,页面标明客户端尚未合入 main,其他页面保留原冻结快照。++## 改动与覆盖++标准 `ui/select.tsx` 与复合 API `SelectParts` 共用焦点、面板和高亮实现。源码扫描确认 Desktop 对 `@radix-ui/react-select` 的直接引用只剩 `ui/select-parts.tsx`。语言、辅助模型、终端、用量设备与时间、存储年龄、Xbox、Work Louder、目标上限、SkillHub 发布等 10 处旧实现接入同一套部件。既有标准 Select 的消费者自动继承。++保留值、回调、选项禁用、分组、文字查找、描述/错误语义与本地主题 alias。通用高亮改用已有 `button-secondary-hover`,修复 Cindy Dark 中 `surface-hover` 与浮层底色仅相差 2/255 的情况。设置/模型局部覆盖仍通过组件局部变量传入;未修改用户主题文件或主题 Token ID。++面板复用 `shadow-menu` 与现有 `float-in` / `float-out`;不增加动画依赖。高亮只移动一块背景,选中勾不随鼠标改变;按真实小数行高测量,反算面板入场缩放,滚动/分组/长说明均不依赖固定行高。++## 对齐 main 的修订(提交 PR 前)++最新 main 已有菜单共用滑动高亮(`dropdown-menu-highlight.ts` + `menu-row.tsx`)。为避免 Select 与菜单两套高亮并存,经用户确认:Select 的滚动视口改为挂载共用的 `MenuHighlightLayer`,选项标记为菜单行;高亮颜色、节奏、移出淡出与减少动态效果均与菜单一致(`--sidebar-item-hover`、`--motion-instant`)。移除自研底板、`--select-option-hover` / `--select-option-selected` 局部别名以及已选行底色;已选值由勾选标记与调用方的选中文字样式表示。调用方自带 `data-[highlighted]:` / `hover:` / `focus:` 底色的行保留原效果。main 新增的 `UsageFilterSelect` 同步接入 `SelectParts`。++下表中焦点环、阴影、入出场、宽度与碰撞翻转的结论仍适用;**关于底板颜色、帧采样与几何差值的记录针对的是被替换的初版底板,修订后的共用高亮尚未在真实客户端重新目检。**++## 真实客户端检查(初版)++macOS Electron 开发版,Global `select-ui` 隔离沙箱、被动调度;`desktop:whoami --all` 确认当前 checkout。使用真实设置页面和 CDP 鼠标/键盘操作,截图不入仓。窗口初始处于隐藏状态,恢复显示后才采样连续动效;未以隐藏窗口的暂停动画证明流畅。++| 场景 | 结果 |+| --- | --- |+| 语言菜单,Cindy Light / Dark | 触发器与菜单均 320px;12px 面板、8px 高亮。柔和阴影分别为 0 4px 16px / 黑色 15%、50%。两模式均已目检。 |+| 鼠标关闭 | 焦点返回触发器,`:focus-visible=false`,`box-shadow=none`。 |+| Tab 进入、Enter 打开、方向键浏览、Esc 取消 | 取消保留原值,焦点返回且保留 2px 软蓝环。 |+| 连续高亮移动 | 实际帧采样显示同一底板经过中间坐标后到达目标;时长 150ms / 既有 ease-out,不延迟选择。 |+| 用量设备的两行说明,Dark | 53.5px 行高;底板与目标行的 x/y/width/height 实测差值均为 0。高亮约 RGB 45.5,面板 RGB 31。 |+| 用量时间 / 设备列表 | 190px 等宽,6px 面板内边距;选择/取消和说明布局保留。 |+| Cindy Make 制作历史标准 Select,Dark | 168px 等宽,复用相同面板/高亮;Button 自有焦点与错误样式不被复合 Trigger 覆盖。 |+| 屏幕下缘 | 自动向上展开,transform-origin 位于面板底部,未超出视口。 |+| 小窗口滚动(1100 × 400) | 面板高度 180.914px、上缘 8px;选项仍为 36px。End 能到最后一项,视口 scrollTop=63 / scrollHeight=226;底板与目标行四项几何差值均为 0。 |+| 减少动态效果 | 面板 `animation-name=none`,高亮 `transition-duration=0s`,选择/关闭仍可用。 |++应用退出后重新启动同一隔离沙箱,补验最终代码并重新采集 `select-light-final.png`、`select-dark-final.png`、`language-small-window-scroll.png`;此前临时目录已被清理,旧截图不再作为可下载附件。提交 PR 时应外置最终图片并补链接。真实截图仅证明以上场景,Windows、其它主题、未连接硬件的专属设置以及全部业务入口尚未逐页实机验证。++## 自动验证++- 修订后(最新 main 上):共享 Select 与 17 个调用处相关测试文件,共 18 个文件、243 项通过;新测试覆盖键盘跳过禁用项、选择只提交一次、取消保留值、单一共用高亮层跟随键盘、自带高亮的行退出共用层。+- `check:design-inventory` 通过(53 个 surface);`git diff --check` 通过。+- 初版另跑过 `check:dev-docs`、台账生成器测试等;不将本地定向验证等同完整 CI 或设计师批准。diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex 54cc432f2d..2b12637e5c 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -514,13 +514,14 @@ Ordinary confirmations opt into standard buttons with `presentation="standard"`### Select & Dropdown- **Trigger**: same as a single-line input — pill (9999px), Card bg, 1px Board border, carrying the current value + a chevron.-- **Panel**: a container — 12px radius, 1px Board border, 6–8px padding. Select listbox panels use the Card bg (`--surface-elevated`) and no shadow (separation comes from the overlay / layer colors).+- **Panel**: a container — 12px radius, 1px Board border, 6–8px padding. Select listbox panels use the Card bg (`--surface-elevated`) and the soft, downward `--shadow-menu` elevation in both modes, like the menu panels below (owner decision, 2026-10-18; supersedes their former no-shadow rule and does not authorize shadows on in-page controls). Existing local panel-color aliases remain compatible.- **Menu and popover panels** (shared defaults in `components/ui/dropdown-menu.tsx` / `popover.tsx`): 12px radius and the registered floating-layer shadow `--shadow-menu` (a §6 token-gated exception) written as `shadow-[shadow:var(--shadow-menu)]` — the untyped `shadow-[var(--shadow-menu)]` is a Tailwind shadow *colour* and renders no shadow. `DropdownMenuContent` / `DropdownMenuSubContent` use `p-1`, `bg-[var(--cmd-palette-bg)]`, `border-[var(--cmd-palette-border)]` and `text-[var(--cmd-palette-item-text)]`; under Cindy themes that surface is glass (`--surface-translucent-overlay` + `blur(6px)`, globals.css), and on Windows (`html[data-platform='win32']`) every `--cmd-palette-bg` surface is opaque with no `backdrop-filter` (§15.12). `PopoverContent` stays opaque `bg-popover`. `DropdownMenuSeparator` uses `--cmd-palette-border`. Row highlights use the 8px inner tier.- **Menu text** (`components/ui/dropdown-menu.tsx`): option rows (Item / CheckboxItem / RadioItem / SubTrigger) are `text-14` / `leading-[1.43]` (32px row with `py-1.5`) on `--cmd-palette-item-text`; shortcuts `text-12` / `leading-[1.33]` / 400 on `--cmd-palette-item-meta`; group labels `text-12` / 500 on `--cmd-palette-item-meta`; destructive rows `variant="danger"` on `--error-fg`; disabled rows 50% opacity. The text colour is the same at rest and on hover. The highlighted (`data-menu-active` / `data-[highlighted]`), checked or open row is 500 (§3 ladder) and its default-stroke Lucide icons go 1.5 → 2, on `--motion-instant` / `--motion-ease-out` (instant under reduced motion). Width never moves: row text and `truncate` spans reserve the 500 width with an invisible zero-height `::after` copy (`content: attr(data-menu-label) / ""`, so `textContent`, typeahead and the accessible name are unchanged), and the shared panels lock their laid-out width (`lockMenuWidth`, re-measured on content, window, image or font changes). A caller's own text colour, weight or inline width wins.- **Menu hover highlight** (`components/ui/dropdown-menu-highlight.ts`): one `--sidebar-item-hover` surface (8px) per `DropdownMenuContent` / `DropdownMenuSubContent` glides between rows with `transform`; the row nearest the pointer anywhere in the panel wins, and separators do not interrupt the glide. Entering fades in from the checked row (or the target), leaving fades out; keyboard follows Radix's highlighted item, and an open SubTrigger stays highlighted while its submenu is in use. Motion: `transform` / `opacity` on `--motion-instant` / `--motion-ease-out` (fade-out `--motion-ease-in`), size snaps, no slide under reduced motion. Danger rows use the same grey layer. Rows whose caller sets its own `focus:` / `hover:` / `data-[highlighted]:` / `data-[state=open]:` background keep it and get no layer; `hoverHighlight={false}` restores per-row fills. Sidebar menus (`features/cc-agent/sidebar/menuStyles.ts`: `MENU_ITEM_CLASS` / `MENU_ROW_CLASS` = `h-8 gap-2`, triggers `cursor-pointer`) use the same highlight.- **Panel width must bind to the trigger width** — never narrower or wider than the control that opened it, except for the explicitly scoped device-navigation treatment below. Radix Select: `position="popper"` + `width: var(--radix-select-trigger-width)`; other primitives measure the trigger. Ordinary form fields retain this equal-width invariant.- **Compact Cindy device navigation (sidebar and teammate chat header only)**: the trigger fits the device label, unread indicator and chevron, retaining its 24px height. The sidebar's remaining row area opens chat; the header trigger caps at 176px and may shrink with its available space. Long labels truncate and retain their full title. Its listbox is independently 256px wide, capped by the available viewport width, so device names, offline state and unread indicators remain usable even when the trigger says only “本机”. This exception belongs to `CindyDevicePicker`, not the shared Select default or other dropdowns. Keep the existing Radix keyboard/focus behavior and theme tokens. Browser hit-target regression: `apps/desktop/scripts/fixtures/cindy-device-picker/verify-device-picker.cjs`.-- **Select listbox option rows** (Select only; dropdown menu rows follow the Menu entries above): selected / hovered highlight fills use the **8px inner radius** (see §5 — the panel is a 12px container, the row highlight is the inner 8px tier; the inner radius must be smaller than the container's to nest cleanly). Highlight bg via `--surface-hover` / Radix `data-[highlighted]`; selected rows get the chip fill, unselected rows stay transparent.+- **Select listbox option rows** (Select only; dropdown menu rows follow the Menu entries above): rows use the **8px inner radius** (§5 — inner tier inside the 12px panel) and join the **shared menu hover highlight** above — one `--sidebar-item-hover` layer per listbox viewport, same glide, fade and reduced-motion behaviour as the dropdown menu (2026-10-18, supersedes the per-row `--surface-hover` / chip fills). The saved value is marked by its checkmark (and the caller's checked text style), not by a fill; Radix's highlighted option drives the layer for keyboard browsing, including the saved option it focuses on open. Rows whose caller sets its own `data-[highlighted]:` / `hover:` / `focus:` background keep it and get no layer. Group labels, wrapped descriptions, disabled options and scroll controls retain their semantics.+- **Shared Select implementation (2026-10-18)**: use `components/ui/select.tsx` for single-value fields; rich/grouped consumers use its `SelectParts` compound API (`components/ui/select-parts.tsx`) instead of importing `@radix-ui/react-select` directly. Both share the trigger, panel, highlight and motion. Trigger rings use `focus-visible`, including after menu dismissal: mouse-only open/close leaves no ring, keyboard navigation keeps a visible focus cue. Radix still owns focus return, keyboard/typeahead, cancellation and value callbacks. Panel entry/exit reuses §14.4's `float-in` / `float-out` with the transform origin following the actual top/bottom collision placement; reduced motion removes the animation.- **Composer dropdown rows — one contract with the shared menu** (2026-10-04, supersedes 2026-07-22): the composer menus keep their own shells — MorphPopover (model / permission / + / agent; §14.4 container transform unchanged), the / and @ lists, the bot-chat @ list and the settings search results — but use the shared menu row parts from `components/ui/menu-row.tsx`: `COMPOSER_MENU_ROW` (8px radius, menu text / weight / motion), `menuRowAttrs`, `withMenuLabels`, and one glide highlight per panel (`useMenuPanel` + `MenuHighlightLayer`, the same `--sidebar-item-hover` layer as the shared menu). Rows inside a glide panel set no `hover:` / `focus:` fill of their own (rows that sit outside any glide panel — the model config card's engine rows, the legacy follow-session and "manage providers" rows — keep a `hover:bg-sidebar-item-hover` fill in the same grey). The selected row is marked by a check + 500 and never by a fill — permission, + and agent menus. **The model menu is the one exception** (owner ruling 2026-10-04, keeping the 2026-08-13 ruling): its chosen row keeps a whole-row `--sidebar-item-hover` fill with no check (`data-[menu-active]:bg-transparent`, so the fill steps aside while the glide layer covers that row instead of stacking two translucent layers), the model name stays 500, and the effort / follow-session rows keep their fill and existing check; it still takes the shared glide highlight and the glass panel. Danger-tier orange / blue tints the **text only**. Lists that keep focus in a text input (/, @, bot @, settings search) stay focus-in-input: the highlight follows their own current index (`data-menu-current` or `aria-selected`) through `attachMenuHighlight`'s `current` option, never Radix focus. Panels: MorphPopover ends on `--menu-panel-surface` (the shared menu's glass under Cindy themes, opaque on Windows) with `--cmd-palette-border` and `--shadow-menu`; the / and @ lists and the model config flyout use the same 12px panel and `--shadow-menu` (the softer `--cmd-palette-shadow` stays for the command palette and the / tooltip). Group labels use the shared label (12 / 500 / `--cmd-palette-item-meta`). When touching any composer menu's row styles, change them through `menu-row.tsx` — never one menu alone.FormField → Select forwards descriptions, required/error semantics, and the semantic error border; native browser required validation remains opt-in by the business form.diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.mdindex e621fb9987..dc5765c3e4 100644--- a/docs/design-rules/design-inventory.md+++ b/docs/design-rules/design-inventory.md@@ -44,7 +44,7 @@| `desktop.skillhub.market` | desktop | SkillHub 市场 | hash `/skillhub/market`(SkillhubMarketListView) | InstallTargetPicker, MarketCard, MarketInfoEditDialog, SkillhubMarketDetailView, SkillhubMarketListView, VisibilityEditorDialog | apps/desktop/src/renderer/features/skillhub/SkillhubMarketDetailView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketListView.tsx, apps/desktop/src/renderer/features/skillhub/components/HomeMarketCard.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx, apps/desktop/src/renderer/features/skillhub/components/LocalSkillControls.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketCard.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketInfoEditDialog.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketInstallStatus.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketListError.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketLocalSkills.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketPreviewTree.tsx, apps/desktop/src/renderer/features/skillhub/components/OfficialSkillBadge.tsx, apps/desktop/src/renderer/features/skillhub/components/PlatformTagSelector.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillCategoryFilterBar.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillDetailLayout.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillIcon.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillTagList.tsx, apps/desktop/src/renderer/features/skillhub/components/TeamScopePicker.tsx, apps/desktop/src/renderer/features/skillhub/components/VisibilityEditorDialog.tsx | 43 | 0 | 37 || `desktop.window.computer-permission-guide` | desktop | 电脑使用权限引导 | `?view=computer-permission-guide` → ComputerPermissionGuideWindow;backdrop 同文件 | ComputerPermissionBackdrop, ComputerPermissionGuideWindow | apps/desktop/src/main/computer-permission-guide/MacComputerPermissionGuideNativeHost.ts, apps/desktop/src/main/computer-permission-guide/placement.ts, apps/desktop/src/main/computer-permission-guide/request.ts, apps/desktop/src/main/computer-permission-guide/switch-target.ts, apps/desktop/src/main/computer-permission-guide/window.ts, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx | 7 | 2 | 9 || `desktop.window.ghost-panel` | desktop | 插件面板独立窗口 | `?ghostPanelWindow=<id>` → renderer/ghost-panel-window-entry.tsx;hash `/ghost-panel-window` | GhostPanelWindowLayout | apps/desktop/src/main/ghost-panel-window/controller.ts, apps/desktop/src/main/ghost-panel-window/ipc.ts, apps/desktop/src/main/ghost-panel-window/registry.ts, apps/desktop/src/main/ghost-panel-window/settings-store.ts, apps/desktop/src/main/ghost-panel-window/window.ts, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/ghost-panel-window-entry.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 77 | 38 | 15 |-| `desktop.window.remote-desktop` | desktop | 远程桌面独立窗口 | `?remoteDesktopViewer=1` → renderer/remote-desktop-viewer-entry.tsx | Button, ConfirmDialog, FormField, Popover, RemoteDesktopViewerWindow, Select, Switch, Tip | apps/desktop/src/main/remote-desktop-viewer/connection.ts, apps/desktop/src/main/remote-desktop-viewer/credentials.ts, apps/desktop/src/main/remote-desktop-viewer/preferences.ts, apps/desktop/src/main/remote-desktop-viewer/registry.ts, apps/desktop/src/main/remote-desktop-viewer/resolutionMemory.ts, apps/desktop/src/main/remote-desktop-viewer/safety.ts, apps/desktop/src/main/remote-desktop-viewer/windows.ts, apps/desktop/src/renderer/components/ui/button.tsx, apps/desktop/src/renderer/components/ui/confirm-dialog.tsx, apps/desktop/src/renderer/components/ui/form-field.tsx, apps/desktop/src/renderer/components/ui/popover.tsx, apps/desktop/src/renderer/components/ui/select.tsx, apps/desktop/src/renderer/components/ui/switch.tsx, apps/desktop/src/renderer/components/ui/tooltip.tsx, apps/desktop/src/renderer/features/remote-desktop/RemoteDesktopViewerWindow.tsx, apps/desktop/src/renderer/features/remote-desktop/viewerWindow.css, apps/desktop/src/renderer/remote-desktop-viewer-entry.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 132 | 36 | 28 |+| `desktop.window.remote-desktop` | desktop | 远程桌面独立窗口 | `?remoteDesktopViewer=1` → renderer/remote-desktop-viewer-entry.tsx | Button, ConfirmDialog, FormField, Popover, RemoteDesktopViewerWindow, Select, Switch, Tip | apps/desktop/src/main/remote-desktop-viewer/connection.ts, apps/desktop/src/main/remote-desktop-viewer/credentials.ts, apps/desktop/src/main/remote-desktop-viewer/preferences.ts, apps/desktop/src/main/remote-desktop-viewer/registry.ts, apps/desktop/src/main/remote-desktop-viewer/resolutionMemory.ts, apps/desktop/src/main/remote-desktop-viewer/safety.ts, apps/desktop/src/main/remote-desktop-viewer/windows.ts, apps/desktop/src/renderer/components/ui/button.tsx, apps/desktop/src/renderer/components/ui/confirm-dialog.tsx, apps/desktop/src/renderer/components/ui/form-field.tsx, apps/desktop/src/renderer/components/ui/popover.tsx, apps/desktop/src/renderer/components/ui/select-parts.tsx, apps/desktop/src/renderer/components/ui/select.css, apps/desktop/src/renderer/components/ui/select.tsx, apps/desktop/src/renderer/components/ui/switch.tsx, apps/desktop/src/renderer/components/ui/tooltip.tsx, apps/desktop/src/renderer/features/remote-desktop/RemoteDesktopViewerWindow.tsx, apps/desktop/src/renderer/features/remote-desktop/viewerWindow.css, apps/desktop/src/renderer/remote-desktop-viewer-entry.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 132 | 36 | 29 || `desktop.window.resource-usage` | desktop | 资源用量窗口 | `?resourceUsageWindow=1` → renderer/resource-usage-entry.tsx(不走 router.tsx) | ResourceUsageWindowLayout, ResourceUsageWindowRoot | apps/desktop/src/main/resource-usage-window/controller.ts, apps/desktop/src/main/resource-usage-window/ipc.ts, apps/desktop/src/main/resource-usage-window/open-sender.ts, apps/desktop/src/main/resource-usage-window/registry.ts, apps/desktop/src/main/resource-usage-window/window.ts, apps/desktop/src/renderer/components/resource-usage/ResourceUsageWindowLayout.tsx, apps/desktop/src/renderer/resource-usage-entry.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 77 | 38 | 15 || `desktop.window.review-artifact-confirm` | desktop | Review 成果确认窗 | main/reviewer/reviewArtifactConfirmWindow.ts 内联 HTML/CSS(不走 renderer 路由) | reviewArtifactConfirmWindow | apps/desktop/src/main/reviewer/reviewArtifactConfirmWindow.ts | 8 | 18 | 2 || `desktop.window.session-drag-preview` | desktop | 会话拖拽预览 | main/session-drag-preview.ts 透明预览窗 | session-drag-preview | apps/desktop/src/main/session-drag-preview.ts | 0 | 1 | 0 |diff --git a/scripts/shared/design-inventory.mjs b/scripts/shared/design-inventory.mjsindex 2cddadaa61..8b33cbdb53 100644--- a/scripts/shared/design-inventory.mjs+++ b/scripts/shared/design-inventory.mjs@@ -806,6 +806,8 @@ export function catalogSurfaces() {'apps/desktop/src/renderer/components/ui/switch.tsx','apps/desktop/src/renderer/components/ui/confirm-dialog.tsx','apps/desktop/src/renderer/components/ui/select.tsx',+ 'apps/desktop/src/renderer/components/ui/select-parts.tsx',+ 'apps/desktop/src/renderer/components/ui/select.css','apps/desktop/src/renderer/components/ui/button.tsx','apps/desktop/src/renderer/components/ui/form-field.tsx','apps/desktop/src/renderer/features/remote-desktop/viewerWindow.css',