@joint/core 4.2.2 → 4.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +2 -2
  2. package/dist/geometry.js +1 -1
  3. package/dist/geometry.min.js +1 -1
  4. package/dist/joint.d.ts +4 -3
  5. package/dist/joint.js +133 -89
  6. package/dist/joint.min.js +2 -2
  7. package/dist/joint.nowrap.js +133 -89
  8. package/dist/joint.nowrap.min.js +2 -2
  9. package/dist/vectorizer.js +26 -4
  10. package/dist/vectorizer.min.js +2 -2
  11. package/dist/version.mjs +1 -1
  12. package/package.json +6 -14
  13. package/src/V/transform.mjs +25 -3
  14. package/src/cellTools/Button.mjs +3 -1
  15. package/src/cellTools/Control.mjs +1 -1
  16. package/src/connectionPoints/index.mjs +1 -1
  17. package/src/connectors/curve.mjs +2 -4
  18. package/src/dia/Cell.mjs +5 -6
  19. package/src/dia/Graph.mjs +13 -13
  20. package/src/dia/GraphLayerCollection.mjs +2 -3
  21. package/src/dia/HighlighterView.mjs +5 -5
  22. package/src/dia/LayerView.mjs +1 -1
  23. package/src/dia/LinkView.mjs +1 -1
  24. package/src/dia/Paper.mjs +25 -15
  25. package/src/dia/attributes/eval.mjs +1 -1
  26. package/src/dia/ports.mjs +2 -2
  27. package/src/elementTools/HoverConnect.mjs +4 -3
  28. package/src/layout/ports/port.mjs +1 -1
  29. package/src/linkTools/RotateLabel.mjs +2 -1
  30. package/src/linkTools/Segments.mjs +1 -1
  31. package/src/mvc/Dom/Dom.mjs +2 -2
  32. package/src/mvc/Dom/animations.mjs +2 -6
  33. package/src/mvc/Dom/methods.mjs +3 -3
  34. package/src/mvc/Dom/props.mjs +1 -1
  35. package/src/mvc/Listener.mjs +1 -0
  36. package/src/mvc/Model.mjs +3 -1
  37. package/src/routers/rightAngle.mjs +9 -9
  38. package/src/util/calc.mjs +1 -1
  39. package/src/util/util.mjs +2 -4
  40. package/src/util/utilHelpers.mjs +5 -5
  41. package/types/joint.d.ts +5 -4
  42. package/types/vectorizer.d.ts +1 -1
package/dist/joint.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.2.2 (2025-12-16) - JavaScript diagramming library
1
+ /*! JointJS v4.2.4 (2026-02-13) - JavaScript diagramming library
2
2
 
3
3
  This Source Code Form is subject to the terms of the Mozilla Public
4
4
  License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7208,7 +7208,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7208
7208
  };
7209
7209
  const initCloneArray = array => {
7210
7210
  const length = array.length;
7211
- let result = new array.constructor(length);
7211
+ const result = new array.constructor(length);
7212
7212
  if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
7213
7213
  result.index = array.index;
7214
7214
  result.input = array.input;
@@ -7386,13 +7386,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7386
7386
  return baseIsEqualDeep(value, other, baseIsEqual, stack);
7387
7387
  };
7388
7388
  const baseIsEqualDeep = (object, other, equalFunc, stack) => {
7389
- let objIsArr = Array.isArray(object);
7389
+ const objIsArr = Array.isArray(object);
7390
7390
  const othIsArr = Array.isArray(other);
7391
7391
  let objTag = objIsArr ? arrayTag : getTag(object);
7392
7392
  let othTag = othIsArr ? arrayTag : getTag(other);
7393
7393
  objTag = objTag == argsTag ? objectTag : objTag;
7394
7394
  othTag = othTag == argsTag ? objectTag : othTag;
7395
- let objIsObj = objTag == objectTag;
7395
+ const objIsObj = objTag == objectTag;
7396
7396
  const othIsObj = othTag == objectTag;
7397
7397
  const isSameTag = objTag == othTag;
7398
7398
  if (isSameTag && !objIsObj) {
@@ -7527,7 +7527,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7527
7527
  };
7528
7528
  const mapToArray = map => {
7529
7529
  let index = -1;
7530
- let result = Array(map.size);
7530
+ const result = Array(map.size);
7531
7531
  map.forEach((value, key) => {
7532
7532
  result[++index] = [key, value];
7533
7533
  });
@@ -7637,7 +7637,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7637
7637
  isCommon = false;
7638
7638
  values = new SetCache(values);
7639
7639
  }
7640
- outer: for (let key in array) {
7640
+ outer: for (const key in array) {
7641
7641
  let value = array[key];
7642
7642
  const computed = value;
7643
7643
  value = value !== 0 ? value : 0;
@@ -9051,7 +9051,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
9051
9051
  // User data storage
9052
9052
  $.data = dataUser;
9053
9053
  $.merge = function (first, second) {
9054
- let len = +second.length;
9054
+ const len = +second.length;
9055
9055
  let i = first.length;
9056
9056
  for (let j = 0; j < len; j++) {
9057
9057
  first[i++] = second[j];
@@ -9219,7 +9219,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
9219
9219
  data = data || selector;
9220
9220
  selector = undefined;
9221
9221
  }
9222
- for (let type in types) {
9222
+ for (const type in types) {
9223
9223
  $.event.on(elem, type, selector, data, types[type], one);
9224
9224
  }
9225
9225
  return elem;
@@ -9712,6 +9712,25 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
9712
9712
  return `matrix(${a},${b},${c},${d},${e},${f})`;
9713
9713
  }
9714
9714
 
9715
+ /**
9716
+ * @param {SVGElement} node
9717
+ * @returns {SVGSVGElement|null}
9718
+ * @description Returns the root SVG element for the given node,
9719
+ * walking up through nested SVG elements.
9720
+ * Returns `null` if the node is not part of an SVG document.
9721
+ */
9722
+ function getRootSVG(node) {
9723
+ let svg = node.ownerSVGElement;
9724
+ if (!svg) {
9725
+ // The node itself may be an <svg> element
9726
+ return node instanceof SVGSVGElement ? node : null;
9727
+ }
9728
+ while (svg.ownerSVGElement) {
9729
+ svg = svg.ownerSVGElement;
9730
+ }
9731
+ return svg;
9732
+ }
9733
+
9715
9734
  /**
9716
9735
  *
9717
9736
  * @param {SVGElement} a
@@ -9722,9 +9741,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
9722
9741
  * in order to calculate the correct transformation matrix.
9723
9742
  */
