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
34 changes: 34 additions & 0 deletions Sources/WeiBei/Support/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1804,6 +1804,40 @@ struct WeiBeiDialogButtonStyle: ButtonStyle {
}

extension View {
/// One-line etched backdrop for upgrading existing flat-fill surfaces;
/// keeps call sites compact inside frozen files.
func weibeiEtchedBackground(
fill: Color,
stroke: Color,
cornerRadius: CGFloat,
contactShadow: Bool = false
) -> some View {
background {
WeiBeiEtchedBackdrop(
shape: RoundedRectangle(cornerRadius: cornerRadius, style: .continuous),
fill: fill,
stroke: stroke,
showsContactShadow: contactShadow
)
}
}

/// Capsule variant of `weibeiEtchedBackground`.
func weibeiEtchedCapsuleBackground(
fill: Color,
stroke: Color,
contactShadow: Bool = false
) -> some View {
background {
WeiBeiEtchedBackdrop(
shape: Capsule(),
fill: fill,
stroke: stroke,
showsContactShadow: contactShadow
)
}
}

func weibeiPanel() -> some View {
self
.foregroundColor(WeiBeiTheme.ink)
Expand Down
37 changes: 21 additions & 16 deletions Sources/WeiBei/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ private struct ImportProgressPill: View {
}
.padding(.horizontal, 12)
.padding(.vertical, 8)
.background(WeiBeiTheme.paperRaised.opacity(0.97))
.weibeiEtchedCapsuleBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.97),
stroke: WeiBeiTheme.hairline.opacity(0.6),
contactShadow: true
)
.clipShape(Capsule())
.overlay {
Capsule()
.stroke(WeiBeiTheme.hairline.opacity(0.6), lineWidth: 1)
}
.shadow(color: WeiBeiTheme.ink.opacity(store.appearanceMode.isDark ? 0.3 : 0.1), radius: 12, y: 6)
.accessibilityElement(children: .combine)
.accessibilityLabel(Text(store.ui("正在导入文件", "Importing files")))
Expand Down Expand Up @@ -432,17 +432,17 @@ private struct WorkspaceStatusBanner: View {
.padding(.horizontal, 12)
.padding(.vertical, 9)
.frame(maxWidth: 440, alignment: .leading)
.background(WeiBeiTheme.paperRaised.opacity(0.97))
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
.overlay {
RoundedRectangle(cornerRadius: 8, style: .continuous)
.stroke(
isAlert
? WeiBeiTheme.cinnabar.opacity(0.55)
: WeiBeiTheme.hairline.opacity(0.6),
lineWidth: 1
)
.background {
WeiBeiEtchedBackdrop(
shape: RoundedRectangle(cornerRadius: 8, style: .continuous),
fill: WeiBeiTheme.paperRaised.opacity(0.97),
stroke: isAlert
? WeiBeiTheme.cinnabar.opacity(0.55)
: WeiBeiTheme.hairline.opacity(0.6),
showsContactShadow: true
)
}
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
.shadow(color: WeiBeiTheme.ink.opacity(store.appearanceMode.isDark ? 0.3 : 0.1), radius: 12, y: 6)
.allowsHitTesting(isAlert)
.accessibilityElement(children: .contain)
Expand Down Expand Up @@ -1257,7 +1257,12 @@ private struct PaneDropTargetView: View {
.foregroundStyle(WeiBeiTheme.cinnabar)
.padding(.horizontal, 10)
.padding(.vertical, 6)
.background(WeiBeiTheme.paperRaised.opacity(0.72), in: Capsule())
.weibeiEtchedCapsuleBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.72),
stroke: WeiBeiTheme.hairline.opacity(0.4),
contactShadow: true
)
.clipShape(Capsule())
.padding(14)
}
.allowsHitTesting(false)
Expand Down
23 changes: 19 additions & 4 deletions Sources/WeiBei/Views/CourseRelationPaperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ struct CourseRelationPaperView: View {
}
.padding(.horizontal, 16)
.frame(height: 40)
.background(WeiBeiTheme.paperRaised.opacity(0.22))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.22),
stroke: WeiBeiTheme.hairline.opacity(0.24),
cornerRadius: 8
)
}

/// Left rail: courses as primary units (plus all / unassigned / unlinked).
Expand Down Expand Up @@ -227,7 +231,11 @@ struct CourseRelationPaperView: View {
}
.frame(width: 212)
.frame(maxHeight: .infinity)
.background(WeiBeiTheme.paperRaised.opacity(0.22))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.22),
stroke: WeiBeiTheme.hairline.opacity(0.24),
cornerRadius: 8
)
}

