mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Use MaterialColorSnapshot in appearance flow
Introduce unified material/color spec and tests, and refactor appearance plumbing to use MaterialColorSnapshot as the single source of truth. Add .trae material-color-service spec/checklist/tasks and integration/unit tests for plugin mapping and appearance VM behavior. AppearanceChangedEvent extended with new appearance change flags and HasChanged logic. ComponentEditorMaterialThemeAdapter rewritten to accept MaterialColorSnapshot and derive palette from snapshot data. Simplify AppearanceSettingsPageViewModel and related view code: remove legacy preview/custom-seed UI logic, preserve material/color fields when updating theme or corner radius, and update save calls to use with-expressions. Update ComponentEditorWindow to use adapter-provided OnPrimary brush and minor docs updates.
This commit is contained in:
12
.trae/specs/material-color-service/checklist.md
Normal file
12
.trae/specs/material-color-service/checklist.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Material Color Service Acceptance Checklist
|
||||
|
||||
- [x] `dotnet build LanMountainDesktop.slnx -c Debug` succeeds.
|
||||
- [x] `dotnet test LanMountainDesktop.slnx -c Debug` succeeds.
|
||||
- [x] Material & Color page exposes color source, wallpaper source, system material, native event preference, polling interval, manual refresh, semantic color preview, and surface preview.
|
||||
- [x] Appearance page no longer owns duplicate visible color/material controls.
|
||||
- [x] Appearance page view model preserves Material & Color settings instead of rewriting them.
|
||||
- [x] Component corner-radius settings preserve Material & Color fields instead of resetting them through old positional constructors.
|
||||
- [x] Component editor receives colors from `MaterialColorSnapshot`.
|
||||
- [x] Plugin SDK snapshot includes read-only color/material fields without breaking the existing constructor shape.
|
||||
- [x] Wallpaper source selection supports auto, app, and system modes.
|
||||
- [x] Native wallpaper event monitoring can be disabled and polling remains available.
|
||||
62
.trae/specs/material-color-service/spec.md
Normal file
62
.trae/specs/material-color-service/spec.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Material Color Service
|
||||
|
||||
## Goal
|
||||
|
||||
Unify Monet seed extraction, wallpaper color extraction, semantic color roles, host material surfaces, and plugin appearance snapshots behind one host-owned material/color source of truth.
|
||||
|
||||
## Scope
|
||||
|
||||
- Host service: `IMaterialColorService`
|
||||
- Compatibility facade: `IAppearanceThemeService`
|
||||
- Settings page: `MaterialColorSettingsPage`
|
||||
- Persisted settings:
|
||||
- `ThemeColorMode`
|
||||
- `ThemeColor`
|
||||
- `SelectedWallpaperSeed`
|
||||
- `SystemMaterialMode`
|
||||
- `ThemeWallpaperColorSource`
|
||||
- `UseNativeWallpaperChangeEvents`
|
||||
- `SystemWallpaperRefreshIntervalSeconds`
|
||||
- Plugin read-only appearance snapshot fields:
|
||||
- accent color
|
||||
- seed color
|
||||
- color source
|
||||
- system material mode
|
||||
- semantic color roles
|
||||
- material surfaces
|
||||
- wallpaper seed candidates
|
||||
|
||||
## Behavior
|
||||
|
||||
`IMaterialColorService` owns the live `MaterialColorSnapshot`. Consumers should derive colors and material values from this snapshot instead of recalculating from raw theme settings, wallpaper settings, or `MonetPalette`.
|
||||
|
||||
Supported color sources:
|
||||
|
||||
- `default_neutral`: stable neutral surfaces with the default accent.
|
||||
- `seed_monet`: user-selected seed color processed through Monet.
|
||||
- `wallpaper_monet`: wallpaper colors processed through Monet.
|
||||
|
||||
Wallpaper color source selection:
|
||||
|
||||
- `auto`: app wallpaper or app solid color first, then system wallpaper, then fallback.
|
||||
- `app`: app wallpaper or app solid color only, then fallback.
|
||||
- `system`: system wallpaper only, then fallback.
|
||||
|
||||
System wallpaper monitoring:
|
||||
|
||||
- Native Windows user preference events are preferred when enabled and available.
|
||||
- Polling remains active as the fallback path.
|
||||
- Manual refresh clears cached wallpaper candidates and rebuilds the snapshot.
|
||||
|
||||
## Refactor Rules
|
||||
|
||||
- New consumers must depend on `IMaterialColorService`, not on parallel combinations of theme settings, wallpaper settings, and `MonetColorService`.
|
||||
- `MonetColorService` remains the extraction/palette utility, not the application-wide coordinator.
|
||||
- Component/editor/plugin appearance code must consume `MaterialColorSnapshot` or a mapper produced from it.
|
||||
- Existing `IAppearanceThemeService` remains available for compatibility, but it must not become a second source of truth.
|
||||
|
||||
## Out Of Scope
|
||||
|
||||
- Plugin write access to global host appearance settings.
|
||||
- Market metadata or sample plugin changes.
|
||||
- Replacing the wallpaper picker page. It remains the asset/source management page.
|
||||
13
.trae/specs/material-color-service/tasks.md
Normal file
13
.trae/specs/material-color-service/tasks.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Material Color Service Tasks
|
||||
|
||||
- [x] Add unified material/color snapshot models and `IMaterialColorService`.
|
||||
- [x] Persist wallpaper color source and native wallpaper event preference.
|
||||
- [x] Add the Material & Color settings page.
|
||||
- [x] Keep Appearance focused on theme mode, window chrome, and corner radius.
|
||||
- [x] Route plugin appearance snapshots through the material/color snapshot.
|
||||
- [x] Route component editor theming through the material/color snapshot.
|
||||
- [x] Remove legacy color/material preview and save logic from the Appearance page view model.
|
||||
- [x] Replace legacy positional `ThemeAppearanceSettingsState` writes with preserving `with` updates where found.
|
||||
- [x] Keep native wallpaper events optional with polling/manual refresh fallback.
|
||||
- [x] Add regression tests for normalization, plugin mapping, and component editor palette mapping.
|
||||
- [ ] Continue retiring legacy direct consumers of raw theme/wallpaper/Monet tuples when they are touched.
|
||||
Reference in New Issue
Block a user