StyleRegistry
Pennington.UI.Styling
Slot-key → CSS class registry behind the overridable styling on Pennington.UI components. Three layers: component defaults (UiStyleDefaults), an optional template skin that replaces a default wholesale, and optional consumer overrides that are merged over the result with Tailwind conflict resolution (conflicting utilities replaced, the rest kept) — effective = merge(skin ?? default, override), where merge is the MonorailCSS class merger supplied by the caller. Component *Class parameters add a per-instance layer on top via Merge. Keys are case-insensitive.
Properties
EntriesImmutableList<StyleEntry>- Every slot sorted by key, with per-layer inputs — consumed by
diag stylesand tests. Itemstring- Effective class string for
key; throws on an unknown key, listing the valid catalog.
Methods
Create
#public static StyleRegistry Create(IReadOnlyDictionary<string, string> templateSkin = null, IReadOnlyDictionary<string, string> overrides = null, Func<string, string, string> mergeOverride = null)
Builds a registry from the component defaults, an optional template skin, and optional consumer overrides. Skin and override keys must exist in StyleKeys; an unknown key throws an InvalidOperationException naming the valid catalog.
Parameters
templateSkinIReadOnlyDictionary<string, string>- Per-slot replacements a site template applies to the component defaults.
overridesIReadOnlyDictionary<string, string>- Per-slot consumer classes Tailwind-merged over the skinned defaults.
mergeOverrideFunc<string, string, string>- Tailwind-aware merge for overridden slots and per-instance
Mergecalls —(baseClasses, overrideClasses) => effective, typically the MonorailCSS class merger fromMonorailCssService.CreateClassMerger. When null the override is appended without conflict resolution (the bare-host fallback).
Returns
StyleRegistryGet
#public string Get(string key)
Effective class string for key; throws on an unknown key, listing the valid catalog.
Parameters
keystring
Returns
stringMerge
#public string Merge(string key, string classes)
Effective class string for key with classes Tailwind-merged over it — the per-instance layer behind component *Class parameters. Null or empty classes returns the effective value unchanged.
Parameters
keystringclassesstring
Returns
stringPennington.UI.Styling.StyleRegistry
namespace Pennington.UI.Styling;
/// Slot-key → CSS class registry behind the overridable styling on Pennington.UI components. Three layers: component defaults (UiStyleDefaults), an optional template skin that replaces a default wholesale, and optional consumer overrides that are merged over the result with Tailwind conflict resolution (conflicting utilities replaced, the rest kept) — effective = merge(skin ?? default, override), where merge is the MonorailCSS class merger supplied by the caller. Component *Class parameters add a per-instance layer on top via Merge. Keys are case-insensitive.
public class StyleRegistry
{
/// Builds a registry from the component defaults, an optional template skin, and optional consumer overrides. Skin and override keys must exist in StyleKeys; an unknown key throws an InvalidOperationException naming the valid catalog.
public static StyleRegistry Create(IReadOnlyDictionary<string, string> templateSkin = null, IReadOnlyDictionary<string, string> overrides = null, Func<string, string, string> mergeOverride = null)
;
/// Every slot sorted by key, with per-layer inputs — consumed by diag styles and tests.
public ImmutableList<StyleEntry> Entries { get; }
/// Effective class string for key; throws on an unknown key, listing the valid catalog.
public string Get(string key)
;
/// Effective class string for key; throws on an unknown key, listing the valid catalog.
public string Item { get; }
/// Effective class string for key with classes Tailwind-merged over it — the per-instance layer behind component *Class parameters. Null or empty classes returns the effective value unchanged.
public string Merge(string key, string classes)
;
}