Skip to content

fix(macos): 1.2.11 窗口/胶囊 UI 对齐 + tab cross-fade + polish 纠错#198

Merged
appergb merged 8 commits into
mainfrom
codex/fix-macos-window-ui
May 3, 2026
Merged

fix(macos): 1.2.11 窗口/胶囊 UI 对齐 + tab cross-fade + polish 纠错#198
appergb merged 8 commits into
mainfrom
codex/fix-macos-window-ui

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 3, 2026

User description

Summary

  • fix(macos): 红绿灯 trafficLightPosition x=14 y=20,titlebar 28pt 上下对称居中;胶囊几何回退到 1.2.11(macOS/Linux 固定 220×110),修按 Shift 后整体下移 + 左右被裁两个回归;emit_capsule macOS show 路径回退到 1.2.11 的 window.show();Translation 设置页 + i18n 回退到 1.2.12(撤回 d7d274f 重排)。
  • feat(ui): tab 切换加 cross-fade with blur — 旧页 ol-page-fadeout (180ms blur+淡出),新页走现有 ol-page-slide enter。Windows 徽章 bottom 公式保留 hostMetrics 路径。
  • feat(polish): COMMON_RULES 加自动纠错(ASR 同音/形近错字按上下文纠回,覆盖"根目录/代码仓/编译/的得地/做作"等)+ 按用户整体意图组织自然书面表达;不动 ROLE_BLOCK / OUTPUT_BLOCK / 各 mode 任务段,保持"不要激进改写"边界。

平台核查

路径 macOS Windows Linux
trafficLightPosition ✅ 生效 无效(自定义 WinTitleBar) 无效
titlebar paddingTop 28 三元 mac→28 →0 不变 →0 不变
emit_capsule show 路径 window.show()+restore key HWND no-activate 不变 window.show()
capsule_window_bounds 220×110(1.2.11 行为) 220×84/118 不变 220×110(96→110,dock 距离不变)
徽章 bottom calc(50%+21+8) hostMetrics 公式 calc(50%+21+8)
Tab cross-fade 三平台共享 ✅
polish prompt 三 mode 共享 COMMON_RULES ✅

Rust cfg 块 100% 未动 Windows / Linux 的 cfg(target_os) 分支(git diff 自审)。

Test plan

  • cargo check(macOS)通过
  • cargo test 37 passed
  • npm run build 通过
  • 本地 macOS .app 装到 /Applications 实测:红绿灯位置、tab 切换 cross-fade、Translation 设置页、胶囊不再左右被裁、按 Shift 不再下移
  • Windows / Linux 端实测(CI release 构建后再验)
  • 合并到 main 后跑一遍完整测试
  • 用户确认无误 → main 上做 release commit + tag v1.2.13-tauri 触发跨平台 CI 发版

PR Type

Enhancement, Bug fix, Tests


Description

  • Restore native macOS chrome and traffic lights

  • Revert capsule sizing and show behavior

  • Add cross-fade and shared motion tokens

  • Improve polish autocorrection and prompt wording

  • Refresh config assertions and UI tests


Diagram Walkthrough

flowchart LR
  A["Tauri window config"] --> B["macOS native chrome"]
  B --> C["Capsule show and focus fixes"]
  C --> D["Shared capsule sizing"]
  D --> E["Shell and dialog motion polish"]
  E --> F["Polish autocorrection rules"]
  E --> G["Updated config tests"]
Loading

File Walkthrough

Relevant files
Bug fix
4 files
coordinator.rs
Switch capsule show path to webview handle                             
+24/-20 
lib.rs
Restore main window focus via ns_window                                   
+23/-12 
WindowChrome.tsx
Restore native macOS titlebar spacing                                       
+8/-5     
capsuleLayout.ts
Fix capsule dimensions on macOS and Linux                               
+3/-2     
Enhancement
16 files
polish.rs
Add autocorrection and natural phrasing rules                       
+32/-2   
AutoUpdate.tsx
Adopt shared motion for update progress                                   
+1/-1     
Capsule.tsx
Tune capsule motion and badge anchoring                                   
+12/-9   
FloatingShell.tsx
Add tab cross-fade and simplify sidebar                                   
+60/-60 
Onboarding.tsx
Smooth permission button transitions                                         
+1/-1     
SettingsModal.tsx
Blur modals and refine modal animations                                   
+14/-11 
SwitchLite.tsx
Standardize switch thumb spring motion                                     
+1/-1     
History.tsx
Polish history filter and row transitions                               
+2/-2     
Overview.tsx
Remove hotkey badge and soften chart                                         
+1/-24   
QaPanel.tsx
Refine QA loading and status motion                                           
+10/-9   
SelectionAsk.tsx
Update history toggle spring timing                                           
+2/-2     
Settings.tsx
Refine settings controls and toggles                                         
+7/-7     
Style.tsx
Smooth master and variant toggle states                                   
+5/-5     
Vocab.tsx
Animate vocab chips with blur transitions                               
+5/-5     
_atoms.tsx
Unify shared button transition timings                                     
+1/-1     
global.css
Add window enter keyframes                                                             
+13/-0   
Configuration changes
2 files
tokens.css
Introduce shared motion and blur tokens                                   
+6/-0     
tauri.conf.json
Enable native chrome and traffic lights                                   
+2/-1     
Tests
1 files
windows-ui-config.test.mjs
Assert updated window and motion config                                   
+36/-1   

