@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 CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.1 (2024-12-02) - JavaScript diagramming library
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
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.1 (2024-12-02) - JavaScript diagramming library
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
package/dist/joint.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.1 (2024-12-02) - JavaScript diagramming library
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
@@ -1693,6 +1693,8 @@ export declare namespace dia {
1693
1693
 
1694
1694
  protected dragMagnetEnd(evt: dia.Event, x: number, y: number): void;
1695
1695
 
1696
+ protected snapToGrid(evt: dia.Event, x: number, y: number): dia.Point;
1697
+
1696
1698
  protected prepareEmbedding(data: any): void;
1697
1699
 
1698
1700
  protected processEmbedding(data: any, evt: dia.Event, x: number, y: number): void;
package/dist/joint.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.1 (2024-12-02) - JavaScript diagramming library
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
@@ -7255,7 +7255,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7255
7255
  const Constructor = object.constructor;
7256
7256
  switch (tag) {
7257
7257
  case arrayBufferTag:
7258
- return cloneArrayBuffer(object, isDeep);
7258
+ return cloneArrayBuffer(object);
7259
7259
  case boolTag:
7260
7260
  case dateTag:
7261
7261
  return new Constructor(+object);
@@ -7874,7 +7874,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7874
7874
  }
7875
7875
  assignMergeValue(object, key, newValue);
7876
7876
  }
7877
- }, keysIn);
7877
+ });
7878
7878
  };
7879
7879
  const baseMergeDeep = (object, source, key, srcIndex, mergeFunc, customizer, stack) => {
7880
7880
  const objValue = safeGet(object, key);
@@ -7964,7 +7964,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7964
7964
  const length = array == null ? 0 : array.length;
7965
7965
  return length ? array[length - 1] : undefined;
7966
7966
  }
7967
- const createSet = Set && 1 / setToArray(new Set([undefined, -0]))[1] == 1 / 0 ? values => new Set(values) : () => {};
7967
+ const createSet = Set && 1 / setToArray(new Set([undefined, -0]))[1] == 1 / 0 ? values => new Set(values) : () => {/* no-op */};
7968
7968
  function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
7969
7969
  if (isObject$1(objValue) && isObject$1(srcValue)) {
7970
7970
  // Recursively merge objects and arrays (susceptible to call stack limits).
@@ -8758,8 +8758,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
8758
8758
  }
