LayoutStaticAsset Class#
A single presentation asset declared by an ILayoutEngine for the host to load alongside the layout. Returned from GetStaticAssetsAsync(IVersoContext, LayoutHostCapabilities) and consumed only by hosts that advertise the asset's content type in their LayoutHostCapabilities.
public sealed record LayoutStaticAsset : System.IEquatable<Verso.Abstractions.LayoutStaticAsset>
Inheritance System.Object → LayoutStaticAsset
Implements System.IEquatable<LayoutStaticAsset>
Constructors#
LayoutStaticAsset(string, string, ReadOnlyMemory<byte>) Constructor#
A single presentation asset declared by an ILayoutEngine for the host to load alongside the layout. Returned from GetStaticAssetsAsync(IVersoContext, LayoutHostCapabilities) and consumed only by hosts that advertise the asset's content type in their LayoutHostCapabilities.
public LayoutStaticAsset(string AssetId, string ContentType, System.ReadOnlyMemory<byte> Content);
Parameters#
AssetId System.String
Stable, layout-relative key (e.g. "dashboard.css"). The host uses this to cache
the asset across re-renders and to construct per-asset DOM identifiers. To force a
refresh after the bytes change, include a version suffix in the id
(e.g. "dashboard.css?v=2"); the bare id alone is not content-hashed.
ContentType System.String
IANA media type of the asset (e.g. "text/css", "text/javascript"). The
host only loads assets whose content type was advertised in the capabilities exchange.
Content System.ReadOnlyMemory<System.Byte>
The asset bytes, exposed as read-only memory. The host is free to serve them via a
host-appropriate transport (custom endpoint, blob URL, inline) and may cache the bytes
for the lifetime of the owning extension. A byte[] passed at construction is
wrapped without a copy.
Properties#
AssetId Property#
Stable, layout-relative key (e.g. "dashboard.css"). The host uses this to cache
the asset across re-renders and to construct per-asset DOM identifiers. To force a
refresh after the bytes change, include a version suffix in the id
(e.g. "dashboard.css?v=2"); the bare id alone is not content-hashed.
public string AssetId { get; init; }
Property Value#
Content Property#
The asset bytes, exposed as read-only memory. The host is free to serve them via a
host-appropriate transport (custom endpoint, blob URL, inline) and may cache the bytes
for the lifetime of the owning extension. A byte[] passed at construction is
wrapped without a copy.
public System.ReadOnlyMemory<byte> Content { get; init; }
Property Value#
System.ReadOnlyMemory<System.Byte>
ContentSecurityPolicy Property#
Optional Content Security Policy hint the layout would like applied to this asset. Carried verbatim through the contract and surfaced to host integrations; current Blazor hosts do not enforce a strict CSP and ignore this field at runtime. Reserved so future enforcement does not require a contract change.
public string? ContentSecurityPolicy { get; init; }
Property Value#
ContentType Property#
IANA media type of the asset (e.g. "text/css", "text/javascript"). The
host only loads assets whose content type was advertised in the capabilities exchange.
public string ContentType { get; init; }
Property Value#
LoadHints Property#
Optional load-order and timing hints for script assets. Ignored for stylesheets and
other content types. Null applies default behavior: classic (non-module) script,
defer load mode, placed after the layout root in DOM order.
public Verso.Abstractions.LayoutStaticAssetLoadHints? LoadHints { get; init; }