Ranvier.View.Preview.Traced
0.1.0
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
<PackageReference Include="Ranvier.View.Preview.Traced" Version="0.1.0" />
<PackageVersion Include="Ranvier.View.Preview.Traced" Version="0.1.0" />
<PackageReference Include="Ranvier.View.Preview.Traced" />
paket add Ranvier.View.Preview.Traced --version 0.1.0
#r "nuget: Ranvier.View.Preview.Traced, 0.1.0"
#:package Ranvier.View.Preview.Traced@0.1.0
#addin nuget:?package=Ranvier.View.Preview.Traced&version=0.1.0
#tool nuget:?package=Ranvier.View.Preview.Traced&version=0.1.0
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 buildmakes aPreviewof the componentkey.buildruns again on each reload, and when a value knob changes.Preview.render definition propsis thePreviewViewof aComponent<'props>mounted withprops.Preview.renderUntypedtakes aTemplateComponentand anobj, for a component that the file cannot name.- A
PreviewViewholds theDefinitionand thePropsthe 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 previewbuilds 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,KnobsandStylesheetslist only what that run registered.Set(path, json)writes a signal knob, or stores a value knob (the caller runs the preview again). It givesWritten,RebuildorRejected reason.Restoreapplies stored values, and keeps those for a path no run has registered yet.Resetdrops every knob and value.KnobChangedfires when code other thanSetwrote a signal knob.DrainLogtakes 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 | 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 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. |
-
net10.0
- FSharp.Core (>= 8.0.100)
- Ranvier.View.Traced (>= 0.9.0)
-
net8.0
- FSharp.Core (>= 8.0.100)
- Ranvier.View.Traced (>= 0.9.0)
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.
The API may change before 1.0.