Skip to content

Commit

Permalink
Merge pull request #339 from Blazor-Diagrams/new-site
Browse files Browse the repository at this point in the history
New documentation website + some fixes/improvements
  • Loading branch information
zHaytam authored Aug 14, 2023
2 parents 098c5b4 + bf24fe6 commit 1f7e376
Show file tree
Hide file tree
Showing 226 changed files with 9,683 additions and 6,762 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2

- name: Publish app
run: cd samples/Wasm && dotnet publish -c Release
run: cd site/Site && dotnet publish -c Release

- name: GitHub Pages
if: success()
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Diagrams (3.0.0) - 2023-08-14

Finally, the new documentation website is here!
Please don't hesitate to create issues for any problems or improvements.
PS: I suck at design.

### Added

- `AddLabel` method to links to easily create `LinkLabelModel`
- `AddVertex` method to links to easily create `LinkVertexModel`
- `ControlledSize` property to nodes. If `true`, the node will not be registered in the `ResizeObserver` (saves a JS call).
- `autoSize` argument to `SvgGroupModel` constructor

### Changed

- Renamed `Point.Substract` to `Subtract` (duh)
- Avoid rendering link selection helper on dragged link

### Fixed

- `SmoothPathGenerator` not working with `LinkAnchor`
- Mouse overlapping dragged link
- Useless Console Logs from `GroupModel` are now removed
- JS exception in `(un)oberve` methods when the element doesn't exist anymore

## Diagrams (3.0.0-beta.6) - 2023-05-09

### Added
Expand Down
21 changes: 10 additions & 11 deletions docs/CustomNodesLinks/Models/DiagramLink.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using Blazor.Diagrams.Core.Models;

namespace CustomNodesLinks.Models
namespace CustomNodesLinks.Models;

public sealed class DiagramLink : LinkModel
{
public DiagramLink(string name, NodeModel sourceNode, NodeModel? targetNode) :
base(name, sourceNode, targetNode)
{
public sealed class DiagramLink : LinkModel
{
public DiagramLink(string name, NodeModel sourceNode, NodeModel? targetNode) :
base(name, sourceNode, targetNode)
{
Name = name;
Labels.Add(new DiagramLinkLabel(this, Name));
}
Name = name;
Labels.Add(new DiagramLinkLabel(this, Name));
}

public string Name { get; set; }
}
public string Name { get; set; }
}
25 changes: 12 additions & 13 deletions docs/CustomNodesLinks/Models/DiagramLinkLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
using Blazor.Diagrams.Core.Models;
using Blazor.Diagrams.Core.Models.Base;

namespace CustomNodesLinks.Models
namespace CustomNodesLinks.Models;

public sealed class DiagramLinkLabel : LinkLabelModel
{
public DiagramLinkLabel(BaseLinkModel parent, string id, string content, double? distance = null, Point? offset = null) :
base(parent, id, content, distance, offset)
{
public sealed class DiagramLinkLabel : LinkLabelModel
{
public DiagramLinkLabel(BaseLinkModel parent, string id, string content, double? distance = null, Point? offset = null) :
base(parent, id, content, distance, offset)
{
}
}

public DiagramLinkLabel(BaseLinkModel parent, string content, double? distance = null, Point? offset = null) :
base(parent, content, distance, offset)
{
}
public DiagramLinkLabel(BaseLinkModel parent, string content, double? distance = null, Point? offset = null) :
base(parent, content, distance, offset)
{
}

public bool ShowLabel { get; set; } = true;
}
public bool ShowLabel { get; set; } = true;
}
19 changes: 9 additions & 10 deletions docs/CustomNodesLinks/Models/DiagramNode.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using Blazor.Diagrams.Core.Geometry;
using Blazor.Diagrams.Core.Models;

namespace CustomNodesLinks.Models
namespace CustomNodesLinks.Models;

public sealed class DiagramNode : NodeModel
{
public DiagramNode(string name, Point pos) :
base(name, pos)
{
public sealed class DiagramNode : NodeModel
{
public DiagramNode(string name, Point pos) :
base(name, pos)
{
Name = name;
}
Name = name;
}

public string Name { get; set; }
}
public string Name { get; set; }
}
39 changes: 17 additions & 22 deletions docs/CustomNodesLinks/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

namespace CustomNodesLinks.Pages
namespace CustomNodesLinks.Pages;

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public string RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;
private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
21 changes: 10 additions & 11 deletions docs/CustomNodesLinks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace CustomNodesLinks
namespace CustomNodesLinks;

public class Program
{
public static void Main(string[] args)
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
83 changes: 41 additions & 42 deletions docs/CustomNodesLinks/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,48 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace CustomNodesLinks
namespace CustomNodesLinks;

public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
public class Startup
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
}
37 changes: 16 additions & 21 deletions docs/Diagram-Demo/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

namespace Diagram_Demo.Pages
namespace Diagram_Demo.Pages;

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public string RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;
private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
21 changes: 10 additions & 11 deletions docs/Diagram-Demo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace Diagram_Demo
namespace Diagram_Demo;

public class Program
{
public static void Main(string[] args)
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
Loading

0 comments on commit 1f7e376

Please sign in to comment.