cytoscape.js
cytoscape.js copied to clipboard
Cytoscape v4 -- planning for breaking API changes
Brainstorming of improvements that would cause breaking changes for a potential, future v4:
Modernising:
- [ ] Add support for ESM bundles referenced by
package.json. This breaks support for CJS code that is bundled by Webpack. See alsoexports(e.g. is-promise). - [ ] Remove internal polyfills. If you want to support old browsers that are missing these objects, use a polyfill like core-js. Note which objects in the stdlib need polyfilling:
Promise,Set,Map, etc. - [ ] Use browser-friendly module links #2661
- [ ] Use Rust/WASM for increased performance (e.g. threading) #2799
- [ ] Use WebGL #2798
Improving formatting & naming:
- [ ]
ele.json()returnsclassesas an array - [ ] Make percent values be specified on [0, 1] when no units are specified, e.g.
0.5is the same as50%. In v3, if you specify0.5, you will get0.5%. - [ ] Make the
{ nodes: [], edges: [] }elements JSON format no longer the default forcy.json()export. Instead use, the plain array format. - [ ] Rename the
coreselector tocy, by default. Thecorevalue should still work, but it won't be returned bycy.json().
Improved defaults:
- Set the default
<position>-arrow-widthvalue tomatch-line(previously1px) (#3194 #3191)
Removing deprecated features & other mistakes:
- [ ] Remove
cy.forceRender(). Deprecated long ago. - [ ] Remove
ele.renderedStyle()(Deprecated in #2223) - [ ] Remove
cy.batchData(). Deprecated long ago. - [ ] Don't set
concentricscratch values when running the concentric layout. The programmer can store values themselves. - [ ] Remove support for event namespaces. It's not all that useful and it adds complexity.
- [ ] Remove non-JSON style formats and revise
cy.style()to only be a JSON setter. Ref: https://github.com/cytoscape/cytoscape.js/issues/2637#issuecomment-600734097 - [ ] Remove
width: labelandheight: label. Ref. #2713
Moving features to external extensions or libraries:
- [ ] Remove
cosefrom the core bundle and make it an external extension. The force-directed layout that a programmer should choose by default isfcose. - [ ] Remove
selectionType: 'additive'from the core lib and turn it into an extension
ele.json() returns classes as an array
Does this mean that it would include classes as well as other data?
Is there any way currently to get the list of classes an element has?
Does this mean that it would include classes as well as other data?
classes: ['foo', 'bar'] versus classes: 'foo bar'
Is there any way currently to get the list of classes an element has?
ele.json().classes
Since a class is a concept in Javascript now, maybe it's better to use classNames? Ecosystem seems to be standardising on this.
Yes, but that wouldn't have to be a breaking (v4) change. The old key could still be supported.
Edit: We may want to use ele.classNames() with the ideal signature in v3 and then in v4 make a breaking change so that ele.classes() matches ele.classNames(). See #2110
This issue is for discussing v4 API -- i.e. breaking API changes. If you have a general feature in mind that is additive w.r.t. API, then feel free to make an ordinary feature request and the corresponding pull request.