@joint/core 4.1.1 → 4.1.2

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.
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.1 (2024-12-02) - JavaScript diagramming library
1
+ /*! JointJS v4.1.2 (2025-01-16) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -7252,7 +7252,7 @@ var joint = (function (exports) {
7252
7252
  const Constructor = object.constructor;
7253
7253
  switch (tag) {
7254
7254
  case arrayBufferTag:
7255
- return cloneArrayBuffer(object, isDeep);
7255
+ return cloneArrayBuffer(object);
7256
7256
  case boolTag:
7257
7257
  case dateTag:
7258
7258
  return new Constructor(+object);
@@ -7871,7 +7871,7 @@ var joint = (function (exports) {
7871
7871
  }
7872
7872
  assignMergeValue(object, key, newValue);
7873
7873
  }
7874
- }, keysIn);
7874
+ });
7875
7875
  };
7876
7876
  const baseMergeDeep = (object, source, key, srcIndex, mergeFunc, customizer, stack) => {
7877
7877
  const objValue = safeGet(object, key);
@@ -7961,7 +7961,7 @@ var joint = (function (exports) {
7961
7961
  const length = array == null ? 0 : array.length;
7962
7962
  return length ? array[length - 1] : undefined;
7963
7963
  }
7964
- const createSet = Set && 1 / setToArray(new Set([undefined, -0]))[1] == 1 / 0 ? values => new Set(values) : () => {};
7964
+ const createSet = Set && 1 / setToArray(new Set([undefined, -0]))[1] == 1 / 0 ? values => new Set(values) : () => {/* no-op */};
7965
7965
  function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
