From 03d4d2be7fa517ac73e229db1b74024c17ad0002 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 May 2026 03:00:35 +0000 Subject: [PATCH 1/2] Bump MudBlazor from 9.2.0 to 9.5.0 --- updated-dependencies: - dependency-name: MudBlazor dependency-version: 9.5.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/MudBlazor.Markdown/MudBlazor.Markdown.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MudBlazor.Markdown/MudBlazor.Markdown.csproj b/src/MudBlazor.Markdown/MudBlazor.Markdown.csproj index 7e19a9a..b19ddf5 100644 --- a/src/MudBlazor.Markdown/MudBlazor.Markdown.csproj +++ b/src/MudBlazor.Markdown/MudBlazor.Markdown.csproj @@ -22,7 +22,7 @@ - + From 7d12268ac4922217acc65a1260da29e712c00317 Mon Sep 17 00:00:00 2001 From: kuzmins Date: Thu, 11 Jun 2026 16:14:36 +0900 Subject: [PATCH 2/2] call internal mudblazor methods --- .../Utils/Extensions/MudBlazorEx.cs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/MudBlazor.Markdown/Utils/Extensions/MudBlazorEx.cs diff --git a/src/MudBlazor.Markdown/Utils/Extensions/MudBlazorEx.cs b/src/MudBlazor.Markdown/Utils/Extensions/MudBlazorEx.cs new file mode 100644 index 0000000..c9ea783 --- /dev/null +++ b/src/MudBlazor.Markdown/Utils/Extensions/MudBlazorEx.cs @@ -0,0 +1,63 @@ +#if NET10_0_OR_GREATER +using System.Runtime.CompilerServices; +#else +using System.Reflection; +#endif + +namespace MudBlazor; + +internal static class MudBlazorEx +{ +#if NET10_0_OR_GREATER + [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "ToStringFast")] + private static extern string MudToStringFast( + [UnsafeAccessorType("MudBlazor.ColorExtensions, MudBlazor")] + object _, + Color color + ); + + [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "ToStringFast")] + private static extern string MudToStringFast( + [UnsafeAccessorType("MudBlazor.UnderlineExtensions, MudBlazor")] + object _, + Underline underline + ); + + [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "ToStringFast")] + private static extern string MudToStringFast( + [UnsafeAccessorType("MudBlazor.TypoExtensions, MudBlazor")] + object _, + Typo typo + ); +#else + private static string MudToStringFast(object _, Color color) + { + var extensions = typeof(Color).Assembly.GetType("MudBlazor.ColorExtensions"); + var method = extensions?.GetMethod("ToStringFast", types: [typeof(Color)], bindingAttr: BindingFlags.Public | BindingFlags.Static); + return (string?)method?.Invoke(null, [color]) ?? throw new InvalidOperationException("Unable to find Color from MudBlazor"); + } + + private static string MudToStringFast(object _, Underline underline) + { + var extensions = typeof(Underline).Assembly.GetType("MudBlazor.UnderlineExtensions"); + var method = extensions?.GetMethod("ToStringFast", types: [typeof(Underline)], bindingAttr: BindingFlags.Public | BindingFlags.Static); + return (string?)method?.Invoke(null, [underline]) ?? throw new InvalidOperationException("Unable to find Underline from MudBlazor"); + } + + private static string MudToStringFast(object _, Typo typo) + { + var extensions = typeof(Typo).Assembly.GetType("MudBlazor.TypoExtensions"); + var method = extensions?.GetMethod("ToStringFast", types: [typeof(Typo)], bindingAttr: BindingFlags.Public | BindingFlags.Static); + return (string?)method?.Invoke(null, [typo]) ?? throw new InvalidOperationException("Unable to find Typo from MudBlazor"); + } +#endif + + public static string ToStringFast(this Color color) + => MudToStringFast(null!, color); + + public static string ToStringFast(this Underline underline) + => MudToStringFast(null!, underline); + + public static string ToStringFast(this Typo typo) + => MudToStringFast(null!, typo); +}