Enx.Atomic.Avalonia.CodeGen
0.0.1
See the version list below for details.
dotnet add package Enx.Atomic.Avalonia.CodeGen --version 0.0.1
NuGet\Install-Package Enx.Atomic.Avalonia.CodeGen -Version 0.0.1
<PackageReference Include="Enx.Atomic.Avalonia.CodeGen" Version="0.0.1" />
<PackageVersion Include="Enx.Atomic.Avalonia.CodeGen" Version="0.0.1" />
<PackageReference Include="Enx.Atomic.Avalonia.CodeGen" />
paket add Enx.Atomic.Avalonia.CodeGen --version 0.0.1
#r "nuget: Enx.Atomic.Avalonia.CodeGen, 0.0.1"
#:package Enx.Atomic.Avalonia.CodeGen@0.0.1
#addin nuget:?package=Enx.Atomic.Avalonia.CodeGen&version=0.0.1
#tool nuget:?package=Enx.Atomic.Avalonia.CodeGen&version=0.0.1
Enx.Atomic.Avalonia
An atomic utility-class engine for Avalonia, inspired by
UnoCSS: resolve Tailwind/UnoCSS-style tokens
(hover:bg-red-500, sm:flex-row, ml-4, ...) into real Avalonia styles instead of
hand-written XAML Styles.
<Button Classes="flex-row p-4 rounded-md bg-blue-500 hover:bg-blue-600" Content="Click me" />
See ARCHITECTURE.md for how the engine actually works — rules, variants, source transformers, the Mini preset, and build-time code generation.
Projects
| Project | Role |
|---|---|
Sources/Enx.Atomic.Avalonia |
The generic engine: resolves tokens into styles, independent of any preset. |
Sources/Enx.Atomic.Avalonia.Preset.Mini |
A concrete rule/variant set, inspired by @unocss/preset-mini. |
Sources/Enx.Atomic.Avalonia.CodeGen |
Build-time C# code generation: emitter, CLI, and MSBuild wiring. |
Sandbox |
An Avalonia console app used as a manual test bed for the engine and the presets. |
Examples/ |
A minimal end-to-end example of the build-time code generation pipeline. |
Tests/Enx.Atomic.Avalonia.Tests |
The automated test suite (xUnit v3). |
Getting started
Requires a .NET SDK compatible with net10.0 (a net10.0-targeting preview SDK
works too).
dotnet build Enx.Atomic.Avalonia.slnx
There are two ways to resolve utility tokens into styles:
- At runtime — call
AtomicGenerator<TTheme>.Generate(...)yourself and add the resulting styles to yourApplication.Styles. SeeSandbox/Program.cs. - At build time — set up a small configuration project and wire it into your
app's build via
Enx.Atomic.Avalonia.CodeGen, so tokens are resolved once at compile time instead of on every startup. SeeExamples/and ARCHITECTURE.md for the full setup.
Testing
dotnet test Tests/Enx.Atomic.Avalonia.Tests/Enx.Atomic.Avalonia.Tests.csproj
With code coverage (Cobertura report under coverage/):
dotnet test Tests/Enx.Atomic.Avalonia.Tests/Enx.Atomic.Avalonia.Tests.csproj \
/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=../../coverage/
Releasing
Enx.Atomic.Avalonia, Enx.Atomic.Avalonia.Preset.Mini, and
Enx.Atomic.Avalonia.CodeGen are published to nuget.org whenever a vX.Y.Z tag is
pushed — see ARCHITECTURE.md for how versioning
and publishing work.
License
Contributing
This repository follows the org-wide contributing guidelines.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Enx.Atomic.Avalonia (>= 0.0.1)
- Spectre.Console.Cli (>= 0.51.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.