@jsplumb/community v4.0.0-RC47
jsPlumb
This is version 4.x alpha. It is a rewrite of the original jsPlumb in Typescript, and is currently a work in progress. Use this version in production at your own risk.
It would be very helpful if existing users of jsPlumb could test this alpha version. There are a number of breaking backwards changes to be mindful of, though:
Breaking changes
Methods
- The - emptymethod was removed from- JsPlumbInstance.
- The - deleteEveryEndpointmethod was removed from- JsPlumbInstance. Functionally, it was identical to- reset. Use- reset.
- addEndpointdoes not support a list of elements as the first argument - only a single DOM element is supported.
- makeSourcedoes not support a list of elements as the first argument - only a single DOM element is supported.
- makeTargetdoes not support a list of elements as the first argument - only a single DOM element is supported.
- getWidthand- getHeightmethods removed from- JsPlumbInstance. All they did was return the- offsetWidthand- offsetHeightof an element.
- updateClassesmethod removed from- JsPlumbInstance. It was an attempt at keeping reflows to a minimum but was used only in one method internally, which is a method that was very rarely called.
- setClassmethod removed from- JsPlumbInstance. This brings- JsPlumbInstanceinto line with the way the DOM works:- classListoffers methods to add/remove/toggle classes, but not to set one particular class.
- jsPlumbUtilis no longer a static member on the window. Some of its more useful methods for users of the library have been exposed elsewhere:- The - uuidmethod, which we use a lot in our demos, and internally, is now exposed on the- JsPlumbInstanceclass and on the global- jsPlumbobject
- The - extendmethod is now exposed on the- JsPlumbInstanceclass and on the global- jsPlumbobject
- The - consumemethod is exposed on the- BrowserJsPlumbInstanceclass (which is currently the only concrete instance of- JsPlumbInstanceand the class you will get from a- jsPlumb.newInstance(..)call).
 
- setIdno longer supports an array-like argument. You must now pass in a single id, or element.
- appendToRootmethod removed. If you're using this, use- document.body.appendChild(..)instead.
- The - droppablemethod was removed. It was not used internally by any of the other code in either the Community or Toolkit editions, and had no accompanying tests. A question was raised on Github about it and the OP ended up saying they'd just used native droppable stuff to achieve what they needed. If you feel- droppableshould be reinstated, we can chat about it in this issue.
Configuration
- All defaults converted to camelCase instead of having a leading capital, eg. "Anchors" -> "anchors", "ConnectionsDetachable" -> "connectionsDetachable". This brings the defaults into line with the parameters used in method calls like - connectand- addEndpointetc.
- It is imperative that you provide the - containerfor an instance of jsPlumb. We no longer infer the container from the- offsetParentof the first element to which an Endpoint is added. If you do not provide- containeran Error is thrown.
- connector-pointer-eventsnot supported on Endpoint definitions. Use- cssClassand CSS tricks.
- labelStyleis no longer supported. Use- cssClassand CSS tricks.
- The - LogEnabledand- DoNotThrowErrorsdefaults have been removed.
- Paint styles for connectors dont support gradients anymore. You can use CSS for this. 
- Removed - overlaysdefault. Use- connectionOverlaysor- endpointOverlaysnow: not all overlay types are supported by Endpoints, so having a common set of overlays doesnt make sense.
- The - radiusoption is not supported on- PaintStyleany longer. More generally, type specific values are not supported -- radiusonly pertains to- Dotendpoints, for instance.- widthand- heightfrom the Rectangle endpoint are also instance of this. Put type specific values on the endpoint spec itself, eg- endpoint:['Dot', { radius:10 }].
CSS classes
- The - jtk-endpoint-anchorcss class is not added to endpoints when the associated anchor did not declare a class. It is still used when the anchor has declared a class (eg- jtk-endpoint-anchor-foo), but otherwise it is not added. Without the anchor's class suffix- jtk-endpoint-anchorwas just a shadow of- jtk-endpoint- use- jtk-endpointinstead.
- Managed elements do not have the - jtk-managedclass applied. They now have a- jtk-managedattribute set on them. It is unlikely anyone was using this class but we include it here for completeness.
- Elements configured via - makeTargetdo not get assigned a- jtk-droppablecss class now. Instead, they are given a- jtk-targetattribute, as well as a- jtk-scope-**attribute for every scope that is assigned.
Events
- The - manageElementand- unmanageElementevents are no longer fired by the- JsPlumbInstanceclass. These were undocumented anyway, but we're calling it out in case you have code that used them.
- Added - drag:start,- drag:moveand- drag:stopevents. These replace the- start,- dragand- stopevent handlers that used to be supported on individual- draggable(..)method calls.
- Binding to - mouseoverand- mouseouton Endpoints and Connections is not supported. You now should bind to these events on a jsplumb instance instead:- endpointMouseOver
- endpointMouseOut
- connectionMouseOver
- connectionMouseOut 
 
