Files
ui/docs/architecture/unified-project-structure.md
2025-10-16 15:08:42 +08:00

6.8 KiB
Raw Blame History

Unified Project Structure

基于 Monorepo 策略和 .NET 项目组织最佳实践,以下是详细的项目文件结构:

D:\32_avalonia.ui/
├── .github/                              # GitHub 工作流Post-MVP
│   └── workflows/
│       ├── ci.yml                        # 持续集成
│       └── release.yml                   # 发布流程
│
├── src/                                  # 源代码目录
│   ├── Penguin.AvaloniaUI/              # 核心控件库项目
│   │   ├── Controls/                     # 业务场景控件
│   │   │   ├── PropertyGrid/
│   │   │   │   ├── PropertyGrid.cs       # 主控件类
│   │   │   │   ├── PropertyItem.cs       # 数据模型
│   │   │   │   ├── PropertyEditorFactory.cs  # 编辑器工厂
│   │   │   │   └── Themes/
│   │   │   │       ├── PropertyGrid.axaml     # 默认模板
│   │   │   │       └── PropertyGrid.axaml.cs
│   │   │   ├── UserGuide/
│   │   │   │   ├── UserGuide.cs
│   │   │   │   ├── GuideStep.cs
│   │   │   │   ├── Overlay.cs
│   │   │   │   ├── RichTooltip.cs
│   │   │   │   └── Themes/
│   │   │   │       ├── UserGuide.axaml
│   │   │   │       ├── Overlay.axaml
│   │   │   │       └── RichTooltip.axaml
│   │   │   └── ... (其他控件)
│   │   │
│   │   ├── Layouts/                      # 布局控件
│   │   │   ├── TwoColumnLayout.cs
│   │   │   └── Themes/
│   │   │       └── TwoColumnLayout.axaml
│   │   │
│   │   ├── Themes/                       # 主题系统
│   │   │   ├── ThemeManager.cs           # 主题管理器
│   │   │   ├── ThemeInfo.cs              # 主题信息模型
│   │   │   ├── ColorSystem/              # 颜色系统定义
│   │   │   │   ├── LightColors.axaml     # 浅色主题颜色
│   │   │   │   └── DarkColors.axaml      # 暗色主题颜色
│   │   │   ├── LightTheme.axaml          # 浅色主题资源
│   │   │   └── DarkTheme.axaml           # 暗色主题资源
│   │   │
│   │   ├── Utils/                        # 工具类
│   │   │   ├── Converters/               # 值转换器
│   │   │   │   ├── BoolToVisibilityConverter.cs
│   │   │   │   └── TypeToEditorConverter.cs
│   │   │   ├── Helpers/                  # 辅助类
│   │   │   │   ├── ReflectionHelper.cs   # 反射工具
│   │   │   │   └── ValidationHelper.cs   # 验证工具
│   │   │   └── Extensions/               # 扩展方法
│   │   │       └── ObservableExtensions.cs
│   │   │
│   │   ├── Assets/                       # 资源文件
│   │   │   └── Icons/                    # 图标资源
│   │   │
│   │   ├── Penguin.AvaloniaUI.csproj     # 项目文件
│   │   └── AssemblyInfo.cs               # 程序集信息
│   │
│   ├── Penguin.AvaloniaUI.SourceGenerators/  # Source GeneratorPost-MVP
│   │   ├── PropertyGridGenerator.cs
│   │   └── Penguin.AvaloniaUI.SourceGenerators.csproj
│   │
│   ├── Example/                          # 示例应用项目
│   │   ├── App.axaml                     # 应用程序资源
│   │   ├── App.axaml.cs
│   │   ├── ViewModels/                   # 视图模型
│   │   │   ├── MainWindowViewModel.cs
│   │   │   ├── PropertyGridDemoViewModel.cs
│   │   │   └── UserGuideDemoViewModel.cs
│   │   ├── Views/                        # 视图/页面
│   │   │   ├── MainWindow.axaml
│   │   │   ├── MainWindow.axaml.cs
│   │   │   ├── Pages/
│   │   │   │   ├── ColorSystemPage.axaml       # 颜色系统演示
│   │   │   │   ├── PropertyGridPage.axaml     # PropertyGrid 演示
│   │   │   │   ├── UserGuidePage.axaml        # UserGuide 演示
│   │   │   │   └── ComprehensiveDemoPage.axaml  # 综合演示
│   │   │   └── ...
│   │   ├── Models/                       # 测试数据模型
│   │   │   ├── DemoSettings.cs           # PropertyGrid 测试类
│   │   │   └── LargeSettings.cs          # 50 属性测试类
│   │   ├── Assets/                       # 示例应用资源
│   │   ├── Example.csproj
│   │   └── Program.cs
│   │
│   └── Penguin.AvaloniaUI.Tests/        # 单元测试项目
│       ├── Controls/
│       │   ├── PropertyGridTests.cs
│       │   ├── UserGuideTests.cs
│       │   └── ...
│       ├── Layouts/
│       │   └── TwoColumnLayoutTests.cs
│       ├── Themes/
│       │   └── ThemeManagerTests.cs
│       ├── Utils/
│       │   └── ReflectionHelperTests.cs
│       └── Penguin.AvaloniaUI.Tests.csproj
│
├── docs/                                 # 项目文档
│   ├── prd.md                            # 产品需求文档
│   ├── architecture.md                   # 架构文档(本文档)
│   ├── brief.md                          # 项目简介
│   └── brainstorm.md                     # 头脑风暴
│
├── .bmad-core/                          # BMAD 框架配置
│   ├── core-config.yaml
│   ├── agents/
│   ├── tasks/
│   └── templates/
│
├── .editorconfig                        # 编辑器配置
├── .gitignore                           # Git 忽略规则
├── Directory.Packages.props             # 统一包版本管理
├── README.md                            # 项目说明
├── LICENSE                              # 许可证Post-MVP
└── Penguin.AvaloniaUI.sln              # 解决方案文件

关键目录说明:

目录 用途 命名空间
Controls/ 业务场景控件实现 Penguin.AvaloniaUI.Controls.*
Layouts/ 布局控件实现 Penguin.AvaloniaUI.Layouts
Themes/ 主题和样式系统 Penguin.AvaloniaUI.Themes
Utils/ 工具类和辅助方法 Penguin.AvaloniaUI.Utils.*
Example/Views/Pages/ 示例应用页面 Example.Views.Pages
Example/ViewModels/ 示例应用 ViewModel Example.ViewModels