camunda-bpmn-js 0.13.2 → 0.15.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +280 -256
  2. package/LICENSE +20 -20
  3. package/README.md +84 -84
  4. package/dist/assets/base-modeler.css +4 -4
  5. package/dist/assets/base-navigated-viewer.css +1 -1
  6. package/dist/assets/base-viewer.css +1 -1
  7. package/dist/assets/bpmn-js.css +32 -4
  8. package/dist/assets/camunda-cloud-modeler.css +1 -1
  9. package/dist/assets/camunda-platform-modeler.css +1 -1
  10. package/dist/assets/diagram-js.css +55 -51
  11. package/dist/assets/element-templates.css +4 -0
  12. package/dist/assets/properties-panel.css +929 -900
  13. package/dist/base-modeler.development.js +7098 -6259
  14. package/dist/base-modeler.production.min.js +4 -4
  15. package/dist/base-navigated-viewer.development.js +21592 -21216
  16. package/dist/base-navigated-viewer.production.min.js +3 -2
  17. package/dist/base-viewer.development.js +20793 -20417
  18. package/dist/base-viewer.production.min.js +3 -2
  19. package/dist/camunda-cloud-modeler.development.js +9667 -8627
  20. package/dist/camunda-cloud-modeler.production.min.js +4 -4
  21. package/dist/camunda-cloud-navigated-viewer.development.js +689 -368
  22. package/dist/camunda-cloud-navigated-viewer.production.min.js +2 -2
  23. package/dist/camunda-cloud-viewer.development.js +688 -367
  24. package/dist/camunda-cloud-viewer.production.min.js +2 -2
  25. package/dist/camunda-platform-modeler.development.js +7571 -6674
  26. package/dist/camunda-platform-modeler.production.min.js +4 -4
  27. package/dist/camunda-platform-navigated-viewer.development.js +667 -261
  28. package/dist/camunda-platform-navigated-viewer.production.min.js +2 -2
  29. package/dist/camunda-platform-viewer.development.js +666 -260
  30. package/dist/camunda-platform-viewer.production.min.js +2 -2
  31. package/lib/base/Modeler.js +46 -46
  32. package/lib/base/NavigatedViewer.js +2 -2
  33. package/lib/base/Viewer.js +2 -2
  34. package/lib/camunda-cloud/Modeler.js +68 -68
  35. package/lib/camunda-cloud/NavigatedViewer.js +34 -34
  36. package/lib/camunda-cloud/Viewer.js +34 -34
  37. package/lib/camunda-cloud/features/context-pad/ContextPadOptions.js +15 -15
  38. package/lib/camunda-cloud/features/context-pad/index.js +6 -6
  39. package/lib/camunda-cloud/features/drilldown/index.js +3 -3
  40. package/lib/camunda-cloud/features/palette/PaletteOptions.js +14 -14
  41. package/lib/camunda-cloud/features/palette/PaletteProvider.js +31 -31
  42. package/lib/camunda-cloud/features/palette/index.js +6 -6
  43. package/lib/camunda-cloud/features/popup-menu/ReplaceMenuProvider.js +71 -71
  44. package/lib/camunda-cloud/features/popup-menu/ReplaceOptions.js +46 -46
  45. package/lib/camunda-cloud/features/popup-menu/index.js +6 -6
  46. package/lib/camunda-cloud/features/rules/BpmnRules.js +137 -137
  47. package/lib/camunda-cloud/features/rules/index.js +5 -5
  48. package/lib/camunda-cloud/util/commonModules.js +13 -13
  49. package/lib/camunda-platform/Modeler.js +46 -46
  50. package/lib/camunda-platform/NavigatedViewer.js +25 -25
  51. package/lib/camunda-platform/Viewer.js +24 -24
  52. package/lib/camunda-platform/util/commonModules.js +6 -6
  53. package/lib/util/ExtensionElementsUtil.js +59 -59
  54. package/package.json +110 -109
  55. package/styles/base-modeler.css +4 -4
  56. package/styles/base-navigated-viewer.css +1 -1
  57. package/styles/base-viewer.css +1 -1
  58. package/styles/camunda-cloud-modeler.css +1 -1
  59. package/styles/camunda-platform-modeler.css +1 -1
  60. package/util/index.js +39 -39
@@ -41,6 +41,8 @@
41
41
  }
42
42
  });
43
43
 
