StyleServiceExtensions
Pennington.UI.Styling
DI registration for the StyleRegistry and its diag styles command.
Methods
AddPenningtonStyles
#public static IServiceCollection AddPenningtonStyles(IServiceCollection services, IReadOnlyDictionary<string, string> templateSkin = null, Func<IReadOnlyDictionary<string, string>> styleOverrides = null, Func<string, string, string> classMerger = null)
Registers the StyleRegistry. Site templates call this internally with their skin; bare hosts composing Pennington.UI components directly can call it themselves (the components fall back to the built-in defaults when nothing is registered). When called more than once the last registration wins; the diag command is registered once.
Parameters
servicesIServiceCollection- The service collection.
templateSkinIReadOnlyDictionary<string, string>- Per-slot replacements a site template applies over the component defaults.
styleOverridesFunc<IReadOnlyDictionary<string, string>>- Factory returning the consumer's per-slot overrides, re-invoked per resolve.
classMergerFunc<string, string, string>- Tailwind-aware class merge for the override layer — typically
MonorailCssService.CreateClassMerger(...). When null an override is appended without conflict resolution; site templates always supply one so overrides knock out conflicting skin/default utilities.
Returns
IServiceCollectionPennington.UI.Styling.StyleServiceExtensions
namespace Pennington.UI.Styling;
/// DI registration for the StyleRegistry and its diag styles command.
public class StyleServiceExtensions
{
/// Registers the StyleRegistry. Site templates call this internally with their skin; bare hosts composing Pennington.UI components directly can call it themselves (the components fall back to the built-in defaults when nothing is registered). When called more than once the last registration wins; the diag command is registered once.
public static IServiceCollection AddPenningtonStyles(IServiceCollection services, IReadOnlyDictionary<string, string> templateSkin = null, Func<IReadOnlyDictionary<string, string>> styleOverrides = null, Func<string, string, string> classMerger = null)
;
}