Lyo.Formatter.Web.Components
1.0.0
See the version list below for details.
dotnet add package Lyo.Formatter.Web.Components --version 1.0.0
NuGet\Install-Package Lyo.Formatter.Web.Components -Version 1.0.0
<PackageReference Include="Lyo.Formatter.Web.Components" Version="1.0.0" />
<PackageVersion Include="Lyo.Formatter.Web.Components" Version="1.0.0" />
<PackageReference Include="Lyo.Formatter.Web.Components" />
paket add Lyo.Formatter.Web.Components --version 1.0.0
#r "nuget: Lyo.Formatter.Web.Components, 1.0.0"
#:package Lyo.Formatter.Web.Components@1.0.0
#addin nuget:?package=Lyo.Formatter.Web.Components&version=1.0.0
#tool nuget:?package=Lyo.Formatter.Web.Components&version=1.0.0
Lyo.Formatter.Web.Components
Blazor / MudBlazor components for Lyo.Formatter. LyoFormatterTemplateEditor and LyoFormatterPreview share a LyoFormatterLiveSession, so the host can put the template box in one region and the preview in another. Formatting runs in-process via IFormatterService. No HTTP. Works with InteractiveWebAssembly and InteractiveServer. This package does not reference Microsoft.AspNetCore.App.
Examples
Split editor and preview
@inject IFormatterService Formatter
<MudGrid>
<MudItem xs="12" md="6">
<LyoFormatterTemplateEditor Session="_session" DebounceInterval="300" />
</MudItem>
<MudItem xs="12" md="6">
<LyoFormatterPreview Session="_session" />
</MudItem>
</MudGrid>
@code {
private LyoFormatterLiveSession _session = default!;
protected override void OnInitialized()
{
_session = new(Formatter) {
Template = "Hello, {Name}! Count: {Count:N0}",
Context = new Dictionary<string, object?> { ["Name"] = "Ada", ["Count"] = 42 }
};
}
}
Components
| Component | Purpose |
|---|---|
LyoFormatterTemplateEditor |
Template textarea with an in-place colored overlay of {placeholders}. Typing { opens a caret-anchored dropdown of session context keys. Object and dictionary values also list nested properties (User.Address.City). Typing updates the overlay immediately. The preview rebuilds after DebounceInterval (default 300 ms). The chip row under the field is hoverable so keys link to preview values. A Session parameter wins over a cascaded session. |
LyoFormatterPreview |
Read-only annotated output. Each replacement is a span with the same per-key color as the editor token. Hover a replacement to emphasize the matching {key}. Editor chips do the reverse. |
Session and colors
LyoFormatterLiveSession. Parent-ownedINotifyPropertyChangedstate:Template,Context,HoveredPlaceholder,DebounceInterval,TemplateSegments,PreviewSegments. CallRefreshPreview()after setting the initial template and context so the first paint is not empty. Dispose the session with the page.- Stable colors.
LyoFormatterPlaceholderPalettehashes the placeholder key (ordinal ignore-case) to an HSL hue so{Name}and its replacement always match. Fills arecolor-mixed into--mud-palette-surfaceso light and dark themes keep contrast. Colors are not re-randomized per render. - Hover. Sets
Session.HoveredPlaceholder. Matching spans get a stronger fill and outline. - Unresolved. Missing context (
MaintainTokens) uses a muted dashed underline instead of a key color. - Autocomplete.
LyoFormatterContextCatalogwalksSession.Context(dictionary keys or public properties, nested up to 3 levels). Typing{opens a floating list under the caret of keys and nested object properties (User,User.Address.City). Further typing filters the list (prefix match on the path or a dotted segment), including inside an already-closed{key}. Arrow, Enter, Tab, and Escape move and insert. The active row scrolls into view. - Optional
CascadingValueof the session so distant editor/preview pairs need not passSessionon every call. An explicitSessionparameter still wins.
Host integration
Call services.AddFormatterService() from Lyo.Formatter. Create one LyoFormatterLiveSession per editor/preview pair (inject IFormatterService). Supply Context as a DTO or IReadOnlyDictionary<string, object?>. There is no context editor in this package.
WASM
No IHttpContextAccessor, no server-only framework reference, no formatting via HTTP. Overlay and textarea share a CSS grid cell so they scroll together. Caret position and the { autocomplete dropdown use a small JS module from this package's wwwroot (imported by the editor; no host <script> tag). Works under InteractiveWebAssembly when the host registers IFormatterService and references this package.
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Formatter(direct, lyo)Lyo.Web.Components(direct, lyo)MudBlazor9.3(direct, third-party)Lyo.Api.Client(transitive, lyo)Lyo.Api.Models(transitive, lyo)Lyo.Cache(transitive, lyo)Lyo.Common(transitive, lyo)Lyo.Compression(transitive, lyo)Lyo.DataTable.Models(transitive, lyo)Lyo.DateAndTime(transitive, lyo)Lyo.Diagnostic(transitive, lyo)Lyo.Encryption(transitive, lyo)Lyo.Exceptions(transitive, lyo)Lyo.Hashing(transitive, lyo)Lyo.Health(transitive, lyo)Lyo.IO.Temp(transitive, lyo)Lyo.KeyStore(transitive, lyo)Lyo.Metrics(transitive, lyo)Lyo.PackageMetadata(transitive, lyo)Lyo.Query(transitive, lyo)Lyo.Query.Models(transitive, lyo)Lyo.Result(transitive, lyo)Lyo.Streams(transitive, lyo)Lyo.Validation(transitive, lyo)Blazored.LocalStorage4.5.0(transitive, third-party)BouncyCastle.Cryptography2.6.2(transitive, third-party, netstandard2.0)EasyCompressor2.1.0(transitive, third-party)Konscious.Security.Cryptography.Argon21.3.1(transitive, third-party)Microsoft.Bcl.AsyncInterfaces10.0.5(transitive, microsoft, netstandard2.0)Microsoft.Extensions.Caching.Memory10.0.5(transitive, microsoft)Microsoft.Extensions.Configuration.Binder10.0.5(transitive, microsoft)Microsoft.Extensions.DependencyInjection10.0.5(transitive, microsoft)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5(transitive, microsoft, net10.0, netstandard2.0)Microsoft.Extensions.Hosting.Abstractions10.0.5(transitive, microsoft)Microsoft.Extensions.Http10.0.5(transitive, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5(transitive, microsoft)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5(transitive, microsoft)SmartFormat.NET3.6.1(transitive, third-party)System.Buffers4.6.1(transitive, microsoft, netstandard2.0)System.ComponentModel.Annotations5.0.0(transitive, microsoft)System.IO.Hashing10.0.5(transitive, microsoft, net10.0)System.Memory4.6.3(transitive, microsoft, netstandard2.0)System.Text.Json10.0.5(transitive, microsoft, netstandard2.0)System.Threading.Tasks.Extensions4.6.3(transitive, microsoft, netstandard2.0)
| 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
- Lyo.Formatter (>= 1.0.0)
- Lyo.Web.Components (>= 1.0.0)
- MudBlazor (>= 9.3.0 && < 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.