9724
9743
  function getRelativeTransformation(a, b) {
9725
- // Different SVG elements, no transformation possible
9726
- // Note: SVGSVGElement has no `ownerSVGElement`
9727
- if ((a.ownerSVGElement || a) !== (b.ownerSVGElement || b)) return null;
9744
+ // Elements must be part of an SVG document
9745
+ const rootA = getRootSVG(a);
9746
+ const rootB = getRootSVG(b);
9747
+ if (!rootA || !rootB) return null;
9748
+ // Different SVG documents, no transformation possible
9749
+ if (rootA !== rootB) return null;
9728
9750
  // Get the transformation matrix from `a` to `b`.
9729
9751
  const am = b.getScreenCTM();
9730
9752
  if (!am) return null;
@@ -12068,7 +12090,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12068
12090
  } else {
12069
12091
  styles = name;
12070
12092
  }
12071
- for (let style in styles) {
12093
+ for (const style in styles) {
12072
12094
  if (styles.hasOwnProperty(style)) {
12073
12095
  for (let i = 0; i < this.length; i++) {
12074
12096
  setCSSProperty(this[i], style, styles[style]);
@@ -12174,7 +12196,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12174
12196
  }
12175
12197
  if (typeof types === 'object') {
12176
12198
  // ( types-object [, selector] )
12177
- for (let type in types) {
12199
+ for (const type in types) {
12178
12200
  this.off(type, selector, types[type]);
12179
12201
  }
12180
12202
  return this;
@@ -12218,7 +12240,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12218
12240
  function position() {
12219
12241
  const [el] = this;
12220
12242
  if (!el) return;
12221
- let $el = $(el);
12243
+ const $el = $(el);
12222
12244
  let offsetParent;
12223
12245
  let offset;
12224
12246
  let doc;
@@ -12337,8 +12359,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12337
12359
  function animateNode(el, properties, opt = {}) {
12338
12360
  let {
12339
12361
  duration = 400,
12362
+ delay = 0
12363
+ } = opt;
12364
+ const {
12340
12365
  easing = 'ease-in-out',
12341
- delay = 0,
12342
12366
  complete
12343
12367
  } = opt;
12344
12368
  const delayId = setTimeout(function () {
@@ -12474,7 +12498,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12474
12498
  } else {
12475
12499
  attributes = name;
12476
12500
  }
12477
- for (let attr in attributes) {
12501
+ for (const attr in attributes) {
12478
12502
  if (attributes.hasOwnProperty(attr)) {
12479
12503
  const value = attributes[attr];
12480
12504
  if (propertiesMap[attr]) {
@@ -12628,11 +12652,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12628
12652
  // TagName
12629
12653
  if (!nodeDef.hasOwnProperty('tagName')) throw new Error('json-dom-parser: missing tagName');
12630
12654
  const tagName = nodeDef.tagName;
12631
- let node;
12632
12655
 
12633
12656
  // Namespace URI
12634
12657
  const ns = nodeDef.hasOwnProperty('namespaceURI') ? nodeDef.namespaceURI : parentNS;
12635
- node = document.createElementNS(ns, tagName);
12658
+ const node = document.createElementNS(ns, tagName);
12636
12659
  const svg = ns === svgNamespace;
12637
12660
  const wrapperNode = svg ? V(node) : $(node);
12638
12661
  // Attributes
@@ -12813,7 +12836,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12813
12836
  // If the event is a touch event, normalize it to a mouse event.
12814
12837
  const touch = originalEvent && originalEvent.changedTouches && originalEvent.changedTouches[0];
12815
12838
  if (touch) {
12816
- for (let property in touch) {
12839
+ for (const property in touch) {
12817
12840
  // copy all the properties from the first touch that are not
12818
12841
  // defined on TouchEvent (clientX, clientY, pageX, pageY, screenX, screenY, identifier, ...)
12819
12842
  if (evt[property] === undefined) {
@@ -14546,7 +14569,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
14546
14569
  if (this.idAttribute in attrs) {
14547
14570
  var prevId = this.id;
14548
14571
  this.id = this.get(this.idAttribute);
14549
- this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
14572
+ if (this.id !== prevId) {
14573
+ this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
14574
+ }
14550
14575
  }
14551
14576
 
14552
14577
  // Trigger all relevant attribute changes.
@@ -14980,7 +15005,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
14980
15005
  let value = expression;
14981
15006
  let startSearchIndex = 0;
14982
15007
  do {
14983
- let calcIndex = value.indexOf(calcStart, startSearchIndex);
15008
+ const calcIndex = value.indexOf(calcStart, startSearchIndex);
14984
15009
  if (calcIndex === -1) return value;
14985
15010
  let calcEndIndex = calcIndex + calcStartOffset;
14986
15011
  let brackets = 1;
@@ -15643,7 +15668,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
15643
15668
  return finalAttributes;
15644
15669
  }
15645
15670
  let defaultAttributes = {};
15646
- let attributes = cloneDeep(this.attributes);
15671
+ const attributes = cloneDeep(this.attributes);
15647
15672
  if (ignoreDefaults === true) {
15648
15673
  // Compare all attributes with the defaults
15649
15674
  defaultAttributes = defaults;
@@ -16198,8 +16223,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
16198
16223
  const {
16199
16224
  _scheduledTransitionIds
16200
16225
  } = this;
16201
- let initialId;
16202
- var initiator = callback => {
16226
+ const initiator = callback => {
16203
16227
  if (_scheduledTransitionIds[transitionKey]) {
16204
16228
  _scheduledTransitionIds[transitionKey] = without(_scheduledTransitionIds[transitionKey], initialId);
16205
16229
  if (_scheduledTransitionIds[transitionKey].length === 0) {
@@ -16211,7 +16235,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
16211
16235
  this._transitionIds[transitionKey] = nextFrame(callback);
16212
16236
  this.trigger('transition:start', this, transitionKey);
16213
16237
  };
16214
- initialId = setTimeout(initiator, opt.delay, setter);
16238
+ const initialId = setTimeout(initiator, opt.delay, setter);
16215
16239
  _scheduledTransitionIds[transitionKey] || (_scheduledTransitionIds[transitionKey] = []);
16216
16240
  _scheduledTransitionIds[transitionKey].push(initialId);
16217
16241
  return initialId;
@@ -16386,11 +16410,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
16386
16410
  }, protoProps);
16387
16411
  var Cell = this.extend(protoProps, staticProps);
16388
16412
  // es5 backward compatibility
16389
- /* eslint-disable no-undef */
16413
+ // eslint-disable-next-line no-undef
16390
16414
  if (typeof joint !== 'undefined' && has(joint, 'shapes')) {
16415
+ // eslint-disable-next-line no-undef
16391
16416
  setByPath(joint.shapes, type, Cell, '.');
16392
16417
  }
16393
- /* eslint-enable no-undef */
16394
16418
  return Cell;
16395
16419
  }
16396
16420
  });
@@ -16739,7 +16763,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
16739
16763
  });
16740
16764
  }
16741
16765
  function argTransform(bbox, args) {
16742
- let {
16766
+ const {
16743
16767
  x,
16744
16768
  y,
16745
16769
  angle
@@ -17203,7 +17227,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
17203
17227
  } else {
17204
17228
  groupPortTransformations = this._getGroupPortTransformations(group, portsArgs, elBBox);
17205
17229
  }
17206
- let accumulator = {
17230
+ const accumulator = {
17207
17231
  ports: ports,
17208
17232
  result: {}
17209
17233
  };
@@ -17361,7 +17385,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
17361
17385
  evaluated.position = this._evaluatePortPositionProperty(group, evaluated);
17362
17386
  evaluated.label = this._evaluatePortLabelProperty(group, evaluated);
17363
17387
  evaluated.z = this._evaluatePortZProperty(group, evaluated);
17364
- evaluated.size = assign({}, group.size, evaluated.size);
17388
+ evaluated.size = assign({
17389
+ width: 0,
17390
+ height: 0
17391
+ }, group.size, evaluated.size);
17365
17392
  return evaluated;
17366
17393
  },
17367
17394
  _evaluatePortPositionProperty: function (group, port) {
@@ -20955,17 +20982,15 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
20955
20982
  const v2 = tpNext.difference(points[i]).normalize();
20956
20983
  const vAngle = angleBetweenVectors(v1, v2);
20957
20984
  let rot = (Math.PI - vAngle) / 2;
20958
- let t;
20959
20985
  const vectorDeterminant = determinant(v1, v2);
20960
- let pointsDeterminant;
20961
- pointsDeterminant = determinant(points[i].difference(points[i + 1]), points[i].difference(points[i - 1]));
20986
+ const pointsDeterminant = determinant(points[i].difference(points[i + 1]), points[i].difference(points[i - 1]));
20962
20987
  if (vectorDeterminant < 0) {
20963
20988
  rot = -rot;
20964
20989
  }
20965
20990
  if (vAngle < Math.PI / 2 && (rot < 0 && pointsDeterminant < 0 || rot > 0 && pointsDeterminant > 0)) {
20966
20991
  rot = rot - Math.PI;
20967
20992
  }
20968
- t = v2.clone();
20993
+ const t = v2.clone();
20969
20994
  rotateVector(t, rot);
20970
20995
  const t1 = t.clone();
20971
20996
  const t2 = t.clone();
@@ -21463,6 +21488,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
21463
21488
  }
21464
21489
  // signature 2 - (object, event, callback, context)
21465
21490
  else if (typeof evt === 'string' && typeof args[0] === 'function') {
21491
+ // eslint-disable-next-line prefer-const
21466
21492
  let [cb, context = null] = args;
21467
21493
  // Invoke the callback with callbackArguments passed first
21468
21494
  if (context || callbackArguments.length > 0) cb = cb.bind(context, ...callbackArguments);
@@ -22289,7 +22315,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
22289
22315
  // all highlighters
22290
22316
  const views = [];
22291
22317
  if (!refs) return views;
22292
- for (let hid in refs) {
22318
+ for (const hid in refs) {
22293
22319
  const ref = refs[hid];
22294
22320
  if (ref instanceof this) {
22295
22321
  views.push(ref);
@@ -22319,7 +22345,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
22319
22345
  if (!refs) return false;
22320
22346
  if (id === null) {
22321
22347
  // any highlighter
22322
- for (let hid in refs) {
22348
+ for (const hid in refs) {
22323
22349
  if (refs[hid] instanceof this) return true;
22324
22350
  }
22325
22351
  return false;
@@ -22364,7 +22390,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
22364
22390
  const refs = _views[cid];
22365
22391
  if (!refs) return;
22366
22392
  if (id) delete refs[id];
22367
- for (let _ in refs) return;
22393
+ for (const _ in refs) return;
22368
22394
  delete _views[cid];
22369
22395
  },
22370
22396
  remove(cellView, id = null) {
@@ -22377,8 +22403,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
22377
22403
  const {
22378
22404
  _views
22379
22405
  } = this;
22380
- for (let cid in _views) {
22381
- for (let hid in _views[cid]) {
22406
+ for (const cid in _views) {
22407
+ for (const hid in _views[cid]) {
22382
22408
  const view = _views[cid][hid];
22383
22409
  if (view.cellView.paper === paper && view instanceof this && (id === null || hid === id)) {
22384
22410
  views.push(view);
@@ -22950,7 +22976,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
22950
22976
  // Connection Points
22951
22977
 
22952
22978
  function anchorConnectionPoint(line, _view, _magnet, opt) {
22953
- let {
22979
+ const {
22954
22980
  offset,
22955
22981
  alignOffset,
22956
22982
  align
@@ -25223,8 +25249,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
25223
25249
  }];
25224
25250
  }
25225
25251
  let x;
25226
- let y1 = Math.min((sy1 + ty0) / 2, toy);
25227
- let y2 = Math.min((sy0 + ty1) / 2, soy);
25252
+ const y1 = Math.min((sy1 + ty0) / 2, toy);
25253
+ const y2 = Math.min((sy0 + ty1) / 2, soy);
25228
25254
  if (toy < soy) {
25229
25255
  // Use the shortest path along the connections on horizontal sides
25230
25256
  if (rightD > leftD) {
@@ -25266,8 +25292,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
25266
25292
  }];
25267
25293
  }
25268
25294
  let x;
25269
- let y1 = Math.max((sy0 + ty1) / 2, toy);
25270
- let y2 = Math.max((sy1 + ty0) / 2, soy);
25295
+ const y1 = Math.max((sy0 + ty1) / 2, toy);
25296
+ const y2 = Math.max((sy1 + ty0) / 2, soy);
25271
25297
  if (toy > soy) {
25272
25298
  // Use the shortest path along the connections on horizontal sides
25273
25299
  if (rightD > leftD) {
@@ -25309,8 +25335,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
25309
25335
  }];
25310
25336
  }
25311
25337
  let y;
25312
- let x1 = Math.min((sx1 + tx0) / 2, tox);
25313
- let x2 = Math.min((sx0 + tx1) / 2, sox);
25338
+ const x1 = Math.min((sx1 + tx0) / 2, tox);
25339
+ const x2 = Math.min((sx0 + tx1) / 2, sox);
25314
25340
  if (tox > sox) {
25315
25341
  if (topD <= bottomD) {
25316
25342
  y = Math.min(smy0, toy);
@@ -25351,8 +25377,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
25351
25377
  }];
25352
25378
  }
25353
25379
  let y;
25354
- let x1 = Math.max((sx0 + tx1) / 2, tox);
25355
- let x2 = Math.max((sx1 + tx0) / 2, sox);
25380
+ const x1 = Math.max((sx0 + tx1) / 2, tox);
25381
+ const x2 = Math.max((sx1 + tx0) / 2, sox);
25356
25382
  if (tox <= sox) {
25357
25383
  if (topD <= bottomD) {
25358
25384
  y = Math.min(smy0, toy);
@@ -26169,7 +26195,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
26169
26195
  const sourcePoint = pointDataFromAnchor(linkView.sourceView, linkView.sourceAnchor, linkView.sourceBBox, sourceDirection, isSourcePort, linkView.sourceAnchor, margin);
26170
26196
  const isTargetPort = !!linkView.model.target().port;
26171
26197
  const targetPoint = pointDataFromAnchor(linkView.targetView, linkView.targetAnchor, linkView.targetBBox, targetDirection, isTargetPort, linkView.targetAnchor, margin);
26172
- let resultVertices = [];
26198
+ const resultVertices = [];
26173
26199
  if (!useVertices || vertices.length === 0) {
26174
26200
  return simplifyPoints(routeBetweenPoints(sourcePoint, targetPoint));
26175
26201
  }
@@ -27072,9 +27098,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27072
27098
  if (cellNamespace) {
27073
27099
  this.cellNamespace = cellNamespace;
27074
27100
  } else {
27075
- /* eslint-disable no-undef */
27101
+ // eslint-disable-next-line no-undef
27076
27102
  this.cellNamespace = typeof joint !== 'undefined' && has(joint, 'shapes') ? joint.shapes : null;
27077
- /* eslint-enable no-undef */
27078
27103
  }
27079
27104
  this.graph = graph;
27080
27105
  },
@@ -27685,7 +27710,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27685
27710
  // links first.
27686
27711
  this.layerCollection.removeCell(sortedCells.shift(), opt);
27687
27712
  } while (sortedCells.length > 0);
27688
- this.stopBatch('clear');
27713
+ this.stopBatch('clear', opt);
27689
27714
  return this;
27690
27715
  },
27691
27716
  _prepareCell: function (cellInit, opt) {
@@ -27853,7 +27878,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27853
27878
  removeCells: function (cellRefs, options) {
27854
27879
  if (!cellRefs.length) return this;
27855
27880
  // Remove multiple cells in a single batch
27856
- this.startBatch('remove');
27881
+ this.startBatch('remove', options);
27857
27882
  for (const cellRef of cellRefs) {
27858
27883
  if (!cellRef) continue;
27859
27884
  let cell;
@@ -27868,7 +27893,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27868
27893
  }
27869
27894
  this.layerCollection.removeCell(cell, options);
27870
27895
  }
27871
- this.stopBatch('remove');
27896
+ this.stopBatch('remove', options);
27872
27897
  return this;
27873
27898
  },
27874
27899
  /**
@@ -27898,7 +27923,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27898
27923
 
27899
27924
  // 3. Add the replacement cell
27900
27925
  this.addCell(replacement, replaceOptions);
27901
- this.stopBatch(batchName);
27926
+ this.stopBatch(batchName, opt);
27902
27927
  },
27903
27928
  /**
27904
27929
  * @protected
@@ -27987,7 +28012,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27987
28012
  this.getLayer(layerId).cellCollection.sort(opt);
27988
28013
  }
27989
28014
  }
27990
- this.stopBatch(batchName);
28015
+ this.stopBatch(batchName, opt);
27991
28016
  },
27992
28017
  /**
27993
28018
  * @public
@@ -28013,13 +28038,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28013
28038
  throw new Error('dia.Graph: cell to remove does not exist in the graph.');
28014
28039
  }
28015
28040
  if (cell.graph !== this) return;
28016
- this.startBatch('remove');
28041
+ this.startBatch('remove', options);
28017
28042
  cell.collection.remove(cell, options);
28018
- this.stopBatch('remove');
28043
+ this.stopBatch('remove', options);
28019
28044
  },
28020
28045
  transferCellEmbeds: function (sourceCell, targetCell, opt = {}) {
28021
28046
  const batchName = 'transfer-embeds';
28022
- this.startBatch(batchName);
28047
+ this.startBatch(batchName, opt);
28023
28048
 
28024
28049
  // Embed children of the source cell in the target cell.
28025
28050
  const children = sourceCell.getEmbeddedCells();
@@ -28027,11 +28052,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28027
28052
  ...opt,
28028
28053
  reparent: true
28029
28054
  });
28030
- this.stopBatch(batchName);
28055
+ this.stopBatch(batchName, opt);
28031
28056
  },
28032
28057
  transferCellConnectedLinks: function (sourceCell, targetCell, opt = {}) {
28033
28058
  const batchName = 'transfer-connected-links';
28034
- this.startBatch(batchName);
28059
+ this.startBatch(batchName, opt);
28035
28060
 
28036
28061
  // Reconnect all the links connected to the old cell to the new cell.
28037
28062
  const connectedLinks = this.getConnectedLinks(sourceCell, opt);
@@ -28043,7 +28068,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28043
28068
  link.prop(['target', 'id'], targetCell.id, opt);
28044
28069
  }
28045
28070
  });
28046
- this.stopBatch(batchName);
28071
+ this.stopBatch(batchName, opt);
28047
28072
  },
28048
28073
  /**
28049
28074
  * @private
@@ -28051,9 +28076,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28051
28076
  */
28052
28077
  _getBeforeLayerIdFromOptions(options, layer = null) {
28053
28078
  let {
28054
- before = null,
28055
28079
  index
28056
28080
  } = options;
28081
+ const {
28082
+ before = null
28083
+ } = options;
28057
28084
  if (before && index !== undefined) {
28058
28085
  throw new Error('dia.Graph: Options "before" and "index" are mutually exclusive.');
28059
28086
  }
@@ -28965,7 +28992,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28965
28992
  }, {});
28966
28993
  function evalAttributes(attrs, refBBox) {
28967
28994
  const evalAttrs = {};
28968
- for (let attrName in attrs) {
28995
+ for (const attrName in attrs) {
28969
28996
  if (!attrs.hasOwnProperty(attrName)) continue;
28970
28997
  evalAttrs[attrName] = evalAttribute(attrName, attrs[attrName], refBBox);
28971
28998
  }
@@ -31811,7 +31838,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
31811
31838
  } = this;
31812
31839
  const selectors = _labelSelectors[index];
31813
31840
  if (!selectors) return;
31814
- for (let selector in selectors) {
31841
+ for (const selector in selectors) {
31815
31842
  const {
31816
31843
  id
31817
31844
  } = selectors[selector];
@@ -33091,7 +33118,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
33091
33118
  el,
33092
33119
  pivotNodes
33093
33120
  } = this;
33094
- for (let z in pivotNodes) el.removeChild(pivotNodes[z]);
33121
+ for (const z in pivotNodes) el.removeChild(pivotNodes[z]);
33095
33122
  this.pivotNodes = {};
33096
33123
  },
33097
33124
  isEmpty: function () {
@@ -34064,9 +34091,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34064
34091
  options
34065
34092
  } = this;
34066
34093
  if (!options.cellViewNamespace) {
34067
- /* eslint-disable no-undef */
34094
+ // eslint-disable-next-line no-undef
34068
34095
  options.cellViewNamespace = typeof joint !== 'undefined' && has(joint, 'shapes') ? joint.shapes : null;
34069
- /* eslint-enable no-undef */
34070
34096
  }
34071
34097
  const defaultLayerViewNamespace = {
34072
34098
  LayerView,
@@ -34130,6 +34156,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34130
34156
  var position = opt.position;
34131
34157
  if (this.isAsync() || !isNumber(position)) {
34132
34158
  this.renderView(cell, opt);
34159
+ // Wake up the paper in case it was idle
34160
+ // When using initializeUnmounted: true the paper won't wake up by itself
34161
+ this.wakeUp();
34133
34162
  } else {
34134
34163
  if (opt.maxPosition === position) this.freeze({
34135
34164
  key: 'addCells'
@@ -34275,11 +34304,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34275
34304
  } = options;
34276
34305
 
34277
34306
  // Default cellView namespace for ES5
34278
- /* eslint-disable no-undef */
34307
+ // eslint-disable-next-line no-undef
34279
34308
  if (!cellViewNamespace && typeof joint !== 'undefined' && has(joint, 'shapes')) {
34309
+ // eslint-disable-next-line no-undef
34280
34310
  options.cellViewNamespace = joint.shapes;
34281
34311
  }
34282
- /* eslint-enable no-undef */
34283
34312
 
34284
34313
  // Here if a function was provided, we can not clone it, as this would result in loosing the function.
34285
34314
  // If the default is used, the cloning is necessary in order to prevent modifying the options on prototype.
@@ -34507,8 +34536,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34507
34536
  * Helper method for addLayerView and moveLayerView methods
34508
34537
  */
34509
34538
  _getBeforeLayerViewFromOptions(layerView, options) {
34539
+ const {
34540
+ before = null
34541
+ } = options;
34510
34542
  let {
34511
- before = null,
34512
34543
  index
34513
34544
  } = options;
34514
34545
  if (before && index !== undefined) {
@@ -34954,7 +34985,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34954
34985
  delete prevPriorityUpdates[cid];
34955
34986
  }
34956
34987
  }
34957
- let currentType = priorityUpdates[cid] || 0;
34988
+ const currentType = priorityUpdates[cid] || 0;
34958
34989
  // Prevent cycling
34959
34990
  if ((currentType & type) === type) return;
34960
34991
  if (!currentType) updates.count++;
@@ -35100,7 +35131,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
35100
35131
  let i = priorityIndexes.length;
35101
35132
  while (i > 0 && i--) {
35102
35133
  // a faster way how to check if an object is empty
35103
- for (let _key in priorities[priorityIndexes[i]]) return true;
35134
+ for (const _key in priorities[priorityIndexes[i]]) return true;
35104
35135
  }
35105
35136
  return false;
35106
35137
  },
@@ -35419,10 +35450,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
35419
35450
  var updates = this._updates;
35420
35451
  var unmountedList = updates.unmountedList;
35421
35452
  for (var i = 0, n = Math.min(unmountedList.length, batchSize); i < n; i++) {
35453
+ // stop if there are no more unmounted views
35454
+ // this can happen when another view was mounted in the onViewUpdate() callback
35455
+ if (unmountedList.length === 0) break;
35422
35456
  const {
35423
35457
  key: cid
35424
35458
  } = unmountedList.peekHead();
35425
- let view = views[cid] || this._viewPlaceholders[cid];
35459
+ const view = views[cid] || this._viewPlaceholders[cid];
35426
35460
  if (!view) {
35427
35461
  // This should not occur
35428
35462
  // Prevent looping over this invalid cid
@@ -35657,8 +35691,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
35657
35691
  width: currentWidth,
35658
35692
  height: currentHeight
35659
35693
  } = options;
35660
- let w = width === undefined ? currentWidth : width;
35661
- let h = height === undefined ? currentHeight : height;
35694
+ const w = width === undefined ? currentWidth : width;
35695
+ const h = height === undefined ? currentHeight : height;
35662
35696
  if (currentWidth === w && currentHeight === h) return;
35663
35697
  options.width = w;
35664
35698
  options.height = h;
@@ -36532,7 +36566,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
36532
36566
 
36533
36567
  resolveHighlighter: function (opt = {}) {
36534
36568
  let {
36535
- highlighter: highlighterDef,
36569
+ highlighter: highlighterDef
36570
+ } = opt;
36571
+ const {
36536
36572
  type
36537
36573
  } = opt;
36538
36574
  const {
@@ -36759,7 +36795,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
36759
36795
  if (view) {
36760
36796
  // The view could have been disposed during dragging
36761
36797
  // e.g. dragged outside of the viewport and hidden
36762
- view = this.findViewByModel(view.model);
36798
+ // The model can be removed in previous mousemove event handlers
36799
+ view = this.findViewByModel(view.model) || view;
36763
36800
  view.pointermove(evt, localPoint.x, localPoint.y);
36764
36801
  } else {
36765
36802
  this.trigger('blank:pointermove', evt, localPoint.x, localPoint.y);
@@ -36774,7 +36811,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
36774
36811
  if (view) {
36775
36812
  // The view could have been disposed during dragging
36776
36813
  // e.g. dragged outside of the viewport and hidden
36777
- view = this.findViewByModel(view.model);
36814
+ // The model can be removed in previous mouseup event handlers (e.g. when deleting an element after dragging)
36815
+ view = this.findViewByModel(view.model) || view;
36778
36816
  view.pointerup(normalizedEvt, localPoint.x, localPoint.y);
36779
36817
  } else {
36780
36818
  this.trigger('blank:pointerup', normalizedEvt, localPoint.x, localPoint.y);
@@ -38281,7 +38319,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
38281
38319
  const isSingleVertex = data.originalVertices.length === 1;
38282
38320
  const origVIndex = isSingleVertex ? 0 : handleIndex;
38283
38321
  const additionalOffset = data.firstHandleShifted && !isSingleVertex ? 1 : 0;
38284
- let nextVIndex = 1 + indexOffset;
38322
+ const nextVIndex = 1 + indexOffset;
38285
38323
  vertices.splice(handleIndex + nextVIndex, 0, data.originalVertices[origVIndex - additionalOffset]);
38286
38324
  }
38287
38325
  }
@@ -38883,7 +38921,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
38883
38921
  } = this;
38884
38922
  handleNode.setAttribute('transform', this.getHandleTransformString());
38885
38923
  if (handleAttributes) {
38886
- for (let attrName in handleAttributes) {
38924
+ for (const attrName in handleAttributes) {
38887
38925
  handleNode.setAttribute(attrName, handleAttributes[attrName]);
38888
38926
  }
38889
38927
  }
@@ -39081,7 +39119,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39081
39119
  const labelPosition = this.getLabelPosition(label);
39082
39120
  const coords = view.getLabelCoordinates(labelPosition);
39083
39121
  let {
39084
- angle = 0,
39122
+ angle = 0
39123
+ } = labelPosition;
39124
+ const {
39085
39125
  args = {}
39086
39126
  } = labelPosition;
39087
39127
  const keepGradient = args.keepGradient;
@@ -39163,15 +39203,18 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39163
39203
  const {
39164
39204
  relatedView: view
39165
39205
  } = this;
39206
+ const toolOptions = getToolOptions(this);
39166
39207
  let {
39167
39208
  x = 0,
39168
- y = 0,
39169
- offset = {},
39209
+ y = 0
39210
+ } = toolOptions;
39211
+ const {
39170
39212
  useModelGeometry,
39213
+ offset = {},
39171
39214
  rotate,
39172
39215
  scale,
39173
39216
  relative
39174
- } = getToolOptions(this);
39217
+ } = toolOptions;
39175
39218
  let bbox = getViewBBox(view, {
39176
39219
  useModelGeometry,
39177
39220
  relative
@@ -39609,11 +39652,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39609
39652
  const {
39610
39653
  relatedView: view
39611
39654
  } = this;
39612
- let {
39655
+ const {
39613
39656
  useModelGeometry,
39614
39657
  relative,
39615
- trackPath = 'M 0 0 H calc(w) V calc(h) H 0 Z'
39658
+ trackPath: initialTrackPath = 'M 0 0 H calc(w) V calc(h) H 0 Z'
39616
39659
  } = getToolOptions(this);
39660
+ let trackPath = initialTrackPath;
39617
39661
  if (typeof trackPath === 'function') {
39618
39662
  trackPath = trackPath.call(this, view);
39619
39663
  }
@@ -39634,7 +39678,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39634
39678
  const {
39635
39679
  relatedView: view
39636
39680
  } = this;
39637
- let {
39681
+ const {
39638
39682
  useModelGeometry,
39639
39683
  rotate
39640
39684
  } = getToolOptions(this);
@@ -39660,7 +39704,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39660
39704
  Remove: Remove
39661
39705
  };
39662
39706
 
39663
- var version = "4.2.2";
39707
+ var version = "4.2.4";
39664
39708
 
39665
39709
  const Vectorizer = V;
39666
39710
  const layout$1 = {