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
60 changes: 37 additions & 23 deletions Sources/WeiBei/Support/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -598,37 +598,51 @@ struct WeiBeiGlassHeaderBackground: View {
var paperOpacity: Double = 0.72
var materialOpacity: Double = 0.14

/// Use product theme, not system colorScheme (纸面/宣纸 are both light).
/// Product theme (not system colorScheme — 纸面/宣纸 are both light).
private var isDark: Bool { WeiBeiThemeRuntime.mode.isDark }

var body: some View {
ZStack {
Rectangle()
.fill(.regularMaterial)
.opacity(materialOpacity)

Rectangle()
.fill(WeiBeiTheme.paperRaised.opacity(paperWashOpacity))

LinearGradient(
colors: [
WeiBeiTheme.glassHighlight.opacity(isDark ? 0.12 : 0.20),
WeiBeiTheme.glassTint.opacity(isDark ? 0.16 : 0.24),
WeiBeiTheme.paperRaised.opacity(isDark ? 0.12 : 0.13),
WeiBeiTheme.paper.opacity(isDark ? 0.10 : 0.04)
],
startPoint: .top,
endPoint: .bottom
)

Rectangle()
.fill(WeiBeiTheme.paperInset.opacity(0.018))
if isDark {
// Dark themes: solid product surface. `.regularMaterial` reads as a
// washed gray bar on 墨石/石碑 and must not sit above the page.
Rectangle()
.fill(WeiBeiTheme.paper)
Rectangle()
.fill(WeiBeiTheme.paperRaised.opacity(0.55))
LinearGradient(
colors: [
WeiBeiTheme.glassHighlight.opacity(0.08),
WeiBeiTheme.paper.opacity(0.0)
],
startPoint: .top,
endPoint: .bottom
)
} else {
Rectangle()
.fill(.regularMaterial)
.opacity(materialOpacity)
Rectangle()
.fill(WeiBeiTheme.paperRaised.opacity(paperWashOpacity))
LinearGradient(
colors: [
WeiBeiTheme.glassHighlight.opacity(0.20),
WeiBeiTheme.glassTint.opacity(0.24),
WeiBeiTheme.paperRaised.opacity(0.13),
WeiBeiTheme.paper.opacity(0.04)
],
startPoint: .top,
endPoint: .bottom
)
Rectangle()
.fill(WeiBeiTheme.paperInset.opacity(0.018))
}
}
}

private var paperWashOpacity: Double {
let factor = isDark ? 0.30 : 0.42
return min(isDark ? 0.34 : 0.48, max(0.20, paperOpacity * factor))
// Light themes only — dark path is solid product paper above.
min(0.48, max(0.20, paperOpacity * 0.42))
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/WeiBei/Views/NotesAgentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4031,8 +4031,8 @@ private struct AgentMessageMarkdownText: View {
.foregroundStyle(WeiBeiTheme.ink)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
// Let wheel events reach the conversation ScrollView (no textSelection).
.allowsHitTesting(false)
// Selectable chat text — wheel still reaches ScrollView via Text's default handling.
.textSelection(.enabled)
}

private var renderedText: AttributedString {
Expand Down
18 changes: 12 additions & 6 deletions Sources/WeiBei/Views/ReaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ struct ImmersiveHoverTitleView<Actions: View>: View {
}

var body: some View {
// Hit-test only the top strip + the visible chip. A full-pane contentShape
// was swallowing PDF/HTML selection and killing the selection float capsule.
ZStack(alignment: .top) {
Color.clear
.frame(maxWidth: .infinity)
.frame(height: 30)
.frame(height: 34)
.contentShape(Rectangle())
.onHover(perform: updateVisibility)

if visible || isPinned {
HStack(alignment: .center, spacing: actionsAlignedTrailing ? 10 : 8) {
Expand Down Expand Up @@ -72,22 +76,24 @@ struct ImmersiveHoverTitleView<Actions: View>: View {
.frame(minHeight: 30)
.background {
RoundedRectangle(cornerRadius: 7)
.fill(WeiBeiTheme.paperRaised.opacity(appearanceMode.isDark ? 0.34 : 0.72))
.fill(WeiBeiTheme.paperRaised.opacity(appearanceMode.isDark ? 0.88 : 0.92))
.overlay {
RoundedRectangle(cornerRadius: 7)
.stroke(WeiBeiTheme.hairline.opacity(appearanceMode.isDark ? 0.30 : 0.42), lineWidth: 1)
.stroke(WeiBeiTheme.hairline.opacity(appearanceMode.isDark ? 0.42 : 0.48), lineWidth: 1)
}
}
.shadow(color: WeiBeiTheme.ink.opacity(appearanceMode.isDark ? 0.24 : 0.07), radius: 9, y: 4)
.shadow(color: WeiBeiTheme.ink.opacity(appearanceMode.isDark ? 0.28 : 0.08), radius: 9, y: 4)
.padding(.horizontal, actionsAlignedTrailing ? 14 : 0)
.padding(.top, 7)
.contentShape(Rectangle())
.onHover(perform: updateVisibility)
.modifier(PaneHeaderReorderModifier(role: reorderRole))
.transition(WeiBeiTransition.floating)
}
}
.contentShape(Rectangle())
.onHover(perform: updateVisibility)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
.allowsHitTesting(true)
// Children define the hit regions; do NOT expand contentShape to the whole pane.
.onDisappear {
hideTask?.cancel()
}
Expand Down
11 changes: 5 additions & 6 deletions Sources/WeiBeiSelfCheck/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1913,9 +1913,9 @@ expect(themeSource.contains("WeiBeiTheme.glassTint.opacity(0.16 * opacity)") &&
expect(themeSource.contains("static func glassTint(for mode:")
&& themeSource.contains("static func glassHighlight(for mode:")
&& themeSource.contains("static func documentMaskFill(for mode:")
&& themeSource.contains("isDark ? 0.12 : 0.20")
&& themeSource.contains("isDark ? 0.16 : 0.24")
&& themeSource.contains("WeiBeiThemeRuntime.mode.isDark"), "dark glass headers use product-theme washes (not system colorScheme alone)")
&& themeSource.contains("WeiBeiThemeRuntime.mode.isDark")
&& themeSource.contains("// Dark themes: solid product surface")
&& themeSource.contains(".regularMaterial"), "dark glass headers use solid product paper; light themes keep material wash")
expect(themeSource.contains("paperRaised.opacity(0.985)")
&& themeSource.contains(".opacity(0.015)")
&& !themeSource.contains("paperRaised.opacity(0.92)"), "floating panels stay readable without losing the light glass surface")
Expand Down Expand Up @@ -4212,9 +4212,8 @@ if let messageTextStart = notesAgentSource.range(of: "private struct AgentMessag
&& messageTextSource.contains("NEVER wire onContentHeightChange to scrollAgentToBottom")
&& messageTextSource.contains("AttributedString(markdown:")
&& messageTextSource.contains("RichAnswerDisplayText.normalizedInlineMath")
&& messageTextSource.contains(".allowsHitTesting(false)")
&& !messageTextSource.contains("onContentHeightChange: onMarkdownHeightChange")
&& !messageTextSource.contains(".textSelection(.enabled)"), "agent chat uses finalized KaTeX with width-aware height and native streaming text without height-scroll thrash")
&& messageTextSource.contains(".textSelection(.enabled)")
&& !messageTextSource.contains("onContentHeightChange: onMarkdownHeightChange"), "agent chat uses finalized KaTeX with width-aware height and selectable native text")
} else {
expect(false, "agent message text source is inspectable")
}
Expand Down
Loading