perf(ui): 移除监控动效并精简原生图表绘制

This commit is contained in:
2026-11-07 14:39:27 +08:00
parent 10c73c6026
commit 80706fa52e
54 changed files with 264 additions and 778 deletions
@@ -24,19 +24,16 @@ import Observation
private let visibility: (Bool) -> Void
private let menuTitle: (String) -> String
private let openSettings: () -> Void
private let reducedMotion: () -> Bool
private var showingStatusMenu = false
private var isHiding = false
init<Content: View>(installStatusItem: Bool = true, visibility: @escaping (Bool) -> Void,
menuTitle: @escaping (String) -> String = { $0 },
openSettings: @escaping () -> Void = {},
reducedMotion: @escaping () -> Bool = { false },
@ViewBuilder content: @escaping (PanelPresentation) -> Content) {
self.visibility = visibility
self.menuTitle = menuTitle
self.openSettings = openSettings
self.reducedMotion = reducedMotion
self.content = {
let host = NSHostingView(rootView: content($0))
// The controller owns the fixed panel frame; content must not negotiate window limits.
@@ -48,7 +45,8 @@ import Observation
panel.isReleasedWhenClosed = false
panel.isOpaque = false
panel.backgroundColor = .clear
panel.hasShadow = true
panel.hasShadow = false
panel.animationBehavior = .none
panel.hidesOnDeactivate = false
panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
panel.dismiss = { [weak self] in self?.hide() }
@@ -115,12 +113,7 @@ import Observation
return window.convertToScreen(button.convert(button.bounds, to: nil)).contains(screenPoint)
}
private func applyWindowMotion() {
panel.animationBehavior = reducedMotion() || NSWorkspace.shared.accessibilityDisplayShouldReduceMotion ? .none : .default
}
func show() {
applyWindowMotion()
guard !panel.isVisible else { panel.makeKeyAndOrderFront(nil); return }
place()
presentation.isOpen = true
@@ -144,7 +137,6 @@ import Observation
isHiding = true
defer { isHiding = false }
presentation.isOpen = false
applyWindowMotion()
panel.orderOut(nil)
#if DEBUG || KYMO_AUDIT
if let content = panel.contentView { lastHiddenContent = content }