Add project files.

This commit is contained in:
2025-08-20 11:07:36 +03:30
parent 3863c74931
commit 1a308a4069
899 changed files with 85379 additions and 0 deletions
@@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Elsa.Studio.Contracts;
public interface IActivityTab
{
string Title { get; }
Func<IDictionary<string, object?>, RenderFragment> Render { get; }
}
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Components;
namespace Elsa.Studio.Contracts;
public interface IAppBarService
{
/// <summary>
/// Invoked when the app bar items change.
/// </summary>
event Action AppBarItemsChanged;
/// <summary>
/// A collection of components to render in the app bar.
/// </summary>
IEnumerable<RenderFragment> AppBarItems { get; }
/// <summary>
/// Adds a component to the app bar.
/// </summary>
/// <typeparam name="T">The type of the component.</typeparam>
void AddAppBarItem<T>() where T : IComponent;
}
@@ -0,0 +1,19 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides connection details to the backend.
/// </summary>
public interface IBackendApiClientProvider
{
/// <summary>
/// Gets the URL to the backend.
/// </summary>
Uri Url { get; }
/// <summary>
/// Gets an API client from the backend connection provider.
/// </summary>
/// <typeparam name="T">The API client type.</typeparam>
/// <returns>The API client.</returns>
ValueTask<T> GetApiAsync<T>(CancellationToken cancellationToken = default) where T : class;
}
@@ -0,0 +1,10 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Represents an interface for accessing the current IServiceProvider in Blazor.
/// </summary>
public interface IBlazorServiceAccessor
{
/// Gets or sets the current IServiceProvider.
IServiceProvider Services { get; set; }
}
@@ -0,0 +1,14 @@
using Elsa.Studio.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides information about the client.
/// </summary>
public interface IClientInformationProvider
{
/// <summary>
/// Gets information about the client.
/// </summary>
ValueTask<ClientInformation> GetInfoAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,14 @@
using Elsa.Api.Client.Resources.Scripting.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides available expression descriptors.
/// </summary>
public interface IExpressionProvider
{
/// <summary>
/// Lists all expression descriptors.
/// </summary>
ValueTask<IEnumerable<ExpressionDescriptor>> ListAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,19 @@
using Elsa.Api.Client.Resources.Scripting.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides syntax services.
/// </summary>
public interface IExpressionService
{
/// <summary>
/// Lists all expression descriptors.
/// </summary>
Task<IEnumerable<ExpressionDescriptor>> ListDescriptorsAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Gets a syntax provider by name.
/// </summary>
Task<ExpressionDescriptor?> GetByTypeAsync(string type, CancellationToken cancellationToken = default);
}
@@ -0,0 +1,13 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Represents a feature that can be registered with the dashboard.
/// </summary>
public interface IFeature
{
/// <summary>
/// Called by the dashboard to initialize the feature.
/// </summary>
/// <param name="cancellationToken">A cancellation token.</param>
ValueTask InitializeAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,22 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Manages features.
/// </summary>
public interface IFeatureService
{
/// <summary>
/// Event that is triggered when the features have been initialized.
/// </summary>
event Action? Initialized;
/// <summary>
/// Returns all features.
/// </summary>
IEnumerable<IFeature> GetFeatures();
/// <summary>
/// Initializes all features.
/// </summary>
Task InitializeFeaturesAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,30 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Represents a mediator that can be used to publish notifications and subscribe to notifications.
/// </summary>
public interface IMediator
{
/// <summary>
/// Subscribes to a notification.
/// </summary>
/// <param name="handler"></param>
/// <typeparam name="TNotification"></typeparam>
/// <typeparam name="THandler"></typeparam>
void Subscribe<TNotification, THandler>(THandler handler) where THandler : INotificationHandler<TNotification> where TNotification : INotification;
/// <summary>
/// Unsubscribes from a notification.
/// </summary>
void Unsubscribe<TNotification, THandler>(THandler handler) where THandler : INotificationHandler<TNotification> where TNotification : INotification;
/// <summary>
/// Unsubscribes from a notification.
/// </summary>
void Unsubscribe(INotificationHandler handler);
/// <summary>
/// Publishes a notification.
/// </summary>
Task NotifyAsync<TNotification>(TNotification notification, CancellationToken cancellationToken = default) where TNotification : INotification;
}
@@ -0,0 +1,16 @@
using Elsa.Studio.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Returns menu item groups to the dashboard.
/// </summary>
public interface IMenuGroupProvider
{
/// <summary>
/// Returns menu item groups to the dashboard.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A collection of <see cref="MenuItemGroup"/> instances.</returns>
ValueTask<IEnumerable<MenuItemGroup>> GetMenuGroupsAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,10 @@
using Elsa.Studio.Models;
namespace Elsa.Studio.Contracts;
/// Provides menu items to the dashboard.
public interface IMenuProvider
{
/// Returns a list of menu items.
ValueTask<IEnumerable<MenuItem>> GetMenuItemsAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,23 @@
using Elsa.Studio.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// A service that provides menu items and menu item groups.
/// </summary>
public interface IMenuService
{
/// <summary>
/// Returns all menu items from all menu providers.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A list of <see cref="MenuItem"/> instances.</returns>
ValueTask<IEnumerable<MenuItem>> GetMenuItemsAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Returns all menu item groups from all menu group providers.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A list of <see cref="MenuItemGroup"/> instances.</returns>
ValueTask<IEnumerable<MenuItemGroup>> GetMenuItemGroupsAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,5 @@
namespace Elsa.Studio.Contracts;
public interface INotification
{
}
@@ -0,0 +1,22 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Represents a notification handler.
/// </summary>
public interface INotificationHandler
{
}
/// <summary>
/// Represents a notification handler.
/// </summary>
/// <typeparam name="T">The type of the notification.</typeparam>
public interface INotificationHandler<in T> : INotificationHandler where T : INotification
{
/// <summary>
/// Handles the given notification.
/// </summary>
/// <param name="notification">The notification to handle.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task HandleAsync(T notification, CancellationToken cancellationToken);
}
@@ -0,0 +1,14 @@
using Elsa.Studio.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides access to the current remote backend.
/// </summary>
public interface IRemoteBackendAccessor
{
/// <summary>
/// Gets or sets the current backend.
/// </summary>
RemoteBackend RemoteBackend { get; }
}
@@ -0,0 +1,22 @@
using Elsa.Api.Client.Resources.Features.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides a way to check if a feature is enabled.
/// </summary>
public interface IRemoteFeatureProvider
{
/// <summary>
/// Returns a value indicating whether the feature with the specified name is enabled.
/// </summary>
/// <param name="featureName">The name of the feature.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
/// <returns>A value indicating whether the feature with the specified name is enabled.</returns>
Task<bool> IsEnabledAsync(string featureName, CancellationToken cancellationToken = default);
/// <summary>
/// Returns a list of installed features.
/// </summary>
Task<IEnumerable<FeatureDescriptor>> ListAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,14 @@
using Elsa.Studio.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides information about the server.
/// </summary>
public interface IServerInformationProvider
{
/// <summary>
/// Gets information about the server.
/// </summary>
ValueTask<ServerInformation> GetInfoAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,13 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Represents a startup task that is invoked once during application startup.
/// </summary>
public interface IStartupTask
{
/// <summary>
/// Invoked during application startup.
/// </summary>
/// <param name="cancellationToken">A cancellation token.</param>
ValueTask ExecuteAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,12 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Runs startup tasks.
/// </summary>
public interface IStartupTaskRunner
{
/// <summary>
/// Runs startup tasks.
/// </summary>
Task RunStartupTasksAsync(CancellationToken cancellationToken = default);
}
@@ -0,0 +1,36 @@
using MudBlazor;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides theme information to the dashboard.
/// </summary>
public interface IThemeService
{
/// <summary>
/// Raised when the current theme changes.
/// </summary>
event Action CurrentThemeChanged;
/// <summary>
/// Raised when the dark mode changes.
/// </summary>
event Action IsDarkModeChanged;
/// <summary>
/// The current theme.
/// </summary>
MudTheme CurrentTheme { get; set; }
/// <summary>
/// Returns the current palette, depending on whether the dashboard is in dark mode.
/// </summary>
#pragma warning disable CS0618
Palette CurrentPalette => IsDarkMode ? CurrentTheme.PaletteDark : CurrentTheme.PaletteLight;
#pragma warning restore CS0618
/// <summary>
/// Whether the dashboard is in dark mode.
/// </summary>
public bool IsDarkMode { get; set; }
}
@@ -0,0 +1,52 @@
using Elsa.Studio.Enums;
using Elsa.Studio.Models;
using Microsoft.AspNetCore.Components;
namespace Elsa.Studio.Contracts
{
/// <summary>
/// Provides a contract for UI field extension handlers.
/// </summary>
public interface IUIFieldExtensionHandler
{
/// <summary>
/// The order in which the extensions should be displayed.
/// </summary>
int DisplayOrder { get; set; }
/// <summary>
/// If set to true and no restricting types are set, either with <c>UIHintComponent</c>, <c>ActivityTypes</c> or <c>Syntaxes</c>, this extension will be rendered for in all field types.
/// </summary>
bool IncludeForAll { get; set; }
/// <summary>
/// The position to render the extension within the field.
/// </summary>
FieldExtensionPosition Position { get; set; }
/// <summary>
/// The UIHint component this extension should be rendered for.
/// </summary>
string UIHintComponent { get; set; }
/// <summary>
/// The activities this extension should be rendered for.
/// </summary>
List<string> ActivityTypes { get; set; }
/// <summary>
/// The syntaxes this extension should be rendered for.
/// </summary>
List<string> Syntaxes { get; set; }
/// <summary>
/// Returns true if the handler extension the specified or is empty.
/// </summary>
bool GetExtensionForInputComponent(string componentName);
/// <summary>
/// Returns a <see cref="RenderFragment"/> of the added extension.
/// </summary>
RenderFragment DisplayExtension(DisplayInputEditorContext context);
}
}
@@ -0,0 +1,17 @@
using Elsa.Studio.Models;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides a service contact for resolving UI field extensions
/// </summary>
public interface IUIFieldExtensionService
{
/// <summary>
/// Try to return a list of extension handlers for a component
/// </summary>
/// <param name="componentName">The component name to get the handler for. This should be the name of the component calling this function.</param>
/// <param name="context">The display input editor context</param>
/// <returns></returns>
List<IUIFieldExtensionHandler>? TryGetHandlers(string componentName, DisplayInputEditorContext context);
}
@@ -0,0 +1,25 @@
using Elsa.Studio.Models;
using Microsoft.AspNetCore.Components;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides a contract for UI hint handlers.
/// </summary>
public interface IUIHintHandler
{
/// <summary>
/// Returns true if the handler supports the specified UI hint.
/// </summary>
bool GetSupportsUIHint(string uiHint);
/// <summary>
/// Returns the UI syntax for the handler.
/// </summary>
string UISyntax { get; }
/// <summary>
/// Returns a <see cref="RenderFragment"/> that renders the input editor.
/// </summary>
RenderFragment DisplayInputEditor(DisplayInputEditorContext context);
}
@@ -0,0 +1,7 @@
namespace Elsa.Studio.Contracts;
public interface IUIHintService
{
IUIHintHandler GetHandler(string uiHint);
//RenderFragment DisplayInputEditor(DisplayInputEditorContext context);
}
@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Components;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides the <see cref="RenderFragment"/> to display the login page.
/// </summary>
public interface IUnauthorizedComponentProvider
{
/// <summary>
/// Returns the <see cref="RenderFragment"/> to display the login page.
/// </summary>
RenderFragment GetUnauthorizedComponent();
}
@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Components;
namespace Elsa.Studio.Contracts;
/// <summary>
/// Represents a widget.
/// </summary>
public interface IWidget
{
/// <summary>
/// Gets the zone in which the widget should be rendered.
/// </summary>
string Zone { get; }
/// <summary>
/// Gets the order in which the widget should be rendered.
/// </summary>
double Order { get; }
/// <summary>
/// Gets the fragment to render.
/// </summary>
Func<IDictionary<string, object?>, RenderFragment> Render { get; }
}
@@ -0,0 +1,17 @@
namespace Elsa.Studio.Contracts;
/// <summary>
/// Provides a registry of widgets.
/// </summary>
public interface IWidgetRegistry
{
/// <summary>
/// Adds the specified widget to the registry.
/// </summary>
void Add(IWidget widget);
/// <summary>
/// Returns a list of widgets for the specified zone.
/// </summary>
IEnumerable<IWidget> List(string zone);
}