Skip to content

Commit c27ef34

Browse files
authored
Merge pull request #340 from Blazor-Diagrams/develop
Version 3.0.0
2 parents 83beefa + 1f7e376 commit c27ef34

File tree

412 files changed

+18305
-6493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+18305
-6493
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: Build
22
on:
33
push:
44
branches:
5-
- master
5+
- master
6+
- develop
7+
- 3.0.0
68
pull_request:
79
types: [opened, synchronize, reopened]
810
jobs:

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v2
1414

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

1818
- name: GitHub Pages
1919
if: success()

Blazor.Diagrams.sln

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30114.128
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32014.148
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EE32E278-A887-454E-987D-FFE9E37169FE}"
77
EndProject
@@ -21,7 +21,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Diagrams.Algorithms"
2121
EndProject
2222
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{260DF53D-FF2B-4D1D-ACA7-431F6B62EE38}"
2323
ProjectSection(SolutionItems) = preProject
24+
.github\workflows\build.yml = .github\workflows\build.yml
2425
CHANGELOG.md = CHANGELOG.md
26+
.github\workflows\main.yml = .github\workflows\main.yml
2527
README.md = README.md
2628
EndProjectSection
2729
EndProject
@@ -31,11 +33,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Diagrams.Core.Tests"
3133
EndProject
3234
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A9FC9B20-A9F1-4066-8B59-83BD26D3B1C8}"
3335
EndProject
34-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diagram-Demo", "docs\Diagram-Demo\Diagram-Demo.csproj", "{5F423724-5319-4DCE-B9F2-8B2D7E1FDC17}"
36+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Diagram-Demo", "docs\Diagram-Demo\Diagram-Demo.csproj", "{5F423724-5319-4DCE-B9F2-8B2D7E1FDC17}"
3537
EndProject
36-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomNodesLinks", "docs\CustomNodesLinks\CustomNodesLinks.csproj", "{3D104DB4-C7F0-42CA-9D78-AB2C8A8AE3D5}"
38+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomNodesLinks", "docs\CustomNodesLinks\CustomNodesLinks.csproj", "{3D104DB4-C7F0-42CA-9D78-AB2C8A8AE3D5}"
3739
EndProject
38-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Layouts", "docs\Layouts\Layouts.csproj", "{78C85C89-B464-4083-8829-78BA52BB4780}"
40+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Layouts", "docs\Layouts\Layouts.csproj", "{78C85C89-B464-4083-8829-78BA52BB4780}"
41+
EndProject
42+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.Diagrams.Tests", "tests\Blazor.Diagrams.Tests\Blazor.Diagrams.Tests.csproj", "{ED3B0D8F-F29A-4C66-A167-C36824A76902}"
43+
EndProject
44+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "site", "site", "{F1E6F4C0-3EC7-4CFF-834A-0CF207CCFF3E}"
45+
EndProject
46+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Site", "site\Site\Site.csproj", "{F26307EC-C188-44BD-B3E5-960318F43C0C}"
3947
EndProject
4048
Global
4149
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -83,6 +91,14 @@ Global
8391
{78C85C89-B464-4083-8829-78BA52BB4780}.Debug|Any CPU.Build.0 = Debug|Any CPU
8492
{78C85C89-B464-4083-8829-78BA52BB4780}.Release|Any CPU.ActiveCfg = Release|Any CPU
8593
{78C85C89-B464-4083-8829-78BA52BB4780}.Release|Any CPU.Build.0 = Release|Any CPU
94+
{ED3B0D8F-F29A-4C66-A167-C36824A76902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95+
{ED3B0D8F-F29A-4C66-A167-C36824A76902}.Debug|Any CPU.Build.0 = Debug|Any CPU
96+
{ED3B0D8F-F29A-4C66-A167-C36824A76902}.Release|Any CPU.ActiveCfg = Release|Any CPU
97+
{ED3B0D8F-F29A-4C66-A167-C36824A76902}.Release|Any CPU.Build.0 = Release|Any CPU
98+
{F26307EC-C188-44BD-B3E5-960318F43C0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99+
{F26307EC-C188-44BD-B3E5-960318F43C0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
100+
{F26307EC-C188-44BD-B3E5-960318F43C0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
101+
{F26307EC-C188-44BD-B3E5-960318F43C0C}.Release|Any CPU.Build.0 = Release|Any CPU
86102
EndGlobalSection
87103
GlobalSection(SolutionProperties) = preSolution
88104
HideSolutionNode = FALSE
@@ -98,6 +114,8 @@ Global
98114
{5F423724-5319-4DCE-B9F2-8B2D7E1FDC17} = {A9FC9B20-A9F1-4066-8B59-83BD26D3B1C8}
99115
{3D104DB4-C7F0-42CA-9D78-AB2C8A8AE3D5} = {A9FC9B20-A9F1-4066-8B59-83BD26D3B1C8}
100116
{78C85C89-B464-4083-8829-78BA52BB4780} = {A9FC9B20-A9F1-4066-8B59-83BD26D3B1C8}
117+
{ED3B0D8F-F29A-4C66-A167-C36824A76902} = {CEEAE4C2-CE68-4FC3-9E0F-D4781B91F7F4}
118+
{F26307EC-C188-44BD-B3E5-960318F43C0C} = {F1E6F4C0-3EC7-4CFF-834A-0CF207CCFF3E}
101119
EndGlobalSection
102120
GlobalSection(ExtensibilityGlobals) = postSolution
103121
SolutionGuid = {969540A2-8162-4063-A4E3-B488F69BD582}

CHANGELOG.md

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,252 @@
1+
12
# Changelog
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
56
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

8+
## Diagrams (3.0.0) - 2023-08-14
9+
10+
Finally, the new documentation website is here!
11+
Please don't hesitate to create issues for any problems or improvements.
12+
PS: I suck at design.
13+
14+
### Added
15+
16+
- `AddLabel` method to links to easily create `LinkLabelModel`
17+
- `AddVertex` method to links to easily create `LinkVertexModel`
18+
- `ControlledSize` property to nodes. If `true`, the node will not be registered in the `ResizeObserver` (saves a JS call).
19+
- `autoSize` argument to `SvgGroupModel` constructor
20+
21+
### Changed
22+
23+
- Renamed `Point.Substract` to `Subtract` (duh)
24+
- Avoid rendering link selection helper on dragged link
25+
26+
### Fixed
27+
28+
- `SmoothPathGenerator` not working with `LinkAnchor`
29+
- Mouse overlapping dragged link
30+
- Useless Console Logs from `GroupModel` are now removed
31+
- JS exception in `(un)oberve` methods when the element doesn't exist anymore
32+
33+
## Diagrams (3.0.0-beta.6) - 2023-05-09
34+
35+
### Added
36+
37+
- `Style` parameter to `PortRenderer`
38+
- `TargetAttached` to links, which triggers when a dragged link attaches to a target
39+
- If port snapping is enabled, it will trigger only once when you let go of the mouse
40+
- `SuspendSorting` to `Diagram` in order to suspend sorting models in each `OrderChanged`
41+
- If you know what you're doing, you could save some processing and avoid sorting everytime
42+
- `RefreshOrders` to be called after unsuspending sorting in order to sort the models again and refresh the diagram
43+
44+
### Changed
45+
46+
- `BaseLayer.Add` now returns the specific type given to it in argument
47+
- **[BREAKING]** CSS classes are now prefixed with `diagram-` to avoid clashes with other libraries
48+
- `diagram-group`, `diagram-node`, `diagram-link`, `diagram-port`, `diagram-link-label`, `diagram-link-vertex`, `diagram-control`
49+
50+
### Fixed
51+
52+
- Portless links in children not refreshing when moving the parent group
53+
- Link's `GetBounds` not returning a valid box
54+
- Port snapping choosing the first port in radius rather than the closest one
55+
- Remove `Console.WriteLine` from `KeyboardShortcutsBehavior`
56+
- Diagram overwriting `Order` when it's not zero (zero being the default int value, which we now consider as not set)
57+
58+
## Diagrams (3.0.0-beta.5) - 2022-11-23
59+
60+
### Added
61+
62+
- `AdditionalSvg` option to `DiagramCanvas` in order to render any exatra SVG content you want
63+
- `AdditionalHtml` option to `DiagramCanvas` in order to render any exatra SVG content you want
64+
- `DistanceTo` overload method to `Point` that takes x and y
65+
- `MoveAlongLine` method to `Point`
66+
- `FullPath` to `PathGeneratorResult` to represent the full path without cuts
67+
- Fallback router to Orthogonal router
68+
- Margin options to `OrthogonalRouter`
69+
- `radius` option to `StraightPathGenerator` in order to generate rounded bends
70+
- Support for custom vertices
71+
- `AutoSize` option to groups to control whether moving children resizes the group
72+
73+
### Changed
74+
75+
- All routers are now classes instead of functions, they inherit from the new abstract class `Router`
76+
- All path generators are now classes instead of functions, they inherit from the new abstract class `PathGenerator`
77+
- Optimize Orthogonal router by using custom A* (x5 improvement)
78+
79+
### Removed
80+
81+
- `Router` delegate
82+
- `PathGenerator` delegate
83+
84+
## Diagrams (3.0.0-beta.4) - 2022-10-16
85+
86+
### Added
87+
88+
- Initial version of Ordering!
89+
- Nodes, groups and links can now be ordered using the new `Order` property or `SendToFront/Back` methods
90+
- `Diagram.OrderedSelectables` returns the ordered selectables/models
91+
- `DiagramCanvas` now uses this new property to render everything
92+
- `GridSnapToCenter` option in order to snap nodes from their center instead of their top/left position (thanks to @[Jeremy Vance](https://github.com/240026763))
93+
- More unit tests
94+
95+
### Changed
96+
97+
- `Groups` is not a list of groups anymore, but a layer instead (just like `Nodes` and `Links`)
98+
99+
### Fixed
100+
101+
- Deleting a group doesn't delete links attached to it
102+
- Deleting a group inside of a group doesn't refresh the parent group
103+
- Links not refreshing when a group's dimensions are updated directly (e.g. deleting a child)
104+
- Layers causing more refreshes than intended
105+
106+
### Removed
107+
108+
- All group-related methods and events from `Diagram`, please use the new layer from now on
109+
110+
## Diagrams (3.0.0-beta.3) - 2022-09-18
111+
112+
### Added
113+
114+
- Support for `LinkFactory` to return null in order to not create an ongoing link
115+
- Support for free links (no source/target required)
116+
- `PositionAnchor` which reprensents a simple plain position (mutable)
117+
- `ArrowHeadControl` to control a link's Source/Target on the fly
118+
- `attached` css class to attached links
119+
120+
### Changed
121+
122+
- Replace `OngoingPosition` with the new `PositionAnchor`
123+
- `BaseLinkModel.Target` will never be null anymore. An ongoing link will have a position anchor as the target
124+
- `Links.Factory` signature now takes the diagram, source (model) and the target anchor
125+
- Move `DynamicAnchor` back to `Anchors` namespace and seal all `Anchor` classes
126+
127+
### Fixed
128+
129+
- Links attached to links not refreshing when the others are
130+
- `LinkPathPositionProvider` not working with maxlength ratios
131+
- Deleting a link not deleting the links attached to it
132+
133+
### Removed
134+
135+
- `PositionProvider` argument from `ExecutableControl` for more freedom
136+
- `Id` and `Refresh` from `ILinkable`
137+
- Unused `Offset` from `Anchor` and make `Model` nullable
138+
139+
## Diagrams (3.0.0-beta.2) - 2022-09-11
140+
141+
### Added
142+
143+
- `Moved` event to Movables
144+
- `Visible` property and `VisbilityChanged` event to models
145+
- `Options.Virtualization` (of type `[Diagram]VirtualizationOptions`) for virtualization options
146+
- `PointerEnter/Leave` events for groups as well
147+
- **Experimental Link to Link** (using `LinkAnchor`)
148+
149+
### Changed
150+
151+
- Rename `RegisterModelComponent` to `RegisterComponent`
152+
- Rename `GetComponentForModel` to `GetComponent`
153+
- Virtualization is now handled by a behavior instead of NodeRender
154+
- This means that it works for almost all models (nodes, groups and links)
155+
- Render link labels without foreignObject in widget nor MarkupString (Thank you .NET 6)
156+
- Custom link labels only need to contain relevant content, they don't need to handle positioning anymore
157+
158+
### Removed
159+
160+
- `EnableVirtualization` option (see added alternative)
161+
162+
## Diagrams (3.0.0-beta.1) - 2022-09-04
163+
164+
.NET 6!
165+
166+
A lot of things changed in this version, a lot of breaking changes were introduced but I believe it was necessary.
167+
Many changes were required to make everything clearer, customizable and cleaner (code wise).
168+
I'm aiming to completely decouple the Core library from the UI, because I'm thinking of giving MAUI Diagrams a try very soon!
169+
170+
### Added
171+
172+
- `BlazorDiagram` class (inherits `Diagram`) to the blazor package to replace the old Core one
173+
- `BlazorDiagramOptions` that inherit from the other diagram options to add Blazor (UI) specific options
174+
- `Blazor.Diagrams.Models.SvgNodeModel` class to represent a node that needs to be rendered in the SVG layer
175+
- `GetBehavior<T>` method to `Diagram` in order to retrieve a registered behavior
176+
- `KeyboardShortcutsBehavior` class which handles keyboard shortcuts/actions:
177+
- `SetShortcut`: sets an action (`Func<Diagrambase, ValueTask>`) to be executed whenever the specified combination is pressed
178+
- `RemoveShortcut`: removes a defined action (if it exists)
179+
- `KeyboardShortcutsDefaults` containing the default shortcuts that were deleted (`DeleteSelection` and `Grouping`)
180+
- Anchors functionality:
181+
- An Anchor determines where on an element the link will connect
182+
- Instead of links requiring the source and target to be either both nodes or both ports, there is now only one `Source` and `Target` of type `Anchor`
183+
- This lets the link not worry about the details of from/to where its going, as long as the anchor provides it with its position when asked for
184+
- Current implementations:
185+
- `SinglePortAnchor`: Specifies that the connection point is a specific port (supports shape & alignment)
186+
- `ShapeIntersectionAnchor`: Specifies that the connection point is the intersection of a line with the node's shape
187+
- `DynamicAnchor`: Specifies that the connection point is one of the given positions (closest)
188+
- Virtual `IShape GetShape()` method on nodes (default `Rectangle`) and ports (default `Circle`)
189+
- `Options.LinksLayerOrder` to indicate the order of the links layer (svg for blazor)
190+
- `Options.NodesLayerOrder` to indicate the order of the nodes layer (html for blazor)
191+
- Support for SVG groups that also represent children as a hierarchy (`SvgGroupModel`)
192+
- Node renderer will now append, in addition to `node locked`, the classes `selected grouped`
193+
- `IHasBounds` and `IHasShape` interfaces to both nodes and ports
194+
- `IPositionProvider` to encapsulate how certain positions are calculated given a model
195+
- They are used for dynamic anchors and controls for now
196+
- `BoundsBasedPositionProvider` returns the position based on the bounds of the model (e.g. (0.5, 0.5) would be the center)
197+
- `ShapeAnglePositionProvider` returns the position as the point at the angle of the shape
198+
- `LinkPathPositionProvider` returns the position based on the link's path (`getPointAtLength`)
199+
- Links have a reference to `Diagram` now
200+
- `PointerEnter` and `PointerLeave` events for nodes and links for now
201+
- `GeneratedPathResult` and `Paths` to `BaseLinkModel` to always have access to the actual paths
202+
- `Controls` feature (beta):
203+
- They are things that can show up on top of nodes/links and can even be clicked to be executed
204+
- Their UI is also picked up from the registered components
205+
- `Control` designates a control that has a position and will be rendered if visible
206+
- `ExecutableControl` designates a control that has a position and will be executed when pressed (PointerDown event)
207+
- Default controls for now are:
208+
- `BoundaryControl` shows the model's boundary
209+
- `RemoveControl` shows a button that when clicked, removes the model from the diagram
210+
- `DragNewLink` shows a button that when clicked, starts a new link dragging from that node
211+
- `GridWidget` a background grid that moves with the diagram instead of being fixed like in the Snap to grid example
212+
- More unit tests
213+
214+
### Changed
215+
216+
- Core package changes:
217+
- Web dependency was removed from the Core package
218+
- `Diagram` is now abstract
219+
- These changes were done to decouple the core from the rendering, in the future we might have a MAUI renderer
220+
- `Diagram.GetComponentForModel` now accepts a `checkSubclasses` argument (default `true`)
221+
- Constraints now must return a `ValueTask<bool>` instead of a simple `bool`
222+
- Renamed `AllLinks` to `PortLinks` for more clarity on which links, since `Links` contains the others
223+
- Dragging links from ports will now follow the mouse at the same pace minus 5 pixels so that it doesn't go on top of the link it self or other ports
224+
- How groups are rendered
225+
- `GroupRenderer` will take care of rendering the group with the appropriate style and classes
226+
- Only `GroupNodes` is required, `GroupLinks` was deleted because all links are shown in the svg layer (with appropriate order)
227+
- `Diagram.AddGroup` will now return the added group
228+
- All `Mouse` events have been converted to `Pointer` events
229+
- `PathGenerator` now return `SvgPath` instead of just strings
230+
- `NavigatorWidget` was rewritten to be faster, lighter, WORKING and customizable
231+
- It now can also take the shape of the nodes into account (rect and ellipse for now)
232+
233+
### Fixed
234+
235+
- Virtualization throwing a JSException (#155)
236+
- Ports not rendering correctly because of the missing `@key` (#220)
237+
- Link not refreshing when a new vertex is created, which was showing out of link
238+
239+
### Removed
240+
241+
- `DefaultNodeComponent` and `DefaultLinkComponent` options (see `GetComponentForModel` changes)
242+
- `RenderLayer` from the Core package and all its usage
243+
- `DeleteSelectionBehavior` since there is a new keyboard shortcuts system
244+
- `GroupingBehavior` since there is a new keyboard shortcuts system
245+
- `BaseLinkModelExtensions` since it was Obselete
246+
- Unnecessary port refreshes when dragging a link ends or when link snapping
247+
- `ShapeDefiner` delegate and constructor arguments on nodes since delegates can't be serialized
248+
- `TouchX` events
249+
7250
## Diagrams (2.1.6) - 2021-10-31
8251

9252
### Fixed

docs/CustomNodesLinks/CustomNodesLinks.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
using Blazor.Diagrams.Core.Models;
22

3-
namespace CustomNodesLinks.Models
3+
namespace CustomNodesLinks.Models;
4+
5+
public sealed class DiagramLink : LinkModel
6+
{
7+
public DiagramLink(string name, NodeModel sourceNode, NodeModel? targetNode) :
8+
base(name, sourceNode, targetNode)
49
{
5-
public sealed class DiagramLink : LinkModel
6-
{
7-
public DiagramLink(string name, NodeModel sourceNode, NodeModel? targetNode) :
8-
base(name, sourceNode, targetNode)
9-
{
10-
Name = name;
11-
Labels.Add(new DiagramLinkLabel(this, Name));
12-
}
10+
Name = name;
11+
Labels.Add(new DiagramLinkLabel(this, Name));
12+
}
1313

14-
public string Name { get; set; }
15-
}
14+
public string Name { get; set; }
1615
}

0 commit comments

Comments
 (0)