private func courseScopeRow(
Expand Down Expand Up @@ -298,7 +306,10 @@ struct CourseRelationPaperView: View {
.foregroundStyle(WeiBeiTheme.ink)
.padding(.horizontal, 10)
.frame(height: 28)
.background(WeiBeiTheme.paperInset.opacity(0.34), in: Capsule())
.weibeiEtchedCapsuleBackground(
fill: WeiBeiTheme.paperInset.opacity(0.34),
stroke: WeiBeiTheme.hairline.opacity(0.3)
)
}
.menuStyle(.borderlessButton)
.menuIndicator(.hidden)
Expand Down Expand Up @@ -611,7 +622,11 @@ struct CourseRelationPaperView: View {
}
.padding(18)
}
.background(WeiBeiTheme.paperRaised.opacity(0.18))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.18),
stroke: WeiBeiTheme.hairline.opacity(0.22),
cornerRadius: 8
)
}

private func compactSection(
Expand Down
42 changes: 35 additions & 7 deletions Sources/WeiBei/Views/CourseWorkspaceComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,11 @@ struct CourseProjectEntrySheet: View {
}
.padding(14)
.frame(maxWidth: .infinity, alignment: .leading)
.background(WeiBeiTheme.paperRaised.opacity(0.34), in: RoundedRectangle(cornerRadius: 10))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.34),
stroke: WeiBeiTheme.hairline.opacity(0.3),
cornerRadius: 10
)
}

@ViewBuilder
Expand Down Expand Up @@ -537,7 +541,11 @@ struct CourseProjectEntrySheet: View {
}
.padding(12)
.frame(maxWidth: .infinity, alignment: .leading)
.background(WeiBeiTheme.paperRaised.opacity(0.30), in: RoundedRectangle(cornerRadius: 9))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.30),
stroke: WeiBeiTheme.hairline.opacity(0.28),
cornerRadius: 9
)
}

private func pathLine(label: String, path: String) -> some View {
Expand All @@ -555,7 +563,11 @@ struct CourseProjectEntrySheet: View {
}
.padding(12)
.frame(maxWidth: .infinity, alignment: .leading)
.background(WeiBeiTheme.paperRaised.opacity(0.30), in: RoundedRectangle(cornerRadius: 9))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.30),
stroke: WeiBeiTheme.hairline.opacity(0.28),
cornerRadius: 9
)
}

@ViewBuilder
Expand Down Expand Up @@ -845,7 +857,11 @@ struct CourseRelationDetailHeader: View {
}
.padding(.horizontal, 24)
.frame(minHeight: 88)
.background(WeiBeiTheme.paperRaised.opacity(0.28))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.28),
stroke: WeiBeiTheme.hairline.opacity(0.26),
cornerRadius: 8
)
}
}

Expand Down Expand Up @@ -1049,7 +1065,11 @@ struct CourseContextLine: View {
}
.padding(.horizontal, 12)
.frame(minHeight: 44)
.background(WeiBeiTheme.paperRaised.opacity(0.30))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.30),
stroke: WeiBeiTheme.hairline.opacity(0.28),
cornerRadius: 8
)
}
}

Expand Down Expand Up @@ -1081,7 +1101,11 @@ struct CourseActionRow: View {
}
.padding(.horizontal, 12)
.frame(minHeight: 50)
.background(WeiBeiTheme.paperRaised.opacity(0.24))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.24),
stroke: WeiBeiTheme.hairline.opacity(0.24),
cornerRadius: 8
)
}
}

Expand Down Expand Up @@ -1253,7 +1277,11 @@ func relationFooter(
}
.padding(.horizontal, 18)
.frame(height: 46)
.background(WeiBeiTheme.paperRaised.opacity(0.36))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(0.36),
stroke: WeiBeiTheme.hairline.opacity(0.3),
cornerRadius: 8
)
}

