cytoscape / cytoscape.js

Graph theory (network) library for visualisation and analysis
https://js.cytoscape.org
MIT License
10.09k stars 1.64k forks source link

Update first-party extensions with changes to 3.0 API #1718

Closed maxkfranz closed 7 years ago

maxkfranz commented 7 years ago

There are breaking API changes in 3.0.

Test each of the first-party extensions to see if they work already (by swapping their reference of cytoscape.js to a local build of 3.0. If not, revise the calls to use the new API.

Layouts:

UIs:

mj3cheun commented 7 years ago

Do you want me to use a copy of cytoscape.js from the 3.x branch or will the unstable branch do?

maxkfranz commented 7 years ago

You can't use unstable, as it doesn't have any 3.0 breaking API changes. The 3.x branch needs to be merged onto master and unstable when 3.0 is released.

Extensions that already work OK on 3.0 can be released as a new minor release with the dependency updated to something like cytoscape: '^2.4 | ^3.0'. Small changes that can easily support both versions can do the same (e.g. event.target || event.cyTarget).

Where the extension could work on 3.0 only by breaking support for 2.x, we'll need to make the changes in a cytoscape3 branch. The branch can be merged in for each of those extensions after 3.0 is officially released.

Probably most extensions will need little or no changes to work with 3.0

maxkfranz commented 7 years ago

@mj3cheun We also should document the cytoscape.use( require('some-extension') ) style in the extensions that are updated to work with 3.0

mj3cheun commented 7 years ago

@maxkfranz I have updated arbor and cola, you may want to have a look to see if I am doing it correctly. If I am, I will continue to update the rest of the dependencies.

maxkfranz commented 7 years ago

@mj3cheun OK, added some comments. Looks pretty good so far

mj3cheun commented 7 years ago

@maxkfranz Also found that for 3.x after calling the layout function, you need to add a .run() in order to make the layout function actually work. In 2.x, this appears to be done for you so .run() is not required. Is this intentional? See https://github.com/cytoscape/cytoscape.js-automove/commit/b7972e0db1c5fff6d13426edb485fca27a4205bc for example. This is a breaking change and applies to all the built-in layouts (eg. circle etc.).

Otherwise I am done with all the extensions, which are all backwards compatible.