Behaviour
- By default, every node is draggable. - .draggable(someElement)no longer exists. You can make an element not draggable by setting a- jtk-not-draggableattribute on it. It doesn't matter what the value of the attribute is, just its presence is all that is required.
- It is not possible to subclass Connection or Endpoint to provide your own implementations in 4.x. 
- There is no - Imageendpoint in 4.x. You can achieve this via a 'Blank' endpoint with a css class. Or if you find you cannot and you can't think of any alternative, we could possibly add a- Customendpoint type, with which you could achieve this.
New Functionality
- elementsDraggableadded to- Defaults, with a default value of true.
- Added - drag:start,- drag:moveand- drag:stopevents to the- JsPlumbInstanceclass. These replace the- start,- dragand- stopevent handlers that used to be supported on individual- draggable(..)method calls.
- The - Mottlelibrary, which used to be a separate project, has now been incorporated into jsPlumb. For convenience, we have exposed- Mottleon the browser window, as some people do use standalone instances of Mottle from time to time.
- The - Katavoriolibrary, which used to be a separate project, has now been incorporated into jsPlumb. At present there is nothing exposed on the window as we did with Mottle, but there could be.
Imports
<script src="../../dist/js/jsplumb.js"></script>Reporting issues
If you find any issues, please report them using the 4.x-alpha tag on Github.
Introduction
If you're new to jsPlumb, please do take the time to read the documentation. There are a few integration issues that you should be aware of: z-index needs special attention, for example.
This project is the 'Community Edition' of jsPlumb. The 'Toolkit Edition' is a commercially-licensed wrapper around this.
This project is not the correct place to report issues for the Toolkit edition. The Toolkit is not a public project. Issues reported for the Toolkit edition in this issue tracker will be deleted.
Documentation
For the Community edition the documentation can now be found here:
https://docs.jsplumbtoolkit.com/community/current/index.html
Installation
npm install @jsplumb/communityNOTE: jsPlumb does not follow strict semantic versioning.  It is not at all recommended that you use wildcards when specifying a dependency on jsPlumb.  The given command will install jsPlumb version using a caret for wildcard, eg ^2.9.0 - you might want to take off the caret.
jsPlumb does not follow strict semantic versioning largely because of the stipulation that breaking changes must result in the major version being bumped. A major version implies something fundamental has occurred. The bump from 1.7.10 to 2.0.0 in jsPlumb was caused by the removal of the VML renderer, meaning IE6 and IE8 were no longer supported. You may say, a-ha! A breaking change! And you would be right; that was a breaking change. But a new major version might also occur when a new capability is added that doesn't affect existing functionality. And not every breaking change constitutes a fundamental change in the library itself. This note about semver was added to jsPlumb, for example, due to a discussion about how the stop event behaviour in the underlying drag library - Katavorio - had changed. Semver would say that the major version should have been bumped. But the change was not something fundamental. No capabilities had been added or removed...just some variables had been shuffled around.
Maybe you agree with this viewpoint. Maybe you don't.
We recommend including the jsplumbtoolkit.css file to begin with, as it provides some sane default values.
Issues
jsPlumb uses GitHub's issue tracker for enhancements and bugs. A losing battle was fought against the usage of Github for questions; now it seems to be the default, and the Google group is no longer in use.
Requirements
No external dependencies.
jsPlumb in action
Links to various Community Edition demonstrations can be found here.
Tests
There is a full suite of unit tests checked in to the test and dist/test directories.
Please don't.
Mailing List
Sign up for the jsPlumb announcements mailing list here.
License
All 1.x.x, 2.x.x and 4.x.x versions of jsPlumb Community edition are dual-licensed under both MIT and GPLv2.
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago