TMS.Z.Blazor.Diagrams
3.0.3.10
dotnet add package TMS.Z.Blazor.Diagrams --version 3.0.3.10
NuGet\Install-Package TMS.Z.Blazor.Diagrams -Version 3.0.3.10
<PackageReference Include="TMS.Z.Blazor.Diagrams" Version="3.0.3.10" />
<PackageVersion Include="TMS.Z.Blazor.Diagrams" Version="3.0.3.10" />
<PackageReference Include="TMS.Z.Blazor.Diagrams" />
paket add TMS.Z.Blazor.Diagrams --version 3.0.3.10
#r "nuget: TMS.Z.Blazor.Diagrams, 3.0.3.10"
#:package TMS.Z.Blazor.Diagrams@3.0.3.10
#addin nuget:?package=TMS.Z.Blazor.Diagrams&version=3.0.3.10
#tool nuget:?package=TMS.Z.Blazor.Diagrams&version=3.0.3.10
TMS.Z.Blazor.Diagrams
Changes from Original Z.Blazor.Diagrams
This fork contains additional features and fixes developed for the TMS (Transportation Management System). Below are the main changes:
рџљЂ New Features
1. Node Rotation Support - v3.0.3.1
- Description: Added full support for node rotation with configurable pivot point
- Model Changes:
NodeModel: addedRotation,RotationPivotX,RotationPivotYproperties- Events:
RotationChanged,RotationPivotChanged - Automatic AABB (Axis-Aligned Bounding Box) recalculation for correct bounds
- Visualization:
NodeRenderer: container rotation with pivot point consideration (CSStransform-origin/translate+rotate)- Support for both HTML and SVG rendering
- Compatibility: No breaking changes - new properties are optional
- Version: 3.0.3.1 (TMS.Z.Blazor.Diagrams, TMS.Z.Blazor.Diagrams.Core)
2. Rendering and Performance Optimization - v3.0.3.7
- Performance Improvements: Rendering optimization and pointer event handling
- Virtualization: Enhanced node visibility handling with size change subscriptions
3. Non-Interactive Nodes Support - v3.0.3.8
- Description: Added ability to make individual nodes non-interactive without JavaScript interop
- Use Case: Disable user interaction with specific nodes while keeping them visible
- Model Changes:
NodeModel: addedInteractableproperty (default:true)DiagramOptions: addedNonInteractableNodeCssClassproperty (default:"non-interactable")
- Visualization:
NodeRenderer: automatically applies CSS class whenInteractable = false- CSS class blocks pointer events via project-configurable class name
- No JavaScript required - changes take effect on next render
- Benefits:
- Zero JS interop overhead for dynamic interaction state changes
- Visual feedback through CSS (can be customized per project)
- Maintains node visibility while preventing selection/drag operations
- Compatibility: Fully backward compatible - new properties are optional
- Version: 3.0.3.10 (all packages)
4. Interactive Controls Pointer-Capture Guard - v3.0.3.10
- Restores clicks/inputs inside node controls by skipping pointer-capture for interactive elements in
wwwroot/script.js.
рџ› Technical Fixes
3. CSS-hiding Virtualization Mode
- Problem: Standard virtualization caused catastrophic delays during pan/zoom (up to 1700ms) due to heavy component recreation
- Solution: New mode where invisible nodes are hidden via
display:noneinstead of DOM removal - Benefits:
- Eliminates mount/unmount overhead during pan/zoom
- Components remain mounted in memory
- SignalR updates work normally without additional caching
- Drag latency reduced from ~1700ms to ~150ms
- Changed Files:
DiagramVirtualizationOptions.cs: newCssHidingpropertyNodeRenderer.cs: CSS-hiding logic for HTML and SVG nodes- Support in consuming application via
SchemeVirtualizationOptions
4. Drag Release Fix (Pointer Capture)
- Problem: Diagram remained in drag mode when mouse button was released outside
DiagramCanvas - Solution: Implementation of pointer capture and document-level fallback handlers
- Technical Details:
script.js: Pointer capture on.diagram-canvas, document-level handlersDiagramCanvas.razor.cs:OnPointerUpOutsidemethod for drag completion- Support for both WASM and Server-side Blazor
- Result: Proper drag completion regardless of mouse release location
5. Dependencies Update
- Description: Updated ASP.NET Core package versions for improved security and stability
- Changes:
- .NET 6.0: ASP.NET Core packages updated to 6.0.36
- .NET 7.0: ASP.NET Core packages updated to 7.0.20
- .NET 8.0: ASP.NET Core packages updated to 8.0.24
- .NET 9.0: ASP.NET Core packages updated to 9.0.13
- Benefits: Latest security patches and performance improvements
- Compatibility: No breaking changes - all updates are patch/minor versions
6. Circuit Disconnection Handling
- Problem: Exceptions thrown when trying to cleanup ResizeObserver after Blazor circuit disconnection
- Solution: Added exception handling in
JSRuntimeExtensions.UnobserveResizes() - Technical Details:
- Catches
JSDisconnectedExceptionwhen circuit is already disconnected - Catches
ObjectDisposedExceptionwhen DotNetObjectReference is disposed - Graceful degradation - cleanup is skipped when impossible
- Catches
- Benefits: Prevents application crashes during navigation or tab closure
- Compatibility: Backward compatible - no API changes
7. Interactive Controls Pointer-Capture Guard
- Problem: Global pointer-capture on
diagram-canvascould intercept interactions inside node UI (buttons, switches, inputs), resulting in visual click feedback without actualOnClick/input handling. - Solution: Added interactive-target guard in
wwwroot/script.jsbefore callingsetPointerCapture. - Technical Details:
- Added helper
isInteractiveTarget(target)with selector-based checks (button,input,textarea,select,a,[contenteditable], MudBlazor control classes, etc.) - In pointerdown capture handler: skip
setPointerCapturefor interactive descendants - Kept pointer-capture behavior unchanged for non-interactive canvas area (drag/release logic still works)
- Added helper
- Benefits:
- Restores correct click/input behavior in embedded node controls
- Removes need for per-control
pointerdown:stopPropagationworkarounds in app code - Preserves drag robustness fixed by pointer-capture release handling
- Changed Files:
src/Blazor.Diagrams/wwwroot/script.js
рџ“Љ Performance Comparison
| Virtualization Mode | Drag Latency | Scripting Overhead | DOM Memory |
|---|---|---|---|
| Disabled | ~150ms | low | all nodes |
| Standard | ~1700ms | ~725ms | viewport only |
| CSS-hiding | ~150ms | low | all nodes |
рџ”§ Configuration
To use new features in your application:
{
"Virtualization": {
"VirtualizationEnabled": true,
"CssHidingEnabled": true,
"VirtualizationPaddingPx": 200,
"ProgressiveOnViewport": false
}
}
рџ“ќ Change Documentation
Detailed technical documentation is available in src/Documents/:
CSS_HIDING_VIRTUALIZATION.md- Complete CSS-hiding mode descriptionPOINTER_CAPTURE_DRAG_RELEASE_FIX.md- Technical details of drag release fix
Blazor.Diagrams
Z.Blazor.Diagrams is a fully customizable and extensible all-purpose diagrams library for Blazor (both Server Side and WASM). It was first inspired by the popular React library react-diagrams, but then evolved into something much bigger. ZBD can be used to make advanced diagrams with a custom design. Even the behavior of the library is "hackable" and can be changed to suit your needs.
| NuGet Package | Version | Download |
|---|---|---|
| Z.Blazor.Diagrams.Core | ||
| Z.Blazor.Diagrams | ||
| Z.Blazor.Diagrams.Algorithms |
| Badges | |
|---|---|
| JavaScript | |
| CSS | |
| Activity | |
| License |
Mindset/Goals
- Be multi purpose and useful for most diagramming use cases. ZBD started as a diagramming library for specific use cases, but it is now expanding to be more generic and more useful.
- Performance is very important, especially in WebAssembly.
- Separate the data layer (models) and the UI layer (widgets). Representing diagrams as a model has a lot of benefits, and the separation makes things easier, such as saving snapshots or mutating models, regardless of how/where it's gonna be rendered.
- Be fully customizable, either in how things look or how things behave. All of the UI can be customized by either providing Blazor components or using CSS. All of the default behaviors are customizable by replacing them with your own custom behaviors.
- Avoid JavaScript. 95% of ZBD is made using C#/Blazor, JS is only used when absolutely necessary (e.g. bounds and observers). JS interop calls are costly, in the future, we strive to have most of them batched and/or replaced.
Features
- Multi purpose
- Touch support
- SVG layer for links/nodes and HTML layer for nodes for maximum customizability
- Links between nodes, ports and even other links
- Link routers, path generators, markers and labels
- Panning, Zooming and Zooming to fit a set of nodes
- Multi selection, deletion and region selection
- Groups as first class citizen, with all the features of nodes
- Custom nodes, links and groups
- Replaceable ("Hackable") behaviors (e.g. link dragging, model deletion, etc..)
- Customizable Diagram overview/navigator for large diagrams
- Snap to Grid
- Virtualization, only draw nodes that are visible to the users
- Locking mechanism (read-only)
- Algorithms
Getting Started
You can get started very easily & quickly using:
Sample project
Repository: https://github.com/Blazor-Diagrams/Blazor.DatabaseDesigner
Contributing
All kinds of contributions are welcome!
If you're interested in helping, please create an issue or comment on an existing one to explain what you will be doing. This is because multiple people can be working on the same problem.
Feedback
If you find a bug or you want to see a functionality in this library, feel free to open an issue.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Microsoft.AspNetCore.Components (>= 6.0.36)
- Microsoft.AspNetCore.Components.Web (>= 6.0.36)
- SvgPathProperties (>= 1.1.2)
-
net7.0
- Microsoft.AspNetCore.Components (>= 7.0.20)
- Microsoft.AspNetCore.Components.Web (>= 7.0.20)
- SvgPathProperties (>= 1.1.2)
-
net8.0
- Microsoft.AspNetCore.Components (>= 8.0.24)
- Microsoft.AspNetCore.Components.Web (>= 8.0.24)
- SvgPathProperties (>= 1.1.2)
-
net9.0
- Microsoft.AspNetCore.Components (>= 9.0.13)
- Microsoft.AspNetCore.Components.Web (>= 9.0.13)
- SvgPathProperties (>= 1.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.