From: Brandon Li <48413902+aspiringLich@users.noreply.github.com> Date: Sun, 19 Oct 2025 21:10:44 +0000 (-0400) Subject: `StyleNano` removal: Palette system and Sheetlets (#29903) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=545cacbcaeef497fcb953b047921a9f413bfee27;p=space-station-14.git `StyleNano` removal: Palette system and Sheetlets (#29903) * Apply patch https://github.com/moonheart08/space-station-14/compare/1777eea9a42a8bdbc4a865327bb9ef3e10fe57de..6b32bb2b148ef9d312b5332ccea4d8688694dba5 Signed-off-by: Brandon Li * make red squiggly line go away Signed-off-by: Brandon Li * Add todo list Signed-off-by: Brandon Li * Add palette to `TextureButton` Signed-off-by: Brandon Li * Rename `PalettedButtonSheetlet` to `NTButtonSheetlet` and move useful methods to `ButtonSheetlet` Signed-off-by: Brandon Li * migrate `ContextMenu` styles Signed-off-by: Brandon Li * Update todo Signed-off-by: Brandon Li * tweak NT colors * New stylesheet: `InterfaceStylesheet` & `InterfaceTooltipSheetlet` * Move inheritance of `IButtonConfig` to `NanotransenStylesheet.Buttons` * move `MenuButtonSheetlet` & actually implement `InterfaceStylesheet` correctly Signed-off-by: Brandon Li * tweak color & update todo Signed-off-by: Brandon Li * chat is this real (update chat palette) Signed-off-by: Brandon Li * Update todo Signed-off-by: Brandon Li * `SmallButton` and remove some obsolete things from `StyleNano` Signed-off-by: Brandon Li * rename `StyleClasses` to `StyleClass` so `Stylesheets.Redux.StyleClasses` syntax is dead Signed-off-by: Brandon Li * replace `ButtonColorGreen` with `Positive` Signed-off-by: Brandon Li * `Placeholder` Signed-off-by: Brandon Li * Examine popup buttons Signed-off-by: Brandon Li * move over more things & cleanup `StyleNano` more (under 1000 lines!!!!) Signed-off-by: Brandon Li * Remove some more redundant stuff Signed-off-by: Brandon Li * Undo style change for chat window Signed-off-by: Brandon Li * paper editing works now Signed-off-by: Brandon Li * `OptionButton` styles Signed-off-by: Brandon Li * `ListContainer`, move `DefaultWindow` styles (for now) & more cleanup Signed-off-by: Brandon Li * fix `ActionButton` not having highlighting Signed-off-by: Brandon Li * remove imports of `Robust.Client.UserInterface.StylesheetHelpers` & format Signed-off-by: Brandon Li * `ButtonBig` and more cleanup Signed-off-by: Brandon Li * Move items inheriting from `ISheetletConfig` into their own directory Signed-off-by: Brandon Li * Cleanup & move `Label` styles Signed-off-by: Brandon Li * Action search box styles Signed-off-by: Brandon Li * Moved, stuff is Signed-off-by: Brandon Li * rename `LabelSubtext` to `LabelSubText` & move more stuff (were almost there!!) Signed-off-by: Brandon Li * yap & move over MORE stuff (just like one thing left!!!) Signed-off-by: Brandon Li * Change status classes to appropriate existing classes Signed-off-by: Brandon Li * remove remaining references to `StyleNano` Signed-off-by: Brandon Li * Fix some hardcoding & broken code, `GetFromControl` Signed-off-by: Brandon Li * Scrollbars! Signed-off-by: Brandon Li * chores Signed-off-by: Brandon Li * clean up `StyleClass.cs` Signed-off-by: Brandon Li * `ItemListSheetlet` refactor Signed-off-by: Brandon Li * more chores! Signed-off-by: Brandon Li * Consistency w/ directory structure Signed-off-by: Brandon Li * Move `MainMenuSheetlet` Signed-off-by: Brandon Li * `ColorPalette` Signed-off-by: Brandon Li * whoopsie Signed-off-by: Brandon Li * Remove most sheet-specific sheetlets Signed-off-by: Brandon Li * fix warnings, cleanup, & fix scrollbar (this is why we fix warnings boys) Signed-off-by: Brandon Li * yap Signed-off-by: Brandon Li * MASSIVE resharper skill issue Signed-off-by: Brandon Li * actually use `ISheetletConfig` Signed-off-by: Brandon Li * have specific sheetlet be specific Signed-off-by: Brandon Li * `GetResourceOr` Signed-off-by: Brandon Li * cleanup & move / remove `IPalette`s Signed-off-by: Brandon Li * actually do specific stylesheets correctly & fix tooltips Signed-off-by: Brandon Li * cleanup & logging Signed-off-by: Brandon Li * Move `FontKind` and `FontKindExtensions` to their own files Signed-off-by: Brandon Li * rename `InterfaceStylesheet` to `SystemStylesheet` Signed-off-by: Brandon Li * change `ButtonHovered` etc to `PseudoHovered` etc Signed-off-by: Brandon Li * give the palettes fun names Signed-off-by: Brandon Li * `StyleSpace` is no more Signed-off-by: Brandon Li * It should compile now! I am now going to bed (fr) if it fails it fails Signed-off-by: Brandon Li * make squiggly red line go away Signed-off-by: Brandon Li * add additional type restrictions to sheetlets * `CommonStylesheet` * minor cleanup * Make `GetSheetletRules` not horrible * wait this was duplicating style rules. oops! * move some sheetlets to their associated xamls * oh wait apparently that was important * review pass 1 * review pass 2 (font & color stuff) * review pass 3: remove unused stuff / filename fix * fix warnings & "replace cast with explicit variable type" * move `Palette` stuff to its own directory * tweak colors (they're different now that I actually fixed the OKlab thing) * review pass 4: little things * make window close button grey before hovering * refactor `HLine` to make it less terrible and allow it to be styled * fix `NanoHeading` (it's been broken for a while whoops) and cleanup hardcoding * band-aid missing references in `StyleNano` * move `StyleBox` generating functions out of `IButtonSheetlet` into `StyleBoxHelper` * remove dictionary field from `IStylesheetManager` * Add check for unloaded sheetlets * style tweaks to satisfy OCD * I somehow missed this: `Caution` styleclass replaced with `negative`, refactor `PowerChargeWindow` * tweak palettes for like the fourth time * construct `StyleNano` / `StyleSpace` in `StylesheetManager` and mark them as obsolete * rename `BackgroundPanel` classes for consistency * tweak window / `ListContainer` * oh right you use `///` not `/**` * font system is bad, make it temporary * acknowledge Divider funkyness * remove use of class `Disabled` * `ColorPalette` allow overriding colors with brace initialization * review pass again * tweak disabled button colors * `StatusPalette` tweaks * typo * Make squiggly red line go away * Delete `Redux` * Remove all references to `Redux` * make red less radioactive * Store stylesheet name inside stylesheet class * fix merge errors * use RT's Oklab support instead * shuffle around `StylesheetManager` fields * apply stylesheets based off `StylesheetComponent` * simplify `ColorPalette` construction * add todo for `SheetletConfigType` * `OptionButton` has a background color now * fix disabled buttons * sigh (red color palette fixed) * make `ItemList` use primary palette * Revert "apply stylesheets based off `StylesheetComponent`" This reverts commit c05b147da845f6e04ff33d1cbd91a18a92c676d7. * dead code removal * buttons are green when pressed (we need togglebuttons) --------- Signed-off-by: Brandon Li Co-authored-by: Janet Blackquill --- diff --git a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs index 209c58c950..ea96b13376 100644 --- a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs +++ b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs @@ -9,6 +9,7 @@ using Robust.Client.UserInterface.XAML; using Robust.Shared.Prototypes; using System.Numerics; using System.Linq; +using Content.Client.Stylesheets; namespace Content.Client.Access.UI { @@ -49,12 +50,12 @@ namespace Content.Client.Access.UI icons.Sort((x, y) => string.Compare(x.LocalizedJobName, y.LocalizedJobName, StringComparison.CurrentCulture)); foreach (var jobIcon in icons) { - String styleBase = StyleBase.ButtonOpenBoth; + String styleBase = StyleClass.ButtonOpenBoth; var modulo = i % JobIconColumnCount; if (modulo == 0) - styleBase = StyleBase.ButtonOpenRight; + styleBase = StyleClass.ButtonOpenRight; else if (modulo == JobIconColumnCount - 1) - styleBase = StyleBase.ButtonOpenLeft; + styleBase = StyleClass.ButtonOpenLeft; // Generate buttons var jobIconButton = new Button diff --git a/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs b/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs index 7af78d9e5f..2a85530c48 100644 --- a/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs +++ b/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs @@ -119,11 +119,11 @@ public sealed partial class GroupedAccessLevelChecklist : BoxContainer if (_groupedAccessLevels.Count > 1) { if (AccessGroupList.ChildCount == 0) - accessGroupButton.AddStyleClass(StyleBase.ButtonOpenLeft); + accessGroupButton.AddStyleClass(StyleClass.ButtonOpenLeft); else if (_groupedAccessLevels.Count > 1 && AccessGroupList.ChildCount == (_groupedAccessLevels.Count - 1)) - accessGroupButton.AddStyleClass(StyleBase.ButtonOpenRight); + accessGroupButton.AddStyleClass(StyleClass.ButtonOpenRight); else - accessGroupButton.AddStyleClass(StyleBase.ButtonOpenBoth); + accessGroupButton.AddStyleClass(StyleClass.ButtonOpenBoth); } accessGroupButton.Pressed = _accessGroupTabIndex == orderedAccessGroups.IndexOf(accessGroup); diff --git a/Content.Client/Actions/UI/ActionAlertTooltip.cs b/Content.Client/Actions/UI/ActionAlertTooltip.cs index 664a67b406..065c16d61b 100644 --- a/Content.Client/Actions/UI/ActionAlertTooltip.cs +++ b/Content.Client/Actions/UI/ActionAlertTooltip.cs @@ -23,9 +23,10 @@ namespace Content.Client.Actions.UI public ActionAlertTooltip(FormattedMessage name, FormattedMessage? desc, string? requires = null) { + Stylesheet = IoCManager.Resolve().SheetSystem; _gameTiming = IoCManager.Resolve(); - SetOnlyStyleClass(StyleNano.StyleClassTooltipPanel); + SetOnlyStyleClass(StyleClass.TooltipPanel); BoxContainer vbox; AddChild(vbox = new BoxContainer @@ -36,7 +37,7 @@ namespace Content.Client.Actions.UI var nameLabel = new RichTextLabel { MaxWidth = TooltipTextMaxWidth, - StyleClasses = {StyleNano.StyleClassTooltipActionTitle} + StyleClasses = { StyleClass.TooltipTitle } }; nameLabel.SetMessage(name); vbox.AddChild(nameLabel); @@ -46,7 +47,7 @@ namespace Content.Client.Actions.UI var description = new RichTextLabel { MaxWidth = TooltipTextMaxWidth, - StyleClasses = {StyleNano.StyleClassTooltipActionDescription} + StyleClasses = { StyleClass.TooltipDesc } }; description.SetMessage(desc); vbox.AddChild(description); @@ -55,7 +56,7 @@ namespace Content.Client.Actions.UI vbox.AddChild(_cooldownLabel = new RichTextLabel { MaxWidth = TooltipTextMaxWidth, - StyleClasses = {StyleNano.StyleClassTooltipActionCooldown}, + StyleClasses = { StyleClass.TooltipDesc }, Visible = false }); @@ -64,7 +65,7 @@ namespace Content.Client.Actions.UI var requiresLabel = new RichTextLabel { MaxWidth = TooltipTextMaxWidth, - StyleClasses = {StyleNano.StyleClassTooltipActionRequirements} + StyleClasses = { StyleClass.TooltipDesc } }; if (!FormattedMessage.TryFromMarkup("[color=#635c5c]" + requires + "[/color]", out var markup)) diff --git a/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml b/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml index cc5207bb3a..bfe6b31c28 100644 --- a/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml +++ b/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml @@ -7,7 +7,7 @@ - + diff --git a/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml.cs b/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml.cs index 148cbf4e18..7870dae7b2 100644 --- a/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml.cs +++ b/Content.Client/Administration/UI/AdminRemarks/AdminMessagePopupWindow.xaml.cs @@ -12,17 +12,19 @@ namespace Content.Client.Administration.UI.AdminRemarks; [GenerateTypedNameReferences] public sealed partial class AdminMessagePopupWindow : Control { + [Dependency] private readonly IStylesheetManager _styleMan = default!; + private float _timer = float.MaxValue; public event Action? OnDismissPressed; - public event Action? OnAcceptPressed; public AdminMessagePopupWindow() { RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); - Stylesheet = IoCManager.Resolve().SheetSpace; + Stylesheet = _styleMan.SheetSystem; AcceptButton.OnPressed += OnAcceptButtonPressed; DismissButton.OnPressed += OnDismissButtonPressed; @@ -49,7 +51,8 @@ public sealed partial class AdminMessagePopupWindow : Control MessageContainer.AddChild(new AdminMessagePopupMessage(message)); } - Description.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length)))); + Description.SetMessage( + FormattedMessage.FromMarkup(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length)))); } private void OnDismissButtonPressed(BaseButton.ButtonEventArgs obj) diff --git a/Content.Client/Administration/UI/PermissionsEui.cs b/Content.Client/Administration/UI/PermissionsEui.cs index fe1237d4c9..96b53babb5 100644 --- a/Content.Client/Administration/UI/PermissionsEui.cs +++ b/Content.Client/Administration/UI/PermissionsEui.cs @@ -27,7 +27,7 @@ namespace Content.Client.Administration.UI [Dependency] private readonly IClientAdminManager _adminManager = default!; private readonly Menu _menu; - private readonly List _subWindows = new(); + private readonly List _subWindows = new(); private Dictionary _ranks = new(); @@ -216,7 +216,7 @@ namespace Content.Client.Administration.UI var titleControl = new Label { Text = admin.Title ?? Loc.GetString("permissions-eui-edit-admin-title-control-text").ToLowerInvariant() }; if (admin.Title == null) // none { - titleControl.StyleClasses.Add(StyleBase.StyleClassItalic); + titleControl.StyleClasses.Add(StyleClass.Italic); } al.AddChild(titleControl); @@ -240,7 +240,7 @@ namespace Content.Client.Administration.UI var rankControl = new Label { Text = rank }; if (italic) { - rankControl.StyleClasses.Add(StyleBase.StyleClassItalic); + rankControl.StyleClasses.Add(StyleClass.Italic); } al.AddChild(rankControl); @@ -340,10 +340,9 @@ namespace Content.Client.Administration.UI tab.AddChild(adminVBox); tab.AddChild(rankVBox); - Contents.AddChild(tab); + ContentsContainer.AddChild(tab); + ContentsContainer.MinSize = new(600, 400); } - - protected override Vector2 ContentsMinimumSize => new Vector2(600, 400); } private sealed class EditAdminWindow : DefaultWindow @@ -419,21 +418,21 @@ namespace Content.Client.Administration.UI var inherit = new Button { Text = "I", - StyleClasses = { StyleBase.ButtonOpenRight }, + StyleClasses = { StyleClass.ButtonOpenRight }, Disabled = disable, Group = group, }; var sub = new Button { Text = "-", - StyleClasses = { StyleBase.ButtonOpenBoth }, + StyleClasses = { StyleClass.ButtonOpenBoth }, Disabled = disable, Group = group }; var plus = new Button { Text = "+", - StyleClasses = { StyleBase.ButtonOpenLeft }, + StyleClasses = { StyleClass.ButtonOpenLeft }, Disabled = disable, Group = group }; @@ -479,7 +478,7 @@ namespace Content.Client.Administration.UI bottomButtons.AddChild(SaveButton); - Contents.AddChild(new BoxContainer + ContentsContainer.AddChild(new BoxContainer { Orientation = LayoutOrientation.Vertical, Children = @@ -605,7 +604,7 @@ namespace Content.Client.Administration.UI bottomButtons.AddChild(SaveButton); - Contents.AddChild(new BoxContainer + ContentsContainer.AddChild(new BoxContainer { Orientation = LayoutOrientation.Vertical, Children = diff --git a/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml b/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml index 9784b34557..88df194ecb 100644 --- a/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml +++ b/Content.Client/Anomaly/Ui/AnomalyGeneratorWindow.xaml @@ -14,7 +14,7 @@ VerticalExpand="True" Margin="0 0 0 0" VerticalAlignment="Center"> - - - + + OnPlayerAction?.Invoke(SharedSpaceVillainArcadeComponent.PlayerAction.NewGame); grid.AddChild(newGame); - Contents.AddChild(grid); + ContentsContainer.AddChild(grid); } private void UpdateMetadata(SharedSpaceVillainArcadeComponent.SpaceVillainArcadeMetaDataUpdateMessage message) diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs index 64680b5321..60e06e98ce 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs @@ -1,6 +1,6 @@ using Content.Client.Atmos.Monitor.UI.Widgets; using Content.Client.Message; -using Content.Client.Stylesheets; +using Content.Client.Stylesheets.Palette; using Content.Client.UserInterface.Controls; using Content.Shared.Atmos; using Content.Shared.Atmos.Monitor; @@ -17,7 +17,7 @@ namespace Content.Client.Atmos.Monitor.UI; public sealed partial class AirAlarmWindow : FancyWindow { public event Action? AtmosDeviceDataChanged; - public event Action? AtmosDeviceDataCopied; + public event Action? AtmosDeviceDataCopied; public event Action? AtmosAlarmThresholdChanged; public event Action? AirAlarmModeChanged; public event Action? AutoModeChanged; @@ -131,7 +131,7 @@ public sealed partial class AirAlarmWindow : FancyWindow case GasVentPumpData pump: if (!_pumps.TryGetValue(addr, out var pumpControl)) { - var control= new PumpControl(pump, addr); + var control = new PumpControl(pump, addr); control.PumpDataChanged += AtmosDeviceDataChanged; control.PumpDataCopied += AtmosDeviceDataCopied; _pumps.Add(addr, control); @@ -186,11 +186,9 @@ public sealed partial class AirAlarmWindow : FancyWindow { return curAlarm switch { - AtmosAlarmType.Danger => StyleNano.DangerousRedFore, - AtmosAlarmType.Warning => StyleNano.ConcerningOrangeFore, - _ => StyleNano.GoodGreenFore, + AtmosAlarmType.Danger => Palettes.Status.Critical, + AtmosAlarmType.Warning => Palettes.Status.Warning, + _ => Palettes.Status.Good, }; } - - } diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs index 38c631e630..f4b31fd95b 100644 --- a/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml.cs @@ -1,3 +1,4 @@ +using Content.Client.Stylesheets; using Content.Shared.Atmos.Monitor; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; @@ -42,11 +43,11 @@ public sealed partial class ThresholdBoundControl : BoxContainer if (enabled) { - CBoundLabel.RemoveStyleClass("Disabled"); + CBoundLabel.RemoveStyleClass(StyleClass.LabelWeak); } else { - CBoundLabel.SetOnlyStyleClass("Disabled"); + CBoundLabel.SetOnlyStyleClass(StyleClass.LabelWeak); } } diff --git a/Content.Client/Atmos/UI/GasCanisterWindow.xaml b/Content.Client/Atmos/UI/GasCanisterWindow.xaml index f76e32a31d..3c7647385a 100644 --- a/Content.Client/Atmos/UI/GasCanisterWindow.xaml +++ b/Content.Client/Atmos/UI/GasCanisterWindow.xaml @@ -4,7 +4,7 @@ MinSize="480 400" Title="Canister"> -