Assembly Registration
Every story assembly must be registered with the [AwenStoryAssembly] attribute so Awen's scanner can discover it.
The Attribute
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public sealed class AwenStoryAssemblyAttribute : Attribute
{
public AwenStoryAssemblyAttribute(string libraryName);
public string LibraryName { get; }
public string? LightThemeResourcePath { get; set; }
public string? DarkThemeResourcePath { get; set; }
}
Basic Registration
Create an AssemblyInfo.cs file in your stories project:
using Awen.Sdk;
[assembly: AwenStoryAssembly("My Component Library")]
The libraryName parameter becomes the top-level node in Awen's sidebar tree.
Custom Themes
If your component library has its own theme resources, you can register them so Awen applies them when previewing your controls:
using Awen.Sdk;
[assembly: AwenStoryAssembly(
"My Component Library",
LightThemeResourcePath = "MyLib.Themes.LightTheme.axaml",
DarkThemeResourcePath = "MyLib.Themes.DarkTheme.axaml")]
The paths should be embedded resource paths within the story assembly. Awen loads these as ResourceDictionary instances and merges them into the application resources when the theme is active.
Discovery Process
When Awen scans the --dir directory, it:
- Loads each
.dllfile - Checks for
[AwenStoryAssembly]on the assembly - If found, scans all exported types for
IStory<,>implementations - Builds the sidebar tree from each story's
Groupproperty, nested under theLibraryName