Skip to content

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.UI as a project reference and merge the exported ResourceDictionaries at runtime.

Dependencies & Integrations

  • Targets net8.0-windows10.0.19041.0 with WinUI 3 enabled; the Windows App SDK package version is centrally managed via Directory.Packages.props.
  • Theme selection logic surfaces through Smrt.UI.Services.IThemeService; consuming apps resolve and apply the URIs to Application.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.Config and emit telemetry through SmrtHub.Logging under 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.

Runtime Workflow

  1. Reference Smrt.UI from the WinUI host project.
  2. Instantiate ThemeService (or an app-specific wrapper) to retrieve theme ResourceDictionary URIs.
  3. Merge the dictionaries for the selected theme into the app’s resource tree.
  4. Listen to ThemeChanged if the host supports user-driven theme switching, updating root resources accordingly.
  5. 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.md so design/QA can trace updates.
  • Regenerate token dictionaries via Smrt.Tools.TokenGen whenever the JSON sources under Smrt.Tools.TokenGen/config change.

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 include Themes/** so the build generates .xbf assets).
  • 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