camunda-bpmn-js 0.23.1 → 0.24.1

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.
@@ -682,7 +682,7 @@
682
682
  }
683
683
  }
684
684
 
685
- function ensureImported$2(element, target) {
685
+ function ensureImported(element, target) {
686
686
 
687
687
  if (element.ownerDocument !== target.ownerDocument) {
688
688
  try {
@@ -710,8 +710,8 @@
710
710
  *
711
711
  * @return {SVGElement} the appended node
712
712
  */
713
- function appendTo$2(element, target) {
714
- return target.appendChild(ensureImported$2(element, target));
713
+ function appendTo(element, target) {
714
+ return target.appendChild(ensureImported(element, target));
715
715
  }
716
716
 
717
717
  /**
@@ -726,8 +726,8 @@
726
726
  *
727
727
  * @return {SVGElement} the element
728
728
  */
729
- function append$2(target, node) {
730
- appendTo$2(node, target);
729
+ function append(target, node) {
730
+ appendTo(node, target);
731
731
  return target;
732
732
  }
733
733
 
@@ -735,9 +735,9 @@
735
735
  * attribute accessor utility
736
736
  */
737
737
 
738
- var LENGTH_ATTR$2 = 2;
738
+ var LENGTH_ATTR = 2;
739
739
 
740
- var CSS_PROPERTIES$2 = {
740
+ var CSS_PROPERTIES = {
741
741
  'alignment-baseline': 1,
742
742
  'baseline-shift': 1,
743
743
  'clip': 1,
@@ -761,7 +761,7 @@
761
761
  'flood-opacity': 1,
762
762
  'font': 1,
763
763
  'font-family': 1,
764
- 'font-size': LENGTH_ATTR$2,
764
+ 'font-size': LENGTH_ATTR,
765
765
  'font-size-adjust': 1,
766
766
  'font-stretch': 1,
767
767
  'font-style': 1,
@@ -791,7 +791,7 @@
791
791
  'stroke-linejoin': 1,
792
792
  'stroke-miterlimit': 1,
793
793
  'stroke-opacity': 1,
794
- 'stroke-width': LENGTH_ATTR$2,
794
+ 'stroke-width': LENGTH_ATTR,
795
795
  'text-anchor': 1,
796
796
  'text-decoration': 1,
797
797
  'text-rendering': 1,
@@ -802,23 +802,23 @@
802
802
  };
803
803
 
804
804
 
805
- function getAttribute$2(node, name) {
806
- if (CSS_PROPERTIES$2[name]) {
805
+ function getAttribute(node, name) {
806
+ if (CSS_PROPERTIES[name]) {
807
807
  return node.style[name];
808
808
  } else {
809
809
  return node.getAttributeNS(null, name);
810
810
  }
811
811
  }
812
812
 
813
- function setAttribute$2(node, name, value) {
813
+ function setAttribute(node, name, value) {
814
814
  var hyphenated = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
815
815
 
816
- var type = CSS_PROPERTIES$2[hyphenated];
816
+ var type = CSS_PROPERTIES[hyphenated];
817
817
 
818
818
  if (type) {
819
819
 
820
820
  // append pixel unit, unless present
821
- if (type === LENGTH_ATTR$2 && typeof value === 'number') {
821
+ if (type === LENGTH_ATTR && typeof value === 'number') {
822
822
  value = String(value) + 'px';
823
823
  }
824
824
 
@@ -828,12 +828,12 @@
828
828
  }
829
829
  }
830
830
 
831
- function setAttributes$2(node, attrs) {
831
+ function setAttributes(node, attrs) {
832
832
 
833
833
  var names = Object.keys(attrs), i, name;
834
834
 
835
835
  for (i = 0, name; (name = names[i]); i++) {
836
- setAttribute$2(node, name, attrs[name]);
836
+ setAttribute(node, name, attrs[name]);
837
837
  }
838
838
  }
839
839
 
@@ -847,15 +847,15 @@
847
847
  *
848
848
  * @return {String}
849
849
  */
850
- function attr$3(node, name, value) {
850
+ function attr$1(node, name, value) {
851
851
  if (typeof name === 'string') {
852
852
  if (value !== undefined) {
853
- setAttribute$2(node, name, value);
853
+ setAttribute(node, name, value);
854
854
  } else {
855
- return getAttribute$2(node, name);
855
+ return getAttribute(node, name);
856
856
  }
857
857
  } else {
858
- setAttributes$2(node, name);
858
+ setAttributes(node, name);
859
859
  }
860
860
 
861
861
  return node;
@@ -871,7 +871,7 @@
871
871
  * toString reference.
872
872
  */
873
873
 
874
- const toString$2 = Object.prototype.toString;
874
+ const toString$1 = Object.prototype.toString;
875
875
 
876
876
  /**
877
877
  * Wrap `el` in a `ClassList`.
@@ -881,11 +881,11 @@
881
881
  * @api public
882
882
  */
883
883
 
884
- function classes$2(el) {
885
- return new ClassList$2(el);
884
+ function classes$1(el) {
885
+ return new ClassList$1(el);
886
886
  }
887
887
 
888
- function ClassList$2(el) {
888
+ function ClassList$1(el) {
889
889
  if (!el || !el.nodeType) {
890
890
  throw new Error('A DOM element reference is required');
891
891
  }
@@ -901,7 +901,7 @@
901
901
  * @api public
902
902
  */
903
903
 
904
- ClassList$2.prototype.add = function(name) {
904
+ ClassList$1.prototype.add = function(name) {
905
905
  this.list.add(name);
906
906
  return this;
907
907
  };
@@ -916,8 +916,8 @@
916
916
  * @api public
917
917
  */
918
918
 
919
- ClassList$2.prototype.remove = function(name) {
920
- if ('[object RegExp]' == toString$2.call(name)) {
919
+ ClassList$1.prototype.remove = function(name) {
920
+ if ('[object RegExp]' == toString$1.call(name)) {
921
921
  return this.removeMatching(name);
922
922
  }
923
923
 
@@ -933,7 +933,7 @@
933
933
  * @api private
934
934
  */
935
935
 
936
- ClassList$2.prototype.removeMatching = function(re) {
936
+ ClassList$1.prototype.removeMatching = function(re) {
937
937
  const arr = this.array();
938
938
  for (let i = 0; i < arr.length; i++) {
939
939
  if (re.test(arr[i])) {
@@ -955,7 +955,7 @@
955
955
  * @api public
956
956
  */
957
957
 
958
- ClassList$2.prototype.toggle = function(name, force) {
958
+ ClassList$1.prototype.toggle = function(name, force) {
959
959
  if ('undefined' !== typeof force) {
960
960
  if (force !== this.list.toggle(name, force)) {
961
961
  this.list.toggle(name); // toggle again to correct
@@ -973,7 +973,7 @@
973
973
  * @api public
974
974
  */
975
975
 
976
- ClassList$2.prototype.array = function() {
976
+ ClassList$1.prototype.array = function() {
977
977
  return Array.from(this.list);
978
978
  };
979
979
 
@@ -985,12 +985,12 @@
985
985
  * @api public
986
986
  */
987
987
 
988
- ClassList$2.prototype.has =
989
- ClassList$2.prototype.contains = function(name) {
988
+ ClassList$1.prototype.has =
989
+ ClassList$1.prototype.contains = function(name) {
990
990
  return this.list.contains(name);
991
991
  };
992
992
 
993
- function remove$3(element) {
993
+ function remove$2(element) {
994
994
  var parent = element.parentNode;
995
995
 
996
996
  if (parent) {
@@ -1010,17 +1010,17 @@
1010
1010
  * @param {DOMElement} element
1011
1011
  * @return {DOMElement} the element (for chaining)
1012
1012
  */
1013
- function clear$2(element) {
1013
+ function clear$1(element) {
1014
1014
  var child;
1015
1015
 
1016
1016
  while ((child = element.firstChild)) {
1017
- remove$3(child);
1017
+ remove$2(child);
1018
1018
  }
1019
1019
 
1020
1020
  return element;
1021
1021
  }
1022
1022
 
1023
- var ns$2 = {
1023
+ var ns = {
1024
1024
  svg: 'http://www.w3.org/2000/svg'
1025
1025
  };
1026
1026
 
@@ -1028,25 +1028,25 @@
1028
1028
  * DOM parsing utility
1029
1029
  */
1030
1030
 
1031
- var SVG_START$2 = '<svg xmlns="' + ns$2.svg + '"';
1031
+ var SVG_START = '<svg xmlns="' + ns.svg + '"';
1032
1032
 
1033
- function parse$3(svg) {
1033
+ function parse$1(svg) {
1034
1034
 
1035
1035
  var unwrap = false;
1036
1036
 
1037
1037
  // ensure we import a valid svg document
1038
1038
  if (svg.substring(0, 4) === '<svg') {
1039
- if (svg.indexOf(ns$2.svg) === -1) {
1040
- svg = SVG_START$2 + svg.substring(4);
1039
+ if (svg.indexOf(ns.svg) === -1) {
1040
+ svg = SVG_START + svg.substring(4);
1041
1041
  }
1042
1042
  } else {
1043
1043
 
1044
1044
  // namespace svg
1045
- svg = SVG_START$2 + '>' + svg + '</svg>';
1045
+ svg = SVG_START + '>' + svg + '</svg>';
1046
1046
  unwrap = true;
1047
1047
  }
1048
1048
 
1049
- var parsed = parseDocument$2(svg);
1049
+ var parsed = parseDocument(svg);
1050
1050
 
1051
1051
  if (!unwrap) {
1052
1052
  return parsed;
@@ -1063,7 +1063,7 @@
1063
1063
  return fragment;
1064
1064
  }
1065
1065
 
1066
- function parseDocument$2(svg) {
1066
+ function parseDocument(svg) {
1067
1067
 
1068
1068
  var parser;
1069
1069
 
@@ -1087,18 +1087,18 @@
1087
1087
  *
1088
1088
  * @returns {SVGElement}
1089
1089
  */
1090
- function create$3(name, attrs) {
1090
+ function create$1(name, attrs) {
1091
1091
  var element;
1092
1092
 
1093
1093
  if (name.charAt(0) === '<') {
1094
- element = parse$3(name).firstChild;
1094
+ element = parse$1(name).firstChild;
1095
1095
  element = document.importNode(element, true);
1096
1096
  } else {
1097
- element = document.createElementNS(ns$2.svg, name);
1097
+ element = document.createElementNS(ns.svg, name);
1098
1098
  }
1099
1099
 
1100
1100
  if (attrs) {
1101
- attr$3(element, attrs);
1101
+ attr$1(element, attrs);
1102
1102
  }
1103
1103
 
1104
1104
  return element;
@@ -1113,7 +1113,7 @@
1113
1113
 
1114
1114
  function getNode() {
1115
1115
  if (node === null) {
1116
- node = create$3('svg');
1116
+ node = create$1('svg');
1117
1117
  }
1118
1118
 
1119
1119
  return node;
@@ -1168,6 +1168,152 @@
1168
1168
  }
1169
1169
  }
1170
1170
 
1171
+ /**
1172
+ * Serialization util
1173
+ */
1174
+
1175
+ var TEXT_ENTITIES = /([&<>]{1})/g;
1176
+ var ATTR_ENTITIES = /([\n\r"]{1})/g;
1177
+
1178
+ var ENTITY_REPLACEMENT = {
1179
+ '&': '&amp;',
1180
+ '<': '&lt;',
1181
+ '>': '&gt;',
1182
+ '"': '\''
1183
+ };
1184
+
1185
+ function escape$1(str, pattern) {
1186
+
1187
+ function replaceFn(match, entity) {
1188
+ return ENTITY_REPLACEMENT[entity] || entity;
1189
+ }
1190
+
1191
+ return str.replace(pattern, replaceFn);
1192
+ }
1193
+
1194
+ function serialize(node, output) {
1195
+
1196
+ var i, len, attrMap, attrNode, childNodes;
1197
+
1198
+ switch (node.nodeType) {
1199
+
1200
+ // TEXT
1201
+ case 3:
1202
+
1203
+ // replace special XML characters
1204
+ output.push(escape$1(node.textContent, TEXT_ENTITIES));
1205
+ break;
1206
+
1207
+ // ELEMENT
1208
+ case 1:
1209
+ output.push('<', node.tagName);
1210
+
1211
+ if (node.hasAttributes()) {
1212
+ attrMap = node.attributes;
1213
+ for (i = 0, len = attrMap.length; i < len; ++i) {
1214
+ attrNode = attrMap.item(i);
1215
+ output.push(' ', attrNode.name, '="', escape$1(attrNode.value, ATTR_ENTITIES), '"');
1216
+ }
1217
+ }
1218
+
1219
+ if (node.hasChildNodes()) {
1220
+ output.push('>');
1221
+ childNodes = node.childNodes;
1222
+ for (i = 0, len = childNodes.length; i < len; ++i) {
1223
+ serialize(childNodes.item(i), output);
1224
+ }
1225
+ output.push('</', node.tagName, '>');
1226
+ } else {
1227
+ output.push('/>');
1228
+ }
1229
+ break;
1230
+
1231
+ // COMMENT
1232
+ case 8:
1233
+ output.push('<!--', escape$1(node.nodeValue, TEXT_ENTITIES), '-->');
1234
+ break;
1235
+
1236
+ // CDATA
1237
+ case 4:
1238
+ output.push('<![CDATA[', node.nodeValue, ']]>');
1239
+ break;
1240
+
1241
+ default:
1242
+ throw new Error('unable to handle node ' + node.nodeType);
1243
+ }
1244
+
1245
+ return output;
1246
+ }
1247
+
1248
+ /**
1249
+ * innerHTML like functionality for SVG elements.
1250
+ * based on innerSVG (https://code.google.com/p/innersvg)
1251
+ */
1252
+
1253
+
1254
+ function set$1(element, svg) {
1255
+
1256
+ var parsed = parse$1(svg);
1257
+
1258
+ // clear element contents
1259
+ clear$1(element);
1260
+
1261
+ if (!svg) {
1262
+ return;
1263
+ }
1264
+
1265
+ if (!isFragment(parsed)) {
1266
+
1267
+ // extract <svg> from parsed document
1268
+ parsed = parsed.documentElement;
1269
+ }
1270
+
1271
+ var nodes = slice$1(parsed.childNodes);
1272
+
1273
+ // import + append each node
1274
+ for (var i = 0; i < nodes.length; i++) {
1275
+ appendTo(nodes[i], element);
1276
+ }
1277
+
1278
+ }
1279
+
1280
+ function get(element) {
1281
+ var child = element.firstChild,
1282
+ output = [];
1283
+
1284
+ while (child) {
1285
+ serialize(child, output);
1286
+ child = child.nextSibling;
1287
+ }
1288
+
1289
+ return output.join('');
1290
+ }
1291
+
1292
+ function isFragment(node) {
1293
+ return node.nodeName === '#document-fragment';
1294
+ }
1295
+
1296
+ function innerSVG(element, svg) {
1297
+
1298
+ if (svg !== undefined) {
1299
+
1300
+ try {
1301
+ set$1(element, svg);
1302
+ } catch (e) {
1303
+ throw new Error('error parsing SVG: ' + e.message);
1304
+ }
1305
+
1306
+ return element;
1307
+ } else {
1308
+ return get(element);
1309
+ }
1310
+ }
1311
+
1312
+
1313
+ function slice$1(arr) {
1314
+ return Array.prototype.slice.call(arr);
1315
+ }
1316
+
1171
1317
  /**
1172
1318
  * transform accessor utility
1173
1319
  */
@@ -1230,18 +1376,18 @@
1230
1376
 
1231
1377
  function createLine(points, attrs) {
1232
1378
 
1233
- var line = create$3('polyline');
1234
- attr$3(line, { points: toSVGPoints(points) });
1379
+ var line = create$1('polyline');
1380
+ attr$1(line, { points: toSVGPoints(points) });
1235
1381
 
1236
1382
  if (attrs) {
1237
- attr$3(line, attrs);
1383
+ attr$1(line, attrs);
1238
1384
  }
1239
1385
 
1240
1386
  return line;
1241
1387
  }
1242
1388
 
1243
1389
  function updateLine(gfx, points) {
1244
- attr$3(gfx, { points: toSVGPoints(points) });
1390
+ attr$1(gfx, { points: toSVGPoints(points) });
1245
1391
 
1246
1392
  return gfx;
1247
1393
  }
@@ -1510,7 +1656,7 @@
1510
1656
  * @param {String} [val]
1511
1657
  * @api public
1512
1658
  */
1513
- function attr$2(el, name, val) {
1659
+ function attr(el, name, val) {
1514
1660
 
1515
1661
  // get
1516
1662
  if (arguments.length == 2) {
@@ -1538,7 +1684,7 @@
1538
1684
  * toString reference.
1539
1685
  */
1540
1686
 
1541
- const toString$1 = Object.prototype.toString;
1687
+ const toString = Object.prototype.toString;
1542
1688
 
1543
1689
  /**
1544
1690
  * Wrap `el` in a `ClassList`.
@@ -1548,8 +1694,8 @@
1548
1694
  * @api public
1549
1695
  */
1550
1696
 
1551
- function classes$1(el) {
1552
- return new ClassList$1(el);
1697
+ function classes(el) {
1698
+ return new ClassList(el);
1553
1699
  }
1554
1700
 
1555
1701
  /**
@@ -1559,7 +1705,7 @@
1559
1705
  * @api private
1560
1706
  */
1561
1707
 
1562
- function ClassList$1(el) {
1708
+ function ClassList(el) {
1563
1709
  if (!el || !el.nodeType) {
1564
1710
  throw new Error('A DOM element reference is required');
1565
1711
  }
@@ -1575,7 +1721,7 @@
1575
1721
  * @api public
1576
1722
  */
1577
1723
 
1578
- ClassList$1.prototype.add = function(name) {
1724
+ ClassList.prototype.add = function(name) {
1579
1725
  this.list.add(name);
1580
1726
  return this;
1581
1727
  };
@@ -1590,8 +1736,8 @@
1590
1736
  * @api public
1591
1737
  */
1592
1738
 
1593
- ClassList$1.prototype.remove = function(name) {
1594
- if ('[object RegExp]' == toString$1.call(name)) {
1739
+ ClassList.prototype.remove = function(name) {
1740
+ if ('[object RegExp]' == toString.call(name)) {
1595
1741
  return this.removeMatching(name);
1596
1742
  }
1597
1743
 
@@ -1607,7 +1753,7 @@
1607
1753
  * @api private
1608
1754
  */
1609
1755
 
1610
- ClassList$1.prototype.removeMatching = function(re) {
1756
+ ClassList.prototype.removeMatching = function(re) {
1611
1757
  const arr = this.array();
1612
1758
  for (let i = 0; i < arr.length; i++) {
1613
1759
  if (re.test(arr[i])) {
@@ -1629,7 +1775,7 @@
1629
1775
  * @api public
1630
1776
  */
1631
1777
 
1632
- ClassList$1.prototype.toggle = function(name, force) {
1778
+ ClassList.prototype.toggle = function(name, force) {
1633
1779
  if ('undefined' !== typeof force) {
1634
1780
  if (force !== this.list.toggle(name, force)) {
1635
1781
  this.list.toggle(name); // toggle again to correct
@@ -1647,7 +1793,7 @@
1647
1793
  * @api public
1648
1794
  */
1649
1795
 
1650
- ClassList$1.prototype.array = function() {
1796
+ ClassList.prototype.array = function() {
1651
1797
  return Array.from(this.list);
1652
1798
  };
1653
1799
 
@@ -1659,15 +1805,15 @@
1659
1805
  * @api public
1660
1806
  */
1661
1807
 
1662
- ClassList$1.prototype.has =
1663
- ClassList$1.prototype.contains = function(name) {
1808
+ ClassList.prototype.has =
1809
+ ClassList.prototype.contains = function(name) {
1664
1810
  return this.list.contains(name);
1665
1811
  };
1666
1812
 
1667
1813
  /**
1668
1814
  * Remove all children from the given element.
1669
1815
  */
1670
- function clear$1(el) {
1816
+ function clear(el) {
1671
1817
 
1672
1818
  var c;
1673
1819
 
@@ -1819,7 +1965,7 @@
1819
1965
  * Expose `parse`.
1820
1966
  */
1821
1967
 
1822
- var domify = parse$2;
1968
+ var domify = parse;
1823
1969
 
1824
1970
  /**
1825
1971
  * Tests for browser support.
@@ -1883,7 +2029,7 @@
1883
2029
  * @api private
1884
2030
  */
1885
2031
 
1886
- function parse$2(html, doc) {
2032
+ function parse(html, doc) {
1887
2033
  if ('string' != typeof html) throw new TypeError('String expected');
1888
2034
 
1889
2035
  // default to the global `document` object
@@ -1941,625 +2087,57 @@
1941
2087
  return el.querySelectorAll(selector);
1942
2088
  }
1943
2089
 
1944
- function remove$2(el) {
2090
+ function remove$1(el) {
1945
2091
  el.parentNode && el.parentNode.removeChild(el);
1946
2092
  }
1947
2093
 
1948
- function ensureImported$1(element, target) {
1949
-
1950
- if (element.ownerDocument !== target.ownerDocument) {
1951
- try {
1952
-
1953
- // may fail on webkit
1954
- return target.ownerDocument.importNode(element, true);
1955
- } catch (e) {
1956
-
1957
- // ignore
1958
- }
1959
- }
1960
-
1961
- return element;
2094
+ /**
2095
+ * @param {<SVGElement>} element
2096
+ * @param {number} x
2097
+ * @param {number} y
2098
+ * @param {number} angle
2099
+ * @param {number} amount
2100
+ */
2101
+ function transform(gfx, x, y, angle, amount) {
2102
+ var translate = createTransform();
2103
+ translate.setTranslate(x, y);
2104
+
2105
+ var rotate = createTransform();
2106
+ rotate.setRotate(angle || 0, 0, 0);
2107
+
2108
+ var scale = createTransform();
2109
+ scale.setScale(amount || 1, amount || 1);
2110
+
2111
+ transform$1(gfx, [ translate, rotate, scale ]);
2112
+ }
2113
+
2114
+
2115
+ /**
2116
+ * @param {SVGElement} element
2117
+ * @param {number} x
2118
+ * @param {number} y
2119
+ */
2120
+ function translate$1(gfx, x, y) {
2121
+ var translate = createTransform();
2122
+ translate.setTranslate(x, y);
2123
+
2124
+ transform$1(gfx, translate);
2125
+ }
2126
+
2127
+
2128
+ /**
2129
+ * @param {SVGElement} element
2130
+ * @param {number} angle
2131
+ */
2132
+ function rotate(gfx, angle) {
2133
+ var rotate = createTransform();
2134
+ rotate.setRotate(angle, 0, 0);
2135
+
2136
+ transform$1(gfx, rotate);
1962
2137
  }
1963
2138
 
1964
- /**
1965
- * appendTo utility
1966
- */
1967
-
1968
- /**
1969
- * Append a node to a target element and return the appended node.
1970
- *
1971
- * @param {SVGElement} element
1972
- * @param {SVGElement} target
1973
- *
1974
- * @return {SVGElement} the appended node
1975
- */
1976
- function appendTo$1(element, target) {
1977
- return target.appendChild(ensureImported$1(element, target));
1978
- }
1979
-
1980
- /**
1981
- * append utility
1982
- */
1983
-
1984
- /**
1985
- * Append a node to an element
1986
- *
1987
- * @param {SVGElement} element
1988
- * @param {SVGElement} node
1989
- *
1990
- * @return {SVGElement} the element
1991
- */
1992
- function append$1(target, node) {
1993
- appendTo$1(node, target);
1994
- return target;
1995
- }
1996
-
1997
- /**
1998
- * attribute accessor utility
1999
- */
2000
-
2001
- var LENGTH_ATTR$1 = 2;
2002
-
2003
- var CSS_PROPERTIES$1 = {
2004
- 'alignment-baseline': 1,
2005
- 'baseline-shift': 1,
2006
- 'clip': 1,
2007
- 'clip-path': 1,
2008
- 'clip-rule': 1,
2009
- 'color': 1,
2010
- 'color-interpolation': 1,
2011
- 'color-interpolation-filters': 1,
2012
- 'color-profile': 1,
2013
- 'color-rendering': 1,
2014
- 'cursor': 1,
2015
- 'direction': 1,
2016
- 'display': 1,
2017
- 'dominant-baseline': 1,
2018
- 'enable-background': 1,
2019
- 'fill': 1,
2020
- 'fill-opacity': 1,
2021
- 'fill-rule': 1,
2022
- 'filter': 1,
2023
- 'flood-color': 1,
2024
- 'flood-opacity': 1,
2025
- 'font': 1,
2026
- 'font-family': 1,
2027
- 'font-size': LENGTH_ATTR$1,
2028
- 'font-size-adjust': 1,
2029
- 'font-stretch': 1,
2030
- 'font-style': 1,
2031
- 'font-variant': 1,
2032
- 'font-weight': 1,
2033
- 'glyph-orientation-horizontal': 1,
2034
- 'glyph-orientation-vertical': 1,
2035
- 'image-rendering': 1,
2036
- 'kerning': 1,
2037
- 'letter-spacing': 1,
2038
- 'lighting-color': 1,
2039
- 'marker': 1,
2040
- 'marker-end': 1,
2041
- 'marker-mid': 1,
2042
- 'marker-start': 1,
2043
- 'mask': 1,
2044
- 'opacity': 1,
2045
- 'overflow': 1,
2046
- 'pointer-events': 1,
2047
- 'shape-rendering': 1,
2048
- 'stop-color': 1,
2049
- 'stop-opacity': 1,
2050
- 'stroke': 1,
2051
- 'stroke-dasharray': 1,
2052
- 'stroke-dashoffset': 1,
2053
- 'stroke-linecap': 1,
2054
- 'stroke-linejoin': 1,
2055
- 'stroke-miterlimit': 1,
2056
- 'stroke-opacity': 1,
2057
- 'stroke-width': LENGTH_ATTR$1,
2058
- 'text-anchor': 1,
2059
- 'text-decoration': 1,
2060
- 'text-rendering': 1,
2061
- 'unicode-bidi': 1,
2062
- 'visibility': 1,
2063
- 'word-spacing': 1,
2064
- 'writing-mode': 1
2065
- };
2066
-
2067
-
2068
- function getAttribute$1(node, name) {
2069
- if (CSS_PROPERTIES$1[name]) {
2070
- return node.style[name];
2071
- } else {
2072
- return node.getAttributeNS(null, name);
2073
- }
2074
- }
2075
-
2076
- function setAttribute$1(node, name, value) {
2077
- var hyphenated = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
2078
-
2079
- var type = CSS_PROPERTIES$1[hyphenated];
2080
-
2081
- if (type) {
2082
-
2083
- // append pixel unit, unless present
2084
- if (type === LENGTH_ATTR$1 && typeof value === 'number') {
2085
- value = String(value) + 'px';
2086
- }
2087
-
2088
- node.style[hyphenated] = value;
2089
- } else {
2090
- node.setAttributeNS(null, name, value);
2091
- }
2092
- }
2093
-
2094
- function setAttributes$1(node, attrs) {
2095
-
2096
- var names = Object.keys(attrs), i, name;
2097
-
2098
- for (i = 0, name; (name = names[i]); i++) {
2099
- setAttribute$1(node, name, attrs[name]);
2100
- }
2101
- }
2102
-
2103
- /**
2104
- * Gets or sets raw attributes on a node.
2105
- *
2106
- * @param {SVGElement} node
2107
- * @param {Object} [attrs]
2108
- * @param {String} [name]
2109
- * @param {String} [value]
2110
- *
2111
- * @return {String}
2112
- */
2113
- function attr$1(node, name, value) {
2114
- if (typeof name === 'string') {
2115
- if (value !== undefined) {
2116
- setAttribute$1(node, name, value);
2117
- } else {
2118
- return getAttribute$1(node, name);
2119
- }
2120
- } else {
2121
- setAttributes$1(node, name);
2122
- }
2123
-
2124
- return node;
2125
- }
2126
-
2127
- /**
2128
- * Taken from https://github.com/component/classes
2129
- *
2130
- * Without the component bits.
2131
- */
2132
-
2133
- /**
2134
- * toString reference.
2135
- */
2136
-
2137
- const toString = Object.prototype.toString;
2138
-
2139
- /**
2140
- * Wrap `el` in a `ClassList`.
2141
- *
2142
- * @param {Element} el
2143
- * @return {ClassList}
2144
- * @api public
2145
- */
2146
-
2147
- function classes(el) {
2148
- return new ClassList(el);
2149
- }
2150
-
2151
- function ClassList(el) {
2152
- if (!el || !el.nodeType) {
2153
- throw new Error('A DOM element reference is required');
2154
- }
2155
- this.el = el;
2156
- this.list = el.classList;
2157
- }
2158
-
2159
- /**
2160
- * Add class `name` if not already present.
2161
- *
2162
- * @param {String} name
2163
- * @return {ClassList}
2164
- * @api public
2165
- */
2166
-
2167
- ClassList.prototype.add = function(name) {
2168
- this.list.add(name);
2169
- return this;
2170
- };
2171
-
2172
- /**
2173
- * Remove class `name` when present, or
2174
- * pass a regular expression to remove
2175
- * any which match.
2176
- *
2177
- * @param {String|RegExp} name
2178
- * @return {ClassList}
2179
- * @api public
2180
- */
2181
-
2182
- ClassList.prototype.remove = function(name) {
2183
- if ('[object RegExp]' == toString.call(name)) {
2184
- return this.removeMatching(name);
2185
- }
2186
-
2187
- this.list.remove(name);
2188
- return this;
2189
- };
2190
-
2191
- /**
2192
- * Remove all classes matching `re`.
2193
- *
2194
- * @param {RegExp} re
2195
- * @return {ClassList}
2196
- * @api private
2197
- */
2198
-
2199
- ClassList.prototype.removeMatching = function(re) {
2200
- const arr = this.array();
2201
- for (let i = 0; i < arr.length; i++) {
2202
- if (re.test(arr[i])) {
2203
- this.remove(arr[i]);
2204
- }
2205
- }
2206
- return this;
2207
- };
2208
-
2209
- /**
2210
- * Toggle class `name`, can force state via `force`.
2211
- *
2212
- * For browsers that support classList, but do not support `force` yet,
2213
- * the mistake will be detected and corrected.
2214
- *
2215
- * @param {String} name
2216
- * @param {Boolean} force
2217
- * @return {ClassList}
2218
- * @api public
2219
- */
2220
-
2221
- ClassList.prototype.toggle = function(name, force) {
2222
- if ('undefined' !== typeof force) {
2223
- if (force !== this.list.toggle(name, force)) {
2224
- this.list.toggle(name); // toggle again to correct
2225
- }
2226
- } else {
2227
- this.list.toggle(name);
2228
- }
2229
- return this;
2230
- };
2231
-
2232
- /**
2233
- * Return an array of classes.
2234
- *
2235
- * @return {Array}
2236
- * @api public
2237
- */
2238
-
2239
- ClassList.prototype.array = function() {
2240
- return Array.from(this.list);
2241
- };
2242
-
2243
- /**
2244
- * Check if class `name` is present.
2245
- *
2246
- * @param {String} name
2247
- * @return {ClassList}
2248
- * @api public
2249
- */
2250
-
2251
- ClassList.prototype.has =
2252
- ClassList.prototype.contains = function(name) {
2253
- return this.list.contains(name);
2254
- };
2255
-
2256
- function remove$1(element) {
2257
- var parent = element.parentNode;
2258
-
2259
- if (parent) {
2260
- parent.removeChild(element);
2261
- }
2262
-
2263
- return element;
2264
- }
2265
-
2266
- /**
2267
- * Clear utility
2268
- */
2269
-
2270
- /**
2271
- * Removes all children from the given element
2272
- *
2273
- * @param {DOMElement} element
2274
- * @return {DOMElement} the element (for chaining)
2275
- */
2276
- function clear(element) {
2277
- var child;
2278
-
2279
- while ((child = element.firstChild)) {
2280
- remove$1(child);
2281
- }
2282
-
2283
- return element;
2284
- }
2285
-
2286
- var ns$1 = {
2287
- svg: 'http://www.w3.org/2000/svg'
2288
- };
2289
-
2290
- /**
2291
- * DOM parsing utility
2292
- */
2293
-
2294
- var SVG_START$1 = '<svg xmlns="' + ns$1.svg + '"';
2295
-
2296
- function parse$1(svg) {
2297
-
2298
- var unwrap = false;
2299
-
2300
- // ensure we import a valid svg document
2301
- if (svg.substring(0, 4) === '<svg') {
2302
- if (svg.indexOf(ns$1.svg) === -1) {
2303
- svg = SVG_START$1 + svg.substring(4);
2304
- }
2305
- } else {
2306
-
2307
- // namespace svg
2308
- svg = SVG_START$1 + '>' + svg + '</svg>';
2309
- unwrap = true;
2310
- }
2311
-
2312
- var parsed = parseDocument$1(svg);
2313
-
2314
- if (!unwrap) {
2315
- return parsed;
2316
- }
2317
-
2318
- var fragment = document.createDocumentFragment();
2319
-
2320
- var parent = parsed.firstChild;
2321
-
2322
- while (parent.firstChild) {
2323
- fragment.appendChild(parent.firstChild);
2324
- }
2325
-
2326
- return fragment;
2327
- }
2328
-
2329
- function parseDocument$1(svg) {
2330
-
2331
- var parser;
2332
-
2333
- // parse
2334
- parser = new DOMParser();
2335
- parser.async = false;
2336
-
2337
- return parser.parseFromString(svg, 'text/xml');
2338
- }
2339
-
2340
- /**
2341
- * Create utility for SVG elements
2342
- */
2343
-
2344
-
2345
- /**
2346
- * Create a specific type from name or SVG markup.
2347
- *
2348
- * @param {String} name the name or markup of the element
2349
- * @param {Object} [attrs] attributes to set on the element
2350
- *
2351
- * @returns {SVGElement}
2352
- */
2353
- function create$2(name, attrs) {
2354
- var element;
2355
-
2356
- if (name.charAt(0) === '<') {
2357
- element = parse$1(name).firstChild;
2358
- element = document.importNode(element, true);
2359
- } else {
2360
- element = document.createElementNS(ns$1.svg, name);
2361
- }
2362
-
2363
- if (attrs) {
2364
- attr$1(element, attrs);
2365
- }
2366
-
2367
- return element;
2368
- }
2369
-
2370
- /**
2371
- * Serialization util
2372
- */
2373
-
2374
- var TEXT_ENTITIES = /([&<>]{1})/g;
2375
- var ATTR_ENTITIES = /([\n\r"]{1})/g;
2376
-
2377
- var ENTITY_REPLACEMENT = {
2378
- '&': '&amp;',
2379
- '<': '&lt;',
2380
- '>': '&gt;',
2381
- '"': '\''
2382
- };
2383
-
2384
- function escape$1(str, pattern) {
2385
-
2386
- function replaceFn(match, entity) {
2387
- return ENTITY_REPLACEMENT[entity] || entity;
2388
- }
2389
-
2390
- return str.replace(pattern, replaceFn);
2391
- }
2392
-
2393
- function serialize(node, output) {
2394
-
2395
- var i, len, attrMap, attrNode, childNodes;
2396
-
2397
- switch (node.nodeType) {
2398
-
2399
- // TEXT
2400
- case 3:
2401
-
2402
- // replace special XML characters
2403
- output.push(escape$1(node.textContent, TEXT_ENTITIES));
2404
- break;
2405
-
2406
- // ELEMENT
2407
- case 1:
2408
- output.push('<', node.tagName);
2409
-
2410
- if (node.hasAttributes()) {
2411
- attrMap = node.attributes;
2412
- for (i = 0, len = attrMap.length; i < len; ++i) {
2413
- attrNode = attrMap.item(i);
2414
- output.push(' ', attrNode.name, '="', escape$1(attrNode.value, ATTR_ENTITIES), '"');
2415
- }
2416
- }
2417
-
2418
- if (node.hasChildNodes()) {
2419
- output.push('>');
2420
- childNodes = node.childNodes;
2421
- for (i = 0, len = childNodes.length; i < len; ++i) {
2422
- serialize(childNodes.item(i), output);
2423
- }
2424
- output.push('</', node.tagName, '>');
2425
- } else {
2426
- output.push('/>');
2427
- }
2428
- break;
2429
-
2430
- // COMMENT
2431
- case 8:
2432
- output.push('<!--', escape$1(node.nodeValue, TEXT_ENTITIES), '-->');
2433
- break;
2434
-
2435
- // CDATA
2436
- case 4:
2437
- output.push('<![CDATA[', node.nodeValue, ']]>');
2438
- break;
2439
-
2440
- default:
2441
- throw new Error('unable to handle node ' + node.nodeType);
2442
- }
2443
-
2444
- return output;
2445
- }
2446
-
2447
- /**
2448
- * innerHTML like functionality for SVG elements.
2449
- * based on innerSVG (https://code.google.com/p/innersvg)
2450
- */
2451
-
2452
-
2453
- function set$1(element, svg) {
2454
-
2455
- var parsed = parse$1(svg);
2456
-
2457
- // clear element contents
2458
- clear(element);
2459
-
2460
- if (!svg) {
2461
- return;
2462
- }
2463
-
2464
- if (!isFragment(parsed)) {
2465
-
2466
- // extract <svg> from parsed document
2467
- parsed = parsed.documentElement;
2468
- }
2469
-
2470
- var nodes = slice$1(parsed.childNodes);
2471
-
2472
- // import + append each node
2473
- for (var i = 0; i < nodes.length; i++) {
2474
- appendTo$1(nodes[i], element);
2475
- }
2476
-
2477
- }
2478
-
2479
- function get(element) {
2480
- var child = element.firstChild,
2481
- output = [];
2482
-
2483
- while (child) {
2484
- serialize(child, output);
2485
- child = child.nextSibling;
2486
- }
2487
-
2488
- return output.join('');
2489
- }
2490
-
2491
- function isFragment(node) {
2492
- return node.nodeName === '#document-fragment';
2493
- }
2494
-
2495
- function innerSVG(element, svg) {
2496
-
2497
- if (svg !== undefined) {
2498
-
2499
- try {
2500
- set$1(element, svg);
2501
- } catch (e) {
2502
- throw new Error('error parsing SVG: ' + e.message);
2503
- }
2504
-
2505
- return element;
2506
- } else {
2507
- return get(element);
2508
- }
2509
- }
2510
-
2511
-
2512
- function slice$1(arr) {
2513
- return Array.prototype.slice.call(arr);
2514
- }
2515
-
2516
- /**
2517
- * @param {<SVGElement>} element
2518
- * @param {number} x
2519
- * @param {number} y
2520
- * @param {number} angle
2521
- * @param {number} amount
2522
- */
2523
- function transform(gfx, x, y, angle, amount) {
2524
- var translate = createTransform();
2525
- translate.setTranslate(x, y);
2526
-
2527
- var rotate = createTransform();
2528
- rotate.setRotate(angle || 0, 0, 0);
2529
-
2530
- var scale = createTransform();
2531
- scale.setScale(amount || 1, amount || 1);
2532
-
2533
- transform$1(gfx, [ translate, rotate, scale ]);
2534
- }
2535
-
2536
-
2537
- /**
2538
- * @param {SVGElement} element
2539
- * @param {number} x
2540
- * @param {number} y
2541
- */
2542
- function translate$1(gfx, x, y) {
2543
- var translate = createTransform();
2544
- translate.setTranslate(x, y);
2545
-
2546
- transform$1(gfx, translate);
2547
- }
2548
-
2549
-
2550
- /**
2551
- * @param {SVGElement} element
2552
- * @param {number} angle
2553
- */
2554
- function rotate(gfx, angle) {
2555
- var rotate = createTransform();
2556
- rotate.setRotate(angle, 0, 0);
2557
-
2558
- transform$1(gfx, rotate);
2559
- }
2560
-
2561
- function createCommonjsModule(fn, module) {
2562
- return module = { exports: {} }, fn(module, module.exports), module.exports;
2139
+ function createCommonjsModule(fn, module) {
2140
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
2563
2141
  }
2564
2142
 
2565
2143
  var hat_1 = createCommonjsModule(function (module) {
@@ -2765,11 +2343,11 @@
2765
2343
  attrs.strokeDasharray = [ 10000, 1 ];
2766
2344
  }
2767
2345
 
2768
- var marker = create$2('marker');
2346
+ var marker = create$1('marker');
2769
2347
 
2770
2348
  attr$1(options.element, attrs);
2771
2349
 
2772
- append$1(marker, options.element);
2350
+ append(marker, options.element);
2773
2351
 
2774
2352
  attr$1(marker, {
2775
2353
  id: id,
@@ -2784,12 +2362,12 @@
2784
2362
  var defs = query('defs', canvas._svg);
2785
2363
 
2786
2364
  if (!defs) {
2787
- defs = create$2('defs');
2365
+ defs = create$1('defs');
2788
2366
 
2789
- append$1(canvas._svg, defs);
2367
+ append(canvas._svg, defs);
2790
2368
  }
2791
2369
 
2792
- append$1(defs, marker);
2370
+ append(defs, marker);
2793
2371
 
2794
2372
  markers[id] = marker;
2795
2373
  }
@@ -2813,7 +2391,7 @@
2813
2391
  function createMarker(id, type, fill, stroke) {
2814
2392
 
2815
2393
  if (type === 'sequenceflow-end') {
2816
- var sequenceflowEnd = create$2('path');
2394
+ var sequenceflowEnd = create$1('path');
2817
2395
  attr$1(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
2818
2396
 
2819
2397
  addMarker(id, {
@@ -2828,7 +2406,7 @@
2828
2406
  }
2829
2407
 
2830
2408
  if (type === 'messageflow-start') {
2831
- var messageflowStart = create$2('circle');
2409
+ var messageflowStart = create$1('circle');
2832
2410
  attr$1(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
2833
2411
 
2834
2412
  addMarker(id, {
@@ -2842,7 +2420,7 @@
2842
2420
  }
2843
2421
 
2844
2422
  if (type === 'messageflow-end') {
2845
- var messageflowEnd = create$2('path');
2423
+ var messageflowEnd = create$1('path');
2846
2424
  attr$1(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
2847
2425
 
2848
2426
  addMarker(id, {
@@ -2857,7 +2435,7 @@
2857
2435
  }
2858
2436
 
2859
2437
  if (type === 'association-start') {
2860
- var associationStart = create$2('path');
2438
+ var associationStart = create$1('path');
2861
2439
  attr$1(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
2862
2440
 
2863
2441
  addMarker(id, {
@@ -2873,7 +2451,7 @@
2873
2451
  }
2874
2452
 
2875
2453
  if (type === 'association-end') {
2876
- var associationEnd = create$2('path');
2454
+ var associationEnd = create$1('path');
2877
2455
  attr$1(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
2878
2456
 
2879
2457
  addMarker(id, {
@@ -2889,7 +2467,7 @@
2889
2467
  }
2890
2468
 
2891
2469
  if (type === 'conditional-flow-marker') {
2892
- var conditionalflowMarker = create$2('path');
2470
+ var conditionalflowMarker = create$1('path');
2893
2471
  attr$1(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
2894
2472
 
2895
2473
  addMarker(id, {
@@ -2904,7 +2482,7 @@
2904
2482
  }
2905
2483
 
2906
2484
  if (type === 'conditional-default-flow-marker') {
2907
- var conditionaldefaultflowMarker = create$2('path');
2485
+ var conditionaldefaultflowMarker = create$1('path');
2908
2486
  attr$1(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
2909
2487
 
2910
2488
  addMarker(id, {
@@ -2940,7 +2518,7 @@
2940
2518
  var cx = width / 2,
2941
2519
  cy = height / 2;
2942
2520
 
2943
- var circle = create$2('circle');
2521
+ var circle = create$1('circle');
2944
2522
  attr$1(circle, {
2945
2523
  cx: cx,
2946
2524
  cy: cy,
@@ -2948,7 +2526,7 @@
2948
2526
  });
2949
2527
  attr$1(circle, attrs);
2950
2528
 
2951
- append$1(parentGfx, circle);
2529
+ append(parentGfx, circle);
2952
2530
 
2953
2531
  return circle;
2954
2532
  }
@@ -2968,7 +2546,7 @@
2968
2546
  fill: 'white'
2969
2547
  });
2970
2548
 
2971
- var rect = create$2('rect');
2549
+ var rect = create$1('rect');
2972
2550
  attr$1(rect, {
2973
2551
  x: offset,
2974
2552
  y: offset,
@@ -2979,7 +2557,7 @@
2979
2557
  });
2980
2558
  attr$1(rect, attrs);
2981
2559
 
2982
- append$1(parentGfx, rect);
2560
+ append(parentGfx, rect);
2983
2561
 
2984
2562
  return rect;
2985
2563
  }
@@ -3001,13 +2579,13 @@
3001
2579
  fill: 'white'
3002
2580
  });
3003
2581
 
3004
- var polygon = create$2('polygon');
2582
+ var polygon = create$1('polygon');
3005
2583
  attr$1(polygon, {
3006
2584
  points: pointsString
3007
2585
  });
3008
2586
  attr$1(polygon, attrs);
3009
2587
 
3010
- append$1(parentGfx, polygon);
2588
+ append(parentGfx, polygon);
3011
2589
 
3012
2590
  return polygon;
3013
2591
  }
@@ -3021,7 +2599,7 @@
3021
2599
 
3022
2600
  var line = createLine(waypoints, attrs);
3023
2601
 
3024
- append$1(parentGfx, line);
2602
+ append(parentGfx, line);
3025
2603
 
3026
2604
  return line;
3027
2605
  }
@@ -3033,11 +2611,11 @@
3033
2611
  stroke: black
3034
2612
  });
3035
2613
 
3036
- var path = create$2('path');
2614
+ var path = create$1('path');
3037
2615
  attr$1(path, { d: d });
3038
2616
  attr$1(path, attrs);
3039
2617
 
3040
- append$1(parentGfx, path);
2618
+ append(parentGfx, path);
3041
2619
 
3042
2620
  return path;
3043
2621
  }
@@ -3123,9 +2701,9 @@
3123
2701
 
3124
2702
  var text = textRenderer.createText(label || '', options);
3125
2703
 
3126
- classes(text).add('djs-label');
2704
+ classes$1(text).add('djs-label');
3127
2705
 
3128
- append$1(parentGfx, text);
2706
+ append(parentGfx, text);
3129
2707
 
3130
2708
  return text;
3131
2709
  }
@@ -4768,9 +4346,9 @@
4768
4346
  var helperSvg = document.getElementById('helper-svg');
4769
4347
 
4770
4348
  if (!helperSvg) {
4771
- helperSvg = create$3('svg');
4349
+ helperSvg = create$1('svg');
4772
4350
 
4773
- attr$3(helperSvg, {
4351
+ attr$1(helperSvg, {
4774
4352
  id: 'helper-svg'
4775
4353
  });
4776
4354
 
@@ -4864,13 +4442,13 @@
4864
4442
  var maxWidth = box.width - padding.left - padding.right;
4865
4443
 
4866
4444
  // ensure correct rendering by attaching helper text node to invisible SVG
4867
- var helperText = create$3('text');
4868
- attr$3(helperText, { x: 0, y: 0 });
4869
- attr$3(helperText, style);
4445
+ var helperText = create$1('text');
4446
+ attr$1(helperText, { x: 0, y: 0 });
4447
+ attr$1(helperText, style);
4870
4448
 
4871
4449
  var helperSvg = getHelperSvg();
4872
4450
 
4873
- append$2(helperSvg, helperText);
4451
+ append(helperSvg, helperText);
4874
4452
 
4875
4453
  while (lines.length) {
4876
4454
  layouted.push(layoutNext(lines, maxWidth, helperText));
@@ -4899,9 +4477,9 @@
4899
4477
  y -= (lineHeight || layouted[0].height) / 4;
4900
4478
 
4901
4479
 
4902
- var textElement = create$3('text');
4480
+ var textElement = create$1('text');
4903
4481
 
4904
- attr$3(textElement, style);
4482
+ attr$1(textElement, style);
4905
4483
 
4906
4484
  // layout each line taking into account that parent
4907
4485
  // shape might resize to fit text size
@@ -4928,15 +4506,15 @@
4928
4506
  - line.width) / 2 + padding.left), 0);
4929
4507
  }
4930
4508
 
4931
- var tspan = create$3('tspan');
4932
- attr$3(tspan, { x: x, y: y });
4509
+ var tspan = create$1('tspan');
4510
+ attr$1(tspan, { x: x, y: y });
4933
4511
 
4934
4512
  tspan.textContent = line.text;
4935
4513
 
4936
- append$2(textElement, tspan);
4514
+ append(textElement, tspan);
4937
4515
  });
4938
4516
 
4939
- remove$3(helperText);
4517
+ remove$2(helperText);
4940
4518
 
4941
4519
  var dimensions = {
4942
4520
  width: maxLineWidth,
@@ -6528,13 +6106,13 @@
6528
6106
  throw new Error('invalid hit type <' + type + '>');
6529
6107
  }
6530
6108
 
6531
- attr$3(hit, attrs);
6109
+ attr$1(hit, attrs);
6532
6110
 
6533
6111
  return hit;
6534
6112
  }
6535
6113
 
6536
6114
  function appendHit(gfx, hit) {
6537
- append$2(gfx, hit);
6115
+ append(gfx, hit);
6538
6116
  }
6539
6117
 
6540
6118
 
@@ -6548,7 +6126,7 @@
6548
6126
  this.removeHits = function(gfx) {
6549
6127
  var hits = all('.djs-hit', gfx);
6550
6128
 
6551
- forEach$1(hits, remove$3);
6129
+ forEach$1(hits, remove$2);
6552
6130
  };
6553
6131
 
6554
6132
  /**
@@ -6612,11 +6190,11 @@
6612
6190
  y: 0
6613
6191
  }, attrs);
6614
6192
 
6615
- var hit = create$3('rect');
6193
+ var hit = create$1('rect');
6616
6194
 
6617
6195
  applyStyle(hit, type);
6618
6196
 
6619
- attr$3(hit, attrs);
6197
+ attr$1(hit, attrs);
6620
6198
 
6621
6199
  appendHit(gfx, hit);
6622
6200
 
@@ -6642,7 +6220,7 @@
6642
6220
  if (element.waypoints) {
6643
6221
  updateLine(hit, element.waypoints);
6644
6222
  } else {
6645
- attr$3(hit, {
6223
+ attr$1(hit, {
6646
6224
  width: element.width,
6647
6225
  height: element.height
6648
6226
  });
@@ -6850,9 +6428,9 @@
6850
6428
  var self = this;
6851
6429
 
6852
6430
  function createOutline(gfx, bounds) {
6853
- var outline = create$3('rect');
6431
+ var outline = create$1('rect');
6854
6432
 
6855
- attr$3(outline, assign$1({
6433
+ attr$1(outline, assign$1({
6856
6434
  x: 10,
6857
6435
  y: 10,
6858
6436
  rx: 3,
@@ -6860,7 +6438,7 @@
6860
6438
  height: 100
6861
6439
  }, OUTLINE_STYLE));
6862
6440
 
6863
- append$2(gfx, outline);
6441
+ append(gfx, outline);
6864
6442
 
6865
6443
  return outline;
6866
6444
  }
@@ -6904,7 +6482,7 @@
6904
6482
  */
6905
6483
  Outline.prototype.updateShapeOutline = function(outline, element) {
6906
6484
 
6907
- attr$3(outline, {
6485
+ attr$1(outline, {
6908
6486
  x: -this.offset,
6909
6487
  y: -this.offset,
6910
6488
  width: element.width + this.offset * 2,
@@ -6925,7 +6503,7 @@
6925
6503
 
6926
6504
  var bbox = getBBox(connection);
6927
6505
 
6928
- attr$3(outline, {
6506
+ attr$1(outline, {
6929
6507
  x: bbox.x - this.offset,
6930
6508
  y: bbox.y - this.offset,
6931
6509
  width: bbox.width + this.offset * 2,
@@ -7129,13 +6707,13 @@
7129
6707
  SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
7130
6708
  var layer = this._canvas.getLayer('selectionOutline');
7131
6709
 
7132
- clear$2(layer);
6710
+ clear$1(layer);
7133
6711
 
7134
6712
  var enabled = selection.length > 1;
7135
6713
 
7136
6714
  var container = this._canvas.getContainer();
7137
6715
 
7138
- classes$2(container)[enabled ? 'add' : 'remove']('djs-multi-select');
6716
+ classes$1(container)[enabled ? 'add' : 'remove']('djs-multi-select');
7139
6717
 
7140
6718
  if (!enabled) {
7141
6719
  return;
@@ -7143,15 +6721,15 @@
7143
6721
 
7144
6722
  var bBox = addSelectionOutlinePadding(getBBox(selection));
7145
6723
 
7146
- var rect = create$3('rect');
6724
+ var rect = create$1('rect');
7147
6725
 
7148
- attr$3(rect, assign$1({
6726
+ attr$1(rect, assign$1({
7149
6727
  rx: 3
7150
6728
  }, bBox));
7151
6729
 
7152
- classes$2(rect).add('djs-selection-outline');
6730
+ classes$1(rect).add('djs-selection-outline');
7153
6731
 
7154
- append$2(layer, rect);
6732
+ append(layer, rect);
7155
6733
  };
7156
6734
 
7157
6735
  // helpers //////////
@@ -7560,8 +7138,8 @@
7560
7138
  var container = self._getOverlayContainer(overlay.element, true);
7561
7139
 
7562
7140
  if (overlay) {
7563
- remove$2(overlay.html);
7564
- remove$2(overlay.htmlContainer);
7141
+ remove$1(overlay.html);
7142
+ remove$1(overlay.htmlContainer);
7565
7143
 
7566
7144
  delete overlay.htmlContainer;
7567
7145
  delete overlay.element;
@@ -7594,7 +7172,7 @@
7594
7172
 
7595
7173
  this._overlayContainers = [];
7596
7174
 
7597
- clear$1(this._overlayRoot);
7175
+ clear(this._overlayRoot);
7598
7176
  };
7599
7177
 
7600
7178
  Overlays.prototype._updateOverlayContainer = function(container) {
@@ -7615,7 +7193,7 @@
7615
7193
 
7616
7194
  setPosition(html, x, y);
7617
7195
 
7618
- attr$2(container.html, 'data-container-id', element.id);
7196
+ attr(container.html, 'data-container-id', element.id);
7619
7197
  };
7620
7198
 
7621
7199
 
@@ -7742,7 +7320,7 @@
7742
7320
  htmlContainer.appendChild(html);
7743
7321
 
7744
7322
  if (overlay.type) {
7745
- classes$1(htmlContainer).add('djs-overlay-' + overlay.type);
7323
+ classes(htmlContainer).add('djs-overlay-' + overlay.type);
7746
7324
  }
7747
7325
 
7748
7326
  var elementRoot = this._canvas.findRoot(element);
@@ -7871,7 +7449,7 @@
7871
7449
  var container = self._getOverlayContainer(element);
7872
7450
 
7873
7451
  if (container) {
7874
- remove$2(container.html);
7452
+ remove$1(container.html);
7875
7453
  var i = self._overlayContainers.indexOf(container);
7876
7454
  if (i !== -1) {
7877
7455
  self._overlayContainers.splice(i, 1);
@@ -7902,7 +7480,7 @@
7902
7480
  eventBus.on('element.marker.update', function(e) {
7903
7481
  var container = self._getOverlayContainer(e.element, true);
7904
7482
  if (container) {
7905
- classes$1(container.html)[e.add ? 'add' : 'remove'](e.marker);
7483
+ classes(container.html)[e.add ? 'add' : 'remove'](e.marker);
7906
7484
  }
7907
7485
  });
7908
7486
 
@@ -8367,7 +7945,7 @@
8367
7945
  function DrilldownBreadcrumbs(eventBus, elementRegistry, overlays, canvas) {
8368
7946
  var breadcrumbs = domify$1('<ul class="bjs-breadcrumbs"></ul>');
8369
7947
  var container = canvas.getContainer();
8370
- var containerClasses = classes$1(container);
7948
+ var containerClasses = classes(container);
8371
7949
  container.appendChild(breadcrumbs);
8372
7950
 
8373
7951
  var boParents = [];
@@ -8923,7 +8501,7 @@
8923
8501
  }
8924
8502
 
8925
8503
  var hasContent = bo && bo.flowElements && bo.flowElements.length;
8926
- classes$1(overlay.html).toggle(EMPTY_MARKER, !hasContent);
8504
+ classes(overlay.html).toggle(EMPTY_MARKER, !hasContent);
8927
8505
  };
8928
8506
 
8929
8507
  /**
@@ -9475,9 +9053,9 @@
9475
9053
  };
9476
9054
 
9477
9055
  DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
9478
- var rect = create$3('rect');
9056
+ var rect = create$1('rect');
9479
9057
 
9480
- attr$3(rect, {
9058
+ attr$1(rect, {
9481
9059
  x: 0,
9482
9060
  y: 0,
9483
9061
  width: element.width || 0,
@@ -9485,12 +9063,12 @@
9485
9063
  });
9486
9064
 
9487
9065
  if (isFrameElement(element)) {
9488
- attr$3(rect, assign$1({}, this.FRAME_STYLE, attrs || {}));
9066
+ attr$1(rect, assign$1({}, this.FRAME_STYLE, attrs || {}));
9489
9067
  } else {
9490
- attr$3(rect, assign$1({}, this.SHAPE_STYLE, attrs || {}));
9068
+ attr$1(rect, assign$1({}, this.SHAPE_STYLE, attrs || {}));
9491
9069
  }
9492
9070
 
9493
- append$2(visuals, rect);
9071
+ append(visuals, rect);
9494
9072
 
9495
9073
  return rect;
9496
9074
  };
@@ -9498,7 +9076,7 @@
9498
9076
  DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
9499
9077
 
9500
9078
  var line = createLine(connection.waypoints, assign$1({}, this.CONNECTION_STYLE, attrs || {}));
9501
- append$2(visuals, line);
9079
+ append(visuals, line);
9502
9080
 
9503
9081
  return line;
9504
9082
  };
@@ -9721,7 +9299,7 @@
9721
9299
  // this way we can always get the correct container size
9722
9300
  // (this is impossible for <svg> elements at the moment)
9723
9301
  const parent = document.createElement('div');
9724
- parent.setAttribute('class', 'djs-container');
9302
+ parent.setAttribute('class', 'djs-container djs-parent');
9725
9303
 
9726
9304
  assign(parent, {
9727
9305
  position: 'relative',
@@ -9736,8 +9314,8 @@
9736
9314
  }
9737
9315
 
9738
9316
  function createGroup(parent, cls, childIndex) {
9739
- const group = create$3('g');
9740
- classes$2(group).add(cls);
9317
+ const group = create$1('g');
9318
+ classes$1(group).add(cls);
9741
9319
 
9742
9320
  const index = childIndex !== undefined ? childIndex : parent.childNodes.length - 1;
9743
9321
 
@@ -9815,10 +9393,10 @@
9815
9393
  // html container
9816
9394
  const container = this._container = createContainer(config);
9817
9395
 
9818
- const svg = this._svg = create$3('svg');
9819
- attr$3(svg, { width: '100%', height: '100%' });
9396
+ const svg = this._svg = create$1('svg');
9397
+ attr$1(svg, { width: '100%', height: '100%' });
9820
9398
 
9821
- append$2(container, svg);
9399
+ append(container, svg);
9822
9400
 
9823
9401
  const viewport = this._viewport = createGroup(svg, 'viewport');
9824
9402
 
@@ -10056,7 +9634,7 @@
10056
9634
  return group;
10057
9635
  }
10058
9636
 
10059
- remove$3(group);
9637
+ remove$2(group);
10060
9638
 
10061
9639
  layer.visible = false;
10062
9640
 
@@ -10071,7 +9649,7 @@
10071
9649
  if (layer) {
10072
9650
  delete this._layers[name];
10073
9651
 
10074
- remove$3(layer.group);
9652
+ remove$2(layer.group);
10075
9653
  }
10076
9654
  };
10077
9655
 
@@ -10164,9 +9742,9 @@
10164
9742
 
10165
9743
  // invoke either addClass or removeClass based on mode
10166
9744
  if (add) {
10167
- classes$2(gfx).add(marker);
9745
+ classes$1(gfx).add(marker);
10168
9746
  } else {
10169
- classes$2(gfx).remove(marker);
9747
+ classes$1(gfx).remove(marker);
10170
9748
  }
10171
9749
  }
10172
9750
  });
@@ -10232,7 +9810,7 @@
10232
9810
 
10233
9811
  const gfx = this.getGraphics(element);
10234
9812
 
10235
- return classes$2(gfx).has(marker);
9813
+ return classes$1(gfx).has(marker);
10236
9814
  };
10237
9815
 
10238
9816
  /**
@@ -11130,10 +10708,10 @@
11130
10708
  this._validateId(id);
11131
10709
 
11132
10710
  // associate dom node with element
11133
- attr$3(gfx, ELEMENT_ID, id);
10711
+ attr$1(gfx, ELEMENT_ID, id);
11134
10712
 
11135
10713
  if (secondaryGfx) {
11136
- attr$3(secondaryGfx, ELEMENT_ID, id);
10714
+ attr$1(secondaryGfx, ELEMENT_ID, id);
11137
10715
  }
11138
10716
 
11139
10717
  this._elements[id] = { element: element, gfx: gfx, secondaryGfx: secondaryGfx };
@@ -11142,7 +10720,7 @@
11142
10720
  /**
11143
10721
  * Removes an element from the registry.
11144
10722
  *
11145
- * @param {djs.model.Base} element
10723
+ * @param {string|djs.model.Base} element
11146
10724
  */
11147
10725
  ElementRegistry.prototype.remove = function(element) {
11148
10726
  var elements = this._elements,
@@ -11152,10 +10730,10 @@
11152
10730
  if (container) {
11153
10731
 
11154
10732
  // unset element id on gfx
11155
- attr$3(container.gfx, ELEMENT_ID, '');
10733
+ attr$1(container.gfx, ELEMENT_ID, '');
11156
10734
 
11157
10735
  if (container.secondaryGfx) {
11158
- attr$3(container.secondaryGfx, ELEMENT_ID, '');
10736
+ attr$1(container.secondaryGfx, ELEMENT_ID, '');
11159
10737
  }
11160
10738
 
11161
10739
  delete elements[id];
@@ -11165,7 +10743,7 @@
11165
10743
  /**
11166
10744
  * Update the id of an element
11167
10745
  *
11168
- * @param {djs.model.Base} element
10746
+ * @param {string|djs.model.Base} element
11169
10747
  * @param {string} newId
11170
10748
  */
11171
10749
  ElementRegistry.prototype.updateId = function(element, newId) {
@@ -11194,7 +10772,7 @@
11194
10772
  /**
11195
10773
  * Update the graphics of an element
11196
10774
  *
11197
- * @param {djs.model.Base} element
10775
+ * @param {string|djs.model.Base} element
11198
10776
  * @param {SVGElement} gfx
11199
10777
  * @param {boolean} [secondary=false] whether to update the secondary connected element
11200
10778
  */
@@ -11210,7 +10788,7 @@
11210
10788
  }
11211
10789
 
11212
10790
  if (gfx) {
11213
- attr$3(gfx, ELEMENT_ID, id);
10791
+ attr$1(gfx, ELEMENT_ID, id);
11214
10792
  }
11215
10793
 
11216
10794
  return gfx;
@@ -11235,7 +10813,7 @@
11235
10813
  if (typeof filter === 'string') {
11236
10814
  id = filter;
11237
10815
  } else {
11238
- id = filter && attr$3(filter, ELEMENT_ID);
10816
+ id = filter && attr$1(filter, ELEMENT_ID);
11239
10817
  }
11240
10818
 
11241
10819
  var container = this._elements[id];
@@ -11900,7 +11478,7 @@
11900
11478
  *
11901
11479
  * @return {Base} the new model instance
11902
11480
  */
11903
- function create$1(type, attrs) {
11481
+ function create(type, attrs) {
11904
11482
  var Type = types$7[type];
11905
11483
  if (!Type) {
11906
11484
  throw new Error('unknown type: <' + type + '>');
@@ -11948,7 +11526,7 @@
11948
11526
  attrs.id = type + '_' + (this._uid++);
11949
11527
  }
11950
11528
 
11951
- return create$1(type, attrs);
11529
+ return create(type, attrs);
11952
11530
  };
11953
11531
 
11954
11532
  var FN_REF = '__fn';
@@ -12518,10 +12096,10 @@
12518
12096
  } else {
12519
12097
  childrenGfx = getChildren(gfx);
12520
12098
  if (!childrenGfx) {
12521
- childrenGfx = create$3('g');
12522
- classes$2(childrenGfx).add('djs-children');
12099
+ childrenGfx = create$1('g');
12100
+ classes$1(childrenGfx).add('djs-children');
12523
12101
 
12524
- append$2(gfx.parentNode, childrenGfx);
12102
+ append(gfx.parentNode, childrenGfx);
12525
12103
  }
12526
12104
  }
12527
12105
 
@@ -12535,7 +12113,7 @@
12535
12113
  GraphicsFactory.prototype._clear = function(gfx) {
12536
12114
  var visual = getVisual(gfx);
12537
12115
 
12538
- clear$1(visual);
12116
+ clear(visual);
12539
12117
 
12540
12118
  return visual;
12541
12119
  };
@@ -12570,31 +12148,31 @@
12570
12148
  GraphicsFactory.prototype._createContainer = function(
12571
12149
  type, childrenGfx, parentIndex, isFrame
12572
12150
  ) {
12573
- var outerGfx = create$3('g');
12574
- classes$2(outerGfx).add('djs-group');
12151
+ var outerGfx = create$1('g');
12152
+ classes$1(outerGfx).add('djs-group');
12575
12153
 
12576
12154
  // insert node at position
12577
12155
  if (typeof parentIndex !== 'undefined') {
12578
12156
  prependTo(outerGfx, childrenGfx, childrenGfx.childNodes[parentIndex]);
12579
12157
  } else {
12580
- append$2(childrenGfx, outerGfx);
12158
+ append(childrenGfx, outerGfx);
12581
12159
  }
12582
12160
 
12583
- var gfx = create$3('g');
12584
- classes$2(gfx).add('djs-element');
12585
- classes$2(gfx).add('djs-' + type);
12161
+ var gfx = create$1('g');
12162
+ classes$1(gfx).add('djs-element');
12163
+ classes$1(gfx).add('djs-' + type);
12586
12164
 
12587
12165
  if (isFrame) {
12588
- classes$2(gfx).add('djs-frame');
12166
+ classes$1(gfx).add('djs-frame');
12589
12167
  }
12590
12168
 
12591
- append$2(outerGfx, gfx);
12169
+ append(outerGfx, gfx);
12592
12170
 
12593
12171
  // create visual
12594
- var visual = create$3('g');
12595
- classes$2(visual).add('djs-visual');
12172
+ var visual = create$1('g');
12173
+ classes$1(visual).add('djs-visual');
12596
12174
 
12597
- append$2(gfx, visual);
12175
+ append(gfx, visual);
12598
12176
 
12599
12177
  return gfx;
12600
12178
  };
@@ -12686,9 +12264,9 @@
12686
12264
  }
12687
12265
 
12688
12266
  if (element.hidden) {
12689
- attr$3(gfx, 'display', 'none');
12267
+ attr$1(gfx, 'display', 'none');
12690
12268
  } else {
12691
- attr$3(gfx, 'display', 'block');
12269
+ attr$1(gfx, 'display', 'block');
12692
12270
  }
12693
12271
  };
12694
12272
 
@@ -12696,7 +12274,7 @@
12696
12274
  var gfx = this._elementRegistry.getGraphics(element);
12697
12275
 
12698
12276
  // remove
12699
- remove$3(gfx.parentNode);
12277
+ remove$2(gfx.parentNode);
12700
12278
  };
12701
12279
 
12702
12280
 
@@ -21713,7 +21291,7 @@
21713
21291
  Diagram.prototype.destroy.call(this);
21714
21292
 
21715
21293
  // dom detach
21716
- remove$2(this._container);
21294
+ remove$1(this._container);
21717
21295
  };
21718
21296
 
21719
21297
  /**
@@ -22006,15 +21584,10 @@
22006
21584
  // default moddle extensions the viewer is composed of
22007
21585
  Viewer.prototype._moddleExtensions = {};
22008
21586
 
22009
- var KEYCODE_C = 67;
22010
- var KEYCODE_V = 86;
22011
- var KEYCODE_Y = 89;
22012
- var KEYCODE_Z = 90;
22013
-
22014
- var KEYS_COPY = [ 'c', 'C', KEYCODE_C ];
22015
- var KEYS_PASTE = [ 'v', 'V', KEYCODE_V ];
22016
- var KEYS_REDO = [ 'y', 'Y', KEYCODE_Y ];
22017
- var KEYS_UNDO = [ 'z', 'Z', KEYCODE_Z ];
21587
+ var KEYS_COPY = [ 'c', 'C', 'KeyC' ];
21588
+ var KEYS_PASTE = [ 'v', 'V', 'KeyV' ];
21589
+ var KEYS_REDO = [ 'y', 'Y', 'KeyY' ];
21590
+ var KEYS_UNDO = [ 'z', 'Z', 'KeyZ' ];
22018
21591
 
22019
21592
  /**
22020
21593
  * Returns true if event was triggered with any modifier
@@ -22047,7 +21620,7 @@
22047
21620
  function isKey(keys, event) {
22048
21621
  keys = isArray$2(keys) ? keys : [ keys ];
22049
21622
 
22050
- return keys.indexOf(event.key) !== -1 || keys.indexOf(event.keyCode) !== -1;
21623
+ return keys.indexOf(event.key) !== -1 || keys.indexOf(event.code) !== -1;
22051
21624
  }
22052
21625
 
22053
21626
  /**
@@ -22086,7 +21659,7 @@
22086
21659
 
22087
21660
  /**
22088
21661
  * A keyboard abstraction that may be activated and
22089
- * deactivated by users at will, consuming key events
21662
+ * deactivated by users at will, consuming global key events
22090
21663
  * and triggering diagram actions.
22091
21664
  *
22092
21665
  * For keys pressed down, keyboard fires `keyboard.keydown` event.
@@ -22171,6 +21744,10 @@
22171
21744
  };
22172
21745
 
22173
21746
  Keyboard.prototype._isEventIgnored = function(event) {
21747
+ if (event.defaultPrevented) {
21748
+ return true;
21749
+ }
21750
+
22174
21751
  return isInput(event.target) && this._isModifiedKeyIgnored(event);
22175
21752
  };
22176
21753
 
@@ -22201,8 +21778,8 @@
22201
21778
  this._node = node;
22202
21779
 
22203
21780
  // bind key events
22204
- event.bind(node, 'keydown', this._keydownHandler, true);
22205
- event.bind(node, 'keyup', this._keyupHandler, true);
21781
+ event.bind(node, 'keydown', this._keydownHandler);
21782
+ event.bind(node, 'keyup', this._keyupHandler);
22206
21783
 
22207
21784
  this._fire('bind');
22208
21785
  };
@@ -22218,8 +21795,8 @@
22218
21795
  this._fire('unbind');
22219
21796
 
22220
21797
  // unbind key events
22221
- event.unbind(node, 'keydown', this._keydownHandler, true);
22222
- event.unbind(node, 'keyup', this._keyupHandler, true);
21798
+ event.unbind(node, 'keydown', this._keydownHandler);
21799
+ event.unbind(node, 'keyup', this._keyupHandler);
22223
21800
  }
22224
21801
 
22225
21802
  this._node = null;
@@ -22531,737 +22108,474 @@
22531
22108
  dx = -actualSpeed;
22532
22109
  break;
22533
22110
  case 'down': // Down
22534
- dy = -actualSpeed;
22535
- break;
22536
- }
22537
-
22538
- canvas.scroll({
22539
- dx: dx,
22540
- dy: dy
22541
- });
22542
- };
22543
-
22544
- }
22545
-
22546
-
22547
- KeyboardMove.$inject = [
22548
- 'config.keyboardMove',
22549
- 'keyboard',
22550
- 'canvas'
22551
- ];
22552
-
22553
- var KeyboardMoveModule = {
22554
- __depends__: [
22555
- KeyboardModule
22556
- ],
22557
- __init__: [ 'keyboardMove' ],
22558
- keyboardMove: [ 'type', KeyboardMove ]
22559
- };
22560
-
22561
- var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
22562
-
22563
-
22564
- function set(mode) {
22565
- var classes = classes$1(document.body);
22566
-
22567
- classes.removeMatching(CURSOR_CLS_PATTERN);
22568
-
22569
- if (mode) {
22570
- classes.add('djs-cursor-' + mode);
22571
- }
22572
- }
22573
-
22574
- function unset() {
22575
- set(null);
22576
- }
22577
-
22578
- var TRAP_PRIORITY = 5000;
22579
-
22580
- /**
22581
- * Installs a click trap that prevents a ghost click following a dragging operation.
22582
- *
22583
- * @return {Function} a function to immediately remove the installed trap.
22584
- */
22585
- function install(eventBus, eventName) {
22586
-
22587
- eventName = eventName || 'element.click';
22588
-
22589
- function trap() {
22590
- return false;
22591
- }
22592
-
22593
- eventBus.once(eventName, TRAP_PRIORITY, trap);
22594
-
22595
- return function() {
22596
- eventBus.off(eventName, trap);
22597
- };
22598
- }
22599
-
22600
- function delta(a, b) {
22601
- return {
22602
- x: a.x - b.x,
22603
- y: a.y - b.y
22604
- };
22605
- }
22606
-
22607
- var THRESHOLD = 15;
22608
-
22609
-
22610
- /**
22611
- * Move the canvas via mouse.
22612
- *
22613
- * @param {EventBus} eventBus
22614
- * @param {Canvas} canvas
22615
- */
22616
- function MoveCanvas(eventBus, canvas) {
22617
-
22618
- var context;
22619
-
22620
-
22621
- // listen for move on element mouse down;
22622
- // allow others to hook into the event before us though
22623
- // (dragging / element moving will do this)
22624
- eventBus.on('element.mousedown', 500, function(e) {
22625
- return handleStart(e.originalEvent);
22626
- });
22627
-
22628
-
22629
- function handleMove(event) {
22630
-
22631
- var start = context.start,
22632
- button = context.button,
22633
- position = toPoint(event),
22634
- delta$1 = delta(position, start);
22635
-
22636
- if (!context.dragging && length(delta$1) > THRESHOLD) {
22637
- context.dragging = true;
22638
-
22639
- if (button === 0) {
22640
- install(eventBus);
22641
- }
22642
-
22643
- set('grab');
22644
- }
22645
-
22646
- if (context.dragging) {
22647
-
22648
- var lastPosition = context.last || context.start;
22649
-
22650
- delta$1 = delta(position, lastPosition);
22651
-
22652
- canvas.scroll({
22653
- dx: delta$1.x,
22654
- dy: delta$1.y
22655
- });
22656
-
22657
- context.last = position;
22658
- }
22659
-
22660
- // prevent select
22661
- event.preventDefault();
22662
- }
22663
-
22664
-
22665
- function handleEnd(event$1) {
22666
- event.unbind(document, 'mousemove', handleMove);
22667
- event.unbind(document, 'mouseup', handleEnd);
22668
-
22669
- context = null;
22670
-
22671
- unset();
22672
- }
22673
-
22674
- function handleStart(event$1) {
22675
-
22676
- // event is already handled by '.djs-draggable'
22677
- if (closest(event$1.target, '.djs-draggable')) {
22678
- return;
22679
- }
22680
-
22681
- var button = event$1.button;
22682
-
22683
- // reject right mouse button or modifier key
22684
- if (button >= 2 || event$1.ctrlKey || event$1.shiftKey || event$1.altKey) {
22685
- return;
22111
+ dy = -actualSpeed;
22112
+ break;
22686
22113
  }
22687
22114
 
22688
- context = {
22689
- button: button,
22690
- start: toPoint(event$1)
22691
- };
22692
-
22693
- event.bind(document, 'mousemove', handleMove);
22694
- event.bind(document, 'mouseup', handleEnd);
22695
-
22696
- // we've handled the event
22697
- return true;
22698
- }
22699
-
22700
- this.isActive = function() {
22701
- return !!context;
22115
+ canvas.scroll({
22116
+ dx: dx,
22117
+ dy: dy
22118
+ });
22702
22119
  };
22703
22120
 
22704
22121
  }
22705
22122
 
22706
22123
 
22707
- MoveCanvas.$inject = [
22708
- 'eventBus',
22124
+ KeyboardMove.$inject = [
22125
+ 'config.keyboardMove',
22126
+ 'keyboard',
22709
22127
  'canvas'
22710
22128
  ];
22711
22129
 
22712
-
22713
-
22714
- // helpers ///////
22715
-
22716
- function length(point) {
22717
- return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
22718
- }
22719
-
22720
- var MoveCanvasModule = {
22721
- __init__: [ 'moveCanvas' ],
22722
- moveCanvas: [ 'type', MoveCanvas ]
22130
+ var KeyboardMoveModule = {
22131
+ __depends__: [
22132
+ KeyboardModule
22133
+ ],
22134
+ __init__: [ 'keyboardMove' ],
22135
+ keyboardMove: [ 'type', KeyboardMove ]
22723
22136
  };
22724
22137
 
22725
- /**
22726
- * Get the logarithm of x with base 10
22727
- * @param {Integer} value
22728
- */
22729
- function log10(x) {
22730
- return Math.log(x) / Math.log(10);
22731
- }
22138
+ var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
22732
22139
 
22733
- /**
22734
- * Get step size for given range and number of steps.
22735
- *
22736
- * @param {Object} range
22737
- * @param {number} range.min
22738
- * @param {number} range.max
22739
- */
22740
- function getStepSize(range, steps) {
22741
22140
 
22742
- var minLinearRange = log10(range.min),
22743
- maxLinearRange = log10(range.max);
22141
+ function set(mode) {
22142
+ var classes$1 = classes(document.body);
22744
22143
 
22745
- var absoluteLinearRange = Math.abs(minLinearRange) + Math.abs(maxLinearRange);
22144
+ classes$1.removeMatching(CURSOR_CLS_PATTERN);
22746
22145
 
22747
- return absoluteLinearRange / steps;
22146
+ if (mode) {
22147
+ classes$1.add('djs-cursor-' + mode);
22148
+ }
22748
22149
  }
22749
22150
 
22750
- function cap(range, scale) {
22751
- return Math.max(range.min, Math.min(range.max, scale));
22151
+ function unset() {
22152
+ set(null);
22752
22153
  }
22753
22154
 
22754
- var sign = Math.sign || function(n) {
22755
- return n >= 0 ? 1 : -1;
22756
- };
22757
-
22758
- var RANGE = { min: 0.2, max: 4 },
22759
- NUM_STEPS = 10;
22760
-
22761
- var DELTA_THRESHOLD = 0.1;
22762
-
22763
- var DEFAULT_SCALE = 0.75;
22155
+ var TRAP_PRIORITY = 5000;
22764
22156
 
22765
22157
  /**
22766
- * An implementation of zooming and scrolling within the
22767
- * {@link Canvas} via the mouse wheel.
22768
- *
22769
- * Mouse wheel zooming / scrolling may be disabled using
22770
- * the {@link toggle(enabled)} method.
22158
+ * Installs a click trap that prevents a ghost click following a dragging operation.
22771
22159
  *
22772
- * @param {Object} [config]
22773
- * @param {boolean} [config.enabled=true] default enabled state
22774
- * @param {number} [config.scale=.75] scroll sensivity
22775
- * @param {EventBus} eventBus
22776
- * @param {Canvas} canvas
22160
+ * @return {Function} a function to immediately remove the installed trap.
22777
22161
  */
22778
- function ZoomScroll(config, eventBus, canvas) {
22779
-
22780
- config = config || {};
22781
-
22782
- this._enabled = false;
22783
-
22784
- this._canvas = canvas;
22785
- this._container = canvas._container;
22162
+ function install(eventBus, eventName) {
22786
22163
 
22787
- this._handleWheel = bind$2(this._handleWheel, this);
22164
+ eventName = eventName || 'element.click';
22788
22165
 
22789
- this._totalDelta = 0;
22790
- this._scale = config.scale || DEFAULT_SCALE;
22166
+ function trap() {
22167
+ return false;
22168
+ }
22791
22169
 
22792
- var self = this;
22170
+ eventBus.once(eventName, TRAP_PRIORITY, trap);
22793
22171
 
22794
- eventBus.on('canvas.init', function(e) {
22795
- self._init(config.enabled !== false);
22796
- });
22172
+ return function() {
22173
+ eventBus.off(eventName, trap);
22174
+ };
22797
22175
  }
22798
22176
 
22799
- ZoomScroll.$inject = [
22800
- 'config.zoomScroll',
22801
- 'eventBus',
22802
- 'canvas'
22803
- ];
22804
-
22805
- ZoomScroll.prototype.scroll = function scroll(delta) {
22806
- this._canvas.scroll(delta);
22807
- };
22177
+ function delta(a, b) {
22178
+ return {
22179
+ x: a.x - b.x,
22180
+ y: a.y - b.y
22181
+ };
22182
+ }
22808
22183
 
22184
+ var THRESHOLD = 15;
22809
22185
 
22810
- ZoomScroll.prototype.reset = function reset() {
22811
- this._canvas.zoom('fit-viewport');
22812
- };
22813
22186
 
22814
22187
  /**
22815
- * Zoom depending on delta.
22188
+ * Move the canvas via mouse.
22816
22189
  *
22817
- * @param {number} delta
22818
- * @param {Object} position
22190
+ * @param {EventBus} eventBus
22191
+ * @param {Canvas} canvas
22819
22192
  */
22820
- ZoomScroll.prototype.zoom = function zoom(delta, position) {
22821
-
22822
- // zoom with half the step size of stepZoom
22823
- var stepSize = getStepSize(RANGE, NUM_STEPS * 2);
22824
-
22825
- // add until threshold reached
22826
- this._totalDelta += delta;
22827
-
22828
- if (Math.abs(this._totalDelta) > DELTA_THRESHOLD) {
22829
- this._zoom(delta, position, stepSize);
22830
-
22831
- // reset
22832
- this._totalDelta = 0;
22833
- }
22834
- };
22835
-
22193
+ function MoveCanvas(eventBus, canvas) {
22836
22194
 
22837
- ZoomScroll.prototype._handleWheel = function handleWheel(event) {
22195
+ var context;
22838
22196
 
22839
- // event is already handled by '.djs-scrollable'
22840
- if (closest(event.target, '.djs-scrollable', true)) {
22841
- return;
22842
- }
22843
22197
 
22844
- var element = this._container;
22198
+ // listen for move on element mouse down;
22199
+ // allow others to hook into the event before us though
22200
+ // (dragging / element moving will do this)
22201
+ eventBus.on('element.mousedown', 500, function(e) {
22202
+ return handleStart(e.originalEvent);
22203
+ });
22845
22204
 
22846
- event.preventDefault();
22847
22205
 
22848
- // pinch to zoom is mapped to wheel + ctrlKey = true
22849
- // in modern browsers (!)
22206
+ function handleMove(event) {
22850
22207
 
22851
- var isZoom = event.ctrlKey;
22208
+ var start = context.start,
22209
+ button = context.button,
22210
+ position = toPoint(event),
22211
+ delta$1 = delta(position, start);
22852
22212
 
22853
- var isHorizontalScroll = event.shiftKey;
22213
+ if (!context.dragging && length(delta$1) > THRESHOLD) {
22214
+ context.dragging = true;
22854
22215
 
22855
- var factor = -1 * this._scale,
22856
- delta;
22216
+ if (button === 0) {
22217
+ install(eventBus);
22218
+ }
22857
22219
 
22858
- if (isZoom) {
22859
- factor *= event.deltaMode === 0 ? 0.020 : 0.32;
22860
- } else {
22861
- factor *= event.deltaMode === 0 ? 1.0 : 16.0;
22862
- }
22220
+ set('grab');
22221
+ }
22863
22222
 
22864
- if (isZoom) {
22865
- var elementRect = element.getBoundingClientRect();
22223
+ if (context.dragging) {
22866
22224
 
22867
- var offset = {
22868
- x: event.clientX - elementRect.left,
22869
- y: event.clientY - elementRect.top
22870
- };
22225
+ var lastPosition = context.last || context.start;
22871
22226
 
22872
- delta = (
22873
- Math.sqrt(
22874
- Math.pow(event.deltaY, 2) +
22875
- Math.pow(event.deltaX, 2)
22876
- ) * sign(event.deltaY) * factor
22877
- );
22227
+ delta$1 = delta(position, lastPosition);
22878
22228
 
22879
- // zoom in relative to diagram {x,y} coordinates
22880
- this.zoom(delta, offset);
22881
- } else {
22229
+ canvas.scroll({
22230
+ dx: delta$1.x,
22231
+ dy: delta$1.y
22232
+ });
22882
22233
 
22883
- if (isHorizontalScroll) {
22884
- delta = {
22885
- dx: factor * event.deltaY,
22886
- dy: 0
22887
- };
22888
- } else {
22889
- delta = {
22890
- dx: factor * event.deltaX,
22891
- dy: factor * event.deltaY
22892
- };
22234
+ context.last = position;
22893
22235
  }
22894
22236
 
22895
- this.scroll(delta);
22237
+ // prevent select
22238
+ event.preventDefault();
22896
22239
  }
22897
- };
22898
-
22899
- /**
22900
- * Zoom with fixed step size.
22901
- *
22902
- * @param {number} delta - Zoom delta (1 for zooming in, -1 for out).
22903
- * @param {Object} position
22904
- */
22905
- ZoomScroll.prototype.stepZoom = function stepZoom(delta, position) {
22906
-
22907
- var stepSize = getStepSize(RANGE, NUM_STEPS);
22908
-
22909
- this._zoom(delta, position, stepSize);
22910
- };
22911
-
22912
-
22913
- /**
22914
- * Zoom in/out given a step size.
22915
- *
22916
- * @param {number} delta
22917
- * @param {Object} position
22918
- * @param {number} stepSize
22919
- */
22920
- ZoomScroll.prototype._zoom = function(delta, position, stepSize) {
22921
- var canvas = this._canvas;
22922
22240
 
22923
- var direction = delta > 0 ? 1 : -1;
22924
22241
 
22925
- var currentLinearZoomLevel = log10(canvas.zoom());
22242
+ function handleEnd(event$1) {
22243
+ event.unbind(document, 'mousemove', handleMove);
22244
+ event.unbind(document, 'mouseup', handleEnd);
22926
22245
 
22927
- // snap to a proximate zoom step
22928
- var newLinearZoomLevel = Math.round(currentLinearZoomLevel / stepSize) * stepSize;
22246
+ context = null;
22929
22247
 
22930
- // increase or decrease one zoom step in the given direction
22931
- newLinearZoomLevel += stepSize * direction;
22248
+ unset();
22249
+ }
22932
22250
 
22933
- // calculate the absolute logarithmic zoom level based on the linear zoom level
22934
- // (e.g. 2 for an absolute x2 zoom)
22935
- var newLogZoomLevel = Math.pow(10, newLinearZoomLevel);
22251
+ function handleStart(event$1) {
22936
22252
 
22937
- canvas.zoom(cap(RANGE, newLogZoomLevel), position);
22938
- };
22253
+ // event is already handled by '.djs-draggable'
22254
+ if (closest(event$1.target, '.djs-draggable')) {
22255
+ return;
22256
+ }
22939
22257
 
22258
+ var button = event$1.button;
22940
22259
 
22941
- /**
22942
- * Toggle the zoom scroll ability via mouse wheel.
22943
- *
22944
- * @param {boolean} [newEnabled] new enabled state
22945
- */
22946
- ZoomScroll.prototype.toggle = function toggle(newEnabled) {
22260
+ // reject right mouse button or modifier key
22261
+ if (button >= 2 || event$1.ctrlKey || event$1.shiftKey || event$1.altKey) {
22262
+ return;
22263
+ }
22947
22264
 
22948
- var element = this._container;
22949
- var handleWheel = this._handleWheel;
22265
+ context = {
22266
+ button: button,
22267
+ start: toPoint(event$1)
22268
+ };
22950
22269
 
22951
- var oldEnabled = this._enabled;
22270
+ event.bind(document, 'mousemove', handleMove);
22271
+ event.bind(document, 'mouseup', handleEnd);
22952
22272
 
22953
- if (typeof newEnabled === 'undefined') {
22954
- newEnabled = !oldEnabled;
22273
+ // we've handled the event
22274
+ return true;
22955
22275
  }
22956
22276
 
22957
- // only react on actual changes
22958
- if (oldEnabled !== newEnabled) {
22277
+ this.isActive = function() {
22278
+ return !!context;
22279
+ };
22959
22280
 
22960
- // add or remove wheel listener based on
22961
- // changed enabled state
22962
- event[newEnabled ? 'bind' : 'unbind'](element, 'wheel', handleWheel, false);
22963
- }
22281
+ }
22964
22282
 
22965
- this._enabled = newEnabled;
22966
22283
 
22967
- return newEnabled;
22968
- };
22284
+ MoveCanvas.$inject = [
22285
+ 'eventBus',
22286
+ 'canvas'
22287
+ ];
22969
22288
 
22970
22289
 
22971
- ZoomScroll.prototype._init = function(newEnabled) {
22972
- this.toggle(newEnabled);
22973
- };
22974
22290
 
22975
- var ZoomScrollModule = {
22976
- __init__: [ 'zoomScroll' ],
22977
- zoomScroll: [ 'type', ZoomScroll ]
22291
+ // helpers ///////
22292
+
22293
+ function length(point) {
22294
+ return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
22295
+ }
22296
+
22297
+ var MoveCanvasModule = {
22298
+ __init__: [ 'moveCanvas' ],
22299
+ moveCanvas: [ 'type', MoveCanvas ]
22978
22300
  };
22979
22301
 
22980
22302
  /**
22981
- * A viewer that includes mouse navigation facilities
22982
- *
22983
- * @param {Object} options
22303
+ * Get the logarithm of x with base 10
22304
+ * @param {Integer} value
22984
22305
  */
22985
- function NavigatedViewer$1(options) {
22986
- Viewer.call(this, options);
22306
+ function log10(x) {
22307
+ return Math.log(x) / Math.log(10);
22987
22308
  }
22988
22309
 
22989
- e(NavigatedViewer$1, Viewer);
22990
-
22310
+ /**
22311
+ * Get step size for given range and number of steps.
22312
+ *
22313
+ * @param {Object} range
22314
+ * @param {number} range.min
22315
+ * @param {number} range.max
22316
+ */
22317
+ function getStepSize(range, steps) {
22991
22318
 
22992
- NavigatedViewer$1.prototype._navigationModules = [
22993
- KeyboardMoveModule,
22994
- MoveCanvasModule,
22995
- ZoomScrollModule
22996
- ];
22319
+ var minLinearRange = log10(range.min),
22320
+ maxLinearRange = log10(range.max);
22997
22321
 
22998
- NavigatedViewer$1.prototype._modules = [].concat(
22999
- Viewer.prototype._modules,
23000
- NavigatedViewer$1.prototype._navigationModules
23001
- );
22322
+ var absoluteLinearRange = Math.abs(minLinearRange) + Math.abs(maxLinearRange);
23002
22323
 
23003
- function ensureImported(element, target) {
22324
+ return absoluteLinearRange / steps;
22325
+ }
23004
22326
 
23005
- if (element.ownerDocument !== target.ownerDocument) {
23006
- try {
22327
+ function cap(range, scale) {
22328
+ return Math.max(range.min, Math.min(range.max, scale));
22329
+ }
23007
22330
 
23008
- // may fail on webkit
23009
- return target.ownerDocument.importNode(element, true);
23010
- } catch (e) {
22331
+ var sign = Math.sign || function(n) {
22332
+ return n >= 0 ? 1 : -1;
22333
+ };
23011
22334
 
23012
- // ignore
23013
- }
23014
- }
22335
+ var RANGE = { min: 0.2, max: 4 },
22336
+ NUM_STEPS = 10;
23015
22337
 
23016
- return element;
23017
- }
22338
+ var DELTA_THRESHOLD = 0.1;
23018
22339
 
23019
- /**
23020
- * appendTo utility
23021
- */
22340
+ var DEFAULT_SCALE = 0.75;
23022
22341
 
23023
22342
  /**
23024
- * Append a node to a target element and return the appended node.
22343
+ * An implementation of zooming and scrolling within the
22344
+ * {@link Canvas} via the mouse wheel.
23025
22345
  *
23026
- * @param {SVGElement} element
23027
- * @param {SVGElement} target
22346
+ * Mouse wheel zooming / scrolling may be disabled using
22347
+ * the {@link toggle(enabled)} method.
23028
22348
  *
23029
- * @return {SVGElement} the appended node
22349
+ * @param {Object} [config]
22350
+ * @param {boolean} [config.enabled=true] default enabled state
22351
+ * @param {number} [config.scale=.75] scroll sensivity
22352
+ * @param {EventBus} eventBus
22353
+ * @param {Canvas} canvas
23030
22354
  */
23031
- function appendTo(element, target) {
23032
- return target.appendChild(ensureImported(element, target));
23033
- }
22355
+ function ZoomScroll(config, eventBus, canvas) {
23034
22356
 
23035
- /**
23036
- * append utility
23037
- */
22357
+ config = config || {};
23038
22358
 
23039
- /**
23040
- * Append a node to an element
23041
- *
23042
- * @param {SVGElement} element
23043
- * @param {SVGElement} node
23044
- *
23045
- * @return {SVGElement} the element
23046
- */
23047
- function append(target, node) {
23048
- appendTo(node, target);
23049
- return target;
23050
- }
22359
+ this._enabled = false;
23051
22360
 
23052
- /**
23053
- * attribute accessor utility
23054
- */
22361
+ this._canvas = canvas;
22362
+ this._container = canvas._container;
23055
22363
 
23056
- var LENGTH_ATTR = 2;
22364
+ this._handleWheel = bind$2(this._handleWheel, this);
23057
22365
 
23058
- var CSS_PROPERTIES = {
23059
- 'alignment-baseline': 1,
23060
- 'baseline-shift': 1,
23061
- 'clip': 1,
23062
- 'clip-path': 1,
23063
- 'clip-rule': 1,
23064
- 'color': 1,
23065
- 'color-interpolation': 1,
23066
- 'color-interpolation-filters': 1,
23067
- 'color-profile': 1,
23068
- 'color-rendering': 1,
23069
- 'cursor': 1,
23070
- 'direction': 1,
23071
- 'display': 1,
23072
- 'dominant-baseline': 1,
23073
- 'enable-background': 1,
23074
- 'fill': 1,
23075
- 'fill-opacity': 1,
23076
- 'fill-rule': 1,
23077
- 'filter': 1,
23078
- 'flood-color': 1,
23079
- 'flood-opacity': 1,
23080
- 'font': 1,
23081
- 'font-family': 1,
23082
- 'font-size': LENGTH_ATTR,
23083
- 'font-size-adjust': 1,
23084
- 'font-stretch': 1,
23085
- 'font-style': 1,
23086
- 'font-variant': 1,
23087
- 'font-weight': 1,
23088
- 'glyph-orientation-horizontal': 1,
23089
- 'glyph-orientation-vertical': 1,
23090
- 'image-rendering': 1,
23091
- 'kerning': 1,
23092
- 'letter-spacing': 1,
23093
- 'lighting-color': 1,
23094
- 'marker': 1,
23095
- 'marker-end': 1,
23096
- 'marker-mid': 1,
23097
- 'marker-start': 1,
23098
- 'mask': 1,
23099
- 'opacity': 1,
23100
- 'overflow': 1,
23101
- 'pointer-events': 1,
23102
- 'shape-rendering': 1,
23103
- 'stop-color': 1,
23104
- 'stop-opacity': 1,
23105
- 'stroke': 1,
23106
- 'stroke-dasharray': 1,
23107
- 'stroke-dashoffset': 1,
23108
- 'stroke-linecap': 1,
23109
- 'stroke-linejoin': 1,
23110
- 'stroke-miterlimit': 1,
23111
- 'stroke-opacity': 1,
23112
- 'stroke-width': LENGTH_ATTR,
23113
- 'text-anchor': 1,
23114
- 'text-decoration': 1,
23115
- 'text-rendering': 1,
23116
- 'unicode-bidi': 1,
23117
- 'visibility': 1,
23118
- 'word-spacing': 1,
23119
- 'writing-mode': 1
22366
+ this._totalDelta = 0;
22367
+ this._scale = config.scale || DEFAULT_SCALE;
22368
+
22369
+ var self = this;
22370
+
22371
+ eventBus.on('canvas.init', function(e) {
22372
+ self._init(config.enabled !== false);
22373
+ });
22374
+ }
22375
+
22376
+ ZoomScroll.$inject = [
22377
+ 'config.zoomScroll',
22378
+ 'eventBus',
22379
+ 'canvas'
22380
+ ];
22381
+
22382
+ ZoomScroll.prototype.scroll = function scroll(delta) {
22383
+ this._canvas.scroll(delta);
23120
22384
  };
23121
22385
 
23122
22386
 
23123
- function getAttribute(node, name) {
23124
- if (CSS_PROPERTIES[name]) {
23125
- return node.style[name];
23126
- } else {
23127
- return node.getAttributeNS(null, name);
22387
+ ZoomScroll.prototype.reset = function reset() {
22388
+ this._canvas.zoom('fit-viewport');
22389
+ };
22390
+
22391
+ /**
22392
+ * Zoom depending on delta.
22393
+ *
22394
+ * @param {number} delta
22395
+ * @param {Object} position
22396
+ */
22397
+ ZoomScroll.prototype.zoom = function zoom(delta, position) {
22398
+
22399
+ // zoom with half the step size of stepZoom
22400
+ var stepSize = getStepSize(RANGE, NUM_STEPS * 2);
22401
+
22402
+ // add until threshold reached
22403
+ this._totalDelta += delta;
22404
+
22405
+ if (Math.abs(this._totalDelta) > DELTA_THRESHOLD) {
22406
+ this._zoom(delta, position, stepSize);
22407
+
22408
+ // reset
22409
+ this._totalDelta = 0;
23128
22410
  }
23129
- }
22411
+ };
23130
22412
 
23131
- function setAttribute(node, name, value) {
23132
- var hyphenated = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
23133
22413
 
23134
- var type = CSS_PROPERTIES[hyphenated];
22414
+ ZoomScroll.prototype._handleWheel = function handleWheel(event) {
23135
22415
 
23136
- if (type) {
22416
+ // event is already handled by '.djs-scrollable'
22417
+ if (closest(event.target, '.djs-scrollable', true)) {
22418
+ return;
22419
+ }
23137
22420
 
23138
- // append pixel unit, unless present
23139
- if (type === LENGTH_ATTR && typeof value === 'number') {
23140
- value = String(value) + 'px';
23141
- }
22421
+ var element = this._container;
23142
22422
 
23143
- node.style[hyphenated] = value;
22423
+ event.preventDefault();
22424
+
22425
+ // pinch to zoom is mapped to wheel + ctrlKey = true
22426
+ // in modern browsers (!)
22427
+
22428
+ var isZoom = event.ctrlKey;
22429
+
22430
+ var isHorizontalScroll = event.shiftKey;
22431
+
22432
+ var factor = -1 * this._scale,
22433
+ delta;
22434
+
22435
+ if (isZoom) {
22436
+ factor *= event.deltaMode === 0 ? 0.020 : 0.32;
23144
22437
  } else {
23145
- node.setAttributeNS(null, name, value);
22438
+ factor *= event.deltaMode === 0 ? 1.0 : 16.0;
23146
22439
  }
23147
- }
23148
22440
 
23149
- function setAttributes(node, attrs) {
22441
+ if (isZoom) {
22442
+ var elementRect = element.getBoundingClientRect();
23150
22443
 
23151
- var names = Object.keys(attrs), i, name;
22444
+ var offset = {
22445
+ x: event.clientX - elementRect.left,
22446
+ y: event.clientY - elementRect.top
22447
+ };
23152
22448
 
23153
- for (i = 0, name; (name = names[i]); i++) {
23154
- setAttribute(node, name, attrs[name]);
22449
+ delta = (
22450
+ Math.sqrt(
22451
+ Math.pow(event.deltaY, 2) +
22452
+ Math.pow(event.deltaX, 2)
22453
+ ) * sign(event.deltaY) * factor
22454
+ );
22455
+
22456
+ // zoom in relative to diagram {x,y} coordinates
22457
+ this.zoom(delta, offset);
22458
+ } else {
22459
+
22460
+ if (isHorizontalScroll) {
22461
+ delta = {
22462
+ dx: factor * event.deltaY,
22463
+ dy: 0
22464
+ };
22465
+ } else {
22466
+ delta = {
22467
+ dx: factor * event.deltaX,
22468
+ dy: factor * event.deltaY
22469
+ };
22470
+ }
22471
+
22472
+ this.scroll(delta);
23155
22473
  }
23156
- }
22474
+ };
23157
22475
 
23158
22476
  /**
23159
- * Gets or sets raw attributes on a node.
23160
- *
23161
- * @param {SVGElement} node
23162
- * @param {Object} [attrs]
23163
- * @param {String} [name]
23164
- * @param {String} [value]
22477
+ * Zoom with fixed step size.
23165
22478
  *
23166
- * @return {String}
22479
+ * @param {number} delta - Zoom delta (1 for zooming in, -1 for out).
22480
+ * @param {Object} position
23167
22481
  */
23168
- function attr(node, name, value) {
23169
- if (typeof name === 'string') {
23170
- if (value !== undefined) {
23171
- setAttribute(node, name, value);
23172
- } else {
23173
- return getAttribute(node, name);
23174
- }
23175
- } else {
23176
- setAttributes(node, name);
23177
- }
22482
+ ZoomScroll.prototype.stepZoom = function stepZoom(delta, position) {
23178
22483
 
23179
- return node;
23180
- }
22484
+ var stepSize = getStepSize(RANGE, NUM_STEPS);
23181
22485
 
23182
- var ns = {
23183
- svg: 'http://www.w3.org/2000/svg'
22486
+ this._zoom(delta, position, stepSize);
23184
22487
  };
23185
22488
 
22489
+
23186
22490
  /**
23187
- * DOM parsing utility
22491
+ * Zoom in/out given a step size.
22492
+ *
22493
+ * @param {number} delta
22494
+ * @param {Object} position
22495
+ * @param {number} stepSize
23188
22496
  */
22497
+ ZoomScroll.prototype._zoom = function(delta, position, stepSize) {
22498
+ var canvas = this._canvas;
23189
22499
 
23190
- var SVG_START = '<svg xmlns="' + ns.svg + '"';
22500
+ var direction = delta > 0 ? 1 : -1;
23191
22501
 
23192
- function parse(svg) {
22502
+ var currentLinearZoomLevel = log10(canvas.zoom());
23193
22503
 
23194
- var unwrap = false;
22504
+ // snap to a proximate zoom step
22505
+ var newLinearZoomLevel = Math.round(currentLinearZoomLevel / stepSize) * stepSize;
23195
22506
 
23196
- // ensure we import a valid svg document
23197
- if (svg.substring(0, 4) === '<svg') {
23198
- if (svg.indexOf(ns.svg) === -1) {
23199
- svg = SVG_START + svg.substring(4);
23200
- }
23201
- } else {
22507
+ // increase or decrease one zoom step in the given direction
22508
+ newLinearZoomLevel += stepSize * direction;
23202
22509
 
23203
- // namespace svg
23204
- svg = SVG_START + '>' + svg + '</svg>';
23205
- unwrap = true;
23206
- }
22510
+ // calculate the absolute logarithmic zoom level based on the linear zoom level
22511
+ // (e.g. 2 for an absolute x2 zoom)
22512
+ var newLogZoomLevel = Math.pow(10, newLinearZoomLevel);
23207
22513
 
23208
- var parsed = parseDocument(svg);
22514
+ canvas.zoom(cap(RANGE, newLogZoomLevel), position);
22515
+ };
23209
22516
 
23210
- if (!unwrap) {
23211
- return parsed;
23212
- }
23213
22517
 
23214
- var fragment = document.createDocumentFragment();
22518
+ /**
22519
+ * Toggle the zoom scroll ability via mouse wheel.
22520
+ *
22521
+ * @param {boolean} [newEnabled] new enabled state
22522
+ */
22523
+ ZoomScroll.prototype.toggle = function toggle(newEnabled) {
23215
22524
 
23216
- var parent = parsed.firstChild;
22525
+ var element = this._container;
22526
+ var handleWheel = this._handleWheel;
23217
22527
 
23218
- while (parent.firstChild) {
23219
- fragment.appendChild(parent.firstChild);
22528
+ var oldEnabled = this._enabled;
22529
+
22530
+ if (typeof newEnabled === 'undefined') {
22531
+ newEnabled = !oldEnabled;
23220
22532
  }
23221
22533
 
23222
- return fragment;
23223
- }
22534
+ // only react on actual changes
22535
+ if (oldEnabled !== newEnabled) {
23224
22536
 
23225
- function parseDocument(svg) {
22537
+ // add or remove wheel listener based on
22538
+ // changed enabled state
22539
+ event[newEnabled ? 'bind' : 'unbind'](element, 'wheel', handleWheel, false);
22540
+ }
23226
22541
 
23227
- var parser;
22542
+ this._enabled = newEnabled;
23228
22543
 
23229
- // parse
23230
- parser = new DOMParser();
23231
- parser.async = false;
22544
+ return newEnabled;
22545
+ };
23232
22546
 
23233
- return parser.parseFromString(svg, 'text/xml');
23234
- }
23235
22547
 
23236
- /**
23237
- * Create utility for SVG elements
23238
- */
22548
+ ZoomScroll.prototype._init = function(newEnabled) {
22549
+ this.toggle(newEnabled);
22550
+ };
23239
22551
 
22552
+ var ZoomScrollModule = {
22553
+ __init__: [ 'zoomScroll' ],
22554
+ zoomScroll: [ 'type', ZoomScroll ]
22555
+ };
23240
22556
 
23241
22557
  /**
23242
- * Create a specific type from name or SVG markup.
23243
- *
23244
- * @param {String} name the name or markup of the element
23245
- * @param {Object} [attrs] attributes to set on the element
22558
+ * A viewer that includes mouse navigation facilities
23246
22559
  *
23247
- * @returns {SVGElement}
22560
+ * @param {Object} options
23248
22561
  */
23249
- function create(name, attrs) {
23250
- var element;
22562
+ function NavigatedViewer$1(options) {
22563
+ Viewer.call(this, options);
22564
+ }
23251
22565
 
23252
- if (name.charAt(0) === '<') {
23253
- element = parse(name).firstChild;
23254
- element = document.importNode(element, true);
23255
- } else {
23256
- element = document.createElementNS(ns.svg, name);
23257
- }
22566
+ e(NavigatedViewer$1, Viewer);
23258
22567
 
23259
- if (attrs) {
23260
- attr(element, attrs);
23261
- }
23262
22568
 
23263
- return element;
23264
- }
22569
+ NavigatedViewer$1.prototype._navigationModules = [
22570
+ KeyboardMoveModule,
22571
+ MoveCanvasModule,
22572
+ ZoomScrollModule
22573
+ ];
22574
+
22575
+ NavigatedViewer$1.prototype._modules = [].concat(
22576
+ Viewer.prototype._modules,
22577
+ NavigatedViewer$1.prototype._navigationModules
22578
+ );
23265
22579
 
23266
22580
  function getModelerTemplateIcon(element) {
23267
22581
  var modelerTemplateIcon = getBusinessObject(element).get('zeebe:modelerTemplateIcon');
@@ -23302,8 +22616,8 @@
23302
22616
 
23303
22617
  var modelerTemplateIcon = getModelerTemplateIcon(element);
23304
22618
 
23305
- var icon = create('image');
23306
- attr(icon, {
22619
+ var icon = create$1('image');
22620
+ attr$1(icon, {
23307
22621
  href: modelerTemplateIcon,
23308
22622
  x: 5,
23309
22623
  y: 5,
@@ -23733,6 +23047,29 @@
23733
23047
  type: "String"
23734
23048
  }
23735
23049
  ]
23050
+ },
23051
+ {
23052
+ name: "Script",
23053
+ superClass: [
23054
+ "Element"
23055
+ ],
23056
+ meta: {
23057
+ allowedIn: [
23058
+ "bpmn:ScriptTask"
23059
+ ]
23060
+ },
23061
+ properties: [
23062
+ {
23063
+ name: "expression",
23064
+ type: "String",
23065
+ isAttr: true
23066
+ },
23067
+ {
23068
+ name: "resultVariable",
23069
+ type: "String",
23070
+ isAttr: true
23071
+ }
23072
+ ]
23736
23073
  }
23737
23074
  ];
23738
23075
  var zeebeModdle = {