Skip to content
SheetForge

Canvas and surfaces

This page lists the public Core types for four areas a plugin can extend: the Data Studio record canvas, color presets, declarative authoring surfaces and code registries.

AreaNamespace
Record canvasSheetForge.Core.Graphing
Color presetsSheetForge.Core.Theming
Declarative authoring surfacesSheetForge.Core.Studio
Code registriesSheetForge.Core.Graphing

Record canvas

The Data Studio record canvas decides what to draw on its own. It walks the reference index outward from the record you opened, the terminus, and lays the result out deterministically. A plugin does not replace that picture. It adds to it.

The types are pure data throughout. Columns are grid cells, not pixels. A color is a free Category string that the window maps to a palette.

TypeKindRole
IRecordCanvasAugmenterinterfaceOne tab's canvas override
CanvasAugmentBuildersealed classThe write surface of an override
GraphShapeRegistrysealed classTab name → canvas override
GraphBuildContextsealed classThe override's read-only input
GraphSpecBuildersealed classThe graph assembly helper
GraphSpecsealed classThe assembled result the canvas draws
GraphNodeSpecsealed classOne node
GraphWireSpecsealed classOne wire
IAuthorableGraphShapeinterfaceOpt-in capability an IRecordCanvasAugmenter may also implement

The members of CanvasAugmentBuilder are under Canvas write surface.

IRecordCanvasAugmenter

One tab's canvas override. Augment(GraphBuildContext, CanvasAugmentBuilder, string terminusTab, string terminusRecordId) is called after the closure is assembled.

  • Adding nothing leaves the core picture as it is.
  • A throw is caught by the window and becomes an English console warning.
  • Identity belongs to the data. A virtual node loses to a real record of the same key.
  • Presentation, the display hint, does not belong to the data. It applies to records that already exist.

GraphShapeRegistry

Maps a tab name to its canvas override.

  • Register(tabName, IRecordCanvasAugmenter) throws on a duplicate tab, an empty name or a null override.
  • TryGet
  • IsEmpty

GraphBuildContext

The override's read-only input.

  • Tables maps a tab to its SheetTable.
  • ReferenceIndex References
  • IReadOnlyList<CodeRegistrySource> CodeRegistries is empty, never null.

The context has no error collector, because a canvas is display, not validation.

GraphSpecBuilder

The graph assembly helper. The constructor takes (GraphBuildContext).

  • Static NodeKey(tab, recordId) returns the standard key for a record node. Wires point at that key.
  • AddNode(GraphNodeSpec) keeps the first node added for each (Key, Column).
  • AddWire(GraphWireSpec)
  • AddWire(fromKey, toKey, label, fromTab, fromRecordId, fieldName, isCyclic = false, cyclicNote = null)

The long AddWire overload also names the cell the link is written in. That is what makes the wire editable.

GraphSpec

The assembled result the canvas draws. It exposes Nodes and Wires.

Assembly goes through the builder. The constructor is internal.

GraphNodeSpec

One node. Its members are Key, Tab, RecordId, Title, Subtitle, Category, CellCoordinate Address, Column, Row, IsFocus, IsMissing, InCount and IsCyclic.

Column and Row are grid cells the canvas has already solved. They are carried here, not chosen here. IsFocus marks the terminus.

GraphWireSpec

One wire. It has two groups of members.

GroupMembers
DisplayFromKey, ToKey, Label, IsCyclic, CyclicNote
The optional owning cellFromTab, FromRecordId, FieldName, RecordEdge? SourceEdge

A null SourceEdge means a display-only wire. The canvas then says that the wire cannot be edited.

The five display arguments are unchanged, so existing calls compile and render identically.

IAuthorableGraphShape

An opt-in capability that an IRecordCanvasAugmenter may also implement.

IReadOnlyList<string> CreatableTabs(GraphBuildContext, string tabName) returns where the canvas may create a record. An empty list means nowhere.

Defaults without the capability

Two defaults apply when an override does not implement IAuthorableGraphShape.

The creatable-tabs list is what the capability replaces. The same list also decides whether a canvas opens at all and how far the pending-row sweep reaches. By default, it covers every tab reachable from the focus tab by following the schema transitively.

The linking cascade is what the user actually sees. By default, it starts from the tabs that the ports currently drawn aim at.

Both defaults drop code-registry tabs and tabs with no key column.

A tab that the capability returns and that no drawn port accepts stays listed in the linking cascade, with its reason attached. The window's own gates still apply on top.

Canvas write surface

CanvasAugmentBuilder is the write surface of a canvas override. It takes four things only.

What you addMethod
A virtual nodeAddNode
An extra edgeAddEdge
A layer hintSetLayer, SetLayerRelative
A display hintSetSubtitle

Virtual nodes

A virtual node stands for an identity that is not a sheet record, such as an event key or an action that lives in code. The tab may be empty.

