Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 73 additions & 33 deletions docs/goxf-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

## 1. 字号(7 档 + 1 个例外)

写法统一用 `text-[Npx]`(与现有代码一致,脚本好查)。`text-ui` = 14px / 行高 22px,
`text-caption` = 12px / 行高 16px,两个 token 可以继续用,等同 14 / 12 档
写法统一用 `text-[Npx]`(与现有代码一致,脚本好查)。`text-ui` = 14px / 行高 20px(BoardUI body 14/20),
`text-caption` = 12px / 行高 16px、字距 0.15px,两个 token 可以继续用,等同 14 / 12 档
(注意 globals.css 注释写的是 13/11,实际值是 14/12,以值为准)。

| 档 | 用途 | 现有出处 |
Expand Down Expand Up @@ -51,25 +51,30 @@

### 3.1 中性色

2026-12-03 起换成 BoardUI 免费版(MIT)的值。浅色:页底白、浮面板 #f7f7f7、卡片和控件白。

| token(类名前缀 bg-/text-/border-) | 浅色 | 深色 | 用途 |
|---|---|---|---|
| `canvas` | #f5f5f5 | #0e0e0e | 窗口底 |
| `main` | #ffffff | #161616 | 主内容区、菜单/弹窗面 |
| `surface` | #ffffff | #1f1f1f | 卡片 |
| `surface-hover` | ink 6% | 6% | 卡片悬停 |
| `bubble` | ink 6% | 6% | 对方气泡 |
| `bubble-user` | #1c1c1c | #f5f5f5 | 自己的气泡 |
| `hover` | ink 6% | 6% | 悬停底、次要按钮底、分段控件槽 |
| `active` | ink 9% | 10% | 按下 / 选中底 |
| `sunken` | ink 4% | 5% | 凹陷区、计数胶囊底 |
| `line` | ink 8% | 8% | 分隔线、卡片边 |
| `line-strong` | ink 14% | 14% | 输入框边、菜单/弹窗 0.5px 边 |
| `ink` | #1c1c1c | #f5f5f5 | 主文字 |
| `ink-secondary` | ink 68% | 68% | 次级文字、ghost 按钮 |
| `ink-muted` | ink 52% | 50% | 说明文字、占位符 |
| `ink-faint` | ink 34% | 32% | 禁用感文字、极弱提示 |

(浅色 ink = rgb(28 28 28),深色 = rgb(245 245 245)。)
| `canvas` | #ffffff | #121212 | 窗口底(页底) |
| `main` | #f7f7f7 | #171717 | 主内容区、侧栏等浮面板、弹窗面 |
| `surface` | #ffffff | #262626 | 卡片、控件、菜单面 |
| `surface-hover` | #f7f7f7 | neutral-700 60% | 白面上的悬停(菜单项、白底按钮) |
| `hover` | #ebebeb | neutral-700 60% | `main` 上的行悬停、次要底、分段控件槽 |
| `hover-on-main` | #ebebeb | #262626 | 同 `hover`,显式写在 `main` 上的场景(新增) |
| `active` | #ebebeb | #262626 | 按下 / 选中底(Bot 列表选中用灰,不用蓝) |
| `sunken` | #ebebeb | #262626 | 输入框填充、计数胶囊底 |
| `bubble` / `bubble-user` | 不变 | 不变 | 气泡(PR C 再换) |
| `line` | #ebebeb | #262626 | 分隔线、卡片边 |
| `line-strong` | #ebebeb | #404040 | 控件 1px 边、菜单/弹窗边 |
| `line-hover` | #d4d4d4 | #737373 | 控件描边悬停、输入框悬停 inset ring(新增) |
| `line-active` | #a1a1a1 | #525252 | 控件按下、输入框聚焦 inset ring(新增) |
| `ink` | #0a0a0a | #fafafa | 主文字 |
| `ink-secondary` | #525252 | #a1a1a1 | 次级文字 |
| `ink-muted` | #737373 | #737373 | 说明文字、图标 |
| `ink-faint` | #a1a1a1 | #525252 | 占位符、极弱提示(不过 3:1,不能放正文) |
| `ink-disabled` | #d4d4d4 | #404040 | 禁用文字(替代 opacity,新增) |

浅色在 `main` 上 `hover` 与 `surface-hover` 不同:`main` 是 #f7f7f7,所以 `main` 上的悬停用 #ebebeb,白面上的悬停用 `surface-hover`。

### 3.2 强调色(accent)

