camunda-bpmn-js 0.13.1 → 0.15.0

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 +276 -243
  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 +33 -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 +6965 -6128
  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 +9564 -8668
  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 +7141 -6455
  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 -103
  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>';
@@ -5928,10 +6128,13 @@
5928
6128
 
5929
6129
  var ALL_HIT_STYLE = createHitStyle('djs-hit djs-hit-all');
5930
6130
 
6131
+ var NO_MOVE_HIT_STYLE = createHitStyle('djs-hit djs-hit-no-move');
6132
+
5931
6133
  var HIT_TYPES = {
5932
6134
  'all': ALL_HIT_STYLE,
5933
6135
  'click-stroke': CLICK_STROKE_HIT_STYLE,
5934
- 'stroke': STROKE_HIT_STYLE
6136
+ 'stroke': STROKE_HIT_STYLE,
6137
+ 'no-move': NO_MOVE_HIT_STYLE
5935
6138
  };
5936
6139
 
5937
6140
  function createHitStyle(classNames, attrs) {
@@ -6184,7 +6387,9 @@
6184
6387
  * the array or the element primitive.
6185
6388
  *
6186
6389
  * @param {Array<djs.model.Shape>|djs.model.Shape} elements
6187
- * @param {boolean} stopRecursion
6390
+ * @param {boolean} [stopRecursion=false]
6391
+ *
6392
+ * @return {Bounds}
6188
6393
  */
6189
6394
  function getBBox(elements, stopRecursion) {
6190
6395
 
@@ -6280,6 +6485,7 @@
6280
6485
  attr(outline, assign({
6281
6486
  x: 10,
6282
6487
  y: 10,
6488
+ rx: 3,
6283
6489
  width: 100,
6284
6490
  height: 100
6285
6491
  }, OUTLINE_STYLE));
@@ -6471,6 +6677,8 @@
6471
6677
  var MARKER_HOVER = 'hover',
6472
6678
  MARKER_SELECTED = 'selected';
6473
6679
 
6680
+ var SELECTION_OUTLINE_PADDING = 6;
6681
+
6474
6682
 
6475
6683
  /**
6476
6684
  * A plugin that adds a visible selection UI to shapes and connections
@@ -6480,11 +6688,13 @@
6480
6688
  *
6481
6689
  * Makes elements selectable, too.
6482
6690
  *
6483
- * @param {EventBus} events
6484
- * @param {SelectionService} selection
6485
6691
  * @param {Canvas} canvas
6692
+ * @param {EventBus} eventBus
6486
6693
  */
6487
- function SelectionVisuals(events, canvas, selection, styles) {
6694
+ function SelectionVisuals(canvas, eventBus, selection) {
6695
+ this._canvas = canvas;
6696
+
6697
+ var self = this;
6488
6698
 
6489
6699
  this._multiSelectionBox = null;
6490
6700
 
@@ -6496,15 +6706,15 @@
6496
6706
  canvas.removeMarker(e, cls);
6497
6707
  }
6498
6708
 
6499
- events.on('element.hover', function(event) {
6709
+ eventBus.on('element.hover', function(event) {
6500
6710
  addMarker(event.element, MARKER_HOVER);
6501
6711
  });
6502
6712
 
6503
- events.on('element.out', function(event) {
6713
+ eventBus.on('element.out', function(event) {
6504
6714
  removeMarker(event.element, MARKER_HOVER);
6505
6715
  });
6506
6716
 
6507
- events.on('selection.changed', function(event) {
6717
+ eventBus.on('selection.changed', function(event) {
6508
6718
 
6509
6719
  function deselect(s) {
6510
6720
  removeMarker(s, MARKER_SELECTED);
@@ -6528,16 +6738,63 @@
6528
6738
  select(e);
6529
6739
  }
6530
6740
  });
6741
+
6742
+ self._updateSelectionOutline(newSelection);
6743
+ });
6744
+
6745
+
6746
+ eventBus.on('element.changed', function(event) {
6747
+ if (selection.isSelected(event.element)) {
6748
+ self._updateSelectionOutline(selection.get());
6749
+ }
6531
6750
  });
6532
6751
  }
6533
6752
 
6534
6753
  SelectionVisuals.$inject = [
6535
- 'eventBus',
6536
6754
  'canvas',
6537
- 'selection',
6538
- 'styles'
6755
+ 'eventBus',
6756
+ 'selection'
6539
6757
  ];
6540
6758
 
6759
+ SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
6760
+ var layer = this._canvas.getLayer('selectionOutline');
6761
+
6762
+ clear(layer);
6763
+
6764
+ var enabled = selection.length > 1;
6765
+
6766
+ var container = this._canvas.getContainer();
6767
+
6768
+ classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
6769
+
6770
+ if (!enabled) {
6771
+ return;
6772
+ }
6773
+
6774
+ var bBox = addSelectionOutlinePadding(getBBox(selection));
6775
+
6776
+ var rect = create('rect');
6777
+
6778
+ attr(rect, assign({
6779
+ rx: 3
6780
+ }, bBox));
6781
+
6782
+ classes(rect).add('djs-selection-outline');
6783
+
6784
+ append(layer, rect);
6785
+ };
6786
+
6787
+ // helpers //////////
6788
+
6789
+ function addSelectionOutlinePadding(bBox) {
6790
+ return {
6791
+ x: bBox.x - SELECTION_OUTLINE_PADDING,
6792
+ y: bBox.y - SELECTION_OUTLINE_PADDING,
6793
+ width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
6794
+ height: bBox.height + SELECTION_OUTLINE_PADDING * 2
6795
+ };
6796
+ }
6797
+
6541
6798
  function SelectionBehavior(eventBus, selection, canvas, elementRegistry) {
6542
6799
 
6543
6800
  // Select elements on create
@@ -6568,11 +6825,10 @@
6568
6825
  // Select connection targets on connect
6569
6826
  eventBus.on('connect.end', 500, function(event) {
6570
6827
  var context = event.context,
6571
- canExecute = context.canExecute,
6572
- hover = context.hover;
6828
+ connection = context.connection;
6573
6829
 
6574
- if (canExecute && hover) {
6575
- selection.select(hover);
6830
+ if (connection) {
6831
+ selection.select(connection);
6576
6832
  }
6577
6833
  });
6578
6834
 
@@ -7038,7 +7294,8 @@
7038
7294
 
7039
7295
 
7040
7296
  Overlays.prototype._createOverlayContainer = function(element) {
7041
- var html = domify('<div class="djs-overlays" style="position: absolute" />');
7297
+ var html = domify('<div class="djs-overlays" />');
7298
+ assign$1(html, { position: 'absolute' });
7042
7299
 
7043
7300
  this._overlayRoot.appendChild(html);
7044
7301
 
@@ -7109,7 +7366,8 @@
7109
7366
 
7110
7367
  overlayContainer = this._getOverlayContainer(element);
7111
7368
 
7112
- htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
7369
+ htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '">');
7370
+ assign$1(htmlContainer, { position: 'absolute' });
7113
7371
 
7114
7372
  htmlContainer.appendChild(html);
7115
7373
 
@@ -7294,18 +7552,30 @@
7294
7552
 
7295
7553
  function createRoot(parentNode) {
7296
7554
  var root = domify(
7297
- '<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'
7555
+ '<div class="djs-overlay-container" />'
7298
7556
  );
7299
7557
 
7558
+ assign$1(root, {
7559
+ position: 'absolute',
7560
+ width: 0,
7561
+ height: 0
7562
+ });
7563
+
7300
7564
  parentNode.insertBefore(root, parentNode.firstChild);
7301
7565
 
7302
7566
  return root;
7303
7567
  }
7304
7568
 
7305
7569
  function setPosition(el, x, y) {
7306
- assign(el.style, { left: x + 'px', top: y + 'px' });
7570
+ assign$1(el, { left: x + 'px', top: y + 'px' });
7307
7571
  }
7308
7572
 
7573
+ /**
7574
+ * Set element visible
7575
+ *
7576
+ * @param {DOMElement} el
7577
+ * @param {boolean} [visible=true]
7578
+ */
7309
7579
  function setVisible(el, visible) {
7310
7580
  el.style.display = visible === false ? 'none' : '';
7311
7581
  }
@@ -7403,7 +7673,7 @@
7403
7673
  *
7404
7674
  * @example
7405
7675
  *
7406
- * import inherits from 'inherits';
7676
+ * import inherits from 'inherits-browser';
7407
7677
  *
7408
7678
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7409
7679
  *
@@ -7559,7 +7829,7 @@
7559
7829
  });
7560
7830
  }
7561
7831
 
7562
- inherits_browser(RootElementsBehavior, CommandInterceptor);
7832
+ e(RootElementsBehavior, CommandInterceptor);
7563
7833
 
7564
7834
  RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
7565
7835
 
@@ -8019,7 +8289,7 @@
8019
8289
  collapsedElements.push(bo);
8020
8290
  }
8021
8291
 
8022
- if (is(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8292
+ if (shouldMoveToPlane(bo, plane)) {
8023
8293
 
8024
8294
  // don't change the array while we iterate over it
8025
8295
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8108,7 +8378,7 @@
8108
8378
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8109
8379
 
8110
8380
 
8111
- // helpers
8381
+ // helpers //////////////////////////
8112
8382
 
8113
8383
  function findRootDiagram(element) {
8114
8384
  if (is(element, 'bpmndi:BPMNDiagram')) {
@@ -8140,6 +8410,23 @@
8140
8410
  return asBounds(planeTrbl);
8141
8411
  }
8142
8412
 
8413
+ function shouldMoveToPlane(bo, plane) {
8414
+ var parent = bo.$parent;
8415
+
8416
+ // don't move elements that are already on the plane
8417
+ if (!is(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8418
+ return false;
8419
+ }
8420
+
8421
+ // dataAssociations are children of the subprocess but rendered on process level
8422
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8423
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8424
+ return false;
8425
+ }
8426
+
8427
+ return true;
8428
+ }
8429
+
8143
8430
  var LOW_PRIORITY$3 = 250;
8144
8431
  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>';
8145
8432
 
@@ -8215,7 +8502,7 @@
8215
8502
  }, true);
8216
8503
 
8217
8504
 
8218
- eventBus.on('import.done', function() {
8505
+ eventBus.on('import.render.complete', function() {
8219
8506
  elementRegistry.filter(function(e) {
8220
8507
  return self.canDrillDown(e);
8221
8508
  }).map(function(el) {
@@ -8225,7 +8512,7 @@
8225
8512
 
8226
8513
  }
8227
8514
 
8228
- inherits_browser(DrilldownOverlayBehavior, CommandInterceptor);
8515
+ e(DrilldownOverlayBehavior, CommandInterceptor);
8229
8516
 
8230
8517
  DrilldownOverlayBehavior.prototype.updateDrilldownOverlay = function(shape) {
8231
8518
  var canvas = this._canvas;
@@ -8326,22 +8613,50 @@
8326
8613
 
8327
8614
  var CLASS_PATTERN = /^class /;
8328
8615
 
8616
+
8617
+ /**
8618
+ * @param {function} fn
8619
+ *
8620
+ * @return {boolean}
8621
+ */
8329
8622
  function isClass(fn) {
8330
8623
  return CLASS_PATTERN.test(fn.toString());
8331
8624
  }
8332
8625
 
8333
- function isArray$1(obj) {
8626
+ /**
8627
+ * @param {any} obj
8628
+ *
8629
+ * @return {boolean}
8630
+ */
8631
+ function isArray$2(obj) {
8334
8632
  return Object.prototype.toString.call(obj) === '[object Array]';
8335
8633
  }
8336
8634
 
8635
+ /**
8636
+ * @param {any} obj
8637
+ * @param {string} prop
8638
+ *
8639
+ * @return {boolean}
8640
+ */
8337
8641
  function hasOwnProp(obj, prop) {
8338
8642
  return Object.prototype.hasOwnProperty.call(obj, prop);
8339
8643
  }
8340
8644
 
8645
+ /**
8646
+ * @typedef {import('./index').InjectAnnotated } InjectAnnotated
8647
+ */
8648
+
8649
+ /**
8650
+ * @template T
8651
+ *
8652
+ * @params {[...string[], T] | ...string[], T} args
8653
+ *
8654
+ * @return {T & InjectAnnotated}
8655
+ */
8341
8656
  function annotate() {
8342
8657
  var args = Array.prototype.slice.call(arguments);
8343
8658
 
8344
- if (args.length === 1 && isArray$1(args[0])) {
8659
+ if (args.length === 1 && isArray$2(args[0])) {
8345
8660
  args = args[0];
8346
8661
  }
8347
8662
 
@@ -8367,9 +8682,14 @@
8367
8682
  // of a nested class, too.
8368
8683
 
8369
8684
  var CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
8370
- var FN_ARGS = /^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m;
8685
+ var FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
8371
8686
  var FN_ARG = /\/\*([^*]*)\*\//m;
8372
8687
 
8688
+ /**
8689
+ * @param {unknown} fn
8690
+ *
8691
+ * @return {string[]}
8692
+ */
8373
8693
  function parseAnnotations(fn) {
8374
8694
 
8375
8695
  if (typeof fn !== 'function') {
@@ -8383,36 +8703,26 @@
8383
8703
  return [];
8384
8704
  }
8385
8705
 
8386
- return match[1] && match[1].split(',').map(function(arg) {
8387
- match = arg.match(FN_ARG);
8388
- return match ? match[1].trim() : arg.trim();
8706
+ var args = match[1] || match[2];
8707
+
8708
+ return args && args.split(',').map(function(arg) {
8709
+ var argMatch = arg.match(FN_ARG);
8710
+ return (argMatch && argMatch[1] || arg).trim();
8389
8711
  }) || [];
8390
8712
  }
8391
8713
 
8392
- function Module() {
8393
- var providers = [];
8394
-
8395
- this.factory = function(name, factory) {
8396
- providers.push([name, 'factory', factory]);
8397
- return this;
8398
- };
8399
-
8400
- this.value = function(name, value) {
8401
- providers.push([name, 'value', value]);
8402
- return this;
8403
- };
8404
-
8405
- this.type = function(name, type) {
8406
- providers.push([name, 'type', type]);
8407
- return this;
8408
- };
8409
-
8410
- this.forEach = function(iterator) {
8411
- providers.forEach(iterator);
8412
- };
8413
-
8414
- }
8714
+ /**
8715
+ * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
8716
+ * @typedef { import('./index').ModuleDefinition } ModuleDefinition
8717
+ * @typedef { import('./index').InjectorContext } InjectorContext
8718
+ */
8415
8719
 
8720
+ /**
8721
+ * Create a new injector with the given modules.
8722
+ *
8723
+ * @param {ModuleDefinition[]} modules
8724
+ * @param {InjectorContext} [parent]
8725
+ */
8416
8726
  function Injector(modules, parent) {
8417
8727
  parent = parent || {
8418
8728
  get: function(name, strict) {
@@ -8441,12 +8751,12 @@
8441
8751
  /**
8442
8752
  * Return a named service.
8443
8753
  *
8444
- * @param {String} name
8445
- * @param {Boolean} [strict=true] if false, resolve missing services to null
8754
+ * @param {string} name
8755
+ * @param {boolean} [strict=true] if false, resolve missing services to null
8446
8756
  *
8447
- * @return {Object}
8757
+ * @return {any}
8448
8758
  */
8449
- var get = function(name, strict) {
8759
+ function get(name, strict) {
8450
8760
  if (!providers[name] && name.indexOf('.') !== -1) {
8451
8761
  var parts = name.split('.');
8452
8762
  var pivot = get(parts.shift());
@@ -8476,16 +8786,16 @@
8476
8786
  }
8477
8787
 
8478
8788
  return parent.get(name, strict);
8479
- };
8789
+ }
8480
8790
 
8481
- var fnDef = function(fn, locals) {
8791
+ function fnDef(fn, locals) {
8482
8792
 
8483
8793
  if (typeof locals === 'undefined') {
8484
8794
  locals = {};
8485
8795
  }
8486
8796
 
8487
8797
  if (typeof fn !== 'function') {
8488
- if (isArray$1(fn)) {
8798
+ if (isArray$2(fn)) {
8489
8799
  fn = annotate(fn.slice());
8490
8800
  } else {
8491
8801
  throw new Error('Cannot invoke "' + fn + '". Expected a function!');
@@ -8505,9 +8815,9 @@
8505
8815
  fn: fn,
8506
8816
  dependencies: dependencies
8507
8817
  };
8508
- };
8818
+ }
8509
8819
 
8510
- var instantiate = function(Type) {
8820
+ function instantiate(Type) {
8511
8821
  var def = fnDef(Type);
8512
8822
 
8513
8823
  var fn = def.fn,
@@ -8517,25 +8827,35 @@
8517
8827
  var Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
8518
8828
 
8519
8829
  return new Constructor();
8520
- };
8830
+ }
8521
8831
 
8522
- var invoke = function(func, context, locals) {
8832
+ function invoke(func, context, locals) {
8523
8833
  var def = fnDef(func, locals);
8524
8834
 
8525
8835
  var fn = def.fn,
8526
8836
  dependencies = def.dependencies;
8527
8837
 
8528
8838
  return fn.apply(context, dependencies);
8529
- };
8530
-
8839
+ }
8531
8840
 
8532
- var createPrivateInjectorFactory = function(privateChildInjector) {
8841
+ /**
8842
+ * @param {Injector} childInjector
8843
+ *
8844
+ * @return {Function}
8845
+ */
8846
+ function createPrivateInjectorFactory(childInjector) {
8533
8847
  return annotate(function(key) {
8534
- return privateChildInjector.get(key);
8848
+ return childInjector.get(key);
8535
8849
  });
8536
- };
8850
+ }
8537
8851
 
8538
- var createChild = function(modules, forceNewInstances) {
8852
+ /**
8853
+ * @param {ModuleDefinition[]} modules
8854
+ * @param {string[]} [forceNewInstances]
8855
+ *
8856
+ * @return {Injector}
8857
+ */
8858
+ function createChild(modules, forceNewInstances) {
8539
8859
  if (forceNewInstances && forceNewInstances.length) {
8540
8860
  var fromParentModule = Object.create(null);
8541
8861
  var matchedScopes = Object.create(null);
@@ -8560,12 +8880,12 @@
8560
8880
  privateInjectorsCache.push(provider[3]);
8561
8881
  privateChildInjectors.push(privateChildInjector);
8562
8882
  privateChildFactories.push(privateChildInjectorFactory);
8563
- fromParentModule[name] = [privateChildInjectorFactory, name, 'private', privateChildInjector];
8883
+ fromParentModule[name] = [ privateChildInjectorFactory, name, 'private', privateChildInjector ];
8564
8884
  } else {
8565
- fromParentModule[name] = [privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx]];
8885
+ fromParentModule[name] = [ privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx] ];
8566
8886
  }
8567
8887
  } else {
8568
- fromParentModule[name] = [provider[2], provider[1]];
8888
+ fromParentModule[name] = [ provider[2], provider[1] ];
8569
8889
  }
8570
8890
  matchedScopes[name] = true;
8571
8891
  }
@@ -8574,7 +8894,7 @@
8574
8894
  /* jshint -W083 */
8575
8895
  forceNewInstances.forEach(function(scope) {
8576
8896
  if (provider[1].$scope.indexOf(scope) !== -1) {
8577
- fromParentModule[name] = [provider[2], provider[1]];
8897
+ fromParentModule[name] = [ provider[2], provider[1] ];
8578
8898
  matchedScopes[scope] = true;
8579
8899
  }
8580
8900
  });
@@ -8591,7 +8911,7 @@
8591
8911
  }
8592
8912
 
8593
8913
  return new Injector(modules, self);
8594
- };
8914
+ }
8595
8915
 
8596
8916
  var factoryMap = {
8597
8917
  factory: invoke,
@@ -8601,62 +8921,169 @@
8601
8921
  }
8602
8922
  };
8603
8923
 
8604
- modules.forEach(function(module) {
8924
+ /**
8925
+ * @param {ModuleDefinition} moduleDefinition
8926
+ * @param {Injector} injector
8927
+ */
8928
+ function createInitializer(moduleDefinition, injector) {
8605
8929
 
8606
- function arrayUnwrap(type, value) {
8607
- if (type !== 'value' && isArray$1(value)) {
8608
- value = annotate(value.slice());
8609
- }
8930
+ var initializers = moduleDefinition.__init__ || [];
8610
8931
 
8611
- return value;
8612
- }
8932
+ return function() {
8933
+ initializers.forEach(function(initializer) {
8613
8934
 
8614
- // TODO(vojta): handle wrong inputs (modules)
8615
- if (module instanceof Module) {
8616
- module.forEach(function(provider) {
8617
- var name = provider[0];
8618
- var type = provider[1];
8619
- var value = provider[2];
8935
+ try {
8620
8936
 
8621
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8622
- });
8623
- } else if (typeof module === 'object') {
8624
- if (module.__exports__) {
8625
- var clonedModule = Object.keys(module).reduce(function(m, key) {
8626
- if (key.substring(0, 2) !== '__') {
8627
- m[key] = module[key];
8937
+ // eagerly resolve component (fn or string)
8938
+ if (typeof initializer === 'string') {
8939
+ injector.get(initializer);
8940
+ } else {
8941
+ injector.invoke(initializer);
8628
8942
  }
8629
- return m;
8630
- }, Object.create(null));
8631
-
8632
- var privateInjector = new Injector((module.__modules__ || []).concat([clonedModule]), self);
8633
- var getFromPrivateInjector = annotate(function(key) {
8634
- return privateInjector.get(key);
8635
- });
8636
- module.__exports__.forEach(function(key) {
8637
- providers[key] = [getFromPrivateInjector, key, 'private', privateInjector];
8638
- });
8639
- } else {
8640
- Object.keys(module).forEach(function(name) {
8641
- if (module[name][2] === 'private') {
8642
- providers[name] = module[name];
8643
- return;
8943
+ } catch (error) {
8944
+ if (typeof AggregateError !== 'undefined') {
8945
+ throw new AggregateError([ error ], 'Failed to initialize!');
8644
8946
  }
8645
8947
 
8646
- var type = module[name][0];
8647
- var value = module[name][1];
8948
+ throw new Error('Failed to initialize! ' + error.message);
8949
+ }
8950
+ });
8951
+ };
8952
+ }
8648
8953
 
8649
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8650
- });
8954
+ /**
8955
+ * @param {ModuleDefinition} moduleDefinition
8956
+ */
8957
+ function loadModule(moduleDefinition) {
8958
+
8959
+ var moduleExports = moduleDefinition.__exports__;
8960
+
8961
+ // private module
8962
+ if (moduleExports) {
8963
+ var nestedModules = moduleDefinition.__modules__;
8964
+
8965
+ var clonedModule = Object.keys(moduleDefinition).reduce(function(clonedModule, key) {
8966
+
8967
+ if (key !== '__exports__' && key !== '__modules__' && key !== '__init__' && key !== '__depends__') {
8968
+ clonedModule[key] = moduleDefinition[key];
8969
+ }
8970
+
8971
+ return clonedModule;
8972
+ }, Object.create(null));
8973
+
8974
+ var childModules = (nestedModules || []).concat(clonedModule);
8975
+
8976
+ var privateInjector = createChild(childModules);
8977
+ var getFromPrivateInjector = annotate(function(key) {
8978
+ return privateInjector.get(key);
8979
+ });
8980
+
8981
+ moduleExports.forEach(function(key) {
8982
+ providers[key] = [ getFromPrivateInjector, key, 'private', privateInjector ];
8983
+ });
8984
+
8985
+ // ensure child injector initializes
8986
+ var initializers = (moduleDefinition.__init__ || []).slice();
8987
+
8988
+ initializers.unshift(function() {
8989
+ privateInjector.init();
8990
+ });
8991
+
8992
+ moduleDefinition = Object.assign({}, moduleDefinition, {
8993
+ __init__: initializers
8994
+ });
8995
+
8996
+ return createInitializer(moduleDefinition, privateInjector);
8997
+ }
8998
+
8999
+ // normal module
9000
+ Object.keys(moduleDefinition).forEach(function(key) {
9001
+
9002
+ if (key === '__init__' || key === '__depends__') {
9003
+ return;
9004
+ }
9005
+
9006
+ if (moduleDefinition[key][2] === 'private') {
9007
+ providers[key] = moduleDefinition[key];
9008
+ return;
8651
9009
  }
9010
+
9011
+ var type = moduleDefinition[key][0];
9012
+ var value = moduleDefinition[key][1];
9013
+
9014
+ providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
9015
+ });
9016
+
9017
+ return createInitializer(moduleDefinition, self);
9018
+ }
9019
+
9020
+ /**
9021
+ * @param {ModuleDefinition[]} moduleDefinitions
9022
+ * @param {ModuleDefinition} moduleDefinition
9023
+ *
9024
+ * @return {ModuleDefinition[]}
9025
+ */
9026
+ function resolveDependencies(moduleDefinitions, moduleDefinition) {
9027
+
9028
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9029
+ return moduleDefinitions;
8652
9030
  }
8653
- });
9031
+
9032
+ moduleDefinitions = (moduleDefinition.__depends__ || []).reduce(resolveDependencies, moduleDefinitions);
9033
+
9034
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9035
+ return moduleDefinitions;
9036
+ }
9037
+
9038
+ return moduleDefinitions.concat(moduleDefinition);
9039
+ }
9040
+
9041
+ /**
9042
+ * @param {ModuleDefinition[]} moduleDefinitions
9043
+ *
9044
+ * @return { () => void } initializerFn
9045
+ */
9046
+ function bootstrap(moduleDefinitions) {
9047
+
9048
+ var initializers = moduleDefinitions
9049
+ .reduce(resolveDependencies, [])
9050
+ .map(loadModule);
9051
+
9052
+ var initialized = false;
9053
+
9054
+ return function() {
9055
+
9056
+ if (initialized) {
9057
+ return;
9058
+ }
9059
+
9060
+ initialized = true;
9061
+
9062
+ initializers.forEach(function(initializer) {
9063
+ return initializer();
9064
+ });
9065
+ };
9066
+ }
8654
9067
 
8655
9068
  // public API
8656
9069
  this.get = get;
8657
9070
  this.invoke = invoke;
8658
9071
  this.instantiate = instantiate;
8659
9072
  this.createChild = createChild;
9073
+
9074
+ // setup
9075
+ this.init = bootstrap(modules);
9076
+ }
9077
+
9078
+
9079
+ // helpers ///////////////
9080
+
9081
+ function arrayUnwrap(type, value) {
9082
+ if (type !== 'value' && isArray$2(value)) {
9083
+ value = annotate(value.slice());
9084
+ }
9085
+
9086
+ return value;
8660
9087
  }
8661
9088
 
8662
9089
  // apply default renderer with lowest possible priority
@@ -8679,7 +9106,7 @@
8679
9106
  this.FRAME_STYLE = styles.style([ 'no-fill' ], { stroke: 'fuchsia', strokeDasharray: 4, strokeWidth: 2 });
8680
9107
  }
8681
9108
 
8682
- inherits_browser(DefaultRenderer, BaseRenderer);
9109
+ e(DefaultRenderer, BaseRenderer);
8683
9110
 
8684
9111
 
8685
9112
  DefaultRenderer.prototype.canRender = function() {
@@ -8935,7 +9362,7 @@
8935
9362
  var parent = document.createElement('div');
8936
9363
  parent.setAttribute('class', 'djs-container');
8937
9364
 
8938
- assign(parent.style, {
9365
+ assign$1(parent, {
8939
9366
  position: 'relative',
8940
9367
  overflow: 'hidden',
8941
9368
  width: ensurePx(options.width),
@@ -11014,7 +11441,7 @@
11014
11441
  attacherRefs.bind(this, 'attachers');
11015
11442
  }
11016
11443
 
11017
- inherits_browser(Shape, Base);
11444
+ e(Shape, Base);
11018
11445
 
11019
11446
 
11020
11447
  /**
@@ -11029,7 +11456,7 @@
11029
11456
  Shape.call(this);
11030
11457
  }
11031
11458
 
11032
- inherits_browser(Root, Shape);
11459
+ e(Root, Shape);
11033
11460
 
11034
11461
 
11035
11462
  /**
@@ -11052,7 +11479,7 @@
11052
11479
  labelRefs.bind(this, 'labelTarget');
11053
11480
  }
11054
11481
 
11055
- inherits_browser(Label, Shape);
11482
+ e(Label, Shape);
11056
11483
 
11057
11484
 
11058
11485
  /**
@@ -11083,7 +11510,7 @@
11083
11510
  incomingRefs.bind(this, 'target');
11084
11511
  }
11085
11512
 
11086
- inherits_browser(Connection, Base);
11513
+ e(Connection, Base);
11087
11514
 
11088
11515
 
11089
11516
  var types = {
@@ -11934,62 +12361,21 @@
11934
12361
  graphicsFactory: [ 'type', GraphicsFactory ]
11935
12362
  };
11936
12363
 
12364
+ /**
12365
+ * @typedef { import('didi').ModuleDeclaration } Module
12366
+ */
12367
+
11937
12368
  /**
11938
12369
  * Bootstrap an injector from a list of modules, instantiating a number of default components
11939
12370
  *
11940
- * @ignore
11941
- * @param {Array<didi.Module>} bootstrapModules
12371
+ * @param {Array<Module>} modules
11942
12372
  *
11943
- * @return {didi.Injector} a injector to use to access the components
12373
+ * @return {Injector} a injector to use to access the components
11944
12374
  */
11945
- function bootstrap(bootstrapModules) {
11946
-
11947
- var modules = [],
11948
- components = [];
11949
-
11950
- function hasModule(m) {
11951
- return modules.indexOf(m) >= 0;
11952
- }
11953
-
11954
- function addModule(m) {
11955
- modules.push(m);
11956
- }
11957
-
11958
- function visit(m) {
11959
- if (hasModule(m)) {
11960
- return;
11961
- }
11962
-
11963
- (m.__depends__ || []).forEach(visit);
11964
-
11965
- if (hasModule(m)) {
11966
- return;
11967
- }
11968
-
11969
- addModule(m);
11970
-
11971
- (m.__init__ || []).forEach(function(c) {
11972
- components.push(c);
11973
- });
11974
- }
11975
-
11976
- bootstrapModules.forEach(visit);
11977
-
12375
+ function bootstrap(modules) {
11978
12376
  var injector = new Injector(modules);
11979
12377
 
11980
- components.forEach(function(c) {
11981
-
11982
- try {
11983
-
11984
- // eagerly resolve component (fn or string)
11985
- injector[typeof c === 'string' ? 'get' : 'invoke'](c);
11986
- } catch (e) {
11987
- console.error('Failed to instantiate component');
11988
- console.error(e.stack);
11989
-
11990
- throw e;
11991
- }
11992
- });
12378
+ injector.init();
11993
12379
 
11994
12380
  return injector;
11995
12381
  }
@@ -11997,9 +12383,8 @@
11997
12383
  /**
11998
12384
  * Creates an injector from passed options.
11999
12385
  *
12000
- * @ignore
12001
- * @param {Object} options
12002
- * @return {didi.Injector}
12386
+ * @param {Object} options
12387
+ * @return {Injector}
12003
12388
  */
12004
12389
  function createInjector(options) {
12005
12390
 
@@ -12019,7 +12404,7 @@
12019
12404
  * The main diagram-js entry point that bootstraps the diagram with the given
12020
12405
  * configuration.
12021
12406
  *
12022
- * To register extensions with the diagram, pass them as Array<didi.Module> to the constructor.
12407
+ * To register extensions with the diagram, pass them as Array<Module> to the constructor.
12023
12408
  *
12024
12409
  * @class djs.Diagram
12025
12410
  * @memberOf djs
@@ -12061,8 +12446,8 @@
12061
12446
  * // 'shape ... was added to the diagram' logged to console
12062
12447
  *
12063
12448
  * @param {Object} options
12064
- * @param {Array<didi.Module>} [options.modules] external modules to instantiate with the diagram
12065
- * @param {didi.Injector} [injector] an (optional) injector to bootstrap the diagram with
12449
+ * @param {Array<Module>} [options.modules] external modules to instantiate with the diagram
12450
+ * @param {Injector} [injector] an (optional) injector to bootstrap the diagram with
12066
12451
  */
12067
12452
  function Diagram(options, injector) {
12068
12453
 
@@ -12727,7 +13112,7 @@
12727
13112
 
12728
13113
  var propertyName = property && property.name;
12729
13114
 
12730
- if (isUndefined$1(value)) {
13115
+ if (isUndefined$2(value)) {
12731
13116
  // unset the property, if the specified value is undefined;
12732
13117
  // delete from $attrs (for extensions) or the target itself
12733
13118
  if (property) {
@@ -12818,7 +13203,7 @@
12818
13203
  };
12819
13204
 
12820
13205
 
12821
- function isUndefined$1(val) {
13206
+ function isUndefined$2(val) {
12822
13207
  return typeof val === 'undefined';
12823
13208
  }
12824
13209
 
@@ -20265,7 +20650,7 @@
20265
20650
  }
20266
20651
 
20267
20652
  /**
20268
- * Returns all diagrams in the same hirarchy as the requested diagram.
20653
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20269
20654
  * Includes all parent and sub process diagrams.
20270
20655
  *
20271
20656
  * @param {Array} definitions
@@ -20373,53 +20758,53 @@
20373
20758
 
20374
20759
 
20375
20760
  // inlined ../../resources/logo.svg
20376
- 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>';
20761
+ 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>';
20377
20762
 
20378
20763
  var BPMNIO_IMG = BPMNIO_LOGO_SVG;
20379
20764
 
20380
- function css(attrs) {
20381
- return attrs.join(';');
20382
- }
20383
-
20384
- var LINK_STYLES = css([
20385
- 'color: #404040'
20386
- ]);
20387
-
20388
- var LIGHTBOX_STYLES = css([
20389
- 'z-index: 1001',
20390
- 'position: fixed',
20391
- 'top: 0',
20392
- 'left: 0',
20393
- 'right: 0',
20394
- 'bottom: 0'
20395
- ]);
20396
-
20397
- var BACKDROP_STYLES = css([
20398
- 'width: 100%',
20399
- 'height: 100%',
20400
- 'background: rgba(40,40,40,0.2)'
20401
- ]);
20402
-
20403
- var NOTICE_STYLES = css([
20404
- 'position: absolute',
20405
- 'left: 50%',
20406
- 'top: 40%',
20407
- 'transform: translate(-50%)',
20408
- 'width: 260px',
20409
- 'padding: 10px',
20410
- 'background: white',
20411
- 'box-shadow: 0 1px 4px rgba(0,0,0,0.3)',
20412
- 'font-family: Helvetica, Arial, sans-serif',
20413
- 'font-size: 14px',
20414
- 'display: flex',
20415
- 'line-height: 1.3'
20416
- ]);
20765
+ var LOGO_STYLES = {
20766
+ verticalAlign: 'middle'
20767
+ };
20768
+
20769
+ var LINK_STYLES = {
20770
+ 'color': '#404040'
20771
+ };
20772
+
20773
+ var LIGHTBOX_STYLES = {
20774
+ 'zIndex': '1001',
20775
+ 'position': 'fixed',
20776
+ 'top': '0',
20777
+ 'left': '0',
20778
+ 'right': '0',
20779
+ 'bottom': '0'
20780
+ };
20781
+
20782
+ var BACKDROP_STYLES = {
20783
+ 'width': '100%',
20784
+ 'height': '100%',
20785
+ 'background': 'rgba(40,40,40,0.2)'
20786
+ };
20787
+
20788
+ var NOTICE_STYLES = {
20789
+ 'position': 'absolute',
20790
+ 'left': '50%',
20791
+ 'top': '40%',
20792
+ 'transform': 'translate(-50%)',
20793
+ 'width': '260px',
20794
+ 'padding': '10px',
20795
+ 'background': 'white',
20796
+ 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',
20797
+ 'fontFamily': 'Helvetica, Arial, sans-serif',
20798
+ 'fontSize': '14px',
20799
+ 'display': 'flex',
20800
+ 'lineHeight': '1.3'
20801
+ };
20417
20802
 
20418
20803
  var LIGHTBOX_MARKUP =
20419
- '<div class="bjs-powered-by-lightbox" style="' + LIGHTBOX_STYLES + '">' +
20420
- '<div class="backdrop" style="' + BACKDROP_STYLES + '"></div>' +
20421
- '<div class="notice" style="' + NOTICE_STYLES + '">' +
20422
- '<a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;' + LINK_STYLES + '">' +
20804
+ '<div class="bjs-powered-by-lightbox">' +
20805
+ '<div class="backdrop"></div>' +
20806
+ '<div class="notice">' +
20807
+ '<a href="https://bpmn.io" target="_blank" rel="noopener" class="link">' +
20423
20808
  BPMNIO_IMG +
20424
20809
  '</a>' +
20425
20810
  '<span>' +
@@ -20432,10 +20817,23 @@
20432
20817
 
20433
20818
  var lightbox;
20434
20819
 
20820
+ function createLightbox() {
20821
+ lightbox = domify(LIGHTBOX_MARKUP);
20822
+
20823
+ assign$1(lightbox, LIGHTBOX_STYLES);
20824
+ assign$1(query('svg', lightbox), LOGO_STYLES);
20825
+ assign$1(query('.backdrop', lightbox), BACKDROP_STYLES);
20826
+ assign$1(query('.notice', lightbox), NOTICE_STYLES);
20827
+ assign$1(query('.link', lightbox), LINK_STYLES, {
20828
+ 'margin': '15px 20px 15px 10px',
20829
+ 'alignSelf': 'center'
20830
+ });
20831
+ }
20832
+
20435
20833
  function open() {
20436
20834
 
20437
20835
  if (!lightbox) {
20438
- lightbox = domify(LIGHTBOX_MARKUP);
20836
+ createLightbox();
20439
20837
 
20440
20838
  delegate.bind(lightbox, '.backdrop', 'click', function(event) {
20441
20839
  document.body.removeChild(lightbox);
@@ -20483,7 +20881,7 @@
20483
20881
  this._init(this._container, this._moddle, options);
20484
20882
  }
20485
20883
 
20486
- inherits_browser(BaseViewer, Diagram);
20884
+ e(BaseViewer, Diagram);
20487
20885
 
20488
20886
  /**
20489
20887
  * The importXML result.
@@ -21071,7 +21469,7 @@
21071
21469
 
21072
21470
  var container = domify('<div class="bjs-container"></div>');
21073
21471
 
21074
- assign(container.style, {
21472
+ assign$1(container, {
21075
21473
  width: ensureUnit(options.width),
21076
21474
  height: ensureUnit(options.height),
21077
21475
  position: options.position
@@ -21161,12 +21559,20 @@
21161
21559
  'target="_blank" ' +
21162
21560
  'class="bjs-powered-by" ' +
21163
21561
  'title="Powered by bpmn.io" ' +
21164
- 'style="position: absolute; bottom: 15px; right: 15px; z-index: 100; ' + LINK_STYLES + '">' +
21562
+ '>' +
21165
21563
  img +
21166
21564
  '</a>';
21167
21565
 
21168
21566
  var linkElement = domify(linkMarkup);
21169
21567
 
21568
+ assign$1(query('svg', linkElement), LOGO_STYLES);
21569
+ assign$1(linkElement, LINK_STYLES, {
21570
+ position: 'absolute',
21571
+ bottom: '15px',
21572
+ right: '15px',
21573
+ zIndex: '100'
21574
+ });
21575
+
21170
21576
  container.appendChild(linkElement);
21171
21577
 
21172
21578
  componentEvent.bind(linkElement, 'click', function(event) {
@@ -21229,7 +21635,7 @@
21229
21635
  BaseViewer.call(this, options);
21230
21636
  }
21231
21637
 
21232
- inherits_browser(Viewer, BaseViewer);
21638
+ e(Viewer, BaseViewer);
21233
21639
 
21234
21640
  // modules the viewer is composed of
21235
21641
  Viewer.prototype._modules = [
@@ -22203,7 +22609,7 @@
22203
22609
  Viewer.call(this, options);
22204
22610
  }
22205
22611
 
22206
- inherits_browser(NavigatedViewer, Viewer);
22612
+ e(NavigatedViewer, Viewer);
22207
22613
 
22208
22614
 
22209
22615
  NavigatedViewer.prototype._navigationModules = [
@@ -22217,93 +22623,6 @@
22217
22623
  NavigatedViewer.prototype._navigationModules
22218
22624
  );
22219
22625
 
22220
- var DEFAULT_RENDER_PRIORITY$2 = 1000;
22221
-
22222
- /**
22223
- * The base implementation of shape and connection renderers.
22224
- *
22225
- * @param {EventBus} eventBus
22226
- * @param {number} [renderPriority=1000]
22227
- */
22228
- function BaseRenderer$1(eventBus, renderPriority) {
22229
- var self = this;
22230
-
22231
- renderPriority = renderPriority || DEFAULT_RENDER_PRIORITY$2;
22232
-
22233
- eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
22234
- var type = evt.type,
22235
- element = context.element,
22236
- visuals = context.gfx,
22237
- attrs = context.attrs;
22238
-
22239
- if (self.canRender(element)) {
22240
- if (type === 'render.shape') {
22241
- return self.drawShape(visuals, element, attrs);
22242
- } else {
22243
- return self.drawConnection(visuals, element, attrs);
22244
- }
22245
- }
22246
- });
22247
-
22248
- eventBus.on([ 'render.getShapePath', 'render.getConnectionPath' ], renderPriority, function(evt, element) {
22249
- if (self.canRender(element)) {
22250
- if (evt.type === 'render.getShapePath') {
22251
- return self.getShapePath(element);
22252
- } else {
22253
- return self.getConnectionPath(element);
22254
- }
22255
- }
22256
- });
22257
- }
22258
-
22259
- /**
22260
- * Should check whether *this* renderer can render
22261
- * the element/connection.
22262
- *
22263
- * @param {element} element
22264
- *
22265
- * @returns {boolean}
22266
- */
22267
- BaseRenderer$1.prototype.canRender = function() {};
22268
-
22269
- /**
22270
- * Provides the shape's snap svg element to be drawn on the `canvas`.
22271
- *
22272
- * @param {djs.Graphics} visuals
22273
- * @param {Shape} shape
22274
- *
22275
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
22276
- */
22277
- BaseRenderer$1.prototype.drawShape = function() {};
22278
-
22279
- /**
22280
- * Provides the shape's snap svg element to be drawn on the `canvas`.
22281
- *
22282
- * @param {djs.Graphics} visuals
22283
- * @param {Connection} connection
22284
- *
22285
- * @returns {Snap.svg} [returns a Snap.svg paper element ]
22286
- */
22287
- BaseRenderer$1.prototype.drawConnection = function() {};
22288
-
22289
- /**
22290
- * Gets the SVG path of a shape that represents it's visual bounds.
22291
- *
22292
- * @param {Shape} shape
22293
- *
22294
- * @return {string} svg path
22295
- */
22296
- BaseRenderer$1.prototype.getShapePath = function() {};
22297
-
22298
- /**
22299
- * Gets the SVG path of a connection that represents it's visual bounds.
22300
- *
22301
- * @param {Connection} connection
22302
- *
22303
- * @return {string} svg path
22304
- */
22305
- BaseRenderer$1.prototype.getConnectionPath = function() {};
22306
-
22307
22626
  function ensureImported$1(element, target) {
22308
22627
 
22309
22628
  if (element.ownerDocument !== target.ownerDocument) {
@@ -22584,10 +22903,10 @@
22584
22903
  ) {
22585
22904
  this._bpmnRenderer = bpmnRenderer;
22586
22905
 
22587
- BaseRenderer$1.call(this, eventBus, HIGH_PRIORITY);
22906
+ BaseRenderer.call(this, eventBus, HIGH_PRIORITY);
22588
22907
  }
22589
22908
 
22590
- inherits_browser(IconsRenderer, BaseRenderer$1);
22909
+ inherits_browser(IconsRenderer, BaseRenderer);
22591
22910
 
22592
22911
  IconsRenderer.prototype.canRender = function(element) {
22593
22912
 
@@ -22612,8 +22931,10 @@
22612
22931
  var icon = create$2('image');
22613
22932
  attr$2(icon, {
22614
22933
  href: modelerTemplateIcon,
22615
- x: 4,
22616
- y: 4
22934
+ x: 5,
22935
+ y: 5,
22936
+ width: 18,
22937
+ height: 18
22617
22938
  });
22618
22939
 
22619
22940
  append$1(parentGfx, icon);
@@ -22631,8 +22952,8 @@
22631
22952
  elementTemplatesIconsRenderer: [ 'type', IconsRenderer ]
22632
22953
  };
22633
22954
 
22634
- var drilldownModule = {
22635
- drilldownOverlayBehavior: [ 'value', null ],
22955
+ var drilldownModule = {
22956
+ drilldownOverlayBehavior: [ 'value', null ],
22636
22957
  };
22637
22958
 
22638
22959
  var name$6 = "zeebe";
@@ -22999,41 +23320,41 @@
22999
23320
  types: types$6
23000
23321
  };
23001
23322
 
23002
- const commonModules = [
23003
- drilldownModule,
23004
- iconRendererModule
23005
- ];
23006
-
23007
- const commonModdleExtensions = {
23008
- zeebe: zeebeModdle
23323
+ const commonModules = [
23324
+ drilldownModule,
23325
+ iconRendererModule
23326
+ ];
23327
+
23328
+ const commonModdleExtensions = {
23329
+ zeebe: zeebeModdle
23009
23330
  };
23010
23331
 
23011
- /**
23012
- *
23013
- * @param {Object} options
23014
- */
23015
- function NavigatedViewer$1(options = {}) {
23016
-
23017
- options = {
23018
- ...options,
23019
- moddleExtensions: {
23020
- ...commonModdleExtensions,
23021
- ...options.moddleExtensions
23022
- }
23023
- };
23024
-
23025
- NavigatedViewer.call(this, options);
23026
- }
23027
-
23028
- inherits_browser(NavigatedViewer$1, NavigatedViewer);
23029
-
23030
- NavigatedViewer$1.prototype._camundaCloudModules = [
23031
- ...commonModules
23032
- ];
23033
-
23034
- NavigatedViewer$1.prototype._modules = [].concat(
23035
- NavigatedViewer.prototype._modules,
23036
- NavigatedViewer$1.prototype._camundaCloudModules
23332
+ /**
23333
+ *
23334
+ * @param {Object} options
23335
+ */
23336
+ function NavigatedViewer$1(options = {}) {
23337
+
23338
+ options = {
23339
+ ...options,
23340
+ moddleExtensions: {
23341
+ ...commonModdleExtensions,
23342
+ ...options.moddleExtensions
23343
+ }
23344
+ };
23345
+
23346
+ NavigatedViewer.call(this, options);
23347
+ }
23348
+
23349
+ inherits_browser(NavigatedViewer$1, NavigatedViewer);
23350
+
23351
+ NavigatedViewer$1.prototype._camundaCloudModules = [
23352
+ ...commonModules
23353
+ ];
23354
+
23355
+ NavigatedViewer$1.prototype._modules = [].concat(
23356
+ NavigatedViewer.prototype._modules,
23357
+ NavigatedViewer$1.prototype._camundaCloudModules
23037
23358
  );
23038
23359
 
23039
23360
  return NavigatedViewer$1;