7966
7966
  if (isObject$1(objValue) && isObject$1(srcValue)) {
7967
7967
  // Recursively merge objects and arrays (susceptible to call stack limits).
@@ -8755,8 +8755,8 @@ var joint = (function (exports) {
8755
8755
  }
8756
8756
  const groupBy = (collection, iteratee) => {
8757
8757
  iteratee = getIteratee(iteratee, 2);
8758
- return reduce(collection, (result, value, key) => {
8759
- key = iteratee(value);
8758
+ return reduce(collection, (result, value) => {
8759
+ const key = iteratee(value);
8760
8760
  if (hasOwnProperty.call(result, key)) {
8761
8761
  result[key].push(value);
8762
8762
  } else {
@@ -9149,8 +9149,8 @@ var joint = (function (exports) {
9149
9149
  }
9150
9150
  return ret;
9151
9151
  };
9152
- $.fn.add = function (selector, context) {
9153
- const newElements = $(selector, context).toArray();
9152
+ $.fn.add = function (selector) {
9153
+ const newElements = $(selector).toArray();
9154
9154
  const prevElements = this.toArray();
9155
9155
  const ret = this.pushStack([]);
9156
9156
  $.merge(ret, uniq(prevElements.concat(newElements)));
@@ -9966,8 +9966,8 @@ var joint = (function (exports) {
9966
9966
  case 'bottom':
9967
9967
  dy = -(0.25 * llMaxFont) - rLineHeights;
9968
9968
  break;
9969
- default:
9970
9969
  case 'top':
9970
+ default:
9971
9971
  dy = 0.8 * flMaxFont;
9972
9972
  break;
9973
9973
  }
@@ -11814,7 +11814,7 @@ var joint = (function (exports) {
11814
11814
  if (!el) return null;
11815
11815
  if (arguments.length === 0) return el.innerHTML;
11816
11816
  if (html === undefined) return this; // do nothing
11817
- cleanNodesData(dataPriv, el.getElementsByTagName('*'));
11817
+ cleanNodesData(el.getElementsByTagName('*'));
11818
11818
  if (typeof html === 'string' || typeof html === 'number') {
11819
11819
  el.innerHTML = html;
11820
11820
  } else {
@@ -12073,17 +12073,21 @@ var joint = (function (exports) {
12073
12073
  // when a statically positioned element is identified
12074
12074
  doc = el.ownerDocument;
12075
12075
  offsetParent = el.offsetParent || doc.documentElement;
12076
- const $parentOffset = $(offsetParent);
12077
- const parentOffsetElementPosition = $parentOffset.css('position') || 'static';
12078
- while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && parentOffsetElementPosition === 'static') {
12079
- offsetParent = offsetParent.parentNode;
12076
+ const isStaticallyPositioned = el => {
12077
+ const {
12078
+ position
12079
+ } = el.style;
12080
+ return !position || position === 'static';
12081
+ };
12082
+ while (offsetParent && offsetParent !== doc.documentElement && isStaticallyPositioned(offsetParent)) {
12083
+ offsetParent = offsetParent.offsetParent || doc.documentElement;
12080
12084
  }
12081
- if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1) {
12085
+ if (offsetParent && offsetParent !== el && offsetParent.nodeType === 1 && !isStaticallyPositioned(offsetParent)) {
12082
12086
  // Incorporate borders into its offset, since they are outside its content origin
12083
12087
  const offsetParentStyles = window.getComputedStyle(offsetParent);
12084
12088
  const borderTopWidth = parseFloat(offsetParentStyles.borderTopWidth) || 0;
12085
12089
  const borderLeftWidth = parseFloat(offsetParentStyles.borderLeftWidth) || 0;
12086
- parentOffset = $parentOffset.offset();
12090
+ parentOffset = $(offsetParent).offset();
12087
12091
  parentOffset.top += borderTopWidth;
12088
12092
  parentOffset.left += borderLeftWidth;
12089
12093
  }
@@ -12442,9 +12446,9 @@ var joint = (function (exports) {
12442
12446
  const selectors = {};
12443
12447
  const groupSelectors = {};
12444
12448
  const svgNamespace = V.namespace.svg;
12445
- const ns = namespace || svgNamespace;
12449
+ const initialNS = namespace || svgNamespace;
12446
12450
  const fragment = document.createDocumentFragment();
12447
- const parseNode = function (siblingsDef, parentNode, ns) {
12451
+ const parseNode = function (siblingsDef, parentNode, parentNS) {
12448
12452
  for (let i = 0; i < siblingsDef.length; i++) {
12449
12453
  const nodeDef = siblingsDef[i];
12450
12454
 
@@ -12461,7 +12465,7 @@ var joint = (function (exports) {
12461
12465
  let node;
12462
12466
 
12463
12467
  // Namespace URI
12464
- if (nodeDef.hasOwnProperty('namespaceURI')) ns = nodeDef.namespaceURI;
12468
+ const ns = nodeDef.hasOwnProperty('namespaceURI') ? nodeDef.namespaceURI : parentNS;
12465
12469
  node = document.createElementNS(ns, tagName);
12466
12470
  const svg = ns === svgNamespace;
12467
12471
  const wrapperNode = svg ? V(node) : $(node);
@@ -12511,7 +12515,7 @@ var joint = (function (exports) {
12511
12515
  }
12512
12516
  }
12513
12517
  };
12514
- parseNode(json, fragment, ns);
12518
+ parseNode(json, fragment, initialNS);
12515
12519
  return {
12516
12520
  fragment: fragment,
12517
12521
  selectors: selectors,
@@ -13842,7 +13846,9 @@ var joint = (function (exports) {
13842
13846
  } = opt || {};
13843
13847
  return findDifference(object, base, 0, maxDepth);
13844
13848
  }
13845
- const noop = function () {};
13849
+ const noop = function () {
13850
+ // Do nothing.
13851
+ };
13846
13852
 
13847
13853
  // Events
13848
13854
  // ---------------
@@ -14313,10 +14319,14 @@ var joint = (function (exports) {
14313
14319
  cidPrefix: 'c',
14314
14320
  // preinitialize is an empty function by default. You can override it with a function
14315
14321
  // or object. preinitialize will run before any instantiation logic is run in the Model.
14316
- preinitialize: function () {},
14322
+ preinitialize: function () {
14323
+ // No implementation.
14324
+ },
14317
14325
  // Initialize is an empty function by default. Override it with your own
14318
14326
  // initialization logic.
14319
- initialize: function () {},
14327
+ initialize: function () {
14328
+ // No implementation.
14329
+ },
14320
14330
  // Return a copy of the model's `attributes` object.
14321
14331
  toJSON: function (options) {
14322
14332
  return clone(this.attributes);
@@ -20533,10 +20543,14 @@ var joint = (function (exports) {
20533
20543
  },
20534
20544
  // preinitialize is an empty function by default. You can override it with a function
20535
20545
  // or object. preinitialize will run before any instantiation logic is run in the View
20536
- preinitialize: function () {},
20546
+ preinitialize: function () {
20547
+ // No implementation.
20548
+ },
20537
20549
  // Initialize is an empty function by default. Override it with your own
20538
20550
  // initialization logic.
20539
- initialize: function () {},
20551
+ initialize: function () {
20552
+ // No implementation.
20553
+ },
20540
20554
  // **render** is the core function that your view should override, in order
20541
20555
  // to populate its element (`this.el`), with the appropriate HTML. The
20542
20556
  // convention is for **render** to always return `this`.
@@ -20926,7 +20940,7 @@ var joint = (function (exports) {
20926
20940
  for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
20927
20941
  args[_key2 - 2] = arguments[_key2];
20928
20942
  }
20929
- if (V.isObject(evt)) {
20943
+ if (evt && typeof evt === 'object') {
20930
20944
  const [context = null] = args;
20931
20945
  Object.entries(evt).forEach(_ref => {
20932
20946
  let [eventName, cb] = _ref;
@@ -21003,10 +21017,14 @@ var joint = (function (exports) {
21003
21017
  model: Model,
21004
21018
  // preinitialize is an empty function by default. You can override it with a function
21005
21019
  // or object. preinitialize will run before any instantiation logic is run in the Collection.
21006
- preinitialize: function () {},
21020
+ preinitialize: function () {
21021
+ // No implementation.
21022
+ },
21007
21023
  // Initialize is an empty function by default. Override it with your own
21008
21024
  // initialization logic.
21009
- initialize: function () {},
21025
+ initialize: function () {
21026
+ // No implementation.
21027
+ },
21010
21028
  // The JSON representation of a Collection is an array of the
21011
21029
  // models' attributes.
21012
21030
  toJSON: function (options) {
@@ -21524,13 +21542,13 @@ var joint = (function (exports) {
21524
21542
  cellView,
21525
21543
  nodeSelector
21526
21544
  } = this;
21527
- if (!cellView.isMounted()) {
21545
+ if (cellView.isMounted()) {
21546
+ this.update(cellView, nodeSelector);
21547
+ this.mount();
21548
+ this.transform();
21549
+ } else {
21528
21550
  this.postponedUpdate = true;
21529
- return 0;
21530
21551
  }
21531
- this.update(cellView, nodeSelector);
21532
- this.mount();
21533
- this.transform();
21534
21552
  return 0;
21535
21553
  },
21536
21554
  findNode(cellView) {
@@ -28512,7 +28530,9 @@ var joint = (function (exports) {
28512
28530
  /**
28513
28531
  * @abstract
28514
28532
  */
28515
- _initializePorts: function () {},
28533
+ _initializePorts: function () {
28534
+ // implemented in ports.js
28535
+ },
28516
28536
  update: function (_, renderingOnlyAttrs) {
28517
28537
  this.cleanNodesCache();
28518
28538
 
@@ -36493,7 +36513,7 @@ var joint = (function (exports) {
36493
36513
  Control: Control
36494
36514
  });
36495
36515
 
36496
- var version = "4.1.1";
36516
+ var version = "4.1.2";
36497
36517
 
36498
36518
  const Vectorizer = V;
36499
36519
  const layout = {