@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
@@ -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
@@ -7205,7 +7205,7 @@ var joint = (function (exports) {
7205
7205
  };
7206
7206
  const initCloneArray = array => {
7207
7207
  const length = array.length;
7208
- let result = new array.constructor(length);
7208
+ const result = new array.constructor(length);
7209
7209
  if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
7210
7210
  result.index = array.index;
7211
7211
  result.input = array.input;
@@ -7383,13 +7383,13 @@ var joint = (function (exports) {
7383
7383
  return baseIsEqualDeep(value, other, baseIsEqual, stack);
7384
7384
  };
7385
7385
  const baseIsEqualDeep = (object, other, equalFunc, stack) => {
7386
- let objIsArr = Array.isArray(object);
7386
+ const objIsArr = Array.isArray(object);
7387
7387
  const othIsArr = Array.isArray(other);
7388
7388
  let objTag = objIsArr ? arrayTag : getTag(object);
7389
7389
  let othTag = othIsArr ? arrayTag : getTag(other);
7390
7390
  objTag = objTag == argsTag ? objectTag : objTag;
7391
7391
  othTag = othTag == argsTag ? objectTag : othTag;
7392
- let objIsObj = objTag == objectTag;
7392
+ const objIsObj = objTag == objectTag;
7393
7393
  const othIsObj = othTag == objectTag;
7394
7394
  const isSameTag = objTag == othTag;
7395
7395
  if (isSameTag && !objIsObj) {
@@ -7524,7 +7524,7 @@ var joint = (function (exports) {
7524
7524
  };
7525
7525
  const mapToArray = map => {
7526
7526
  let index = -1;
7527
- let result = Array(map.size);
7527
+ const result = Array(map.size);
7528
7528
  map.forEach((value, key) => {
7529
7529
  result[++index] = [key, value];
7530
7530
  });
@@ -7634,7 +7634,7 @@ var joint = (function (exports) {
7634
7634
  isCommon = false;
7635
7635
  values = new SetCache(values);
7636
7636
  }
7637
- outer: for (let key in array) {
7637
+ outer: for (const key in array) {
7638
7638
  let value = array[key];
7639
7639
  const computed = value;
7640
7640
  value = value !== 0 ? value : 0;
@@ -9048,7 +9048,7 @@ var joint = (function (exports) {
9048
9048
  // User data storage
9049
9049
  $.data = dataUser;
9050
9050
  $.merge = function (first, second) {
9051
- let len = +second.length;
9051
+ const len = +second.length;
9052
9052
  let i = first.length;
9053
9053
  for (let j = 0; j < len; j++) {
9054
9054
  first[i++] = second[j];
@@ -9216,7 +9216,7 @@ var joint = (function (exports) {
9216
9216
  data = data || selector;
9217
9217
  selector = undefined;
9218
9218
  }
9219
- for (let type in types) {
9219
+ for (const type in types) {
9220
9220
  $.event.on(elem, type, selector, data, types[type], one);
9221
9221
  }
9222
9222
  return elem;
@@ -9709,6 +9709,25 @@ var joint = (function (exports) {
9709
9709
  return `matrix(${a},${b},${c},${d},${e},${f})`;
9710
9710
  }
9711
9711
 
9712
+ /**
9713
+ * @param {SVGElement} node
9714
+ * @returns {SVGSVGElement|null}
9715
+ * @description Returns the root SVG element for the given node,
9716
+ * walking up through nested SVG elements.
9717
+ * Returns `null` if the node is not part of an SVG document.
9718
+ */
9719
+ function getRootSVG(node) {
9720
+ let svg = node.ownerSVGElement;
9721
+ if (!svg) {
9722
+ // The node itself may be an <svg> element
9723
+ return node instanceof SVGSVGElement ? node : null;
9724
+ }
9725
+ while (svg.ownerSVGElement) {
9726
+ svg = svg.ownerSVGElement;
9727
+ }
9728
+ return svg;
9729
+ }
9730
+
9712
9731
  /**
9713
9732
  *
9714
9733
  * @param {SVGElement} a
@@ -9719,9 +9738,12 @@ var joint = (function (exports) {
9719
9738
  * in order to calculate the correct transformation matrix.
9720
9739
  */
9721
9740
  function getRelativeTransformation(a, b) {
9722
- // Different SVG elements, no transformation possible
9723
- // Note: SVGSVGElement has no `ownerSVGElement`
9724
- if ((a.ownerSVGElement || a) !== (b.ownerSVGElement || b)) return null;
9741
+ // Elements must be part of an SVG document
9742
+ const rootA = getRootSVG(a);
9743
+ const rootB = getRootSVG(b);
9744
+ if (!rootA || !rootB) return null;
9745
+ // Different SVG documents, no transformation possible
9746
+ if (rootA !== rootB) return null;
9725
9747
  // Get the transformation matrix from `a` to `b`.
9726
9748
  const am = b.getScreenCTM();
9727
9749
  if (!am) return null;
@@ -12065,7 +12087,7 @@ var joint = (function (exports) {
12065
12087
  } else {
12066
12088
  styles = name;
12067
12089
  }
12068
- for (let style in styles) {
12090
+ for (const style in styles) {
12069
12091
  if (styles.hasOwnProperty(style)) {
12070
12092
  for (let i = 0; i < this.length; i++) {
12071
12093
  setCSSProperty(this[i], style, styles[style]);
@@ -12171,7 +12193,7 @@ var joint = (function (exports) {
12171
12193
  }
12172
12194
  if (typeof types === 'object') {
12173
12195
  // ( types-object [, selector] )
12174
- for (let type in types) {
12196
+ for (const type in types) {
12175
12197
  this.off(type, selector, types[type]);
12176
12198
  }
12177
12199
  return this;
@@ -12215,7 +12237,7 @@ var joint = (function (exports) {
12215
12237
  function position() {
12216
12238
  const [el] = this;
12217
12239
  if (!el) return;
12218
- let $el = $(el);
12240
+ const $el = $(el);
12219
12241
  let offsetParent;
12220
12242
  let offset;
12221
12243
  let doc;
@@ -12334,8 +12356,10 @@ var joint = (function (exports) {
12334
12356
  function animateNode(el, properties, opt = {}) {
12335
12357
  let {
12336
12358
  duration = 400,
12359
+ delay = 0
12360
+ } = opt;
12361
+ const {
12337
12362
  easing = 'ease-in-out',
12338
- delay = 0,
12339
12363
  complete
12340
12364
  } = opt;
12341
12365
  const delayId = setTimeout(function () {
@@ -12471,7 +12495,7 @@ var joint = (function (exports) {
12471
12495
  } else {
12472
12496
  attributes = name;
12473
12497
  }
12474
- for (let attr in attributes) {
12498
+ for (const attr in attributes) {
12475
12499
  if (attributes.hasOwnProperty(attr)) {
12476
12500
  const value = attributes[attr];
12477
12501
  if (propertiesMap[attr]) {
@@ -12625,11 +12649,10 @@ var joint = (function (exports) {
12625
12649
  // TagName
12626
12650
  if (!nodeDef.hasOwnProperty('tagName')) throw new Error('json-dom-parser: missing tagName');
12627
12651
  const tagName = nodeDef.tagName;
12628
- let node;
12629
12652
 
12630
12653
  // Namespace URI
12631
12654
  const ns = nodeDef.hasOwnProperty('namespaceURI') ? nodeDef.namespaceURI : parentNS;
12632
- node = document.createElementNS(ns, tagName);
12655
+ const node = document.createElementNS(ns, tagName);
12633
12656
  const svg = ns === svgNamespace;
12634
12657
  const wrapperNode = svg ? V(node) : $(node);
12635
12658
  // Attributes
@@ -12810,7 +12833,7 @@ var joint = (function (exports) {
12810
12833
  // If the event is a touch event, normalize it to a mouse event.
12811
12834
  const touch = originalEvent && originalEvent.changedTouches && originalEvent.changedTouches[0];
12812
12835
  if (touch) {
12813
- for (let property in touch) {
12836
+ for (const property in touch) {
12814
12837
  // copy all the properties from the first touch that are not
12815
12838
  // defined on TouchEvent (clientX, clientY, pageX, pageY, screenX, screenY, identifier, ...)
12816
12839
  if (evt[property] === undefined) {
@@ -14543,7 +14566,9 @@ var joint = (function (exports) {
14543
14566
  if (this.idAttribute in attrs) {
14544
14567
  var prevId = this.id;
14545
14568
  this.id = this.get(this.idAttribute);
14546
- this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
14569
+ if (this.id !== prevId) {
14570
+ this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
14571
+ }
14547
14572
  }
14548
14573
 
14549
14574
  // Trigger all relevant attribute changes.
@@ -14977,7 +15002,7 @@ var joint = (function (exports) {
14977
15002
  let value = expression;
14978
15003
  let startSearchIndex = 0;
14979
15004
  do {
14980
- let calcIndex = value.indexOf(calcStart, startSearchIndex);
15005
+ const calcIndex = value.indexOf(calcStart, startSearchIndex);
14981
15006
  if (calcIndex === -1) return value;
14982
15007
  let calcEndIndex = calcIndex + calcStartOffset;
14983
15008
  let brackets = 1;
@@ -15640,7 +15665,7 @@ var joint = (function (exports) {
15640
15665
  return finalAttributes;
15641
15666
  }
15642
15667
  let defaultAttributes = {};
15643
- let attributes = cloneDeep(this.attributes);
15668
+ const attributes = cloneDeep(this.attributes);
15644
15669
  if (ignoreDefaults === true) {
15645
15670
  // Compare all attributes with the defaults
15646
15671
  defaultAttributes = defaults;
@@ -16195,8 +16220,7 @@ var joint = (function (exports) {
16195
16220
  const {
16196
16221
  _scheduledTransitionIds
16197
16222
  } = this;
16198
- let initialId;
16199
- var initiator = callback => {
16223
+ const initiator = callback => {
16200
16224
  if (_scheduledTransitionIds[transitionKey]) {
16201
16225
  _scheduledTransitionIds[transitionKey] = without(_scheduledTransitionIds[transitionKey], initialId);
16202
16226
  if (_scheduledTransitionIds[transitionKey].length === 0) {
@@ -16208,7 +16232,7 @@ var joint = (function (exports) {
16208
16232
  this._transitionIds[transitionKey] = nextFrame(callback);
16209
16233
  this.trigger('transition:start', this, transitionKey);
16210
16234
  };
16211
- initialId = setTimeout(initiator, opt.delay, setter);
16235
+ const initialId = setTimeout(initiator, opt.delay, setter);
16212
16236
  _scheduledTransitionIds[transitionKey] || (_scheduledTransitionIds[transitionKey] = []);
16213
16237
  _scheduledTransitionIds[transitionKey].push(initialId);
16214
16238
  return initialId;
@@ -16383,11 +16407,11 @@ var joint = (function (exports) {
16383
16407
  }, protoProps);
16384
16408
  var Cell = this.extend(protoProps, staticProps);
16385
16409
  // es5 backward compatibility
16386
- /* eslint-disable no-undef */
16410
+ // eslint-disable-next-line no-undef
16387
16411
  if (typeof joint !== 'undefined' && has(joint, 'shapes')) {
16412
+ // eslint-disable-next-line no-undef
16388
16413
  setByPath(joint.shapes, type, Cell, '.');
16389
16414
  }
16390
- /* eslint-enable no-undef */
16391
16415
  return Cell;
16392
16416
  }
16393
16417
  });
@@ -16736,7 +16760,7 @@ var joint = (function (exports) {
16736
16760
  });
16737
16761
  }
16738
16762
  function argTransform(bbox, args) {
16739
- let {
16763
+ const {
16740
16764
  x,
16741
16765
  y,
16742
16766
  angle
@@ -17200,7 +17224,7 @@ var joint = (function (exports) {
17200
17224
  } else {
17201
17225
  groupPortTransformations = this._getGroupPortTransformations(group, portsArgs, elBBox);
17202
17226
  }
17203
- let accumulator = {
17227
+ const accumulator = {
17204
17228
  ports: ports,
17205
17229
  result: {}
17206
17230
  };
@@ -17358,7 +17382,10 @@ var joint = (function (exports) {
17358
17382
  evaluated.position = this._evaluatePortPositionProperty(group, evaluated);
17359
17383
  evaluated.label = this._evaluatePortLabelProperty(group, evaluated);
17360
17384
  evaluated.z = this._evaluatePortZProperty(group, evaluated);
17361
- evaluated.size = assign({}, group.size, evaluated.size);
17385
+ evaluated.size = assign({
17386
+ width: 0,
17387
+ height: 0
17388
+ }, group.size, evaluated.size);
17362
17389
  return evaluated;
17363
17390
  },
17364
17391
  _evaluatePortPositionProperty: function (group, port) {
@@ -20952,17 +20979,15 @@ var joint = (function (exports) {
20952
20979
  const v2 = tpNext.difference(points[i]).normalize();
20953
20980
  const vAngle = angleBetweenVectors(v1, v2);
20954
20981
  let rot = (Math.PI - vAngle) / 2;
20955
- let t;
20956
20982
  const vectorDeterminant = determinant(v1, v2);
20957
- let pointsDeterminant;
20958
- pointsDeterminant = determinant(points[i].difference(points[i + 1]), points[i].difference(points[i - 1]));
20983
+ const pointsDeterminant = determinant(points[i].difference(points[i + 1]), points[i].difference(points[i - 1]));
20959
20984
  if (vectorDeterminant < 0) {
20960
20985
  rot = -rot;
20961
20986
  }
20962
20987
  if (vAngle < Math.PI / 2 && (rot < 0 && pointsDeterminant < 0 || rot > 0 && pointsDeterminant > 0)) {
20963
20988
  rot = rot - Math.PI;
20964
20989
  }
20965
- t = v2.clone();
20990
+ const t = v2.clone();
20966
20991
  rotateVector(t, rot);
20967
20992
  const t1 = t.clone();
20968
20993
  const t2 = t.clone();
@@ -21460,6 +21485,7 @@ var joint = (function (exports) {
21460
21485
  }
21461
21486
  // signature 2 - (object, event, callback, context)
21462
21487
  else if (typeof evt === 'string' && typeof args[0] === 'function') {
21488
+ // eslint-disable-next-line prefer-const
21463
21489
  let [cb, context = null] = args;
21464
21490
  // Invoke the callback with callbackArguments passed first
21465
21491
  if (context || callbackArguments.length > 0) cb = cb.bind(context, ...callbackArguments);
@@ -22286,7 +22312,7 @@ var joint = (function (exports) {
22286
22312
  // all highlighters
22287
22313
  const views = [];
22288
22314
  if (!refs) return views;
22289
- for (let hid in refs) {
22315
+ for (const hid in refs) {
22290
22316
  const ref = refs[hid];
22291
22317
  if (ref instanceof this) {
22292
22318
  views.push(ref);
@@ -22316,7 +22342,7 @@ var joint = (function (exports) {
22316
22342
  if (!refs) return false;
22317
22343
  if (id === null) {
22318
22344
  // any highlighter
22319
- for (let hid in refs) {
22345
+ for (const hid in refs) {
22320
22346
  if (refs[hid] instanceof this) return true;
22321
22347
  }
22322
22348
  return false;
@@ -22361,7 +22387,7 @@ var joint = (function (exports) {
22361
22387
  const refs = _views[cid];
22362
22388
  if (!refs) return;
22363
22389
  if (id) delete refs[id];
22364
- for (let _ in refs) return;
22390
+ for (const _ in refs) return;
22365
22391
  delete _views[cid];
22366
22392
  },
22367
22393
  remove(cellView, id = null) {
@@ -22374,8 +22400,8 @@ var joint = (function (exports) {
22374
22400
  const {
22375
22401
  _views
22376
22402
  } = this;
22377
- for (let cid in _views) {
22378
- for (let hid in _views[cid]) {
22403
+ for (const cid in _views) {
22404
+ for (const hid in _views[cid]) {
22379
22405
  const view = _views[cid][hid];
22380
22406
  if (view.cellView.paper === paper && view instanceof this && (id === null || hid === id)) {
22381
22407
  views.push(view);
@@ -22947,7 +22973,7 @@ var joint = (function (exports) {
22947
22973
  // Connection Points
22948
22974
 
22949
22975
  function anchorConnectionPoint(line, _view, _magnet, opt) {
22950
- let {
22976
+ const {
22951
22977
  offset,
22952
22978
  alignOffset,
22953
22979
  align
@@ -25220,8 +25246,8 @@ var joint = (function (exports) {
25220
25246
  }];
25221
25247
  }
25222
25248
  let x;
25223
- let y1 = Math.min((sy1 + ty0) / 2, toy);
25224
- let y2 = Math.min((sy0 + ty1) / 2, soy);
25249
+ const y1 = Math.min((sy1 + ty0) / 2, toy);
25250
+ const y2 = Math.min((sy0 + ty1) / 2, soy);
25225
25251
  if (toy < soy) {
25226
25252
  // Use the shortest path along the connections on horizontal sides
25227
25253
  if (rightD > leftD) {
@@ -25263,8 +25289,8 @@ var joint = (function (exports) {
25263
25289
  }];
25264
25290
  }
25265
25291
  let x;
25266
- let y1 = Math.max((sy0 + ty1) / 2, toy);
25267
- let y2 = Math.max((sy1 + ty0) / 2, soy);
25292
+ const y1 = Math.max((sy0 + ty1) / 2, toy);
25293
+ const y2 = Math.max((sy1 + ty0) / 2, soy);
25268
25294
  if (toy > soy) {
25269
25295
  // Use the shortest path along the connections on horizontal sides
25270
25296
  if (rightD > leftD) {
@@ -25306,8 +25332,8 @@ var joint = (function (exports) {
25306
25332
  }];
25307
25333
  }
25308
25334
  let y;
25309
- let x1 = Math.min((sx1 + tx0) / 2, tox);
25310
- let x2 = Math.min((sx0 + tx1) / 2, sox);
25335
+ const x1 = Math.min((sx1 + tx0) / 2, tox);
25336
+ const x2 = Math.min((sx0 + tx1) / 2, sox);
25311
25337
  if (tox > sox) {
25312
25338
  if (topD <= bottomD) {
25313
25339
  y = Math.min(smy0, toy);
@@ -25348,8 +25374,8 @@ var joint = (function (exports) {
25348
25374
  }];
25349
25375
  }
25350
25376
  let y;
25351
- let x1 = Math.max((sx0 + tx1) / 2, tox);
25352
- let x2 = Math.max((sx1 + tx0) / 2, sox);
25377
+ const x1 = Math.max((sx0 + tx1) / 2, tox);
25378
+ const x2 = Math.max((sx1 + tx0) / 2, sox);
25353
25379
  if (tox <= sox) {
25354
25380
  if (topD <= bottomD) {
25355
25381
  y = Math.min(smy0, toy);
@@ -26166,7 +26192,7 @@ var joint = (function (exports) {
26166
26192
  const sourcePoint = pointDataFromAnchor(linkView.sourceView, linkView.sourceAnchor, linkView.sourceBBox, sourceDirection, isSourcePort, linkView.sourceAnchor, margin);
26167
26193
  const isTargetPort = !!linkView.model.target().port;
26168
26194
  const targetPoint = pointDataFromAnchor(linkView.targetView, linkView.targetAnchor, linkView.targetBBox, targetDirection, isTargetPort, linkView.targetAnchor, margin);
26169
- let resultVertices = [];
26195
+ const resultVertices = [];
26170
26196
  if (!useVertices || vertices.length === 0) {
26171
26197
  return simplifyPoints(routeBetweenPoints(sourcePoint, targetPoint));
26172
26198
  }
@@ -27069,9 +27095,8 @@ var joint = (function (exports) {
27069
27095
  if (cellNamespace) {
27070
27096
  this.cellNamespace = cellNamespace;
27071
27097
  } else {
27072
- /* eslint-disable no-undef */
27098
+ // eslint-disable-next-line no-undef
27073
27099
  this.cellNamespace = typeof joint !== 'undefined' && has(joint, 'shapes') ? joint.shapes : null;
27074
- /* eslint-enable no-undef */
27075
27100
  }
27076
27101
  this.graph = graph;
27077
27102
  },
@@ -27682,7 +27707,7 @@ var joint = (function (exports) {
27682
27707
  // links first.
27683
27708
  this.layerCollection.removeCell(sortedCells.shift(), opt);
27684
27709
  } while (sortedCells.length > 0);
27685
- this.stopBatch('clear');
27710
+ this.stopBatch('clear', opt);
27686
27711
  return this;
27687
27712
  },
27688
27713
  _prepareCell: function (cellInit, opt) {
@@ -27850,7 +27875,7 @@ var joint = (function (exports) {
27850
27875
  removeCells: function (cellRefs, options) {
27851
27876
  if (!cellRefs.length) return this;
27852
27877
  // Remove multiple cells in a single batch
27853
- this.startBatch('remove');
27878
+ this.startBatch('remove', options);
27854
27879
  for (const cellRef of cellRefs) {
27855
27880
  if (!cellRef) continue;
27856
27881
  let cell;
@@ -27865,7 +27890,7 @@ var joint = (function (exports) {
27865
27890
  }
27866
27891
  this.layerCollection.removeCell(cell, options);
27867
27892
  }
27868
- this.stopBatch('remove');
27893
+ this.stopBatch('remove', options);
27869
27894
  return this;
27870
27895
  },
27871
27896
  /**
@@ -27895,7 +27920,7 @@ var joint = (function (exports) {
27895
27920
 
27896
27921
  // 3. Add the replacement cell
27897
27922
  this.addCell(replacement, replaceOptions);
27898
- this.stopBatch(batchName);
27923
+ this.stopBatch(batchName, opt);
27899
27924
  },
27900
27925
  /**
27901
27926
  * @protected
@@ -27984,7 +28009,7 @@ var joint = (function (exports) {
27984
28009
  this.getLayer(layerId).cellCollection.sort(opt);
27985
28010
  }
27986
28011
  }
27987
- this.stopBatch(batchName);
28012
+ this.stopBatch(batchName, opt);
27988
28013
  },
27989
28014
  /**
27990
28015
  * @public
@@ -28010,13 +28035,13 @@ var joint = (function (exports) {
28010
28035
  throw new Error('dia.Graph: cell to remove does not exist in the graph.');
28011
28036
  }
28012
28037
  if (cell.graph !== this) return;
28013
- this.startBatch('remove');
28038
+ this.startBatch('remove', options);
28014
28039
  cell.collection.remove(cell, options);
28015
- this.stopBatch('remove');
28040
+ this.stopBatch('remove', options);
28016
28041
  },
28017
28042
  transferCellEmbeds: function (sourceCell, targetCell, opt = {}) {
28018
28043
  const batchName = 'transfer-embeds';
28019
- this.startBatch(batchName);
28044
+ this.startBatch(batchName, opt);
28020
28045
 
28021
28046
  // Embed children of the source cell in the target cell.
28022
28047
  const children = sourceCell.getEmbeddedCells();
@@ -28024,11 +28049,11 @@ var joint = (function (exports) {
28024
28049
  ...opt,
28025
28050
  reparent: true
28026
28051
  });
28027
- this.stopBatch(batchName);
28052
+ this.stopBatch(batchName, opt);
28028
28053
  },
28029
28054
  transferCellConnectedLinks: function (sourceCell, targetCell, opt = {}) {
28030
28055
  const batchName = 'transfer-connected-links';
28031
- this.startBatch(batchName);
28056
+ this.startBatch(batchName, opt);
28032
28057
 
28033
28058
  // Reconnect all the links connected to the old cell to the new cell.
28034
28059
  const connectedLinks = this.getConnectedLinks(sourceCell, opt);
@@ -28040,7 +28065,7 @@ var joint = (function (exports) {
28040
28065
  link.prop(['target', 'id'], targetCell.id, opt);
28041
28066
  }
28042
28067
  });
28043
- this.stopBatch(batchName);
28068
+ this.stopBatch(batchName, opt);
28044
28069
  },
28045
28070
  /**
28046
28071
  * @private
@@ -28048,9 +28073,11 @@ var joint = (function (exports) {
28048
28073
  */
28049
28074
  _getBeforeLayerIdFromOptions(options, layer = null) {
28050
28075
  let {
28051
- before = null,
28052
28076
  index
28053
28077
  } = options;
28078
+ const {
28079
+ before = null
28080
+ } = options;
28054
28081
  if (before && index !== undefined) {
28055
28082
  throw new Error('dia.Graph: Options "before" and "index" are mutually exclusive.');
28056
28083
  }
@@ -28962,7 +28989,7 @@ var joint = (function (exports) {
28962
28989
  }, {});
28963
28990
  function evalAttributes(attrs, refBBox) {
28964
28991
  const evalAttrs = {};
28965
- for (let attrName in attrs) {
28992
+ for (const attrName in attrs) {
28966
28993
  if (!attrs.hasOwnProperty(attrName)) continue;
28967
28994
  evalAttrs[attrName] = evalAttribute(attrName, attrs[attrName], refBBox);
28968
28995
  }
@@ -31808,7 +31835,7 @@ var joint = (function (exports) {
31808
31835
  } = this;
31809
31836
  const selectors = _labelSelectors[index];
31810
31837
  if (!selectors) return;
31811
- for (let selector in selectors) {
31838
+ for (const selector in selectors) {
31812
31839
  const {
31813
31840
  id
31814
31841
  } = selectors[selector];
@@ -33088,7 +33115,7 @@ var joint = (function (exports) {
33088
33115
  el,
33089
33116
  pivotNodes
33090
33117
  } = this;
33091
- for (let z in pivotNodes) el.removeChild(pivotNodes[z]);
33118
+ for (const z in pivotNodes) el.removeChild(pivotNodes[z]);
33092
33119
  this.pivotNodes = {};
33093
33120
  },
33094
33121
  isEmpty: function () {
@@ -34061,9 +34088,8 @@ var joint = (function (exports) {
34061
34088
  options
34062
34089
  } = this;
34063
34090
  if (!options.cellViewNamespace) {
34064
- /* eslint-disable no-undef */
34091
+ // eslint-disable-next-line no-undef
34065
34092
  options.cellViewNamespace = typeof joint !== 'undefined' && has(joint, 'shapes') ? joint.shapes : null;
34066
- /* eslint-enable no-undef */
34067
34093
  }
34068
34094
  const defaultLayerViewNamespace = {
34069
34095
  LayerView,
@@ -34127,6 +34153,9 @@ var joint = (function (exports) {
34127
34153
  var position = opt.position;
34128
34154
  if (this.isAsync() || !isNumber(position)) {
34129
34155
  this.renderView(cell, opt);
34156
+ // Wake up the paper in case it was idle
34157
+ // When using initializeUnmounted: true the paper won't wake up by itself
34158
+ this.wakeUp();
34130
34159
  } else {
34131
34160
  if (opt.maxPosition === position) this.freeze({
34132
34161
  key: 'addCells'
@@ -34272,11 +34301,11 @@ var joint = (function (exports) {
34272
34301
  } = options;
34273
34302
 
34274
34303
  // Default cellView namespace for ES5
34275
- /* eslint-disable no-undef */
34304
+ // eslint-disable-next-line no-undef
34276
34305
  if (!cellViewNamespace && typeof joint !== 'undefined' && has(joint, 'shapes')) {
34306
+ // eslint-disable-next-line no-undef
34277
34307
  options.cellViewNamespace = joint.shapes;
34278
34308
  }
34279
- /* eslint-enable no-undef */
34280
34309
 
34281
34310
  // Here if a function was provided, we can not clone it, as this would result in loosing the function.
34282
34311
  // If the default is used, the cloning is necessary in order to prevent modifying the options on prototype.
@@ -34504,8 +34533,10 @@ var joint = (function (exports) {
34504
34533
  * Helper method for addLayerView and moveLayerView methods
34505
34534
  */
34506
34535
  _getBeforeLayerViewFromOptions(layerView, options) {
34536
+ const {
34537
+ before = null
34538
+ } = options;
34507
34539
  let {
34508
- before = null,
34509
34540
  index
34510
34541
  } = options;
34511
34542
  if (before && index !== undefined) {
@@ -34951,7 +34982,7 @@ var joint = (function (exports) {
34951
34982
  delete prevPriorityUpdates[cid];
34952
34983
  }
34953
34984
  }
34954
- let currentType = priorityUpdates[cid] || 0;
34985
+ const currentType = priorityUpdates[cid] || 0;
34955
34986
  // Prevent cycling
34956
34987
  if ((currentType & type) === type) return;
34957
34988
  if (!currentType) updates.count++;
@@ -35097,7 +35128,7 @@ var joint = (function (exports) {
35097
35128
  let i = priorityIndexes.length;
35098
35129
  while (i > 0 && i--) {
35099
35130
  // a faster way how to check if an object is empty
35100
- for (let _key in priorities[priorityIndexes[i]]) return true;
35131
+ for (const _key in priorities[priorityIndexes[i]]) return true;
35101
35132
  }
35102
35133
  return false;
35103
35134
  },
@@ -35416,10 +35447,13 @@ var joint = (function (exports) {
35416
35447
  var updates = this._updates;
35417
35448
  var unmountedList = updates.unmountedList;
35418
35449
  for (var i = 0, n = Math.min(unmountedList.length, batchSize); i < n; i++) {
35450
+ // stop if there are no more unmounted views
35451
+ // this can happen when another view was mounted in the onViewUpdate() callback
35452
+ if (unmountedList.length === 0) break;
35419
35453
  const {
35420
35454
  key: cid
35421
35455
  } = unmountedList.peekHead();
35422
- let view = views[cid] || this._viewPlaceholders[cid];
35456
+ const view = views[cid] || this._viewPlaceholders[cid];
35423
35457
  if (!view) {
35424
35458
  // This should not occur
35425
35459
  // Prevent looping over this invalid cid
@@ -35654,8 +35688,8 @@ var joint = (function (exports) {
35654
35688
  width: currentWidth,
35655
35689
  height: currentHeight
35656
35690
  } = options;
35657
- let w = width === undefined ? currentWidth : width;
35658
- let h = height === undefined ? currentHeight : height;
35691
+ const w = width === undefined ? currentWidth : width;
35692
+ const h = height === undefined ? currentHeight : height;
35659
35693
  if (currentWidth === w && currentHeight === h) return;
35660
35694
  options.width = w;
35661
35695
  options.height = h;
@@ -36529,7 +36563,9 @@ var joint = (function (exports) {
36529
36563
 
36530
36564
  resolveHighlighter: function (opt = {}) {
36531
36565
  let {
36532
- highlighter: highlighterDef,
36566
+ highlighter: highlighterDef
36567
+ } = opt;
36568
+ const {
36533
36569
  type
36534
36570
  } = opt;
36535
36571
  const {
@@ -36756,7 +36792,8 @@ var joint = (function (exports) {
36756
36792
  if (view) {
36757
36793
  // The view could have been disposed during dragging
36758
36794
  // e.g. dragged outside of the viewport and hidden
36759
- view = this.findViewByModel(view.model);
36795
+ // The model can be removed in previous mousemove event handlers
36796
+ view = this.findViewByModel(view.model) || view;
36760
36797
  view.pointermove(evt, localPoint.x, localPoint.y);
36761
36798
  } else {
36762
36799
  this.trigger('blank:pointermove', evt, localPoint.x, localPoint.y);
@@ -36771,7 +36808,8 @@ var joint = (function (exports) {
36771
36808
  if (view) {
36772
36809
  // The view could have been disposed during dragging
36773
36810
  // e.g. dragged outside of the viewport and hidden
36774
- view = this.findViewByModel(view.model);
36811
+ // The model can be removed in previous mouseup event handlers (e.g. when deleting an element after dragging)
36812
+ view = this.findViewByModel(view.model) || view;
36775
36813
  view.pointerup(normalizedEvt, localPoint.x, localPoint.y);
36776
36814
  } else {
36777
36815
  this.trigger('blank:pointerup', normalizedEvt, localPoint.x, localPoint.y);
@@ -38278,7 +38316,7 @@ var joint = (function (exports) {
38278
38316
  const isSingleVertex = data.originalVertices.length === 1;
38279
38317
  const origVIndex = isSingleVertex ? 0 : handleIndex;
38280
38318
  const additionalOffset = data.firstHandleShifted && !isSingleVertex ? 1 : 0;
38281
- let nextVIndex = 1 + indexOffset;
38319
+ const nextVIndex = 1 + indexOffset;
38282
38320
  vertices.splice(handleIndex + nextVIndex, 0, data.originalVertices[origVIndex - additionalOffset]);
38283
38321
  }
38284
38322
  }
@@ -38880,7 +38918,7 @@ var joint = (function (exports) {
38880
38918
  } = this;
38881
38919
  handleNode.setAttribute('transform', this.getHandleTransformString());
38882
38920
  if (handleAttributes) {
38883
- for (let attrName in handleAttributes) {
38921
+ for (const attrName in handleAttributes) {
38884
38922
  handleNode.setAttribute(attrName, handleAttributes[attrName]);
38885
38923
  }
38886
38924
  }
@@ -39078,7 +39116,9 @@ var joint = (function (exports) {
39078
39116
  const labelPosition = this.getLabelPosition(label);
39079
39117
  const coords = view.getLabelCoordinates(labelPosition);
39080
39118
  let {
39081
- angle = 0,
39119
+ angle = 0
39120
+ } = labelPosition;
39121
+ const {
39082
39122
  args = {}
39083
39123
  } = labelPosition;
39084
39124
  const keepGradient = args.keepGradient;
@@ -39160,15 +39200,18 @@ var joint = (function (exports) {
39160
39200
  const {
39161
39201
  relatedView: view
39162
39202
  } = this;
39203
+ const toolOptions = getToolOptions(this);
39163
39204
  let {
39164
39205
  x = 0,
39165
- y = 0,
39166
- offset = {},
39206
+ y = 0
39207
+ } = toolOptions;
39208
+ const {
39167
39209
  useModelGeometry,
39210
+ offset = {},
39168
39211
  rotate,
39169
39212
  scale,
39170
39213
  relative
39171
- } = getToolOptions(this);
39214
+ } = toolOptions;
39172
39215
  let bbox = getViewBBox(view, {
39173
39216
  useModelGeometry,
39174
39217
  relative
@@ -39606,11 +39649,12 @@ var joint = (function (exports) {
39606
39649
  const {
39607
39650
  relatedView: view
39608
39651
  } = this;
39609
- let {
39652
+ const {
39610
39653
  useModelGeometry,
39611
39654
  relative,
39612
- trackPath = 'M 0 0 H calc(w) V calc(h) H 0 Z'
39655
+ trackPath: initialTrackPath = 'M 0 0 H calc(w) V calc(h) H 0 Z'
39613
39656
  } = getToolOptions(this);
39657
+ let trackPath = initialTrackPath;
39614
39658
  if (typeof trackPath === 'function') {
39615
39659
  trackPath = trackPath.call(this, view);
39616
39660
  }
@@ -39631,7 +39675,7 @@ var joint = (function (exports) {
39631
39675
  const {
39632
39676
  relatedView: view
39633
39677
  } = this;
39634
- let {
39678
+ const {
39635
39679
  useModelGeometry,
39636
39680
  rotate
39637
39681
  } = getToolOptions(this);
@@ -39657,7 +39701,7 @@ var joint = (function (exports) {
39657
39701
  Remove: Remove
39658
39702
  };
39659
39703
 
39660
- var version = "4.2.2";
39704
+ var version = "4.2.4";
39661
39705
 
39662
39706
  const Vectorizer = V;
39663
39707
  const layout$1 = {