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.
| Area | Namespace |
|---|---|
| Record canvas | SheetForge.Core.Graphing |
| Color presets | SheetForge.Core.Theming |
| Declarative authoring surfaces | SheetForge.Core.Studio |
| Code registries | SheetForge.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.
| Type | Kind | Role |
|---|---|---|
IRecordCanvasAugmenter | interface | One tab's canvas override |
CanvasAugmentBuilder | sealed class | The write surface of an override |
GraphShapeRegistry | sealed class | Tab name → canvas override |
GraphBuildContext | sealed class | The override's read-only input |
GraphSpecBuilder | sealed class | The graph assembly helper |
GraphSpec | sealed class | The assembled result the canvas draws |
GraphNodeSpec | sealed class | One node |
GraphWireSpec | sealed class | One wire |
IAuthorableGraphShape | interface | Opt-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.TryGetIsEmpty
GraphBuildContext
The override's read-only input.
Tablesmaps a tab to itsSheetTable.ReferenceIndex ReferencesIReadOnlyList<CodeRegistrySource> CodeRegistriesis 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.
| Group | Members |
|---|---|
| Display | FromKey, ToKey, Label, IsCyclic, CyclicNote |
| The optional owning cell | FromTab, 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 add | Method |
|---|---|
| A virtual node | AddNode |
| An extra edge | AddEdge |
| A layer hint | SetLayer, SetLayerRelative |
| A display hint | SetSubtitle |
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)
| Argument | What it says |
|---|---|
fieldName | Which cell the link is written in |
fieldOnTarget | That cell sits on the arrival rather than the departure |
isCyclic, cyclicNote | Mark 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.
| Type | Role |
|---|---|
ThemeRegistry | Preset id → theme |
SheetForgeTheme | One color preset |
ThemeColorSlot | The 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.
IdDisplayNameDarkColors/LightColorsare each anIReadOnlyDictionary<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.
| Type | Kind | Role |
|---|---|---|
StudioUiRegistry | sealed class | What RegisterStudioUi fills |
StudioUiNode | sealed class | One described fragment, immutable |
StudioUiNodeKind | enum | The 13 node kinds, Row … Link |
StudioActionDescriptor | sealed class | One verb |
StudioActionPlacement | enum | The seat an action takes |
StudioPanelDescriptor | sealed class | One panel in the Studio's right-hand pane |
StudioColumnBadgeDescriptor | sealed class | One badge beside a column header |
StudioCellEditorHint | sealed class | Picks a built-in widget for a type |
StudioCellEditorArchetype | enum | The built-in widget kinds a hint picks from |
BuiltinCellEditorHints | static class | The three hints the Core itself declares |
StudioCellOption | sealed class | One dropdown candidate |
StudioSurfaceContext | sealed class | The one seam an extension sees and acts through |
StudioUiRegistry
RegisterStudioUi fills this registry.
| Method | Collection |
|---|---|
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)allowshttpandhttpsonly.
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.
Idis unique.LabelKeyis a Loc key. An unregistered key shows verbatim.StudioActionPlacement PlacementFunc<StudioSurfaceContext,bool> AppliesToAction<StudioSurfaceContext> ExecuteConfirmKeyis 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.
| Seat | Context it carries |
|---|---|
| The node inspector seat | The active tab only |
| The row seat | The record |
| The topbar seat | The active tab only |
| The column seat | The column name |
| The canvas seat | That node's record |
StudioPanelDescriptor
One panel in the Studio's right-hand pane.
IdTitleKeyFunc<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.
TypeNameis an exactCellParserRegistrytype name.StudioCellEditorArchetype ArchetypeGetOptionsis for a dropdown only. Its shape isFunc<context, tab, field, IReadOnlyList<StudioCellOption>>.SliderMin/SliderMaxToggleTrueValue/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.
| Archetype | Cell text |
|---|---|
ColorPicker | #RRGGBB / #RRGGBBAA |
CurveEditor | The canonical CurveValue notation |
GradientEditor | The 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 name | Archetype |
|---|---|
Color | ColorPicker |
AnimationCurve | CurveEditor |
Gradient | GradientEditor |
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> Alllists 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.
Valueis the canonical text written to the cell.Labelis what a person reads. It defaults toValue.
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> StageCellAction<IReadOnlyList<EdgeCellWrite>> StageCellsstages every write as one Undo step, all-or-nothing.Action<string,string> FocusRecordAction 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.
| Type | Kind | Role |
|---|---|---|
CodeRegistryCatalog | sealed class | Registration root |
CodeRegistrySource | sealed class | One locked virtual tab |
CodeRegistryEntry | sealed class | One entry |
CodeRegistryCatalog
The registration root.
Register(CodeRegistrySource)throws on null, an empty tab name or a duplicate tab name.TryGet(tabName, out source)SourcesIsEmpty
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 Keyis what a reference may point at.string LabelIReadOnlyList<string> Raisesis never null. A null value normalizes to empty.
Core treats all three as opaque strings.
Next steps
- Canvas overrides
Add nodes, edges, layers and display names to a tab's canvas.
- Authoring surfaces
Describe actions, panels, badges and cell editor hints as data.
- Theming and strings
Register color presets and translated UI strings.
- Plugin contracts
The interfaces that fill these registries.