From 9f212d2f19106dec5c26650970c10a5ec77fbfd4 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Thu, 16 Jul 2026 22:34:47 +0800 Subject: [PATCH] style(webui): refine shared surface depth Add theme-neutral media keylines and layered card shadows so avatars, previews, pickers, and shared cards remain separated without relying on hard borders. Keep the message composer radius hierarchy concentric across appearance settings and remove redundant nested canvas surfaces from forwarded-message editors. This changes visual presentation only; message composition behavior and emitted payloads remain unchanged. --- .../src/components/debug/message-builder.tsx | 33 +++++++++++++++---- packages/webui/src/components/ui/avatar.tsx | 2 +- packages/webui/src/components/ui/card.tsx | 2 +- .../webui/src/components/ui/json-tree.tsx | 2 +- packages/webui/src/components/ui/picker.tsx | 6 ++-- packages/webui/src/index.css | 28 ++++++++++++++++ 6 files changed, 60 insertions(+), 13 deletions(-) diff --git a/packages/webui/src/components/debug/message-builder.tsx b/packages/webui/src/components/debug/message-builder.tsx index b2bee066..e9207b3e 100644 --- a/packages/webui/src/components/debug/message-builder.tsx +++ b/packages/webui/src/components/debug/message-builder.tsx @@ -128,11 +128,29 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }: onChange(next); }; + // Keep the top-level canvas concentric with its rows at any operator-selected + // corner radius. At the default 12px radius this is 20px → 12px over the 8px + // inset. Nested forward builders deliberately avoid another canvas surface: + // cards-inside-cards add visual noise and cannot remain concentric with a + // parent row once the operator selects a compact radius. + const nested = depth > 0; + const canvasRadius = 'calc(var(--radius) + 0.5rem)'; + const rowRadius = depth === 0 + ? 'var(--radius)' + : depth === 1 + ? 'max(0px, calc(var(--radius) - 0.25rem))' + : 'max(0px, calc(var(--radius) - 0.5rem))'; + return ( - // A bounded "compose canvas" at every level — so the empty hint reads as an - // intentional empty state inside a defined region rather than a stray - // centered line floating in the left-aligned form (Apple-HIG alignment). -
+ // The root is a bounded compose canvas, so its empty hint reads as an + // intentional empty state rather than a stray line. Nested builders inherit + // the surrounding node surface instead of drawing another card within it. +
{segments.length === 0 && (

空消息 — 点下方「添加段」开始

)} @@ -142,7 +160,8 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }: key={s._id} onDragOver={(e) => e.preventDefault()} onDrop={(e) => { e.stopPropagation(); if (dragFrom !== null) move(dragFrom, i); setDragFrom(null); }} - className="rounded-xl border border-border/50 bg-card/60 p-2" + className="border border-border/50 bg-card/60 p-2" + style={{ borderRadius: rowRadius }} > {/* Drag is scoped to the grip handle only — making the whole row draggable hijacked text selection inside the segment inputs (you @@ -184,7 +203,7 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }:
{COMMON.map((c) => ( ))} @@ -194,7 +213,7 @@ export function MessageBuilder({ segments, onChange, uin, groupId, depth = 0 }:
{ADVANCED.map((c) => ( ))} diff --git a/packages/webui/src/components/ui/avatar.tsx b/packages/webui/src/components/ui/avatar.tsx index 8d331319..85f0c472 100644 --- a/packages/webui/src/components/ui/avatar.tsx +++ b/packages/webui/src/components/ui/avatar.tsx @@ -9,7 +9,7 @@ const Avatar = React.forwardRef( ({ className, size = 36, style, ...props }, ref) => (
diff --git a/packages/webui/src/components/ui/card.tsx b/packages/webui/src/components/ui/card.tsx index 413c3e03..8627f8a5 100644 --- a/packages/webui/src/components/ui/card.tsx +++ b/packages/webui/src/components/ui/card.tsx @@ -5,7 +5,7 @@ const Card = React.forwardRef (
) diff --git a/packages/webui/src/components/ui/json-tree.tsx b/packages/webui/src/components/ui/json-tree.tsx index ed32d45e..d22083b7 100644 --- a/packages/webui/src/components/ui/json-tree.tsx +++ b/packages/webui/src/components/ui/json-tree.tsx @@ -39,7 +39,7 @@ function Leaf({ value }: { value: string | number | boolean | null }) { {showImg && ( - 预览 + 预览 )} diff --git a/packages/webui/src/components/ui/picker.tsx b/packages/webui/src/components/ui/picker.tsx index d9a32504..0599bd5f 100644 --- a/packages/webui/src/components/ui/picker.tsx +++ b/packages/webui/src/components/ui/picker.tsx @@ -138,7 +138,7 @@ export function Picker({ !selected && !value && 'text-muted-foreground', )} > - {selected?.avatar && } + {selected?.avatar && } {selected ? selected.label : value || placeholder} {selected?.sub && {selected.sub}} @@ -217,8 +217,8 @@ export function Picker({ {opt ? ( <> {opt.avatar - ? - : } + ? + : } {opt.label} {opt.sub && {opt.sub}} diff --git a/packages/webui/src/index.css b/packages/webui/src/index.css index b665a8ab..42f6c784 100644 --- a/packages/webui/src/index.css +++ b/packages/webui/src/index.css @@ -59,6 +59,14 @@ --sidebar-accent-foreground: oklch(35% 0.08 230); --sidebar-border: oklch(92% 0.01 240); --sidebar-ring: oklch(68.5% 0.155 230); + --media-outline: oklch(0% 0 0 / 0.1); + + /* Cards need depth without turning every surface into a hard outlined box. + The short shadow separates the edge; the long, faint shadow establishes + elevation without looking like a floating modal. */ + --shadow-card: + 0 1px 2px oklch(20% 0.03 250 / 0.05), + 0 12px 32px -22px oklch(20% 0.03 250 / 0.28); } .dark { @@ -108,6 +116,12 @@ --sidebar-accent-foreground: oklch(85% 0.1 230); --sidebar-border: oklch(26% 0.02 250); --sidebar-ring: oklch(75% 0.14 230); + --media-outline: oklch(100% 0 0 / 0.12); + + --shadow-card: + 0 1px 2px oklch(0% 0 0 / 0.36), + 0 16px 38px -24px oklch(0% 0 0 / 0.72), + inset 0 1px oklch(100% 0 0 / 0.025); } @theme inline { @@ -193,6 +207,20 @@ } } +@layer components { + /* Shared media keyline: an inset outline remains visible on both pale and + dark images without changing layout or shrinking the image content. */ + .media-outline { + outline: 1px solid var(--media-outline); + outline-offset: -1px; + } + + .ui-card { + box-shadow: var(--shadow-card); + } + +} + /* ────────────────────────────────────────────── Customization layers (driven by ThemeContext via data-* attributes + CSS vars on )