@joint/core 4.2.3 → 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.
package/dist/geometry.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.2.3 (2026-01-21) - 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
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.2.3 (2026-01-21) - 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
package/dist/joint.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.2.3 (2026-01-21) - 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
package/dist/joint.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.2.3 (2026-01-21) - 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
@@ -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;
@@ -14547,7 +14569,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
14547
14569
  if (this.idAttribute in attrs) {
14548
14570
  var prevId = this.id;
14549
14571
  this.id = this.get(this.idAttribute);
14550
- this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
14572
+ if (this.id !== prevId) {
14573
+ this.trigger(this.eventPrefix + 'changeId', this, prevId, options);
14574
+ }
14551
14575
  }
14552
14576
 
14553
14577
  // Trigger all relevant attribute changes.
@@ -27686,7 +27710,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27686
27710
  // links first.
27687
27711
  this.layerCollection.removeCell(sortedCells.shift(), opt);
27688
27712
  } while (sortedCells.length > 0);
27689
- this.stopBatch('clear');
27713
+ this.stopBatch('clear', opt);
27690
27714
  return this;
27691
27715
  },
27692
27716
  _prepareCell: function (cellInit, opt) {
@@ -27854,7 +27878,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27854
27878
  removeCells: function (cellRefs, options) {
27855
27879
  if (!cellRefs.length) return this;
27856
27880
  // Remove multiple cells in a single batch
27857
- this.startBatch('remove');
27881
+ this.startBatch('remove', options);
27858
27882
  for (const cellRef of cellRefs) {
27859
27883
  if (!cellRef) continue;
27860
27884
  let cell;
@@ -27869,7 +27893,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27869
27893
  }
27870
27894
  this.layerCollection.removeCell(cell, options);
27871
27895
  }
27872
- this.stopBatch('remove');
27896
+ this.stopBatch('remove', options);
27873
27897
  return this;
27874
27898
  },
27875
27899
  /**
@@ -27899,7 +27923,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27899
27923
 
27900
27924
  // 3. Add the replacement cell
27901
27925
  this.addCell(replacement, replaceOptions);
27902
- this.stopBatch(batchName);
27926
+ this.stopBatch(batchName, opt);
27903
27927
  },
27904
27928
  /**
27905
27929
  * @protected
@@ -27988,7 +28012,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27988
28012
  this.getLayer(layerId).cellCollection.sort(opt);
27989
28013
  }
27990
28014
  }
27991
- this.stopBatch(batchName);
28015
+ this.stopBatch(batchName, opt);
27992
28016
  },
27993
28017
  /**
27994
28018
  * @public
@@ -28014,13 +28038,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28014
28038
  throw new Error('dia.Graph: cell to remove does not exist in the graph.');
28015
28039
  }
28016
28040
  if (cell.graph !== this) return;
28017
- this.startBatch('remove');
28041
+ this.startBatch('remove', options);
28018
28042
  cell.collection.remove(cell, options);
28019
- this.stopBatch('remove');
28043
+ this.stopBatch('remove', options);
28020
28044
  },
28021
28045
  transferCellEmbeds: function (sourceCell, targetCell, opt = {}) {
28022
28046
  const batchName = 'transfer-embeds';
28023
- this.startBatch(batchName);
28047
+ this.startBatch(batchName, opt);
28024
28048
 
28025
28049
  // Embed children of the source cell in the target cell.
28026
28050
  const children = sourceCell.getEmbeddedCells();
@@ -28028,11 +28052,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28028
28052
  ...opt,
28029
28053
  reparent: true
28030
28054
  });
28031
- this.stopBatch(batchName);
28055
+ this.stopBatch(batchName, opt);
28032
28056
  },
28033
28057
  transferCellConnectedLinks: function (sourceCell, targetCell, opt = {}) {
28034
28058
  const batchName = 'transfer-connected-links';
28035
- this.startBatch(batchName);
28059
+ this.startBatch(batchName, opt);
28036
28060
 
28037
28061
  // Reconnect all the links connected to the old cell to the new cell.
28038
28062
  const connectedLinks = this.getConnectedLinks(sourceCell, opt);
@@ -28044,7 +28068,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28044
28068
  link.prop(['target', 'id'], targetCell.id, opt);
28045
28069
  }
28046
28070
  });
28047
- this.stopBatch(batchName);
28071
+ this.stopBatch(batchName, opt);
28048
28072
  },
28049
28073
  /**
28050
28074
  * @private
@@ -36771,7 +36795,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
36771
36795
  if (view) {
36772
36796
  // The view could have been disposed during dragging
36773
36797
  // e.g. dragged outside of the viewport and hidden
36774
- view = this.findViewByModel(view.model);
36798
+ // The model can be removed in previous mousemove event handlers
36799
+ view = this.findViewByModel(view.model) || view;
36775
36800
  view.pointermove(evt, localPoint.x, localPoint.y);
36776
36801
  } else {
36777
36802
  this.trigger('blank:pointermove', evt, localPoint.x, localPoint.y);
@@ -36786,7 +36811,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
36786
36811
  if (view) {
36787
36812
  // The view could have been disposed during dragging
36788
36813
  // e.g. dragged outside of the viewport and hidden
36789
- 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;
36790
36816
  view.pointerup(normalizedEvt, localPoint.x, localPoint.y);
36791
36817
  } else {
36792
36818
  this.trigger('blank:pointerup', normalizedEvt, localPoint.x, localPoint.y);
@@ -39678,7 +39704,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39678
39704
  Remove: Remove
39679
39705
  };
39680
39706
 
39681
- var version = "4.2.3";
39707
+ var version = "4.2.4";
39682
39708
 
39683
39709
  const Vectorizer = V;
39684
39710
  const layout$1 = {