feat!: improve tree-shaking of `EdgeStyle` by tbouffard · Pull Request #791 · maxGraph/maxGraph
Previously, `EdgeStyle` was a class with only static properties referring to all `EdgeStyleFunction` builtin implementations provided by maxGraph. This meant they were all included in the application even if only some values were used (i.e., only the edge styles registered in StyleRegistry). `EdgeStyle` is now a namespace, allowing all bundlers to properly tree-shake and only keep the edge styles actually used by the application. Note that currently this has limited impact on tree-shaking because most builtin implementations are referenced directly in the code, so they are still included in the application. In the future, these references will be removed to further reduce bundle size. The documentation now includes a new page explaining how to use and create `EdgeStyle` implementations. The documentation about the "perimeters" have been updated to have a consistent content with the new page. BREAKING CHANGES: `EdgeStyle` has been changed from a class with static properties to a namespace. This has minimal impact for most applications that only read edge style values. The breaking change only affects applications that modify EdgeStyle properties (add/update/remove values), which is no longer possible. Instead, create your own EdgeStyle implementation and register it.