From 26e4aa488b3bf8b31d2a45601b079dea8bd55003 Mon Sep 17 00:00:00 2001 From: Steve Bilogan Date: Thu, 28 Sep 2023 12:43:22 -0400 Subject: [PATCH] refactor: pr comments --- .../Uno.Themes.WinUI.Markup/Theme/TextBox.cs | 185 +++++++++++------- 1 file changed, 118 insertions(+), 67 deletions(-) diff --git a/src/library/Uno.Themes.WinUI.Markup/Theme/TextBox.cs b/src/library/Uno.Themes.WinUI.Markup/Theme/TextBox.cs index bb7c58b12..d62ee9a5b 100644 --- a/src/library/Uno.Themes.WinUI.Markup/Theme/TextBox.cs +++ b/src/library/Uno.Themes.WinUI.Markup/Theme/TextBox.cs @@ -1,5 +1,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media; +using Uno.Extensions.Markup; using Uno.Extensions.Markup.Internals; using Windows.UI.Text; @@ -11,119 +12,119 @@ public static class TextBox { public static class Resources { - public static class DeleteButton - { - public static class Foreground - { - [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForeground")] - public static ResourceValue Default => new("TextBoxDeleteButtonForeground", true); - - [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForegroundPointerOver")] - public static ResourceValue PointerOver => new("TextBoxDeleteButtonForegroundPointerOver", true); - - [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForegroundPressed")] - public static ResourceValue Pressed => new("TextBoxDeleteButtonForegroundPressed", true); - - [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForegroundDisabled")] - public static ResourceValue Disabled => new("TextBoxDeleteButtonForegroundDisabled", true); - } - } - public static class Filled { public static class Foreground { [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxForeground")] - public static ResourceValue Default => new("FilledTextBoxForeground", true); + public static ThemeResourceKey Default => new("FilledTextBoxForeground"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxForegroundPointerOver")] - public static ResourceValue PointerOver => new("FilledTextBoxForegroundPointerOver", true); + public static ThemeResourceKey PointerOver => new("FilledTextBoxForegroundPointerOver"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxForegroundFocused")] - public static ResourceValue Focused => new("FilledTextBoxForegroundFocused", true); + public static ThemeResourceKey Focused => new("FilledTextBoxForegroundFocused"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxForegroundDisabled")] - public static ResourceValue Disabled => new("FilledTextBoxForegroundDisabled", true); + public static ThemeResourceKey Disabled => new("FilledTextBoxForegroundDisabled"); + } + public static class PlaceholderForeground + { [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxPlaceholderForeground")] - public static ResourceValue Placeholder => new("FilledTextBoxPlaceholderForeground", true); + public static ThemeResourceKey Default => new("FilledTextBoxPlaceholderForeground"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxPlaceholderForegroundPointerOver")] - public static ResourceValue PlaceholderPointerOver => new("FilledTextBoxPlaceholderForegroundPointerOver", true); + public static ThemeResourceKey PointerOver => new("FilledTextBoxPlaceholderForegroundPointerOver"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxPlaceholderForegroundFocused")] - public static ResourceValue PlaceholderFocused => new("FilledTextBoxPlaceholderForegroundFocused", true); + public static ThemeResourceKey Focused => new("FilledTextBoxPlaceholderForegroundFocused"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxPlaceholderForegroundDisabled")] - public static ResourceValue PlaceholderDisabled => new("FilledTextBoxPlaceholderForegroundDisabled", true); + public static ThemeResourceKey Disabled => new("FilledTextBoxPlaceholderForegroundDisabled"); + } + public static class DeleteButtonForeground + { [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxDeleteButtonForeground")] - public static ResourceValue DeleteButton => new("FilledTextBoxDeleteButtonForeground", true); + public static ThemeResourceKey Default => new("FilledTextBoxDeleteButtonForeground"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxDeleteButtonForegroundPointerOver")] - public static ResourceValue DeleteButtonPointerOver => new("FilledTextBoxDeleteButtonForegroundPointerOver", true); + public static ThemeResourceKey PointerOver => new("FilledTextBoxDeleteButtonForegroundPointerOver"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxDeleteButtonForegroundFocused")] - public static ResourceValue DeleteButtonFocused => new("FilledTextBoxDeleteButtonForegroundFocused", true); + public static ThemeResourceKey Focused => new("FilledTextBoxDeleteButtonForegroundFocused"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxDeleteButtonForegroundDisabled")] - public static ResourceValue DeleteButtonDisabled => new("FilledTextBoxDeleteButtonForegroundDisabled", true); + public static ThemeResourceKey Disabled => new("FilledTextBoxDeleteButtonForegroundDisabled"); } public static class Background { [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBackground")] - public static ResourceValue Default => new("FilledTextBoxBackground", true); + public static ThemeResourceKey Default => new("FilledTextBoxBackground"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBackgroundPointerOver")] - public static ResourceValue PointerOver => new("FilledTextBoxBackgroundPointerOver", true); + public static ThemeResourceKey PointerOver => new("FilledTextBoxBackgroundPointerOver"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBackgroundFocused")] - public static ResourceValue Focused => new("FilledTextBoxBackgroundFocused", true); + public static ThemeResourceKey Focused => new("FilledTextBoxBackgroundFocused"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBackgroundDisabled")] - public static ResourceValue Disabled => new("FilledTextBoxBackgroundDisabled", true); + public static ThemeResourceKey Disabled => new("FilledTextBoxBackgroundDisabled"); } public static class BorderBrush { [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBorderBrush")] - public static ResourceValue Default => new("FilledTextBoxBorderBrush", true); + public static ThemeResourceKey Default => new("FilledTextBoxBorderBrush"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBorderBrushPointerOver")] - public static ResourceValue PointerOver => new("FilledTextBoxBorderBrushPointerOver", true); + public static ThemeResourceKey PointerOver => new("FilledTextBoxBorderBrushPointerOver"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBorderBrushFocused")] - public static ResourceValue Focused => new("FilledTextBoxBorderBrushFocused", true); + public static ThemeResourceKey Focused => new("FilledTextBoxBorderBrushFocused"); [ResourceKeyDefinition(typeof(Brush), "FilledTextBoxBorderBrushDisabled")] - public static ResourceValue Disabled => new("FilledTextBoxBorderBrushDisabled", true); + public static ThemeResourceKey Disabled => new("FilledTextBoxBorderBrushDisabled"); } public static class BorderThickness { [ResourceKeyDefinition(typeof(Thickness), "FilledTextBoxBorderThicknessNormal")] - public static ResourceValue Normal => new("FilledTextBoxBorderThicknessNormal", true); + public static ThemeResourceKey Default => new("FilledTextBoxBorderThicknessNormal"); [ResourceKeyDefinition(typeof(Thickness), "FilledTextBoxBorderThicknessFocused")] - public static ResourceValue Focused => new("FilledTextBoxBorderThicknessFocused", true); + public static ThemeResourceKey Focused => new("FilledTextBoxBorderThicknessFocused"); } public static class Typography { [ResourceKeyDefinition(typeof(FontFamily), "FilledTextBoxFontFamily")] - public static ResourceValue FontFamily => new("FilledTextBoxFontFamily", true); + public static ThemeResourceKey FontFamily => new("FilledTextBoxFontFamily"); [ResourceKeyDefinition(typeof(double), "FilledTextBoxFontSize")] - public static ResourceValue FontSize => new("FilledTextBoxFontSize", true); + public static ThemeResourceKey FontSize => new("FilledTextBoxFontSize"); + + [ResourceKeyDefinition(typeof(FontWeight), "FilledTextBoxFontWeight")] + public static ThemeResourceKey FontWeight => new("FilledTextBoxFontWeight"); + + [ResourceKeyDefinition(typeof(int), "FilledTextBoxCharacterSpacing")] + public static ThemeResourceKey CharacterSpacing => new("FilledTextBoxCharacterSpacing"); } - [ResourceKeyDefinition(typeof(FontWeight), "FilledTextBoxFontWeight")] - public static ResourceValue FontWeight => new("FilledTextBoxFontWeight", true); + [ResourceKeyDefinition(typeof(Microsoft.UI.Xaml.CornerRadius), "MaterialFilledTextBoxCornerRadius")] + public static ThemeResourceKey CornerRadius => new("MaterialFilledTextBoxCornerRadius"); - [ResourceKeyDefinition(typeof(int), "FilledTextBoxCharacterSpacing")] - public static ResourceValue CharacterSpacing => new("FilledTextBoxCharacterSpacing", true); + [ResourceKeyDefinition(typeof(Thickness), "MaterialFilledTextBoxPadding")] + public static ThemeResourceKey Padding => new("MaterialFilledTextBoxPadding"); + + [ResourceKeyDefinition(typeof(double), "MaterialFilledTextBoxMinHeight")] + public static ThemeResourceKey MinHeight => new("MaterialFilledTextBoxMinHeight"); + + [ResourceKeyDefinition(typeof(double), "MaterialFilledTextBoxBorderHeightFocused")] + public static ThemeResourceKey BorderHeightFocused => new("MaterialFilledTextBoxBorderHeightFocused"); } public static class Outlined @@ -131,70 +132,120 @@ public static class Outlined public static class Foreground { [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxForeground")] - public static ResourceValue Default => new("OutlinedTextBoxForeground", true); + public static ThemeResourceKey Default => new("OutlinedTextBoxForeground"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxForegroundPointerOver")] - public static ResourceValue PointerOver => new("OutlinedTextBoxForegroundPointerOver", true); + public static ThemeResourceKey PointerOver => new("OutlinedTextBoxForegroundPointerOver"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxForegroundFocused")] - public static ResourceValue Focused => new("OutlinedTextBoxForegroundFocused", true); + public static ThemeResourceKey Focused => new("OutlinedTextBoxForegroundFocused"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxForegroundDisabled")] - public static ResourceValue Disabled => new("OutlinedTextBoxForegroundDisabled", true); + public static ThemeResourceKey Disabled => new("OutlinedTextBoxForegroundDisabled"); + } + public static class PlaceholderForeground + { [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxPlaceholderForeground")] - public static ResourceValue Placeholder => new("OutlinedTextBoxPlaceholderForeground", true); + public static ThemeResourceKey Default => new("OutlinedTextBoxPlaceholderForeground"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxPlaceholderForegroundPointerOver")] - public static ResourceValue PlaceholderPointerOver => new("OutlinedTextBoxPlaceholderForegroundPointerOver", true); + public static ThemeResourceKey PointerOver => new("OutlinedTextBoxPlaceholderForegroundPointerOver"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxPlaceholderForegroundFocused")] - public static ResourceValue PlaceholderFocused => new("OutlinedTextBoxPlaceholderForegroundFocused", true); + public static ThemeResourceKey Focused => new("OutlinedTextBoxPlaceholderForegroundFocused"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxPlaceholderForegroundDisabled")] - public static ResourceValue PlaceholderDisabled => new("OutlinedTextBoxPlaceholderForegroundDisabled", true); + public static ThemeResourceKey Disabled => new("OutlinedTextBoxPlaceholderForegroundDisabled"); } public static class BorderBrush { [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxBorderBrush")] - public static ResourceValue Default => new("OutlinedTextBoxBorderBrush", true); + public static ThemeResourceKey Default => new("OutlinedTextBoxBorderBrush"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxBorderBrushPointerOver")] - public static ResourceValue PointerOver => new("OutlinedTextBoxBorderBrushPointerOver", true); + public static ThemeResourceKey PointerOver => new("OutlinedTextBoxBorderBrushPointerOver"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxBorderBrushFocused")] - public static ResourceValue Focused => new("OutlinedTextBoxBorderBrushFocused", true); + public static ThemeResourceKey Focused => new("OutlinedTextBoxBorderBrushFocused"); [ResourceKeyDefinition(typeof(Brush), "OutlinedTextBoxBorderBrushDisabled")] - public static ResourceValue Disabled => new("OutlinedTextBoxBorderBrushDisabled", true); + public static ThemeResourceKey Disabled => new("OutlinedTextBoxBorderBrushDisabled"); } public static class Typography { [ResourceKeyDefinition(typeof(FontFamily), "OutlinedTextBoxFontFamily")] - public static ResourceValue FontFamily => new("OutlinedTextBoxFontFamily", true); - + public static ThemeResourceKey FontFamily => new("OutlinedTextBoxFontFamily"); [ResourceKeyDefinition(typeof(double), "OutlinedTextBoxFontSize")] - public static ResourceValue FontSize => new("OutlinedTextBoxFontSize", true); + public static ThemeResourceKey FontSize => new("OutlinedTextBoxFontSize"); + + [ResourceKeyDefinition(typeof(FontWeight), "OutlinedTextBoxFontWeight")] + public static ThemeResourceKey FontWeight => new("OutlinedTextBoxFontWeight"); + + [ResourceKeyDefinition(typeof(int), "OutlinedTextBoxCharacterSpacing")] + public static ThemeResourceKey CharacterSpacing => new("OutlinedTextBoxCharacterSpacing"); } - [ResourceKeyDefinition(typeof(FontWeight), "OutlinedTextBoxFontWeight")] - public static ResourceValue FontWeight => new("OutlinedTextBoxFontWeight", true); + [ResourceKeyDefinition(typeof(double), "MaterialOutlinedTextBoxBorderThickness")] + public static ThemeResourceKey BorderThickness => new("MaterialOutlinedTextBoxBorderThickness"); + + [ResourceKeyDefinition(typeof(Microsoft.UI.Xaml.CornerRadius), "MaterialOutlinedTextBoxCornerRadius")] + public static ThemeResourceKey CornerRadius => new("MaterialOutlinedTextBoxCornerRadius"); + + [ResourceKeyDefinition(typeof(Thickness), "MaterialOutlinedTextBoxPadding")] + public static ThemeResourceKey Padding => new("MaterialOutlinedTextBoxPadding"); - [ResourceKeyDefinition(typeof(int), "OutlinedTextBoxCharacterSpacing")] - public static ResourceValue CharacterSpacing => new("OutlinedTextBoxCharacterSpacing", true); + [ResourceKeyDefinition(typeof(double), "MaterialOutlinedTextBoxMinHeight")] + public static ThemeResourceKey MinHeight => new("MaterialOutlinedTextBoxMinHeight"); + + [ResourceKeyDefinition(typeof(double), "MaterialOutlinedTextBoxBorderPadding")] + public static ThemeResourceKey BorderPadding => new("MaterialOutlinedTextBoxBorderPadding"); + + [ResourceKeyDefinition(typeof(double), "MaterialOutlinedTextBoxBorderThicknessFocused")] + public static ThemeResourceKey BorderThicknessFocused => new("MaterialOutlinedTextBoxBorderThicknessFocused"); } + + public static class DeleteButtonForeground + { + [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForeground")] + public static ThemeResourceKey Default => new("TextBoxDeleteButtonForeground"); + + [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForegroundPointerOver")] + public static ThemeResourceKey PointerOver => new("TextBoxDeleteButtonForegroundPointerOver"); + + [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForegroundPressed")] + public static ThemeResourceKey Pressed => new("TextBoxDeleteButtonForegroundPressed"); + + [ResourceKeyDefinition(typeof(Brush), "TextBoxDeleteButtonForegroundDisabled")] + public static ThemeResourceKey Disabled => new("TextBoxDeleteButtonForegroundDisabled"); + } + + public static class LeadingIconForeground + { + [ResourceKeyDefinition(typeof(Brush), "TextBoxLeadingIconForeground")] + public static ThemeResourceKey Default => new("TextBoxLeadingIconForeground"); + + [ResourceKeyDefinition(typeof(Brush), "TextBoxLeadingIconForegroundDisabled")] + public static ThemeResourceKey Disabled => new("TextBoxLeadingIconForegroundDisabled"); + } + + [ResourceKeyDefinition(typeof(double), "MaterialTextBoxClearGlyphWidth")] + public static ThemeResourceKey ClearGlyphWidth => new("MaterialTextBoxClearGlyphWidth"); + + [ResourceKeyDefinition(typeof(double), "MaterialTextBoxClearGlyphHeight")] + public static ThemeResourceKey ClearGlyphHeight => new("MaterialTextBoxClearGlyphHeight"); } public static class Styles { [ResourceKeyDefinition(typeof(Style), "FilledTextBoxStyle", TargetType = typeof(TextBox))] - public static ResourceValue