@joint/core 4.2.1 → 4.2.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 +2 -2
- package/dist/geometry.js +1 -1
- package/dist/geometry.min.js +1 -1
- package/dist/joint.d.ts +6 -4
- package/dist/joint.js +106 -73
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +106 -73
- 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 +6 -14
- package/src/cellTools/Button.mjs +3 -1
- package/src/cellTools/Control.mjs +1 -1
- package/src/connectionPoints/index.mjs +1 -1
- package/src/connectors/curve.mjs +2 -4
- package/src/dia/Cell.mjs +5 -6
- package/src/dia/Graph.mjs +19 -3
- package/src/dia/GraphLayerCollection.mjs +2 -3
- package/src/dia/HighlighterView.mjs +5 -5
- package/src/dia/LayerView.mjs +1 -1
- package/src/dia/LinkView.mjs +1 -1
- package/src/dia/Paper.mjs +21 -13
- package/src/dia/attributes/eval.mjs +1 -1
- package/src/dia/ports.mjs +2 -2
- package/src/elementTools/HoverConnect.mjs +4 -3
- package/src/layout/ports/port.mjs +1 -1
- package/src/linkTools/RotateLabel.mjs +2 -1
- package/src/linkTools/Segments.mjs +1 -1
- package/src/mvc/Dom/Dom.mjs +2 -2
- package/src/mvc/Dom/animations.mjs +2 -6
- package/src/mvc/Dom/methods.mjs +3 -3
- package/src/mvc/Dom/props.mjs +1 -1
- package/src/mvc/Listener.mjs +1 -0
- package/src/routers/rightAngle.mjs +9 -9
- package/src/util/calc.mjs +1 -1
- package/src/util/util.mjs +2 -4
- package/src/util/utilHelpers.mjs +5 -5
- package/types/joint.d.ts +7 -5
- package/types/vectorizer.d.ts +1 -1
package/dist/vectorizer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! JointJS v4.2.
|
|
1
|
+
/*! JointJS v4.2.3 (2026-01-21) - 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/vectorizer.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! JointJS v4.2.
|
|
1
|
+
/*! JointJS v4.2.3 (2026-01-21) - 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/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joint/core",
|
|
3
3
|
"title": "JointJS",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.3",
|
|
5
5
|
"description": "JavaScript diagramming library",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/joint.min.js",
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
"scripts": {
|
|
41
41
|
"prepublishOnly": "echo \"Publishing via NPM is not allowed!\" && exit 1",
|
|
42
42
|
"prepack": "yarn run dist",
|
|
43
|
+
"dist": "grunt dist",
|
|
43
44
|
"build": "grunt install",
|
|
45
|
+
"build-bundles": "grunt build:bundles",
|
|
44
46
|
"test": "grunt test",
|
|
45
47
|
"test-server": "grunt test:server",
|
|
46
48
|
"test-client": "grunt test:client",
|
|
@@ -48,12 +50,10 @@
|
|
|
48
50
|
"test-coverage": "grunt test:coverage",
|
|
49
51
|
"test-coverage-lcov": "yarn run test-coverage --reporter=lcov",
|
|
50
52
|
"test-bundles": "grunt test:bundles",
|
|
51
|
-
"build-bundles": "grunt build:bundles",
|
|
52
53
|
"test-e2e": "grunt test:e2e",
|
|
53
54
|
"test-e2e-all": "grunt test:e2e:all",
|
|
54
55
|
"lint": "eslint .",
|
|
55
|
-
"lint-fix": "yarn run lint --fix"
|
|
56
|
-
"dist": "grunt dist"
|
|
56
|
+
"lint-fix": "yarn run lint --fix"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"dist/",
|
|
@@ -69,19 +69,15 @@
|
|
|
69
69
|
"@babel/plugin-transform-nullish-coalescing-operator": "7.26.6",
|
|
70
70
|
"@babel/plugin-transform-optional-chaining": "7.25.9",
|
|
71
71
|
"@babel/preset-env": "7.26.9",
|
|
72
|
-
"@eslint
|
|
72
|
+
"@joint/eslint-config": "4.2.3",
|
|
73
73
|
"@microsoft/api-extractor": "7.52.10",
|
|
74
74
|
"@rollup/plugin-babel": "^6.0.4",
|
|
75
|
-
"@stylistic/eslint-plugin": "5.5.0",
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "8.46.2",
|
|
77
|
-
"@typescript-eslint/parser": "8.46.2",
|
|
78
75
|
"async": "2.6.1",
|
|
79
76
|
"chai": "4.2.0",
|
|
80
77
|
"core-js": "~3.8.3",
|
|
81
78
|
"es-module-shims": "0.2.4",
|
|
82
|
-
"eslint": "9.
|
|
79
|
+
"eslint": "9.39.2",
|
|
83
80
|
"express": "4.21.2",
|
|
84
|
-
"globals": "16.0.0",
|
|
85
81
|
"grunt": "1.6.1",
|
|
86
82
|
"grunt-browserify": "5.3.0",
|
|
87
83
|
"grunt-contrib-clean": "2.0.0",
|
|
@@ -91,7 +87,6 @@
|
|
|
91
87
|
"grunt-contrib-uglify": "4.0.1",
|
|
92
88
|
"grunt-contrib-watch": "1.1.0",
|
|
93
89
|
"grunt-env": "0.4.4",
|
|
94
|
-
"grunt-eslint": "21.0.0",
|
|
95
90
|
"grunt-karma": "4.0.2",
|
|
96
91
|
"grunt-mocha-test": "0.13.3",
|
|
97
92
|
"grunt-newer": "1.3.0",
|
|
@@ -130,9 +125,6 @@
|
|
|
130
125
|
"npm": "11.2.0",
|
|
131
126
|
"yarn": "4.7.0"
|
|
132
127
|
},
|
|
133
|
-
"resolutions": {
|
|
134
|
-
"globals": "16.0.0"
|
|
135
|
-
},
|
|
136
128
|
"keywords": [
|
|
137
129
|
"joint",
|
|
138
130
|
"jointjs",
|
package/src/cellTools/Button.mjs
CHANGED
|
@@ -33,7 +33,9 @@ export const Button = ToolView.extend({
|
|
|
33
33
|
},
|
|
34
34
|
getElementMatrix() {
|
|
35
35
|
const { relatedView: view } = this;
|
|
36
|
-
|
|
36
|
+
const toolOptions = getToolOptions(this);
|
|
37
|
+
let { x = 0, y = 0 } = toolOptions;
|
|
38
|
+
const { useModelGeometry, offset = {}, rotate, scale, relative } = toolOptions;
|
|
37
39
|
let bbox = getViewBBox(view, { useModelGeometry, relative });
|
|
38
40
|
const angle = view.model.angle();
|
|
39
41
|
if (!rotate) bbox = bbox.bbox(angle);
|
|
@@ -76,7 +76,7 @@ export const Control = ToolView.extend({
|
|
|
76
76
|
const { options: { handleAttributes }} = this;
|
|
77
77
|
handleNode.setAttribute('transform', this.getHandleTransformString());
|
|
78
78
|
if (handleAttributes) {
|
|
79
|
-
for (
|
|
79
|
+
for (const attrName in handleAttributes) {
|
|
80
80
|
handleNode.setAttribute(attrName, handleAttributes[attrName]);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -71,7 +71,7 @@ function alignLine(line, type, offset = 0) {
|
|
|
71
71
|
// Connection Points
|
|
72
72
|
|
|
73
73
|
function anchorConnectionPoint(line, _view, _magnet, opt) {
|
|
74
|
-
|
|
74
|
+
const { offset, alignOffset, align } = opt;
|
|
75
75
|
if (align) alignLine(line, align, alignOffset);
|
|
76
76
|
return offsetPoint(line.end, line.start, offset);
|
|
77
77
|
}
|
package/src/connectors/curve.mjs
CHANGED
|
@@ -490,17 +490,15 @@ function createCatmullRomCurves(points, sourceTangent, targetTangent, options) {
|
|
|
490
490
|
const vAngle = angleBetweenVectors(v1, v2);
|
|
491
491
|
|
|
492
492
|
let rot = (Math.PI - vAngle) / 2;
|
|
493
|
-
let t;
|
|
494
493
|
const vectorDeterminant = determinant(v1, v2);
|
|
495
|
-
|
|
496
|
-
pointsDeterminant = determinant(points[i].difference(points[i + 1]), points[i].difference(points[i - 1]));
|
|
494
|
+
const pointsDeterminant = determinant(points[i].difference(points[i + 1]), points[i].difference(points[i - 1]));
|
|
497
495
|
if (vectorDeterminant < 0) {
|
|
498
496
|
rot = -rot;
|
|
499
497
|
}
|
|
500
498
|
if ((vAngle < Math.PI / 2) && ((rot < 0 && pointsDeterminant < 0) || (rot > 0 && pointsDeterminant > 0))) {
|
|
501
499
|
rot = rot - Math.PI;
|
|
502
500
|
}
|
|
503
|
-
t = v2.clone();
|
|
501
|
+
const t = v2.clone();
|
|
504
502
|
rotateVector(t, rot);
|
|
505
503
|
|
|
506
504
|
const t1 = t.clone();
|
package/src/dia/Cell.mjs
CHANGED
|
@@ -100,7 +100,7 @@ export const Cell = Model.extend({
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
let defaultAttributes = {};
|
|
103
|
-
|
|
103
|
+
const attributes = cloneDeep(this.attributes);
|
|
104
104
|
|
|
105
105
|
if (ignoreDefaults === true) {
|
|
106
106
|
// Compare all attributes with the defaults
|
|
@@ -747,9 +747,8 @@ export const Cell = Model.extend({
|
|
|
747
747
|
}.bind(this);
|
|
748
748
|
|
|
749
749
|
const { _scheduledTransitionIds } = this;
|
|
750
|
-
let initialId;
|
|
751
750
|
|
|
752
|
-
|
|
751
|
+
const initiator = (callback) => {
|
|
753
752
|
|
|
754
753
|
if (_scheduledTransitionIds[transitionKey]) {
|
|
755
754
|
_scheduledTransitionIds[transitionKey] = without(_scheduledTransitionIds[transitionKey], initialId);
|
|
@@ -768,7 +767,7 @@ export const Cell = Model.extend({
|
|
|
768
767
|
|
|
769
768
|
};
|
|
770
769
|
|
|
771
|
-
initialId = setTimeout(initiator, opt.delay, setter);
|
|
770
|
+
const initialId = setTimeout(initiator, opt.delay, setter);
|
|
772
771
|
|
|
773
772
|
_scheduledTransitionIds[transitionKey] || (_scheduledTransitionIds[transitionKey] = []);
|
|
774
773
|
_scheduledTransitionIds[transitionKey].push(initialId);
|
|
@@ -975,11 +974,11 @@ export const Cell = Model.extend({
|
|
|
975
974
|
|
|
976
975
|
var Cell = this.extend(protoProps, staticProps);
|
|
977
976
|
// es5 backward compatibility
|
|
978
|
-
|
|
977
|
+
// eslint-disable-next-line no-undef
|
|
979
978
|
if (typeof joint !== 'undefined' && has(joint, 'shapes')) {
|
|
979
|
+
// eslint-disable-next-line no-undef
|
|
980
980
|
setByPath(joint.shapes, type, Cell, '.');
|
|
981
981
|
}
|
|
982
|
-
/* eslint-enable no-undef */
|
|
983
982
|
return Cell;
|
|
984
983
|
}
|
|
985
984
|
});
|
package/src/dia/Graph.mjs
CHANGED
|
@@ -29,6 +29,13 @@ export const Graph = Model.extend({
|
|
|
29
29
|
*/
|
|
30
30
|
defaultLayerId: DEFAULT_LAYER_ID,
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @protected
|
|
34
|
+
* @description If `true`, layer functionality is disabled
|
|
35
|
+
* and all cells are assigned to the default layer.
|
|
36
|
+
*/
|
|
37
|
+
ignoreLayers: false,
|
|
38
|
+
|
|
32
39
|
initialize: function(attrs, options = {}) {
|
|
33
40
|
|
|
34
41
|
const layerCollection = this.layerCollection = new GraphLayerCollection([], {
|
|
@@ -52,6 +59,11 @@ export const Graph = Model.extend({
|
|
|
52
59
|
// Controller that manages communication between the graph and its layers.
|
|
53
60
|
this.layersController = new GraphLayersController({ graph: this });
|
|
54
61
|
|
|
62
|
+
// Option to ignore layers altogether.
|
|
63
|
+
if (options.ignoreLayers) {
|
|
64
|
+
this.ignoreLayers = true;
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
// `Graph` keeps an internal data structure (an adjacency list)
|
|
56
68
|
// for fast graph queries. All changes that affect the structure of the graph
|
|
57
69
|
// must be reflected in the `al` object. This object provides fast answers to
|
|
@@ -156,7 +168,7 @@ export const Graph = Model.extend({
|
|
|
156
168
|
// Backward compatibility: prior v4.2, z-index was not set during reset.
|
|
157
169
|
if (opt && opt.ensureZIndex) {
|
|
158
170
|
if (cellAttributes.z === undefined) {
|
|
159
|
-
const layerId =
|
|
171
|
+
const layerId = this.getCellLayerId(cellInit);
|
|
160
172
|
const zIndex = this.maxZIndex(layerId) + 1;
|
|
161
173
|
if (cellInit[CELL_MARKER]) {
|
|
162
174
|
// Set with event in case there is a listener
|
|
@@ -268,6 +280,10 @@ export const Graph = Model.extend({
|
|
|
268
280
|
if (!cellInit) {
|
|
269
281
|
throw new Error('dia.Graph: No cell provided.');
|
|
270
282
|
}
|
|
283
|
+
if (this.ignoreLayers) {
|
|
284
|
+
// When layers are ignored, all cells belong to the default layer.
|
|
285
|
+
return this.defaultLayerId;
|
|
286
|
+
}
|
|
271
287
|
const cellAttributes = cellInit[CELL_MARKER]
|
|
272
288
|
? cellInit.attributes
|
|
273
289
|
: cellInit;
|
|
@@ -526,8 +542,8 @@ export const Graph = Model.extend({
|
|
|
526
542
|
* Helper method for addLayer and moveLayer methods
|
|
527
543
|
*/
|
|
528
544
|
_getBeforeLayerIdFromOptions(options, layer = null) {
|
|
529
|
-
let {
|
|
530
|
-
|
|
545
|
+
let { index } = options;
|
|
546
|
+
const { before = null } = options;
|
|
531
547
|
if (before && index !== undefined) {
|
|
532
548
|
throw new Error('dia.Graph: Options "before" and "index" are mutually exclusive.');
|
|
533
549
|
}
|
|
@@ -28,9 +28,8 @@ export const GraphLayerCollection = Collection.extend({
|
|
|
28
28
|
if (cellNamespace) {
|
|
29
29
|
this.cellNamespace = cellNamespace;
|
|
30
30
|
} else {
|
|
31
|
-
|
|
32
|
-
this.cellNamespace = typeof joint !== 'undefined' && util.has(joint, 'shapes') ? joint.shapes : null;
|
|
33
|
-
/* eslint-enable no-undef */
|
|
31
|
+
// eslint-disable-next-line no-undef
|
|
32
|
+
this.cellNamespace = (((typeof joint !== 'undefined') && util.has(joint, 'shapes')) ? joint.shapes : null);
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
this.graph = graph;
|
|
@@ -244,7 +244,7 @@ export const HighlighterView = mvc.View.extend({
|
|
|
244
244
|
// all highlighters
|
|
245
245
|
const views = [];
|
|
246
246
|
if (!refs) return views;
|
|
247
|
-
for (
|
|
247
|
+
for (const hid in refs) {
|
|
248
248
|
const ref = refs[hid];
|
|
249
249
|
if (ref instanceof this) {
|
|
250
250
|
views.push(ref);
|
|
@@ -271,7 +271,7 @@ export const HighlighterView = mvc.View.extend({
|
|
|
271
271
|
if (!refs) return false;
|
|
272
272
|
if (id === null) {
|
|
273
273
|
// any highlighter
|
|
274
|
-
for (
|
|
274
|
+
for (const hid in refs) {
|
|
275
275
|
if (refs[hid] instanceof this) return true;
|
|
276
276
|
}
|
|
277
277
|
return false;
|
|
@@ -311,7 +311,7 @@ export const HighlighterView = mvc.View.extend({
|
|
|
311
311
|
const refs = _views[cid];
|
|
312
312
|
if (!refs) return;
|
|
313
313
|
if (id) delete refs[id];
|
|
314
|
-
for (
|
|
314
|
+
for (const _ in refs) return;
|
|
315
315
|
delete _views[cid];
|
|
316
316
|
},
|
|
317
317
|
|
|
@@ -324,8 +324,8 @@ export const HighlighterView = mvc.View.extend({
|
|
|
324
324
|
getAll(paper, id = null) {
|
|
325
325
|
const views = [];
|
|
326
326
|
const { _views } = this;
|
|
327
|
-
for (
|
|
328
|
-
for (
|
|
327
|
+
for (const cid in _views) {
|
|
328
|
+
for (const hid in _views[cid]) {
|
|
329
329
|
const view = _views[cid][hid];
|
|
330
330
|
if (view.cellView.paper === paper && view instanceof this && (id === null || hid === id)) {
|
|
331
331
|
views.push(view);
|
package/src/dia/LayerView.mjs
CHANGED
|
@@ -99,7 +99,7 @@ export const LayerView = View.extend({
|
|
|
99
99
|
|
|
100
100
|
removePivots: function() {
|
|
101
101
|
const { el, pivotNodes } = this;
|
|
102
|
-
for (
|
|
102
|
+
for (const z in pivotNodes) el.removeChild(pivotNodes[z]);
|
|
103
103
|
this.pivotNodes = {};
|
|
104
104
|
},
|
|
105
105
|
|
package/src/dia/LinkView.mjs
CHANGED
|
@@ -933,7 +933,7 @@ export const LinkView = CellView.extend({
|
|
|
933
933
|
const { metrics, _labelSelectors } = this;
|
|
934
934
|
const selectors = _labelSelectors[index];
|
|
935
935
|
if (!selectors) return;
|
|
936
|
-
for (
|
|
936
|
+
for (const selector in selectors) {
|
|
937
937
|
const { id } = selectors[selector];
|
|
938
938
|
if (id && (id in metrics)) delete metrics[id].magnetMatrix;
|
|
939
939
|
}
|
package/src/dia/Paper.mjs
CHANGED
|
@@ -637,9 +637,8 @@ export const Paper = View.extend({
|
|
|
637
637
|
|
|
638
638
|
const { options } = this;
|
|
639
639
|
if (!options.cellViewNamespace) {
|
|
640
|
-
|
|
641
|
-
options.cellViewNamespace = typeof joint !== 'undefined' && has(joint, 'shapes') ? joint.shapes : null;
|
|
642
|
-
/* eslint-enable no-undef */
|
|
640
|
+
// eslint-disable-next-line no-undef
|
|
641
|
+
options.cellViewNamespace = (((typeof joint !== 'undefined') && has(joint, 'shapes')) ? joint.shapes : null);
|
|
643
642
|
}
|
|
644
643
|
|
|
645
644
|
const defaultLayerViewNamespace = {
|
|
@@ -720,6 +719,9 @@ export const Paper = View.extend({
|
|
|
720
719
|
var position = opt.position;
|
|
721
720
|
if (this.isAsync() || !isNumber(position)) {
|
|
722
721
|
this.renderView(cell, opt);
|
|
722
|
+
// Wake up the paper in case it was idle
|
|
723
|
+
// When using initializeUnmounted: true the paper won't wake up by itself
|
|
724
|
+
this.wakeUp();
|
|
723
725
|
} else {
|
|
724
726
|
if (opt.maxPosition === position) this.freeze({ key: 'addCells' });
|
|
725
727
|
this.renderView(cell, opt);
|
|
@@ -867,11 +869,11 @@ export const Paper = View.extend({
|
|
|
867
869
|
} = options;
|
|
868
870
|
|
|
869
871
|
// Default cellView namespace for ES5
|
|
870
|
-
|
|
871
|
-
if (!cellViewNamespace && typeof joint !== 'undefined' && has(joint, 'shapes')) {
|
|
872
|
+
// eslint-disable-next-line no-undef
|
|
873
|
+
if (!cellViewNamespace && (typeof joint !== 'undefined') && has(joint, 'shapes')) {
|
|
874
|
+
// eslint-disable-next-line no-undef
|
|
872
875
|
options.cellViewNamespace = joint.shapes;
|
|
873
876
|
}
|
|
874
|
-
/* eslint-enable no-undef */
|
|
875
877
|
|
|
876
878
|
// Here if a function was provided, we can not clone it, as this would result in loosing the function.
|
|
877
879
|
// If the default is used, the cloning is necessary in order to prevent modifying the options on prototype.
|
|
@@ -1108,7 +1110,8 @@ export const Paper = View.extend({
|
|
|
1108
1110
|
* Helper method for addLayerView and moveLayerView methods
|
|
1109
1111
|
*/
|
|
1110
1112
|
_getBeforeLayerViewFromOptions(layerView, options) {
|
|
1111
|
-
|
|
1113
|
+
const { before = null } = options;
|
|
1114
|
+
let { index } = options;
|
|
1112
1115
|
|
|
1113
1116
|
if (before && index !== undefined) {
|
|
1114
1117
|
throw new Error('dia.Paper: Options "before" and "index" are mutually exclusive.');
|
|
@@ -1568,7 +1571,7 @@ export const Paper = View.extend({
|
|
|
1568
1571
|
delete prevPriorityUpdates[cid];
|
|
1569
1572
|
}
|
|
1570
1573
|
}
|
|
1571
|
-
|
|
1574
|
+
const currentType = priorityUpdates[cid] || 0;
|
|
1572
1575
|
// Prevent cycling
|
|
1573
1576
|
if ((currentType & type) === type) return;
|
|
1574
1577
|
if (!currentType) updates.count++;
|
|
@@ -1710,7 +1713,7 @@ export const Paper = View.extend({
|
|
|
1710
1713
|
let i = priorityIndexes.length;
|
|
1711
1714
|
while (i > 0 && i--) {
|
|
1712
1715
|
// a faster way how to check if an object is empty
|
|
1713
|
-
for (
|
|
1716
|
+
for (const _key in priorities[priorityIndexes[i]]) return true;
|
|
1714
1717
|
}
|
|
1715
1718
|
return false;
|
|
1716
1719
|
},
|
|
@@ -2030,8 +2033,12 @@ export const Paper = View.extend({
|
|
|
2030
2033
|
var updates = this._updates;
|
|
2031
2034
|
var unmountedList = updates.unmountedList;
|
|
2032
2035
|
for (var i = 0, n = Math.min(unmountedList.length, batchSize); i < n; i++) {
|
|
2036
|
+
// stop if there are no more unmounted views
|
|
2037
|
+
// this can happen when another view was mounted in the onViewUpdate() callback
|
|
2038
|
+
if (unmountedList.length === 0) break;
|
|
2039
|
+
|
|
2033
2040
|
const { key: cid } = unmountedList.peekHead();
|
|
2034
|
-
|
|
2041
|
+
const view = viewsRegistry[cid] || this._viewPlaceholders[cid];
|
|
2035
2042
|
if (!view) {
|
|
2036
2043
|
// This should not occur
|
|
2037
2044
|
// Prevent looping over this invalid cid
|
|
@@ -2267,8 +2274,8 @@ export const Paper = View.extend({
|
|
|
2267
2274
|
setDimensions: function(width, height, data = {}) {
|
|
2268
2275
|
const { options } = this;
|
|
2269
2276
|
const { width: currentWidth, height: currentHeight } = options;
|
|
2270
|
-
|
|
2271
|
-
|
|
2277
|
+
const w = (width === undefined) ? currentWidth : width;
|
|
2278
|
+
const h = (height === undefined) ? currentHeight : height;
|
|
2272
2279
|
if (currentWidth === w && currentHeight === h) return;
|
|
2273
2280
|
options.width = w;
|
|
2274
2281
|
options.height = h;
|
|
@@ -3243,7 +3250,8 @@ export const Paper = View.extend({
|
|
|
3243
3250
|
|
|
3244
3251
|
resolveHighlighter: function(opt = {}) {
|
|
3245
3252
|
|
|
3246
|
-
let { highlighter: highlighterDef
|
|
3253
|
+
let { highlighter: highlighterDef } = opt;
|
|
3254
|
+
const { type } = opt;
|
|
3247
3255
|
const { highlighting,highlighterNamespace } = this.options;
|
|
3248
3256
|
|
|
3249
3257
|
/*
|
|
@@ -45,7 +45,7 @@ const positiveValueAttributes = positiveValueList.reduce((acc, attrName) => {
|
|
|
45
45
|
|
|
46
46
|
export function evalAttributes(attrs, refBBox) {
|
|
47
47
|
const evalAttrs = {};
|
|
48
|
-
for (
|
|
48
|
+
for (const attrName in attrs) {
|
|
49
49
|
if (!attrs.hasOwnProperty(attrName)) continue;
|
|
50
50
|
evalAttrs[attrName] = evalAttribute(attrName, attrs[attrName], refBBox);
|
|
51
51
|
}
|
package/src/dia/ports.mjs
CHANGED
|
@@ -98,7 +98,7 @@ PortData.prototype = {
|
|
|
98
98
|
groupPortTransformations = this._getGroupPortTransformations(group, portsArgs, elBBox);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
const accumulator = {
|
|
102
102
|
ports: ports,
|
|
103
103
|
result: {}
|
|
104
104
|
};
|
|
@@ -264,7 +264,7 @@ PortData.prototype = {
|
|
|
264
264
|
evaluated.position = this._evaluatePortPositionProperty(group, evaluated);
|
|
265
265
|
evaluated.label = this._evaluatePortLabelProperty(group, evaluated);
|
|
266
266
|
evaluated.z = this._evaluatePortZProperty(group, evaluated);
|
|
267
|
-
evaluated.size = util.assign({}, group.size, evaluated.size);
|
|
267
|
+
evaluated.size = util.assign({ width: 0, height: 0 }, group.size, evaluated.size);
|
|
268
268
|
return evaluated;
|
|
269
269
|
},
|
|
270
270
|
|
|
@@ -8,11 +8,12 @@ export const HoverConnect = LinkHoverConnect.extend({
|
|
|
8
8
|
|
|
9
9
|
getTrackPath() {
|
|
10
10
|
const { relatedView: view } = this;
|
|
11
|
-
|
|
11
|
+
const {
|
|
12
12
|
useModelGeometry,
|
|
13
13
|
relative,
|
|
14
|
-
trackPath = 'M 0 0 H calc(w) V calc(h) H 0 Z'
|
|
14
|
+
trackPath: initialTrackPath = 'M 0 0 H calc(w) V calc(h) H 0 Z'
|
|
15
15
|
} = getToolOptions(this);
|
|
16
|
+
let trackPath = initialTrackPath;
|
|
16
17
|
if (typeof trackPath === 'function') {
|
|
17
18
|
trackPath = trackPath.call(this, view);
|
|
18
19
|
}
|
|
@@ -30,7 +31,7 @@ export const HoverConnect = LinkHoverConnect.extend({
|
|
|
30
31
|
|
|
31
32
|
getTrackMatrixAbsolute() {
|
|
32
33
|
const { relatedView: view } = this;
|
|
33
|
-
|
|
34
|
+
const { useModelGeometry, rotate } = getToolOptions(this);
|
|
34
35
|
let bbox = getViewBBox(view, { useModelGeometry });
|
|
35
36
|
const angle = view.model.angle();
|
|
36
37
|
if (!rotate) bbox = bbox.bbox(angle);
|
|
@@ -52,7 +52,8 @@ export const RotateLabel = Control.extend({
|
|
|
52
52
|
const label = this.getLabel();
|
|
53
53
|
const labelPosition = this.getLabelPosition(label);
|
|
54
54
|
const coords = view.getLabelCoordinates(labelPosition);
|
|
55
|
-
let { angle = 0
|
|
55
|
+
let { angle = 0 } = labelPosition;
|
|
56
|
+
const { args = {}} = labelPosition;
|
|
56
57
|
const keepGradient = args.keepGradient;
|
|
57
58
|
if (keepGradient) {
|
|
58
59
|
const tangent = view.getTangentAtRatio(
|
|
@@ -235,7 +235,7 @@ export const Segments = ToolView.extend({
|
|
|
235
235
|
const isSingleVertex = data.originalVertices.length === 1;
|
|
236
236
|
const origVIndex = isSingleVertex ? 0 : handleIndex;
|
|
237
237
|
const additionalOffset = data.firstHandleShifted && !isSingleVertex ? 1 : 0;
|
|
238
|
-
|
|
238
|
+
const nextVIndex = 1 + indexOffset;
|
|
239
239
|
vertices.splice(handleIndex + nextVIndex, 0, data.originalVertices[origVIndex - additionalOffset]);
|
|
240
240
|
}
|
|
241
241
|
}
|
package/src/mvc/Dom/Dom.mjs
CHANGED
|
@@ -44,7 +44,7 @@ $.guid = 1;
|
|
|
44
44
|
$.data = dataUser;
|
|
45
45
|
|
|
46
46
|
$.merge = function(first, second) {
|
|
47
|
-
|
|
47
|
+
const len = +second.length;
|
|
48
48
|
let i = first.length;
|
|
49
49
|
for (let j = 0; j < len; j++) {
|
|
50
50
|
first[i++] = second[j];
|
|
@@ -227,7 +227,7 @@ $.event.on = function(elem, types, selector, data, fn, one) {
|
|
|
227
227
|
data = data || selector;
|
|
228
228
|
selector = undefined;
|
|
229
229
|
}
|
|
230
|
-
for (
|
|
230
|
+
for (const type in types) {
|
|
231
231
|
$.event.on(elem, type, selector, data, types[type], one);
|
|
232
232
|
}
|
|
233
233
|
return elem;
|
|
@@ -23,12 +23,8 @@ export function animate(properties, opt = {}) {
|
|
|
23
23
|
|
|
24
24
|
function animateNode(el, properties, opt = {}) {
|
|
25
25
|
|
|
26
|
-
let {
|
|
27
|
-
|
|
28
|
-
easing = 'ease-in-out',
|
|
29
|
-
delay = 0,
|
|
30
|
-
complete
|
|
31
|
-
} = opt;
|
|
26
|
+
let { duration = 400, delay = 0 } = opt;
|
|
27
|
+
const { easing = 'ease-in-out', complete } = opt;
|
|
32
28
|
|
|
33
29
|
const delayId = setTimeout(function() {
|
|
34
30
|
|
package/src/mvc/Dom/methods.mjs
CHANGED
|
@@ -158,7 +158,7 @@ export function css(name, value) {
|
|
|
158
158
|
} else {
|
|
159
159
|
styles = name;
|
|
160
160
|
}
|
|
161
|
-
for (
|
|
161
|
+
for (const style in styles) {
|
|
162
162
|
if (styles.hasOwnProperty(style)) {
|
|
163
163
|
for (let i = 0; i < this.length; i++) {
|
|
164
164
|
setCSSProperty(this[i], style, styles[style]);
|
|
@@ -274,7 +274,7 @@ export function off(types, selector, fn) {
|
|
|
274
274
|
}
|
|
275
275
|
if (typeof types === 'object') {
|
|
276
276
|
// ( types-object [, selector] )
|
|
277
|
-
for (
|
|
277
|
+
for (const type in types) {
|
|
278
278
|
this.off(type, selector, types[type]);
|
|
279
279
|
}
|
|
280
280
|
return this;
|
|
@@ -321,7 +321,7 @@ export function height() {
|
|
|
321
321
|
export function position() {
|
|
322
322
|
const [el] = this;
|
|
323
323
|
if (!el) return;
|
|
324
|
-
|
|
324
|
+
const $el = $(el);
|
|
325
325
|
let offsetParent;
|
|
326
326
|
let offset;
|
|
327
327
|
let doc;
|
package/src/mvc/Dom/props.mjs
CHANGED
package/src/mvc/Listener.mjs
CHANGED
|
@@ -19,6 +19,7 @@ export class Listener {
|
|
|
19
19
|
}
|
|
20
20
|
// signature 2 - (object, event, callback, context)
|
|
21
21
|
else if (typeof evt === 'string' && typeof args[0] === 'function') {
|
|
22
|
+
// eslint-disable-next-line prefer-const
|
|
22
23
|
let [cb, context = null] = args;
|
|
23
24
|
// Invoke the callback with callbackArguments passed first
|
|
24
25
|
if (context || callbackArguments.length > 0) cb = cb.bind(context, ...callbackArguments);
|
|
@@ -776,8 +776,8 @@ function routeBetweenPoints(source, target, opt = {}) {
|
|
|
776
776
|
}
|
|
777
777
|
|
|
778
778
|
let x;
|
|
779
|
-
|
|
780
|
-
|
|
779
|
+
const y1 = Math.min((sy1 + ty0) / 2, toy);
|
|
780
|
+
const y2 = Math.min((sy0 + ty1) / 2, soy);
|
|
781
781
|
|
|
782
782
|
if (toy < soy) {
|
|
783
783
|
// Use the shortest path along the connections on horizontal sides
|
|
@@ -816,8 +816,8 @@ function routeBetweenPoints(source, target, opt = {}) {
|
|
|
816
816
|
}
|
|
817
817
|
|
|
818
818
|
let x;
|
|
819
|
-
|
|
820
|
-
|
|
819
|
+
const y1 = Math.max((sy0 + ty1) / 2, toy);
|
|
820
|
+
const y2 = Math.max((sy1 + ty0) / 2, soy);
|
|
821
821
|
|
|
822
822
|
if (toy > soy) {
|
|
823
823
|
// Use the shortest path along the connections on horizontal sides
|
|
@@ -856,8 +856,8 @@ function routeBetweenPoints(source, target, opt = {}) {
|
|
|
856
856
|
}
|
|
857
857
|
|
|
858
858
|
let y;
|
|
859
|
-
|
|
860
|
-
|
|
859
|
+
const x1 = Math.min((sx1 + tx0) / 2, tox);
|
|
860
|
+
const x2 = Math.min((sx0 + tx1) / 2, sox);
|
|
861
861
|
|
|
862
862
|
if (tox > sox) {
|
|
863
863
|
if (topD <= bottomD) {
|
|
@@ -895,8 +895,8 @@ function routeBetweenPoints(source, target, opt = {}) {
|
|
|
895
895
|
}
|
|
896
896
|
|
|
897
897
|
let y;
|
|
898
|
-
|
|
899
|
-
|
|
898
|
+
const x1 = Math.max((sx0 + tx1) / 2, tox);
|
|
899
|
+
const x2 = Math.max((sx1 + tx0) / 2, sox);
|
|
900
900
|
|
|
901
901
|
if (tox <= sox) {
|
|
902
902
|
if (topD <= bottomD) {
|
|
@@ -1518,7 +1518,7 @@ function rightAngleRouter(vertices, opt, linkView) {
|
|
|
1518
1518
|
const isTargetPort = !!linkView.model.target().port;
|
|
1519
1519
|
const targetPoint = pointDataFromAnchor(linkView.targetView, linkView.targetAnchor, linkView.targetBBox, targetDirection, isTargetPort, linkView.targetAnchor, margin);
|
|
1520
1520
|
|
|
1521
|
-
|
|
1521
|
+
const resultVertices = [];
|
|
1522
1522
|
|
|
1523
1523
|
if (!useVertices || vertices.length === 0) {
|
|
1524
1524
|
return simplifyPoints(routeBetweenPoints(sourcePoint, targetPoint));
|
package/src/util/calc.mjs
CHANGED
|
@@ -104,7 +104,7 @@ export function evalCalcExpression(expression, rect) {
|
|
|
104
104
|
let value = expression;
|
|
105
105
|
let startSearchIndex = 0;
|
|
106
106
|
do {
|
|
107
|
-
|
|
107
|
+
const calcIndex = value.indexOf(calcStart, startSearchIndex);
|
|
108
108
|
if (calcIndex === -1) return value;
|
|
109
109
|
let calcEndIndex = calcIndex + calcStartOffset;
|
|
110
110
|
let brackets = 1;
|