{{ message }}
feat!: improve tree-shaking by isolating SelectionCellsHandler dependencies#823
Draft
tbouffard wants to merge 27 commits into
Draft
feat!: improve tree-shaking by isolating SelectionCellsHandler dependencies#823tbouffard wants to merge 27 commits into
tbouffard wants to merge 27 commits into
Conversation
|
…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
tbouffard
commented
Jul 31, 2025
| EdgeStyleHandlerKind, | ||
| EdgeHandlerFactoryFunction | ||
| >([ | ||
| ['default', (state: CellState) => new EdgeHandler(state)], |
Member
Author
There was a problem hiding this comment.
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'; |
Member
Author
There was a problem hiding this comment.
nitpick: revert removal of the type directive.
We only manage types here!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




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