AshleyShrok.ViewModelShell
0.3.5
See the version list below for details.
dotnet add package AshleyShrok.ViewModelShell --version 0.3.5
NuGet\Install-Package AshleyShrok.ViewModelShell -Version 0.3.5
<PackageReference Include="AshleyShrok.ViewModelShell" Version="0.3.5" />
<PackageVersion Include="AshleyShrok.ViewModelShell" Version="0.3.5" />
<PackageReference Include="AshleyShrok.ViewModelShell" />
paket add AshleyShrok.ViewModelShell --version 0.3.5
#r "nuget: AshleyShrok.ViewModelShell, 0.3.5"
#:package AshleyShrok.ViewModelShell@0.3.5
#addin nuget:?package=AshleyShrok.ViewModelShell&version=0.3.5
#tool nuget:?package=AshleyShrok.ViewModelShell&version=0.3.5
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 full
ViewNodehierarchy with[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]+[JsonDerivedType(...)]:PageNode,SectionNode,ListNode,ListItemNode,FormNode,FieldNode,CheckboxNode,ButtonNode,TextNode,StatBarNode,TabsNode,ProgressNode,ModalNode,TableNode,LinkNode. - Action/state primitives:
ActionDescriptor,ActionPayload<TState>(with theParse(actionJson, stateJson)helper),ShellResponse<TState>. - Supporting records:
FieldOption,StatItem,TabItem,TableColumn,TableRow.
All under the neutral ViewModelShell namespace.
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 | 61 | 6/2/2026 |
| 0.15.0 | 100 | 6/1/2026 |
| 0.14.0 | 91 | 6/1/2026 |
| 0.13.0 | 98 | 6/1/2026 |
| 0.12.0 | 105 | 5/28/2026 |
| 0.11.0 | 89 | 5/24/2026 |
| 0.10.0 | 105 | 5/23/2026 |
| 0.9.0 | 94 | 5/21/2026 |
| 0.8.0 | 92 | 5/20/2026 |
| 0.7.0 | 91 | 5/20/2026 |
| 0.6.0 | 87 | 5/20/2026 |
| 0.5.0 | 104 | 5/20/2026 |
| 0.4.2 | 94 | 5/19/2026 |
| 0.4.1 | 91 | 5/18/2026 |
| 0.4.0 | 121 | 5/18/2026 |
| 0.3.10 | 93 | 5/15/2026 |
| 0.3.9 | 101 | 5/13/2026 |
| 0.3.8 | 102 | 5/12/2026 |
| 0.3.6 | 93 | 5/12/2026 |
| 0.3.5 | 118 | 5/12/2026 |