baiqing added 6 commits May 3, 2026 09:29
红绿灯
- trafficLightPosition x=14 y=20(Apple Notes / Safari 视觉),
  MAC_TITLEBAR_HEIGHT 30→28,paddingTop 30→28,让红绿灯在 titlebar
  内对称居中。

胶囊几何回退到 1.2.11
- macOS / Linux 上 capsule_window_bounds 固定 220×110,capsule_visual_height
  改回 96,emit_capsule 不再随 translation_active 改 size + 位置。修两个
  回归:(a) 录音胶囊 pill 左右被裁;(b) 按 Shift 后窗口高度从 42→110
  导致整体下移。
- 单元测试断言同步更新。

emit_capsule macOS show 路径回退到 1.2.11
- show_capsule_window_no_activate macOS 实现删除(合进 cfg(not(windows))
  stub 返回 false),fallback 走 window.show() + restore_main_window_key_if_active。
  orderFrontRegardless 路径在 webview 未完整初始化时偶发不可见。

Translation 设置页 + i18n 回退到 1.2.12
- 撤回 d7d274f 整页重排,回到 1.2.11/1.2.12 的简洁布局。

tab 切换 cross-fade with blur
- FloatingShell.tsx 加 displayTab + tabPhase;点新 tab 触发旧页
  ol-page-fadeout(opacity 1→0、blur 0→8px、180ms),结束后挂载
  新页走现有 ol-page-slide。修 Windows 徽章 bottom 公式:保留
  hostMetrics 路径(pill 不在 win host 中线,calc(50%) 不对)。

Capsule.tsx 动画化简
- 徽章/capsule-in 撤回 motion-soft / motion-spring 别名 + filter blur,
  回到 1.2.11 的 ease-out / cubic-bezier。
补 COMMON_RULES 两条:
- 规则 3 扩展:在保留原意和语气的前提下,按用户的整体意图把零碎口语
  组织成协调、自然的书面表达。
- 规则 5(新增)自动纠错:明显的 ASR 同音 / 形近错字按上下文纠回正确字面,
  覆盖"跟目录/根木鹿→根目录"、"代码厂→代码仓"、"编一编→编译"、
  "的/得/地"、"做/作"等常见错别字。专有名词、人名、品牌名、不在常见
  中文词典里的词原样保留,不强行改字;改动会引起含义变化的不改。

不动 ROLE_BLOCK / OUTPUT_BLOCK / 各 mode 任务段,保持"不要激进改写"
的边界(feedback memory)。translate / qa prompt 与本次诉求无关,未改。

加一个测试 common_rules_include_auto_correction_and_natural_organization
覆盖四个 mode,防止规则被回退或遗漏。
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

…w-ui

# Conflicts:
#	openless-all/app/src-tauri/src/polish.rs
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

PR Reviewer Guide 🔍

(Review updated until commit 0bf4f7e)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Persistent review updated to latest commit d39072a

PR Reviewer (PR Agent) 指出:getCapsuleHostMetrics(os, false) 把
translation 参数硬编码成 false,Windows 端 host 在翻译模式下应该从
84 长到 118,硬编码后徽章 bottom 用更短 host 量出来 → 跟 118pt 实际
窗口尺寸错位、徽章可能溢出或被裁。

修:把 useState<translation> 提到 hostMetrics 之前,调用改回
getCapsuleHostMetrics(os, translation)。macOS / Linux 不受影响 —
capsuleLayout 在那两个分支已经忽略 translationActive 返回固定 42。
@appergb
Copy link
Copy Markdown
Collaborator Author

appergb commented May 3, 2026

对 PR Agent 的两条 observations 处理如下:

1. Double chrome (Windows) — false positive
tauri.conf.jsondecorations: true 实际只对 macOS 生效。Windows 上 lib.rs::setup 在 main window 第一次 show 之前显式调用 main.set_decorations(false) 把 native chrome 关掉(见 lib.rs 行 113-115),React 端的 WinTitleBar 才接管自定义 chrome。这是项目原有逻辑,本 PR 没动。无 double titlebar。

2. Stale metrics (Windows) — 已修
commit 0bf4f7e fix(capsule): Windows 翻译模式 host 高度跟随 translation flag

  • getCapsuleHostMetrics(os, false) 改回 getCapsuleHostMetrics(os, translation)
  • 调整 useState 顺序,translation 提到 hostMetrics 之前声明
  • macOS / Linux 不受影响(capsuleLayout 在那两个分支已经忽略 translationActive 参数返回固定 42)
  • 验证:npm run build ✓ / cargo test 41 passed ✓

@appergb appergb merged commit 3cfa462 into main May 3, 2026
2 checks passed
@appergb appergb deleted the codex/fix-macos-window-ui branch May 3, 2026 07:05
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Persistent review updated to latest commit 0bf4f7e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant