diff --git a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor index 434cd066..10689bca 100644 --- a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor +++ b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor @@ -116,7 +116,9 @@ UncheckedColor="@assistantSwitch.GetColor(assistantSwitch.UncheckedColor)" ThumbIcon="@assistantSwitch.GetIconSvg()" ThumbIconColor="@assistantSwitch.GetColor(assistantSwitch.IconColor)" - Disabled="@assistantSwitch.Disabled"> + Disabled="@assistantSwitch.Disabled" + Class="@assistantSwitch.Class" + Style="@this.GetOptionalStyle(assistantSwitch.Style)"> @(currentValue ? assistantSwitch.LabelOn : assistantSwitch.LabelOff) diff --git a/app/MindWork AI Studio/Plugins/assistants/README.md b/app/MindWork AI Studio/Plugins/assistants/README.md index 2e92a50c..a225f1d3 100644 --- a/app/MindWork AI Studio/Plugins/assistants/README.md +++ b/app/MindWork AI Studio/Plugins/assistants/README.md @@ -11,7 +11,7 @@ Supported types (matching the Blazor UI components): - `TEXT_AREA`: user input field based on `MudTextField`; requires `Name`, `Label`, and may include `HelperText`, `HelperTextOnFocus`, `Adornment`, `AdornmentIcon`, `AdornmentText`, `AdornmentColor`, `Counter`, `MaxLength`, `IsImmediate`, `UserPrompt`, `PrefillText`, `IsSingleLine`, `ReadOnly`, `Class`, `Style`. - `DROPDOWN`: selects between variants; `Props` must include `Name`, `Label`, `Default`, `Items`, and optionally `ValueType` plus `UserPrompt`. -- `SWITCH`: boolean option; requires `Name`, `Label`, `Value`, and may include `Disabled`, `UserPrompt`, `LabelOn`, `LabelOff`, `LabelPlacement`, `Icon`, `IconColor`, `CheckedColor`, `UncheckedColor`. +- `SWITCH`: boolean option; requires `Name`, `Label`, `Value`, and may include `Disabled`, `UserPrompt`, `LabelOn`, `LabelOff`, `LabelPlacement`, `Icon`, `IconColor`, `CheckedColor`, `UncheckedColor`, `Class`, `Style`. - `COLOR_PICKER`: color input based on `MudColorPicker`; requires `Name`, `Label`, and may include `Placeholder`, `ShowAlpha`, `ShowToolbar`, `ShowModeSwitch`, `PickerVariant`, `UserPrompt`, `Class`, `Style`. - `PROVIDER_SELECTION` / `PROFILE_SELECTION`: hooks into the shared provider/profile selectors. - `WEB_CONTENT_READER`: renders `ReadWebContent`; include `Name`, `UserPrompt`, `Preselect`, `PreselectContentCleanerAgent`. @@ -173,7 +173,8 @@ Example: - `IconColor`: one of the MudBlazor `Color` enum names such as `Primary`, `Secondary`, `Warning`; omitted values default to `Inherit`. - `CheckedColor`: color used when the switch state is `true`; omitted values default to `Inherit`. - `UncheckedColor`: color used when the switch state is `false`; omitted values default to `Inherit`. - + - `Class`, `Style`: forwarded to the rendered component for layout/styling. + - Example: ```lua { @@ -190,7 +191,8 @@ Example: ["Icon"] = "Icons.Material.Filled.Summarize", ["IconColor"] = "Primary", ["CheckedColor"] = "Success", - ["UncheckedColor"] = "Default" + ["UncheckedColor"] = "Default", + ["Class"] = "mb-6", } } ``` diff --git a/app/MindWork AI Studio/Plugins/assistants/plugin.lua b/app/MindWork AI Studio/Plugins/assistants/plugin.lua index cabe3838..1053c83e 100644 --- a/app/MindWork AI Studio/Plugins/assistants/plugin.lua +++ b/app/MindWork AI Studio/Plugins/assistants/plugin.lua @@ -83,8 +83,8 @@ ASSISTANT = { ["PrefillText"] = "", ["IsSingleLine"] = false, -- if true, shows a text field instead of an area ["ReadOnly"] = false, -- if true, deactivates user input (make sure to provide a PrefillText) - ["Class"] = "", - ["Style"] = "", + ["Class"] = "", + ["Style"] = "", } }, { @@ -116,6 +116,8 @@ ASSISTANT = { ["IconColor"] = "", -- color of the thumb icon. Defaults to `Inherit` ["CheckedColor"] = "", -- color of the switch if state is true. Defaults to `Inherit` ["UncheckedColor"] = "", -- color of the switch if state is false. Defaults to `Inherit` + ["Class"] = "", + ["Style"] = "", } }, { diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantSwitch.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantSwitch.cs index 7de760ac..798a1dd0 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantSwitch.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/AssistantSwitch.cs @@ -79,6 +79,18 @@ internal sealed class AssistantSwitch : AssistantComponentBase get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.IconColor)); set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.IconColor), value); } + + public string Class + { + get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Class)); + set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Class), value); + } + + public string Style + { + get => AssistantComponentPropHelper.ReadString(this.Props, nameof(this.Style)); + set => AssistantComponentPropHelper.WriteString(this.Props, nameof(this.Style), value); + } public MudBlazor.Color GetColor(string colorString) => Enum.TryParse(colorString, out var color) ? color : MudBlazor.Color.Inherit; public Placement GetLabelPlacement() => Enum.TryParse(this.LabelPlacement, out var placement) ? placement : Placement.Right; diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs index 6525f7f7..b3e54833 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/DataModel/ComponentPropSpecs.cs @@ -35,7 +35,10 @@ public static class ComponentPropSpecs ), [AssistantComponentType.SWITCH] = new( required: ["Name", "Label", "Value"], - optional: [ "LabelOn", "LabelOff", "LabelPlacement", "Icon", "IconColor", "UserPrompt", "CheckedColor", "UncheckedColor", "Disabled"] + optional: [ + "LabelOn", "LabelOff", "LabelPlacement", "Icon", "IconColor", "UserPrompt", + "CheckedColor", "UncheckedColor", "Disabled", "Class", "Style", + ] ), [AssistantComponentType.HEADING] = new( required: ["Text", "Level"],