npm run unpack-library-files
Migrating to 2.5 from 2.4
Changes in the library files
The libraries are provided as tgz files
The yFiles libraries are provided as tgz files. They now can be used directly without running the setup script.
Developers who have used the library js files directly instead of the npm modules now have to unpack the library
files. To do so, please switch to the folder /tools/unpack-library-files/ folder and execute the npm task
unpack-library-files:
Alternatively, you can unpack the tgz file manually and rename the resulting folder package to es-modules or umd.
The tgz files are now located in the lib and lib-dev folders
The npm package files are now located in the lib and lib-dev folders:
-
lib/yfiles-<version>.tgz -
lib-dev/yfiles-<version>+dev.tgz -
lib/yfiles-umd-<version>.tgz -
lib-dev/yfiles-umd-<version>+dev.tgz
Before, they were located in the es-modules and umd sub folders. The path to yFiles has to be adjusted
in the dependencies in the package.json files.
The yFiles npm package files now use the correct semver syntax for their versions
Developers who use the yFiles development library should note that the 'dev' suffix is appended with a + now.
The library has now to be referenced as yfiles-<version>+dev.tgz.
One TypeScript definition file for both VS Code and WebStorm
The TypeScript definition files can now be used in both WebStorm and VS Code. There is no need to use the
npm-module-vscode script anymore.
Clickable Handles and Handle Behavior
The IHandle interface has a new method handleClick. This method must be
implemented by custom handle implementations.
When starting to drag the handle of a selected item, the handle is not replaced anymore by a new
handle instance provided for the selected item. Previously, this happened automatically, regardless of whether
necessary to support use cases where state changes should result in a different handle instance. Now,
GraphEditorInputMode's requeryHandles method has to be called explicitly when changes are made that
affect handles that are potentially already visible. Alternatively, a proxy implementation can be used that
dynamically dispatches to new instances on its own when required.
The HandleInputMode class does not initialize a handle drag as soon as the handle is
pressed, anymore. Instead, it waits until the draggedRecognizer or
draggedRecognizerTouch is triggered. When pressed, the mutex is already acquired,
which discards other concurrent input modes. This can be turned off by setting the
requestMutexOnPress property to false.
ModelManagers must be installed now
Due to the new install and uninstall methods of the ModelManager
class, the following of its members have been changed:
-
The
CanvasComponentconstructor parameter has been removed. Instead, you can call the newinstallmethod with theCanvasComponentas parameter. Similarly, theCanvasComponentconstructor parameters of the derived classes have been removed, too. -
Its existing protected methods
installanduninstallhave been renamed toinstallItemanduninstallItem. -
Its protected methods
addandremovehave been renamed toaddItemandremoveItem. -
The optional
SelectionModelandModelparameters ofHighlightIndicatorManagerandSelectionIndicatorManagerhave been removed from the constructors, too. Instead, you can set the corresponding properties directly.
Setting a new model manager to GraphComponent's selectionIndicatorManager,
highlightIndicatorManager, or focusIndicatorManager properties,
will call install and set the necessary properties automatically.
Interactive node and edge creation can be asynchronous
-
The return values of
CreateEdgeInputMode'screateEdgemethod and of the function which can be set asedgeCreatorhave been changed toIEdge | Promise<IEdge|null> | null. -
The return value of the function which can be set to
GraphEditorInputMode'snodeCreatorproperty has been changed toINode | Promise<INode|null> | null.
WebGL2
-
The
WebGL2NodeEffectenum was renamed toWebGL2Effectsince it can now be used for effects of nodes, edges, and labels. -
The
createNodeEffectScaleAnimation,createNodeEffectFadeAnimation, andcreateNodeEffectPulseAnimationmethods ofWebGL2GraphModelManagerwere renamed tocreateEffect*Animation. -
The animation API of the
WebGL2GraphModelManagerwas refined to be more consistent and flexible. All animation factory methods now have atimingparameter of typeWebGL2AnimationTiming. -
In WebGL2 rendering mode, handles and selection indicators no longer adopt styling specified with CSS classes. Instead, more comprehensive styling options are available with the new
Themeclass and thestyleproperties of theWebGL2SelectionIndicatorManager,WebGL2HighlightIndicatorManager, andWebGL2FocusIndicatorManagerclasses. -
The
WebGL2GraphModelManager.getWebGL2LabelStylemethod may now also return an instance ofWebGL2IconLabelStyle(but the default implementation does not).
Other API Changes
-
The
directionparameter of theBfsAlgorithm.getLayersmethod now uses the newBfsDirectionenum instead of theTraversalDirectionenum.TraversalDirectiongot a new member that does not apply to this method, andBfsDirectionreflects the options previously available. Note that this is expert API and you typically use theBfsclass, instead. -
The
Exception.innerExceptionproperty was renamed tocauseto conform to recent additions of the ECMAScript spec. -
The
NodeLabelingPolicyenum has been moved fromyfiles.treetoyfiles.layout. The reason is that the policy is now not only supported byBalloonLayoutbut also byCircularLayout,RadialLayoutandCactusGroupLayout. -
The type of the
EdgeCellInfo.cellSegmentInfosproperty was changed fromYListtoCellSegmentInfo[]. -
HierarchicLayoutData'ssubComponentsproperty is replaced by the newsubcomponentsproperty with a different signature. The new property uses instances of the newSubcomponentDescriptorclass to define subcomponents, and the layout algorithm responsible for a component is now specified via the newSubcomponentDescriptor.layoutAlgorithmproperty. -
Similarly, the data provider keys
HierarchicLayout.SUB_COMPONENT_ID_DP_KEYandHierarchicLayout.SUB_COMPONENT_LAYOUT_ALGORITHM_DP_KEYare replaced by the new keyHierarchicLayout.SUBCOMPONENT_DESCRIPTOR_DP_KEYthat assigns instances of the newSubcomponentDescriptorclass to nodes. -
The data provider key
TemporaryGroupNodeInsertionStage.COMPONENT_LAYOUT_ALGORITHM_DP_KEYwas removed and the name of the keyTemporaryGroupNodeInsertionStage.COMPONENT_ID_DP_KEYwas changed toTEMPORARY_GROUP_DESCRIPTOR_DP_KEY. The newly addedTemporaryGroupDescriptorclass now specifies groups and the applied recursive group layout algorithm. -
The property
componentsof classTemporaryGroupNodeInsertionDatahas been renamed totemporaryGroups. Also, its value type has been changed toTemporaryGroupDescriptor. -
The protected
ImageNodeStyleRenderer.getPreserveAspectRatiomethod has been removed in favor of the newImageNodeStyle.aspectRatioproperty. -
The
NavigationInputMode.adjustGroupNodeLocationmethod has now an additional parameterexpandedSizethat specifies the size of the group node when it is expanded. -
ILookup'slookupmethod is now generic and infers its return type from the given parameter. TypeScript implementations must be adapted accordingly. Nothing changes for JavaScript. -
The
Fill.freeze,Stroke.freeze,DashStyle.freeze, andGradientStop.freezemethods now return their respective containing type. -
The
License.valueproperty has now the more specific typeRecord<string, unknown>instead ofobject. -
The
nodeparameter ofIGraph'ssetIsGroupNodemethod is now correctly annotated as not-null. The documentation already stated that this method throws an error if the node isnull.
Changes of Default Behavior
-
The semantics of
TraversalDirection'sBOTHenum value used by theNeighborhoodandBfsalgorithms has been changed and does not ignore the direction anymore, but now returns a union of thesuccessorand thepredecessorresults instead. The old behavior can be restored by using the newUNDIRECTEDenum value. Consequently, the default values of thetraversalDirectionproperties of both theNeighborhoodand theBfsalgorithms have been changed fromBOTHtoUNDIRECTED. -
Formatting text with the
WORD_ELLIPSISoption still wraps at word boundaries, but now trims character by character to better match the CSStext-overflowbehavior and make more efficient use of the remaining space. -
The lists returned by methods
GraphPartition.getCells,DynamicObstacleDecomposition.getCellsandDynamicObstacleDecomposition.getObstaclesare no longer unmodifiable. -
With the graph builder classes, label bindings which do not provide label data (or provide
null) no longer add empty labels. Instead, no label will be added. Similarly, for label sources, no label will be added for data items for which theLabelCreator.textProviderreturnsnull. This involves the following API changes:-
The
LabelCreator.addLabelmethod can returnnullif no label is added. -
The
LabelCreator.updateLabelmethod now returns a boolean value:trueif the label has been updated,falseif the label should be removed.
-
Removed unused methods and properties
The following methods and properties have been removed since they had no effect. Usages of them can be safely removed:
DataProviderAdapter.defined, GraphEditorInputMode.shouldClickCreateNode,
NodeAggregation.multiThreadingAllowed, and NodeAggregationAlgorithm.multiThreadingAllowed.
Deprecations
-
The styles
BevelNodeStyle,ShinyPlateNodeStyle, andPanelNodeStyleclasses and their renderers are now deprecated. Their appearance is rather outdated, and some of them are not very configurable. For group nodes, have a look at the newGroupNodeStyleclass. -
IEnumerable'sfirstOrDefaultandlastOrDefaultmethods are now marked as deprecated since they duplicate thefindandfindLastmethods, and the latter had the same name as the corresponding methods of the native JavaScriptArray.