Component: Smrt.UI¶
Canonical source:
SmrtApps/src/Smrt.UI/README.md(mirrored below)
Smrt.UI¶
Overview & Responsibilities¶
- Shared WinUI 3 resource library consumed by SmrtHub desktop apps (HubWindow, Supervisor surfaces, etc.).
- Provides canonical theme dictionaries, typography, iconography, and helper services so experiences stay visually consistent.
- Ships as a WinUI class library; consuming apps add
Smrt.UIas a project reference and merge the exported ResourceDictionaries at runtime.
Dependencies & Integrations¶
- Targets
net8.0-windows10.0.19041.0with WinUI 3 enabled; the Windows App SDK package version is centrally managed viaDirectory.Packages.props. - Theme selection logic surfaces through
Smrt.UI.Services.IThemeService; consuming apps resolve and apply the URIs toApplication.Resources. - When updating assets or tokens, follow
README.Files/System/Policies/SmrtHub-Asset-Policy.README.md(do not inline policy specifics here).
Configuration & Log Paths¶
- The library has no runtime configuration or logging needs. Applications integrating it should continue to manage state with
Smrt.Configand emit telemetry throughSmrtHub.Loggingunder their own component slugs.
Observability and diagnostics¶
- This library does not initialize logging; hosts log theme selection/apply events under their own component slugs when needed.
Support Bundle¶
- Not applicable directly (library); collect host application logs via Support Bundle.
Related docs¶
- Token generator: SmrtApps/src/Smrt.Tools.TokenGen/README.md
- HubWindow: SmrtApps/CSApps/HubWindow/README.md
- Documentation policy:
README.Files/System/Policies/SmrtHub-Documentation-Policy-v1.0.README.md
Runtime Workflow¶
- Reference
Smrt.UIfrom the WinUI host project. - Instantiate
ThemeService(or an app-specific wrapper) to retrieve theme ResourceDictionary URIs. - Merge the dictionaries for the selected theme into the app’s resource tree.
- Listen to
ThemeChangedif the host supports user-driven theme switching, updating root resources accordingly. - Include XAML dictionaries from
Themes/**directly for static references (e.g.,<ResourceDictionary Source="ms-appx:///Smrt.UI/Themes/Generic.xaml" />).
Testing & Validation¶
- Execute a focused build to ensure XAML dictionaries compile:
dotnet build SmrtApps/src/Smrt.UI/Smrt.UI.csproj -c Debug -r win-x64. - For downstream validation, run the CSApps WinUI hosts (HubWindow, Supervisor) and confirm resource merges at runtime.
- Changes to theme assets should include visual QA (screenshot diffs or design sign-off) and, when relevant, updates to
Themes/CHANGES-*.md.
Assets & Token Governance¶
- Token files (
Themes/Tokens/*.xaml) define canonical colors, typography, and spacing. Palettes and semantic dictionaries consume these tokens. - All new assets must comply with the Asset Policy and maintain parity across light/dark/high-contrast variants.
- Document notable visual changes in
Themes/CHANGES-YYYY-MM-DD.mdso design/QA can trace updates. - Regenerate token dictionaries via
Smrt.Tools.TokenGenwhenever the JSON sources underSmrt.Tools.TokenGen/configchange.
State tokens (interaction + feedback):
- Status semantics are provided via SmrtHub.Status.* (semantic brushes; usually system-alias-driven).
- Busy/progress visuals are provided via SmrtHub.Busy.Indicator.* (palette-driven).
- Transient feedback motion primitives are provided via SmrtHub.Motion.TransientFeedback.* (base tokens).
These token families are part of the shared SmrtHub UI contract; consuming apps should bind to them via ThemeResource rather than defining app-local equivalents.
Directory Map¶
Services/— theme service contract/implementation plus canonical pack URIs.Themes/— resource dictionaries grouped by Tokens, Palettes, Semantic layers, Icons, and control-specific styles.Build-Smrt.UI.ps1/Clean-Smrt.UI.ps1— convenience scripts for local packaging/cleanup.Smrt.UI.csproj— WinUI class library configuration (pages includeThemes/**so the build generates.xbfassets).bin/,obj/— generated build artifacts (ignored/cleaned via standard tooling).
Policy References¶
- Documentation standards:
README.Files/System/Policies/SmrtHub-Documentation-Policy-v1.0.README.md - Asset governance:
README.Files/System/Policies/SmrtHub-Asset-Policy.README.md - Operational data policy (for consuming apps):
README.Files/System/Policies/SmrtHub-Operational-Data-Policy-v1.0.README.md