This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

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

Entries ImmutableList<StyleEntry>
Every slot sorted by key, with per-layer inputs — consumed by diag styles and tests.
Item string
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

templateSkin IReadOnlyDictionary<string, string>
Per-slot replacements a site template applies to the component defaults.
overrides IReadOnlyDictionary<string, string>
Per-slot consumer classes Tailwind-merged over the skinned defaults.
mergeOverride Func<string, string, string>
Tailwind-aware merge for overridden slots and per-instance Merge calls — (baseClasses, overrideClasses) => effective, typically the MonorailCSS class merger from MonorailCssService.CreateClassMerger. When null the override is appended without conflict resolution (the bare-host fallback).

Returns

StyleRegistry

Get

#
public string Get(string key)

Effective class string for key; throws on an unknown key, listing the valid catalog.

Parameters

key string

Returns

string

Merge

#
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

key string
classes string

Returns

string

Pennington.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)
; }