From 94922b2b9eb3750268d0daf954e3e5d3bd9b009d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=81=E5=86=9C=E9=98=BF=E6=A5=A0?= Date: Tue, 3 Nov 2026 21:04:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor(settings):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=8D=95=E8=89=B2=E4=B8=8B=E6=8B=89=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E5=B9=B6=E6=94=B6=E7=AA=84=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/architecture.md | 2 + docs/settings-tabs-plan.md | 6 ++ .../Settings/AppearanceSettingsView.swift | 65 ++++--------------- 3 files changed, 21 insertions(+), 52 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index a8f2e60..d33ab31 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -246,3 +246,5 @@ GPU 核心数格式文案按面板 SwiftUI locale 通过 AppLocalization 解析 AppKit 场景与面板的语言环境通过 UI 层 `AppLanguageScope` 注入:在 SwiftUI body 内观察 LanguagePreferences,避免在一次性的宿主构造闭包中固定 locale。设置容器的语言变化回调重建原生主菜单,保留当前设置页及进程搜索等视图状态。 悬浮提示收敛为操作用途、输入约束及精确数据读取。进程标题不再承载覆盖计数/采样语义说明,资源卡片不再接受 statusHelp;长篇指标解释及重复标签不通过 help 展示,图表数据悬浮层保持原有实现。 + +设置中的外观/语言菜单 Picker 使用局部 primary tint(深浅模式的黑白灰),其余交互默认蓝色;设置内容宽度固定 520pt。已删除外观专用玻璃分段选择器,不改变外观偏好及系统主题解析。 diff --git a/docs/settings-tabs-plan.md b/docs/settings-tabs-plan.md index 198202e..a933da1 100644 --- a/docs/settings-tabs-plan.md +++ b/docs/settings-tabs-plan.md @@ -32,3 +32,9 @@ 前一轮使用独立 NSWindow,不能代表 Settings 场景对 TabView 的系统呈现。现改为 principal 工具栏中的原生分段 Picker,内容按选中页切换,使正式设置场景保持文字胶囊样式。 Debug 构建通过;本轮隔离 app 使用与应用一致的 NSHostingSceneRepresentation + Settings + openSettings 入口加载实际设置源码,AX 确认窗口为 com_apple_SwiftUI_Settings_window,截图确认顶部胶囊及无图标页签,实际点击关于页成功。没有操作用户已有进程。 + +## 紧凑单色选择器 + +外观与语言统一使用原生菜单 Picker,局部 tint 为 primary,随深浅模式呈现黑白灰;删除不再使用的液态外观分段组件和图标映射。设置内容宽度固定 520pt,避免 Settings 场景恢复为过宽窗口。 + +Debug 构建通过;隔离 app 使用实际 Settings 场景及真实源码,实测浅色/深色菜单切换、英文/繁体中文即时切换;截图复核 520pt 下三语标签未截断,英文说明正常换行,选择器无蓝色强调。没有修改用户现有应用及偏好。系统弹出菜单的悬停高亮仍由 macOS 管理。 diff --git a/kymo/Features/Settings/AppearanceSettingsView.swift b/kymo/Features/Settings/AppearanceSettingsView.swift index 9c157df..cadf3ec 100644 --- a/kymo/Features/Settings/AppearanceSettingsView.swift +++ b/kymo/Features/Settings/AppearanceSettingsView.swift @@ -32,7 +32,8 @@ struct AppearanceSettingsView: View { } .background(SettingsWindowLifecycle(title: AppLocalization.string("settings.title", locale: locale), requestID: presentation.requestID)) - .frame(minWidth: 600, idealWidth: 640, minHeight: 420, idealHeight: 460) + .frame(width: 520) + .frame(minHeight: 420, idealHeight: 460) .modifier(AppearanceStyle(preferences: preferences, refreshContentOnChange: true)) } @@ -40,7 +41,15 @@ struct AppearanceSettingsView: View { Form { Section { LabeledContent("appearance.title") { - LiquidAppearancePicker(selection: $preferences.appearance) + Picker("appearance.title", selection: $preferences.appearance) { + ForEach(AppAppearance.allCases) { appearance in + Text(appearance.title).tag(appearance) + } + } + .pickerStyle(.menu) + .labelsHidden() + .fixedSize() + .tint(.primary) } LabeledContent("language.title") { Picker("language.title", selection: $language.language) { @@ -49,8 +58,10 @@ struct AppearanceSettingsView: View { Text(verbatim: "繁體中文").tag(AppLanguage.traditionalChinese) Text(verbatim: "English").tag(AppLanguage.english) } + .pickerStyle(.menu) .labelsHidden() .fixedSize() + .tint(.primary) } } Section { @@ -99,49 +110,6 @@ struct AppearanceSettingsView: View { } } -private struct LiquidAppearancePicker: View { - @Binding var selection: AppAppearance - @Environment(\.accessibilityReduceMotion) private var reduceMotion - @Namespace private var selectionNamespace - - var body: some View { - GlassEffectContainer(spacing: 10) { - HStack(spacing: 4) { - ForEach(AppAppearance.allCases) { appearance in - Button { - // Theme changes must not animate the native tab view / Form hierarchy. - selection = appearance - } label: { - Label(appearance.title, systemImage: appearance.symbol) - .labelStyle(.titleAndIcon) - .font(.system(size: 13, weight: .medium)) - .foregroundStyle(selection == appearance ? .primary : .secondary) - .padding(.horizontal, 11) - .frame(minWidth: 108, minHeight: 34) - .contentShape(.capsule) - .background { - if selection == appearance { - Capsule() - .fill(.clear) - .glassEffect(.regular.interactive(), in: .capsule) - .glassEffectID("appearance-selection", in: selectionNamespace) - .glassEffectTransition(.matchedGeometry) - } - } - } - .buttonStyle(.plain) - .accessibilityAddTraits(selection == appearance ? .isSelected : []) - } - } - .padding(4) - .glassEffect(.regular, in: .capsule) - } - .animation(reduceMotion ? nil : .smooth(duration: 0.24), value: selection) - .accessibilityElement(children: .contain) - .accessibilityLabel(Text("appearance.title")) - } -} - private extension AppAppearance { var title: LocalizedStringKey { switch self { @@ -151,13 +119,6 @@ private extension AppAppearance { } } - var symbol: String { - switch self { - case .system: "circle.lefthalf.filled" - case .light: "sun.max.fill" - case .dark: "moon.fill" - } - } } private enum SettingsPage: Hashable {