mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-25 03:04:26 +08:00
Migrate to Avalonia 12 and Plugin SDK v5
Upgrade project to the Avalonia 12 baseline and Plugin SDK v5: centralize Avalonia packages, remove legacy WebView.Avalonia usage (use NativeWebView/WebView2 EnvironmentRequested), and update Fluent/Material icon/package usages. Bump multiple package/project versions to 5.0.0 and Avalonia 12.0.1, update plugin template and README/docs to SDK v5, and add PLUGIN_SDK_V5_MIGRATION.md. Also fix runtime/behavior bugs: make DataLocationResolver use a fixed bootstrap launcher data path and avoid recursive ResolveDataRoot; add legacy-state handling and extraction in OobeStateService; and update component settings tests to reflect migrated storage (DB/backup) and reset cache for test reloads. Various csproj, tests, and docs updated to reflect the migration and ensure build/test compatibility.
This commit is contained in:
@@ -1,63 +1,49 @@
|
||||
# Avalonia 12 迁移规格
|
||||
# Avalonia 12 Full Stack Migration
|
||||
|
||||
## Why
|
||||
## Summary
|
||||
|
||||
Avalonia 12 带来性能改进(SkiaSharp 3.0、编译绑定默认开启)、新的窗口装饰体系(WindowDrawnDecorations)和更简洁的 API 设计。项目当前已升级包引用,但存在 18 个编译错误和若干过时 API 警告,需要系统性修复以确保构建通过。
|
||||
LanMountainDesktop has moved its desktop stack to the Avalonia 12 baseline. The migration covers the main host, Launcher, Plugin SDK, plugin runtime loading policy, official WebView usage, ClassIsland Markdown, FluentAvalonia, FluentIcons, and Material-related dependencies.
|
||||
|
||||
## What Changes
|
||||
## Requirements
|
||||
|
||||
- **BREAKING**: 移除 `ExtendClientAreaChromeHints` 和 `SystemDecorations` 的使用,迁移到 `WindowDecorations`
|
||||
- **BREAKING**: 移除 `BindingPlugins.DataValidators` 的使用(v12 已移除绑定插件体系)
|
||||
- **BREAKING**: 替换 `IClipboard.SetTextAsync` 为 `ClipboardExtensions.SetTextAsync`
|
||||
- **BREAKING**: 更新 `Bitmap.CopyPixels` 调用签名(移除 `AlphaFormat` 参数)
|
||||
- **BREAKING**: 替换 `FluentIcons.Avalonia.SymbolIconSource` 为 v3 等效 API
|
||||
- 修复 `MainWindow.ComponentSystem.cs` 和 `MainWindow.DesktopPaging.cs` 中缺失的字段/变量
|
||||
- 批量替换 `TextBox.Watermark` → `PlaceholderText`
|
||||
### Requirement: Centralized Avalonia 12 dependency baseline
|
||||
|
||||
## Impact
|
||||
The solution SHALL use central package management for direct Avalonia-facing projects and keep the core UI dependency baseline on Avalonia `12.0.1`.
|
||||
|
||||
- 受影响代码:
|
||||
- `LanMountainDesktop/Views/SettingsWindow.axaml.cs`
|
||||
- `LanMountainDesktop/Views/ComponentEditorWindow.axaml.cs`
|
||||
- `LanMountainDesktop/Views/MainWindow.ComponentSystem.cs`
|
||||
- `LanMountainDesktop/Views/MainWindow.DesktopPaging.cs`
|
||||
- `LanMountainDesktop/App.axaml.cs`
|
||||
- `LanMountainDesktop/Views/Components/DesktopComponentFailureView.cs`
|
||||
- `LanMountainDesktop/Services/MonetColorService.cs`
|
||||
- 13 个 `.axaml` 文件(`SystemDecorations` → `WindowDecorations`)
|
||||
- 7 个 `.cs` 文件 + 7 个 `.axaml` 文件(`Watermark` → `PlaceholderText`)
|
||||
- 受影响规格:无现有规格直接关联
|
||||
Required package baseline:
|
||||
|
||||
## ADDED Requirements
|
||||
- `Avalonia*` `12.0.1`
|
||||
- `Avalonia.Controls.WebView` `12.0.0`
|
||||
- `ClassIsland.Markdown.Avalonia` `12.0.0`
|
||||
- `FluentAvaloniaUI` `3.0.0-preview1`
|
||||
- `FluentIcons.Avalonia` `2.1.325`
|
||||
- `Material.Avalonia` `3.16.0`
|
||||
- `Material.Icons.Avalonia` `3.0.2`
|
||||
|
||||
### Requirement: 窗口装饰 API 迁移
|
||||
系统 SHALL 使用 Avalonia 12 的 `WindowDecorations` 属性替代已移除的 `SystemDecorations` 和 `ExtendClientAreaChromeHints`。
|
||||
### Requirement: Official WebView
|
||||
|
||||
#### Scenario: SettingsWindow 无边框模式
|
||||
- **WHEN** `ApplyChromeMode(false)` 被调用
|
||||
- **THEN** `WindowDecorations = WindowDecorations.BorderOnly` 且 `ExtendClientAreaToDecorationsHint = true`
|
||||
The host SHALL use `Avalonia.Controls.NativeWebView` for the browser widget and SHALL NOT reference `WebView.Avalonia`, `AvaloniaWebView`, or `.UseDesktopWebView()`.
|
||||
|
||||
#### Scenario: SettingsWindow 系统 Chrome 模式
|
||||
- **WHEN** `ApplyChromeMode(true)` 被调用
|
||||
- **THEN** `WindowDecorations = WindowDecorations.Full` 且 `ExtendClientAreaToDecorationsHint = true`
|
||||
Windows WebView2 user data configuration SHALL be supplied through `EnvironmentRequested` using `WindowsWebView2EnvironmentRequestedEventArgs.UserDataFolder`.
|
||||
|
||||
### Requirement: 剪贴板 API 迁移
|
||||
系统 SHALL 使用 Avalonia 12 的 `ClipboardExtensions.SetTextAsync` 替代已移除的 `IClipboard.SetTextAsync`。
|
||||
### Requirement: Plugin SDK v5
|
||||
|
||||
### Requirement: Bitmap.CopyPixels 签名更新
|
||||
系统 SHALL 使用新的 `CopyPixels` 签名,不再传入 `AlphaFormat` 参数。
|
||||
The Plugin SDK API baseline SHALL be `5.0.0`. SDK v4 plugins are treated as incompatible until rebuilt.
|
||||
|
||||
### Requirement: FluentIcons v3 API 适配
|
||||
系统 SHALL 使用 `FluentIcons.Avalonia.FluentIcon` 替代已移除的 `SymbolIconSource`。
|
||||
The SDK SHALL keep the existing public UI extension shape, including `SettingsPageBase` and Avalonia `Control` based desktop components.
|
||||
|
||||
## MODIFIED Requirements
|
||||
### Requirement: Launcher data location stability
|
||||
|
||||
### Requirement: 编译绑定验证
|
||||
- **修改前**:`BindingPlugins.DataValidators.RemoveAt(0)` 移除默认数据注解验证插件
|
||||
- **修改后**:v12 默认禁用数据注解验证插件,无需手动移除
|
||||
Launcher data location configuration SHALL be read from a fixed bootstrap Launcher data directory so resolving the selected data root cannot recursively require resolving itself.
|
||||
|
||||
## REMOVED Requirements
|
||||
### Requirement: OOBE state compatibility
|
||||
|
||||
### Requirement: ExtendClientAreaChromeHints 配置
|
||||
**Reason**: Avalonia 12 移除此属性,由 `WindowDecorations` 统一管理
|
||||
**Migration**: 删除所有 `ExtendClientAreaChromeHints` 赋值代码
|
||||
The Launcher SHALL read current OOBE state from the resolved `Launcher/state` directory and SHALL continue to migrate the legacy `.launcher/state/first_run_completed` marker.
|
||||
|
||||
## Acceptance
|
||||
|
||||
- `dotnet build LanMountainDesktop.slnx -c Debug` completes with 0 errors.
|
||||
- `OobeStateServiceTests` pass.
|
||||
- Full `dotnet test LanMountainDesktop.slnx -c Debug` no longer aborts from `DataLocationResolver` recursion.
|
||||
- Plugin template defaults to SDK package version `5.0.0` and manifest `apiVersion` `5.0.0`.
|
||||
- Current developer documentation points to SDK v5 and Avalonia 12.
|
||||
|
||||
Reference in New Issue
Block a user