AshleyShrok.ViewModelShell 0.16.0

dotnet add package AshleyShrok.ViewModelShell --version 0.16.0
                    
NuGet\Install-Package AshleyShrok.ViewModelShell -Version 0.16.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AshleyShrok.ViewModelShell" Version="0.16.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AshleyShrok.ViewModelShell" Version="0.16.0" />
                    
Directory.Packages.props
<PackageReference Include="AshleyShrok.ViewModelShell" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AshleyShrok.ViewModelShell --version 0.16.0
                    
#r "nuget: AshleyShrok.ViewModelShell, 0.16.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AshleyShrok.ViewModelShell@0.16.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AshleyShrok.ViewModelShell&version=0.16.0
                    
Install as a Cake Addin
#tool nuget:?package=AshleyShrok.ViewModelShell&version=0.16.0
                    
Install as a Cake Tool

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 ViewNode hierarchy as record types with [JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] + [JsonDerivedType(...)] discriminators.
  • The action/state primitives needed to produce the wire contract — ActionPayload<TState> (with Parse / 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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
Loading failed