diff --git a/docs/goxf-design.md b/docs/goxf-design.md index 5f280823..6234672a 100644 --- a/docs/goxf-design.md +++ b/docs/goxf-design.md @@ -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,以值为准)。 | 档 | 用途 | 现有出处 | @@ -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) @@ -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`。 @@ -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. 组件 diff --git a/scripts/goxf-design-check.mjs b/scripts/goxf-design-check.mjs index 678dd7ab..608f5d30 100644 --- a/scripts/goxf-design-check.mjs +++ b/scripts/goxf-design-check.mjs @@ -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). */ @@ -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 diff --git a/src/renderer/src/components/ui/Avatar.tsx b/src/renderer/src/components/ui/Avatar.tsx index 323f1501..306a3096 100644 --- a/src/renderer/src/components/ui/Avatar.tsx +++ b/src/renderer/src/components/ui/Avatar.tsx @@ -131,7 +131,7 @@ export function AccountAvatar({ diff --git a/src/renderer/src/components/ui/BotAvatarEditorDialog.tsx b/src/renderer/src/components/ui/BotAvatarEditorDialog.tsx index b315b219..b669acd5 100644 --- a/src/renderer/src/components/ui/BotAvatarEditorDialog.tsx +++ b/src/renderer/src/components/ui/BotAvatarEditorDialog.tsx @@ -133,7 +133,7 @@ export function BotAvatarEditorDialog({ bot, open, onOpenChange }: BotAvatarEdit return ( -
+
@@ -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" > @@ -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} diff --git a/src/renderer/src/components/ui/Dialog.tsx b/src/renderer/src/components/ui/Dialog.tsx index c2ae20fa..3f4c674b 100644 --- a/src/renderer/src/components/ui/Dialog.tsx +++ b/src/renderer/src/components/ui/Dialog.tsx @@ -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. */ @@ -46,13 +46,13 @@ export function Dialog({ return ( - + -
+
@@ -56,18 +57,14 @@ export class ErrorBoundary extends Component
- + {!this.props.surface && ( - + )}
diff --git a/src/renderer/src/components/ui/Field.tsx b/src/renderer/src/components/ui/Field.tsx index 57eeec84..4dbe30f1 100644 --- a/src/renderer/src/components/ui/Field.tsx +++ b/src/renderer/src/components/ui/Field.tsx @@ -38,9 +38,11 @@ export function TextInput({ className, invalid, ...props }: TextInputProps) { shortcut?: string active?: boolean size?: 'sm' | 'md' - /** 36px circle with a hairline border (sidebar header actions). */ + /** 36px white tile with a 1px line + xs shadow (BoardUI icon-button). */ round?: boolean ref?: Ref } @@ -31,14 +31,14 @@ export function IconButton({ title={shortcut ? `${label} (${shortcut})` : label} aria-pressed={active || undefined} className={cn( - 'no-drag press-icon inline-flex shrink-0 items-center justify-center rounded-full text-ink-secondary', - 'hover:bg-hover hover:text-ink disabled:pointer-events-none disabled:opacity-35', + 'no-drag press-icon inline-flex shrink-0 items-center justify-center text-ink-muted', + 'hover:bg-hover hover:text-ink-secondary disabled:pointer-events-none disabled:opacity-60', round - ? 'size-9 border border-line bg-main text-ink [&_svg]:size-[18px]' + ? 'size-9 rounded-xl border border-line-strong bg-surface text-ink shadow-soft hover:border-line-hover hover:bg-surface-hover hover:text-ink [&_svg]:size-[18px]' : size === 'sm' - ? 'size-7 [&_svg]:size-4' - : 'size-8 [&_svg]:size-[18px]', - active && 'bg-active text-ink hover:bg-active', + ? 'size-7 rounded-md [&_svg]:size-4' + : 'size-8 rounded-lg [&_svg]:size-[18px]', + active && 'bg-active text-ink hover:bg-active hover:text-ink', className )} {...props} diff --git a/src/renderer/src/components/ui/InlineEdit.tsx b/src/renderer/src/components/ui/InlineEdit.tsx index c32840b7..1587fbc0 100644 --- a/src/renderer/src/components/ui/InlineEdit.tsx +++ b/src/renderer/src/components/ui/InlineEdit.tsx @@ -46,7 +46,7 @@ export function InlineEdit({ value, onCommit, onDone, label, maxLength = 40, cla } }} className={cn( - 'h-7 w-full min-w-0 rounded-md border border-accent-600 bg-surface px-1.5 text-ink ring-3 ring-accent-100 outline-none', + 'h-7 w-full min-w-0 rounded-lg bg-sunken px-1.5 text-ink ring-2 ring-line-active ring-inset outline-none', className )} /> diff --git a/src/renderer/src/components/ui/Menu.tsx b/src/renderer/src/components/ui/Menu.tsx index c2b8b197..c05deb3c 100644 --- a/src/renderer/src/components/ui/Menu.tsx +++ b/src/renderer/src/components/ui/Menu.tsx @@ -5,7 +5,7 @@ import { useOverlayLock } from '@/lib/overlay' /** * Thin styling layer over Radix DropdownMenu: arrow keys, typeahead and Esc - * come from Radix; menus pop in on the tap spring and fade out in .12s. + * come from Radix; menus scale in from .95 with a 2px blur (150ms) and fade out in .12s. */ export function Menu({ onOpenChange, open: openProp, ...props }: ComponentProps) { const [openState, setOpenState] = useState(false) @@ -25,7 +25,7 @@ export function Menu({ onOpenChange, open: openProp, ...props }: ComponentProps< export const MenuTrigger = DropdownMenu.Trigger export const MENU_SURFACE = - 'rounded-xl border-[0.5px] border-line-strong bg-main p-1.5 shadow-pop outline-none' + 'rounded-2xl border border-line-strong bg-surface p-2 shadow-pop outline-none' export function MenuContent({ className, sideOffset = 6, ...props }: ComponentProps) { return ( @@ -54,8 +54,8 @@ export function MenuItem({ return ( ) { return ( ) } export function MenuSeparator({ className, ...props }: ComponentProps) { - return + return } diff --git a/src/renderer/src/components/ui/PlatformGlyph.tsx b/src/renderer/src/components/ui/PlatformGlyph.tsx index 22bfd47f..f67e7855 100644 --- a/src/renderer/src/components/ui/PlatformGlyph.tsx +++ b/src/renderer/src/components/ui/PlatformGlyph.tsx @@ -10,7 +10,7 @@ interface PlatformGlyphProps { const SIZES = { sm: 'size-5 rounded-md text-[10px]', - md: 'size-9 rounded-[10px] text-sm', + md: 'size-9 rounded-xl text-sm', lg: 'size-14 rounded-2xl text-lg' } as const diff --git a/src/renderer/src/components/ui/SegmentedControl.tsx b/src/renderer/src/components/ui/SegmentedControl.tsx index dbedd1cf..a7b9ac67 100644 --- a/src/renderer/src/components/ui/SegmentedControl.tsx +++ b/src/renderer/src/components/ui/SegmentedControl.tsx @@ -49,7 +49,7 @@ export function SegmentedControl({ role="tablist" aria-label={ariaLabel} className={cn( - 'no-drag relative inline-flex items-center rounded-[11px] bg-hover p-0.5 select-none', + 'no-drag relative inline-flex items-center rounded-xl bg-hover p-0.5 select-none', pill && 'rounded-full', fullWidth && 'flex w-full', className @@ -72,7 +72,7 @@ export function SegmentedControl({ {glide.thumb && ( )} @@ -89,12 +89,12 @@ export function SegmentedControl({ tabIndex={active ? 0 : -1} onClick={() => onValueChange(opt.value)} className={cn( - 'press relative inline-flex min-w-0 items-center justify-center rounded-[9px] font-medium tracking-tight whitespace-nowrap transition-colors outline-none', - 'disabled:pointer-events-none disabled:opacity-35', + 'press relative inline-flex min-w-0 items-center justify-center rounded-lg tracking-tight whitespace-nowrap transition-colors duration-200 outline-none', + 'disabled:pointer-events-none disabled:text-ink-disabled', fullWidth && 'flex-1', pill && 'rounded-full', ITEM_SIZES[size], - active ? 'text-ink' : 'text-ink-secondary hover:text-ink' + active ? 'font-medium text-ink' : 'text-ink-muted hover:text-ink' )} > {opt.icon && {opt.icon}} diff --git a/src/renderer/src/components/ui/Select.tsx b/src/renderer/src/components/ui/Select.tsx index 33d31211..269ab42f 100644 --- a/src/renderer/src/components/ui/Select.tsx +++ b/src/renderer/src/components/ui/Select.tsx @@ -35,10 +35,10 @@ export interface SelectProps { } const TRIGGER_VARIANTS = { - pill: 'rounded-full border-[0.5px] border-line-strong bg-surface text-ink shadow-soft hover:bg-hover data-[state=open]:bg-hover', + pill: 'rounded-full border border-line-strong bg-surface text-ink shadow-soft hover:border-line-hover hover:bg-surface-hover data-[state=open]:border-line-active', field: - 'w-full rounded-lg border border-line-strong bg-surface text-ink shadow-soft hover:border-ink/20 data-[state=open]:border-accent-300 data-[state=open]:ring-3 data-[state=open]:ring-accent-100', - ghost: 'rounded-full bg-transparent text-ink-secondary hover:bg-hover hover:text-ink data-[state=open]:bg-hover data-[state=open]:text-ink' + 'w-full rounded-xl border border-line-strong bg-surface text-ink shadow-soft hover:border-line-hover hover:bg-surface-hover data-[state=open]:border-line-active', + ghost: 'rounded-lg bg-transparent text-ink-secondary hover:bg-hover hover:text-ink data-[state=open]:bg-hover data-[state=open]:text-ink' } as const const TRIGGER_SIZES = { @@ -85,7 +85,7 @@ export function Select({ title={title ?? selected?.label} className={cn( 'no-drag group press inline-flex min-w-0 items-center justify-between font-medium outline-none select-none', - 'disabled:pointer-events-none disabled:opacity-40', + 'disabled:pointer-events-none disabled:text-ink-disabled disabled:shadow-none', TRIGGER_VARIANTS[variant], TRIGGER_SIZES[size], className @@ -104,7 +104,7 @@ export function Select({ @@ -130,9 +130,9 @@ export function Select({ disabled={opt.disabled} onSelect={() => onValueChange(opt.value)} className={cn( - 'flex min-h-[30px] cursor-default items-center gap-2 rounded-lg px-2.5 py-1.5 text-[12.5px] leading-[18px] text-ink outline-none select-none', - 'transition-colors duration-100 data-[disabled]:opacity-35 data-[highlighted]:bg-hover', - active && 'bg-accent-50/70 font-medium text-ink' + 'flex min-h-8 cursor-default items-center gap-2 rounded-lg p-2 text-[13px] leading-[18px] text-ink outline-none select-none', + 'transition-colors duration-150 data-[disabled]:text-ink-disabled data-[highlighted]:bg-surface-hover', + active && 'bg-surface-hover font-medium text-ink' )} > {opt.icon && ( diff --git a/src/renderer/src/components/ui/Status.tsx b/src/renderer/src/components/ui/Status.tsx index 4f3cc5d9..29beeb3e 100644 --- a/src/renderer/src/components/ui/Status.tsx +++ b/src/renderer/src/components/ui/Status.tsx @@ -52,7 +52,7 @@ export function StatusBadge({ status, label, className }: StatusBadgeProps) { return ( + ({ botId, name, accountId: `acc-${botId}`, platform: 'meta-muse', cursor: 0 } as RoomMember) +const MEMBERS = [member('a', 'Claude'), member('b', 'GPT'), member('c', 'Hark')] +const at = new Date(2026, 11, 3, 17, 40).getTime() +const MESSAGES: RoomMessage[] = [ + { id: 'h1', author: 'User', text: '@Claude 本地存储用 SQLite 还是 IndexedDB?给结论和理由。', createdAt: at }, + { id: 'r1', author: 'Claude', authorBotId: 'a', createdAt: at + 60_000, + text: '结论:用 SQLite(better-sqlite3,放主进程)。\n\n1. 群聊消息量大,要按群、按时间查,SQL 索引更省事;\n2. 主进程统一读写,多窗口不会互相覆盖;\n3. 备份就是拷一个文件。' }, + { id: 'h2', author: 'User', text: '@GPT 评审一下,有没有坑?', createdAt: at + 120_000 }, + { id: 'r2', author: 'GPT', authorBotId: 'b', createdAt: at + 180_000, + text: '两个坑:原生模块要按 Electron 版本重编;便携版要把数据库放在 BotArkData 里,别写进程序目录。' } +] +const roomFor = (id: string): CollabRoom => + ({ id, title: '架构评审', mode: 'manual', limit: 8, brief: '', members: MEMBERS, messages: MESSAGES } as unknown as CollabRoom) + +const IDS = ['mock-v34-before', 'mock-v34-after'] +useRooms.setState((s) => ({ + rooms: [...IDS.map(roomFor), ...s.rooms.filter((r) => !IDS.includes(r.id))], +})) +useBotStore.setState({ infoPanelOpen: false }) + +function Frame({ id, skin }: { id: string; skin?: boolean }) { + useEffect(() => { + const t = setTimeout(() => setRoomDraft(id, '@Hark 汇总一下两位的意见,给最终方案'), 50) + return () => clearTimeout(t) + }, [id]) + return ( +
+
+ +
+
+ ) +} + +export const V34ReskinBeforeMock = () => +export const V34ReskinAfterMock = () => diff --git a/src/renderer/src/mock/mocks/v35-free-parts.css b/src/renderer/src/mock/mocks/v35-free-parts.css new file mode 100644 index 00000000..bd93397a --- /dev/null +++ b/src/renderer/src/mock/mocks/v35-free-parts.css @@ -0,0 +1,49 @@ +/* + * v35 效果图:BoardUI 免费件(MIT)按 goxf 档位重写后的样式。 + * 动效节奏取自 BoardUI styles/globals.css(Copyright 2026 BoardUI,MIT)。 + * 开工后搬进 goxf-scale.css;新增 token 在这里先定义。 + */ +:root { + --color-glow-1: #5eead4; + --color-glow-2: #46baec; + --color-glow-3: #e633a4; + --color-glow-4: #00faa7; +} + +@keyframes goxf-thinking-shimmer { + from { background-position: 200% center; } + to { background-position: -100% center; } +} +.goxf-thinking-label { + color: transparent; + background-image: linear-gradient(100deg, + color-mix(in oklab, var(--goxf-thinking-tone) 55%, transparent) 30%, + var(--goxf-thinking-tone) 50%, + color-mix(in oklab, var(--goxf-thinking-tone) 55%, transparent) 70%); + background-position: 200% center; + background-size: 300% 100%; + background-clip: text; + -webkit-background-clip: text; + animation: goxf-thinking-shimmer 2.6s linear infinite; +} +@keyframes goxf-thinking-star { + 0%, 100% { transform: scale(0); opacity: 0; } + 40% { transform: scale(1); opacity: 1; } + 60% { transform: scale(0.8); opacity: 0.9; } +} +.goxf-thinking-star { + animation-name: goxf-thinking-star; + animation-timing-function: ease-in-out; + animation-iteration-count: infinite; +} +@keyframes goxf-dash { to { stroke-dashoffset: -100; } } +.goxf-thinking-comet, +.goxf-loader-rect { + animation-name: goxf-dash; + animation-timing-function: linear; + animation-iteration-count: infinite; +} +@media (prefers-reduced-motion: reduce) { + .goxf-thinking-label { color: var(--goxf-thinking-tone); background-image: none; animation: none; } + .goxf-thinking-star, .goxf-thinking-comet, .goxf-loader-rect { animation: none; } +} diff --git a/src/renderer/src/mock/mocks/v35-free-parts.tsx b/src/renderer/src/mock/mocks/v35-free-parts.tsx new file mode 100644 index 00000000..6b02425d --- /dev/null +++ b/src/renderer/src/mock/mocks/v35-free-parts.tsx @@ -0,0 +1,335 @@ +/* + * v35 效果图:BoardUI 免费件按 goxf 档位重写(字号 7 档、圆角 5 档、颜色只用 token)。 + * 参考 BoardUI(https://github.com/BoardUI/boardui,MIT,Copyright 2026 BoardUI)的 + * agent-thinking、composer-loader、token-input、notification-center;开工后拆成正式组件。 + */ +import './v35-free-parts.css' +import { useEffect, useId, useRef, useState, type CSSProperties, type ReactNode } from 'react' +import { ArrowUp, AtSign, Bell, CheckCircle2, FileText, Info, Plus, Sparkles, Square, XCircle } from 'lucide-react' +import { BotAvatar } from '@/components/ui/Avatar' +import { Button } from '@/components/ui/Button' +import { IconButton } from '@/components/ui/IconButton' +import { MENU_SURFACE } from '@/components/ui/Menu' +import { SegmentedControl } from '@/components/ui/SegmentedControl' +import { cn } from '@/lib/cn' + +/* ───────────────────────── Agent Thinking ───────────────────────── */ + +type Variant = 'wave' | 'spin' | 'stars' | 'infinity' +const TONE = { muted: 'var(--color-ink-muted)', secondary: 'var(--color-ink-secondary)', accent: 'var(--color-accent-600)' } + +function dotOpacities(variant: 'wave' | 'spin', phase: number) { + return Array.from({ length: 9 }, (_, i) => { + const col = i % 3 + const row = Math.floor(i / 3) + const s = variant === 'wave' ? ((col + row) / 4) * 0.75 : (Math.atan2(row - 1, col - 1) / (2 * Math.PI) + 1) % 1 + const behind = (phase - s + 1) % 1 + return 0.12 + 0.88 * Math.max(0, 1 - behind / 0.3) ** 1.5 + }) +} + +function Dots({ variant }: { variant: 'wave' | 'spin' }) { + const [phase, setPhase] = useState(0.45) + useEffect(() => { + const id = window.setInterval(() => setPhase((p) => (p + 1 / 8) % 1), 80) + return () => window.clearInterval(id) + }, []) + return ( + + {dotOpacities(variant, phase).map((o, i) => ( + + ))} + + ) +} + +const STARS = [{ x: 50, y: 46, s: 1 }, { x: 18, y: 22, s: 0.55 }, { x: 82, y: 26, s: 0.45 }, { x: 78, y: 76, s: 0.55 }, { x: 22, y: 78, s: 0.4 }] +function Stars() { + return ( + + {STARS.map((st, i) => { + const size = 14 * st.s + return ( + + + + ) + })} + + ) +} + +const INF = 'M28 14C33 5 47 5 47 14C47 23 33 23 28 14C23 5 9 5 9 14C9 23 23 23 28 14Z' +function Infinity_() { + return ( + + + + + ) +} + +export function AgentThinking({ variant = 'wave', label = '思考中', tone = 'secondary', seconds }: { + variant?: Variant; label?: string; tone?: keyof typeof TONE; seconds?: number +}) { + const color = TONE[tone] + return ( +
+ {(variant === 'wave' || variant === 'spin') && } + {variant === 'stars' && } + {variant === 'infinity' && } + {label} + {seconds !== undefined && {seconds.toFixed(1)}s} +
+ ) +} + +/* ───────────────────────── Composer Loader ───────────────────────── */ + +export function ComposerLoader({ active, children, speed = 4.5, arc = 120, line = 2.5, bloom = 16 }: { + active: boolean; children: ReactNode; speed?: number; arc?: number; line?: number; bloom?: number +}) { + const gid = `goxf-cl-${useId().replace(/[^a-zA-Z0-9]/g, '')}` + const ref = useRef(null) + const [box, setBox] = useState({ w: 640, h: 52 }) + useEffect(() => { + const el = ref.current + if (!el) return + const ro = new ResizeObserver(() => setBox({ w: Math.max(1, el.clientWidth), h: Math.max(1, el.clientHeight) })) + ro.observe(el) + return () => ro.disconnect() + }, []) + const band = (arc / 360) * 100 + const r = box.h / 2 + const per = 2 * (box.w - box.h) + Math.PI * box.h + const back = (px: number) => (px * 100) / per + const stroke = (width: number, blur: number, opacity: number, len: number, backPx: number) => ( + + ) + return ( +
+ + + + + + + + + + + {[14, 6, 1].map((b) => ( + + ))} + + {stroke(bloom * 2, 14, 0.3, band * 0.9, bloom + 16)} + {stroke(line * 3.2, 6, 0.8, band * 0.95, 10)} + {stroke(line, 1, 1, band, 0)} + + +
{children}
+
+ ) +} + +/* ───────────────────────── Token Input(静态视觉) ───────────────────────── */ + +type Tok = { label: string; tone: 'accent' | 'neutral'; icon?: ReactNode } +const Chip = ({ t, selected }: { t: Tok; selected?: boolean }) => ( + + {t.icon}{t.label} + +) + +function PillComposer({ children, busy, send = true }: { children: ReactNode; busy?: boolean; send?: boolean }) { + return ( +
+ + +
{children}
+ {busy ? ( + + ) : ( + + )} +
+ ) +} + +const T = { + claude: { label: '@Claude', tone: 'accent' } as Tok, + gpt: { label: '@GPT', tone: 'accent' } as Tok, + skill: { label: '先给结论', tone: 'neutral', icon: } as Tok, + file: { label: '架构草案.md', tone: 'neutral', icon: } as Tok +} + +function MentionMenu() { + const rows = [ + { name: 'Claude', note: '安全审查 · 在线', seed: 'a', on: true }, + { name: 'GPT', note: '性能与体积 · 在线', seed: 'b' }, + { name: 'Hark', note: '空闲', seed: 'c' } + ] + return ( +
+
成员
+ {rows.map((r) => ( +
+ + {r.name} + {r.note} +
+ ))} +
+ ) +} + +/* ───────────────────────── Notification Center ───────────────────────── */ + +type Status = 'neutral' | 'info' | 'success' | 'error' +const STATUS: Record = { + neutral: { icon: , cls: 'bg-sunken text-ink-secondary' }, + info: { icon: , cls: 'bg-status-busy/12 text-status-busy-ink' }, + success: { icon: , cls: 'bg-status-online/10 text-status-online-ink' }, + error: { icon: , cls: 'bg-status-error/10 text-status-error-ink' } +} +type Note = { id: string; title: string; desc: string; time: string; unread?: boolean; status?: Status; bot?: string; actions?: string[] } +const NOTES: Note[] = [ + { id: '1', bot: 'a', title: 'Claude 在「架构评审」@了你', desc: '结论已给出,等你确认要不要接给 GPT 评审。', time: '2 分钟前', unread: true, actions: ['去看看', '接给 GPT'] }, + { id: '2', status: 'error', title: 'Hark 账号掉线', desc: '点名它会失败,重新登录后恢复。', time: '8 分钟前', unread: true, actions: ['重新登录'] }, + { id: '3', status: 'success', title: '测试版 0.19.3 已下载', desc: '重启后生效,不影响正在跑的群聊。', time: '17:40' }, + { id: '4', status: 'info', title: '上游有 6 个新提交', desc: '可以同步上游,预计冲突 0 个。', time: '昨天' } +] + +function NotificationCenter() { + const [tab, setTab] = useState<'all' | 'mention' | 'system'>('all') + const unread = NOTES.filter((n) => n.unread).length + const count = (n: number) => {n} + return ( +
+
+
+
+

通知

+

{unread} 条未读

+
+ +
+ 全部{count(4)} }, + { value: 'mention', label: <>@我{count(1)} }, + { value: 'system', label: <>系统{count(3)} } + ]} /> +
+
+
+ {NOTES.map((n) => ( +
+ {n.bot ? ( + + ) : ( + + {STATUS[n.status ?? 'neutral'].icon} + + )} +
+
+

{n.title}

+
+ {n.time} + {n.unread && } +
+
+

{n.desc}

+ {n.actions && ( +
+ {n.actions.map((a, i) => )} +
+ )} +
+
+ ))} +
+
+
+ ) +} + +/* ───────────────────────── 画面 ───────────────────────── */ + +function Card({ title, note, children, w = 'w-[520px]' }: { title: string; note?: string; children: ReactNode; w?: string }) { + return ( +
+
{title}
+
{children}
+ {note &&

{note}

} +
+ ) +} + +export function V35ThinkingLoaderMock() { + return ( +
+ + + + + +
+
+ +
+ Claude + +
+
+ + + + 发消息,或输入 @ 点名… + + + 等待 @Claude 回复… + + +
+ ) +} + +export function V35TokenNotifyMock() { + return ( +
+ +
+ + 用 看看 + +
+
+ + 评审一下,然后 @C + +
+
+
+
+
Notification Center · 群聊与系统通知
+ +
+
+ ) +} diff --git a/src/renderer/src/mock/mocks/v36-reskin-measured.css b/src/renderer/src/mock/mocks/v36-reskin-measured.css new file mode 100644 index 00000000..0d8f25e0 --- /dev/null +++ b/src/renderer/src/mock/mocks/v36-reskin-measured.css @@ -0,0 +1,89 @@ +/* + * v36 效果图专用:按 Craft Anything(净室模式)实测 boardui.com/templates/multi-agent-chat 修正 v34。 + * 实测:页面底 #ffffff,聊天面板 #f7f7f7 圆角 16;成员消息灰气泡 #ebebeb 圆角 16、内边距 12、最宽 520、14/20; + * 自己的消息白气泡 + 1px #ebebeb 描边影;文字三档 #0a0a0a/#737373/#a1a1a1;输入框白底、上方柔影 0 -2px 13px 4.3%; + * 发送键纯色圆,无渐变。深色值取 BoardUI 免费版(MIT)theme.css。 + */ + +.goxf-skin-measured { + /* 中性色:BoardUI neutral 阶梯(950/600/500/400,200 线,100 底) */ + --color-canvas: #ffffff; + --color-main: #f7f7f7; + --color-surface: #ffffff; + --color-surface-hover: #f7f7f7; + --color-bubble: #ebebeb; + --color-bubble-user: #ffffff; + --color-hover: rgb(10 10 10 / 0.05); + --color-active: rgb(10 10 10 / 0.08); + --color-sunken: #ebebeb; + --color-line: #ebebeb; + --color-line-strong: #e5e5e5; + --color-ink: #0a0a0a; + --color-ink-secondary: #525252; + --color-ink-muted: #737373; + --color-ink-faint: #a1a1a1; + /* 阴影:BoardUI 6%/10% 配方 + 1px 接触影 + 侧栏三层 */ + --shadow-hairline: 0 0 0 1px rgb(0 0 0 / 0.05); + --shadow-soft: 0 1px 1px 0 rgb(0 0 0 / 0.05); + --shadow-card: 0 1px 2px 0 rgb(0 0 0 / 0.06), 0 1px 3px 0 rgb(0 0 0 / 0.1); + --shadow-float: 0 1px 0 0 rgb(0 0 0 / 0.02), 0 1px 12px 0 rgb(0 0 0 / 0.06), 0 0 1px 0 rgb(0 0 0 / 0.32); + --shadow-pop: 0 1px 1px 0 rgb(0 0 0 / 0.04), 0 4px 4px 0 rgb(0 0 0 / 0.02), 0 0 1px 0 rgb(0 0 0 / 0.32); + --shadow-dialog: 0 0 6px 0 rgb(0 0 0 / 0.06), 0 0 64px 0 rgb(0 0 0 / 0.16), 0 0 1px 0 rgb(0 0 0 / 0.32); + --gradient-primary: linear-gradient(180deg, var(--color-accent-500) 0%, var(--color-accent-600) 100%); + --gradient-primary-hover: linear-gradient(180deg, var(--color-accent-400) 0%, var(--color-accent-500) 100%); + --shadow-primary: 0 1px 2px 0 rgb(0 0 0 / 0.18), inset 0 1px 0 0 rgb(255 255 255 / 0.25); + --color-bubble-user-ink: var(--color-ink); +} +[data-theme='dark'] .goxf-skin-measured { + --color-canvas: #0a0a0a; + --color-main: #171717; + --color-surface: #262626; + --color-surface-hover: #2e2e2e; + --color-bubble: #262626; + --color-bubble-user: #1f1f1f; + --color-hover: rgb(250 250 250 / 0.06); + --color-active: rgb(250 250 250 / 0.1); + --color-sunken: #262626; + --color-line: #262626; + --color-line-strong: #404040; + --color-ink: #fafafa; + --color-ink-secondary: #a3a3a3; + --color-ink-muted: #8a8a8a; + --color-ink-faint: #525252; + --shadow-hairline: 0 0 0 1px rgb(255 255 255 / 0.06); + --shadow-soft: 0 1px 1px 0 rgb(0 0 0 / 0.3); + --shadow-card: 0 1px 2px 0 rgb(0 0 0 / 0.4), inset 0 1px 0 0 rgb(255 255 255 / 0.04); + --shadow-float: 0 1px 12px 0 rgb(0 0 0 / 0.4), 0 0 0 1px rgb(255 255 255 / 0.06); + --shadow-pop: 0 4px 12px 0 rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.08); + --shadow-primary: 0 1px 2px 0 rgb(0 0 0 / 0.4), inset 0 1px 0 0 rgb(255 255 255 / 0.18); +} + +/* 自己的气泡:深色实心 → 白底 + 1px 描边影,圆角 16(实测) */ +.goxf-skin-measured .bg-bubble-user { + color: var(--color-bubble-user-ink); + border-radius: var(--radius-2xl); + box-shadow: 0 0 0 1px var(--color-line); +} +/* 自己气泡里的 @成员:反白胶囊 → 浅强调胶囊 */ +.goxf-skin-measured .bg-bubble-user .text-main { + background-color: var(--color-accent-50); + color: var(--color-accent-700); +} +[data-theme='dark'] .goxf-skin-measured .bg-bubble-user .text-main { + color: var(--color-accent-400); +} +/* 成员回复:保留灰气泡,内边距 12,最宽 520(实测) */ +.goxf-skin-measured .bg-bubble.px-4 { + padding: 12px; + max-width: 520px; + line-height: 20px; +} +/* 输入框:去描边,白底,上方柔影(实测 0 -2px 13px 4.3%) */ +.goxf-skin-measured form.border-line-strong, +.goxf-skin-measured .border-line-strong.shadow-card { + border-color: transparent; + box-shadow: 0 -2px 13px 0 rgb(0 0 0 / 0.043), 0 0 0 1px var(--color-line); +} + +/* 效果图专用:假群没有真账号,隐藏「成员掉线」提示 */ +.v36-frame [role='status'].animate-step-in { display: none; } diff --git a/src/renderer/src/mock/mocks/v36-reskin-measured.tsx b/src/renderer/src/mock/mocks/v36-reskin-measured.tsx new file mode 100644 index 00000000..766806c2 --- /dev/null +++ b/src/renderer/src/mock/mocks/v36-reskin-measured.tsx @@ -0,0 +1,51 @@ +import './v36-reskin-measured.css' +import type { CollabRoom, RoomMember, RoomMessage } from '@/rooms/model' +import { useEffect } from 'react' +import { setRoomDraft } from '@/rooms/roomComposerEvents' +import { RoomView } from '@/rooms/RoomView' +import { useRooms } from '@/rooms/roomStore' +import { useBotStore } from '@/store/botStore' + +/** + * v36 界面换皮:按 Craft Anything 实测数值修正的 BoardUI 风格(v34 留档不删)。 + * 两张都是真 RoomView(同一份假群数据);「BoardUI 风格」只是外面包了 .goxf-skin-board, + * 改的是 token 值和少量组件级规则(见 v34-reskin-board.css),组件代码不动。 + */ +const member = (botId: string, name: string): RoomMember => + ({ botId, name, accountId: `acc-${botId}`, platform: 'meta-muse', cursor: 0 } as RoomMember) +const MEMBERS = [member('a', 'Claude'), member('b', 'GPT'), member('c', 'Hark')] +const at = new Date(2026, 11, 3, 17, 40).getTime() +const MESSAGES: RoomMessage[] = [ + { id: 'h1', author: 'User', text: '@Claude 本地存储用 SQLite 还是 IndexedDB?给结论和理由。', createdAt: at }, + { id: 'r1', author: 'Claude', authorBotId: 'a', createdAt: at + 60_000, + text: '结论:用 SQLite(better-sqlite3,放主进程)。\n\n1. 群聊消息量大,要按群、按时间查,SQL 索引更省事;\n2. 主进程统一读写,多窗口不会互相覆盖;\n3. 备份就是拷一个文件。' }, + { id: 'h2', author: 'User', text: '@GPT 评审一下,有没有坑?', createdAt: at + 120_000 }, + { id: 'r2', author: 'GPT', authorBotId: 'b', createdAt: at + 180_000, + text: '两个坑:原生模块要按 Electron 版本重编;便携版要把数据库放在 BotArkData 里,别写进程序目录。' } +] +const roomFor = (id: string): CollabRoom => + ({ id, title: '架构评审', mode: 'manual', limit: 8, brief: '', members: MEMBERS, messages: MESSAGES } as unknown as CollabRoom) + +const IDS = ['mock-v36-after'] +useRooms.setState((s) => ({ + rooms: [...IDS.map(roomFor), ...s.rooms.filter((r) => !IDS.includes(r.id))], +})) +useBotStore.setState({ infoPanelOpen: false }) + +function Frame({ id, skin }: { id: string; skin?: boolean }) { + useEffect(() => { + const t = setTimeout(() => setRoomDraft(id, '@Hark 汇总一下两位的意见,给最终方案'), 50) + return () => clearTimeout(t) + }, [id]) + return ( +
+
+
+ +
+
+
+ ) +} + +export const V36ReskinMeasuredMock = () => diff --git a/src/renderer/src/mock/mocks/v37-app.tsx b/src/renderer/src/mock/mocks/v37-app.tsx new file mode 100644 index 00000000..ea6ee5b7 --- /dev/null +++ b/src/renderer/src/mock/mocks/v37-app.tsx @@ -0,0 +1,56 @@ +import type { CollabRoom, RoomMember, RoomMessage } from '@/rooms/model' +import { useEffect } from 'react' +import { setRoomDraft } from '@/rooms/roomComposerEvents' +import { RoomView } from '@/rooms/RoomView' +import { useRooms } from '@/rooms/roomStore' +import { useBotStore } from '@/store/botStore' +import { SettingsView } from '@/components/settings/SettingsView' + +/** + * v37 真实页面(换皮 PR A+B 后):群聊页 RoomView、设置页 SettingsView,只看 token 生效后的整体效果。 + * 外壳(白底 + 浮面板)和气泡留给 PR C,这里外框照旧:canvas 底 + main 面板。 + */ +const member = (botId: string, name: string): RoomMember => + ({ botId, name, accountId: `acc-${botId}`, platform: 'meta-muse', cursor: 0 } as RoomMember) +const MEMBERS = [member('a', 'Claude'), member('b', 'GPT'), member('c', 'Hark')] +const at = new Date(2026, 11, 3, 17, 40).getTime() +const MESSAGES: RoomMessage[] = [ + { id: 'h1', author: 'User', text: '@Claude 本地存储用 SQLite 还是 IndexedDB?给结论和理由。', createdAt: at }, + { id: 'r1', author: 'Claude', authorBotId: 'a', createdAt: at + 60_000, + text: '结论:用 SQLite(better-sqlite3,放主进程)。\n\n1. 群聊消息量大,要按群、按时间查,SQL 索引更省事;\n2. 主进程统一读写,多窗口不会互相覆盖;\n3. 备份就是拷一个文件。' }, + { id: 'h2', author: 'User', text: '@GPT 评审一下,有没有坑?', createdAt: at + 120_000 }, + { id: 'r2', author: 'GPT', authorBotId: 'b', createdAt: at + 180_000, + text: '两个坑:原生模块要按 Electron 版本重编;便携版要把数据库放在 BotArkData 里,别写进程序目录。' } +] +const ID = 'mock-v37-room' +useRooms.setState((s) => ({ + rooms: [ + { id: ID, title: '架构评审', mode: 'manual', limit: 8, brief: '', members: MEMBERS, messages: MESSAGES } as unknown as CollabRoom, + ...s.rooms.filter((r) => r.id !== ID) + ] +})) +useBotStore.setState({ infoPanelOpen: false }) + +export function V37AppRoomMock() { + useEffect(() => { + const t = setTimeout(() => setRoomDraft(ID, '@Hark 汇总一下两位的意见,给最终方案'), 50) + return () => clearTimeout(t) + }, []) + return ( +
+
+ +
+
+ ) +} + +export function V37AppSettingsMock() { + return ( +
+
+ +
+
+ ) +} diff --git a/src/renderer/src/mock/mocks/v37-ui-kit.css b/src/renderer/src/mock/mocks/v37-ui-kit.css new file mode 100644 index 00000000..a99ae62b --- /dev/null +++ b/src/renderer/src/mock/mocks/v37-ui-kit.css @@ -0,0 +1,13 @@ +/* v37 UI kit:把弹窗遮罩和弹窗收进右下角区域,免得盖住状态总表(只影响这张效果图)。 */ +body:has(#v37-kit) .fixed.inset-0.z-40 { + inset: auto; + left: 664px; + top: 1040px; + width: 680px; + height: 340px; + border-radius: 16px; +} +body:has(#v37-kit) [role='dialog'] { + left: 1004px; + top: 1210px; +} diff --git a/src/renderer/src/mock/mocks/v37-ui-kit.tsx b/src/renderer/src/mock/mocks/v37-ui-kit.tsx new file mode 100644 index 00000000..7358bbf4 --- /dev/null +++ b/src/renderer/src/mock/mocks/v37-ui-kit.tsx @@ -0,0 +1,210 @@ +import './v37-ui-kit.css' +import type { ReactNode } from 'react' +import type { PlatformDescriptor } from '@adapters/types' +import { Bell, Copy, Pencil, Plus, Search, Settings, Trash2 } from 'lucide-react' +import { Button } from '@/components/ui/Button' +import { IconButton } from '@/components/ui/IconButton' +import { Field, TextInput } from '@/components/ui/Field' +import { InlineEdit } from '@/components/ui/InlineEdit' +import { Select } from '@/components/ui/Select' +import { Menu, MenuContent, MenuItem, MenuLabel, MenuSeparator, MenuTrigger } from '@/components/ui/Menu' +import { Dialog } from '@/components/ui/Dialog' +import { SegmentedControl } from '@/components/ui/SegmentedControl' +import { NumberStepper, SwitchPill } from '@/components/ui/Controls' +import { StatusBadge, StatusDot, UnreadBadge } from '@/components/ui/Status' +import { AccountAvatar, BotAvatar } from '@/components/ui/Avatar' +import { ErrorBoundary } from '@/components/ui/ErrorBoundary' +import { PlatformGlyph } from '@/components/ui/PlatformGlyph' + +/** + * v37 UI kit:components/ui 每个组件的各状态放一张图(换皮 PR A+B 改前 / 改后对比)。 + * 「悬停 / 聚焦 / 按下」由截图脚本用 CDP forcePseudoState 按 data-force 强制,不是手写样式。 + * BotAvatarEditorDialog 是弹窗,与 Dialog 同时打开会互相抢焦点,本图不放(其分段切换与 SegmentedControl 同款)。 + */ +const noop = () => {} +const COLS = ['默认', '悬停', '聚焦', '禁用', '出错 / 其他'] +const STATUSES = ['online', 'busy', 'attention', 'offline', 'error'] as const +const OPTS = [ + { value: 'claude', label: 'Claude' }, + { value: 'gpt', label: 'GPT-5' }, + { value: 'hark', label: 'Hark', description: '浏览器 Bot' } +] +const glyph = (name: string, ok: boolean) => + ({ id: `mock-${name}`, name, monogram: name.slice(0, 2), availability: ok ? 'available' : 'unavailable' }) as unknown as PlatformDescriptor + +function Boom(): ReactNode { + throw new Error('mock render failure') +} + +function Row({ name, children }: { name: string; children: ReactNode[] }) { + return ( + <> +
{name}
+ {children.map((c, i) => ( +
+ {c} +
+ ))} + + ) +} + +const btn = (variant: 'primary' | 'secondary' | 'ghost' | 'danger' | 'danger-confirm', label: string) => [ + , + , + , + , + +] + +export function V37UiKitMock() { + return ( +
+
components/ui · 状态总表
+
+
+ {COLS.map((c) => ( +
{c}
+ ))} + {btn('primary', '发送')} + {btn('secondary', '取消')} + {btn('ghost', '更多')} + {btn('danger', '删除')} + {btn('danger-confirm', '确认删除')} + + {[ + , + , + , + , + + ]} + + + {[ + <>, + , + , + , + <>active + ]} + + + {[ + , + , + , + , + + ]} + + + {[ + , + , + , + , + + ]} + + + {[ + , + , + , + , + + ]} + + + {[ + , + , +