44
+ function e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}));}
45
+
44
46
  /**
45
47
  * Flatten array, one level deep.
46
48
  *
@@ -507,6 +509,21 @@
507
509
  return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
508
510
  }
509
511
 
512
+
513
+ /**
514
+ * Return true if element has any of the given types.
515
+ *
516
+ * @param {djs.model.Base} element
517
+ * @param {Array<string>} types
518
+ *
519
+ * @return {boolean}
520
+ */
521
+ function isAny(element, types) {
522
+ return some(types, function(t) {
523
+ return is(element, t);
524
+ });
525
+ }
526
+
510
527
  /**
511
528
  * Return the business object for a given element.
512
529
  *
@@ -1374,6 +1391,8 @@
1374
1391
  return gfx;
1375
1392
  }
1376
1393
 
1394
+ var black = 'hsl(225, 10%, 15%)';
1395
+
1377
1396
  // element utils //////////////////////
1378
1397
 
1379
1398
  /**
@@ -1424,7 +1443,7 @@
1424
1443
  function getStrokeColor(element, defaultColor) {
1425
1444
  var di = getDi(element);
1426
1445
 
1427
- return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || 'black';
1446
+ return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1428
1447
  }
1429
1448
 
1430
1449
  function getLabelColor(element, defaultColor, defaultStrokeColor) {
@@ -1514,6 +1533,101 @@
1514
1533
  return componentsToPath(rectPath);
1515
1534
  }
1516
1535
 
1536
+ /**
1537
+ * Flatten array, one level deep.
1538
+ *
1539
+ * @param {Array<?>} arr
1540
+ *
1541
+ * @return {Array<?>}
1542
+ */
1543
+
1544
+ var nativeToString$1 = Object.prototype.toString;
1545
+ var nativeHasOwnProperty$1 = Object.prototype.hasOwnProperty;
1546
+ function isUndefined$1(obj) {
1547
+ return obj === undefined;
1548
+ }
1549
+ function isArray$1(obj) {
1550
+ return nativeToString$1.call(obj) === '[object Array]';
1551
+ }
1552
+ /**
1553
+ * Return true, if target owns a property with the given key.
1554
+ *
1555
+ * @param {Object} target
1556
+ * @param {String} key
1557
+ *
1558
+ * @return {Boolean}
1559
+ */
1560
+
1561
+ function has$1(target, key) {
1562
+ return nativeHasOwnProperty$1.call(target, key);
1563
+ }
1564
+ /**
1565
+ * Iterate over collection; returning something
1566
+ * (non-undefined) will stop iteration.
1567
+ *
1568
+ * @param {Array|Object} collection
1569
+ * @param {Function} iterator
1570
+ *
1571
+ * @return {Object} return result that stopped the iteration
1572
+ */
1573
+
1574
+ function forEach$1(collection, iterator) {
1575
+ var val, result;
1576
+
1577
+ if (isUndefined$1(collection)) {
1578
+ return;
1579
+ }
1580
+
1581
+ var convertKey = isArray$1(collection) ? toNum$1 : identity$1;
1582
+
1583
+ for (var key in collection) {
1584
+ if (has$1(collection, key)) {
1585
+ val = collection[key];
1586
+ result = iterator(val, convertKey(key));
1587
+
1588
+ if (result === false) {
1589
+ return val;
1590
+ }
1591
+ }
1592
+ }
1593
+ }
1594
+
1595
+ function identity$1(arg) {
1596
+ return arg;
1597
+ }
1598
+
1599
+ function toNum$1(arg) {
1600
+ return Number(arg);
1601
+ }
1602
+
1603
+ /**
1604
+ * Assigns style attributes in a style-src compliant way.
1605
+ *
1606
+ * @param {Element} element
1607
+ * @param {...Object} styleSources
1608
+ *
1609
+ * @return {Element} the element
1610
+ */
1611
+ function assign$1(element) {
1612
+ var target = element.style;
1613
+
1614
+ for (var _len = arguments.length, styleSources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1615
+ styleSources[_key - 1] = arguments[_key];
1616
+ }
1617
+
1618
+ forEach$1(styleSources, function (style) {
1619
+ if (!style) {
1620
+ return;
1621
+ }
1622
+
1623
+ forEach$1(style, function (value, key) {
1624
+ target[key] = value;
1625
+ });
1626
+ });
1627
+
1628
+ return element;
1629
+ }
1630
+
1517
1631
  /**
1518
1632
  * Set attribute `name` to `val`, or get attr `name`.
1519
1633
  *
@@ -1863,7 +1977,7 @@
1863
1977
  // when delegating.
1864
1978
  var forceCaptureEvents = ['focus', 'blur'];
1865
1979
 
1866
- function bind$1$1(el, selector, type, fn, capture) {
1980
+ function bind$2(el, selector, type, fn, capture) {
1867
1981
  if (forceCaptureEvents.indexOf(type) !== -1) {
1868
1982
  capture = true;
1869
1983
  }
@@ -1895,7 +2009,7 @@
1895
2009
  }
1896
2010
 
1897
2011
  var delegate = {
1898
- bind: bind$1$1,
2012
+ bind: bind$2,
1899
2013
  unbind: unbind$1
1900
2014
  };
1901
2015
 
@@ -2263,7 +2377,7 @@
2263
2377
 
2264
2378
  function addMarker(id, options) {
2265
2379
  var attrs = assign({
2266
- fill: 'black',
2380
+ fill: black,
2267
2381
  strokeWidth: 1,
2268
2382
  strokeLinecap: 'round',
2269
2383
  strokeDasharray: 'none'
@@ -2442,7 +2556,7 @@
2442
2556
  offset = offset || 0;
2443
2557
 
2444
2558
  attrs = computeStyle(attrs, {
2445
- stroke: 'black',
2559
+ stroke: black,
2446
2560
  strokeWidth: 2,
2447
2561
  fill: 'white'
2448
2562
  });
@@ -2477,7 +2591,7 @@
2477
2591
  offset = offset || 0;
2478
2592
 
2479
2593
  attrs = computeStyle(attrs, {
2480
- stroke: 'black',
2594
+ stroke: black,
2481
2595
  strokeWidth: 2,
2482
2596
  fill: 'white'
2483
2597
  });
@@ -2510,7 +2624,7 @@
2510
2624
  }).join(' ');
2511
2625
 
2512
2626
  attrs = computeStyle(attrs, {
2513
- stroke: 'black',
2627
+ stroke: black,
2514
2628
  strokeWidth: 2,
2515
2629
  fill: 'white'
2516
2630
  });
@@ -2528,7 +2642,7 @@
2528
2642
 
2529
2643
  function drawLine(parentGfx, waypoints, attrs) {
2530
2644
  attrs = computeStyle(attrs, [ 'no-fill' ], {
2531
- stroke: 'black',
2645
+ stroke: black,
2532
2646
  strokeWidth: 2,
2533
2647
  fill: 'none'
2534
2648
  });
@@ -2544,7 +2658,7 @@
2544
2658
 
2545
2659
  attrs = computeStyle(attrs, [ 'no-fill' ], {
2546
2660
  strokeWidth: 2,
2547
- stroke: 'black'
2661
+ stroke: black
2548
2662
  });
2549
2663
 
2550
2664
  var path = create('path');
@@ -3649,7 +3763,7 @@
3649
3763
 
3650
3764
  if (di.messageVisibleKind === 'initiating') {
3651
3765
  messageAttrs.fill = 'white';
3652
- messageAttrs.stroke = 'black';
3766
+ messageAttrs.stroke = black;
3653
3767
  } else {
3654
3768
  messageAttrs.fill = '#888';
3655
3769
  messageAttrs.stroke = 'white';
@@ -3724,7 +3838,7 @@
3724
3838
 
3725
3839
  /* output arrow path */ drawPath(parentGfx, arrowPathData, {
3726
3840
  strokeWidth: 1,
3727
- fill: 'black'
3841
+ fill: black
3728
3842
  });
3729
3843
 
3730
3844
  return elementObject;
@@ -4054,7 +4168,7 @@
4054
4168
  }
4055
4169
 
4056
4170
 
4057
- inherits_browser(BpmnRenderer, BaseRenderer);
4171
+ e(BpmnRenderer, BaseRenderer);
4058
4172
 
4059
4173
  BpmnRenderer.$inject = [
4060
4174
  'config.bpmnRenderer',
@@ -4288,7 +4402,8 @@
4288
4402
  id: 'helper-svg',
4289
4403
  width: 0,
4290
4404
  height: 0,
4291
- style: 'visibility: hidden; position: fixed'
4405
+ visibility: 'hidden',
4406
+ position: 'fixed'
4292
4407
  });
4293
4408
 
4294
4409
  document.body.appendChild(helperSvg);
@@ -5279,13 +5394,98 @@
5279
5394
  *
5280
5395
  * @return {Point}
5281
5396
  */