Expand All @@ -80,9 +85,9 @@
| `accent-200` | #bfdbfe | / .35 |
| `accent-300` | #93c5fd | / .50 |
| `accent-400` | #4d9bff | 同浅色 |
| `accent-500` | #1e86fc | 同浅色 |
| `accent-600` | #1680f3 | 同浅色(主按钮、焦点环) |
| `accent-700` | #126fd4 | 同浅色(主按钮悬停) |
| `accent-500` | #1e86fc | 同浅色(焦点环 2px offset 2) |
| `accent-600` | #1680f3 | 同浅色 |
| `accent-700` | #126fd4 | 同浅色(主按钮渐变终点) |

一屏只有一个 `primary` 按钮。浅底上的强调字用 `accent-700`,深色模式下改 `dark:text-accent-400`。

Expand Down Expand Up @@ -112,17 +117,52 @@

## 4. 阴影

| token | 用途 |
|---|---|
| `shadow-hairline` | 平铺面的 1px 描边感(无边框时) |
| `shadow-soft` | 卡片、输入框、设置分组卡(默认) |
| `shadow-card` | 可点的浮起卡片 |
| `shadow-float` | 分段控件滑块、悬浮小块 |
| `shadow-pop` | 菜单、下拉、弹出层 |
| `shadow-toast` | Toast |
| `shadow-dialog` | 弹窗 |

`shadow-xs/sm/2xs` 及自写阴影一律当 `shadow-soft`。深色模式下各阴影已在 globals.css 重定义,不要加 `dark:shadow-*`。
BoardUI 配方(2026-12-03)。深色模式下各阴影已在 globals.css 重定义,不要加 `dark:shadow-*`。

| token | 值(浅色) | 用途 |
|---|---|---|
| `shadow-hairline` | 0 1px 0 /.05(BoardUI 2xs) | 分段控件滑块 |
| `shadow-soft` | 0 1px 2px /.05(BoardUI xs) | 白底按钮、选择器、卡片(默认) |
| `shadow-card` | 0 1px 1px /.05 | 可点的浮起卡片 |
| `shadow-float` | 0 1px 12px /.06 + 0 0 1px /.32 + 0 1px 0 /.02 | 浮面板、悬浮小块 |
| `shadow-pop` | 0 1px 1px /.04 + 0 4px 4px /.02,配 1px `line-strong` 边 | 菜单、下拉、弹出层 |
| `shadow-toast` | 同 float 配方 | Toast |
| `shadow-dialog` | BoardUI waitlist 配方(5 层) | 弹窗(遮罩 40%) |
| `shadow-primary` | 0 1px 2px /.05 | 主按钮(新增) |
| `shadow-nav-selected` | 1px accent-500 + 内 1px 白 25% | 顶部导航选中(新增) |
| `shadow-control-selected` | 内 2px 白 25% + 内 1px accent-500 | 复选类开态(新增;开关保留绿色,不用) |
| `inset-shadow-2xs/xs/sm` | inset 0 1px 0 / 0 1px 1px / 0 2px 4px,/.05 | 凹陷感(新增) |

`shadow-xs/sm` 及自写阴影一律当 `shadow-soft`,`shadow-2xs` 当 `shadow-hairline`。

## 4.1 渐变

180° 竖向渐变,工具类 `bg-gradient-primary` / `bg-gradient-danger` 自带悬停、按下、禁用态;`bg-gradient-nav-selected` 带 `shadow-nav-selected`。

| token | 值 | 用途 |
|---|---|---|
| `--gradient-primary` | #1e86fc → #126fd4 | 主按钮、发送键 |
| `--gradient-primary-hover` | #4d9bff → #1e86fc | 悬停 |
| `--gradient-primary-active` | #1680f3 → #126fd4 | 按下 |
| `--gradient-primary-disabled` | #ebebeb → #d4d4d4(深 #404040 → #262626),字 `ink-faint` | 禁用主按钮 / 危险按钮 |
| `--gradient-danger(-hover/-active)` | #fb2c36 → #e7000b(悬停 #ff6467 → #fb2c36,按下 #e7000b → #c10007) | `danger-confirm` |
| `--gradient-nav-selected` | = primary | 只给顶部导航选中;Bot 列表选中用灰 `active` |

goxf 蓝 500/600 太接近,所以各态跳一档。

## 4.2 动效

