feat(panel): 调整资源卡片读数布局并保留趋势平移

逐核显示 CPU 占用,在 GPU 标题展示核数并补充分项读数。无电池设备显示整机功率。

存储与网络将曲线排在详情下方,CPU、GPU、内存和电池保留整卡趋势。数值直接刷新,曲线随采样平滑平移。顶栏展示版本号,底栏调整开机时间和刷新间隔。
This commit is contained in:
2026-11-15 22:03:46 +08:00
parent c886c4227d
commit 6300db3d15
27 changed files with 427 additions and 250 deletions
+22 -2
View File
@@ -1,9 +1,15 @@
import SwiftUI
/// Metrics change only when a new sample is published; no numeric transition or spring.
extension EnvironmentValues {
@Entry var panelMotionActive: Bool = true
}
struct MetricText: View {
let value: String
var body: some View { Text(verbatim: value).monospacedDigit() }
var body: some View {
Text(verbatim: value).monospacedDigit()
}
}
struct PanelCardBackground: ViewModifier {
@@ -13,3 +19,17 @@ struct PanelCardBackground: ViewModifier {
content.background(RoundedRectangle(cornerRadius: radius).fill(Color("PanelCard")))
}
}
struct InlineMetric: View {
let title: LocalizedStringKey
let value: String
init(_ title: LocalizedStringKey, _ value: String) { self.title = title; self.value = value }
var body: some View {
HStack(spacing: 4) {
Text(title).foregroundStyle(.secondary)
MetricText(value: value).fontWeight(.medium)
}
.font(.system(size: 10)).lineLimit(1)
}
}