Skip to content

Commit 56b4fbf

Browse files
committed
Release 3.0.0 (MudBlazor v8 support)
1 parent ec6e1dd commit 56b4fbf

File tree

5 files changed

+15
-81
lines changed

5 files changed

+15
-81
lines changed

build/_build.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<RootNamespace></RootNamespace>
77
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn>
88
<NukeRootDirectory>..</NukeRootDirectory>
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Nuke.Common" Version="8.0.0" />
15+
<PackageReference Include="Nuke.Common" Version="9.0.4" />
1616
</ItemGroup>
1717

1818
</Project>

src/MudBlazor.ThemeManager/Extensions/Extension.cs

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,11 @@ internal static class Extension
99

1010
public static MudTheme DeepClone(this MudTheme source)
1111
{
12-
// TODO: Needs this to be done https://github.com/MudBlazor/MudBlazor/pull/9434
13-
//var themeType = typeof(MudTheme);
14-
//var serializeStr = JsonSerializer.Serialize(source, themeType, ThemeSerializerContext);
15-
//var copyObj = (MudTheme?)JsonSerializer.Deserialize(serializeStr, themeType, ThemeSerializerContext);
12+
var themeType = typeof(MudTheme);
13+
var serializeStr = JsonSerializer.Serialize(source, themeType, ThemeSerializerContext);
14+
var copyObj = (MudTheme?)JsonSerializer.Deserialize(serializeStr, themeType, ThemeSerializerContext);
1615

17-
//return copyObj;
18-
19-
// Code below is a workaround for the above issue
20-
21-
return new MudTheme
22-
{
23-
PaletteDark = source.PaletteDark.DeepClone() ?? new PaletteDark(),
24-
PaletteLight = source.PaletteLight.DeepClone() ?? new PaletteLight(),
25-
Shadows = DeepCloneTheme(source.Shadows) ?? new Shadow(),
26-
LayoutProperties = DeepCloneTheme(source.LayoutProperties) ?? new LayoutProperties(),
27-
ZIndex = DeepCloneTheme(source.ZIndex) ?? new ZIndex(),
28-
PseudoCss = DeepCloneTheme(source.PseudoCss) ?? new PseudoCss(),
29-
// Exception case
30-
Typography = new Typography
31-
{
32-
Default = DeepCloneBaseTypography(source.Typography.Default),
33-
H1 = DeepCloneBaseTypography(source.Typography.H1),
34-
H2 = DeepCloneBaseTypography(source.Typography.H2),
35-
H3 = DeepCloneBaseTypography(source.Typography.H3),
36-
H4 = DeepCloneBaseTypography(source.Typography.H4),
37-
H5 = DeepCloneBaseTypography(source.Typography.H5),
38-
H6 = DeepCloneBaseTypography(source.Typography.H6),
39-
Subtitle1 = DeepCloneBaseTypography(source.Typography.Subtitle1),
40-
Subtitle2 = DeepCloneBaseTypography(source.Typography.Subtitle2),
41-
Body1 = DeepCloneBaseTypography(source.Typography.Body1),
42-
Body2 = DeepCloneBaseTypography(source.Typography.Body2),
43-
Input = DeepCloneBaseTypography(source.Typography.Input),
44-
Button = DeepCloneBaseTypography(source.Typography.Button),
45-
Caption = DeepCloneBaseTypography(source.Typography.Caption),
46-
Overline = DeepCloneBaseTypography(source.Typography.Overline)
47-
}
48-
};
16+
return copyObj ?? new MudTheme();
4917
}
5018

5119
public static PaletteDark? DeepClone(this PaletteDark source) => DeepClonePalette(source);
@@ -60,38 +28,4 @@ public static MudTheme DeepClone(this MudTheme source)
6028

6129
return copyObj;
6230
}
63-
64-
private static T? DeepCloneTheme<T>(T source) where T : class
65-
{
66-
var paletteType = typeof(T);
67-
var serializeStr = JsonSerializer.Serialize(source, paletteType, ThemeSerializerContext);
68-
var copyObj = (T?)JsonSerializer.Deserialize(serializeStr, paletteType, ThemeSerializerContext);
69-
70-
return copyObj;
71-
}
72-
73-
private static T DeepCloneBaseTypography<T>(T baseTypography) where T : BaseTypography, new()
74-
{
75-
string[] fontFamilyCloned = new string[baseTypography.FontFamily?.Length ?? 0];
76-
if (baseTypography.FontFamily is not null)
77-
{
78-
Array.Copy(baseTypography.FontFamily, fontFamilyCloned, baseTypography.FontFamily.Length);
79-
}
80-
81-
var fontWeightCloned = baseTypography.FontWeight;
82-
var fontSizeCloned = baseTypography.FontSize;
83-
var lineHeightCloned = baseTypography.LineHeight;
84-
var letterSpacingCloned = baseTypography.LetterSpacing;
85-
var textTransformCloned = baseTypography.TextTransform;
86-
87-
return new T
88-
{
89-
FontWeight = fontWeightCloned,
90-
FontFamily = fontFamilyCloned,
91-
FontSize = fontSizeCloned,
92-
LineHeight = lineHeightCloned,
93-
LetterSpacing = letterSpacingCloned,
94-
TextTransform = textTransformCloned,
95-
};
96-
}
9731
}

src/MudBlazor.ThemeManager/Extensions/ThemeSerializerContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace MudBlazor.ThemeManager.Extensions;
44

5-
//[JsonSerializable(typeof(MudTheme))] TODO: Needs this to be done https://github.com/MudBlazor/MudBlazor/pull/9434 rest can be removed after
5+
[JsonSerializable(typeof(MudTheme))]
66
[JsonSerializable(typeof(Shadow))]
77
[JsonSerializable(typeof(LayoutProperties))]
88
[JsonSerializable(typeof(ZIndex))]

src/MudBlazor.ThemeManager/MudBlazor.ThemeManager.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
@@ -56,21 +56,21 @@
5656
<SupportedPlatform Include="browser" />
5757
</ItemGroup>
5858

59-
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
60-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="7.0.20" />
59+
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
60+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.12" />
6161
</ItemGroup>
6262

63-
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
64-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.6" />
63+
<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
64+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.1" />
6565
</ItemGroup>
6666

6767
<ItemGroup>
6868
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
6969
<PrivateAssets>all</PrivateAssets>
7070
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7171
</PackageReference>
72-
<PackageReference Include="MudBlazor" Version="7.0.0" />
73-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.139">
72+
<PackageReference Include="MudBlazor" Version="8.0.0" />
73+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.7.115">
7474
<PrivateAssets>all</PrivateAssets>
7575
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7676
</PackageReference>

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "2.1.0",
3+
"version": "3.0.0",
44
"publicReleaseRefSpec": [
55
"^refs/heads/master$",
66
"^refs/heads/main$",

0 commit comments

Comments
 (0)