-
Notifications
You must be signed in to change notification settings - Fork 199
feat!: improve tree-shaking by isolating SelectionCellsHandler dependencies #823
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
base: main
Are you sure you want to change the base?
feat!: improve tree-shaking by isolating SelectionCellsHandler dependencies #823
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
…encies Move handler creation logic from AbstractGraph to SelectionCellsHandler plugin where it's actually used. This prevents automatic inclusion of VertexHandler and EdgeHandler classes (~63kB) when the plugin isn't being used (for example, in applications that perform Graph visualization only, without Cell section). ADDED: - Support for registering additional edge handlers beyond the built-in ones BREAKING CHANGES: - Removed AbstractGraph.createHandler methods, now in SelectionCellsHandler - Handler customization now uses composition instead of inheritance, by using configureVertexHandler() and configureEdgeHandler() instead of extending Graph
12885b7 to
e1b84d6
Compare
| EdgeStyleHandlerKind, | ||
| EdgeHandlerFactoryFunction | ||
| >([ | ||
| ['default', (state: CellState) => new EdgeHandler(state)], |
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.
Type of parameter can be omit in the factory functions
| import type AbstractCanvas2D from './view/canvas/AbstractCanvas2D.js'; | ||
| import type Cell from './view/cell/Cell.js'; | ||
| import type CellState from './view/cell/CellState.js'; | ||
| import CellState from './view/cell/CellState.js'; |
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.
nitpick: revert removal of the type directive.
We only manage types here!
|



Move handler creation logic from AbstractGraph to SelectionCellsHandler plugin where it's actually used.
This prevents automatic inclusion of VertexHandler and EdgeHandler classes (~83kB) when the plugin isn't being used (for example, in applications that perform Graph visualization only, without Cell section).
ADDED:
BREAKING CHANGES:
configureVertexHandler() and configureEdgeHandler() instead of extending Graph
Notes
Covers #762
Impact on the size of the examples
Note: experiment in #449 had shown a potential decrease of 63-66 kB, here we see 83.5 kB!
1st measures (to be confirmed)
We see a decrease only on example "without defaults", others use the SelectionCellsHandler plugin
Additional measure: without subclasses of EdgeHandler
In the future (#890), we may provide a way to configure the EdgeHandler that are registered in the plugin to reduce the size of application that doesn't require them:
Remaining Tasks
DragSource: refactor: migrate the DragSource story to TypeScript #860FixedPoints: refactor: migrate the FixedPoints story to TypeScript #839Wires: refactor: fix most problems in the Wires story #893, also required by refactor!: move tooltip methods to TooltipHandler #640AutoLayoutContextIconsDragSourceFixedPointsHandlesOrthogonalStencilsWires