@joint/core 4.1.1 → 4.1.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/dist/geometry.js +1 -1
- package/dist/geometry.min.js +1 -1
- package/dist/joint.d.ts +3 -1
- package/dist/joint.js +66 -38
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +66 -38
- package/dist/joint.nowrap.min.js +2 -2
- package/dist/vectorizer.js +2 -2
- package/dist/vectorizer.min.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/V/index.mjs +1 -1
- package/src/dia/ElementView.mjs +10 -4
- package/src/dia/HighlighterView.mjs +5 -5
- package/src/mvc/Collection.mjs +6 -2
- package/src/mvc/Dom/Dom.mjs +2 -2
- package/src/mvc/Dom/methods.mjs +9 -7
- package/src/mvc/Listener.mjs +1 -2
- package/src/mvc/Model.mjs +6 -2
- package/src/mvc/ViewBase.mjs +6 -2
- package/src/util/util.mjs +5 -4
- package/src/util/utilHelpers.mjs +5 -5
- package/types/joint.d.ts +2 -0
package/dist/vectorizer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! JointJS v4.1.
|
|
1
|
+
/*! JointJS v4.1.3 (2025-02-04) - JavaScript diagramming library
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -5721,8 +5721,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
5721
5721
|
case 'bottom':
|
|
5722
5722
|
dy = -(0.25 * llMaxFont) - rLineHeights;
|
|
5723
5723
|
break;
|
|
5724
|
-
default:
|
|
5725
5724
|
case 'top':
|
|
5725
|
+
default:
|
|
5726
5726
|
dy = 0.8 * flMaxFont;
|
|
5727
5727
|
break;
|
|
5728
5728
|
}
|
package/dist/vectorizer.min.js
CHANGED
package/dist/version.mjs
CHANGED
package/package.json
CHANGED
package/src/V/index.mjs
CHANGED
package/src/dia/ElementView.mjs
CHANGED
|
@@ -142,7 +142,7 @@ export const ElementView = CellView.extend({
|
|
|
142
142
|
* @abstract
|
|
143
143
|
*/
|
|
144
144
|
_initializePorts: function() {
|
|
145
|
-
|
|
145
|
+
// implemented in ports.js
|
|
146
146
|
},
|
|
147
147
|
|
|
148
148
|
update: function(_, renderingOnlyAttrs) {
|
|
@@ -804,17 +804,23 @@ export const ElementView = CellView.extend({
|
|
|
804
804
|
|
|
805
805
|
// Drag Handlers
|
|
806
806
|
|
|
807
|
+
snapToGrid: function(evt, x, y) {
|
|
808
|
+
const grid = this.paper.options.gridSize;
|
|
809
|
+
return {
|
|
810
|
+
x: snapToGrid(x, grid),
|
|
811
|
+
y: snapToGrid(y, grid)
|
|
812
|
+
};
|
|
813
|
+
},
|
|
814
|
+
|
|
807
815
|
drag: function(evt, x, y) {
|
|
808
816
|
|
|
809
817
|
var paper = this.paper;
|
|
810
|
-
var grid = paper.options.gridSize;
|
|
811
818
|
var element = this.model;
|
|
812
819
|
var data = this.eventData(evt);
|
|
813
820
|
var { pointerOffset, restrictedArea, embedding } = data;
|
|
814
821
|
|
|
815
822
|
// Make sure the new element's position always snaps to the current grid
|
|
816
|
-
|
|
817
|
-
var elY = snapToGrid(y + pointerOffset.y, grid);
|
|
823
|
+
const { x: elX, y: elY } = this.snapToGrid(evt, x + pointerOffset.x, y + pointerOffset.y);
|
|
818
824
|
|
|
819
825
|
element.position(elX, elY, { restrictedArea, deep: true, ui: true });
|
|
820
826
|
|
|
@@ -42,13 +42,13 @@ export const HighlighterView = mvc.View.extend({
|
|
|
42
42
|
// The cellView is now rendered/updated since it has a higher update priority.
|
|
43
43
|
this.updateRequested = false;
|
|
44
44
|
const { cellView, nodeSelector } = this;
|
|
45
|
-
if (
|
|
45
|
+
if (cellView.isMounted()) {
|
|
46
|
+
this.update(cellView, nodeSelector);
|
|
47
|
+
this.mount();
|
|
48
|
+
this.transform();
|
|
49
|
+
} else {
|
|
46
50
|
this.postponedUpdate = true;
|
|
47
|
-
return 0;
|
|
48
51
|
}
|
|
49
|
-
this.update(cellView, nodeSelector);
|
|
50
|
-
this.mount();
|
|
51
|
-
this.transform();
|
|
52
52
|
return 0;
|
|
53
53
|
},
|
|
54
54
|
|
package/src/mvc/Collection.mjs
CHANGED
|
@@ -59,11 +59,15 @@ assign(Collection.prototype, Events, {
|
|
|
59
59
|
|
|
60
60
|
// preinitialize is an empty function by default. You can override it with a function
|
|
61
61
|
// or object. preinitialize will run before any instantiation logic is run in the Collection.
|
|
62
|
-
preinitialize: function(){
|
|
62
|
+
preinitialize: function(){
|
|
63
|
+
// No implementation.
|
|
64
|
+
},
|
|
63
65
|
|
|
64
66
|
// Initialize is an empty function by default. Override it with your own
|
|
65
67
|
// initialization logic.
|
|
66
|
-
initialize: function(){
|
|
68
|
+
initialize: function(){
|
|
69
|
+
// No implementation.
|
|
70
|
+
},
|
|
67
71
|
|
|
68
72
|
// The JSON representation of a Collection is an array of the
|
|
69
73
|
// models' attributes.
|
package/src/mvc/Dom/Dom.mjs
CHANGED
|
@@ -109,8 +109,8 @@ $.fn.find = function(selector) {
|
|
|
109
109
|
return ret;
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
$.fn.add = function(selector
|
|
113
|
-
const newElements = $(selector
|
|
112
|
+
$.fn.add = function(selector) {
|
|
113
|
+
const newElements = $(selector).toArray();
|
|
114
114
|
const prevElements = this.toArray();
|
|
115
115
|
const ret = this.pushStack([]);
|
|
116
116
|
$.merge(ret, uniq(prevElements.concat(newElements)));
|
package/src/mvc/Dom/methods.mjs
CHANGED
|
@@ -65,7 +65,7 @@ export function html(html) {
|
|
|
65
65
|
if (!el) return null;
|
|
66
66
|
if (arguments.length === 0) return el.innerHTML;
|
|
67
67
|
if (html === undefined) return this; // do nothing
|
|
68
|
-
cleanNodesData(
|
|
68
|
+
cleanNodesData(el.getElementsByTagName('*'));
|
|
69
69
|
if (typeof html === 'string' || typeof html === 'number') {
|
|
70
70
|
el.innerHTML = html;
|
|
71
71
|
} else {
|
|
@@ -336,17 +336,19 @@ export function position() {
|
|
|
336
336
|
// when a statically positioned element is identified
|
|
337
337
|
doc = el.ownerDocument;
|
|
338
338
|
offsetParent = el.offsetParent || doc.documentElement;
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
339
|
+
const isStaticallyPositioned = (el) => {
|
|
340
|
+
const { position } = getComputedStyle(el);
|
|
341
|
+
return position === 'static';
|
|
342
|
+
};
|
|
343
|
+
while (offsetParent && offsetParent !== doc.documentElement && isStaticallyPositioned(offsetParent)) {
|
|
344
|
+
offsetParent = offsetParent.offsetParent || doc.documentElement;
|
|
343
345
|
}
|
|
344
|
-
if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1) {
|
|
346
|
+
if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1 && !isStaticallyPositioned(offsetParent)) {
|
|
345
347
|
// Incorporate borders into its offset, since they are outside its content origin
|
|
346
348
|
const offsetParentStyles = window.getComputedStyle(offsetParent);
|
|
347
349
|
const borderTopWidth = parseFloat(offsetParentStyles.borderTopWidth) || 0;
|
|
348
350
|
const borderLeftWidth = parseFloat(offsetParentStyles.borderLeftWidth) || 0;
|
|
349
|
-
parentOffset = $
|
|
351
|
+
parentOffset = $(offsetParent).offset();
|
|
350
352
|
parentOffset.top += borderTopWidth;
|
|
351
353
|
parentOffset.left += borderLeftWidth;
|
|
352
354
|
}
|
package/src/mvc/Listener.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import V from '../V/index.mjs';
|
|
2
1
|
import { Events } from './Events.mjs';
|
|
3
2
|
|
|
4
3
|
export class Listener {
|
|
@@ -9,7 +8,7 @@ export class Listener {
|
|
|
9
8
|
listenTo(object, evt, ...args) {
|
|
10
9
|
const { callbackArguments } = this;
|
|
11
10
|
// signature 1 - (object, eventHashMap, context)
|
|
12
|
-
if (
|
|
11
|
+
if (evt && typeof evt === 'object') {
|
|
13
12
|
const [context = null] = args;
|
|
14
13
|
Object.entries(evt).forEach(([eventName, cb]) => {
|
|
15
14
|
if (typeof cb !== 'function') return;
|
package/src/mvc/Model.mjs
CHANGED
|
@@ -59,11 +59,15 @@ assign(Model.prototype, Events, {
|
|
|
59
59
|
|
|
60
60
|
// preinitialize is an empty function by default. You can override it with a function
|
|
61
61
|
// or object. preinitialize will run before any instantiation logic is run in the Model.
|
|
62
|
-
preinitialize: function(){
|
|
62
|
+
preinitialize: function(){
|
|
63
|
+
// No implementation.
|
|
64
|
+
},
|
|
63
65
|
|
|
64
66
|
// Initialize is an empty function by default. Override it with your own
|
|
65
67
|
// initialization logic.
|
|
66
|
-
initialize: function(){
|
|
68
|
+
initialize: function(){
|
|
69
|
+
// No implementation.
|
|
70
|
+
},
|
|
67
71
|
|
|
68
72
|
// Return a copy of the model's `attributes` object.
|
|
69
73
|
toJSON: function(options) {
|
package/src/mvc/ViewBase.mjs
CHANGED
|
@@ -52,11 +52,15 @@ assign(ViewBase.prototype, Events, {
|
|
|
52
52
|
|
|
53
53
|
// preinitialize is an empty function by default. You can override it with a function
|
|
54
54
|
// or object. preinitialize will run before any instantiation logic is run in the View
|
|
55
|
-
preinitialize: function(){
|
|
55
|
+
preinitialize: function(){
|
|
56
|
+
// No implementation.
|
|
57
|
+
},
|
|
56
58
|
|
|
57
59
|
// Initialize is an empty function by default. Override it with your own
|
|
58
60
|
// initialization logic.
|
|
59
|
-
initialize: function(){
|
|
61
|
+
initialize: function(){
|
|
62
|
+
// No implementation.
|
|
63
|
+
},
|
|
60
64
|
|
|
61
65
|
// **render** is the core function that your view should override, in order
|
|
62
66
|
// to populate its element (`this.el`), with the appropriate HTML. The
|
package/src/util/util.mjs
CHANGED
|
@@ -79,10 +79,10 @@ export const parseDOMJSON = function(json, namespace) {
|
|
|
79
79
|
const groupSelectors = {};
|
|
80
80
|
const svgNamespace = V.namespace.svg;
|
|
81
81
|
|
|
82
|
-
const
|
|
82
|
+
const initialNS = namespace || svgNamespace;
|
|
83
83
|
const fragment = document.createDocumentFragment();
|
|
84
84
|
|
|
85
|
-
const parseNode = function(siblingsDef, parentNode,
|
|
85
|
+
const parseNode = function(siblingsDef, parentNode, parentNS) {
|
|
86
86
|
for (let i = 0; i < siblingsDef.length; i++) {
|
|
87
87
|
const nodeDef = siblingsDef[i];
|
|
88
88
|
|
|
@@ -100,7 +100,7 @@ export const parseDOMJSON = function(json, namespace) {
|
|
|
100
100
|
let node;
|
|
101
101
|
|
|
102
102
|
// Namespace URI
|
|
103
|
-
|
|
103
|
+
const ns = (nodeDef.hasOwnProperty('namespaceURI')) ? nodeDef.namespaceURI : parentNS;
|
|
104
104
|
node = document.createElementNS(ns, tagName);
|
|
105
105
|
const svg = (ns === svgNamespace);
|
|
106
106
|
|
|
@@ -152,7 +152,7 @@ export const parseDOMJSON = function(json, namespace) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
parseNode(json, fragment,
|
|
155
|
+
parseNode(json, fragment, initialNS);
|
|
156
156
|
return {
|
|
157
157
|
fragment: fragment,
|
|
158
158
|
selectors: selectors,
|
|
@@ -1790,4 +1790,5 @@ export {
|
|
|
1790
1790
|
};
|
|
1791
1791
|
|
|
1792
1792
|
export const noop = function() {
|
|
1793
|
+
// Do nothing.
|
|
1793
1794
|
};
|
package/src/util/utilHelpers.mjs
CHANGED
|
@@ -389,7 +389,7 @@ const initCloneByTag = (object, tag, isDeep) => {
|
|
|
389
389
|
const Constructor = object.constructor;
|
|
390
390
|
switch(tag) {
|
|
391
391
|
case arrayBufferTag:
|
|
392
|
-
return cloneArrayBuffer(object
|
|
392
|
+
return cloneArrayBuffer(object);
|
|
393
393
|
case boolTag:
|
|
394
394
|
case dateTag:
|
|
395
395
|
return new Constructor(+object);
|
|
@@ -1168,7 +1168,7 @@ const baseMerge = (object, source, srcIndex, customizer, stack) => {
|
|
|
1168
1168
|
|
|
1169
1169
|
assignMergeValue(object, key, newValue);
|
|
1170
1170
|
}
|
|
1171
|
-
}
|
|
1171
|
+
});
|
|
1172
1172
|
};
|
|
1173
1173
|
|
|
1174
1174
|
const baseMergeDeep = (object, source, key, srcIndex, mergeFunc, customizer, stack) => {
|
|
@@ -1281,7 +1281,7 @@ function last(array) {
|
|
|
1281
1281
|
|
|
1282
1282
|
const createSet = (Set && (1 / setToArray(new Set([undefined,-0]))[1]) == 1 / 0)
|
|
1283
1283
|
? (values) => new Set(values)
|
|
1284
|
-
: () => {};
|
|
1284
|
+
: () => { /* no-op */ };
|
|
1285
1285
|
|
|
1286
1286
|
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
|
1287
1287
|
if (isObject(objValue) && isObject(srcValue)) {
|
|
@@ -2236,8 +2236,8 @@ export function debounce(func, wait, opt) {
|
|
|
2236
2236
|
export const groupBy = (collection, iteratee) => {
|
|
2237
2237
|
iteratee = getIteratee(iteratee, 2);
|
|
2238
2238
|
|
|
2239
|
-
return reduce(collection, (result, value
|
|
2240
|
-
key = iteratee(value);
|
|
2239
|
+
return reduce(collection, (result, value) => {
|
|
2240
|
+
const key = iteratee(value);
|
|
2241
2241
|
if (hasOwnProperty.call(result, key)) {
|
|
2242
2242
|
result[key].push(value);
|
|
2243
2243
|
} else {
|
package/types/joint.d.ts
CHANGED
|
@@ -1090,6 +1090,8 @@ export namespace dia {
|
|
|
1090
1090
|
|
|
1091
1091
|
protected dragMagnetEnd(evt: dia.Event, x: number, y: number): void;
|
|
1092
1092
|
|
|
1093
|
+
protected snapToGrid(evt: dia.Event, x: number, y: number): dia.Point;
|
|
1094
|
+
|
|
1093
1095
|
protected prepareEmbedding(data: any): void;
|
|
1094
1096
|
|
|
1095
1097
|
protected processEmbedding(data: any, evt: dia.Event, x: number, y: number): void;
|