@joint/core 4.1.3 → 4.2.0-alpha.1
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 +4 -2
- package/dist/geometry.js +129 -124
- package/dist/geometry.min.js +4 -3
- package/dist/joint.d.ts +352 -160
- package/dist/joint.js +3654 -2191
- package/dist/joint.min.js +4 -3
- package/dist/joint.nowrap.js +3653 -2188
- package/dist/joint.nowrap.min.js +4 -3
- package/dist/vectorizer.js +489 -279
- package/dist/vectorizer.min.js +4 -3
- package/dist/version.mjs +1 -1
- package/package.json +33 -27
- package/src/V/create.mjs +51 -0
- package/src/V/index.mjs +89 -159
- package/src/V/namespace.mjs +9 -0
- package/src/V/transform.mjs +183 -0
- package/src/V/traverse.mjs +16 -0
- package/src/alg/Deque.mjs +126 -0
- package/src/anchors/index.mjs +140 -33
- package/src/cellTools/Boundary.mjs +15 -13
- package/src/cellTools/Button.mjs +7 -5
- package/src/cellTools/Control.mjs +38 -15
- package/src/cellTools/HoverConnect.mjs +5 -1
- package/src/cellTools/helpers.mjs +44 -3
- package/src/config/index.mjs +8 -0
- package/src/connectionPoints/index.mjs +24 -9
- package/src/connectionStrategies/index.mjs +1 -1
- package/src/connectors/jumpover.mjs +1 -1
- package/src/dia/Cell.mjs +32 -12
- package/src/dia/CellView.mjs +53 -38
- package/src/dia/Element.mjs +81 -35
- package/src/dia/ElementView.mjs +2 -1
- package/src/dia/HighlighterView.mjs +54 -11
- package/src/dia/LinkView.mjs +118 -98
- package/src/dia/Paper.mjs +831 -231
- package/src/dia/PaperLayer.mjs +9 -2
- package/src/dia/ToolView.mjs +4 -0
- package/src/dia/ToolsView.mjs +12 -3
- package/src/dia/attributes/text.mjs +16 -5
- package/src/dia/layers/GridLayer.mjs +5 -0
- package/src/dia/ports.mjs +344 -111
- package/src/elementTools/HoverConnect.mjs +14 -8
- package/src/env/index.mjs +7 -4
- package/src/g/rect.mjs +7 -0
- package/src/highlighters/stroke.mjs +1 -1
- package/src/layout/ports/port.mjs +30 -15
- package/src/layout/ports/portLabel.mjs +1 -1
- package/src/linkAnchors/index.mjs +2 -2
- package/src/linkTools/Anchor.mjs +2 -2
- package/src/linkTools/Vertices.mjs +4 -6
- package/src/mvc/View.mjs +4 -0
- package/src/mvc/ViewBase.mjs +1 -1
- package/src/util/util.mjs +1 -1
- package/src/util/utilHelpers.mjs +2 -0
- package/types/geometry.d.ts +65 -59
- package/types/joint.d.ts +278 -102
- package/types/vectorizer.d.ts +11 -1
- package/src/V/annotation.mjs +0 -0
package/src/dia/PaperLayer.mjs
CHANGED
|
@@ -22,7 +22,9 @@ export const PaperLayer = View.extend({
|
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
className: function() {
|
|
25
|
-
|
|
25
|
+
const { name } = this.options;
|
|
26
|
+
if (!name) return null;
|
|
27
|
+
return addClassNamePrefix(`${name}-layer`);
|
|
26
28
|
},
|
|
27
29
|
|
|
28
30
|
init: function() {
|
|
@@ -70,6 +72,11 @@ export const PaperLayer = View.extend({
|
|
|
70
72
|
const { el, pivotNodes } = this;
|
|
71
73
|
for (let z in pivotNodes) el.removeChild(pivotNodes[z]);
|
|
72
74
|
this.pivotNodes = {};
|
|
73
|
-
}
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
isEmpty: function() {
|
|
78
|
+
// Check if the layer has any child elements (pivot comments are not counted).
|
|
79
|
+
return this.el.children.length === 0;
|
|
80
|
+
},
|
|
74
81
|
|
|
75
82
|
});
|
package/src/dia/ToolView.mjs
CHANGED
|
@@ -69,6 +69,10 @@ export const ToolView = mvc.View.extend({
|
|
|
69
69
|
return !!this._visible;
|
|
70
70
|
},
|
|
71
71
|
|
|
72
|
+
isOverlay: function() {
|
|
73
|
+
return !!this.parentView && this.parentView.hasLayer();
|
|
74
|
+
},
|
|
75
|
+
|
|
72
76
|
focus: function() {
|
|
73
77
|
var opacity = this.options.focusOpacity;
|
|
74
78
|
if (isFinite(opacity)) this.el.style.opacity = opacity;
|
package/src/dia/ToolsView.mjs
CHANGED
|
@@ -138,12 +138,21 @@ export const ToolsView = mvc.View.extend({
|
|
|
138
138
|
this.tools = null;
|
|
139
139
|
},
|
|
140
140
|
|
|
141
|
+
getLayer() {
|
|
142
|
+
const { layer = LayersNames.TOOLS } = this.options;
|
|
143
|
+
return layer;
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
hasLayer() {
|
|
147
|
+
return !!this.getLayer();
|
|
148
|
+
},
|
|
149
|
+
|
|
141
150
|
mount: function() {
|
|
142
151
|
const { options, el } = this;
|
|
143
|
-
const { relatedView,
|
|
152
|
+
const { relatedView, z } = options;
|
|
144
153
|
if (relatedView) {
|
|
145
|
-
if (
|
|
146
|
-
relatedView.paper.getLayerView(
|
|
154
|
+
if (this.hasLayer()) {
|
|
155
|
+
relatedView.paper.getLayerView(this.getLayer()).insertSortedNode(el, z);
|
|
147
156
|
} else {
|
|
148
157
|
relatedView.el.appendChild(el);
|
|
149
158
|
}
|
|
@@ -54,9 +54,10 @@ const textAttributesNS = {
|
|
|
54
54
|
const eol = attrs.eol;
|
|
55
55
|
const x = attrs.x;
|
|
56
56
|
let textPath = attrs['text-path'];
|
|
57
|
+
const useNoBreakSpace = attrs['use-no-break-space'] === true;
|
|
57
58
|
// Update the text only if there was a change in the string
|
|
58
59
|
// or any of its attributes.
|
|
59
|
-
const textHash = JSON.stringify([text, lineHeight, annotations, textVerticalAnchor, eol, displayEmpty, textPath, x, fontSize]);
|
|
60
|
+
const textHash = JSON.stringify([text, lineHeight, annotations, textVerticalAnchor, eol, displayEmpty, textPath, x, fontSize, useNoBreakSpace]);
|
|
60
61
|
if (cache === undefined || cache !== textHash) {
|
|
61
62
|
// Chrome bug:
|
|
62
63
|
// <tspan> positions defined as `em` are not updated
|
|
@@ -79,7 +80,8 @@ const textAttributesNS = {
|
|
|
79
80
|
x,
|
|
80
81
|
textVerticalAnchor,
|
|
81
82
|
eol,
|
|
82
|
-
displayEmpty
|
|
83
|
+
displayEmpty,
|
|
84
|
+
useNoBreakSpace
|
|
83
85
|
});
|
|
84
86
|
$.data.set(node, cacheName, textHash);
|
|
85
87
|
}
|
|
@@ -148,10 +150,19 @@ const textAttributesNS = {
|
|
|
148
150
|
// TODO: change the `lineHeight` to breakText option.
|
|
149
151
|
wrapFontAttributes.lineHeight = attrs['line-height'];
|
|
150
152
|
|
|
153
|
+
let svgDocument = this.paper.svg;
|
|
154
|
+
if (!svgDocument.checkVisibility()) {
|
|
155
|
+
// If the paper is visible, we can utilize
|
|
156
|
+
// its SVG element to measure the text size
|
|
157
|
+
// when breaking the text.
|
|
158
|
+
// Otherwise, we need to create a temporary
|
|
159
|
+
// SVG document and append it to the DOM,
|
|
160
|
+
// (the default behavior of `breakText`).
|
|
161
|
+
svgDocument = null;
|
|
162
|
+
}
|
|
163
|
+
|
|
151
164
|
wrappedText = breakTextFn('' + text, size, wrapFontAttributes, {
|
|
152
|
-
|
|
153
|
-
// instead of creating a temporary one over again.
|
|
154
|
-
svgDocument: this.paper.svg,
|
|
165
|
+
svgDocument,
|
|
155
166
|
ellipsis: value.ellipsis,
|
|
156
167
|
hyphen: value.hyphen,
|
|
157
168
|
separator: value.separator,
|