![]() |
VOOZH | about |
dotnet add package Cyrena.Components.Core --version 0.5.0
NuGet\Install-Package Cyrena.Components.Core -Version 0.5.0
<PackageReference Include="Cyrena.Components.Core" Version="0.5.0" />
<PackageVersion Include="Cyrena.Components.Core" Version="0.5.0" />Directory.Packages.props
<PackageReference Include="Cyrena.Components.Core" />Project file
paket add Cyrena.Components.Core --version 0.5.0
#r "nuget: Cyrena.Components.Core, 0.5.0"
#:package Cyrena.Components.Core@0.5.0
#addin nuget:?package=Cyrena.Components.Core&version=0.5.0Install as a Cake Addin
#tool nuget:?package=Cyrena.Components.Core&version=0.5.0Install as a Cake Tool
Cyrena.Components.Core is the Blazor component library providing UI contracts, base classes, and extension methods for building UI components that integrate with CyrΓ©na's kernel-scoped services. Extensions that add UI elements (toolbars, settings pages, shortcuts) must reference this package.
Version: 0.5.0
Target Framework: .NET 10.0
Namespaces: Cyrena.Contracts, Cyrena.Models, Cyrena.Options, Cyrena.Extensions, Cyrena.Attributes, Cyrena.Components.Shared
IDisplayService (Kernel-locked)Service for showing dialogs, toast notifications, and navigation in the Blazor UI.
public interface IDisplayService
{
Task<DialogResult> ShowModal<TComponent>(ResultDialogOption option, Dialog? dialog = null)
where TComponent : IComponent, IResultDialog;
Task<DialogResult> ShowModal(string title, string content, ResultDialogOption? option = null, Dialog? dialog = null);
Task ShowToast(ToastOption option, ToastContainer? toastContainer = null);
Task ShowErrorToast(string? title = null, string? content = null, bool autoHide = true);
Task ShowWarnToast(string? title = null, string? content = null, bool autoHide = true);
Task ShowSuccessToast(string? title = null, string? content = null, bool autoHide = true);
Task ShowInfoToast(string? title = null, string? content = null, bool autoHide = true);
void NavigateTo(string url);
}
Dependencies: Requires BootstrapBlazor components (Dialog, ToastContainer, ToastOption, ResultDialogOption, DialogResult).
Implementation: DisplayService in Cyrena.Components.Runtime implements this interface.
IShortcutDefines a keyboard shortcut or quick action that appears in the UI.
public interface IShortcut
{
string Title { get; }
string Description { get; }
string Icon { get; }
string Color { get; }
string Category { get; }
string[] Tags { get; }
Task OnClick();
}
IToolbarComponentDefines a component that renders in the chat toolbar.
public interface IToolbarComponent
{
Type Component { get; }
ToolbarAlignment Alignment { get; }
}
public enum ToolbarAlignment
{
Start, End
}
Component: The Type of the Blazor component to render.Alignment: Start (left side) or End (right side) of the toolbar.IViewStartProviderProvides optional ViewStart entries for user-configurable starting views.
public interface IViewStartProvider
{
IEnumerable<ViewStart> Provide();
}
KernelInjectAttributeIndicates that the associated property should have a value injected from the KernelComponentBase.Kernel service provider. Overrides ComponentBase.OnParametersSet.
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class KernelInjectAttribute : Attribute
{
public object? Key { get; init; }
}
Key: Optional keyed service key for GetKeyedService resolution.Usage:
public class MyToolbarComponent : KernelComponentBase
{
[KernelInject]
public IChatMessageService ChatService { get; set; } = default!;
[KernelInject(Key = "my-key")]
public IMyService MyService { get; set; } = default!;
}
KernelComponentBaseBase class for Blazor components that need access to the current Kernel and its services via [KernelInject].
public abstract class KernelComponentBase : ComponentBase
{
[Parameter]
[EditorRequired]
public Kernel Kernel { get; set; } = default!;
}
Components extending this class receive the active kernel instance as a parameter. When Kernel is set, all properties marked with [KernelInject] are automatically resolved from Kernel.Services.
ViewStartInformation for a configurable starting view.
public sealed class ViewStart
{
public string Href { get; set; } = default!;
public string Title { get; set; } = default!;
public string? Description { get; set; }
}
ComponentOptionsConfiguration for UI components, particularly settings pages.
public class ComponentOptions
{
internal List<ComponentMetaData> SettingsComponents { get; set; }
public ComponentMetaData[] GetSettingsComponents();
}
public record ComponentMetaData(Type Component, string? Section, int Order);
SettingsComponents: Collection of registered settings component metadata (internal).GetSettingsComponents(): Returns all registered settings components as an array.ComponentMetaData: Record describing a settings component with its type, section group, and display order.ComponentOptionsExtensionsExtension methods for registering settings components:
public static class ComponentOptionsExtensions
{
[Obsolete("Use new section mapping API")]
public static void AddSettingsComponent<TComponent>(this ComponentOptions options)
where TComponent : ComponentBase;
public static void AddSettingsComponent<TComponent>(this ComponentOptions options, string section);
public static void AddSettingsComponent<TComponent>(this ComponentOptions options, string section, int order);
}
CodeLanguagesMaps file extensions to syntax highlighting language identifiers.
public class CodeLanguages
{
public string GetFileLanguage(string extension);
}
Supported mappings:
.c, .h β c.cpp, .hpp, .ino β cpp.cs β csharp.razor β html.css β css.js β javascript.md β markdown.csproj, .xml β xml.json β jsonplaintextCyrenaBuilderExtensionspublic static class CyrenaBuilderExtensions
{
[Obsolete("Use new section mapping API")]
public static CyrenaBuilder AddSettingsComponent<TComponent>(this CyrenaBuilder builder)
where TComponent : ComponentBase;
public static CyrenaBuilder AddSettingsComponent<TComponent>(this CyrenaBuilder builder, string section)
where TComponent : ComponentBase;
public static CyrenaBuilder AddSettingsComponent<TComponent>(this CyrenaBuilder builder, string section, int order)
where TComponent : ComponentBase;
public static CyrenaBuilder AddShortcut<TShortcut>(this CyrenaBuilder builder)
where TShortcut : class, IShortcut;
}
AddSettingsComponent: Registers a Blazor component as a settings tab under the specified section with optional order.AddShortcut: Registers a shortcut action in the UI as a scoped IShortcut service.CyrenaKernelBuilderExtensionspublic static class CyrenaKernelBuilderExtensions
{
public static void AddToolbarComponent<TComponent>(this CyrenaKernelBuilder builder, ToolbarAlignment alignment)
where TComponent : KernelComponentBase;
[Obsolete]
public static void AddToolbarComponent<TComponent>(this IKernelBuilder builder, ToolbarAlignment alignment)
where TComponent : KernelComponentBase;
}
AddToolbarComponent: Registers a component to render in the chat toolbar for the current kernel/chat.IKernelBuilder is deprecated; prefer CyrenaKernelBuilder.ComponentBaseExtensionspublic static class ComponentBaseExtensions
{
public static RenderFragment Render(this ComponentBase cmp, Type type);
public static RenderFragment Render(this ComponentBase cmp, Type type, Dictionary<string, object?> parameters);
}
Helper methods for dynamically rendering Blazor components from code with optional parameter passing.
CodeInput.razorMonaco code editor wrapper (BlazorMonaco) with syntax highlighting, dark theme, and two-way value binding.
Parameters:
Value / ValueChanged β Two-way bound editor contentLanguage β Monaco language mode (default: "plaintext")ConnectionSelector.razorDropdown of available AI connections from all registered IConnectionProvider services.
Parameters:
Value / ValueChanged β Two-way bound selected connection IDLabel β Dropdown label (default: "AI Connection")Behavior: Populates connections on first render and on click. Displays Name (Source) per option.
PluginSelector.razorCheckbox list for activating/deactivating IAssistantPlugin instances filtered by the current chat's assistant mode.
Parameters:
Chat (ChatConfiguration, required) β Chat whose PluginIds will be updatedBehavior:
Chat.PluginIds is empty, all plugins are selected by defaultChat.PluginIds on every selection changeReference Cyrena.Components.Core to:
IShortcut for quick actionsIToolbarComponent for toolbar buttonsKernelComponentBase for kernel-aware UI componentsIDisplayService for dialogs and toasts[KernelInject] for automatic service injection from kernel scopeAddSettingsComponentAddToolbarComponentIViewStartProvider for custom starting viewsExample - Toolbar Component:
public class MyToolbarComponent : KernelComponentBase
{
[KernelInject]
public IChatMessageService ChatService { get; set; } = default!;
}
// In IAssistantPlugin.LoadAsync:
builder.AddToolbarComponent<MyToolbarComponent>(ToolbarAlignment.End);
Example - Shortcut:
public class MyShortcut : IShortcut
{
public string Title => "My Action";
public string Description => "Does something";
public string Icon => "fa-solid fa-star";
public string Color => "primary";
public string Category => "My Category";
public string[] Tags => ["my"];
public Task OnClick() { ... }
}
// In extension BuildExtension:
builder.AddShortcut<MyShortcut>();
Example - Settings Component:
builder.AddSettingsComponent<MySettingsComponent>("General", 1);
Example - View Start Provider:
public class MyViewStartProvider : IViewStartProvider
{
public IEnumerable<ViewStart> Provide()
{
yield return new ViewStart { Href = "/my-page", Title = "My Page" };
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.5.0 | 102 | 5/13/2026 |