Ranvier.View.Preview.Traced 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ranvier.View.Preview.Traced --version 0.1.0
                    
NuGet\Install-Package Ranvier.View.Preview.Traced -Version 0.1.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="Ranvier.View.Preview.Traced" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ranvier.View.Preview.Traced" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Ranvier.View.Preview.Traced" />
                    
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 Ranvier.View.Preview.Traced --version 0.1.0
                    
#r "nuget: Ranvier.View.Preview.Traced, 0.1.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 Ranvier.View.Preview.Traced@0.1.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=Ranvier.View.Preview.Traced&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Ranvier.View.Preview.Traced&version=0.1.0
                    
Install as a Cake Tool

Ranvier.View.Preview

The live component preview of Ranvier.View: the pipe protocol, the knob model and the reflection that the preview host and the editor extension share.

Applications never reference this package. The preview host (Ranvier.View.WebCore.Hmr) loads it from a generated harness project that lives under .ionide/ranvier/preview/, so nothing is added to an application's own project. The generated props files reference it too. Preview mode of the host documents the flags, the exit codes and what a reload keeps.

A props file

A props file defines one Preview: the key of a component and a function that builds its props from knobs.

module RanvierPreview.MyApp_Counter_counter

open Ranvier.View.Preview

let preview: Preview =
    Preview.create "MyApp.Counter.counter" (fun p ->
        let props: MyApp.Counter.CounterProps =
            { Count = p.Signal("count", Knob.int, 0)
              Label = p.Value("label", Knob.string, "") }

        Preview.render MyApp.Counter.counter props)

API

Preview

  • Preview.create key build makes a Preview of the component key. build runs again on each reload, and when a value knob changes.
  • Preview.render definition props is the PreviewView of a Component<'props> mounted with props. Preview.renderUntyped takes a TemplateComponent and an obj, for a component that the file cannot name.
  • A PreviewView holds the Definition and the Props the host mounts.

PreviewContext

The argument of build. Each member names a knob by a path: a record field is parent.field, a union case's field is parent/Case/field, a function argument is arg:<name>.

Member Meaning
Signal(path, knob, initial) A signal knob. The editor writes it in place, and a write by the component reaches the editor.
Value(path, knob, initial) A value knob. Its value is initial until the editor sets it, and a new value runs build again.
Log(path, args) Records a call of the function argument at path, for the editor's log.
Stylesheet(name, css) Registers a named stylesheet. css is read after each run.

Knob

Knob.int, float, decimal, string, bool and char are the primitive knobs. Knob.cases names is a choice among named cases. Knob.option, Knob.list and Knob.array take the knob of their element. Knob.readOnly shows a value that the editor cannot set. A knob carries the codec of its values as JSON text. A knob's value survives a restart of the host because the editor keeps it and sends it back with restore.

Reflected

Reaches what a generated file cannot name because it is private or internal, by a type's full name: Reflected.value, Reflected.call, Reflected.record, Reflected.union, Reflected.signal, and Reflected.ofMembers and Reflected.ofClass, which build a component from a type as Component.ofMembers and Component.ofClass do. Reflected.resolver finds the type; the host replaces it with one that sees the newest FSI evaluation.

PreviewSession

PreviewSession(graph) is what the host builds around a Preview:

  • Run preview builds the preview in a new scope, and disposes the scope of the previous run once the build succeeds. A knob path registered earlier keeps its signal and value when its type is the same. After the run, Knobs and Stylesheets list only what that run registered.
  • Set(path, json) writes a signal knob, or stores a value knob (the caller runs the preview again). It gives Written, Rebuild or Rejected reason.
  • Restore applies stored values, and keeps those for a path no run has registered yet. Reset drops every knob and value.
  • KnobChanged fires when code other than Set wrote a signal knob. DrainLog takes the calls logged since the last drain.

Protocol

Ranvier.View.Preview.Protocol is the pipe's wire format, version 1.0: a frame is a 4-byte little-endian payload length, one byte of kind (0 for UTF-8 JSON, 1 for binary) and the payload, which is at most 64 MiB (MaxPayload). Its records are the messages: the host sends Hello, Status, Knobs, Knob, Log and Fault, and the editor sends Open, Set, Restore, Reset, Resize, Front and Close. Frame.encode and FrameReader write and read frames. Protocol.fs depends on FSharp.Core alone and compiles under .NET and Fable; the package ships it as a Fable source (fable/Protocol.fs) so the editor extension compiles the same file.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Ranvier.View.Preview.Traced:

Package Downloads
Ranvier.View.WebCore.Hmr.Traced

Hot reload for native Ranvier apps in development: `dotnet run -- dev` keeps the SDL window and WebCore page alive and patches edited components into them, keeping their state.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 64 12/3/2026
0.1.1 78 12/2/2026
0.1.0 77 12/1/2026

The API may change before 1.0.