func toggled(_ itemID: String, in values: Set<String>) -> Set<String> {
Expand Down
67 changes: 33 additions & 34 deletions Sources/WeiBei/Views/NotesAgentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1857,14 +1857,11 @@ struct AgentPaneView: View {
.foregroundStyle(isAgentHistoryRevealButtonHovered ? WeiBeiTheme.link : WeiBeiTheme.secondaryInk)
.padding(.vertical, 6)
.padding(.horizontal, 12)
.background {
Capsule()
.fill(WeiBeiTheme.paperInset.opacity(isAgentHistoryRevealButtonHovered ? 0.42 : 0.24))
}
.overlay {
Capsule()
.stroke(WeiBeiTheme.hairline.opacity(isAgentHistoryRevealButtonHovered ? 0.72 : 0.44), lineWidth: 1)
}
.weibeiEtchedCapsuleBackground(
fill: WeiBeiTheme.paperInset.opacity(isAgentHistoryRevealButtonHovered ? 0.42 : 0.24),
stroke: WeiBeiTheme.hairline.opacity(isAgentHistoryRevealButtonHovered ? 0.72 : 0.44),
contactShadow: isAgentHistoryRevealButtonHovered
)
}
.buttonStyle(.plain)
.scaleEffect(isAgentHistoryRevealButtonHovered ? 1.015 : 1)
Expand Down Expand Up @@ -2119,12 +2116,13 @@ private struct AgentSelectionAttachmentPill: View {
.padding(.leading, 10)
.padding(.trailing, 6)
.frame(height: 28)
.background(WeiBeiTheme.paperRaised.opacity(pillHovering ? 0.72 : 0.54))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperRaised.opacity(pillHovering ? 0.72 : 0.54),
stroke: WeiBeiTheme.hairline.opacity(pillHovering ? 0.68 : 0.38),
cornerRadius: 8,
contactShadow: pillHovering
)
.clipShape(RoundedRectangle(cornerRadius: 8))
.overlay {
RoundedRectangle(cornerRadius: 8)
.stroke(WeiBeiTheme.hairline.opacity(pillHovering ? 0.68 : 0.38), lineWidth: 1)
}
.accessibilityLabel(Text(store.ui("\(interaction.selectionAttachments.count) 个已选文本片段", "\(interaction.selectionAttachments.count) selected text fragments")))
.help(store.ui("悬停查看选区", "Hover to preview selections"))
}
Expand Down Expand Up @@ -2220,12 +2218,12 @@ private struct AgentSelectionAttachmentPill: View {
.padding(.leading, 1)
}
.padding(9)
.background(WeiBeiTheme.paperInset.opacity(0.32))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperInset.opacity(0.32),
stroke: WeiBeiTheme.hairline.opacity(0.36),
cornerRadius: 7
)
.clipShape(RoundedRectangle(cornerRadius: 7))
.overlay {
RoundedRectangle(cornerRadius: 7)
.stroke(WeiBeiTheme.hairline.opacity(0.36), lineWidth: 1)
}
}

private func setPillHovering(_ value: Bool) {
Expand Down Expand Up @@ -2938,17 +2936,14 @@ private struct SelectionFloatChrome: ViewModifier {
content
.foregroundColor(WeiBeiTheme.ink)
.background {
RoundedRectangle(cornerRadius: expanded ? 12 : 9, style: .continuous)
.fill(WeiBeiTheme.paperRaised.opacity(0.98))
WeiBeiEtchedBackdrop(
shape: RoundedRectangle(cornerRadius: expanded ? 12 : 9, style: .continuous),
fill: WeiBeiTheme.paperRaised.opacity(0.98),
stroke: WeiBeiTheme.hairline.opacity(0.65),
showsContactShadow: true
)
}
.clipShape(RoundedRectangle(cornerRadius: expanded ? 12 : 9, style: .continuous))
.overlay {
RoundedRectangle(cornerRadius: expanded ? 12 : 9, style: .continuous)
.strokeBorder(
WeiBeiTheme.hairline.opacity(0.65),
lineWidth: 1
)
}
.shadow(color: WeiBeiTheme.ink.opacity(0.06), radius: 8, y: 3)
}
}
Expand Down Expand Up @@ -3846,12 +3841,12 @@ private struct AgentReplyActionCard: View {
alignment: .leading
)
.background {
RoundedRectangle(cornerRadius: 10, style: .continuous)
.fill(WeiBeiTheme.paperRaised.opacity(0.82))
}
.overlay {
RoundedRectangle(cornerRadius: 10, style: .continuous)
.strokeBorder(WeiBeiTheme.hairline.opacity(0.58), lineWidth: 1)
WeiBeiEtchedBackdrop(
shape: RoundedRectangle(cornerRadius: 10, style: .continuous),
fill: WeiBeiTheme.paperRaised.opacity(0.82),
stroke: WeiBeiTheme.hairline.opacity(0.58),
showsContactShadow: true
)
}
}

Expand Down Expand Up @@ -4032,7 +4027,11 @@ private struct AgentReplyActionCard: View {
.lineLimit(1)
.padding(.horizontal, 8)
.frame(height: 28)
.background(WeiBeiTheme.paperInset.opacity(0.34))
.weibeiEtchedBackground(
fill: WeiBeiTheme.paperInset.opacity(0.34),
stroke: WeiBeiTheme.hairline.opacity(0.3),
cornerRadius: 6
)
.clipShape(RoundedRectangle(cornerRadius: 6))
}

Expand Down
Loading