From 5ef60c5460a85cddcb94141446cf6a70ad053d32 Mon Sep 17 00:00:00 2001 From: taekchef Date: Sat, 22 Aug 2026 12:39:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E8=AF=9D=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E5=8D=87=E7=BA=A7=E4=B8=BA=E5=88=BB=E8=9A=80=E7=BA=B8?= =?UTF-8?q?=E9=9D=A2=E5=8D=A1=E7=89=87=E8=B4=A8=E6=84=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Theme 新增 weibeiComposerCard:在原形状上叠加纸面分层——顶部内高光、 底部内阴影、发丝外框、极薄材质层,投影改双层(贴地 2pt + 环境 10pt), 聚焦描边用应用统一的链接色,与 weibeiInputSurface 的刻蚀语言一致 - AgentComposerField 的平涂底色+单层描边/投影换成该修饰符,形状不变 --- Sources/WeiBei/Support/Theme.swift | 51 +++++++++++++++++++++++ Sources/WeiBei/Views/NotesAgentView.swift | 28 +++---------- 2 files changed, 57 insertions(+), 22 deletions(-) diff --git a/Sources/WeiBei/Support/Theme.swift b/Sources/WeiBei/Support/Theme.swift index 19fc69ef1..1b7eab106 100644 --- a/Sources/WeiBei/Support/Theme.swift +++ b/Sources/WeiBei/Support/Theme.swift @@ -1642,6 +1642,57 @@ extension View { .animation(WeiBeiMotion.reveal, value: active) } + /// Chat composer card: the etched input-surface treatment scaled up — + /// top inner light, bottom inner shade, hairline frame, and a two-layer + /// shadow (tight contact + soft ambient) so the card sits on the thread + /// instead of floating flat. Keeps the shape handed in via `cornerRadius`. + func weibeiComposerCard( + cornerRadius: CGFloat, + focused: Bool, + showsChrome: Bool = true + ) -> some View { + let dark = WeiBeiThemeRuntime.mode.isDark + let glass = WeiBeiThemeRuntime.mode.isGlass + return self + .background { + if showsChrome { + ZStack { + RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) + .fill(WeiBeiTheme.paperRaised.opacity(dark ? 0.40 : 0.62)) + RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) + .fill(.ultraThinMaterial) + .opacity(glass ? 0.06 : 0.02) + } + } + } + .clipShape(RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)) + .overlay(alignment: .top) { + if showsChrome { + RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) + .stroke(WeiBeiTheme.glassHighlight.opacity(dark ? 0.20 : 0.26), lineWidth: 1) + .padding(1) + } + } + .overlay(alignment: .bottom) { + if showsChrome { + RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) + .stroke(WeiBeiTheme.paperInset.opacity(dark ? 0.38 : 0.32), lineWidth: 1) + .padding(0.5) + } + } + .overlay { + if showsChrome { + RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) + .stroke( + focused ? WeiBeiTheme.link.opacity(0.32) : WeiBeiTheme.hairline.opacity(0.55), + lineWidth: 1 + ) + } + } + .shadow(color: WeiBeiTheme.ink.opacity(showsChrome ? 0.07 : 0), radius: 2, y: 1) + .shadow(color: WeiBeiTheme.ink.opacity(showsChrome ? 0.05 : 0), radius: 10, y: 3) + } + func weibeiFloatingPanel(cornerRadius: CGFloat = 8, shadowOpacity: Double = 0.10) -> some View { let isGlass = WeiBeiThemeRuntime.mode.isGlass return self diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 40871248c..78a41b37c 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -348,28 +348,12 @@ private struct AgentComposerField: View { alignment: .topLeading ) .fixedSize(horizontal: false, vertical: true) - .background { - if showsChrome { - // ChatGPT-like: same paper as the thread, lifted only by a soft - // border and a whisper of shadow — no fill-color seam. - RoundedRectangle(cornerRadius: corner, style: .continuous) - .fill(WeiBeiTheme.paperRaised.opacity(store.appearanceMode.isDark ? 0.34 : 0.5)) - } - } - .clipShape(RoundedRectangle(cornerRadius: corner, style: .continuous)) - .overlay { - if showsChrome { - RoundedRectangle(cornerRadius: corner, style: .continuous) - .stroke( - focused.wrappedValue ? WeiBeiTheme.hairline.opacity(0.9) : WeiBeiTheme.hairline.opacity(0.55), - lineWidth: 1 - ) - } - } - .shadow( - color: showsChrome ? WeiBeiTheme.ink.opacity(0.05) : .clear, - radius: showsChrome ? 10 : 0, - y: showsChrome ? 3 : 0 + // Etched paper card: graded fill + inner light/shade + hairline frame + // + two-layer shadow (see weibeiComposerCard), same shape as before. + .weibeiComposerCard( + cornerRadius: corner, + focused: focused.wrappedValue, + showsChrome: showsChrome ) .contentShape(Rectangle()) .onTapGesture {