Skip to content

Commit

Permalink
Update packages, add DataUrlDecoder.Decode extension method (#298)
Browse files Browse the repository at this point in the history
## Target
<!--
  Why are you making this change?
 -->
Update packages, add DataUrlDecoder.Decode extension method
#### Open Questions
<!-- OPTIONAL
- [ ] Use the GitHub checklists to spark discussion on issues that may
arise from your approach. Please tick the box and explain your answer.
-->

## Checklist
<!--
It serves as a gentle reminder for common tasks. Confirm it's done and
check everything that applies.
-->
- [ ] Documentation updated
- [x] Tests cover new or modified code
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] New dependencies added
- [ ] Includes breaking changes
- [x] Version bumped

## Visuals
<!-- OPTIONAL
Show results both before and after this change. When the output changes,
it can be a screenshot of a trace, metric, or log illustrating the
change.
-->
  • Loading branch information
MaxymGorn authored Feb 2, 2024
2 parents b215ec4 + 68dfc6d commit 39dbbfd
Show file tree
Hide file tree
Showing 120 changed files with 1,810 additions and 768 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,24 @@ jobs:
files: coverage.net6.0.cobertura.xml, coverage.net7.0.cobertura.xml, coverage.net8.0.cobertura.xml
fail_ci_if_error: true
verbose: true

# publishes Blazor project to the release-folder

- name: Wait for Exit Code 1 for Cropper.Blazor.Sitemap.Generator project
run: |
dotnet run -c Release
working-directory: src/Cropper.Blazor/Cropper.Blazor.Sitemap.Generator

- name: Check if sitemap.xml File Exists
run: |
filePath="./sitemap.xml"
if [ -f "$filePath" ]; then
echo "sitemap.xml file exists"
else
echo "File does not exist"
exit 1
fi
working-directory: src/Cropper.Blazor/Client/wwwroot

# publishes Blazor project to the release-folder
- name: Publish .NET Core Project
run: dotnet publish ./src/Cropper.Blazor/Client/Cropper.Blazor.Client.csproj -c Release --output release --nologo

Expand Down Expand Up @@ -119,6 +135,8 @@ jobs:
demo-projects-build:
name: Build Demo Projects
runs-on: windows-latest
env:
JAVA_HOME: '/home/runner/android-sdk'

steps:
- uses: actions/checkout@v3
Expand All @@ -131,7 +149,23 @@ jobs:
6.0.x
7.0.x
8.0.x
- name: Cache JDK
id: cache-jdk
uses: actions/cache@v3
with:
path: ${{ env.JAVA_HOME }}
key: ${{ runner.os }}-jdk-11
restore-keys: |
${{ runner.os }}-jdk-
- name: Setup Java JDK
if: steps.cache-jdk.outputs.cache-hit != 'true'
uses: actions/[email protected]
with:
distribution: 'microsoft'
java-version: 11

- name: search workloads
run: dotnet workload search

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="7.0.1" Version="7.0.1" />
<PackageReference Include="MudBlazor" Version="6.11.0" />
<PackageReference Include="MudBlazor" Version="6.11.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="MudBlazor" Version="6.11.0" />
<PackageReference Include="MudBlazor" Version="6.11.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MudBlazor" Version="6.11.0" />
<PackageReference Include="MudBlazor" Version="6.11.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MudBlazor" Version="6.11.0" />
<PackageReference Include="MudBlazor" Version="6.11.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MudBlazor" Version="6.11.0" />
<PackageReference Include="MudBlazor" Version="6.11.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MudBlazor" Version="6.11.0" />
<PackageReference Include="MudBlazor" Version="6.11.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Cropper.Blazor/Client/App.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
<FocusOnNavigate RouteData="@routeData" Selector=".button-gradient" />
</Found>

<NotFound>
Expand Down
6 changes: 3 additions & 3 deletions src/Cropper.Blazor/Client/Components/Docs/ApiLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private static string GetComponentName(Type type)
return component;
}

public static Type GetTypeFromComponentLink(string component)
public static Type? GetTypeFromComponentLink(string component)
{
if (component.Contains('#') == true)
{
Expand All @@ -37,7 +37,7 @@ public static Type GetTypeFromComponentLink(string component)

if (string.IsNullOrEmpty(component))
{
throw new ArgumentException(nameof(component));
return null;
}

var assembly = typeof(CropperComponent).Assembly;
Expand All @@ -58,7 +58,7 @@ public static Type GetTypeFromComponentLink(string component)
}
}

