# accntech/shad-ui architecture

> Architecture diagram of the GitHub repository accntech/shad-ui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/accntech/shad-ui
- Repository: https://github.com/accntech/shad-ui

## Overview

##### Project Type & Purpose
- ShadUI is an open-source, Avalonia-based Desktop UI component library plus a demo application and packaging project.
- It delivers reusable controls, themes, dialogs, toasts, converters, utilities, and responsive breakpoints, all orchestrated under one solution (ShadUI.sln).

##### Core Components
- **ShadUI Library** (src/ShadUI)
- Controls (Buttons, Cards, DataGrid, etc.)
- Dialogs (DialogHost, DialogBuilder)
- Toasts (ToastBuilder, ToastHost)
- Themes (ShadTheme, Dark/Light, ThemeWatcher)
- Converters (Value converters for bindings)
- Breakpoints (Responsive layout helpers)
- Extensions & Utilities (ControlAssist, AnimationHelpers, etc.)
- Styles (AXAML resource files)
- Enums & Input (support classes)
- **ShadUI.Demo** (src/ShadUI.Demo)
- A desktop client app showcasing every control/feature in an MVVM pattern
- View layer: AXAML files under Views and Controls folders
- ViewModel layer: ViewModels under ViewModels folder
- Converters & Validators for demonstration
- ServiceProvider for dependency injection
- **ShadUI.Package** (src/ShadUI.Package)
- A UWP packaging project (.wapproj + appxmanifest) to publish a Microsoft-Store client
- **CI/CD**
- GitHub Actions workflow to publish the NuGet package (publish-nuget.yml)

##### Component Relationships & Data Flow
- ShadUI.Demo → references → ShadUI Library
- Demo ViewViews (AXAML)  ←data-bind→  ViewModels ←use→ Converters & Validators
- ShadUI Library modules are self-contained: Controls consume Styles/Themes, call DialogManager/ToastManager for overlays, and use Utilities/Extensions internally.
- The Packaging project bundles the Demo as a UWP app for distribution.
- CI/CD automates building ShadUI Library and pushing the NuGet package to nuget.org.