8759
8759
  const groupBy = (collection, iteratee) => {
8760
8760
  iteratee = getIteratee(iteratee, 2);
8761
- return reduce(collection, (result, value, key) => {
8762
- key = iteratee(value);
8761
+ return reduce(collection, (result, value) => {
8762
+ const key = iteratee(value);
8763
8763
  if (hasOwnProperty.call(result, key)) {
8764
8764
  result[key].push(value);
8765
8765
  } else {
@@ -9152,8 +9152,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
9152
9152
  }
9153
9153
  return ret;
9154
9154
  };
9155
- $.fn.add = function (selector, context) {
9156
- const newElements = $(selector, context).toArray();
9155
+ $.fn.add = function (selector) {
9156
+ const newElements = $(selector).toArray();
9157
9157
  const prevElements = this.toArray();
9158
9158
  const ret = this.pushStack([]);
9159
9159
  $.merge(ret, uniq(prevElements.concat(newElements)));
@@ -9969,8 +9969,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
9969
9969
  case 'bottom':
9970
9970
  dy = -(0.25 * llMaxFont) - rLineHeights;
9971
9971
  break;
9972
- default:
9973
9972
  case 'top':
9973
+ default:
9974
9974
  dy = 0.8 * flMaxFont;
9975
9975
  break;
9976
9976
  }
@@ -11817,7 +11817,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
11817
11817
  if (!el) return null;
11818
11818
  if (arguments.length === 0) return el.innerHTML;
11819
11819
  if (html === undefined) return this; // do nothing
11820
- cleanNodesData(dataPriv, el.getElementsByTagName('*'));
11820
+ cleanNodesData(el.getElementsByTagName('*'));
11821
11821
  if (typeof html === 'string' || typeof html === 'number') {
11822
11822
  el.innerHTML = html;
11823
11823
  } else {
@@ -12076,17 +12076,21 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12076
12076
  // when a statically positioned element is identified
12077
12077
  doc = el.ownerDocument;
12078
12078
  offsetParent = el.offsetParent || doc.documentElement;
12079
- const $parentOffset = $(offsetParent);
12080
- const parentOffsetElementPosition = $parentOffset.css('position') || 'static';
12081
- while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && parentOffsetElementPosition === 'static') {
12082
- offsetParent = offsetParent.parentNode;
12079
+ const isStaticallyPositioned = el => {
12080
+ const {
12081
+ position
12082
+ } = getComputedStyle(el);
12083
+ return position === 'static';
12084
+ };
12085
+ while (offsetParent && offsetParent !== doc.documentElement && isStaticallyPositioned(offsetParent)) {
12086
+ offsetParent = offsetParent.offsetParent || doc.documentElement;
12083
12087
  }
12084
- if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1) {
12088
+ if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1 && !isStaticallyPositioned(offsetParent)) {
12085
12089
  // Incorporate borders into its offset, since they are outside its content origin
12086
12090
  const offsetParentStyles = window.getComputedStyle(offsetParent);
12087
12091
  const borderTopWidth = parseFloat(offsetParentStyles.borderTopWidth) || 0;
12088
12092
  const borderLeftWidth = parseFloat(offsetParentStyles.borderLeftWidth) || 0;
12089
- parentOffset = $parentOffset.offset();
12093
+ parentOffset = $(offsetParent).offset();
12090
12094
  parentOffset.top += borderTopWidth;
12091
12095
  parentOffset.left += borderLeftWidth;
12092
12096
  }
@@ -12445,9 +12449,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12445
12449
  const selectors = {};
12446
12450
  const groupSelectors = {};
12447
12451
  const svgNamespace = V.namespace.svg;
12448
- const ns = namespace || svgNamespace;
12452
+ const initialNS = namespace || svgNamespace;
12449
12453
  const fragment = document.createDocumentFragment();
12450
- const parseNode = function (siblingsDef, parentNode, ns) {
12454
+ const parseNode = function (siblingsDef, parentNode, parentNS) {
12451
12455
  for (let i = 0; i < siblingsDef.length; i++) {
12452
12456
  const nodeDef = siblingsDef[i];
12453
12457
 
@@ -12464,7 +12468,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12464
12468
  let node;
12465
12469
 
12466
12470
  // Namespace URI
12467
- if (nodeDef.hasOwnProperty('namespaceURI')) ns = nodeDef.namespaceURI;
12471
+ const ns = nodeDef.hasOwnProperty('namespaceURI') ? nodeDef.namespaceURI : parentNS;
12468
12472
  node = document.createElementNS(ns, tagName);
12469
12473
  const svg = ns === svgNamespace;
12470
12474
  const wrapperNode = svg ? V(node) : $(node);
@@ -12514,7 +12518,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
12514
12518
  }
12515
12519
  }
12516
12520
  };
12517
- parseNode(json, fragment, ns);
12521
+ parseNode(json, fragment, initialNS);
12518
12522
  return {
12519
12523
  fragment: fragment,
12520
12524
  selectors: selectors,
@@ -13845,7 +13849,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
13845
13849
  } = opt || {};
13846
13850
  return findDifference(object, base, 0, maxDepth);
13847
13851
  }
13848
- const noop = function () {};
13852
+ const noop = function () {
13853
+ // Do nothing.
13854
+ };
13849
13855
 
13850
13856
  // Events
13851
13857
  // ---------------
@@ -14316,10 +14322,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
14316
14322
  cidPrefix: 'c',
14317
14323
  // preinitialize is an empty function by default. You can override it with a function
14318
14324
  // or object. preinitialize will run before any instantiation logic is run in the Model.
14319
- preinitialize: function () {},
14325
+ preinitialize: function () {
14326
+ // No implementation.
14327
+ },
14320
14328
  // Initialize is an empty function by default. Override it with your own
14321
14329
  // initialization logic.
14322
- initialize: function () {},
14330
+ initialize: function () {
14331
+ // No implementation.
14332
+ },
14323
14333
  // Return a copy of the model's `attributes` object.
14324
14334
  toJSON: function (options) {
14325
14335
  return clone(this.attributes);
@@ -20536,10 +20546,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
20536
20546
  },
20537
20547
  // preinitialize is an empty function by default. You can override it with a function
20538
20548
  // or object. preinitialize will run before any instantiation logic is run in the View
20539
- preinitialize: function () {},
20549
+ preinitialize: function () {
20550
+ // No implementation.
20551
+ },
20540
20552
  // Initialize is an empty function by default. Override it with your own
20541
20553
  // initialization logic.
20542
- initialize: function () {},
20554
+ initialize: function () {
20555
+ // No implementation.
20556
+ },
20543
20557
  // **render** is the core function that your view should override, in order
20544
20558
  // to populate its element (`this.el`), with the appropriate HTML. The
20545
20559
  // convention is for **render** to always return `this`.
@@ -20929,7 +20943,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
20929
20943
  for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
20930
20944
  args[_key2 - 2] = arguments[_key2];
20931
20945
  }
20932
- if (V.isObject(evt)) {
20946
+ if (evt && typeof evt === 'object') {
20933
20947
  const [context = null] = args;
20934
20948
  Object.entries(evt).forEach(_ref => {
20935
20949
  let [eventName, cb] = _ref;
@@ -21006,10 +21020,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
21006
21020
  model: Model,
21007
21021
  // preinitialize is an empty function by default. You can override it with a function
21008
21022
  // or object. preinitialize will run before any instantiation logic is run in the Collection.
21009
- preinitialize: function () {},
21023
+ preinitialize: function () {
21024
+ // No implementation.
21025
+ },
21010
21026
  // Initialize is an empty function by default. Override it with your own
21011
21027
  // initialization logic.
21012
- initialize: function () {},
21028
+ initialize: function () {
21029
+ // No implementation.
21030
+ },
21013
21031
  // The JSON representation of a Collection is an array of the
21014
21032
  // models' attributes.
21015
21033
  toJSON: function (options) {
@@ -21527,13 +21545,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
21527
21545
  cellView,
21528
21546
  nodeSelector
21529
21547
  } = this;
21530
- if (!cellView.isMounted()) {
21548
+ if (cellView.isMounted()) {
21549
+ this.update(cellView, nodeSelector);
21550
+ this.mount();
21551
+ this.transform();
21552
+ } else {
21531
21553
  this.postponedUpdate = true;
21532
- return 0;
21533
21554
  }
21534
- this.update(cellView, nodeSelector);
21535
- this.mount();
21536
- this.transform();
21537
21555
  return 0;
21538
21556
  },
21539
21557
  findNode(cellView) {
@@ -28515,7 +28533,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28515
28533
  /**
28516
28534
  * @abstract
28517
28535
  */
28518
- _initializePorts: function () {},
28536
+ _initializePorts: function () {
28537
+ // implemented in ports.js
28538
+ },
28519
28539
  update: function (_, renderingOnlyAttrs) {
28520
28540
  this.cleanNodesCache();
28521
28541
 
@@ -29148,9 +29168,15 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
29148
29168
  },
29149
29169
  // Drag Handlers
29150
29170
 
29171
+ snapToGrid: function (evt, x, y) {
29172
+ const grid = this.paper.options.gridSize;
29173
+ return {
29174
+ x: snapToGrid(x, grid),
29175
+ y: snapToGrid(y, grid)
29176
+ };
29177
+ },
29151
29178
  drag: function (evt, x, y) {
29152
29179
  var paper = this.paper;
29153
- var grid = paper.options.gridSize;
29154
29180
  var element = this.model;
29155
29181
  var data = this.eventData(evt);
29156
29182
  var {
@@ -29160,8 +29186,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
29160
29186
  } = data;
29161
29187
 
29162
29188
  // Make sure the new element's position always snaps to the current grid
29163
- var elX = snapToGrid(x + pointerOffset.x, grid);
29164
- var elY = snapToGrid(y + pointerOffset.y, grid);
29189
+ const {
29190
+ x: elX,
29191
+ y: elY
29192
+ } = this.snapToGrid(evt, x + pointerOffset.x, y + pointerOffset.y);
29165
29193
  element.position(elX, elY, {
29166
29194
  restrictedArea,
29167
29195
  deep: true,
@@ -36496,7 +36524,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
36496
36524
  Control: Control
36497
36525
  });
36498
36526
 
36499
- var version = "4.1.1";
36527
+ var version = "4.1.3";
36500
36528
 
36501
36529
  const Vectorizer = V;
36502
36530
  const layout = {