feat!: improve tree-shaking of EdgeStyle by tbouffard · Pull Request #809 · maxGraph/maxGraph

@tbouffard

Remove hard-coded EdgeStyle references throughout the codebase to enable proper tree-shaking.
Previously, all built-in EdgeStyle implementations were always included in application bundles.
Now, only registered EdgeStyle implementations are bundled, reducing application size by up to 17kB when no EdgeStyles are used.

This is implemented by:
- Creating a dedicated EdgeStyleRegistry to register EdgeStyle with metadata
- Introducing PerimeterRegistry to manage Perimeter registrations separately
- Removing StyleRegistry which previously handled both concerns

Additional improvements:
- Add dedicated unregister functions for each registry type, allowing independent management of EdgeStyle and Perimeter registrations
- Create BaseRegistry to share common functionality between all style registries

BREAKING CHANGES: `StyleRegistry` has been removed. Use `EdgeStyleRegistry` and `PerimeterRegistry` instead.
The methods of the new registries are also named differently.

coderabbitai[bot]

@tbouffard

@tbouffard

No longer tries to do it with object in GraphViewCodec.
The related registries only hold function.
In addition, the logic was wrong. It should have been a OR instead of a AND when checking for 'function' and 'object'.

@tbouffard

@tbouffard

coderabbitai[bot]

@tbouffard

@tbouffard

@tbouffard tbouffard deleted the feat/introduce_EdgeStyleRegistry branch

May 6, 2025 08:16