AddNode has two overloads:

  • AddNode(tab, recordId, title = null, category = null)
  • AddNode(tab, recordId, title, category, CellCoordinate address)

Extra edges

An extra edge is an edge the core scanner cannot see.

  • AddEdge(fromTab, fromRecordId, toTab, toRecordId, label = null, fieldName = null, fieldOnTarget = false, isCyclic = false, cyclicNote = null)
ArgumentWhat it says
fieldNameWhich cell the link is written in
fieldOnTargetThat cell sits on the arrival rather than the departure
isCyclic, cyclicNoteMark a loop for display, with the note only the domain knows

Layer hints

SetLayer(tab, recordId, layer) sets an absolute layer hint. Layer 0 is the leftmost. A negative layer goes further left, and everything shifts right to compensate.

SetLayerRelative(tab, recordId, offset) sets the same hint, counted from the terminus. An offset of −1 means one column left of the terminus. The offset is resolved against the terminus column before any hint moved it.

Display hints

SetSubtitle(tab, recordId, subtitle) sets a display hint. It is the one thing that applies to records that already exist.

It also applies to records that are not on screen. The connect picker reads those.

Ignored items and widening

Items with an empty key are ignored. What was collected is internal, because the merge rules live in one place.

Every widening adds trailing parameters, so an override written against an earlier surface still compiles.

Color presets

A preset overrides only the slots it names. Every other slot keeps the product default, so a preset stays valid as slots are added.

Registering never applies a preset. The user picks one in the Data Studio toolbar's theme menu, under Color preset.

TypeRole
ThemeRegistryPreset id → theme
SheetForgeThemeOne color preset
ThemeColorSlotThe color roles a preset may override (enum)

ThemeRegistry

Maps a preset id to its theme. Blank ids, duplicates and the two reserved built-in ids throw.

  • Registration and lookup: Register(SheetForgeTheme), TryGet, Themes, IsEmpty.
  • Built-in ids: IsBuiltInId(id), BuiltInDefaultId, BuiltInHighContrastId.

SheetForgeTheme

One color preset.

  • Id
  • DisplayName
  • DarkColors / LightColors are each an IReadOnlyDictionary<ThemeColorSlot, uint>, copied on construction.
  • TryGetColor(dark, slot, out rgb)
  • IsEmpty

ThemeColorSlot

An enum of the 33 color roles a preset may override. The roles cover surfaces, lines, text, semantic colors, staging marks, failure surfaces, scrim and the record canvas. The enum is append-only.

Colors are 0xRRGGBB. Core references no engine type, and translucent fills derive from a slot color plus a fixed alpha.

Declarative authoring surfaces

A plugin describes what to show. The shell is data, and the predicate and the effect are delegates. Each host draws the description with its own widgets: UIToolkit in the editor, React in the browser.

No layout numbers appear anywhere. What to say is the plugin's. How to place it is the renderer's.

Every enum here is append-only, so a registration keeps its meaning as the vocabulary grows.

TypeKindRole
StudioUiRegistrysealed classWhat RegisterStudioUi fills
StudioUiNodesealed classOne described fragment, immutable
StudioUiNodeKindenumThe 13 node kinds, Row … Link
StudioActionDescriptorsealed classOne verb
StudioActionPlacementenumThe seat an action takes
StudioPanelDescriptorsealed classOne panel in the Studio's right-hand pane
StudioColumnBadgeDescriptorsealed classOne badge beside a column header
StudioCellEditorHintsealed classPicks a built-in widget for a type
StudioCellEditorArchetypeenumThe built-in widget kinds a hint picks from
BuiltinCellEditorHintsstatic classThe three hints the Core itself declares
StudioCellOptionsealed classOne dropdown candidate
StudioSurfaceContextsealed classThe one seam an extension sees and acts through

StudioUiRegistry

RegisterStudioUi fills this registry.

MethodCollection
AddAction(StudioActionDescriptor)Actions
AddPanel(StudioPanelDescriptor)Panels
AddColumnBadge(StudioColumnBadgeDescriptor)ColumnBadges
AddCellEditorHint(StudioCellEditorHint)CellEditorHints

The registry also exposes IsEmpty.

StudioUiNode

One described fragment. A node is immutable and is built through static factories.

  • Factories: Row, Label, Chip, Badge, Button, Rule, Heading, KeyValue, Table(headerRow, rows), List, Progress, Input, Link.
  • WithTooltip(text) returns a new node rather than changing this one.
  • Reads: Kind, Text, Tooltip, ThemeColorSlot? Tone, ActionId, Detail, Ratio, Url, Children.
  • Static bool IsAllowedUrl(url) allows http and https only.

StudioUiNodeKind holds the 13 kinds that the factories build, Row … Link.

Tone is never a hard-coded color, so it follows the theme.

IsAllowedUrl is one predicate that both hosts ask. They cannot disagree about what is safe to open.

StudioActionDescriptor

