From ec26e143a273747e510f8ee13d82d10e237d6afa Mon Sep 17 00:00:00 2001 From: AndresAldana Date: Thu, 22 Dec 2022 13:29:25 -0500 Subject: [PATCH 1/5] feat: Add common theme constants library --- src/Directory.Packages.props | 2 +- src/Uno.Toolkit.sln | 115 ++++++++++ .../AssemblyInfo.cs | 5 + .../Theme.Styles.cs | 208 ++++++++++++++++++ .../Uno.Toolkit.WinUI.Themes.Markup.csproj | 37 ++++ 5 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 src/library/Uno.Toolkit.WinUI.Themes.Markup/AssemblyInfo.cs create mode 100644 src/library/Uno.Toolkit.WinUI.Themes.Markup/Theme.Styles.cs create mode 100644 src/library/Uno.Toolkit.WinUI.Themes.Markup/Uno.Toolkit.WinUI.Themes.Markup.csproj diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 78d092ba9..bb5a70aac 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -9,7 +9,7 @@ - + diff --git a/src/Uno.Toolkit.sln b/src/Uno.Toolkit.sln index 45857f96e..07c6f9957 100644 --- a/src/Uno.Toolkit.sln +++ b/src/Uno.Toolkit.sln @@ -90,6 +90,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{5D8F2DC4 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markup", "Markup", "{558EEC70-D98E-491B-9652-F1376168004C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Toolkit.WinUI.Themes.Markup", "library\Uno.Toolkit.WinUI.Themes.Markup\Uno.Toolkit.WinUI.Themes.Markup.csproj", "{93E7BA9F-E1DE-48C6-8185-454942B6C034}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Android = Ad-Hoc|Android @@ -2798,6 +2800,118 @@ Global {83C3F373-8CAA-4127-9E7E-6474D9E9BCD4}.Release|WASM.ActiveCfg = Release|Any CPU {83C3F373-8CAA-4127-9E7E-6474D9E9BCD4}.Release|x64.ActiveCfg = Release|Any CPU {83C3F373-8CAA-4127-9E7E-6474D9E9BCD4}.Release|x86.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Android.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Android.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|ARM64.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|ARM64.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|macOS.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|macOS.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Packages.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Packages.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Packages_WinUI.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Packages_WinUI.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Samples.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Samples.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Samples_WinUI.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|Samples_WinUI.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|WASM.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|WASM.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Android.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Android.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|ARM.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|ARM64.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|ARM64.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|iPhone.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|macOS.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|macOS.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Packages.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Packages.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Packages_WinUI.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Packages_WinUI.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Samples.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Samples.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Samples_WinUI.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|Samples_WinUI.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|WASM.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|WASM.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|x64.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|x64.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|x86.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.AppStore|x86.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Android.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Android.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Any CPU.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|ARM.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|ARM.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|ARM64.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|iPhone.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|macOS.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|macOS.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Packages.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Packages.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Packages_WinUI.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Packages_WinUI.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Samples.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Samples.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Samples_WinUI.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|Samples_WinUI.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|WASM.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|WASM.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|x64.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|x64.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|x86.ActiveCfg = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Debug|x86.Build.0 = Debug|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Android.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Android.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Any CPU.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Any CPU.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|ARM.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|ARM.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|ARM64.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|ARM64.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|iPhone.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|iPhone.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|macOS.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|macOS.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Packages.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Packages.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Packages_WinUI.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Packages_WinUI.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Samples.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Samples.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Samples_WinUI.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|Samples_WinUI.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|WASM.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|WASM.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|x64.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|x64.Build.0 = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|x86.ActiveCfg = Release|Any CPU + {93E7BA9F-E1DE-48C6-8185-454942B6C034}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2826,6 +2940,7 @@ Global {04A5011F-DC76-4BD6-9994-FC1C9E937A6D} = {39BDC5B9-2807-409B-A8CB-B41B33E05C5D} {83C3F373-8CAA-4127-9E7E-6474D9E9BCD4} = {558EEC70-D98E-491B-9652-F1376168004C} {558EEC70-D98E-491B-9652-F1376168004C} = {39BDC5B9-2807-409B-A8CB-B41B33E05C5D} + {93E7BA9F-E1DE-48C6-8185-454942B6C034} = {558EEC70-D98E-491B-9652-F1376168004C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EEF2F9D4-91C2-4F1A-BF0C-654FD02D3E2A} diff --git a/src/library/Uno.Toolkit.WinUI.Themes.Markup/AssemblyInfo.cs b/src/library/Uno.Toolkit.WinUI.Themes.Markup/AssemblyInfo.cs new file mode 100644 index 000000000..d457aa619 --- /dev/null +++ b/src/library/Uno.Toolkit.WinUI.Themes.Markup/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System.Reflection; +using Microsoft.UI.Xaml.MarkupHelpers.Internals; + +[assembly: AssemblyMetadata("IsTrimmable", "True")] +[assembly: ResourceDefinitionClass(typeof(Uno.Toolkit.Themes.Markup.Theme))] diff --git a/src/library/Uno.Toolkit.WinUI.Themes.Markup/Theme.Styles.cs b/src/library/Uno.Toolkit.WinUI.Themes.Markup/Theme.Styles.cs new file mode 100644 index 000000000..6fa938701 --- /dev/null +++ b/src/library/Uno.Toolkit.WinUI.Themes.Markup/Theme.Styles.cs @@ -0,0 +1,208 @@ +using System; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.MarkupHelpers; +using Microsoft.UI.Xaml.MarkupHelpers.Internals; + +namespace Uno.Toolkit.Themes.Markup +{ + public static partial class Theme + { + public static class Styles + { + public static class AppBarButton + { + [ResourceKeyDefinition(typeof(Style), "MainCommandStyle", TargetType = typeof(AppBarButton))] + public static Action> Default => StaticResource.Get