throw new ArgumentNullException(nameof(component));
return null;
}

public static string GetContextType(this Type type)
Expand Down
70 changes: 35 additions & 35 deletions src/Cropper.Blazor/Client/Components/Docs/DocsApi.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,42 @@
@using Cropper.Blazor.Shared.Extensions;

<DocsPage>
@if (!IsContract)
{
<link rel="canonical" Href="@ApiLink.GetComponentLinkFor(Type)" />
<DocsPageSection api-link-section>
<SectionHeader Title="Pages" TitleClass="mt-3" />
<div class="docs-page-apilinks">
<ul class="my-2">
<li>
<MudLink Class="disabled"
UserAttributes="@(new Dictionary<string, object>(){ {"rel", "noopener"} })"
Href="#">
<CodeInline>@Type.GetTypeDisplayName()</CodeInline>
</MudLink>
</li>
</ul>
</div>
</DocsPageSection>
}
else
{
<MudText Typo="Typo.h5" Class="mt-3">
@if (Type.IsEnum)
{
<div>
Enum <b>@TypeNameHelper.GetTypeDisplay(Type, false, true)</b>
</div>
}
else
{
<div>
Contract <b>@TypeNameHelper.GetTypeDisplay(Type, false, true)</b>
</div>
}
</MudText>
}
<DocsPageHeader Title="Cropper Component API" TitleTypo="@Typo.h4" />
<DocsPageContent>
@if (!IsContract)
{
<link rel="canonical" Href="@ApiLink.GetComponentLinkFor(Type)" />
<DocsPageSection api-link-section>
<SectionHeader Title="Pages" TitleClass="mt-3" />
<div class="docs-page-apilinks">
<ul class="my-2">
<li>
<MudLink UserAttributes="@(new Dictionary<string, object>(){ {"rel", "noopener"} })"
Href="examples/cropperusage">
<CodeInline>@Type.GetTypeDisplayName()</CodeInline>
</MudLink>
</li>
</ul>
</div>
</DocsPageSection>
}
else
{
<MudText Typo="Typo.h5" Class="mt-3">
@if (Type.IsEnum)
{
<div>
Enum <b>@TypeNameHelper.GetTypeDisplay(Type, false, true)</b>
</div>
}
else
{
<div>
Contract <b>@TypeNameHelper.GetTypeDisplay(Type, false, true)</b>
</div>
}
</MudText>
}