| token | 值 | 用途 |
|---|---|---|
| `--duration-color` | 150ms ease | 颜色、边框、阴影过渡 |
| `--duration-control` | 200ms ease | 分段滑块、开关、选择器 |
| `--duration-press` + `--ease-standard` | 220ms cubic-bezier(.4,0,.2,1) | `press` / `press-icon`,按下 scale .98 |
| `--duration-menu` | 150ms ease-out,scale .95 + blur 2px | 菜单、下拉(`animate-pop-*`) |
| `--duration-dialog` + `--ease-dialog` | 300ms cubic-bezier(.32,.72,0,1),scale .85 + blur 4px | 弹窗(`animate-dialog-rise`),遮罩 300ms |
| `--ease-check` | cubic-bezier(.65,0,.35,1) | 完成勾 |
| `shimmer-text` | 背景 200% → -100% | 「思考中」文字 |

退出动画保留原时长(菜单 120ms、弹窗 160ms),只换形状,避免影响卸载时机。

## 5. 组件

Expand Down
5 changes: 3 additions & 2 deletions scripts/goxf-design-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const ALLOWED_RADIUS = new Set(['none', 'sm', 'md', 'lg', 'xl', '2xl', 'f
* check so someone decides whether it maps to a token.
*/
export const ALLOWED_RADIUS_ARBITRARY = new Set(['3px', '4px', '9px', '10px', '11px', '12px', '14px', '18px', '20px', '22px'])
export const ALLOWED_SHADOW = new Set(['soft', 'float', 'hairline', 'card', 'pop', 'toast', 'dialog', 'none'])
export const ALLOWED_SHADOW = new Set(['soft', 'float', 'hairline', 'card', 'pop', 'toast', 'dialog', 'none', 'primary', 'nav-selected', 'control-selected'])
/** Neutral palette colors tolerated anywhere (media overlays, on-dark text). */
export const ALLOWED_PALETTE = new Set(['black', 'white'])
/** Individually reviewed exceptions (exact class, any variant). */
Expand Down Expand Up @@ -79,9 +79,10 @@ export const MAPPING = {
rounded: radius('md'),
'rounded-3xl': radius('2xl'),
'rounded-xs': radius('sm'),
'rounded-[10px]': radius('xl'), // BoardUI 2lg(10) -> xl(12), user 2026-12-03
// shadows (only --tw-shadow is swapped, so rings etc. still compose)
shadow: SOFT,
'shadow-2xs': SOFT,
'shadow-2xs': { '--tw-shadow': 'var(--shadow-hairline)' }, // BoardUI shadow-2xs
'shadow-xs': SOFT,
'shadow-sm': SOFT,
// palette colors -> status tokens
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/ui/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function AccountAvatar({
<span
aria-hidden
className={cn(
'grid place-items-center rounded-full bg-sunken font-semibold tracking-wide text-ink-secondary ring-1 ring-line select-none',
'grid place-items-center rounded-full bg-line-hover font-semibold tracking-wide text-ink-secondary select-none dark:bg-active',
ACCOUNT_SIZES[size]
)}
>
Expand Down
10 changes: 5 additions & 5 deletions src/renderer/src/components/ui/BotAvatarEditorDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function BotAvatarEditorDialog({ bot, open, onOpenChange }: BotAvatarEdit

return (
<Dialog open={open} onOpenChange={changeOpen} title={t('Bot appearance')} className="max-w-[360px]">
<div className="mb-3 flex rounded-lg bg-hover p-0.5 text-[12px]" role="tablist">
<div className="mb-3 flex rounded-xl bg-hover p-0.5 text-[12px]" role="tablist">
<button
type="button"
role="tab"
Expand All @@ -143,8 +143,8 @@ export function BotAvatarEditorDialog({ bot, open, onOpenChange }: BotAvatarEdit
setTab('bot')
}}
className={cn(
'flex-1 rounded-md py-1 font-medium transition-colors',
tab === 'bot' ? 'bg-surface text-ink shadow-soft' : 'text-ink-secondary hover:text-ink'
'flex-1 rounded-lg py-1 transition-colors duration-200',
tab === 'bot' ? 'bg-surface font-medium text-ink shadow-hairline' : 'text-ink-muted hover:text-ink'
)}
>
Bot
Expand All @@ -155,8 +155,8 @@ export function BotAvatarEditorDialog({ bot, open, onOpenChange }: BotAvatarEdit
aria-selected={tab === 'upload'}
onClick={() => setTab('upload')}
className={cn(
'flex-1 rounded-md py-1 font-medium transition-colors',
tab === 'upload' ? 'bg-surface text-ink shadow-soft' : 'text-ink-secondary hover:text-ink'
'flex-1 rounded-lg py-1 transition-colors duration-200',
tab === 'upload' ? 'bg-surface font-medium text-ink shadow-hairline' : 'text-ink-muted hover:text-ink'
)}
>
{t('Photo')}
Expand Down
25 changes: 13 additions & 12 deletions src/renderer/src/components/ui/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import { cn } from '@/lib/cn'

const VARIANTS = {
/** One per surface: send, create, save. */
primary: 'bg-accent-600 text-white hover:bg-accent-700 disabled:opacity-35',
/** Soft pill on the hover tint — every other action. */
secondary: 'bg-hover text-ink hover:bg-active disabled:opacity-35',
ghost: 'text-ink-secondary hover:bg-hover hover:text-ink disabled:opacity-35',
danger: 'text-status-error hover:bg-status-error/10 disabled:opacity-35',
/** Destructive action waiting for a second click. */
'danger-confirm': 'bg-status-error/10 text-status-error hover:bg-status-error/15'
primary: 'bg-gradient-primary text-white shadow-primary disabled:text-ink-faint disabled:shadow-none',
/** White, 1px line, xs shadow (BoardUI secondary) — every other action. */
secondary:
'border border-line-strong bg-surface text-ink shadow-soft hover:border-line-hover hover:bg-surface-hover active:border-line-active disabled:text-ink-disabled disabled:shadow-none',
ghost: 'text-ink-secondary hover:bg-hover hover:text-ink disabled:text-ink-disabled',
danger: 'text-status-error hover:bg-status-error/10 disabled:text-ink-disabled',
/** Destructive action waiting for a second click (BoardUI danger: solid red gradient). */
'danger-confirm': 'bg-gradient-danger text-white shadow-primary disabled:text-ink-faint disabled:shadow-none'
} as const

const SIZES = {
sm: 'h-7 gap-1.5 px-3 text-[12px] [&_svg]:size-3.5',
md: 'h-9 gap-2 px-4 text-[14px] [&_svg]:size-4',
lg: 'h-10 gap-2 px-5 text-[14px] [&_svg]:size-4'
sm: 'h-7 gap-1 rounded-lg px-2.5 text-[12px] [&_svg]:size-3.5',
md: 'h-9 gap-1.5 rounded-xl px-3 text-[14px] [&_svg]:size-4',
lg: 'h-10 gap-2 rounded-xl px-4 text-[14px] [&_svg]:size-4'
} as const

export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
Expand All @@ -24,7 +25,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
ref?: Ref<HTMLButtonElement>
}

/** Pill-shaped button; presses on the tap spring. */
/** BoardUI-style button (rounded-lg/xl, gradient primary); presses to .98. */
export function Button({
variant = 'secondary',
size = 'md',
Expand All @@ -36,7 +37,7 @@ export function Button({
<button
type={type}
className={cn(
'no-drag press inline-flex shrink-0 items-center justify-center rounded-full font-medium whitespace-nowrap disabled:pointer-events-none',
'no-drag press inline-flex shrink-0 items-center justify-center font-medium whitespace-nowrap disabled:pointer-events-none',
VARIANTS[variant],
SIZES[size],
className
Expand Down
25 changes: 13 additions & 12 deletions src/renderer/src/components/ui/Controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface SwitchPillProps {
}

/**
* Tactile spring-animated toggle switch (Grok Bot Sand style).
* Toggle switch, BoardUI proportions (200ms ease); on-state keeps the goxf green.
*/
export function SwitchPill({
checked,
Expand All @@ -31,18 +31,19 @@ export function SwitchPill({
disabled={disabled}
onClick={() => onCheckedChange(!checked)}
className={cn(
'no-drag press relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-colors duration-150 outline-none',
'focus-visible:ring-2 focus-visible:ring-accent-400 focus-visible:ring-offset-1',
'no-drag press relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-colors duration-200 outline-none',
'focus-visible:ring-2 focus-visible:ring-accent-500 focus-visible:ring-offset-2',
'disabled:pointer-events-none disabled:opacity-40',
sm ? 'h-[20px] w-[34px] p-[2px]' : 'h-[24px] w-[42px] p-[2px]',
checked ? 'bg-status-online' : 'bg-ink/16 hover:bg-ink/22',
sm ? 'h-5 w-[34px] p-0.5' : 'h-6 w-[42px] p-0.5',
/* GOXF: on-state stays green (user 2026-12-03); off-state is BoardUI #ebebeb. */
checked ? 'bg-status-online' : 'bg-active hover:bg-line-hover',
className
)}
>
<span
aria-hidden
className={cn(
'pointer-events-none block rounded-full bg-white shadow-soft transition-transform duration-[290ms] ease-spring-tap',
'pointer-events-none block rounded-full bg-white shadow-soft transition-transform duration-200 ease-standard',
sm ? 'size-4' : 'size-5',
checked ? (sm ? 'translate-x-[14px]' : 'translate-x-[18px]') : 'translate-x-0'
)}
Expand Down Expand Up @@ -86,14 +87,14 @@ export function NumberStepper({
<div
role="group"
aria-label={ariaLabel}
className="inline-flex h-8 items-center rounded-full border-[0.5px] border-line-strong bg-surface p-0.5 shadow-soft"
className="inline-flex h-8 items-center rounded-xl bg-sunken p-0.5"
>
<button
type="button"
aria-label="Decrease"
disabled={disabled || value <= min}
onClick={() => onChange(clamp(value - step))}
className="press-icon grid size-7 place-items-center rounded-full text-ink-secondary hover:bg-hover hover:text-ink disabled:pointer-events-none disabled:opacity-30"
className="press-icon grid size-7 place-items-center rounded-md text-ink-muted hover:bg-line-hover hover:text-ink disabled:pointer-events-none disabled:text-ink-disabled"
>
<Minus className="size-3.5" />
</button>
Expand All @@ -106,7 +107,7 @@ export function NumberStepper({
aria-label="Increase"
disabled={disabled || value >= max}
onClick={() => onChange(clamp(value + step))}
className="press-icon grid size-7 place-items-center rounded-full text-ink-secondary hover:bg-hover hover:text-ink disabled:pointer-events-none disabled:opacity-30"
className="press-icon grid size-7 place-items-center rounded-md text-ink-muted hover:bg-line-hover hover:text-ink disabled:pointer-events-none disabled:text-ink-disabled"
>
<Plus className="size-3.5" />
</button>
Expand All @@ -123,10 +124,10 @@ export function NumberStepper({
disabled={disabled}
onClick={() => onChange(clamp(p))}
className={cn(
'press h-7 rounded-full px-2.5 text-[12px] font-medium tabular-nums transition-colors',
'press h-7 rounded-lg px-2.5 text-[12px] font-medium tabular-nums transition-colors',
active
? 'bg-accent-600 text-white shadow-soft'
: 'bg-hover text-ink-secondary hover:bg-active hover:text-ink'
? 'bg-accent-100 text-accent-700 dark:text-accent-400'
: 'border border-line-strong bg-surface text-ink-secondary shadow-soft hover:border-line-hover hover:text-ink'
)}
>
{p}
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/components/ui/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface DialogProps {
}

/**
* Centered modal. Rises on the shape spring and sinks out in .16s; Radix keeps
* Centered modal (BoardUI: white, 1px line, 40% scrim). Scales in from .85 with a blur (300ms) and sinks out in .16s; Radix keeps
* it mounted until the exit animation ends. Esc, the scrim and the close
* button all dismiss it.
*/
Expand All @@ -46,13 +46,13 @@ export function Dialog({
return (
<RadixDialog.Root open={open} onOpenChange={onOpenChange}>
<RadixDialog.Portal>
<RadixDialog.Overlay className="no-drag fixed inset-0 z-40 bg-black/25 data-[state=closed]:animate-scrim-out data-[state=open]:animate-scrim-in" />
<RadixDialog.Overlay className="no-drag fixed inset-0 z-40 bg-black/40 data-[state=closed]:animate-scrim-out data-[state=open]:animate-scrim-in" />
<RadixDialog.Content
onOpenAutoFocus={onOpenAutoFocus}
onCloseAutoFocus={onCloseAutoFocus}
className={cn(
'no-drag fixed top-1/2 left-1/2 z-50 flex max-h-[min(88vh,760px)] w-[min(92vw,560px)] -translate-x-1/2 -translate-y-1/2 flex-col',
'rounded-2xl border-[0.5px] border-line-strong bg-main shadow-dialog outline-none',
'rounded-2xl border border-line bg-canvas shadow-dialog outline-none',
'data-[state=closed]:animate-dialog-sink data-[state=open]:animate-dialog-rise',
className
)}
Expand Down
Loading