5282
- function getMid(bounds) {
5397
+ function getBoundsMid(bounds) {
5283
5398
  return roundPoint({
5284
5399
  x: bounds.x + (bounds.width || 0) / 2,
5285
5400
  y: bounds.y + (bounds.height || 0) / 2
5286
5401
  });
5287
5402
  }
5288
5403
 
5404
+
5405
+ /**
5406
+ * Get the mid of the given Connection.
5407
+ *
5408
+ * @param {djs.Base.Connection} connection
5409
+ *
5410
+ * @return {Point}
5411
+ */
5412
+ function getConnectionMid(connection) {
5413
+ var waypoints = connection.waypoints;
5414
+
5415
+ // calculate total length and length of each segment
5416
+ var parts = waypoints.reduce(function(parts, point, index) {
5417
+
5418
+ var lastPoint = waypoints[index - 1];
5419
+
5420
+ if (lastPoint) {
5421
+ var lastPart = parts[parts.length - 1];
5422
+
5423
+ var startLength = lastPart && lastPart.endLength || 0;
5424
+ var length = distance(lastPoint, point);
5425
+
5426
+ parts.push({
5427
+ start: lastPoint,
5428
+ end: point,
5429
+ startLength: startLength,
5430
+ endLength: startLength + length,
5431
+ length: length
5432
+ });
5433
+ }
5434
+
5435
+ return parts;
5436
+ }, []);
5437
+
5438
+ var totalLength = parts.reduce(function(length, part) {
5439
+ return length + part.length;
5440
+ }, 0);
5441
+
5442
+ // find which segement contains middle point
5443
+ var midLength = totalLength / 2;
5444
+
5445
+ var i = 0;
5446
+ var midSegment = parts[i];
5447
+
5448
+ while (midSegment.endLength < midLength) {
5449
+ midSegment = parts[++i];
5450
+ }
5451
+
5452
+ // calculate relative position on mid segment
5453
+ var segmentProgress = (midLength - midSegment.startLength) / midSegment.length;
5454
+
5455
+ var midPoint = {
5456
+ x: midSegment.start.x + (midSegment.end.x - midSegment.start.x) * segmentProgress,
5457
+ y: midSegment.start.y + (midSegment.end.y - midSegment.start.y) * segmentProgress
5458
+ };
5459
+
5460
+ return midPoint;
5461
+ }
5462
+
5463
+
5464
+ /**
5465
+ * Get the mid of the given Element.
5466
+ *
5467
+ * @param {djs.Base.Connection} connection
5468
+ *
5469
+ * @return {Point}
5470
+ */
5471
+ function getMid(element) {
5472
+ if (isConnection(element)) {
5473
+ return getConnectionMid(element);
5474
+ }
5475
+
5476
+ return getBoundsMid(element);
5477
+ }
5478
+
5479
+ // helpers //////////////////////
5480
+
5481
+ function distance(a, b) {
5482
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
5483
+ }
5484
+
5485
+ function isConnection(element) {
5486
+ return !!element.waypoints;
5487
+ }
5488
+
5289
5489
  function elementToString(e) {
5290
5490
  if (!e) {
5291
5491
  return '<null>';
@@ -5911,10 +6111,13 @@
5911
6111
 
5912
6112
  var ALL_HIT_STYLE = createHitStyle('djs-hit djs-hit-all');
5913
6113
 
6114
+ var NO_MOVE_HIT_STYLE = createHitStyle('djs-hit djs-hit-no-move');
6115
+
5914
6116
  var HIT_TYPES = {
5915
6117
  'all': ALL_HIT_STYLE,
5916
6118
  'click-stroke': CLICK_STROKE_HIT_STYLE,
5917
- 'stroke': STROKE_HIT_STYLE
6119
+ 'stroke': STROKE_HIT_STYLE,
6120
+ 'no-move': NO_MOVE_HIT_STYLE
5918
6121
  };
5919
6122
 
5920
6123
  function createHitStyle(classNames, attrs) {
@@ -6167,7 +6370,9 @@
6167
6370
  * the array or the element primitive.
6168
6371
  *
6169
6372
  * @param {Array<djs.model.Shape>|djs.model.Shape} elements
6170
- * @param {boolean} stopRecursion
6373
+ * @param {boolean} [stopRecursion=false]
6374
+ *
6375
+ * @return {Bounds}
6171
6376
  */
6172
6377
  function getBBox(elements, stopRecursion) {
6173
6378
 
@@ -6263,6 +6468,7 @@
6263
6468
  attr(outline, assign({
6264
6469
  x: 10,
6265
6470
  y: 10,
6471
+ rx: 3,
6266
6472
  width: 100,
6267
6473
  height: 100
6268
6474
  }, OUTLINE_STYLE));
@@ -6454,6 +6660,8 @@
6454
6660
  var MARKER_HOVER = 'hover',
6455
6661
  MARKER_SELECTED = 'selected';
6456
6662
 
6663
+ var SELECTION_OUTLINE_PADDING = 6;
6664
+
6457
6665
 
6458
6666
  /**
6459
6667
  * A plugin that adds a visible selection UI to shapes and connections
@@ -6463,11 +6671,13 @@
6463
6671
  *
6464
6672
  * Makes elements selectable, too.
6465
6673
  *
6466
- * @param {EventBus} events
6467
- * @param {SelectionService} selection
6468
6674
  * @param {Canvas} canvas
6675
+ * @param {EventBus} eventBus
6469
6676
  */
6470
- function SelectionVisuals(events, canvas, selection, styles) {
6677
+ function SelectionVisuals(canvas, eventBus, selection) {
6678
+ this._canvas = canvas;
6679
+
6680
+ var self = this;
6471
6681
 
6472
6682
  this._multiSelectionBox = null;
6473
6683
 
@@ -6479,15 +6689,15 @@
6479
6689
  canvas.removeMarker(e, cls);
6480
6690
  }
6481
6691
 
6482
- events.on('element.hover', function(event) {
6692
+ eventBus.on('element.hover', function(event) {
6483
6693
  addMarker(event.element, MARKER_HOVER);
6484
6694
  });
6485
6695
 
6486
- events.on('element.out', function(event) {
6696
+ eventBus.on('element.out', function(event) {
6487
6697
  removeMarker(event.element, MARKER_HOVER);
6488
6698
  });
6489
6699
 
6490
- events.on('selection.changed', function(event) {
6700
+ eventBus.on('selection.changed', function(event) {
6491
6701
 
6492
6702
  function deselect(s) {
6493
6703
  removeMarker(s, MARKER_SELECTED);
@@ -6511,16 +6721,63 @@
6511
6721
  select(e);
6512
6722
  }
6513
6723
  });
6724
+
6725
+ self._updateSelectionOutline(newSelection);
6726
+ });
6727
+
6728
+
6729
+ eventBus.on('element.changed', function(event) {
6730
+ if (selection.isSelected(event.element)) {
6731
+ self._updateSelectionOutline(selection.get());
6732
+ }
6514
6733
  });
6515
6734
  }
6516
6735
 
6517
6736
  SelectionVisuals.$inject = [
6518
- 'eventBus',
6519
6737
  'canvas',
6520
- 'selection',
6521
- 'styles'
6738
+ 'eventBus',
6739
+ 'selection'
6522
6740
  ];
6523
6741
 
6742
+ SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
6743
+ var layer = this._canvas.getLayer('selectionOutline');
6744
+
6745
+ clear(layer);
6746
+
6747
+ var enabled = selection.length > 1;
6748
+
6749
+ var container = this._canvas.getContainer();
6750
+
6751
+ classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
6752
+
6753
+ if (!enabled) {
6754
+ return;
6755
+ }
6756
+
6757
+ var bBox = addSelectionOutlinePadding(getBBox(selection));
6758
+
6759
+ var rect = create('rect');
6760
+
6761
+ attr(rect, assign({
6762
+ rx: 3
6763
+ }, bBox));
6764
+
6765
+ classes(rect).add('djs-selection-outline');
6766
+
6767
+ append(layer, rect);
6768
+ };
6769
+
6770
+ // helpers //////////
6771
+
6772
+ function addSelectionOutlinePadding(bBox) {
6773
+ return {
6774
+ x: bBox.x - SELECTION_OUTLINE_PADDING,
6775
+ y: bBox.y - SELECTION_OUTLINE_PADDING,
6776
+ width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
6777
+ height: bBox.height + SELECTION_OUTLINE_PADDING * 2
6778
+ };
6779
+ }
6780
+
6524
6781
  function SelectionBehavior(eventBus, selection, canvas, elementRegistry) {
6525
6782
 
6526
6783
  // Select elements on create
@@ -6551,11 +6808,10 @@
6551
6808
  // Select connection targets on connect
6552
6809
  eventBus.on('connect.end', 500, function(event) {
6553
6810
  var context = event.context,
6554
- canExecute = context.canExecute,
6555
- hover = context.hover;
6811
+ connection = context.connection;
6556
6812
 
6557
- if (canExecute && hover) {
6558
- selection.select(hover);
6813
+ if (connection) {
6814
+ selection.select(connection);
6559
6815
  }
6560
6816
  });
6561
6817
 
@@ -7021,7 +7277,8 @@
7021
7277
 
7022
7278
 
7023
7279
  Overlays.prototype._createOverlayContainer = function(element) {
7024
- var html = domify('<div class="djs-overlays" style="position: absolute" />');
7280
+ var html = domify('<div class="djs-overlays" />');
7281
+ assign$1(html, { position: 'absolute' });
7025
7282
 
7026
7283
  this._overlayRoot.appendChild(html);
7027
7284
 
@@ -7092,7 +7349,8 @@
7092
7349
 
7093
7350
  overlayContainer = this._getOverlayContainer(element);
7094
7351
 
7095
- htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
7352
+ htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '">');
7353
+ assign$1(htmlContainer, { position: 'absolute' });
7096
7354
 
7097
7355
  htmlContainer.appendChild(html);
7098
7356
 
@@ -7277,18 +7535,30 @@
7277
7535
 
7278
7536
  function createRoot(parentNode) {
7279
7537
  var root = domify(
7280
- '<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'
7538
+ '<div class="djs-overlay-container" />'
7281
7539
  );
7282
7540
 
7541
+ assign$1(root, {
7542
+ position: 'absolute',
7543
+ width: 0,
7544
+ height: 0
7545
+ });
7546
+
7283
7547
  parentNode.insertBefore(root, parentNode.firstChild);
7284
7548
 
7285
7549
  return root;
7286
7550
  }
7287
7551
 
7288
7552
  function setPosition(el, x, y) {
7289
- assign(el.style, { left: x + 'px', top: y + 'px' });
7553
+ assign$1(el, { left: x + 'px', top: y + 'px' });
7290
7554
  }
7291
7555
 
7556
+ /**
7557
+ * Set element visible
7558
+ *
7559
+ * @param {DOMElement} el
7560
+ * @param {boolean} [visible=true]
7561
+ */
7292
7562
  function setVisible(el, visible) {
7293
7563
  el.style.display = visible === false ? 'none' : '';
7294
7564
  }
@@ -7386,7 +7656,7 @@
7386
7656
  *
7387
7657
  * @example
7388
7658
  *
7389
- * import inherits from 'inherits';
7659
+ * import inherits from 'inherits-browser';
7390
7660
  *
7391
7661
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7392
7662
  *
@@ -7542,7 +7812,7 @@
7542
7812
  });
7543
7813
  }
7544
7814
 
7545
- inherits_browser(RootElementsBehavior, CommandInterceptor);
7815
+ e(RootElementsBehavior, CommandInterceptor);
7546
7816
 
7547
7817
  RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
7548
7818
 
@@ -8002,7 +8272,7 @@
8002
8272
  collapsedElements.push(bo);
8003
8273
  }
8004
8274
 
8005
- if (is(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8275
+ if (shouldMoveToPlane(bo, plane)) {
8006
8276
 
8007
8277
  // don't change the array while we iterate over it
8008
8278
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8091,7 +8361,7 @@
8091
8361
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8092
8362
 
8093
8363
 
8094
- // helpers
8364
+ // helpers //////////////////////////
8095
8365
 
8096
8366
  function findRootDiagram(element) {
8097
8367
  if (is(element, 'bpmndi:BPMNDiagram')) {
@@ -8123,6 +8393,23 @@
8123
8393
  return asBounds(planeTrbl);
8124
8394
  }
8125
8395
 
8396
+ function shouldMoveToPlane(bo, plane) {
8397
+ var parent = bo.$parent;
8398
+
8399
+ // don't move elements that are already on the plane
8400
+ if (!is(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8401
+ return false;
8402
+ }
8403
+
8404
+ // dataAssociations are children of the subprocess but rendered on process level
8405
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8406
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8407
+ return false;
8408
+ }
8409
+
8410
+ return true;
8411
+ }
8412
+
8126
8413
  var LOW_PRIORITY$3 = 250;
8127
8414
  var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
8128
8415
 
@@ -8198,7 +8485,7 @@
8198
8485
  }, true);
8199
8486
 
8200
8487
 
8201
- eventBus.on('import.done', function() {
8488
+ eventBus.on('import.render.complete', function() {
8202
8489
  elementRegistry.filter(function(e) {
8203
8490
  return self.canDrillDown(e);
8204
8491
  }).map(function(el) {
@@ -8208,7 +8495,7 @@
8208
8495
 
8209
8496
  }
8210
8497
 
8211
- inherits_browser(DrilldownOverlayBehavior, CommandInterceptor);
8498
+ e(DrilldownOverlayBehavior, CommandInterceptor);
8212
8499
 
8213
8500
  DrilldownOverlayBehavior.prototype.updateDrilldownOverlay = function(shape) {
8214
8501
  var canvas = this._canvas;
@@ -8309,22 +8596,50 @@
8309
8596
 
8310
8597
  var CLASS_PATTERN = /^class /;
8311
8598
 
8599
+
8600
+ /**
8601
+ * @param {function} fn
8602
+ *
8603
+ * @return {boolean}
8604
+ */
8312
8605
  function isClass(fn) {
8313
8606
  return CLASS_PATTERN.test(fn.toString());
8314
8607
  }
8315
8608
 
8316
- function isArray$1(obj) {
8609
+ /**
8610
+ * @param {any} obj
8611
+ *
8612
+ * @return {boolean}
8613
+ */
8614
+ function isArray$2(obj) {
8317
8615
  return Object.prototype.toString.call(obj) === '[object Array]';
8318
8616
  }
8319
8617
 
8618
+ /**
8619
+ * @param {any} obj
8620
+ * @param {string} prop
8621
+ *
8622
+ * @return {boolean}
8623
+ */
8320
8624
  function hasOwnProp(obj, prop) {
8321
8625
  return Object.prototype.hasOwnProperty.call(obj, prop);
8322
8626
  }
8323
8627
 
8628
+ /**
8629
+ * @typedef {import('./index').InjectAnnotated } InjectAnnotated
8630
+ */
8631
+
8632
+ /**
8633
+ * @template T
8634
+ *
8635
+ * @params {[...string[], T] | ...string[], T} args
8636
+ *
8637
+ * @return {T & InjectAnnotated}
8638
+ */
8324
8639
  function annotate() {
8325
8640
  var args = Array.prototype.slice.call(arguments);
8326
8641
 
8327
- if (args.length === 1 && isArray$1(args[0])) {
8642
+ if (args.length === 1 && isArray$2(args[0])) {
8328
8643
  args = args[0];
8329
8644
  }
8330
8645
 
@@ -8350,9 +8665,14 @@
8350
8665
  // of a nested class, too.
8351
8666
 
8352
8667
  var CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
8353
- var FN_ARGS = /^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m;
8668
+ var FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
8354
8669
  var FN_ARG = /\/\*([^*]*)\*\//m;
8355
8670
 
8671
+ /**
8672
+ * @param {unknown} fn
8673
+ *
8674
+ * @return {string[]}
8675
+ */
8356
8676
  function parseAnnotations(fn) {
8357
8677
 
8358
8678
  if (typeof fn !== 'function') {
@@ -8366,36 +8686,26 @@
8366
8686
  return [];
8367
8687
  }
8368
8688
 
8369
- return match[1] && match[1].split(',').map(function(arg) {
8370
- match = arg.match(FN_ARG);
8371
- return match ? match[1].trim() : arg.trim();
8689
+ var args = match[1] || match[2];
8690
+
8691
+ return args && args.split(',').map(function(arg) {
8692
+ var argMatch = arg.match(FN_ARG);
8693
+ return (argMatch && argMatch[1] || arg).trim();
8372
8694
  }) || [];
8373
8695
  }
8374
8696
 
8375
- function Module() {
8376
- var providers = [];
8377
-
8378
- this.factory = function(name, factory) {
8379
- providers.push([name, 'factory', factory]);
8380
- return this;
8381
- };
8382
-
8383
- this.value = function(name, value) {
8384
- providers.push([name, 'value', value]);
8385
- return this;
8386
- };
8387
-
8388
- this.type = function(name, type) {
8389
- providers.push([name, 'type', type]);
8390
- return this;
8391
- };
8392
-
8393
- this.forEach = function(iterator) {
8394
- providers.forEach(iterator);
8395
- };
8396
-
8397
- }
8697
+ /**
8698
+ * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
8699
+ * @typedef { import('./index').ModuleDefinition } ModuleDefinition
8700
+ * @typedef { import('./index').InjectorContext } InjectorContext
8701
+ */
8398
8702
 
8703
+ /**
8704
+ * Create a new injector with the given modules.
8705
+ *
8706
+ * @param {ModuleDefinition[]} modules
8707
+ * @param {InjectorContext} [parent]
8708
+ */
8399
8709
  function Injector(modules, parent) {
8400
8710
  parent = parent || {
8401
8711
  get: function(name, strict) {
@@ -8424,12 +8734,12 @@
8424
8734
  /**
8425
8735
  * Return a named service.
8426
8736
  *
8427
- * @param {String} name
8428
- * @param {Boolean} [strict=true] if false, resolve missing services to null
8737
+ * @param {string} name
8738
+ * @param {boolean} [strict=true] if false, resolve missing services to null
8429
8739
  *
8430
- * @return {Object}
8740
+ * @return {any}
8431
8741
  */
8432
- var get = function(name, strict) {
8742
+ function get(name, strict) {
8433
8743
  if (!providers[name] && name.indexOf('.') !== -1) {
8434
8744
  var parts = name.split('.');
8435
8745
  var pivot = get(parts.shift());
@@ -8459,16 +8769,16 @@
8459
8769
  }
8460
8770
 
8461
8771
  return parent.get(name, strict);
8462
- };
8772
+ }
8463
8773
 
8464
- var fnDef = function(fn, locals) {
8774
+ function fnDef(fn, locals) {
8465
8775
 
8466
8776
  if (typeof locals === 'undefined') {
8467
8777
  locals = {};
8468
8778
  }
8469
8779
 
8470
8780
  if (typeof fn !== 'function') {
8471
- if (isArray$1(fn)) {
8781
+ if (isArray$2(fn)) {
8472
8782
  fn = annotate(fn.slice());
8473
8783
  } else {
8474
8784
  throw new Error('Cannot invoke "' + fn + '". Expected a function!');
@@ -8488,9 +8798,9 @@
8488
8798
  fn: fn,
8489
8799
  dependencies: dependencies
8490
8800
  };
8491
- };
8801
+ }
8492
8802
 
8493
- var instantiate = function(Type) {
8803
+ function instantiate(Type) {
8494
8804
  var def = fnDef(Type);
8495
8805
 
8496
8806
  var fn = def.fn,
@@ -8500,25 +8810,35 @@
8500
8810
  var Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
8501
8811
 
8502
8812
  return new Constructor();
8503
- };
8813
+ }
8504
8814
 
8505
- var invoke = function(func, context, locals) {
8815
+ function invoke(func, context, locals) {
8506
8816
  var def = fnDef(func, locals);
8507
8817
 
8508
8818
  var fn = def.fn,
8509
8819
  dependencies = def.dependencies;
8510
8820
 
8511
8821
  return fn.apply(context, dependencies);
8512
- };
8513
-
8822
+ }
8514
8823
 
8515
- var createPrivateInjectorFactory = function(privateChildInjector) {
8824
+ /**
8825
+ * @param {Injector} childInjector
8826
+ *
8827
+ * @return {Function}
8828
+ */
8829
+ function createPrivateInjectorFactory(childInjector) {
8516
8830
  return annotate(function(key) {
8517
- return privateChildInjector.get(key);
8831
+ return childInjector.get(key);
8518
8832
  });
8519
- };
8833
+ }
8520
8834
 
8521
- var createChild = function(modules, forceNewInstances) {
8835
+ /**
8836
+ * @param {ModuleDefinition[]} modules
8837
+ * @param {string[]} [forceNewInstances]
8838
+ *
8839
+ * @return {Injector}
8840
+ */
8841
+ function createChild(modules, forceNewInstances) {
8522
8842
  if (forceNewInstances && forceNewInstances.length) {
8523
8843
  var fromParentModule = Object.create(null);
8524
8844
  var matchedScopes = Object.create(null);
@@ -8543,12 +8863,12 @@
8543
8863
  privateInjectorsCache.push(provider[3]);
8544
8864
  privateChildInjectors.push(privateChildInjector);
8545
8865
  privateChildFactories.push(privateChildInjectorFactory);
8546
- fromParentModule[name] = [privateChildInjectorFactory, name, 'private', privateChildInjector];
8866
+ fromParentModule[name] = [ privateChildInjectorFactory, name, 'private', privateChildInjector ];
8547
8867
  } else {
8548
- fromParentModule[name] = [privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx]];
8868
+ fromParentModule[name] = [ privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx] ];
8549
8869
  }
8550
8870
  } else {
8551
- fromParentModule[name] = [provider[2], provider[1]];
8871
+ fromParentModule[name] = [ provider[2], provider[1] ];
8552
8872
  }
8553
8873
  matchedScopes[name] = true;
8554
8874
  }
@@ -8557,7 +8877,7 @@
8557
8877
  /* jshint -W083 */
8558
8878
  forceNewInstances.forEach(function(scope) {
8559
8879
  if (provider[1].$scope.indexOf(scope) !== -1) {
8560
- fromParentModule[name] = [provider[2], provider[1]];
8880
+ fromParentModule[name] = [ provider[2], provider[1] ];
8561
8881
  matchedScopes[scope] = true;
8562
8882
  }
8563
8883
  });
@@ -8574,7 +8894,7 @@
8574
8894
  }
8575
8895
 
8576
8896
  return new Injector(modules, self);
8577
- };
8897
+ }
8578
8898
 
8579
8899
  var factoryMap = {
8580
8900
  factory: invoke,
@@ -8584,62 +8904,169 @@
8584
8904
  }
8585
8905
  };
8586
8906
 
8587
- modules.forEach(function(module) {
8907
+ /**
8908
+ * @param {ModuleDefinition} moduleDefinition
8909
+ * @param {Injector} injector
8910
+ */
8911
+ function createInitializer(moduleDefinition, injector) {
8588
8912
 
8589
- function arrayUnwrap(type, value) {
8590
- if (type !== 'value' && isArray$1(value)) {
8591
- value = annotate(value.slice());
8592
- }
8913
+ var initializers = moduleDefinition.__init__ || [];
8593
8914
 
8594
- return value;
8595
- }
8915
+ return function() {
8916
+ initializers.forEach(function(initializer) {
8596
8917
 
8597
- // TODO(vojta): handle wrong inputs (modules)
8598
- if (module instanceof Module) {
8599
- module.forEach(function(provider) {
8600
- var name = provider[0];
8601
- var type = provider[1];
8602
- var value = provider[2];
8918
+ try {
8603
8919
 
8604
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8605
- });
8606
- } else if (typeof module === 'object') {
8607
- if (module.__exports__) {
8608
- var clonedModule = Object.keys(module).reduce(function(m, key) {
8609
- if (key.substring(0, 2) !== '__') {
8610
- m[key] = module[key];
8920
+ // eagerly resolve component (fn or string)
8921
+ if (typeof initializer === 'string') {
8922
+ injector.get(initializer);
8923
+ } else {
8924
+ injector.invoke(initializer);
8611
8925
  }
8612
- return m;
8613
- }, Object.create(null));
8614
-
8615
- var privateInjector = new Injector((module.__modules__ || []).concat([clonedModule]), self);
8616
- var getFromPrivateInjector = annotate(function(key) {
8617
- return privateInjector.get(key);
8618
- });
8619
- module.__exports__.forEach(function(key) {
8620
- providers[key] = [getFromPrivateInjector, key, 'private', privateInjector];
8621
- });
8622
- } else {
8623
- Object.keys(module).forEach(function(name) {
8624
- if (module[name][2] === 'private') {
8625
- providers[name] = module[name];
8626
- return;
8926
+ } catch (error) {
8927
+ if (typeof AggregateError !== 'undefined') {
8928
+ throw new AggregateError([ error ], 'Failed to initialize!');
8627
8929
  }
8628
8930
 
8629
- var type = module[name][0];
8630
- var value = module[name][1];
8931
+ throw new Error('Failed to initialize! ' + error.message);
8932
+ }
8933
+ });
8934
+ };
8935
+ }
8631
8936
 
8632
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8633
- });
8937
+ /**
8938
+ * @param {ModuleDefinition} moduleDefinition
8939
+ */
8940
+ function loadModule(moduleDefinition) {
8941
+
8942
+ var moduleExports = moduleDefinition.__exports__;
8943
+
8944
+ // private module
8945
+ if (moduleExports) {
8946
+ var nestedModules = moduleDefinition.__modules__;
8947
+
8948
+ var clonedModule = Object.keys(moduleDefinition).reduce(function(clonedModule, key) {
8949
+
8950
+ if (key !== '__exports__' && key !== '__modules__' && key !== '__init__' && key !== '__depends__') {
8951
+ clonedModule[key] = moduleDefinition[key];
8952
+ }
8953
+
8954
+ return clonedModule;
8955
+ }, Object.create(null));
8956
+
8957
+ var childModules = (nestedModules || []).concat(clonedModule);
8958
+
8959
+ var privateInjector = createChild(childModules);
8960
+ var getFromPrivateInjector = annotate(function(key) {
8961
+ return privateInjector.get(key);
8962
+ });
8963
+
8964
+ moduleExports.forEach(function(key) {
8965
+ providers[key] = [ getFromPrivateInjector, key, 'private', privateInjector ];
8966
+ });
8967
+
8968
+ // ensure child injector initializes
8969
+ var initializers = (moduleDefinition.__init__ || []).slice();
8970
+
8971
+ initializers.unshift(function() {
8972
+ privateInjector.init();
8973
+ });
8974
+
8975
+ moduleDefinition = Object.assign({}, moduleDefinition, {
8976
+ __init__: initializers
8977
+ });
8978
+
8979
+ return createInitializer(moduleDefinition, privateInjector);
8980
+ }
8981
+
8982
+ // normal module
8983
+ Object.keys(moduleDefinition).forEach(function(key) {
8984
+
8985
+ if (key === '__init__' || key === '__depends__') {
8986
+ return;
8987
+ }
8988
+
8989
+ if (moduleDefinition[key][2] === 'private') {
8990
+ providers[key] = moduleDefinition[key];
8991
+ return;
8634
8992
  }
8993
+
8994
+ var type = moduleDefinition[key][0];
8995
+ var value = moduleDefinition[key][1];
8996
+
8997
+ providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
8998
+ });
8999
+
9000
+ return createInitializer(moduleDefinition, self);
9001
+ }
9002
+
9003
+ /**
9004
+ * @param {ModuleDefinition[]} moduleDefinitions
9005
+ * @param {ModuleDefinition} moduleDefinition
9006
+ *
9007
+ * @return {ModuleDefinition[]}
9008
+ */
9009
+ function resolveDependencies(moduleDefinitions, moduleDefinition) {
9010
+
9011
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9012
+ return moduleDefinitions;
8635
9013
  }
8636
- });
9014
+
9015
+ moduleDefinitions = (moduleDefinition.__depends__ || []).reduce(resolveDependencies, moduleDefinitions);
9016
+
9017
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9018
+ return moduleDefinitions;
9019
+ }
9020
+
9021
+ return moduleDefinitions.concat(moduleDefinition);
9022
+ }
9023
+
9024
+ /**
9025
+ * @param {ModuleDefinition[]} moduleDefinitions
9026
+ *
9027
+ * @return { () => void } initializerFn
9028
+ */
9029
+ function bootstrap(moduleDefinitions) {
9030
+
9031
+ var initializers = moduleDefinitions
9032
+ .reduce(resolveDependencies, [])
9033
+ .map(loadModule);
9034
+
9035
+ var initialized = false;
9036
+
9037
+ return function() {
9038
+
9039
+ if (initialized) {
9040
+ return;
9041
+ }
9042
+
9043
+ initialized = true;
9044
+
9045
+ initializers.forEach(function(initializer) {
9046
+ return initializer();
9047
+ });
9048
+ };
9049
+ }
8637
9050
 
8638
9051
  // public API
8639
9052
  this.get = get;
8640
9053
  this.invoke = invoke;
8641
9054
  this.instantiate = instantiate;
8642
9055
  this.createChild = createChild;
9056
+
9057
+ // setup
9058
+ this.init = bootstrap(modules);
9059
+ }
9060
+
9061
+
9062
+ // helpers ///////////////
9063
+
9064
+ function arrayUnwrap(type, value) {
9065
+ if (type !== 'value' && isArray$2(value)) {
9066
+ value = annotate(value.slice());
9067
+ }
9068
+
9069
+ return value;
8643
9070
  }
8644
9071
 
8645
9072
  // apply default renderer with lowest possible priority
@@ -8662,7 +9089,7 @@
8662
9089
  this.FRAME_STYLE = styles.style([ 'no-fill' ], { stroke: 'fuchsia', strokeDasharray: 4, strokeWidth: 2 });
8663
9090
  }
8664
9091
 
8665
- inherits_browser(DefaultRenderer, BaseRenderer);
9092
+ e(DefaultRenderer, BaseRenderer);
8666
9093
 
8667
9094
 
8668
9095
  DefaultRenderer.prototype.canRender = function() {
@@ -8918,7 +9345,7 @@
8918
9345
  var parent = document.createElement('div');
8919
9346
  parent.setAttribute('class', 'djs-container');
8920
9347
 
8921
- assign(parent.style, {
9348
+ assign$1(parent, {
8922
9349
  position: 'relative',
8923
9350
  overflow: 'hidden',
8924
9351
  width: ensurePx(options.width),
@@ -10997,7 +11424,7 @@
10997
11424
  attacherRefs.bind(this, 'attachers');
10998
11425
  }
10999
11426
 
11000
- inherits_browser(Shape, Base);
11427
+ e(Shape, Base);
11001
11428
 
11002
11429
 
11003
11430
  /**
@@ -11012,7 +11439,7 @@
11012
11439
  Shape.call(this);
11013
11440
  }
11014
11441
 
11015
- inherits_browser(Root, Shape);
11442
+ e(Root, Shape);
11016
11443
 
11017
11444
 
11018
11445
  /**
@@ -11035,7 +11462,7 @@
11035
11462
  labelRefs.bind(this, 'labelTarget');
11036
11463
  }
11037
11464
 
11038
- inherits_browser(Label, Shape);
11465
+ e(Label, Shape);
11039
11466
 
11040
11467
 
11041
11468
  /**
@@ -11066,7 +11493,7 @@
11066
11493
  incomingRefs.bind(this, 'target');
11067
11494
  }
11068
11495
 
11069
- inherits_browser(Connection, Base);
11496
+ e(Connection, Base);
11070
11497
 
11071
11498
 
11072
11499
  var types = {
@@ -11917,62 +12344,21 @@
11917
12344
  graphicsFactory: [ 'type', GraphicsFactory ]
11918
12345
  };
11919
12346
 
12347
+ /**
12348
+ * @typedef { import('didi').ModuleDeclaration } Module
12349
+ */
12350
+
11920
12351
  /**
11921
12352
  * Bootstrap an injector from a list of modules, instantiating a number of default components
11922
12353
  *
11923
- * @ignore
11924
- * @param {Array<didi.Module>} bootstrapModules
12354
+ * @param {Array<Module>} modules
11925
12355
  *
11926
- * @return {didi.Injector} a injector to use to access the components
12356
+ * @return {Injector} a injector to use to access the components
11927
12357
  */
11928
- function bootstrap(bootstrapModules) {
11929
-
11930
- var modules = [],
11931
- components = [];
11932
-
11933
- function hasModule(m) {
11934
- return modules.indexOf(m) >= 0;
11935
- }
11936
-
11937
- function addModule(m) {
11938
- modules.push(m);
11939
- }
11940
-
11941
- function visit(m) {
11942
- if (hasModule(m)) {
11943
- return;
11944
- }
11945
-
11946
- (m.__depends__ || []).forEach(visit);
11947
-
11948
- if (hasModule(m)) {
11949
- return;
11950
- }
11951
-
11952
- addModule(m);
11953
-
11954
- (m.__init__ || []).forEach(function(c) {
11955
- components.push(c);
11956
- });
11957
- }
11958
-
11959
- bootstrapModules.forEach(visit);
11960
-
12358
+ function bootstrap(modules) {
11961
12359
  var injector = new Injector(modules);
11962
12360
 
11963
- components.forEach(function(c) {
11964
-
11965
- try {
11966
-
11967
- // eagerly resolve component (fn or string)
11968
- injector[typeof c === 'string' ? 'get' : 'invoke'](c);
11969
- } catch (e) {
11970
- console.error('Failed to instantiate component');
11971
- console.error(e.stack);
11972
-
11973
- throw e;
11974
- }
11975
- });
12361
+ injector.init();
11976
12362
 
11977
12363
  return injector;
11978
12364
  }
@@ -11980,9 +12366,8 @@
11980
12366
  /**
11981
12367
  * Creates an injector from passed options.
11982
12368
  *
11983
- * @ignore
11984
- * @param {Object} options
11985
- * @return {didi.Injector}
12369
+ * @param {Object} options
12370
+ * @return {Injector}
11986
12371
  */
11987
12372
  function createInjector(options) {
11988
12373
 
@@ -12002,7 +12387,7 @@
12002
12387
  * The main diagram-js entry point that bootstraps the diagram with the given
12003
12388
  * configuration.
12004
12389
  *
12005
- * To register extensions with the diagram, pass them as Array<didi.Module> to the constructor.
12390
+ * To register extensions with the diagram, pass them as Array<Module> to the constructor.
12006
12391
  *
12007
12392
  * @class djs.Diagram
12008
12393
  * @memberOf djs
@@ -12044,8 +12429,8 @@
12044
12429
  * // 'shape ... was added to the diagram' logged to console
12045
12430
  *
12046
12431
  * @param {Object} options
12047
- * @param {Array<didi.Module>} [options.modules] external modules to instantiate with the diagram
12048
- * @param {didi.Injector} [injector] an (optional) injector to bootstrap the diagram with
12432
+ * @param {Array<Module>} [options.modules] external modules to instantiate with the diagram
12433
+ * @param {Injector} [injector] an (optional) injector to bootstrap the diagram with
12049
12434
  */
12050
12435
  function Diagram(options, injector) {
12051
12436
 
@@ -12710,7 +13095,7 @@
12710
13095
 
12711
13096
  var propertyName = property && property.name;
12712
13097
 
12713
- if (isUndefined$1(value)) {
13098
+ if (isUndefined$2(value)) {
12714
13099
  // unset the property, if the specified value is undefined;
12715
13100
  // delete from $attrs (for extensions) or the target itself
12716
13101
  if (property) {
@@ -12801,7 +13186,7 @@
12801
13186
  };
12802
13187
 
12803
13188
 
12804
- function isUndefined$1(val) {
13189
+ function isUndefined$2(val) {
12805
13190
  return typeof val === 'undefined';
12806
13191
  }
12807
13192
 
@@ -20248,7 +20633,7 @@
20248
20633
  }
20249
20634
 
20250
20635
  /**
20251
- * Returns all diagrams in the same hirarchy as the requested diagram.
20636
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20252
20637
  * Includes all parent and sub process diagrams.
20253
20638
  *
20254
20639
  * @param {Array} definitions
@@ -20356,53 +20741,53 @@
20356
20741
 
20357
20742
 
20358
20743
  // inlined ../../resources/logo.svg
20359
- var BPMNIO_LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21" style="vertical-align:middle"><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>';
20744
+ 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>';
20360
20745
 
20361
20746
  var BPMNIO_IMG = BPMNIO_LOGO_SVG;
20362
20747
 
20363
- function css(attrs) {
20364
- return attrs.join(';');
20365
- }
20366
-
20367
- var LINK_STYLES = css([
20368
- 'color: #404040'
20369
- ]);
20370
-
20371
- var LIGHTBOX_STYLES = css([
20372
- 'z-index: 1001',
20373
- 'position: fixed',
20374
- 'top: 0',
20375
- 'left: 0',
20376
- 'right: 0',
20377
- 'bottom: 0'
20378
- ]);
20379
-
20380
- var BACKDROP_STYLES = css([
20381
- 'width: 100%',
20382
- 'height: 100%',
20383
- 'background: rgba(40,40,40,0.2)'
20384
- ]);
20385
-
20386
- var NOTICE_STYLES = css([
20387
- 'position: absolute',
20388
- 'left: 50%',
20389
- 'top: 40%',
20390
- 'transform: translate(-50%)',
20391
- 'width: 260px',
20392
- 'padding: 10px',
20393
- 'background: white',
20394
- 'box-shadow: 0 1px 4px rgba(0,0,0,0.3)',
20395
- 'font-family: Helvetica, Arial, sans-serif',
20396
- 'font-size: 14px',
20397
- 'display: flex',
20398
- 'line-height: 1.3'
20399
- ]);
20748
+ var LOGO_STYLES = {
20749
+ verticalAlign: 'middle'
20750
+ };
20751
+
20752
+ var LINK_STYLES = {
20753
+ 'color': '#404040'
20754
+ };
20755
+
20756
+ var LIGHTBOX_STYLES = {
20757
+ 'zIndex': '1001',
20758
+ 'position': 'fixed',
20759
+ 'top': '0',
20760
+ 'left': '0',
20761
+ 'right': '0',
20762
+ 'bottom': '0'
20763
+ };
20764
+
20765
+ var BACKDROP_STYLES = {
20766
+ 'width': '100%',
20767
+ 'height': '100%',
20768
+ 'background': 'rgba(40,40,40,0.2)'
20769
+ };
20770
+
20771
+ var NOTICE_STYLES = {
20772
+ 'position': 'absolute',
20773
+ 'left': '50%',
20774
+ 'top': '40%',
20775
+ 'transform': 'translate(-50%)',
20776
+ 'width': '260px',
20777
+ 'padding': '10px',
20778
+ 'background': 'white',
20779
+ 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',
20780
+ 'fontFamily': 'Helvetica, Arial, sans-serif',
20781
+ 'fontSize': '14px',
20782
+ 'display': 'flex',
20783
+ 'lineHeight': '1.3'
20784
+ };
20400
20785
 
20401
20786
  var LIGHTBOX_MARKUP =
20402
- '<div class="bjs-powered-by-lightbox" style="' + LIGHTBOX_STYLES + '">' +
20403
- '<div class="backdrop" style="' + BACKDROP_STYLES + '"></div>' +
20404
- '<div class="notice" style="' + NOTICE_STYLES + '">' +
20405
- '<a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;' + LINK_STYLES + '">' +
20787
+ '<div class="bjs-powered-by-lightbox">' +
20788
+ '<div class="backdrop"></div>' +
20789
+ '<div class="notice">' +
20790
+ '<a href="https://bpmn.io" target="_blank" rel="noopener" class="link">' +
20406
20791
  BPMNIO_IMG +
20407
20792
  '</a>' +
20408
20793
  '<span>' +
@@ -20415,10 +20800,23 @@
20415
20800
 
20416
20801
  var lightbox;
20417
20802
 
20803
+ function createLightbox() {
20804
+ lightbox = domify(LIGHTBOX_MARKUP);
20805
+
20806
+ assign$1(lightbox, LIGHTBOX_STYLES);
20807
+ assign$1(query('svg', lightbox), LOGO_STYLES);
20808
+ assign$1(query('.backdrop', lightbox), BACKDROP_STYLES);
20809
+ assign$1(query('.notice', lightbox), NOTICE_STYLES);
20810
+ assign$1(query('.link', lightbox), LINK_STYLES, {
20811
+ 'margin': '15px 20px 15px 10px',
20812
+ 'alignSelf': 'center'
20813
+ });
20814
+ }
20815
+
20418
20816
  function open() {
20419
20817
 
20420
20818
  if (!lightbox) {
20421
- lightbox = domify(LIGHTBOX_MARKUP);
20819
+ createLightbox();
20422
20820
 
20423
20821
  delegate.bind(lightbox, '.backdrop', 'click', function(event) {
20424
20822
  document.body.removeChild(lightbox);
@@ -20466,7 +20864,7 @@
20466
20864
  this._init(this._container, this._moddle, options);
20467
20865
  }
20468
20866
 
20469
- inherits_browser(BaseViewer, Diagram);
20867
+ e(BaseViewer, Diagram);
20470
20868
 
20471
20869
  /**
20472
20870
  * The importXML result.
@@ -21054,7 +21452,7 @@
21054
21452
 
21055
21453
  var container = domify('<div class="bjs-container"></div>');
21056
21454
 
21057
- assign(container.style, {
21455
+ assign$1(container, {
21058
21456
  width: ensureUnit(options.width),
21059
21457
  height: ensureUnit(options.height),
21060
21458
  position: options.position
@@ -21144,12 +21542,20 @@
21144
21542
  'target="_blank" ' +
21145
21543
  'class="bjs-powered-by" ' +
21146
21544
  'title="Powered by bpmn.io" ' +
21147
- 'style="position: absolute; bottom: 15px; right: 15px; z-index: 100; ' + LINK_STYLES + '">' +
21545
+ '>' +
21148
21546
  img +
21149
21547
  '</a>';
21150
21548
 
21151
21549
  var linkElement = domify(linkMarkup);
21152
21550
 
21551
+ assign$1(query('svg', linkElement), LOGO_STYLES);
21552
+ assign$1(linkElement, LINK_STYLES, {
21553
+ position: 'absolute',
21554
+ bottom: '15px',
21555
+ right: '15px',
21556
+ zIndex: '100'
21557
+ });
21558
+
21153
21559
  container.appendChild(linkElement);
21154
21560
 
21155
21561
  componentEvent.bind(linkElement, 'click', function(event) {
@@ -21212,7 +21618,7 @@
21212
21618
  BaseViewer.call(this, options);
21213
21619
  }
21214
21620
 
21215
- inherits_browser(Viewer, BaseViewer);
21621
+ e(Viewer, BaseViewer);
21216
21622
 
21217
21623
  // modules the viewer is composed of
21218
21624
  Viewer.prototype._modules = [
@@ -21226,93 +21632,6 @@
21226
21632
  // default moddle extensions the viewer is composed of
21227
21633
  Viewer.prototype._moddleExtensions = {};
21228
21634
 
21229
- var DEFAULT_RENDER_PRIORITY$2 = 1000;
21230
-
21231
- /**
21232
- * The base implementation of shape and connection renderers.
21233
- *
21234
- * @param {EventBus} eventBus
21235
- * @param {number} [renderPriority=1000]
21236
- */
21237
- function BaseRenderer$1(eventBus, renderPriority) {
21238
- var self = this;
21239
-
21240
- renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY$2;
21241
-
21242
- eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
21243
- var type = evt.type,
21244
- element = context.element,
21245
- visuals = context.gfx,
21246
- attrs = context.attrs;
21247
-
21248
- if (self.canRender(element)) {
21249
- if (type === 'render.shape') {
21250
- return self.drawShape(visuals, element, attrs);
21251
- } else {
21252
- return self.drawConnection(visuals, element, attrs);
21253
- }
21254
- }
21255
- });
21256
-
21257
- eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
21258
- if (self.canRender(element)) {
21259
- if (evt.type === 'render.getShapePath') {
21260
- return self.getShapePath(element);
21261
- } else {
21262
- return self.getConnectionPath(element);
21263
- }
21264
- }
21265
- });
21266
- }
21267
-
21268
- /**
21269
- * Should check whether *this* renderer can render
21270
- * the element/connection.
21271
- *
21272
- * @param {element} element
21273
- *
21274
- * @returns {boolean}
21275
- */
21276
- BaseRenderer$1.prototype.canRender = function() {};
21277
-
21278
- /**
21279
- * Provides the shape's snap svg element to be drawn on the `canvas`.
21280
- *
21281
- * @param {djs.Graphics} visuals
21282
- * @param {Shape} shape
21283
- *
21284
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
21285
- */
21286
- BaseRenderer$1.prototype.drawShape = function() {};
21287
-
21288
- /**
21289
- * Provides the shape's snap svg element to be drawn on the `canvas`.
21290
- *
21291
- * @param {djs.Graphics} visuals
21292
- * @param {Connection} connection
21293
- *
21294
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
21295
- */
21296
- BaseRenderer$1.prototype.drawConnection = function() {};
21297
-
21298
- /**
21299
- * Gets the SVG path of a shape that represents it's visual bounds.
21300
- *
21301
- * @param {Shape} shape
21302
- *
21303
- * @return {string} svg path
21304
- */
21305
- BaseRenderer$1.prototype.getShapePath = function() {};
21306
-
21307
- /**
21308
- * Gets the SVG path of a connection that represents it's visual bounds.
21309
- *
21310
- * @param {Connection} connection
21311
- *
21312
- * @return {string} svg path
21313
- */
21314
- BaseRenderer$1.prototype.getConnectionPath = function() {};
21315
-
21316
21635
  function ensureImported$1(element, target) {
21317
21636
 
21318
21637
  if (element.ownerDocument !== target.ownerDocument) {
@@ -21593,10 +21912,10 @@
21593
21912
  ) {
21594
21913
  this._bpmnRenderer = bpmnRenderer;
21595
21914
 
21596
- BaseRenderer$1.call(this, eventBus, HIGH_PRIORITY);
21915
+ BaseRenderer.call(this, eventBus, HIGH_PRIORITY);
21597
21916
  }
21598
21917
 
21599
- inherits_browser(IconsRenderer, BaseRenderer$1);
21918
+ inherits_browser(IconsRenderer, BaseRenderer);
21600
21919
 
21601
21920
  IconsRenderer.prototype.canRender = function(element) {
21602
21921
 
@@ -21621,8 +21940,10 @@
21621
21940
  var icon = create$2('image');
21622
21941
  attr$2(icon, {
21623
21942
  href: modelerTemplateIcon,
21624
- x: 4,
21625
- y: 4
21943
+ x: 5,
21944
+ y: 5,
21945
+ width: 18,
21946
+ height: 18
21626
21947
  });
21627
21948
 
21628
21949
  append$1(parentGfx, icon);
@@ -21640,8 +21961,8 @@
21640
21961
  elementTemplatesIconsRenderer: [ 'type', IconsRenderer ]
21641
21962
  };
21642
21963
 
21643
- var drilldownModule = {
21644
- drilldownOverlayBehavior: [ 'value', null ],
21964
+ var drilldownModule = {
21965
+ drilldownOverlayBehavior: [ 'value', null ],
21645
21966
  };
21646
21967
 
21647
21968
  var name$6 = "zeebe";
@@ -22008,41 +22329,41 @@
22008
22329
  types: types$6
22009
22330
  };
22010
22331
 
22011
- const commonModules = [
22012
- drilldownModule,
22013
- iconRendererModule
22014
- ];
22015
-
22016
- const commonModdleExtensions = {
22017
- zeebe: zeebeModdle
22332
+ const commonModules = [
22333
+ drilldownModule,
22334
+ iconRendererModule
22335
+ ];
22336
+
22337
+ const commonModdleExtensions = {
22338
+ zeebe: zeebeModdle
22018
22339
  };
22019
22340
 
22020
- /**
22021
- *
22022
- * @param {Object} options
22023
- */
22024
- function Viewer$1(options = {}) {
22025
-
22026
- options = {
22027
- ...options,
22028
- moddleExtensions: {
22029
- ...commonModdleExtensions,
22030
- ...options.moddleExtensions
22031
- }
22032
- };
22033
-
22034
- Viewer.call(this, options);
22035
- }
22036
-
22037
- inherits_browser(Viewer$1, Viewer);
22038
-
22039
- Viewer$1.prototype._camundaCloudModules = [
22040
- ...commonModules
22041
- ];
22042
-
22043
- Viewer$1.prototype._modules = [].concat(
22044
- Viewer.prototype._modules,
22045
- Viewer$1.prototype._camundaCloudModules
22341
+ /**
22342
+ *
22343
+ * @param {Object} options
22344
+ */
22345
+ function Viewer$1(options = {}) {
22346
+
22347
+ options = {
22348
+ ...options,
22349
+ moddleExtensions: {
22350
+ ...commonModdleExtensions,
22351
+ ...options.moddleExtensions
22352
+ }
22353
+ };
22354
+
22355
+ Viewer.call(this, options);
22356
+ }
22357
+
22358
+ inherits_browser(Viewer$1, Viewer);
22359
+
22360
+ Viewer$1.prototype._camundaCloudModules = [
22361
+ ...commonModules
22362
+ ];
22363
+
22364
+ Viewer$1.prototype._modules = [].concat(
22365
+ Viewer.prototype._modules,
22366
+ Viewer$1.prototype._camundaCloudModules
22046
22367
  );
22047
22368
 
22048
22369
  return Viewer$1;