@{
// save as lists to speed up displaying the page
Expand Down
18 changes: 17 additions & 1 deletion src/Cropper.Blazor/Client/Components/Docs/DocsPage.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
<MudMainContent Class="mb-16">
<MudMainContent Class="mb-8">
<MudContainer MaxWidth="MaxWidth.Large">
<div id="docspage" class="docs-page">
<CascadingValue Value="this" IsFixed>
@ChildContent
</CascadingValue>
</div>
</MudContainer>
@if (DisplayFooter)
{
<MudContainer MaxWidth="MaxWidth.Large" Class="mt-16">
<Footer />
</MudContainer>
}
else
{
<MudContainer MaxWidth="MaxWidth.Large" Class="mt-8">
<MudToolBar DisableGutters="true" Dense="true" WrapContent="true">
<MudText Typo="Typo.body1">Copyright © 2022-@DateTime.Now.Year <span class="text-gradient">Cropper.Blazor</span></MudText>
<MudSpacer />
<MudText Typo="Typo.body1">Powered by .NET @Environment.Version.ToString()</MudText>
</MudToolBar>
</MudContainer>
}
<MudDrawer Class="docs-page-content-navigation-drawer" @bind-Open="_contentDrawerOpen" Breakpoint="Breakpoint.Lg" Anchor="Anchor.End" ClipMode="DrawerClipMode.Always" Elevation="0" Color="Color.Transparent">
@if (_displayView)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Diagnostics;
using Cropper.Blazor.Client.Services;
using Microsoft.AspNetCore.Components;
using Cropper.Blazor.Client.Models;
using MudBlazor;
using MudBlazor.Interfaces;

Expand All @@ -19,6 +18,7 @@ public partial class DocsPage : ComponentBase
[Inject] NavigationManager NavigationManager { get; set; }
[Inject] private IRenderQueueService RenderQueue { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public bool DisplayFooter { get; set; }

private bool _contentDrawerOpen = true;
public event Action<Stopwatch> Rendered;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
else
{
<div class="docs-page-header mt-6 mb-12">
<MudText Typo="@Typo.h3">@Title</MudText>
<MudText Typo="@TitleTypo">@Title</MudText>
<MudText>@GetSubTitle() @Description</MudText>
</div>
}
Expand All @@ -25,9 +25,10 @@ else
[Parameter] public string SubTitle { get; set; }
[Parameter] public RenderFragment Description { get; set; }
[Parameter] public RenderFragment SpecialHeaderContent { get; set; }
[Parameter] public Typo TitleTypo { get; set; } = Typo.h3;


string GetTitle() => $"{Title} - MudBlazor";
string GetTitle() => $"{Title} - Cropper.Blazor";

string GetSubTitle()
{
Expand Down
56 changes: 28 additions & 28 deletions src/Cropper.Blazor/Client/Components/Docs/SectionContent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@

@if ((Codes != null || ChildContent != null) && !IsOnlySingleSectionCode)
{
<div class="@Classname">
<div class="@Classname" style="@Style">
@if (Codes != null || ChildContent != null)
{
<MudToolBar Class="@ToolbarClassname">
<MudButtonGroup Color="Color.Primary" Class="mud-width-full"
Variant="Variant.Text" VerticalAlign="IsVerticalAlign"
Style="border-radius: 8px 8px 0 0">
@if (Codes != null)
<MudToolBar Class="@ToolbarClassname" WrapContent="IsVerticalAlign">
@if (Codes != null)
{
@foreach (var codefile in Codes)
{
@foreach (var codefile in Codes)
{
<MudButton Class="@GetActiveCode(codefile.code)"
OnClick="@(() => SetActiveCode(codefile.code))"
Style="word-break: break-word;"
Size="Size.Small">
@codefile.title
</MudButton>
}
}

@if (!IsVerticalAlign)
{
<MudSpacer />
}

@if (HasCode && ChildContent != null)
{
<MudButton OnClick="OnShowCode"
StartIcon="@(ShowCode ? @Icons.Material.Rounded.CodeOff : Icons.Material.Rounded.Code)"
<MudButton Class="@GetActiveCode(codefile.code)"
Variant="@(IsVerticalAlign ? Variant.Filled : Variant.Text)"
Color="@(IsVerticalAlign ? Color.Primary : Color.Default)"
FullWidth="IsVerticalAlign"
OnClick="@(() => SetActiveCode(codefile.code))"
Style="word-break: break-word;"
Size="Size.Small">
@(ShowCode ? "Hide code" : "Show code")
@codefile.title
</MudButton>
}
</MudButtonGroup>
}

@if (!IsVerticalAlign)
{
<MudSpacer />
}

@if (HasCode && ChildContent != null)
{
<MudButton OnClick="OnShowCode"
FullWidth="IsVerticalAlign"
StartIcon="@(ShowCode ? @Icons.Material.Rounded.CodeOff : Icons.Material.Rounded.Code)"
Size="Size.Small">
@(ShowCode ? "Hide code" : "Show code")
</MudButton>
}
</MudToolBar>
}
@if (ChildContent != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public partial class SectionContent : IBrowserViewportObserver
.AddClass(ShowCodeClass)
.Build();

[Parameter] public string Style { get; set; } = null!;
[Parameter] public string Class { get; set; } = string.Empty;
[Parameter] public string ShowCodeClass { get; set; } = string.Empty;
[Parameter] public bool DarkenBackground { get; set; }
Expand Down Expand Up @@ -118,6 +119,12 @@ RenderFragment CodeComponent(string code) => builder =>
try
{
string? key = typeof(SectionContent).Assembly.GetManifestResourceNames().FirstOrDefault(x => x.Contains($".{code}Code.html"));

if (key is null)
{
throw new KeyNotFoundException($"'.{code}Code.html' code not exist");
}

using var stream = typeof(SectionContent).Assembly.GetManifestResourceStream(key!);
using var reader = new StreamReader(stream!);
var read = reader.ReadToEnd();
Expand All @@ -143,7 +150,7 @@ RenderFragment CodeComponent(string code) => builder =>
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
Console.WriteLine($"{ex.Message}, {ex.StackTrace}");
}
};

Expand Down
Loading

0 comments on commit 39dbbfd

Please sign in to comment.