AshleyShrok.ViewModelShell
0.16.0
dotnet add package AshleyShrok.ViewModelShell --version 0.16.0
NuGet\Install-Package AshleyShrok.ViewModelShell -Version 0.16.0
<PackageReference Include="AshleyShrok.ViewModelShell" Version="0.16.0" />
<PackageVersion Include="AshleyShrok.ViewModelShell" Version="0.16.0" />
<PackageReference Include="AshleyShrok.ViewModelShell" />
paket add AshleyShrok.ViewModelShell --version 0.16.0
#r "nuget: AshleyShrok.ViewModelShell, 0.16.0"
#:package AshleyShrok.ViewModelShell@0.16.0
#addin nuget:?package=AshleyShrok.ViewModelShell&version=0.16.0
#tool nuget:?package=AshleyShrok.ViewModelShell&version=0.16.0
AshleyShrok.ViewModelShell
Server-driven UI framework — backend types for @ashley-shrok/viewmodel-shell.
The npm package ships a thin TypeScript adapter that renders a JSON tree of typed nodes to DOM. This NuGet package ships the matching .NET type hierarchy so an ASP.NET Core (or any .NET) app can produce the JSON contract without re-implementing it. Wire-format-aligned with the npm package — same major.minor version means same set of ViewNode discriminator keys.
Install
dotnet add package AshleyShrok.ViewModelShell
Use
using ViewModelShell;
[ApiController]
[Route("api/tasks")]
public class TasksController : ControllerBase
{
[HttpGet]
public ShellResponse<TasksState> Get()
{
var state = TasksState.Initial();
return new(BuildVm(state), state);
}
[HttpPost("action")]
[Consumes("multipart/form-data")]
public ActionResult<ShellResponse<TasksState>> Action()
{
var payload = ActionPayload<TasksState>.Parse(
Request.Form["_action"].ToString(),
Request.Form["_state"].ToString());
var state = payload.State;
switch (payload.Name)
{
case "add": state = state with { /* ... */ }; break;
default: return BadRequest($"Unknown action: {payload.Name}");
}
return new ShellResponse<TasksState>(BuildVm(state), state);
}
private static ViewNode BuildVm(TasksState state) =>
new PageNode("Tasks", new ViewNode[]
{
new TextNode("Hello", "heading"),
// ...
});
}
What's in the package
The complete .NET backend type set, all under the neutral ViewModelShell namespace:
- The full
ViewNodehierarchy asrecordtypes with[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]+[JsonDerivedType(...)]discriminators. - The action/state primitives needed to produce the wire contract —
ActionPayload<TState>(withParse/ParseJson),ShellResponse<TState>— plus the supporting records the nodes compose from.
The single file viewmodel-shell-dotnet/ViewModels.cs is the package: it's the authoritative, always-current list of every type and prop. This README intentionally does not enumerate the node set, so it cannot fall out of sync with the shipped assembly — that exact mismatch (a README node list disagreeing with the DLL) was issue #9. The npm package's dist/index.d.ts is the matching TypeScript view of the same contract; the two are kept aligned by the repo's cross-backend parity suite.
Versioning
This package's major.minor matches the npm package. A new ViewNode type or wire-format change bumps both sides; mismatched majors mean the discriminator keys can disagree.
Docs
Full framework docs and the wire format reference: https://github.com/ashley-shrok/ViewModelShell/blob/main/AGENTS.md
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.16.0 | 0 | 6/2/2026 |
| 0.15.0 | 49 | 6/1/2026 |
| 0.14.0 | 49 | 6/1/2026 |
| 0.13.0 | 56 | 6/1/2026 |
| 0.12.0 | 55 | 5/28/2026 |
| 0.11.0 | 88 | 5/24/2026 |
| 0.10.0 | 104 | 5/23/2026 |
| 0.9.0 | 93 | 5/21/2026 |
| 0.8.0 | 91 | 5/20/2026 |
| 0.7.0 | 91 | 5/20/2026 |
| 0.6.0 | 86 | 5/20/2026 |
| 0.5.0 | 103 | 5/20/2026 |
| 0.4.2 | 93 | 5/19/2026 |
| 0.4.1 | 90 | 5/18/2026 |
| 0.4.0 | 119 | 5/18/2026 |
| 0.3.10 | 92 | 5/15/2026 |
| 0.3.9 | 99 | 5/13/2026 |
| 0.3.8 | 100 | 5/12/2026 |
| 0.3.6 | 93 | 5/12/2026 |
| 0.3.5 | 117 | 5/12/2026 |