Docs · API reference · Verso.Contexts

PanelContext Class#

IPanelContext implementation backed by a Scaffold. Hosts build one of these each time they ask a panel whether it is available or ask it to produce content.

public sealed class PanelContext : Verso.Abstractions.IPanelContext, Verso.Abstractions.IVersoContext

Inheritance System.Object → PanelContext

Implements IPanelContext, IVersoContext

Remarks#

Panels do not execute cells, so WriteOutputAsync(CellOutput) and UpdateOutputAsync(string, CellOutput) have no cell to write to. A panel that wants to affect the notebook goes through Notebook, which is the same route a toolbar action takes.

Properties#

CancellationToken Property#

Gets the cancellation token that signals when the current operation should be aborted.

public System.Threading.CancellationToken CancellationToken { get; }

Implements CancellationToken

Property Value#

System.Threading.CancellationToken

ExtensionHost Property#

Gets the extension host context for querying loaded extensions by category.

public Verso.Abstractions.IExtensionHostContext ExtensionHost { get; }

Implements ExtensionHost

Property Value#

IExtensionHostContext

LayoutCapabilities Property#

Gets the layout capabilities supported by the current rendering surface.

public Verso.Abstractions.LayoutCapabilities LayoutCapabilities { get; }

Implements LayoutCapabilities

Property Value#

LayoutCapabilities

Notebook Property#

Gets the notebook operations interface for executing cells, managing outputs, and mutating the cell collection.

public Verso.Abstractions.INotebookOperations Notebook { get; }

Implements Notebook

Property Value#

INotebookOperations

NotebookCells Property#

Gets the ordered list of all cell models in the notebook.

public System.Collections.Generic.IReadOnlyList<Verso.Abstractions.CellModel> NotebookCells { get; }

Implements NotebookCells

Property Value#

System.Collections.Generic.IReadOnlyList<CellModel>

NotebookMetadata Property#

Gets the read-only metadata for the current notebook.

public Verso.Abstractions.INotebookMetadata NotebookMetadata { get; }

Implements NotebookMetadata

Property Value#

INotebookMetadata

SelectedCellId Property#

Gets the identifier of the currently selected cell, or null when no cell is selected. Panels that report on the selection should re-render when this changes; the host calls RenderAsync(IPanelContext) again on selection change.

public System.Nullable<System.Guid> SelectedCellId { get; }

Implements SelectedCellId

Property Value#

System.Nullable<System.Guid>

Theme Property#

Gets the active theme context for resolving colors, fonts, and spacing.

public Verso.Abstractions.IThemeContext Theme { get; }

Implements Theme

Property Value#

IThemeContext

Variables Property#

Gets the shared variable store for exchanging data between kernels.

public Verso.Abstractions.IVariableStore Variables { get; }

Implements Variables

Property Value#

IVariableStore

Methods#

UpdateOutputAsync(string, CellOutput) Method#

Updates an existing output block in place, replacing its content with the new output.

public System.Threading.Tasks.Task UpdateOutputAsync(string outputBlockId, Verso.Abstractions.CellOutput output);

Parameters#

outputBlockId System.String

The identifier of the output block to update.

output CellOutput

The new cell output to display.

Implements UpdateOutputAsync(string, CellOutput)

Returns#

System.Threading.Tasks.Task
A task that completes when the update has been sent.

WriteOutputAsync(CellOutput) Method#

Writes a cell output to the notebook output stream.

public System.Threading.Tasks.Task WriteOutputAsync(Verso.Abstractions.CellOutput output);

Parameters#

output CellOutput

The cell output to write.

Implements WriteOutputAsync(CellOutput)

Returns#

System.Threading.Tasks.Task
A task that completes when the output has been written.