-
-
Notifications
You must be signed in to change notification settings - Fork 49
Unify installation flow (Angular CLI + Nx) and improve canvas rendering performance #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify installation flow (Angular CLI + Nx) and improve canvas rendering performance #244
Conversation
…tions - add grouped selectors ([fNodes], [fConnections], [fGroups]) to support consecutive @for/@if blocks - unify and simplify ng-content matching logic - keep specific selectors before grouped ones to preserve slot projection priority
…ve zoom performance - reduce redundant connection redraw operations and path recalculations - fix macos safari issue where connection path could render incompletely - improve zoom rendering performance by reducing layout thrashing and recalculation frequency
- added `add` schematic alias so Nx users can run `nx g @foblex/flow:add` - ensured `ng add @foblex/flow` continues to work without requiring Nx - no runtime changes, only install/usage improvements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR unifies the installation flow for both Angular CLI and Nx workspaces by adding an "add" schematic alias, improves canvas rendering performance by optimizing connection path calculations and zoom behavior, and enhances content projection to better support Angular's control flow syntax.
Key changes:
- Added
addschematic alias enabling Nx users to install vianx g @foblex/flow:add - Optimized connection and zoom rendering by reducing layout thrashing and unnecessary recalculations
- Updated content projection slots to support
@forand@ifcontrol flow blocks
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/f-flow/schematics/collection.json | Added "add" schematic alias for Nx compatibility |
| projects/f-flow/package.json | Version bump to 17.9.5 |
| projects/f-flow/src/f-canvas/f-canvas.component.html | Enhanced ng-content selectors with group selectors for control flow support |
| projects/f-flow/src/f-flow/f-flow.component.scss | Changed connection positioning from fixed to absolute and added z-index layering |
| projects/f-flow/src/f-connection/f-connection/f-connection.component.scss | Moved position styling to SVG element with !important overflow rule |
| projects/f-flow/src/f-connection/common/f-connection-base.ts | Made fTextComponent optional to prevent errors when text is absent |
| projects/f-flow/src/f-zoom/f-zoom.directive.ts | Refactored to use signals and direct event listeners instead of Renderer2 |
| projects/f-flow/src/f-draggable/f-draggable-base.ts | Moved to direct event listeners, removed NgZone dependency injection |
| projects/f-flow/src/drag-toolkit/drag-and-drop-base.ts | Injected dependencies directly, removed ICanRunOutsideAngular interface |
| projects/f-flow/src/drag-toolkit/event.extensions.ts | Improved type safety and code consistency |
| projects/f-pro-examples/tournament-bracket/* | Updated to use new control flow syntax and group selectors |
| projects/f-examples/nodes/stress-test/* | Added connection toggle feature for performance testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This MR introduces a unified installation mechanism that works seamlessly in both Angular CLI and Nx workspaces without requiring Nx as a dependency, and includes several performance improvements related to node/connection rendering and zoom inside f-canvas.
⸻
Changes
🛠 Installation / Tooling
• Added add schematic alias so the library can now be installed in Nx as well:
• Angular CLI: ng add @foblex/flow
• Nx: nx g @foblex/flow:add
• No @nx/devkit dependency added — the library remains framework-agnostic
• Existing schema structure remains fully backward-compatible
🎛 Content Projection (Slots)
• Unified and simplified ng-content slot selectors
• Introduced group selectors ([fNodes], [fConnections]) to correctly handle nested control flow blocks (@for, @if)
• Ensured correct projection without element loss when using the new Angular control flow syntax
⚡ Performance Improvements
• Connection rendering optimized to reduce unnecessary path recalculations
• Zoom performance improved by minimizing layout thrashing and reducing redraw frequency
• Less jitter and better stability when dragging or rearranging nodes
🧩 Browser Compatibility Fixes
• Fixed Safari (macOS) rendering issue where connection paths were occasionally clipped / not fully drawn
⸻
Result
• Smooth installation experience in both Angular CLI and Nx workspaces
• More stable and efficient rendering pipeline
• Improved zoom + drag experience
• Reliable behavior across Chrome / Firefox / Safari
⸻
Testing Notes
• Verified in Angular CLI projects (18.x)
• Verified in Nx workspaces (18.x)
• Tested in Safari, Chrome, and Firefox
• Stress-tested node dragging and zooming performance