From 4eecc941c3e4bcc7996bc50b1a86839ce735893f Mon Sep 17 00:00:00 2001 From: Dan Heron Date: Thu, 5 Dec 2024 16:04:34 +0100 Subject: [PATCH 1/2] Updated to MudBlazor 8 preview and .Net 9 --- .../Heron.MudCalendar.Docs.csproj | 13 +- .../Pages/Extending/Extending.razor | 20 +-- .../Pages/Extending/TotalCalendar.razor | 126 +++++++++--------- Heron.MudCalendar.Docs/Program.cs | 8 +- .../Shared/MainLayout.razor | 2 +- Heron.MudCalendar.Docs/Theme/Theme.cs | 63 ++++----- Heron.MudCalendar.Docs/wwwroot/index.html | 4 +- ...MudCalendar.UnitTests.Viewer.Server.csproj | 4 +- .../Program.cs | 3 +- .../Heron.MudCalendar.UnitTests.Viewer.csproj | 8 +- .../Calendar/CalendarMultiDayMonthTest.razor | 2 +- .../Components/CalendarTests.cs | 1 + .../Heron.MudCalendar.UnitTests.csproj | 16 +-- Heron.MudCalendar/Heron.MudCalendar.csproj | 20 +-- 14 files changed, 149 insertions(+), 141 deletions(-) diff --git a/Heron.MudCalendar.Docs/Heron.MudCalendar.Docs.csproj b/Heron.MudCalendar.Docs/Heron.MudCalendar.Docs.csproj index b2743e2..cc410bd 100644 --- a/Heron.MudCalendar.Docs/Heron.MudCalendar.Docs.csproj +++ b/Heron.MudCalendar.Docs/Heron.MudCalendar.Docs.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 disable enable @@ -10,10 +10,9 @@ - - - - + + + @@ -27,10 +26,10 @@ - ..\..\MudBlazor\src\MudBlazor.Docs\bin\Release\net8.0\MudBlazor.Docs.dll + ..\..\MudBlazor\src\MudBlazor.Docs\bin\Release\net9.0\MudBlazor.Docs.dll - ..\..\MudBlazor\src\MudBlazor.Docs\bin\Release\net8.0\MudBlazor.Examples.Data.dll + ..\..\MudBlazor\src\MudBlazor.Docs\bin\Release\net9.0\MudBlazor.Examples.Data.dll diff --git a/Heron.MudCalendar.Docs/Pages/Extending/Extending.razor b/Heron.MudCalendar.Docs/Pages/Extending/Extending.razor index 79f56cb..4bda168 100644 --- a/Heron.MudCalendar.Docs/Pages/Extending/Extending.razor +++ b/Heron.MudCalendar.Docs/Pages/Extending/Extending.razor @@ -45,16 +45,16 @@ - - - Heron.MudTotalCalendar is a calendar component for displaying numeric values and totals. - It can be used as an example of extending Heron.MudCalendar. - The source code can be found on Github. - - - - - + @* *@ + @* *@ + @* Heron.MudTotalCalendar is a calendar component for displaying numeric values and totals. *@ + @* It can be used as an example of extending Heron.MudCalendar. *@ + @* The source code can be found on Github. *@ + @* *@ + @* *@ + @* *@ + @* *@ + @* *@ \ No newline at end of file diff --git a/Heron.MudCalendar.Docs/Pages/Extending/TotalCalendar.razor b/Heron.MudCalendar.Docs/Pages/Extending/TotalCalendar.razor index 460c78a..77f6712 100644 --- a/Heron.MudCalendar.Docs/Pages/Extending/TotalCalendar.razor +++ b/Heron.MudCalendar.Docs/Pages/Extending/TotalCalendar.razor @@ -1,63 +1,63 @@ -@using Heron.MudTotalCalendar - - - -@code { - - private List BuildTestData() - { - var power = new ValueDefinition - { - Name = "Power", - Units = "kWh", - FormatString = "N2", - Style = "background-color: #AD1457; color: #ffffff;" - }; - var offpeak = new ValueDefinition - { - Name = "Off-peak", - Units = "EUR", - PrefixUnits = true, - FormatString = "N2", - Style = "background-color: #1565C0; color: #ffffff;" - }; - var peak = new ValueDefinition - { - Name = "Peak", - Units = "EUR", - PrefixUnits = true, - FormatString = "N2", - Style = "background-color: #2E7D32; color: #ffffff;" - }; - var total = new ValueDefinition - { - Name = "Total", - Units = "EUR", - PrefixUnits = true, - FormatString = "N2", - Style = "background-color: #EF6C00; color: #ffffff;" - }; - - return new List - { - // Today - new() { Date = DateTime.Today, Definition = power, Amount = 3.34 }, - new() { Date = DateTime.Today, Definition = peak, Amount = 4.34 }, - new() { Date = DateTime.Today, Definition = offpeak, Amount = 2.34 }, - new() { Date = DateTime.Today, Definition = total, Amount = 6.68 }, - - // Tomorrow - new() { Date = DateTime.Today.AddDays(-1), Definition = power, Amount = 4.89 }, - new() { Date = DateTime.Today.AddDays(-1), Definition = peak, Amount = 5.23 }, - new() { Date = DateTime.Today.AddDays(-1), Definition = offpeak, Amount = 3.32 }, - new() { Date = DateTime.Today.AddDays(-1), Definition = total, Amount = 8.55 }, - - // The next day - new() { Date = DateTime.Today.AddDays(-2), Definition = power, Amount = 2.97 }, - new() { Date = DateTime.Today.AddDays(-2), Definition = peak, Amount = 5.78 }, - new() { Date = DateTime.Today.AddDays(-2), Definition = offpeak, Amount = 2.98 }, - new() { Date = DateTime.Today.AddDays(-2), Definition = total, Amount = 8.76 } - }; - } - -} \ No newline at end of file +@* @using Heron.MudTotalCalendar *@ +@* *@ +@* *@ +@* *@ +@* @code { *@ +@* *@ +@* private List BuildTestData() *@ +@* { *@ +@* var power = new ValueDefinition *@ +@* { *@ +@* Name = "Power", *@ +@* Units = "kWh", *@ +@* FormatString = "N2", *@ +@* Style = "background-color: #AD1457; color: #ffffff;" *@ +@* }; *@ +@* var offpeak = new ValueDefinition *@ +@* { *@ +@* Name = "Off-peak", *@ +@* Units = "EUR", *@ +@* PrefixUnits = true, *@ +@* FormatString = "N2", *@ +@* Style = "background-color: #1565C0; color: #ffffff;" *@ +@* }; *@ +@* var peak = new ValueDefinition *@ +@* { *@ +@* Name = "Peak", *@ +@* Units = "EUR", *@ +@* PrefixUnits = true, *@ +@* FormatString = "N2", *@ +@* Style = "background-color: #2E7D32; color: #ffffff;" *@ +@* }; *@ +@* var total = new ValueDefinition *@ +@* { *@ +@* Name = "Total", *@ +@* Units = "EUR", *@ +@* PrefixUnits = true, *@ +@* FormatString = "N2", *@ +@* Style = "background-color: #EF6C00; color: #ffffff;" *@ +@* }; *@ +@* *@ +@* return new List *@ +@* { *@ +@* // Today *@ +@* new() { Date = DateTime.Today, Definition = power, Amount = 3.34 }, *@ +@* new() { Date = DateTime.Today, Definition = peak, Amount = 4.34 }, *@ +@* new() { Date = DateTime.Today, Definition = offpeak, Amount = 2.34 }, *@ +@* new() { Date = DateTime.Today, Definition = total, Amount = 6.68 }, *@ +@* *@ +@* // Tomorrow *@ +@* new() { Date = DateTime.Today.AddDays(-1), Definition = power, Amount = 4.89 }, *@ +@* new() { Date = DateTime.Today.AddDays(-1), Definition = peak, Amount = 5.23 }, *@ +@* new() { Date = DateTime.Today.AddDays(-1), Definition = offpeak, Amount = 3.32 }, *@ +@* new() { Date = DateTime.Today.AddDays(-1), Definition = total, Amount = 8.55 }, *@ +@* *@ +@* // The next day *@ +@* new() { Date = DateTime.Today.AddDays(-2), Definition = power, Amount = 2.97 }, *@ +@* new() { Date = DateTime.Today.AddDays(-2), Definition = peak, Amount = 5.78 }, *@ +@* new() { Date = DateTime.Today.AddDays(-2), Definition = offpeak, Amount = 2.98 }, *@ +@* new() { Date = DateTime.Today.AddDays(-2), Definition = total, Amount = 8.76 } *@ +@* }; *@ +@* } *@ +@* *@ +@* } *@ \ No newline at end of file diff --git a/Heron.MudCalendar.Docs/Program.cs b/Heron.MudCalendar.Docs/Program.cs index 4474c8f..6763f5e 100644 --- a/Heron.MudCalendar.Docs/Program.cs +++ b/Heron.MudCalendar.Docs/Program.cs @@ -3,6 +3,7 @@ using Heron.MudCalendar.Docs; using Heron.MudCalendar.Docs.Services; using MudBlazor.Docs.Extensions; +using MudBlazor.Docs.Services; using MudBlazor.Services; var builder = WebAssemblyHostBuilder.CreateDefault(args); @@ -11,7 +12,12 @@ builder.Services.AddScoped(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddMudServices(); -builder.Services.TryAddDocsViewServices(); +//builder.Services.TryAddDocsViewServices(); + +builder.Services.AddScoped(); +builder.Services.AddSingleton(); +builder.Services.AddScoped(); +builder.Services.AddSingleton(); builder.Services.AddScoped(); diff --git a/Heron.MudCalendar.Docs/Shared/MainLayout.razor b/Heron.MudCalendar.Docs/Shared/MainLayout.razor index d8edfd9..4c7bf83 100644 --- a/Heron.MudCalendar.Docs/Shared/MainLayout.razor +++ b/Heron.MudCalendar.Docs/Shared/MainLayout.razor @@ -3,7 +3,7 @@ - + diff --git a/Heron.MudCalendar.Docs/Theme/Theme.cs b/Heron.MudCalendar.Docs/Theme/Theme.cs index 966447c..6317dc0 100644 --- a/Heron.MudCalendar.Docs/Theme/Theme.cs +++ b/Heron.MudCalendar.Docs/Theme/Theme.cs @@ -38,7 +38,7 @@ public static MudTheme DocsTheme() return theme; } - + #region Docs @@ -49,13 +49,13 @@ public static MudTheme DocsTheme() AppbarBackground = "rgba(255,255,255,0.8)", DrawerBackground = "#ffffff", GrayLight = "#e8e8e8", - GrayLighter = "#f9f9f9" + GrayLighter = "#f9f9f9", }; - private static readonly PaletteDark DocsDarkPalette = new() + private static readonly PaletteDark DocsDarkPalette = new() { Primary = "#7e6fff", - Surface= "#1e1e2d", + Surface = "#1e1e2d", Background = "#1a1a27", BackgroundGray = "#151521", AppbarText = "#92929f", @@ -78,8 +78,7 @@ public static MudTheme DocsTheme() LinesDefault = "#33323e", TableLines = "#33323e", Divider = "#292838", - OverlayLight = "#1e1e2d80" - + OverlayLight = "#1e1e2d80", }; #endregion #region LandingPage @@ -88,62 +87,64 @@ public static MudTheme DocsTheme() { DefaultBorderRadius = "6px" }; + private static readonly Typography LandingPageTypography = new() { - Default = new Default() + Default = new DefaultTypography() { FontFamily = new[] { "Public Sans", "Roboto", "Arial", "sans-serif" }, LetterSpacing = "normal" }, - H1 = new H1() + H1 = new H1Typography() { FontSize = "4rem", - FontWeight = 700, + FontWeight = "700", }, - H3 = new H3() + H3 = new H3Typography() { FontSize = "3rem", - FontWeight = 600, - LineHeight = 1.8, + FontWeight = "600", + LineHeight = "1.8", }, - H4 = new H4() + H4 = new H4Typography() { FontSize = "1.8rem", - FontWeight = 700, + FontWeight = "700", }, - H5 = new H5() + H5 = new H5Typography() { FontSize = "1.8rem", - FontWeight = 700, - LineHeight = 2, + FontWeight = "700", + LineHeight = "2", }, - H6 = new H6() + H6 = new H6Typography() { FontSize = "1.125rem", - FontWeight = 700, - LineHeight = 2, + FontWeight = "700", + LineHeight = "2", }, - Subtitle1 = new Subtitle1() + Subtitle1 = new Subtitle1Typography() { FontSize = "1.1rem", - FontWeight = 500 + FontWeight = "500" }, - Subtitle2 = new Subtitle2() + Subtitle2 = new Subtitle2Typography() { FontSize = "1rem", - FontWeight = 600, - LineHeight = 1.8, + FontWeight = "600", + LineHeight = "1.8", }, - Body1 = new Body1() + Body1 = new Body1Typography() { FontSize = "1rem", - FontWeight = 400 + FontWeight = "400" }, - Button = new Button() + Button = new ButtonTypography() { TextTransform = "none" } }; + private static readonly PaletteLight LandingPageLightPalette = new() { AppbarText = "#424242", @@ -154,14 +155,14 @@ public static MudTheme DocsTheme() DarkLighten = "#1A1643", GrayDefault = "#4B5563", GrayLight = "#9CA3AF", - GrayLighter = "#adbdccff" + GrayLighter = "#adbdccff", }; private static readonly PaletteDark LandingPageDarkPalette = new() { AppbarText = "#92929f", AppbarBackground = "rgba(0,0,0,0)", BackgroundGray = "#1a1a27", - Surface= "#1e1e2d", + Surface = "#1e1e2d", Background = "#151521", Dark = "#111019", DarkLighten = "#1A1643", @@ -173,7 +174,7 @@ public static MudTheme DocsTheme() DrawerText = "#92929f", DrawerBackground = "#151521", OverlayLight = "#1e1e2d80", - Divider = "#5c5c6a" + Divider = "#5c5c6a", }; private static readonly Shadow LandingPageShadows = new() diff --git a/Heron.MudCalendar.Docs/wwwroot/index.html b/Heron.MudCalendar.Docs/wwwroot/index.html index 902004b..951d5e3 100644 --- a/Heron.MudCalendar.Docs/wwwroot/index.html +++ b/Heron.MudCalendar.Docs/wwwroot/index.html @@ -7,9 +7,9 @@ Heron.MudCalendar.Docs - + - + diff --git a/Heron.MudCalendar.UnitTests.Viewer.Server/Heron.MudCalendar.UnitTests.Viewer.Server.csproj b/Heron.MudCalendar.UnitTests.Viewer.Server/Heron.MudCalendar.UnitTests.Viewer.Server.csproj index 3274592..7e5fc68 100644 --- a/Heron.MudCalendar.UnitTests.Viewer.Server/Heron.MudCalendar.UnitTests.Viewer.Server.csproj +++ b/Heron.MudCalendar.UnitTests.Viewer.Server/Heron.MudCalendar.UnitTests.Viewer.Server.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable @@ -15,7 +15,7 @@ - + diff --git a/Heron.MudCalendar.UnitTests.Viewer.Server/Program.cs b/Heron.MudCalendar.UnitTests.Viewer.Server/Program.cs index 5b264e8..a74510c 100644 --- a/Heron.MudCalendar.UnitTests.Viewer.Server/Program.cs +++ b/Heron.MudCalendar.UnitTests.Viewer.Server/Program.cs @@ -3,7 +3,8 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddRazorPages(); -builder.Services.AddServerSideBlazor(); +builder.Services.AddServerSideBlazor() + .AddCircuitOptions(options => { options.DetailedErrors = true; }); builder.Services.AddMudServices(); diff --git a/Heron.MudCalendar.UnitTests.Viewer/Heron.MudCalendar.UnitTests.Viewer.csproj b/Heron.MudCalendar.UnitTests.Viewer/Heron.MudCalendar.UnitTests.Viewer.csproj index ca59e58..3540956 100644 --- a/Heron.MudCalendar.UnitTests.Viewer/Heron.MudCalendar.UnitTests.Viewer.csproj +++ b/Heron.MudCalendar.UnitTests.Viewer/Heron.MudCalendar.UnitTests.Viewer.csproj @@ -1,16 +1,16 @@ - net8.0 + net9.0 disable enable default - - - + + + diff --git a/Heron.MudCalendar.UnitTests.Viewer/TestComponents/Calendar/CalendarMultiDayMonthTest.razor b/Heron.MudCalendar.UnitTests.Viewer/TestComponents/Calendar/CalendarMultiDayMonthTest.razor index 2560b33..cb1d931 100644 --- a/Heron.MudCalendar.UnitTests.Viewer/TestComponents/Calendar/CalendarMultiDayMonthTest.razor +++ b/Heron.MudCalendar.UnitTests.Viewer/TestComponents/Calendar/CalendarMultiDayMonthTest.razor @@ -33,7 +33,7 @@ new CalendarItem { Start = new DateTime(2024, 11, 13, 12, 30, 0), - End = new DateTime(2024, 11, 14, 12, 0, 0), + End = new DateTime(2024, 11, 14, 9, 0, 0), Text = "Event 4" }, new CalendarItem diff --git a/Heron.MudCalendar.UnitTests/Components/CalendarTests.cs b/Heron.MudCalendar.UnitTests/Components/CalendarTests.cs index 7888760..89080c1 100644 --- a/Heron.MudCalendar.UnitTests/Components/CalendarTests.cs +++ b/Heron.MudCalendar.UnitTests/Components/CalendarTests.cs @@ -30,6 +30,7 @@ public void ChangeViews() buttons[1].Click(); cut.FindAll("div.mud-cal-week-view").Count.Should().Be(1); + buttons = comp.FindAll("button"); buttons[2].Click(); cut.FindAll("div.mud-cal-week-view").Count.Should().Be(1); } diff --git a/Heron.MudCalendar.UnitTests/Heron.MudCalendar.UnitTests.csproj b/Heron.MudCalendar.UnitTests/Heron.MudCalendar.UnitTests.csproj index ff37634..9added7 100644 --- a/Heron.MudCalendar.UnitTests/Heron.MudCalendar.UnitTests.csproj +++ b/Heron.MudCalendar.UnitTests/Heron.MudCalendar.UnitTests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable false default @@ -15,24 +15,24 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - - - + + + diff --git a/Heron.MudCalendar/Heron.MudCalendar.csproj b/Heron.MudCalendar/Heron.MudCalendar.csproj index 2fcf97c..6171470 100644 --- a/Heron.MudCalendar/Heron.MudCalendar.csproj +++ b/Heron.MudCalendar/Heron.MudCalendar.csproj @@ -3,7 +3,7 @@ enable enable - net7.0;net8.0 + net8.0;net9.0 @@ -55,20 +55,20 @@ - - - - + + + + - - - - + + + + - + From a571c94c42f99f108a5d788d57b2fe534ea73609 Mon Sep 17 00:00:00 2001 From: Dan Heron Date: Thu, 5 Dec 2024 16:08:52 +0100 Subject: [PATCH 2/2] Updated build and test workflow for .Net 9 --- .github/workflows/build-test-mudcalendar.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-mudcalendar.yml b/.github/workflows/build-test-mudcalendar.yml index 53c84ae..ea6aa7b 100644 --- a/.github/workflows/build-test-mudcalendar.yml +++ b/.github/workflows/build-test-mudcalendar.yml @@ -11,11 +11,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dotnet-version: [ '7.0.x', '8.0.x' ] + dotnet-version: [ '8.0.x', '9.0.x' ] steps: - name: Checkout MudCalendar repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup dotnet uses: actions/setup-dotnet@v3