Hi all (including but not limited to @junsikshim @coclav @jgadsden)!
Not sure I'll be able to work on this for the next few weeks but have managed to make a reasonable amount of progress - here's a quick status current status in case anyone has any feedback/would like to continue working on it:
I've nearly finished converting all the main stuff to TypeScript, aside from a few files (e.g. the shapes are mostly done, whereas the layout ones I've started but need more type info filled in). The changes are merged to https://github.com/maxGraph/maxGraph/tree/mcyph-graph-refactor
The plan to introduce tree-shaking we discussed I think still remains both the most risky and potentially lucrative part of this. This has involved trying to separate all the mxGraph
classes into different Graph*
files (e.g. snap/GraphSnap.ts
etc) then making all the classes refer to each other via namespaces (e.g. this.graph.snap.(method)
), though this is likely a temporary thing until we can come up with a plugin/object-based configurable system or similar.
I can vaguely foresee using the graph something like the below mock code, based on charting libraries like Apache eCharts:
import { Graph } from "maxgraph/view"; import { Rubberband } from "maxgraph/view/rubberband"; const graph = new Graph({ container: (element), styles: {...}, plugins: [ new Rubberband({...rubberband options}), ], }); graph.addVertex(new RectangleShape({...styles}); ...
The reason why I think providing actual references to the modules in the plugins could be a good idea rather than strings is because explicitly importing would make tree-shaking and parameter checking with TypeScript possible.
This is only preliminary though and would definitely like to know what other alternatives are and their pros/cons before we come to a conclusion!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4