One verb.

  • Id is unique.
  • LabelKey is a Loc key. An unregistered key shows verbatim.
  • StudioActionPlacement Placement
  • Func<StudioSurfaceContext,bool> AppliesTo
  • Action<StudioSurfaceContext> Execute
  • ConfirmKey is optional. It names a sentence that the host asks first.

The host checks AppliesTo again at invocation. A stale menu entry answers with a no-op and a redraw.

StudioActionPlacement

The values are Inspector, RowContextMenu, TopbarMenu, ColumnHeaderMenu and CanvasNodeMenu.

Each seat fills different context fields. Every seat carries the tab.

SeatContext it carries
The node inspector seatThe active tab only
The row seatThe record
The topbar seatThe active tab only
The column seatThe column name
The canvas seatThat node's record

StudioPanelDescriptor

One panel in the Studio's right-hand pane.

  • Id
  • TitleKey
  • Func<StudioSurfaceContext,StudioUiNode> Build

The panel is rebuilt each recompute tick, so it holds no state. With no panel registered, the pane is not drawn at all.

StudioColumnBadgeDescriptor

One badge beside a column header.

Func<StudioSurfaceContext,string,string,StudioUiNode> Provide takes the context, the tab and the field. Returning null means nothing on that column.

StudioCellEditorHint

A hint says "use this built-in widget for this type". It picks a kind rather than supplying one.

  • TypeName is an exact CellParserRegistry type name.
  • StudioCellEditorArchetype Archetype
  • GetOptions is for a dropdown only. Its shape is Func<context, tab, field, IReadOnlyList<StudioCellOption>>.
  • SliderMin / SliderMax
  • ToggleTrueValue / ToggleFalseValue

The class has four constructors, one per kind of input the hint needs.

TypeName matches by these rules:

  • A list cell is matched on its element name.
  • Wrapper cells keep the canonical text and are never matched.

Where a hint is consulted

A hint is consulted after a registered IStudioCellEditorProvider declines and before the built-in branches.

A plugin's hint is consulted before the built-in hints. Registering a hint under Color, AnimationCurve or Gradient therefore overrides the default editor for that type.

A List<> whose element hint is ColorPicker, CurveEditor or GradientEditor becomes a chip editor in both hosts.

StudioCellEditorArchetype

The values are Dropdown, MultilineText, Slider, Toggle, ColorPicker, CurveEditor and GradientEditor.

ArchetypeCell text
ColorPicker#RRGGBB / #RRGGBBAA
CurveEditorThe canonical CurveValue notation
GradientEditorThe canonical GradientValue notation

The enum is append-only. The two newest values are 5 and 6.

BuiltinCellEditorHints

The three hints the Core itself declares.

Type nameArchetype
ColorColorPicker
AnimationCurveCurveEditor
GradientGradientEditor

These hints travel the same path as a plugin's hints, so the editor and the browser cannot choose different widgets for them.

  • IReadOnlyList<StudioCellEditorHint> All lists the hints in a fixed order.
  • bool TryGet(typeName, out hint) compares type names ordinally.

Hosts consult StudioUiRegistry.CellEditorHints first and fall back to this table.

StudioCellOption

One dropdown candidate.

  • Value is the canonical text written to the cell.
  • Label is what a person reads. It defaults to Value.

StudioSurfaceContext

The one seam an extension sees and acts through. The host assembles it, so the constructor is internal.

An extension reads Tables, ReferenceIndex References, CodeRegistries, Tab, RecordId, Field and ActionArgument. ActionArgument is the value an Input node committed.

An extension changes things through mediated mutation, and nothing else:

  • Action<string,string,string,string> StageCell
  • Action<IReadOnlyList<EdgeCellWrite>> StageCells stages every write as one Undo step, all-or-nothing.
  • Action<string,string> FocusRecord
  • Action RequestRebuild

Staging goes through the window's own gate. A read-only source, a running pipeline or an xlsx-backed tab blocks it with a reason.

Code registries

Code registries are reference targets that live in code. The Data Studio and the web app show them as locked virtual tabs.

The Data Studio consumes them in the sidebar, the record canvas and the node inspector. The import validator does not.

TypeKindRole
CodeRegistryCatalogsealed classRegistration root
CodeRegistrySourcesealed classOne locked virtual tab
CodeRegistryEntrysealed classOne entry

CodeRegistryCatalog

The registration root.

  • Register(CodeRegistrySource) throws on null, an empty tab name or a duplicate tab name.
  • TryGet(tabName, out source)
  • Sources
  • IsEmpty

CodeRegistrySource

One locked virtual tab.

string TabName names the tab. IReadOnlyList<CodeRegistryEntry> Entries holds the entries. Registration order is display order.

CodeRegistryEntry

One entry.

  • string Key is what a reference may point at.
  • string Label
  • IReadOnlyList<string> Raises is never null. A null value normalizes to empty.

Core treats all three as opaque strings.

Next steps