formaui-net.Framework.Plugins
1.0.0-preview.27
Prefix Reserved
dotnet add package formaui-net.Framework.Plugins --version 1.0.0-preview.27
NuGet\Install-Package formaui-net.Framework.Plugins -Version 1.0.0-preview.27
<PackageReference Include="formaui-net.Framework.Plugins" Version="1.0.0-preview.27" />
<PackageVersion Include="formaui-net.Framework.Plugins" Version="1.0.0-preview.27" />
<PackageReference Include="formaui-net.Framework.Plugins" />
paket add formaui-net.Framework.Plugins --version 1.0.0-preview.27
#r "nuget: formaui-net.Framework.Plugins, 1.0.0-preview.27"
#:package formaui-net.Framework.Plugins@1.0.0-preview.27
#addin nuget:?package=formaui-net.Framework.Plugins&version=1.0.0-preview.27&prerelease
#tool nuget:?package=formaui-net.Framework.Plugins&version=1.0.0-preview.27&prerelease
Forma.Framework.Plugins
A plugin registry for a feature that others extend. The feature declares its plugin contract, and the registry supplies the rest: registering plugins in order and under one another, configuring each through an options record, building every owner its own instances with their constructor arguments resolved, and disposing what it built.
Install
dotnet add package formaui-net.Framework.Plugins --prerelease
| Type | What it is |
|---|---|
IPlugin |
An extension with an Id, unique among the plugins registered beside it; a feature's contract derives from it. |
IPluginConfigurable<TOptions> |
Declares the options record a plugin's constructor takes. |
PluginRegistry<TPlugin> |
What one owner registers, in order, with whatever each plugin registers under it. |
PluginScope<TPlugin> |
One owner's built plugins, which it disposes. |
PluginInstance<TPlugin> |
One built plugin, its Owner in the tree, and whether it IsAutonomous, governing its own lifetime. |
Declaring plugins
A plugin has one public constructor. It takes its options record, other plugins in the same registry and the host's services:
using Forma.Framework.Plugins;
public interface IChartPlugin : IPlugin
{
void Draw(Chart chart);
}
public sealed class GridOptions
{
public int Step { get; set; } = 5;
}
public sealed class GridPlugin(GridOptions options, LinePlugin line) : IChartPlugin, IPluginConfigurable<GridOptions>
{
public string Id => "grid";
public void Draw(Chart chart) => chart.DrawGrid(line.Bounds, options.Step);
}
Registering
var registry = new PluginRegistry<IChartPlugin>()
.Add<LinePlugin>(line => line
.Add<LegendPlugin>()
.Add<GridPlugin, GridOptions>(options => options.Step = 10))
.Add<ExportPlugin>(_ => sharedExporter)
.TryAdd<TooltipPlugin>();
| Call | What it registers |
|---|---|
Add<TImplementation>(children) |
A plugin built from its constructor, with the plugins children registers under it. |
Add<TImplementation, TOptions>(configure, children) |
A plugin that takes options; configure fills a new options record each time the registry is activated. |
Add<TImplementation>(factory, children) |
A plugin the host creates from its IServiceProvider. |
TryAdd<TImplementation>() |
A fallback, used only when the same registry has no Add of that type. |
Registering a type again replaces the earlier registration in its place, together with whatever was registered under it.
Activating
Activate builds the registry's plugins for one owner, in registration order with each plugin
followed by those under it:
await using var scope = registry.Activate(services);
foreach (var plugin in scope.Plugins)
{
plugin.Draw(chart);
}
Each constructor parameter is taken from the first of these that supplies it:
- a plugin in the same registry, the nearest owner first, as one instance shared by everything that takes it;
- the registration's options record;
- the host's services;
- the parameter's default value.
A parameter none of them supplies, more than one public constructor, or two plugins taking each
other throws an InvalidOperationException that names the plugin. The same type registered in
two places is two plugins, each with its own options.
Disposing the scope disposes every plugin it built, through IAsyncDisposable or IDisposable.
A plugin a factory created is autonomous and stays with the host to dispose.
License
Apache License 2.0, under the repository's LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on formaui-net.Framework.Plugins:
| Package | Downloads |
|---|---|
|
formaui-net.Framework.Composer.Extensibility
The contracts a FormaComposer plugin is written against: what a plugin contributes, what it reads of the composer while it runs, and what it can ask the composer to do. |
|
|
formaui-net.Framework.Composer
The engine FormaComposer runs its plugins with: the description of a composer's plugins and the builders that write it, the catalog that picks the editor and the plugins in play, the registry that routes a command to the layer that runs it, the toolbar layout, the undo history, the status items and gutter markers, text operations, and document conversion. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.27 | 47 | 12/3/2026 |
| 1.0.0-preview.26 | 53 | 12/3/2026 |
| 1.0.0-preview.25 | 63 | 12/2/2026 |
| 1.0.0-preview.24 | 65 | 12/1/2026 |
| 1.0.0-preview.23 | 88 | 11/30/2026 |
| 1.0.0-preview.22 | 82 | 11/30/2026 |
| 1.0.0-preview.21 | 87 | 11/29/2026 |
| 1.0.0-preview.20 | 93 | 11/26/2026 |
| 1.0.0-preview.19 | 94 | 11/26/2026 |
| 1.0.0-preview.18 | 87 | 11/26/2026 |
| 1.0.0-preview.17 | 80 | 11/26/2026 |
| 1.0.0-preview.16 | 77 | 11/24/2026 |
| 1.0.0-preview.15 | 76 | 11/23/2026 |
| 1.0.0-preview.14 | 80 | 11/23/2026 |
| 1.0.0-preview.13 | 82 | 11/21/2026 |
| 1.0.0-preview.12 | 81 | 11/20/2026 |
| 1.0.0-preview.11 | 87 | 11/18/2026 |
| 1.0.0-preview.10 | 83 | 11/17/2026 |
| 1.0.0-preview.9 | 110 | 11/17/2026 |
| 1.0.0-preview.8 | 93 | 11/17/2026 |
What this release changed is in Forma's changelog: https://github.com/FormaUI/Forma/blob/v1.0.0-preview.27/CHANGELOG.md