@joint/core 4.0.2 → 4.0.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/README.md +3 -3
- package/dist/geometry.js +1 -1
- package/dist/geometry.min.js +1 -1
- package/dist/joint.d.ts +15 -3
- package/dist/joint.js +87 -23
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +87 -23
- package/dist/joint.nowrap.min.js +2 -2
- package/dist/vectorizer.js +1 -1
- package/dist/vectorizer.min.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +3 -2
- package/src/dia/CellView.mjs +11 -6
- package/src/dia/LinkView.mjs +19 -1
- package/src/dia/attributes/text.mjs +26 -10
- package/src/dia/layers/GridLayer.mjs +6 -2
- package/src/dia/ports.mjs +7 -0
- package/src/env/index.mjs +5 -0
- package/src/linkTools/Arrowhead.mjs +3 -1
- package/src/mvc/View.mjs +9 -7
- package/types/joint.d.ts +14 -2
package/dist/joint.nowrap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! JointJS v4.0.
|
|
1
|
+
/*! JointJS v4.0.4 (2024-05-31) - JavaScript diagramming library
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -17407,6 +17407,8 @@ var joint = (function (exports) {
|
|
|
17407
17407
|
return (attrs.text !== undefined);
|
|
17408
17408
|
}
|
|
17409
17409
|
|
|
17410
|
+
var FONT_ATTRIBUTES = ['font-weight', 'font-family', 'font-size', 'letter-spacing', 'text-transform'];
|
|
17411
|
+
|
|
17410
17412
|
var textAttributesNS = {
|
|
17411
17413
|
|
|
17412
17414
|
'line-height': {
|
|
@@ -17522,18 +17524,28 @@ var joint = (function (exports) {
|
|
|
17522
17524
|
var text = value.text;
|
|
17523
17525
|
if (text === undefined) { text = attrs.text; }
|
|
17524
17526
|
if (text !== undefined) {
|
|
17527
|
+
|
|
17525
17528
|
var breakTextFn = value.breakText || breakText;
|
|
17526
17529
|
var computedStyles = getComputedStyle(node);
|
|
17530
|
+
var wrapFontAttributes = {};
|
|
17531
|
+
// The font size attributes must be set on the node
|
|
17532
|
+
// to get the correct text wrapping.
|
|
17533
|
+
// TODO: set the native SVG attributes before special attributes
|
|
17534
|
+
for (var i = 0; i < FONT_ATTRIBUTES.length; i++) {
|
|
17535
|
+
var name = FONT_ATTRIBUTES[i];
|
|
17536
|
+
if (name in attrs) {
|
|
17537
|
+
node.setAttribute(name, attrs[name]);
|
|
17538
|
+
}
|
|
17539
|
+
// Note: computedStyles is a live object
|
|
17540
|
+
// i.e. the properties are evaluated when accessed.
|
|
17541
|
+
wrapFontAttributes[name] = computedStyles[name];
|
|
17542
|
+
}
|
|
17527
17543
|
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
'letter-spacing': computedStyles.letterSpacing,
|
|
17534
|
-
// The `line-height` attribute in SVG is JoinJS specific.
|
|
17535
|
-
'lineHeight': attrs['line-height'],
|
|
17536
|
-
}, {
|
|
17544
|
+
// The `line-height` attribute in SVG is JoinJS specific.
|
|
17545
|
+
// TODO: change the `lineHeight` to breakText option.
|
|
17546
|
+
wrapFontAttributes.lineHeight = attrs['line-height'];
|
|
17547
|
+
|
|
17548
|
+
wrappedText = breakTextFn('' + text, size, wrapFontAttributes, {
|
|
17537
17549
|
// Provide an existing SVG Document here
|
|
17538
17550
|
// instead of creating a temporary one over again.
|
|
17539
17551
|
svgDocument: this.paper.svg,
|
|
@@ -17547,7 +17559,11 @@ var joint = (function (exports) {
|
|
|
17547
17559
|
wrappedText = '';
|
|
17548
17560
|
}
|
|
17549
17561
|
textAttributesNS.text.set.call(this, wrappedText, refBBox, node, attrs);
|
|
17550
|
-
}
|
|
17562
|
+
},
|
|
17563
|
+
// We expose the font attributes list to allow
|
|
17564
|
+
// the user to take other custom font attributes into account
|
|
17565
|
+
// when wrapping the text.
|
|
17566
|
+
FONT_ATTRIBUTES: FONT_ATTRIBUTES
|
|
17551
17567
|
},
|
|
17552
17568
|
|
|
17553
17569
|
'title': {
|
|
@@ -20341,6 +20357,13 @@ var joint = (function (exports) {
|
|
|
20341
20357
|
'port-group': port.group
|
|
20342
20358
|
});
|
|
20343
20359
|
|
|
20360
|
+
// If the port ID is a number, we need to add
|
|
20361
|
+
// extra information to the port element to distinguish
|
|
20362
|
+
// between ports with the same ID but different types.
|
|
20363
|
+
if (isNumber(port.id)) {
|
|
20364
|
+
portElement.attr('port-id-type', 'number');
|
|
20365
|
+
}
|
|
20366
|
+
|
|
20344
20367
|
var labelMarkupDef = this._getPortLabelMarkup(port.label);
|
|
20345
20368
|
if (Array.isArray(labelMarkupDef)) {
|
|
20346
20369
|
// JSON Markup
|
|
@@ -21607,6 +21630,11 @@ var joint = (function (exports) {
|
|
|
21607
21630
|
svgforeignobject: function() {
|
|
21608
21631
|
return !!document.createElementNS &&
|
|
21609
21632
|
/SVGForeignObject/.test(({}).toString.call(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject')));
|
|
21633
|
+
},
|
|
21634
|
+
|
|
21635
|
+
// works for iOS browsers too
|
|
21636
|
+
isSafari: function() {
|
|
21637
|
+
return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
|
|
21610
21638
|
}
|
|
21611
21639
|
},
|
|
21612
21640
|
|
|
@@ -23863,23 +23891,25 @@ var joint = (function (exports) {
|
|
|
23863
23891
|
return this;
|
|
23864
23892
|
},
|
|
23865
23893
|
|
|
23866
|
-
|
|
23867
|
-
|
|
23894
|
+
findAttributeNode: function(attributeName, node) {
|
|
23868
23895
|
var currentNode = node;
|
|
23869
|
-
|
|
23870
23896
|
while (currentNode && currentNode.nodeType === 1) {
|
|
23871
|
-
var attributeValue = currentNode.getAttribute(attributeName);
|
|
23872
23897
|
// attribute found
|
|
23873
|
-
|
|
23898
|
+
// (empty value does not count as attribute found)
|
|
23899
|
+
if (currentNode.getAttribute(attributeName)) { return currentNode; }
|
|
23874
23900
|
// do not climb up the DOM
|
|
23875
23901
|
if (currentNode === this.el) { return null; }
|
|
23876
23902
|
// try parent node
|
|
23877
23903
|
currentNode = currentNode.parentNode;
|
|
23878
23904
|
}
|
|
23879
|
-
|
|
23880
23905
|
return null;
|
|
23881
23906
|
},
|
|
23882
23907
|
|
|
23908
|
+
findAttribute: function(attributeName, node) {
|
|
23909
|
+
var matchedNode = this.findAttributeNode(attributeName, node);
|
|
23910
|
+
return matchedNode && matchedNode.getAttribute(attributeName);
|
|
23911
|
+
},
|
|
23912
|
+
|
|
23883
23913
|
// Override the mvc ViewBase `_ensureElement()` method in order to create an
|
|
23884
23914
|
// svg element (e.g., `<g>`) node that wraps all the nodes of the Cell view.
|
|
23885
23915
|
// Expose class name setter as a separate method.
|
|
@@ -30603,13 +30633,18 @@ var joint = (function (exports) {
|
|
|
30603
30633
|
|
|
30604
30634
|
var model = this.model;
|
|
30605
30635
|
var id = model.id;
|
|
30606
|
-
|
|
30636
|
+
// Find a node with the `port` attribute set on it.
|
|
30637
|
+
var portNode = this.findAttributeNode('port', magnet);
|
|
30607
30638
|
// Find a unique `selector` of the element under pointer that is a magnet.
|
|
30608
30639
|
var selector = magnet.getAttribute('joint-selector');
|
|
30609
30640
|
|
|
30610
30641
|
var end = { id: id };
|
|
30611
30642
|
if (selector != null) { end.magnet = selector; }
|
|
30612
|
-
if (
|
|
30643
|
+
if (portNode != null) {
|
|
30644
|
+
var port = portNode.getAttribute('port');
|
|
30645
|
+
if (portNode.getAttribute('port-id-type') === 'number') {
|
|
30646
|
+
port = parseInt(port, 10);
|
|
30647
|
+
}
|
|
30613
30648
|
end.port = port;
|
|
30614
30649
|
if (!model.hasPort(port) && !selector) {
|
|
30615
30650
|
// port created via the `port` attribute (not API)
|
|
@@ -32468,6 +32503,11 @@ var joint = (function (exports) {
|
|
|
32468
32503
|
this.updateHighlighters(true);
|
|
32469
32504
|
this.updateTools(opt);
|
|
32470
32505
|
flags = this.removeFlag(flags, [Flags$2.RENDER, Flags$2.UPDATE, Flags$2.LABELS, Flags$2.TOOLS, Flags$2.CONNECTOR]);
|
|
32506
|
+
|
|
32507
|
+
if (env.test('isSafari')) {
|
|
32508
|
+
this.__fixSafariBug268376();
|
|
32509
|
+
}
|
|
32510
|
+
|
|
32471
32511
|
return flags;
|
|
32472
32512
|
}
|
|
32473
32513
|
|
|
@@ -32521,6 +32561,20 @@ var joint = (function (exports) {
|
|
|
32521
32561
|
return flags;
|
|
32522
32562
|
},
|
|
32523
32563
|
|
|
32564
|
+
__fixSafariBug268376: function() {
|
|
32565
|
+
// Safari has a bug where any change after the first render is not reflected in the DOM.
|
|
32566
|
+
// https://bugs.webkit.org/show_bug.cgi?id=268376
|
|
32567
|
+
var ref = this;
|
|
32568
|
+
var el = ref.el;
|
|
32569
|
+
var childNodes = Array.from(el.childNodes);
|
|
32570
|
+
var fragment = document.createDocumentFragment();
|
|
32571
|
+
for (var i = 0, n = childNodes.length; i < n; i++) {
|
|
32572
|
+
el.removeChild(childNodes[i]);
|
|
32573
|
+
fragment.appendChild(childNodes[i]);
|
|
32574
|
+
}
|
|
32575
|
+
el.appendChild(fragment);
|
|
32576
|
+
},
|
|
32577
|
+
|
|
32524
32578
|
requestConnectionUpdate: function(opt) {
|
|
32525
32579
|
this.requestUpdate(this.getFlag(Flags$2.UPDATE), opt);
|
|
32526
32580
|
},
|
|
@@ -34664,6 +34718,8 @@ var joint = (function (exports) {
|
|
|
34664
34718
|
},
|
|
34665
34719
|
|
|
34666
34720
|
renderGrid: function renderGrid() {
|
|
34721
|
+
var this$1 = this;
|
|
34722
|
+
|
|
34667
34723
|
|
|
34668
34724
|
var ref = this;
|
|
34669
34725
|
var paper = ref.options.paper;
|
|
@@ -34683,7 +34739,7 @@ var joint = (function (exports) {
|
|
|
34683
34739
|
|
|
34684
34740
|
gridSettings.forEach(function (gridLayerSetting, index) {
|
|
34685
34741
|
|
|
34686
|
-
var id =
|
|
34742
|
+
var id = this$1._getPatternId(index);
|
|
34687
34743
|
var options = merge({}, gridLayerSetting);
|
|
34688
34744
|
var scaleFactor = options.scaleFactor; if ( scaleFactor === void 0 ) scaleFactor = 1;
|
|
34689
34745
|
options.width = gridSize * scaleFactor || 1;
|
|
@@ -34711,6 +34767,8 @@ var joint = (function (exports) {
|
|
|
34711
34767
|
},
|
|
34712
34768
|
|
|
34713
34769
|
updateGrid: function updateGrid() {
|
|
34770
|
+
var this$1 = this;
|
|
34771
|
+
|
|
34714
34772
|
|
|
34715
34773
|
var ref = this;
|
|
34716
34774
|
var grid = ref._gridCache;
|
|
@@ -34731,12 +34789,16 @@ var joint = (function (exports) {
|
|
|
34731
34789
|
}
|
|
34732
34790
|
gridSettings.forEach(function (options, index) {
|
|
34733
34791
|
if (isFunction(options.update)) {
|
|
34734
|
-
var vPattern = patterns[
|
|
34792
|
+
var vPattern = patterns[this$1._getPatternId(index)];
|
|
34735
34793
|
options.update(vPattern.node.firstChild, options, paper);
|
|
34736
34794
|
}
|
|
34737
34795
|
});
|
|
34738
34796
|
},
|
|
34739
34797
|
|
|
34798
|
+
_getPatternId: function _getPatternId(index) {
|
|
34799
|
+
return ("pattern_" + (this.options.paper.cid) + "_" + index);
|
|
34800
|
+
},
|
|
34801
|
+
|
|
34740
34802
|
_getGridRefs: function _getGridRefs() {
|
|
34741
34803
|
var ref = this;
|
|
34742
34804
|
var grid = ref._gridCache;
|
|
@@ -38961,12 +39023,14 @@ var joint = (function (exports) {
|
|
|
38961
39023
|
evt.stopPropagation();
|
|
38962
39024
|
evt.preventDefault();
|
|
38963
39025
|
var relatedView = this.relatedView;
|
|
39026
|
+
var paper = relatedView.paper;
|
|
38964
39027
|
relatedView.model.startBatch('arrowhead-move', { ui: true, tool: this.cid });
|
|
38965
39028
|
relatedView.startArrowheadMove(this.arrowheadType);
|
|
38966
39029
|
this.delegateDocumentEvents();
|
|
38967
|
-
|
|
39030
|
+
paper.undelegateEvents();
|
|
38968
39031
|
this.focus();
|
|
38969
39032
|
this.el.style.pointerEvents = 'none';
|
|
39033
|
+
relatedView.notifyPointerdown.apply(relatedView, paper.getPointerArgs(evt));
|
|
38970
39034
|
},
|
|
38971
39035
|
onPointerMove: function(evt) {
|
|
38972
39036
|
var normalizedEvent = normalizeEvent(evt);
|
|
@@ -39921,7 +39985,7 @@ var joint = (function (exports) {
|
|
|
39921
39985
|
Control: Control
|
|
39922
39986
|
});
|
|
39923
39987
|
|
|
39924
|
-
var version = "4.0.
|
|
39988
|
+
var version = "4.0.4";
|
|
39925
39989
|
|
|
39926
39990
|
var Vectorizer = V;
|
|
39927
39991
|
var layout = { PortLabel: PortLabel, Port: Port };
|