style(mac): hud glass voice overlay
This commit is contained in:
38
apps/macos/Sources/Clawdis/VisualEffectView.swift
Normal file
38
apps/macos/Sources/Clawdis/VisualEffectView.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
struct VisualEffectView: NSViewRepresentable {
|
||||
var material: NSVisualEffectView.Material
|
||||
var blendingMode: NSVisualEffectView.BlendingMode
|
||||
var state: NSVisualEffectView.State
|
||||
var emphasized: Bool
|
||||
|
||||
init(
|
||||
material: NSVisualEffectView.Material,
|
||||
blendingMode: NSVisualEffectView.BlendingMode = .behindWindow,
|
||||
state: NSVisualEffectView.State = .active,
|
||||
emphasized: Bool = false)
|
||||
{
|
||||
self.material = material
|
||||
self.blendingMode = blendingMode
|
||||
self.state = state
|
||||
self.emphasized = emphasized
|
||||
}
|
||||
|
||||
func makeNSView(context _: Context) -> NSVisualEffectView {
|
||||
let view = NSVisualEffectView()
|
||||
view.material = self.material
|
||||
view.blendingMode = self.blendingMode
|
||||
view.state = self.state
|
||||
view.isEmphasized = self.emphasized
|
||||
return view
|
||||
}
|
||||
|
||||
func updateNSView(_ nsView: NSVisualEffectView, context _: Context) {
|
||||
nsView.material = self.material
|
||||
nsView.blendingMode = self.blendingMode
|
||||
nsView.state = self.state
|
||||
nsView.isEmphasized = self.emphasized
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,12 +510,13 @@ private struct VoiceWakeOverlayView: View {
|
||||
.padding(.vertical, 8)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
.strokeBorder(Color.white.opacity(0.12), lineWidth: 1)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
.fill(.regularMaterial)))
|
||||
.background {
|
||||
let shape = RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
VisualEffectView(material: .hudWindow, blendingMode: .behindWindow)
|
||||
.clipShape(shape)
|
||||
.overlay(shape.strokeBorder(Color.white.opacity(0.16), lineWidth: 1))
|
||||
}
|
||||
.shadow(color: Color.black.opacity(0.22), radius: 14, x: 0, y: -2)
|
||||
.onHover { self.isHovering = $0 }
|
||||
|
||||
// Close button rendered above and outside the clipped bubble
|
||||
|
||||
Reference in New Issue
Block a user