Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(ui): clarify Cindy Switch states and add subtle thumb motion
kirozengeaac55cae43a
diff --git a/apps/desktop/src/renderer/components/ui/__tests__/switch.test.tsx b/apps/desktop/src/renderer/components/ui/__tests__/switch.test.tsxindex 7546a99af3..4e0ef5396b 100644--- a/apps/desktop/src/renderer/components/ui/__tests__/switch.test.tsx+++ b/apps/desktop/src/renderer/components/ui/__tests__/switch.test.tsx@@ -1,7 +1,9 @@// @vitest-environment jsdom-import { cleanup, render, screen } from '@testing-library/react';-import { afterEach, describe, expect, it } from 'vitest';+import { cleanup, fireEvent, render, screen } from '@testing-library/react';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { createRef, useState } from 'react';import { Switch } from '../switch';@@ -18,6 +20,7 @@ describe('Switch', () => {const { track, thumb } = renderSwitch();expect(track.className).toContain('data-[state=unchecked]:bg-[var(--switch-track-off)]');expect(thumb.className).toContain('data-[state=unchecked]:bg-[var(--switch-thumb-off)]');+ expect(thumb.className).toContain('data-[state=checked]:bg-[var(--switch-thumb-on)]');expect(track.className).toContain('data-[state=checked]:bg-[var(--switch-track-on)]');});@@ -27,6 +30,193 @@ describe('Switch', () => {expect(thumb.className).not.toContain('shadow');// 禁用态两级弱化必须走皮肤可覆盖的 token,不得回退硬编码 opacity(定值见 colors.ts)expect(track.className).toContain('disabled:opacity-[var(--switch-disabled-opacity)]');- expect(thumb.className).toContain('data-[disabled]:opacity-[var(--switch-disabled-thumb-opacity)]');+ expect(thumb.className).toContain(+ 'data-[disabled]:opacity-[var(--switch-disabled-thumb-opacity)]',+ );+ });+});++// jsdom supplies neither pointer capture nor layout. Only those browser inputs+// are supplied here; the real Radix component, click path and form input run.+describe('Switch input compatibility', () => {+ beforeEach(() => {+ document.documentElement.style.fontSize = '16px';+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe() {}+ unobserve() {}+ disconnect() {}+ },+ );+ vi.stubGlobal(+ 'PointerEvent',+ class extends MouseEvent {+ pointerId: number;+ pointerType: string;+ isPrimary: boolean;+ constructor(type: string, init: PointerEventInit = {}) {+ super(type, init);+ this.pointerId = init.pointerId ?? 1;+ this.pointerType = init.pointerType ?? 'mouse';+ this.isPrimary = init.isPrimary ?? true;+ }+ },+ );+ });+ afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+ vi.restoreAllMocks();+ document.documentElement.style.fontSize = '';+ });++ function prepare(track: HTMLElement) {+ let captured: number | null = null;+ Object.defineProperties(track, {+ offsetWidth: { value: 36 },+ clientWidth: { value: 32 },+ clientLeft: { value: 2 },+ setPointerCapture: {+ value: vi.fn((id: number) => {+ captured = id;+ }),+ },+ hasPointerCapture: { value: (id: number) => captured === id },+ releasePointerCapture: {+ value: vi.fn(() => {+ captured = null;+ }),+ },+ });+ vi.spyOn(track, 'getBoundingClientRect').mockReturnValue({ left: 100, width: 36 } as DOMRect);+ vi.spyOn(track.firstElementChild!, 'getBoundingClientRect').mockImplementation(+ () =>+ ({+ left: track.dataset.state === 'checked' ? 118 : 102,+ }) as DOMRect,+ );+ return track;+ }+ function drag(track: HTMLElement, delta: number, end = 'up') {+ fireEvent.pointerDown(track, { clientX: 106, button: 0, pointerId: 1 });+ fireEvent.pointerMove(track, { clientX: 106 + delta, pointerId: 1 });+ if (end === 'cancel') fireEvent.pointerCancel(track, { pointerId: 1 });+ else if (end === 'escape') fireEvent.keyDown(track, { key: 'Escape' });+ else if (end === 'capture') fireEvent.lostPointerCapture(track, { pointerId: 1 });+ else fireEvent.pointerUp(track, { pointerId: 1 });+ fireEvent.click(track, { detail: 1 });+ }++ it('retains the forwarded button ref, labels, uncontrolled state and form value', () => {+ const ref = createRef<HTMLButtonElement>();+ const changed = vi.fn();+ const { container } = render(+ <form>+ <label htmlFor="test-switch">Notifications</label>+ <Switch+ id="test-switch"+ name="notifications"+ defaultChecked+ ref={ref}+ onCheckedChange={changed}+ />+ </form>,+ );+ const track = screen.getByRole('switch');+ expect(ref.current).toBe(track);+ expect(track.getAttribute('aria-checked')).toBe('true');+ fireEvent.click(screen.getByText('Notifications'));+ expect(changed.mock.calls).toEqual([[false]]);+ expect(+ (container.querySelector('input[name="notifications"]') as HTMLInputElement).checked,+ ).toBe(false);+ fireEvent.click(track, { detail: 0 }); // keyboard-style activation+ expect(changed.mock.calls).toEqual([[false], [true]]);+ });++ it('commits each drag once through the controlled callback and form event', () => {+ const changed = vi.fn(),+ formChanged = vi.fn();+ function Controlled() {+ const [checked, setChecked] = useState(false);+ return (+ <form onChange={formChanged}>+ <Switch+ name="setting"+ checked={checked}+ onCheckedChange={(next) => {+ changed(next);+ setChecked(next);+ }}+ />+ </form>+ );+ }+ render(<Controlled />);+ const track = prepare(screen.getByRole('switch'));+ drag(track, 24);+ expect(track.dataset.state).toBe('checked');+ expect(changed.mock.calls).toEqual([[true]]);+ expect(formChanged).toHaveBeenCalledTimes(1);+ drag(track, -24);+ expect(track.dataset.state).toBe('unchecked');+ expect(changed.mock.calls).toEqual([[true], [false]]);+ expect(formChanged).toHaveBeenCalledTimes(2);+ });++ it('does not change a controlled value until its owner accepts it', () => {+ const changed = vi.fn();+ render(<Switch checked={false} onCheckedChange={changed} />);+ const track = prepare(screen.getByRole('switch'));+ drag(track, 24);+ expect(changed.mock.calls).toEqual([[true]]);+ expect(track.dataset.state).toBe('unchecked');+ expect((track.firstElementChild as HTMLElement).style.getPropertyValue('--switch-drag-x')).toBe(+ '',+ );+ });++ it.each(['up', 'cancel', 'escape', 'capture'])(+ 'does not toggle on a same-side or cancelled drag (%s)',+ (end) => {+ const changed = vi.fn();+ render(<Switch onCheckedChange={changed} />);+ const track = prepare(screen.getByRole('switch'));+ drag(track, end === 'up' ? 3 : 24, end);+ expect(changed).not.toHaveBeenCalled();+ expect(track.dataset.state).toBe('unchecked');+ expect(track.firstElementChild?.hasAttribute('data-dragging')).toBe(false);+ // A cancelled pointer interaction must not swallow a later keyboard click.+ fireEvent.click(track, { detail: 0 });+ expect(changed.mock.calls).toEqual([[true]]);+ },+ );++ it('cancels an active gesture when disabled and stays inert', () => {+ const changed = vi.fn();+ const { rerender } = render(<Switch onCheckedChange={changed} />);+ const track = prepare(screen.getByRole('switch'));+ fireEvent.pointerDown(track, { clientX: 106 });+ fireEvent.pointerMove(track, { clientX: 130 });+ rerender(<Switch disabled onCheckedChange={changed} />);+ fireEvent.pointerUp(track);+ fireEvent.click(track);+ expect(changed).not.toHaveBeenCalled();+ expect(track.firstElementChild?.hasAttribute('data-dragging')).toBe(false);+ expect((track as HTMLButtonElement).hasPointerCapture(1)).toBe(false);+ });++ it('respects consumer event cancellation for pointer gestures and clicks', () => {+ const changed = vi.fn();+ const { rerender } = render(+ <Switch onCheckedChange={changed} onPointerDown={(event) => event.preventDefault()} />,+ );+ const track = prepare(screen.getByRole('switch'));+ fireEvent.pointerDown(track, { clientX: 106 });+ expect((track as HTMLButtonElement).setPointerCapture).not.toHaveBeenCalled();+ rerender(<Switch onCheckedChange={changed} onClick={(event) => event.preventDefault()} />);+ drag(track, 24);+ expect(changed).not.toHaveBeenCalled();});});diff --git a/apps/desktop/src/renderer/components/ui/switch.css b/apps/desktop/src/renderer/components/ui/switch.cssnew file mode 100644index 0000000000..d71328ef82--- /dev/null+++ b/apps/desktop/src/renderer/components/ui/switch.css@@ -0,0 +1,37 @@+/* Approved Switch study: subtle deformation, no shadow or overshoot. */+.cindy-switch {+ transition-duration: var(--motion-instant);+}++/* Transparent 24px target; the visible track stays 36 × 20. */+.cindy-switch::after {+ content: '';+ position: absolute;+ inset: -4px -2px;+ border-radius: inherit;+}++.cindy-switch-thumb {+ width: var(--switch-thumb-width);+ height: var(--switch-thumb-height);+ transform: translateX(var(--switch-drag-x, 0px));+ transition:+ transform var(--motion-fast) var(--motion-ease-out),+ width var(--motion-fast) var(--motion-ease-out),+ height var(--motion-fast) var(--motion-ease-out);+}++.cindy-switch-thumb[data-state='checked'] {+ transform: translateX(var(--switch-drag-x, calc(2rem - var(--switch-thumb-width))));+}++.cindy-switch-thumb[data-dragging] {+ transition: none;+}++@media (prefers-reduced-motion: reduce) {+ .cindy-switch,+ .cindy-switch-thumb {+ transition: none;+ }+}diff --git a/apps/desktop/src/renderer/components/ui/switch.tsx b/apps/desktop/src/renderer/components/ui/switch.tsxindex 261aab51b9..cf893f099d 100644--- a/apps/desktop/src/renderer/components/ui/switch.tsx+++ b/apps/desktop/src/renderer/components/ui/switch.tsx@@ -1,44 +1,232 @@/**- * Switch — shadcn/ui new-york 风格的 Radix Switch 包装。- *- * 与 dropdown-menu / popover 同 Radix 包装风格:直接 forwardRef + cn() 拼样式。- * 颜色全走 token:开启态走 --switch-track-on(默认 primary,皮肤可覆盖为主题色);- * 关闭态使用 Switch 专用 track/thumb token,避免复用 input 边框色后在设置卡片上- * 失去非文字组件所需的轮廓对比度。滑块无投影(DESIGN.md §6 零阴影哲学,试过可见- * 投影后被显式否决);禁用态 = 整体 × 滑块两级不透明度 token 叠加,让「不可用」靠- * 失去立体感区别于「关」。定值与依据见 colors.ts 注册处(用户裁决 2026-08-05)。+ * Shared Radix Switch. The approved HTML study supplies the subtle thumb motion;+ * Radix still owns checked/defaultChecked, keyboard activation and form events.+ * Colors remain theme tokens; the CINDY dark skin opts into the bright thumb.*/-import * as React from 'react';import * as SwitchPrimitives from '@radix-ui/react-switch';import { cn } from '@/lib/utils';+import './switch.css';++// Rem geometry follows the existing h-4/w-4 thumb and UI scaling.+const THUMB_SIZE = 16;+const HOVER_WIDTH = 17;+const PRESS_WIDTH = 18;+const PRESS_HEIGHT = 14;+const DRAG_THRESHOLD = 2;++type Gesture = {+ id: number;+ button: HTMLButtonElement;+ startX: number;+ originX: number;+ scale: number;+ maxX: number;+ x: number;+ dragging: boolean;+};const Switch = React.forwardRef<React.ComponentRef<typeof SwitchPrimitives.Root>,React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>->(({ className, ...props }, ref) => (- <SwitchPrimitives.Root- className={cn(- 'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors',- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',- 'disabled:cursor-not-allowed disabled:opacity-[var(--switch-disabled-opacity)]',- 'data-[state=checked]:bg-[var(--switch-track-on)] data-[state=unchecked]:bg-[var(--switch-track-off)]',+>(+ (+ {className,- )}- {...props}- ref={ref}- >- <SwitchPrimitives.Thumb- className={cn(- 'pointer-events-none block h-4 w-4 rounded-full ring-0 transition-transform',- 'data-[disabled]:opacity-[var(--switch-disabled-thumb-opacity)]',- 'data-[state=checked]:bg-background data-[state=unchecked]:bg-[var(--switch-thumb-off)]',- 'data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',- )}- />- </SwitchPrimitives.Root>-));+ disabled,+ onClick,+ onPointerDown,+ onPointerMove,+ onPointerUp,+ onPointerCancel,+ onLostPointerCapture,+ onPointerEnter,+ onPointerLeave,+ onKeyDown,+ onKeyUp,+ onBlur,+ ...props+ },+ ref,+ ) => {+ const thumbRef = React.useRef<HTMLSpanElement>(null);+ const gesture = React.useRef<Gesture | null>(null);+ const suppressPointerClick = React.useRef(false);+ const [hovered, setHovered] = React.useState(false);+ const [pressed, setPressed] = React.useState(false);+ const [dragX, setDragX] = React.useState<number | null>(null);++ const releaseCapture = () => {+ const active = gesture.current;+ gesture.current = null;+ if (active?.button.hasPointerCapture(active.id)) {+ active.button.releasePointerCapture(active.id);+ }+ };+ const cancel = () => {+ if (gesture.current) suppressPointerClick.current = true;+ releaseCapture();+ setPressed(false);+ setDragX(null);+ };+ React.useEffect(() => {+ if (disabled) {+ cancel();+ setHovered(false);+ }+ }, [disabled]);+ React.useEffect(() => () => releaseCapture(), []);++ const thumbWidth =+ !disabled && pressed ? PRESS_WIDTH : !disabled && hovered ? HOVER_WIDTH : THUMB_SIZE;+ const thumbHeight = !disabled && pressed ? PRESS_HEIGHT : THUMB_SIZE;+ const thumbStyle = {+ '--switch-thumb-width': `${thumbWidth / THUMB_SIZE}rem`,+ '--switch-thumb-height': `${thumbHeight / THUMB_SIZE}rem`,+ ...(dragX !== null && !disabled ? { '--switch-drag-x': `${dragX}px` } : {}),+ } as React.CSSProperties;++ return (+ <SwitchPrimitives.Root+ {...props}+ ref={ref}+ disabled={disabled}+ className={cn(+ 'cindy-switch peer relative inline-flex h-5 w-9 shrink-0 cursor-pointer touch-pan-y select-none items-center rounded-full border-2 border-transparent transition-colors',+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',+ 'disabled:cursor-not-allowed disabled:opacity-[var(--switch-disabled-opacity)]',+ 'data-[state=checked]:bg-[var(--switch-track-on)] data-[state=unchecked]:bg-[var(--switch-track-off)]',+ className,+ )}+ onClick={(event) => {+ // Drag release invokes the ordinary Radix click once. Suppress only the+ // subsequent native pointer click, never keyboard or label activation.+ if (suppressPointerClick.current && event.detail > 0) {+ suppressPointerClick.current = false;+ event.preventDefault();+ event.stopPropagation();+ return;+ }+ onClick?.(event);+ }}+ onPointerEnter={(event) => {+ onPointerEnter?.(event);+ if (!event.defaultPrevented && !disabled && event.pointerType === 'mouse')+ setHovered(true);+ }}+ onPointerLeave={(event) => {+ onPointerLeave?.(event);+ setHovered(false);+ }}+ onPointerDown={(event) => {+ onPointerDown?.(event);+ if (+ event.defaultPrevented ||+ disabled ||+ event.button !== 0 ||+ !event.isPrimary ||+ gesture.current+ )+ return;+ const button = event.currentTarget;+ const thumb = thumbRef.current;+ if (!thumb) return;+ const bounds = button.getBoundingClientRect();+ const scale = bounds.width / button.offsetWidth || 1;+ const rem = parseFloat(getComputedStyle(button.ownerDocument.documentElement).fontSize);+ const maxX = Math.max(0, button.clientWidth - (PRESS_WIDTH / THUMB_SIZE) * rem);+ const originX = Math.max(+ 0,+ Math.min(+ maxX,+ (thumb.getBoundingClientRect().left - bounds.left) / scale - button.clientLeft,+ ),+ );+ suppressPointerClick.current = false;+ gesture.current = {+ id: event.pointerId,+ button,+ startX: event.clientX,+ originX,+ scale,+ maxX,+ x: originX,+ dragging: false,+ };+ button.setPointerCapture(event.pointerId);+ setPressed(true);+ }}+ onPointerMove={(event) => {+ onPointerMove?.(event);+ const active = gesture.current;+ if (event.defaultPrevented || !active || active.id !== event.pointerId) return;+ const delta = (event.clientX - active.startX) / active.scale;+ if (!active.dragging && Math.abs(delta) < DRAG_THRESHOLD) return;+ active.dragging = true;+ active.x = Math.max(0, Math.min(active.maxX, active.originX + delta));+ setDragX(active.x);+ }}+ onPointerUp={(event) => {+ onPointerUp?.(event);+ const active = gesture.current;+ if (!active || active.id !== event.pointerId) return;+ releaseCapture();+ setPressed(false);+ setDragX(null);+ if (event.pointerType !== 'mouse') setHovered(false);+ if (active.dragging) {+ suppressPointerClick.current = true;+ const next = active.x > active.maxX / 2;+ if (+ !event.defaultPrevented &&+ !disabled &&+ next !== (event.currentTarget.dataset.state === 'checked')+ ) {+ event.currentTarget.click();+ }+ }+ }}+ onPointerCancel={(event) => {+ onPointerCancel?.(event);+ if (gesture.current?.id === event.pointerId) {+ cancel();+ setHovered(false);+ }+ }}+ onLostPointerCapture={(event) => {+ onLostPointerCapture?.(event);+ if (gesture.current?.id === event.pointerId) cancel();+ }}+ onKeyDown={(event) => {+ onKeyDown?.(event);+ if (event.defaultPrevented || disabled) return;+ if (event.key === ' ' || event.key === 'Enter') setPressed(true);+ if (event.key === 'Escape') cancel();+ }}+ onKeyUp={(event) => {+ onKeyUp?.(event);+ if (event.key === ' ' || event.key === 'Enter') setPressed(false);+ }}+ onBlur={(event) => {+ onBlur?.(event);+ cancel();+ }}+ >+ <SwitchPrimitives.Thumb+ ref={thumbRef}+ style={thumbStyle}+ data-dragging={dragX !== null && !disabled ? '' : undefined}+ className={cn(+ 'cindy-switch-thumb pointer-events-none block shrink-0 rounded-full ring-0',+ 'data-[disabled]:opacity-[var(--switch-disabled-thumb-opacity)]',+ 'data-[state=checked]:bg-[var(--switch-thumb-on)] data-[state=unchecked]:bg-[var(--switch-thumb-off)]',+ )}+ />+ </SwitchPrimitives.Root>+ );+ },+);Switch.displayName = SwitchPrimitives.Root.displayName;export { Switch };diff --git a/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.ts b/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.tsindex 9ca5f1a017..815a61b3a1 100644--- a/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.ts+++ b/apps/desktop/src/renderer/themes/__tests__/cindyDecisionData.ts@@ -40,6 +40,8 @@ export const CINDY_REQUIRED_COLOR_IDS = ['text-disabled','text-disabled-tertiary','switch-track-off', // 用户裁决 2026-08-05 入表(见 CINDY_EXPECTED_VALUES 同名条目)+ 'switch-thumb-on', // 用户批准 2026-09-16 HTML 效果+ 'switch-thumb-off', // 用户批准 2026-09-16 HTML 效果'switch-track-on', // 用户裁决 2026-08-05 入表(见 CINDY_EXPECTED_VALUES 同名条目)'caret-accent','accent-cta-bg',@@ -221,7 +223,9 @@ export const CINDY_EXPECTED_VALUES: Record<string, { light: string; dark: string'text-disabled': { light: '#6B6B67', dark: '#C1C1C1' },'text-disabled-tertiary': { light: '#6B6B67', dark: '#C1C1C1' },'switch-track-off': { light: '#888888', dark: '#787878' }, // 用户调参 2026-08-05:两端都顶到 3:1 底线内的极值拉开开/关差距——light 最亮档 #888888(×surface 3.03),dark 最深档 #787878(×elevated 3.01,等效白 36% 透明)- 'switch-track-on': { light: '#4A4D51', dark: '#EEEEEE' }, // 用户调参 2026-08-05:light 自 primary #3C3F43 提亮一档;dark 维持 E1D 中性浅灰现状值(因 light 入表,dark 显式同冻)+ 'switch-track-on': { light: '#417CDD', dark: '#417CDD' }, // 用户裁决 2026-09-15:两模式开启轨道改为蓝色,替代 2026-08-05 中性开启态;亮色滑块后续裁决见下+ 'switch-thumb-on': { light: 'hsl(var(--background))', dark: '#FCFCFC' }, // 用户批准 2026-09-16:暗色亮滑块,浅色保留别名+ 'switch-thumb-off': { light: 'var(--surface-on-card)', dark: '#FCFCFC' }, // 用户批准 2026-09-16:开关两态统一亮滑块'caret-accent': { light: '#417CDD', dark: '#417CDD' }, // 用户改稿 2026-07-18:光标撤红改回蓝'accent-cta-bg': { light: '#3C3F43', dark: '#EEEEEE' }, // E1D'accent-cta-bg-pure': { light: '#3C3F43', dark: '#EEEEEE' }, // E1Ddiff --git a/apps/desktop/src/renderer/themes/__tests__/fixtures/builtin-theme-overrides.json b/apps/desktop/src/renderer/themes/__tests__/fixtures/builtin-theme-overrides.jsonindex 50284c6f3d..ecb72cad44 100644--- a/apps/desktop/src/renderer/themes/__tests__/fixtures/builtin-theme-overrides.json+++ b/apps/desktop/src/renderer/themes/__tests__/fixtures/builtin-theme-overrides.json@@ -272,7 +272,9 @@"surface-hover-hsl": "60.0 12.8% 92.4%","surface-on-card": "#FFFFFF","switch-track-off": "#888888",- "switch-track-on": "#4A4D51",+ "switch-track-on": "#417CDD",+ "switch-thumb-on": "hsl(var(--background))",+ "switch-thumb-off": "var(--surface-on-card)","status-badge-fg": "#1F1F1F","border-default": "#E4E4DF","border-default-hsl": "60.0 8.5% 88.4%",@@ -445,7 +447,9 @@"surface-hover-hsl": "0 0% 11.4%","surface-on-card": "#181818","switch-track-off": "#787878",- "switch-track-on": "#EEEEEE",+ "switch-track-on": "#417CDD",+ "switch-thumb-on": "#FCFCFC",+ "switch-thumb-off": "#FCFCFC","status-badge-fg": "#121212","border-default": "#313131","border-default-hsl": "0 0% 19.2%",diff --git a/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.json b/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.jsonindex 3bbc35c9a3..b09764ba49 100644--- a/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.json+++ b/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.json@@ -1,6 +1,6 @@{"source": "apps/desktop/src/renderer/themes/colors.ts",- "count": 542,+ "count": 543,"colors": [{"id": "surface",@@ -352,6 +352,11 @@"light": "var(--surface-on-card)","dark": "var(--surface-on-card)"},+ {+ "id": "switch-thumb-on",+ "light": "hsl(var(--background))",+ "dark": "hsl(var(--background))"+ },{"id": "switch-disabled-opacity","light": "0.3",diff --git a/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.ts b/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.tsindex b7e82548db..5466926094 100644--- a/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.ts+++ b/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.ts@@ -13,7 +13,7 @@ describe('generated effort inputs initialize without DOM or circular imports', (await import('../colors');await import('../effortTierColors');expect(colorRegistry.getColors()).toEqual(first);- expect(first.length).toBe(542);+ expect(first.length).toBe(543);expect(first[0].id).toBe('surface');expect(effort.effortTierColor('high')).toBe('#3B82F6');expect(effort.effortTierColor('unknown')).toBe('#14B8A6');diff --git a/apps/desktop/src/renderer/themes/__tests__/switchThemeContrast.test.ts b/apps/desktop/src/renderer/themes/__tests__/switchThemeContrast.test.tsindex 12b09be7a2..365864fff4 100644--- a/apps/desktop/src/renderer/themes/__tests__/switchThemeContrast.test.ts+++ b/apps/desktop/src/renderer/themes/__tests__/switchThemeContrast.test.ts@@ -44,7 +44,7 @@ const SURFACES = [/** 开/关两态共用一套守卫:轨道×滑块、轨道×全部表面均 ≥3:1(非文字组件底线)。 */const CONTROL_STATES = [{ state: 'unchecked', trackId: 'switch-track-off', thumbId: 'switch-thumb-off' },- { state: 'checked', trackId: 'switch-track-on', thumbId: 'background' },+ { state: 'checked', trackId: 'switch-track-on', thumbId: 'switch-thumb-on' },] as const;const importedDarkTheme: Theme = {@@ -93,6 +93,8 @@ describe('Switch contrast', () => {// 开启态轨道默认沿用 primary:不覆盖的主题(Classic/导入)外观零变化expect(colorRegistry.resolveDefault('switch-track-on', 'light')).toBe('hsl(var(--primary))');expect(colorRegistry.resolveDefault('switch-track-on', 'dark')).toBe('hsl(var(--primary))');+ expect(colorRegistry.resolveDefault('switch-thumb-on', 'light')).toBe('hsl(var(--background))');+ expect(colorRegistry.resolveDefault('switch-thumb-on', 'dark')).toBe('hsl(var(--background))');// 禁用态两级弱化的全局定稿值(用户裁决 2026-08-05):整体 0.3 × 滑块 0.5for (const [id, expected] of [['switch-disabled-opacity', '0.3'],@@ -103,6 +105,14 @@ describe('Switch contrast', () => {}});+ it('keeps old imported background overrides and accepts an explicit checked thumb', () => {+ const legacy: Theme = { ...importedDarkTheme, colors: { ...importedDarkTheme.colors, background: '0 0% 12%' } };+ expect(resolveColor(legacy, 'switch-thumb-on')).toBe('0 0% 12%');+ const customized = { ...legacy, colors: { ...legacy.colors, 'switch-thumb-on': '#FDFDFD' } };+ expect(resolveColor(customized, 'switch-thumb-on')).toBe('#FDFDFD');+ expect(legacy.colors).not.toHaveProperty('switch-thumb-on');+ });+it('fails closed for unsupported color formats', () => {expect(() => parseHex('rgb(130, 130, 130)')).toThrow('Unsupported color format');expect(() => toRgb('rgba(130, 130, 130, 0.5)')).toThrow('Unsupported color format');diff --git a/apps/desktop/src/renderer/themes/builtin/cindy-dark.ts b/apps/desktop/src/renderer/themes/builtin/cindy-dark.tsindex 84ffeec21f..784af294d5 100644--- a/apps/desktop/src/renderer/themes/builtin/cindy-dark.ts+++ b/apps/desktop/src/renderer/themes/builtin/cindy-dark.ts@@ -25,7 +25,9 @@ const GENERATED_OVERRIDES = {"surface-hover-hsl": "0 0% 11.4%", // hover -> HSL"surface-on-card": "#181818", // 直映: 页底(纯中性)"switch-track-off": "#787878", // 关闭态轨道:值与依据见决策表(用户调参 2026-08-05)- "switch-track-on": "#EEEEEE", // 开启态轨道:值与依据见决策表(用户调参 2026-08-05)+ "switch-track-on": "#417CDD", // 开启态轨道:蓝色 #417CDD(用户裁决 2026-09-15)+ "switch-thumb-on": "#FCFCFC", // Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名+ "switch-thumb-off": "#FCFCFC", // Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名"status-badge-fg": "#121212", // 反相深字: 平移"border-default": "#313131", // 边框"border-default-hsl": "0 0% 19.2%", // 边框 -> HSLdiff --git a/apps/desktop/src/renderer/themes/builtin/cindy-light.ts b/apps/desktop/src/renderer/themes/builtin/cindy-light.tsindex a17c1a5289..d40166d347 100644--- a/apps/desktop/src/renderer/themes/builtin/cindy-light.ts+++ b/apps/desktop/src/renderer/themes/builtin/cindy-light.ts@@ -25,7 +25,9 @@ const GENERATED_OVERRIDES = {"surface-hover-hsl": "60.0 12.8% 92.4%", // hover -> HSL"surface-on-card": "#FFFFFF", // 裁决: 中性反相前景,不作红 CTA 专用"switch-track-off": "#888888", // 关闭态轨道:值与依据见决策表(用户调参 2026-08-05)- "switch-track-on": "#4A4D51", // 开启态轨道:值与依据见决策表(用户调参 2026-08-05)+ "switch-track-on": "#417CDD", // 开启态轨道:蓝色 #417CDD(用户裁决 2026-09-15)+ "switch-thumb-on": "hsl(var(--background))", // Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名+ "switch-thumb-off": "var(--surface-on-card)", // Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名"status-badge-fg": "#1F1F1F", // §7 必炸点:值经队列震荡后按 HEAD 冻结(#1F1F1F,5.61:1 × #FF6600 ≥4.5),批准依据:用户亲批方案 2026-07-17"border-default": "#E4E4DF", // 直映: 边框(冷转暖)"border-default-hsl": "60.0 8.5% 88.4%", // 边框 -> HSLdiff --git a/apps/desktop/src/renderer/themes/colors.ts b/apps/desktop/src/renderer/themes/colors.tsindex 4b2f55baae..c146947b1a 100644--- a/apps/desktop/src/renderer/themes/colors.ts+++ b/apps/desktop/src/renderer/themes/colors.ts@@ -249,6 +249,10 @@ const GENERATED_DEFAULTS = {"light": "var(--surface-on-card)","dark": "var(--surface-on-card)"},+ "switch-thumb-on": {+ "light": "hsl(var(--background))",+ "dark": "hsl(var(--background))"+ },"switch-disabled-opacity": {"light": "0.3","dark": "0.3"@@ -2227,6 +2231,7 @@ registerColor('border', GENERATED_DEFAULTS["border"], 'border');registerColor('input', GENERATED_DEFAULTS["input"], 'input');registerColor('switch-track-off', GENERATED_DEFAULTS["switch-track-off"], '共享 Switch 未选中轨道;跟随主题次要前景,与默认/悬停表面及滑块保持至少 3:1 非文字组件对比度,同时弱于开启态');registerColor('switch-thumb-off', GENERATED_DEFAULTS["switch-thumb-off"], '共享 Switch 未选中滑块;跟随主题反相前景,与未选中轨道保持至少 3:1 非文字组件对比度');+registerColor('switch-thumb-on', GENERATED_DEFAULTS["switch-thumb-on"], '共享 Switch 开启滑块;默认沿用 background 保持旧主题与用户覆盖,CINDY Dark 独立改为近白(用户批准 2026-09-16)');registerColor('switch-disabled-opacity', GENERATED_DEFAULTS["switch-disabled-opacity"], '共享 Switch 禁用态整体不透明度(纯数值 token,非颜色);全局 0.3(用户裁决 2026-08-05,自出货值 0.5 调深),各皮肤仍可覆盖');registerColor('switch-disabled-thumb-opacity', GENERATED_DEFAULTS["switch-disabled-thumb-opacity"], '共享 Switch 禁用态滑块自身不透明度(纯数值 token,叠加在整体不透明度之上);全局 0.5(用户裁决 2026-08-05)——禁用态滑块与轨道趋近、削掉立体感,「不可用」区别于「关」的关键');registerColor('switch-track-on', GENERATED_DEFAULTS["switch-track-on"], '共享 Switch 开启态轨道;默认沿用 primary(不覆盖的主题外观不变),移植主题覆盖为各自主题色、CINDY 冻结于决策表;每个覆盖值须过 switchThemeContrast 的 ≥3:1 守卫(用户裁决 2026-08-05)');diff --git a/docs/design-evidence/2026-09-16/cindy-switch-style.md b/docs/design-evidence/2026-09-16/cindy-switch-style.mdnew file mode 100644index 0000000000..08ddfacf16--- /dev/null+++ b/docs/design-evidence/2026-09-16/cindy-switch-style.md@@ -0,0 +1,71 @@+# Cindy Switch:蓝色轨道、亮滑块与轻微形变++2026-09-16。用户逐轮试用 HTML 后批准实施(按压收敛为 18×14,悬停 17×16)。+类别:有意可见变化;规范:DESIGN.md §14.4 / §15.17。++首次实机验证的 checkout HEAD:`6f56e4cd78aec8947ec4c621cd60fe115e2a072e`,加本地未提交 Switch 改动。+当时尚未提交或推送。DS-11 #4455 现已合并,本次 Switch 以独立分支交付。++## 实现与兼容++共享 Desktop Radix Switch 保留 checked/defaultChecked、onCheckedChange、ref、原生标签、+键盘和表单路径。拖动后仅通过原有 click 路径提交一次,随后抑制原生指针产生的重复 click;+同侧拖动、取消、Escape、丢失捕获与禁用不提交。未接受更新的受控组件回到当前状态。++新增 switch-thumb-on 默认别名为 hsl(var(--background));原主题的 background 自定义仍有效。+CINDY Dark 对开、关滑块均覆盖为 #FCFCFC。CINDY Light 保留 background / surface-on-card+别名。DTCG 源、生成物、独立预期与历史分类索引同步更新;旧 ID 与用户主题文件不变。+共享动效适用于 Desktop 各主题;Mobile 不在本次范围。++## 验证++- Desktop 主题目录 + Switch 组件:17 个测试文件、231 项通过。+- design-tokens:47 项覆盖;首次发现新 ID 尚未登记到历史分类索引,补齐后定向重跑+ classification.test.ts 的 9 项全部通过,其余 38 项在本轮全包执行中通过。+- Desktop 与 design-tokens typecheck 均通过;生成新鲜度检查通过。+- Switch 组件和输入测试的 ESLint 通过;git diff --check 通过。+- 首次实机验证阶段未执行提交门禁;主干整合后的门禁结果见下方补记。++## 真实 Electron 验证++macOS,Global 隔离 dev2-ds11-review profile;实际设置页(通知开关),CDP 9331。+复用当前 checkout 的 Vite HMR,不重启。实例启动 SHA 为+`46e44879d32b9a5c75f06530fc30e6a46a408905`,与当前 HEAD 不同;已通过生产 DOM 中+cindy-switch 类、加载的生产主题模块及下列 computed style 确认当前 Renderer 改动生效。+此记录不声称重新构建 main/preload 或验证 packaged 版本。++| 项目 | CINDY Light | CINDY Dark |+| --- | --- | --- |+| 开启轨道 | #417CDD | #417CDD |+| 开启滑块 | rgb(242,242,237),保留原 background | #FCFCFC |+| 关闭滑块 | #FFFFFF | #FCFCFC |+| 轨道尺寸 | 36×20 | 36×20 |+| 静止 / 悬停 / 按住滑块 | 16×16 / 17×16 / 18×14 | 16×16 / 17×16 / 18×14 |+| 几何过渡 | 150ms,cubic-bezier(0.16,1,0.3,1) | 同左 |+| 减少动态效果 | CSS 已实现、静态检查 | 实机确认过渡时长为 0s |++两模式均实测拖动关闭/开启与 Space 切换。未见可见滑块阴影(原 ring-0 产生的+box-shadow 长度均为 0);未改变原焦点环。验证结束恢复通知设置与原主题。+静止设置页截图已目检;Windows/Linux 和触摸硬件未实机验证。++截图、逐状态 computed 值与验证脚本位于本机临时目录,不入 Git:++`/var/folders/yh/nrp07sr92331p22044y8zl440000gn/T/cindy-switch-implementation-8ryxm2t4/`++- cindy-light-settings.png / cindy-dark-settings.png+- cindy-light-pressed.png / cindy-dark-pressed.png+- runtime-verification.json / runtime-check.cjs++尚未上传 PR 附件,以上路径仅是本地证据,不代表跨机器可访问的长期链接。+回退时整体回退本次 Switch 组件/CSS、主题源与生成物、独立预期和规范条目,不改写用户主题。++## DS-11 合并后的独立提交验证++基于 main `5a5ad0eff234c6555d2b46335231b1c7253289d7`,分支 `ui/cindy-switch-blue-motion`。+Switch 补丁可无冲突应用;本分支仅收录 Switch 代码、主题与证据,不含设计站点。++- `pnpm test:unit:related` 通过(Desktop 与 design-tokens 相关单测;runner 543 项通过、2 项既有跳过)。+- Desktop / design-tokens 类型检查、Token 生成物新鲜度、Switch ESLint 与 diff 空白检查通过。+- client-ci 静态预检:设计台账、端点、i18n / 品牌 / 术语、Mobile 类型与 scope、migration、scheduler,以及 device-link 编译与集成测试均通过。+- 新分支未重启宿主;上方实机证据对应相同 Switch 实现,不能当作新 main/preload 构建的证明。+- 可交互确认稿:https://cindy-design-lab.workers.xd.team/#/switch ,这是设计稿,非实机截图。diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex 026c52ab6d..c3add8f967 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -89,6 +89,7 @@ The grayscale rule is near-absolute. The following are the **only** sanctioned n> **Additional narrowly-scoped exceptions** (documented in their respective component specs, do NOT generalize as system semantic colors):>+> - **CINDY checked Switch** — `--switch-track-on` uses blue `#417CDD` in CINDY Light and Dark (owner decision 2026-09-15, §15.17). This is an enabled-state signal, independently adjustable from focus, caret and Auto Approval despite sharing their current hue. Other themes retain their own checked-track colors.> - **Windows taskbar attention badge** — the native OS overlay uses a fixed red background (`#D91F37`) and white digits/border (`#FFFFFF`) in both Light and Dark taskbars. This is the app-wide count of active tasks needing attention, not an error-only status. The image-specific semantic pair lives in `apps/desktop/src/main/windowsBadgeIcon.ts`; it is not an in-app theme token. Render at 16 logical pixels with 100/125/150/200/300% representations; use a circle for one digit, a rounded square for multiple digits, and `99+` above 99. The accessibility description keeps the exact total. Only the OS image may use its fitted 8–12px system-font digits; web typography and status-dot color rules are unchanged.> - **Toast Info / Success / Warning / Error** — `#417CDD` / `#2AAE5B` / `#F3A115` / `#D91F37`(finalized 2026-07-17; Toast exemption lifted) — used ONLY on the 16×16 lucide icon inside Toast pill notifications. The pill body (background, text, border, close icon) remains strictly grayscale. Info blue #417CDD equals the focus-ring / Auto Approval value (originally #3B82F6, added 2026-07-14, now finalized); success/warning/error equal the global status colors (done green / status error / warning foreground).> - **Usage History category color (owner-approved 2026-09-08, extended 2026-09-09).** The registered usage heatmap uses a blue intensity scale. Daily token bars and their corresponding model-table swatches/share marks use `--usage-model-1` … `--usage-model-5` as the seed palette; additional models receive theme-derived hues without a top-five cutoff. All model identities in the full history are included, even when absent from the last 30 days. Agent/harness swatches, share marks and the stacked share strip reuse the existing engine identity tokens: `--engine-badge-cc` (terracotta orange), `--engine-badge-codex` (blue), and `--usage-model-1` (owner-chosen teal for pi, to distinguish it from Codex blue). Claude/Codex retain their cross-mode fixed-value contract; pi follows the existing Light/Dark teal values. `--usage-heatmap-high` supplies the high end of the heatmap. The heatmap retains its process-blue alias; category colors do not inherit process/status semantics. Task marks, text and control frames stay neutral. See [the component specification](./usage-history-charts.md); colors.ts remains the seed-value source, with runtime derivation under governance §3.4.@@ -720,7 +721,7 @@ Settings → Appearance can import a VSCode color theme (`*.json` / jsonc) or an- **`-hsl` tokens are computed, not copied.** Both forms of a color must denote the same color, so the converter derives every HSL triplet from its hex via `toHslTriplet()`. (Note: a few hand-written builtin themes carry approximate HSL values — `github-dark`'s `SURFACE_BG_HSL` was copied off one-dark-pro. Those are left as-is; new imports are exact.)- **Markdown text colors go through `--md-h1-fg`…`--md-h6-fg` / `--md-strong-fg`, and default to `inherit`.** Before these tokens existed, Markdown headings and bold text inherited their color from the container (`baseComponents` sets size/weight only). Defaulting to `var(--text-primary)` would have repainted headings inside blockquotes, tool cards and secondary-text regions, so the defaults are `inherit` — every built-in theme renders exactly as before. Imported themes fill them from Obsidian `--hN-color` / `--bold-color` or VSCode `markup.heading` / `markup.bold`. Guard: `themes/__tests__/markdownColorTokens.test.ts`.- **Obsidian import is a palette import, not a theme port.** Only CSS custom properties are read; selectors, layout, radii and fonts are discarded — Cindy's layout and typography stay owned by §3/§5. Values that cannot be evaluated statically (`color-mix()`, undefined `var()`) are skipped and reported rather than guessed.-- **Checked Switch track = theme accent (ported theme files only, user ruling 2026-08-05).** The seven ported theme files each override `switch-track-on` to their own accent (solarized-light uses `GREEN_DEEP` — the official `#859900` fails the 3:1 floor). The registry default stays `hsl(var(--primary))`: Classic and imported themes keep the pre-existing neutral checked track, and CINDY carries its own frozen decision-table values (Dark keeps `#EEEEEE`; Light deliberately lightened to `#4A4D51`). Guard: `switchThemeContrast.test.ts` asserts every builtin theme's checked track ≥3:1 against the checked thumb (`background`) and all five surfaces.+- **Checked Switch track = theme accent.** The seven ported theme files each override `switch-track-on` to their own accent (user ruling 2026-08-05; solarized-light uses `GREEN_DEEP` — the official `#859900` fails the 3:1 floor). The registry default stays `hsl(var(--primary))`: Classic and imported themes keep the pre-existing neutral checked track. CINDY Light and Dark use blue `#417CDD` (owner decision 2026-09-15, §15.17), replacing their former neutral checked tracks. Guard: `switchThemeContrast.test.ts` asserts every builtin theme's checked track ≥3:1 against the checked thumb (`switch-thumb-on`, defaulting to `hsl(var(--background))`) and all five surfaces.- **Local themes may declare an optional `family`.** Same-family light + dark variants merge into one switchable family (`themes/families.ts`); files without the field keep behaving exactly as before (family id = theme id). Obsidian's dual-mode CSS uses this to land as a single theme that follows Light/Dark mode.## 11. Voice & Content(微文案规范)@@ -830,6 +831,8 @@ ellipsis (with the native full-title tooltip) and disables the track. This narroexception preserves readable, constant-paced title playback without allowing thelong duration to leak into any other hover or transition.+**Switch feedback (owner-approved 2026-09-16).** The shared Desktop Switch uses the bounded thumb width/height changes registered in §15.17: a one-shot size transition with `--motion-fast` / `--motion-ease-out`, no overshoot, and direct pointer tracking during drag. The track and hit region do not move or grow. This is a functional transient width/height exception; it does not authorize looping layout animation. Reduced motion removes transitions and keeps immediate state feedback.+#### Semantics → motion prototypes (one semantic, one motion, app-wide)| Semantic | Spec | Reference implementation |@@ -1465,6 +1468,15 @@ The execution rulebook for subsequent desktop / mobile UI updates. Sources: the- **Exempt families untouched**: `login-*` (58 tokens), `diff-*`, `error-*`, `overlay-*`, semantic status colors, shadows — per §10/§16 and `protected-tokens.ts`.- User-tuned one-offs: dark sidebar glass `rgba(5,5,5,0.85)` (2026-08-11); light sidebar glass 85% opacity (2026-08-17, aligned with dark).+### 15.17 Switch color and motion (owner decisions 2026-09-15 / 2026-09-16)++- Desktop CINDY Light and Dark both override `switch-track-on` to `#417CDD`, replacing the 2026-08-05 Light `#4A4D51` / Dark `#EEEEEE` decision. Blue adds an enabled-state signal to the existing thumb-position cue.+- The 2026-09-16 approved HTML study makes CINDY Dark's checked and unchecked thumbs near-white `#FCFCFC`. `switch-thumb-on` is a dedicated role; its registry default remains `hsl(var(--background))` so old themes and customized backgrounds continue to apply. CINDY Light retains `hsl(var(--background))` for ON and `var(--surface-on-card)` for OFF. Never change global `background` to recolor a Switch.+- The shared Desktop Switch keeps its 36 × 20 track and 16 × 16 resting thumb. Mouse hover widens the thumb to 17 × 16; press/drag uses 18 × 14 (the user reduced the earlier 20 × 12 prototype). The outer edge stays anchored, the thumb stays vertically centered, and the original focus treatment and shadow-free pill shape remain. A transparent hit area provides at least 24px height without resizing the visible track.+- Motion: geometry uses `--motion-fast` / `--motion-ease-out`; track color uses `--motion-instant`. No overshoot. Dragging tracks the pointer after 2px of horizontal travel; release chooses the nearest state, cancellation restores the current value, and each completed change uses the existing Radix click/form/callback path once. Disabled controls do not deform or drag; opacity remains track 0.3 × thumb 0.5. Reduced motion changes state/shape immediately.+- Scope: approved thumb colors belong to CINDY; shared Switch feedback applies across Desktop themes. Ordinary CTAs keep their own contracts. Mobile retains its separate baseline pending its own follow-up.+- Values live in the DTCG sources and generated theme defaults/overrides. `cindyDecisionData.ts` and the builtin-theme fixture independently freeze the approved values; `switchThemeContrast.test.ts` guards both states against the thumb and all five surfaces (checked blue minimum: Light 3.50:1 / Dark 3.97:1). Component input tests cover controlled/uncontrolled use, form events, drag cancellation and disabled behavior.+## 16. Login Flow (登录链路)> 本节是登录全链路的设计系统规范。逐参数权威 = 同目录的 [`figma-component-spec.md`](./figma-component-spec.md)(组件 / 色板速查,nodeId 溯源)与 [`token-decision-table.md`](./token-decision-table.md)(token / 尺寸决策)——两份自 2026-07-24 起随 `docs/design-rules/` 入仓维护;`DESIGN-login`(逐屏规格)、`flow-map`(状态机)、`fidelity-matrix`(保真度验收矩阵)仍为设计阶段工作文件,不入仓库。本节不重复抄全表,只钉死设计规则与组件契约,逐参数值以 Figma 组件库及本节色板表为准。diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.mdindex 07cf6e3c12..af24c11dd5 100644--- a/docs/design-rules/design-decision-log.md+++ b/docs/design-rules/design-decision-log.md@@ -12,6 +12,10 @@## 2026-09+- **09-16(Switch 亮滑块与轻微形变)**:用户确认 HTML 并要求应用到当前 Cindy Switch。CINDY Dark 的开/关滑块统一为 `#FCFCFC`,开启轨道沿用蓝色 `#417CDD`;新增 `switch-thumb-on`,默认跟随旧 `background`,保留其他主题与用户覆盖。参考 Fluid Functionalism 后,用户认为压缩过大,将按压由 20×12 收敛到 18×14、悬停由 18×16 收敛到 17×16,静止仍为 16×16;沿用 Cindy 150ms 缓动和 80ms 轨道变色,无过冲、无阴影。共享 Desktop 组件支持拖动,保留 Radix 的 ref、checked/defaultChecked、键盘与表单回调;禁用与减少动态效果适配。规范见 `DESIGN.md §14.4 / §15.17`。本次为独立有意可见变化,DS-10 #4427 已合并,DS-11 #4455 的远端内容不在本次修改范围。++- **09-15(CINDY 开关开启态改蓝)**:用户查看浅深模式 HTML 对比后明确要求「把开关打开状态改成蓝色 #417CDD 应用到 Cindy UI」。Desktop CINDY Light / Dark 的 `switch-track-on` 同为 `#417CDD`,取代 2026-08-05 的 Light `#4A4D51` / Dark `#EEEEEE`。关闭轨道、滑块、禁用透明度、尺寸与焦点处理沿用既有合同;普通主操作保持中性,其他主题与 Mobile 不扩展。蓝色与光标、焦点、自动批准同色但不互相绑定。现行规范见 `DESIGN.md §2 / §10 / §15.17`;DTCG 主题源生成生产值,`cindyDecisionData.ts` 与内置主题快照独立锁定新预期。此裁决独立于仍待合并的 DS-10 / DS-11,不将旧截图或其验收结论当作本次改色的实机证据。+- **09-12 IM 上下文卡片的轻量折叠入口(#4367,补记已确认方向)**:用户看过深浅 HTML 示意后确认统一所有 IM bot 的折叠分组与数字展示。本轮补齐组件登记:仅 `HookTaskCard` 的长正文和附带上下文开关使用无背景、无边框的文字控件;不将其他聊天操作豁免为裸文字按钮。两处共用点击留白与独立键盘焦点处理,分组不套背景框;规范落点为 `DESIGN.md §4`。本条记录既有需求与展示方向,不表示真实客户端双模式或真实 IM 端到端已经验收。- **09-12** **侧栏整理菜单收为子菜单**——用户逐轮确认 HTML 后授权实施:一级为分组、任务排序、项目排序、任务状态、筛选、显示、任务信息,右侧均显示当前选择。任务排序直接并列优先级、最近活动、创建时间;优先级列首不改变默认值。筛选维度名为 Harness,补 Pi;任务状态独立于内容筛选的计数和重置。所有菜单行配图标,分组入口按真实侧栏的组标题与缩进任务行绘制,取代网格及 FolderTree 候选。替代旧菜单的平铺区块、嵌套时间排序及部分行刻意无图标的处理。现行行为见 `docs/product-rules/sidebar-redesign-plan.md §3`,实现为 `SidebarFilterPopover.tsx`;本条记录设计批准,不代表客户端实机验收通过。diff --git a/packages/design-tokens/README.md b/packages/design-tokens/README.mdindex 00c4a08201..dc7c782ec0 100644--- a/packages/design-tokens/README.md+++ b/packages/design-tokens/README.md@@ -39,7 +39,7 @@ Effort/price 静态表也由 colors.ts 生成并导出,`effortTierColors.ts` i## 已接管与保留-基线为 **541 ID / 11 内置主题**。DS-11 新增独立 `form-field-hint` 角色(默认保留 secondary-mid alias,One Dark Pro / Solarized 单独补可读性),当前 523 注册项接管,19 项原位保留:7 个 Markdown `inherit`、2 个登录背景 `none`、7 个 color-mix 运行期表达式,以及 annotation-accent / login-brand-accent / login-brand-accent-pressed 三个 register-only 保护 singleton。静态阴影、透明度、radius 和 splash 动效已建模,不能统称动态值漏掉。+基线为 **541 ID / 11 内置主题**。DS-11 新增独立 `form-field-hint` 角色(默认保留 secondary-mid alias,One Dark Pro / Solarized 单独补可读性),Switch 新增独立 `switch-thumb-on` 角色(默认保留 background alias,CINDY Dark 使用近白滑块),当前 524 注册项接管,19 项原位保留:7 个 Markdown `inherit`、2 个登录背景 `none`、7 个 color-mix 运行期表达式,以及 annotation-accent / login-brand-accent / login-brand-accent-pressed 三个 register-only 保护 singleton。静态阴影、透明度、radius 和 splash 动效已建模,不能统称动态值漏掉。动态模型 OKLCH 配色、effort 插值、字体选择/缩放/compact、reduced-motion、Diff 测量/Worker/缓存、数据几何及业务计时继续留在原代码。通用 Tailwind 尺度已接源,不代表所有局部任意值、第三方编辑器/终端/登录画布几何或各业务组件已完成设计迁移;这些保持现有登记与后续批次边界,不新增标准档位。diff --git a/packages/design-tokens/src/__tests__/production.test.ts b/packages/design-tokens/src/__tests__/production.test.tsindex a02f2d300e..8afd8899d9 100644--- a/packages/design-tokens/src/__tests__/production.test.ts+++ b/packages/design-tokens/src/__tests__/production.test.ts@@ -176,7 +176,7 @@ describe("DS-8 production source", () => {ts.forEachChild(node, visit);};visit(source);- expect(new Set(ids).size).toBe(542);+ expect(new Set(ids).size).toBe(543);expect([...Object.keys(bindings.defaults),diff --git a/packages/design-tokens/src/classification.json b/packages/design-tokens/src/classification.jsonindex 0789b3dc43..417158e91c 100644--- a/packages/design-tokens/src/classification.json+++ b/packages/design-tokens/src/classification.json@@ -1,10 +1,10 @@{"source": "apps/desktop/src/renderer/themes/colors.ts","generatedBy": "packages/design-tokens/src/classify.ts",- "snapshotCount": 542,+ "snapshotCount": 543,"categories": {"literal": 265,- "alias": 241,+ "alias": 242,"hsl-triplet": 6,"runtime-derived-or-protected": 30},@@ -629,6 +629,18 @@},"modeledAsSemantic": false},+ {+ "id": "switch-thumb-on",+ "category": "alias",+ "destination": "semantic-or-component-candidate",+ "lightKind": "alias",+ "darkKind": "alias",+ "aliasOf": {+ "light": "background",+ "dark": "background"+ },+ "modeledAsSemantic": false+ },{"id": "switch-disabled-opacity","category": "runtime-derived-or-protected",diff --git a/packages/design-tokens/src/component/color.json b/packages/design-tokens/src/component/color.jsonindex f2c9e97df3..cb1a0dbe9b 100644--- a/packages/design-tokens/src/component/color.json+++ b/packages/design-tokens/src/component/color.json@@ -193,6 +193,30 @@}}},+ "switch-thumb-on": {+ "light": {+ "$type": "color",+ "$value": "{semantic.defaults.background.light}",+ "$extensions": {+ "com.cindy.desktop": {+ "cssAlias": "background",+ "wrapper": "hsl",+ "mode": "light"+ }+ }+ },+ "dark": {+ "$type": "color",+ "$value": "{semantic.defaults.background.dark}",+ "$extensions": {+ "com.cindy.desktop": {+ "cssAlias": "background",+ "wrapper": "hsl",+ "mode": "dark"+ }+ }+ }+ },"switch-track-on": {"light": {"$type": "color",diff --git a/packages/design-tokens/src/desktop-bindings.json b/packages/design-tokens/src/desktop-bindings.jsonindex 02a9c5e5b6..132ae7202f 100644--- a/packages/design-tokens/src/desktop-bindings.json+++ b/packages/design-tokens/src/desktop-bindings.json@@ -248,6 +248,10 @@"light": "component.defaults.switch-thumb-off.light","dark": "component.defaults.switch-thumb-off.dark"},+ "switch-thumb-on": {+ "light": "component.defaults.switch-thumb-on.light",+ "dark": "component.defaults.switch-thumb-on.dark"+ },"switch-disabled-opacity": {"light": "semantic.defaults.switch-disabled-opacity.light","dark": "semantic.defaults.switch-disabled-opacity.dark"@@ -2244,6 +2248,8 @@"surface-on-card": "themes.cindy-dark.surface-on-card","switch-track-off": "themes.cindy-dark.switch-track-off","switch-track-on": "themes.cindy-dark.switch-track-on",+ "switch-thumb-on": "themes.cindy-dark.switch-thumb-on",+ "switch-thumb-off": "themes.cindy-dark.switch-thumb-off","status-badge-fg": "themes.cindy-dark.status-badge-fg","border-default": "themes.cindy-dark.border-default","border-default-hsl": "themes.cindy-dark.border-default-hsl",@@ -2417,6 +2423,8 @@"surface-on-card": "themes.cindy-light.surface-on-card","switch-track-off": "themes.cindy-light.switch-track-off","switch-track-on": "themes.cindy-light.switch-track-on",+ "switch-thumb-on": "themes.cindy-light.switch-thumb-on",+ "switch-thumb-off": "themes.cindy-light.switch-thumb-off","status-badge-fg": "themes.cindy-light.status-badge-fg","border-default": "themes.cindy-light.border-default","border-default-hsl": "themes.cindy-light.border-default-hsl",diff --git a/packages/design-tokens/src/reference/themes.json b/packages/design-tokens/src/reference/themes.jsonindex ee934877a2..dfb8141fd4 100644--- a/packages/design-tokens/src/reference/themes.json+++ b/packages/design-tokens/src/reference/themes.json@@ -763,9 +763,27 @@"$value": {"colorSpace": "srgb","components": [- 0.933333,- 0.933333,- 0.933333+ 0.254902,+ 0.486275,+ 0.866667+ ]+ },+ "$extensions": {+ "com.cindy.desktop": {+ "format": "hex",+ "uppercase": true,+ "alpha": false+ }+ }+ },+ "value-switch-thumb-light": {+ "$type": "color",+ "$value": {+ "colorSpace": "srgb",+ "components": [+ 0.988235,+ 0.988235,+ 0.988235]},"$extensions": {@@ -3824,9 +3842,9 @@"$value": {"colorSpace": "srgb","components": [- 0.290196,- 0.301961,- 0.317647+ 0.254902,+ 0.486275,+ 0.866667]},"$extensions": {diff --git a/packages/design-tokens/src/themes/builtin.json b/packages/design-tokens/src/themes/builtin.jsonindex 5a7a911173..86da9d2aef 100644--- a/packages/design-tokens/src/themes/builtin.json+++ b/packages/design-tokens/src/themes/builtin.json@@ -498,7 +498,17 @@"switch-track-on": {"$type": "color","$value": "{reference.themes.cindy-dark.value-switch-track-on}",- "$description": "开启态轨道:值与依据见决策表(用户调参 2026-08-05)"+ "$description": "开启态轨道:蓝色 #417CDD(用户裁决 2026-09-15)"+ },+ "switch-thumb-on": {+ "$type": "color",+ "$value": "{reference.themes.cindy-dark.value-switch-thumb-light}",+ "$description": "Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名"+ },+ "switch-thumb-off": {+ "$type": "color",+ "$value": "{reference.themes.cindy-dark.value-switch-thumb-light}",+ "$description": "Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名"},"status-badge-fg": {"$type": "color",@@ -1326,7 +1336,31 @@"switch-track-on": {"$type": "color","$value": "{reference.themes.cindy-light.value-switch-track-on}",- "$description": "开启态轨道:值与依据见决策表(用户调参 2026-08-05)"+ "$description": "开启态轨道:蓝色 #417CDD(用户裁决 2026-09-15)"+ },+ "switch-thumb-on": {+ "$type": "color",+ "$value": "{reference.themes.cindy-light.value-background}",+ "$description": "Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名",+ "$extensions": {+ "com.cindy.desktop": {+ "cssAlias": "background",+ "wrapper": "hsl",+ "mode": "light"+ }+ }+ },+ "switch-thumb-off": {+ "$type": "color",+ "$value": "{reference.themes.cindy-light.value-surface-on-card}",+ "$description": "Switch 滑块:用户批准 HTML 效果 2026-09-16;暗色近白,浅色沿用原有别名",+ "$extensions": {+ "com.cindy.desktop": {+ "cssAlias": "surface-on-card",+ "wrapper": "var",+ "mode": "light"+ }+ }},"status-badge-fg": {"$type": "color",