##### Architectural Patterns & Principles
- **Modular Design:** Each functional area (Controls, Dialogs, Themes, etc.) lives in its own namespace and folder.
- **MVVM (in Demo):** Clean separation between Views (AXAML) and ViewModels (C#) with data-binding via Converters.
- **Theming & Styling:** Centralized resource dictionaries (AXAML) that plug into Avalonia’s styling system.
- **Extensibility Points:**
- DialogBuilderExtensions, ToastBuilderExtensions
- Breakpoint services for responsive layouts
- ControlAssist and other attached behavior classes for augmenting Avalonia controls

- Clear, consistent labels on all components.
- Library modules (rectangles with blue outline)
- Demo MVVM layers (stacked green rectangles)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "ShadUI.sln"
        subgraph "ShadUI Library"
            LibraryRoot["ShadUI.csproj"]:::lib
            Controls["Controls"]:::lib
            Dialogs["Dialogs"]:::lib
            Toasts["Toasts"]:::lib
            Themes["Themes"]:::lib
            Styles["Styles (AXAML)"]:::lib
            Converters["Converters"]:::lib
            Breakpoints["Breakpoints"]:::lib
            Extensions["Extensions/Behaviors"]:::lib
            Utilities["Utilities"]:::lib
            Enums["Enums"]:::lib
            Input["Input Helpers"]:::lib
        end
        subgraph "ShadUI.Demo"
            DemoRoot["ShadUI.Demo.csproj"]:::demo
            Views["Views (AXAML)"]:::demo
            DemoControls["Controls"]:::demo
            ViewModels["ViewModels"]:::demo
            DemoConverters["Converters"]:::demo
            Validators["Validators"]:::demo
            DemoThemes["Themes"]:::demo
            Entry["Program.cs & ServiceProvider"]:::demo
        end
        subgraph "ShadUI.Package"
            PackageProj["ShadUI.Package.wapproj"]:::pkg
            Appx["Package.appxmanifest"]:::pkg
            Assets["Images"]:::pkg
        end
    end

    Avalonia["Avalonia UI Framework"]:::ext
    GitHubActions["GitHub Actions Workflow"]:::ext
    NuGet["NuGet.org"]:::ext
    Store["Microsoft Store"]:::ext

    DemoRoot -->|"references"| LibraryRoot
    Views -->|"data-binds"| ViewModels
    ViewModels -->|"uses"| DemoConverters
    ViewModels -->|"uses"| Validators
    ViewModels -->|"uses"| DemoThemes
    Entry -->|"sets up DI"| ViewModels

    Controls -->|"uses themes/styles"| Themes
    Controls -->|"uses themes/styles"| Styles
    Dialogs -->|"calls"| Utilities
    Toasts -->|"calls"| Utilities
    Controls -->|"uses"| Extensions
    Dialogs -->|"uses"| Extensions
    Toasts -->|"uses"| Extensions
    Themes -->|"uses"| Extensions
    Styles -->|"uses"| Extensions
    Converters -->|"uses"| Extensions
    Breakpoints -->|"uses"| Extensions
    Utilities -->|"uses"| Extensions
    Enums -->|"uses"| Extensions
    Input -->|"uses"| Extensions

    GitHubActions -->|"build & publish"| LibraryRoot
    LibraryRoot -->|"publishes to"| NuGet
    PackageProj -->|"bundles Demo"| DemoRoot
    PackageProj -->|"publishes to"| Store
    Avalonia -->|"framework for"| LibraryRoot
    Avalonia -->|"framework for"| DemoRoot

    click LibraryRoot "https://github.com/accntech/shad-ui/blob/main/src/ShadUI/ShadUI.csproj"
    click Controls "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Controls"
    click Dialogs "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Dialogs"
    click Toasts "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Toasts"
    click Themes "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Themes"
    click Styles "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Styles"
    click Converters "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Converters"
    click Breakpoints "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Breakpoints"
    click Extensions "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Extensions"
    click Utilities "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Utilities"
    click Enums "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Enums"
    click Input "https://github.com/accntech/shad-ui/tree/main/src/ShadUI/Input"
    click DemoRoot "https://github.com/accntech/shad-ui/blob/main/src/ShadUI.Demo/ShadUI.Demo.csproj"
    click Views "https://github.com/accntech/shad-ui/tree/main/src/ShadUI.Demo/Views"
    click DemoControls "https://github.com/accntech/shad-ui/tree/main/src/ShadUI.Demo/Controls"
    click ViewModels "https://github.com/accntech/shad-ui/tree/main/src/ShadUI.Demo/ViewModels"
    click DemoConverters "https://github.com/accntech/shad-ui/tree/main/src/ShadUI.Demo/Converters"
    click Validators "https://github.com/accntech/shad-ui/tree/main/src/ShadUI.Demo/Validators"
    click DemoThemes "https://github.com/accntech/shad-ui/tree/main/src/ShadUI.Demo/Themes"
    click Entry "https://github.com/accntech/shad-ui/blob/main/src/ShadUI.Demo/Program.cs"
    click PackageProj "https://github.com/accntech/shad-ui/blob/main/src/ShadUI.Package/ShadUI.Package.wapproj"
    click Appx "https://github.com/accntech/shad-ui/blob/main/src/ShadUI.Package/Package.appxmanifest"
    click Assets "https://github.com/accntech/shad-ui/tree/main/src/ShadUI.Package/Images"
    click GitHubActions "https://github.com/accntech/shad-ui/blob/main/.github/workflows/publish-nuget.yml"

    classDef lib fill:#add8e6,stroke:#1f77b4,color:#fff
    classDef demo fill:#98fb98,stroke:#2ca02c,color:#fff
    classDef pkg fill:#ffa500,stroke:#d2691e,color:#fff
    classDef ext fill:#d3d3d3,stroke:#696969,color:#000
```
