bpmn-js 17.8.0 → 17.8.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,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-navigated-viewer v17.8.0
2
+ * bpmn-js - bpmn-navigated-viewer v17.8.2
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2024-05-28
11
+ * Date: 2024-06-17
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * @template T
25
25
  *
26
- * @param {T[][]} arr
26
+ * @param {T[][] | T[] | null} [arr]
27
27
  *
28
28
  * @return {T[]}
29
29
  */
@@ -504,7 +504,7 @@
504
504
  *
505
505
  * @return {T}
506
506
  */
507
- function set$2(target, path, value) {
507
+ function set$1(target, path, value) {
508
508
 
509
509
  let currentTarget = target;
510
510
 
@@ -1070,6 +1070,7 @@
1070
1070
  * appendTo utility
1071
1071
  */
1072
1072
 
1073
+
1073
1074
  /**
1074
1075
  * Append a node to a target element and return the appended node.
1075
1076
  *
@@ -1086,6 +1087,7 @@
1086
1087
  * append utility
1087
1088
  */
1088
1089
 
1090
+
1089
1091
  /**
1090
1092
  * Append a node to an element
1091
1093
  *
@@ -1358,16 +1360,6 @@
1358
1360
  return this.list.contains(name);
1359
1361
  };
1360
1362
 
1361
- function remove$2(element) {
1362
- var parent = element.parentNode;
1363
-
1364
- if (parent) {
1365
- parent.removeChild(element);
1366
- }
1367
-
1368
- return element;
1369
- }
1370
-
1371
1363
  /**
1372
1364
  * Clear utility
1373
1365
  */
@@ -1375,14 +1367,14 @@
1375
1367
  /**
1376
1368
  * Removes all children from the given element
1377
1369
  *
1378
- * @param {DOMElement} element
1379
- * @return {DOMElement} the element (for chaining)
1370
+ * @param {SVGElement} element
1371
+ * @return {Element} the element (for chaining)
1380
1372
  */
1381
1373
  function clear$1(element) {
1382
1374
  var child;
1383
1375
 
1384
1376
  while ((child = element.firstChild)) {
1385
- remove$2(child);
1377
+ element.removeChild(child);
1386
1378
  }
1387
1379
 
1388
1380
  return element;
@@ -1396,6 +1388,7 @@
1396
1388
  * DOM parsing utility
1397
1389
  */
1398
1390
 
1391
+
1399
1392
  var SVG_START = '<svg xmlns="' + ns.svg + '"';
1400
1393
 
1401
1394
  function parse$1(svg) {
@@ -1447,6 +1440,7 @@
1447
1440
  */
1448
1441
 
1449
1442
 
1443
+
1450
1444
  /**
1451
1445
  * Create a specific type from name or SVG markup.
1452
1446
  *
@@ -1458,6 +1452,8 @@
1458
1452
  function create$1(name, attrs) {
1459
1453
  var element;
1460
1454
 
1455
+ name = name.trim();
1456
+
1461
1457
  if (name.charAt(0) === '<') {
1462
1458
  element = parse$1(name).firstChild;
1463
1459
  element = document.importNode(element, true);
@@ -1476,6 +1472,7 @@
1476
1472
  * Geometry helpers
1477
1473
  */
1478
1474
 
1475
+
1479
1476
  // fake node used to instantiate svg geometry elements
1480
1477
  var node = null;
1481
1478
 
@@ -1529,9 +1526,7 @@
1529
1526
  }
1530
1527
 
1531
1528
  function createTransform(matrix) {
1532
- if (matrix) {
1533
- return getNode().createSVGTransformFromMatrix(matrix);
1534
- } else {
1529
+ {
1535
1530
  return getNode().createSVGTransform();
1536
1531
  }
1537
1532
  }
@@ -1613,38 +1608,6 @@
1613
1608
  return output;
1614
1609
  }
1615
1610
 
1616
- /**
1617
- * innerHTML like functionality for SVG elements.
1618
- * based on innerSVG (https://code.google.com/p/innersvg)
1619
- */
1620
-
1621
-
1622
- function set$1(element, svg) {
1623
-
1624
- var parsed = parse$1(svg);
1625
-
1626
- // clear element contents
1627
- clear$1(element);
1628
-
1629
- if (!svg) {
1630
- return;
1631
- }
1632
-
1633
- if (!isFragment(parsed)) {
1634
-
1635
- // extract <svg> from parsed document
1636
- parsed = parsed.documentElement;
1637
- }
1638
-
1639
- var nodes = slice$1(parsed.childNodes);
1640
-
1641
- // import + append each node
1642
- for (var i = 0; i < nodes.length; i++) {
1643
- appendTo(nodes[i], element);
1644
- }
1645
-
1646
- }
1647
-
1648
1611
  function get(element) {
1649
1612
  var child = element.firstChild,
1650
1613
  output = [];
@@ -1657,29 +1620,21 @@
1657
1620
  return output.join('');
1658
1621
  }
1659
1622
 
1660
- function isFragment(node) {
1661
- return node.nodeName === '#document-fragment';
1662
- }
1663
-
1664
1623
  function innerSVG(element, svg) {
1665
1624
 
1666
- if (svg !== undefined) {
1667
-
1668
- try {
1669
- set$1(element, svg);
1670
- } catch (e) {
1671
- throw new Error('error parsing SVG: ' + e.message);
1672
- }
1673
-
1674
- return element;
1675
- } else {
1625
+ {
1676
1626
  return get(element);
1677
1627
  }
1678
1628
  }
1679
1629
 
1630
+ function remove$2(element) {
1631
+ var parent = element.parentNode;
1680
1632
 
1681
- function slice$1(arr) {
1682
- return Array.prototype.slice.call(arr);
1633
+ if (parent) {
1634
+ parent.removeChild(element);
1635
+ }
1636
+
1637
+ return element;
1683
1638
  }
1684
1639
 
1685
1640
  /**
@@ -2127,9 +2082,11 @@
2127
2082
  /**
2128
2083
  * Flatten array, one level deep.
2129
2084
  *
2130
- * @param {Array<?>} arr
2085
+ * @template T
2131
2086
  *
2132
- * @return {Array<?>}
2087
+ * @param {T[][] | T[] | null} [arr]
2088
+ *
2089
+ * @return {T[]}
2133
2090
  */
2134
2091
 
2135
2092
  const nativeToString = Object.prototype.toString;
@@ -2160,10 +2117,11 @@
2160
2117
  * Iterate over collection; returning something
2161
2118
  * (non-undefined) will stop iteration.
2162
2119
  *
2163
- * @param {Array|Object} collection
2164
- * @param {Function} iterator
2120
+ * @template T
2121
+ * @param {Collection<T>} collection
2122
+ * @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
2165
2123
  *
2166
- * @return {Object} return result that stopped the iteration
2124
+ * @return {T} return result that stopped the iteration
2167
2125
  */
2168
2126
  function forEach(collection, iterator) {
2169
2127
 
@@ -2386,51 +2344,37 @@
2386
2344
  };
2387
2345
 
2388
2346
  /**
2389
- * Remove all children from the given element.
2347
+ * Clear utility
2390
2348
  */
2391
- function clear(el) {
2392
-
2393
- var c;
2394
-
2395
- while (el.childNodes.length) {
2396
- c = el.childNodes[0];
2397
- el.removeChild(c);
2398
- }
2399
-
2400
- return el;
2401
- }
2402
2349
 
2403
2350
  /**
2404
- * @param { HTMLElement } element
2405
- * @param { String } selector
2351
+ * Removes all children from the given element
2406
2352
  *
2407
- * @return { boolean }
2353
+ * @param {Element} element
2354
+ *
2355
+ * @return {Element} the element (for chaining)
2408
2356
  */
2409
- function matches(element, selector) {
2410
- return element && typeof element.matches === 'function' && element.matches(selector);
2357
+ function clear(element) {
2358
+ var child;
2359
+
2360
+ while ((child = element.firstChild)) {
2361
+ element.removeChild(child);
2362
+ }
2363
+
2364
+ return element;
2411
2365
  }
2412
2366
 
2413
2367
  /**
2414
2368
  * Closest
2415
2369
  *
2416
2370
  * @param {Element} el
2417
- * @param {String} selector
2418
- * @param {Boolean} checkYourSelf (optional)
2371
+ * @param {string} selector
2372
+ * @param {boolean} checkYourSelf (optional)
2419
2373
  */
2420
2374
  function closest(element, selector, checkYourSelf) {
2421
- var currentElem = checkYourSelf ? element : element.parentNode;
2422
-
2423
- while (currentElem && currentElem.nodeType !== document.DOCUMENT_NODE &&
2424
- currentElem.nodeType !== document.DOCUMENT_FRAGMENT_NODE) {
2425
-
2426
- if (matches(currentElem, selector)) {
2427
- return currentElem;
2428
- }
2375
+ var actualElement = checkYourSelf ? element : element.parentNode;
2429
2376
 
2430
- currentElem = currentElem.parentNode;
2431
- }
2432
-
2433
- return matches(currentElem, selector) ? currentElem : null;
2377
+ return actualElement && typeof actualElement.closest === 'function' && actualElement.closest(selector) || null;
2434
2378
  }
2435
2379
 
2436
2380
  var componentEvent = {};
@@ -2656,6 +2600,16 @@
2656
2600
 
2657
2601
  var domify$1 = domify;
2658
2602
 
2603
+ /**
2604
+ * @param { HTMLElement } element
2605
+ * @param { String } selector
2606
+ *
2607
+ * @return { boolean }
2608
+ */
2609
+ function matches(element, selector) {
2610
+ return element && typeof element.matches === 'function' && element.matches(selector) || false;
2611
+ }
2612
+
2659
2613
  function query(selector, el) {
2660
2614
  el = el || document;
2661
2615
 
@@ -2687,7 +2641,7 @@
2687
2641
  rotate.setRotate(angle || 0, 0, 0);
2688
2642
 
2689
2643
  var scale = createTransform();
2690
- scale.setScale(amount || 1, amount || 1);
2644
+ scale.setScale(1, 1);
2691
2645
 
2692
2646
  transform$1(gfx, [ translate, rotate, scale ]);
2693
2647
  }
@@ -8053,24 +8007,31 @@
8053
8007
  businessObjectParents = getBusinessObjectParentChain(element);
8054
8008
  }
8055
8009
 
8056
- var path = businessObjectParents.map(function(parent) {
8057
- var title = escapeHTML(parent.name || parent.id);
8058
- var link = domify$1('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
8010
+ var path = businessObjectParents.flatMap(function(parent) {
8011
+ var parentPlane =
8012
+ canvas.findRoot(getPlaneIdFromShape(parent)) ||
8013
+ canvas.findRoot(parent.id);
8059
8014
 
8060
- var parentPlane = canvas.findRoot(getPlaneIdFromShape(parent)) || canvas.findRoot(parent.id);
8061
-
8062
- // when the root is a collaboration, the process does not have a corresponding
8063
- // element in the elementRegisty. Instead, we search for the corresponding participant
8015
+ // when the root is a collaboration, the process does not have a
8016
+ // corresponding element in the elementRegisty. Instead, we search
8017
+ // for the corresponding participant
8064
8018
  if (!parentPlane && is$1(parent, 'bpmn:Process')) {
8065
8019
  var participant = elementRegistry.find(function(element) {
8066
8020
  var businessObject = getBusinessObject(element);
8067
8021
 
8068
- return businessObject && businessObject.get('processRef') && businessObject.get('processRef') === parent;
8022
+ return businessObject && businessObject.get('processRef') === parent;
8069
8023
  });
8070
8024
 
8071
- parentPlane = canvas.findRoot(participant.id);
8025
+ parentPlane = participant && canvas.findRoot(participant.id);
8026
+ }
8027
+
8028
+ if (!parentPlane) {
8029
+ return [];
8072
8030
  }
8073
8031
 
8032
+ var title = escapeHTML(parent.name || parent.id);
8033
+ var link = domify$1('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
8034
+
8074
8035
  link.addEventListener('click', function() {
8075
8036
  canvas.setRootElement(parentPlane);
8076
8037
  });
@@ -9115,6 +9076,7 @@
9115
9076
  * @typedef {import('../util/Types').Point} Point
9116
9077
  */
9117
9078
 
9079
+
9118
9080
  /**
9119
9081
  * @param {import('../core/EventBus').Event} event
9120
9082
  *
@@ -15354,7 +15316,7 @@
15354
15316
  return this[key];
15355
15317
  },
15356
15318
  set: function(key, value) {
15357
- set$2(this, [ key ], value);
15319
+ set$1(this, [ key ], value);
15358
15320
  }
15359
15321
  };
15360
15322
 
@@ -22735,6 +22697,7 @@
22735
22697
  */
22736
22698
 
22737
22699
 
22700
+
22738
22701
  // inlined ../../resources/logo.svg
22739
22702
  var BPMNIO_LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';
22740
22703
 
@@ -24376,6 +24339,7 @@
24376
24339
  */
24377
24340
 
24378
24341
 
24342
+
24379
24343
  /**
24380
24344
  * @param {Point} a
24381
24345
  * @param {Point} b