@joint/core 4.0.2 → 4.0.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JointJS - JavaScript diagramming library powering exceptional UIs
2
2
 
3
- [![Build Status](https://travis-ci.com/clientIO/joint.svg?branch=master)](https://travis-ci.com/clientIO/joint)
3
+ [![Build Status](https://app.travis-ci.com/clientIO/joint.svg?token=YC3doXGarvYwgzfqe9zy&branch=master)](https://app.travis-ci.com/clientIO/joint)
4
4
  [![Total Discussion](https://img.shields.io/github/discussions/badges/shields)](https://github.com/clientIO/joint/discussions)
5
5
  [![NPM Version](https://img.shields.io/npm/v/jointjs)](https://www.npmjs.com/package/jointjs)
6
6
  [![NPM License](https://img.shields.io/npm/l/jointjs?color=blue)](https://github.com/clientIO/joint/blob/master/LICENSE)
package/dist/geometry.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.2 (2024-04-09) - JavaScript diagramming library
1
+ /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.2 (2024-04-09) - JavaScript diagramming library
1
+ /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
package/dist/joint.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.2 (2024-04-09) - JavaScript diagramming library
1
+ /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -4487,6 +4487,8 @@ export declare namespace mvc {
4487
4487
 
4488
4488
  isMounted(): boolean;
4489
4489
 
4490
+ protected findAttributeNode(attributeName: string, node: Element): Element | null;
4491
+
4490
4492
  protected init(): void;
4491
4493
 
4492
4494
  protected onRender(): void;
package/dist/joint.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.2 (2024-04-09) - JavaScript diagramming library
1
+ /*! JointJS v4.0.3 (2024-05-14) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -20344,6 +20344,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
20344
20344
  'port-group': port.group
20345
20345
  });
20346
20346
 
20347
+ // If the port ID is a number, we need to add
20348
+ // extra information to the port element to distinguish
20349
+ // between ports with the same ID but different types.
20350
+ if (isNumber(port.id)) {
20351
+ portElement.attr('port-id-type', 'number');
20352
+ }
20353
+
20347
20354
  var labelMarkupDef = this._getPortLabelMarkup(port.label);
20348
20355
  if (Array.isArray(labelMarkupDef)) {
20349
20356
  // JSON Markup
@@ -23866,23 +23873,25 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
23866
23873
  return this;
23867
23874
  },
23868
23875
 
23869
- findAttribute: function(attributeName, node) {
23870
-
23876
+ findAttributeNode: function(attributeName, node) {
23871
23877
  var currentNode = node;
23872
-
23873
23878
  while (currentNode && currentNode.nodeType === 1) {
23874
- var attributeValue = currentNode.getAttribute(attributeName);
23875
23879
  // attribute found
23876
- if (attributeValue) { return attributeValue; }
23880
+ // (empty value does not count as attribute found)
23881
+ if (currentNode.getAttribute(attributeName)) { return currentNode; }
23877
23882
  // do not climb up the DOM
23878
23883
  if (currentNode === this.el) { return null; }
23879
23884
  // try parent node
23880
23885
  currentNode = currentNode.parentNode;
23881
23886
  }
23882
-
23883
23887
  return null;
23884
23888
  },
23885
23889
 
23890
+ findAttribute: function(attributeName, node) {
23891
+ var matchedNode = this.findAttributeNode(attributeName, node);
23892
+ return matchedNode && matchedNode.getAttribute(attributeName);
23893
+ },
23894
+
23886
23895
  // Override the mvc ViewBase `_ensureElement()` method in order to create an
23887
23896
  // svg element (e.g., `<g>`) node that wraps all the nodes of the Cell view.
23888
23897
  // Expose class name setter as a separate method.
@@ -30606,13 +30615,18 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
30606
30615
 
30607
30616
  var model = this.model;
30608
30617
  var id = model.id;
30609
- var port = this.findAttribute('port', magnet);
30618
+ // Find a node with the `port` attribute set on it.
30619
+ var portNode = this.findAttributeNode('port', magnet);
30610
30620
  // Find a unique `selector` of the element under pointer that is a magnet.
30611
30621
  var selector = magnet.getAttribute('joint-selector');
30612
30622
 
30613
30623
  var end = { id: id };
30614
30624
  if (selector != null) { end.magnet = selector; }
30615
- if (port != null) {
30625
+ if (portNode != null) {
30626
+ var port = portNode.getAttribute('port');
30627
+ if (portNode.getAttribute('port-id-type') === 'number') {
30628
+ port = parseInt(port, 10);
30629
+ }
30616
30630
  end.port = port;
30617
30631
  if (!model.hasPort(port) && !selector) {
30618
30632
  // port created via the `port` attribute (not API)
@@ -34667,6 +34681,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34667
34681
  },
34668
34682
 
34669
34683
  renderGrid: function renderGrid() {
34684
+ var this$1 = this;
34685
+
34670
34686
 
34671
34687
  var ref = this;
34672
34688
  var paper = ref.options.paper;
@@ -34686,7 +34702,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34686
34702
 
34687
34703
  gridSettings.forEach(function (gridLayerSetting, index) {
34688
34704
 
34689
- var id = 'pattern_' + index;
34705
+ var id = this$1._getPatternId(index);
34690
34706
  var options = merge({}, gridLayerSetting);
34691
34707
  var scaleFactor = options.scaleFactor; if ( scaleFactor === void 0 ) scaleFactor = 1;
34692
34708
  options.width = gridSize * scaleFactor || 1;
@@ -34714,6 +34730,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34714
34730
  },
34715
34731
 
34716
34732
  updateGrid: function updateGrid() {
34733
+ var this$1 = this;
34734
+
34717
34735
 
34718
34736
  var ref = this;
34719
34737
  var grid = ref._gridCache;
@@ -34734,12 +34752,16 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34734
34752
  }
34735
34753
  gridSettings.forEach(function (options, index) {
34736
34754
  if (isFunction(options.update)) {
34737
- var vPattern = patterns['pattern_' + index];
34755
+ var vPattern = patterns[this$1._getPatternId(index)];
34738
34756
  options.update(vPattern.node.firstChild, options, paper);
34739
34757
  }
34740
34758
  });
34741
34759
  },
34742
34760
 
34761
+ _getPatternId: function _getPatternId(index) {
34762
+ return ("pattern_" + (this.options.paper.cid) + "_" + index);
34763
+ },
34764
+
34743
34765
  _getGridRefs: function _getGridRefs() {
34744
34766
  var ref = this;
34745
34767
  var grid = ref._gridCache;
@@ -38964,12 +38986,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
38964
38986
  evt.stopPropagation();
38965
38987
  evt.preventDefault();
38966
38988
  var relatedView = this.relatedView;
38989
+ var paper = relatedView.paper;
38967
38990
  relatedView.model.startBatch('arrowhead-move', { ui: true, tool: this.cid });
38968
38991
  relatedView.startArrowheadMove(this.arrowheadType);
38969
38992
  this.delegateDocumentEvents();
38970
- relatedView.paper.undelegateEvents();
38993
+ paper.undelegateEvents();
38971
38994
  this.focus();
38972
38995
  this.el.style.pointerEvents = 'none';
38996
+ relatedView.notifyPointerdown.apply(relatedView, paper.getPointerArgs(evt));
38973
38997
  },
38974
38998
  onPointerMove: function(evt) {
38975
38999
  var normalizedEvent = normalizeEvent(evt);
@@ -39924,7 +39948,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39924
39948
  Control: Control
39925
39949
  });
39926
39950
 
39927
- var version = "4.0.2";
39951
+ var version = "4.0.3";
39928
39952
 
39929
39953
  var Vectorizer = V;
39930
39954
  var layout = { PortLabel: PortLabel, Port: Port };