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);
@@ -5275,13 +5390,98 @@
5275
5390
  *
5276
5391
  * @return {Point}
5277
5392
  */
5278
- function getMid(bounds) {
5393
+ function getBoundsMid(bounds) {
5279
5394
  return roundPoint({
5280
5395
  x: bounds.x + (bounds.width || 0) / 2,
5281
5396
  y: bounds.y + (bounds.height || 0) / 2
5282
5397
  });
5283
5398
  }
5284
5399
 
5400
+
5401
+ /**
5402
+ * Get the mid of the given Connection.
5403
+ *
5404
+ * @param {djs.Base.Connection} connection
5405
+ *
5406
+ * @return {Point}
5407
+ */
5408
+ function getConnectionMid(connection) {
5409
+ var waypoints = connection.waypoints;
5410
+
5411
+ // calculate total length and length of each segment
5412
+ var parts = waypoints.reduce(function(parts, point, index) {
5413
+
5414
+ var lastPoint = waypoints[index - 1];
5415
+
5416
+ if (lastPoint) {
5417
+ var lastPart = parts[parts.length - 1];
5418
+
5419
+ var startLength = lastPart && lastPart.endLength || 0;
5420
+ var length = distance(lastPoint, point);
5421
+
5422
+ parts.push({
5423
+ start: lastPoint,
5424
+ end: point,
5425
+ startLength: startLength,
5426
+ endLength: startLength + length,
5427
+ length: length
5428
+ });
5429
+ }
5430
+
5431
+ return parts;
5432
+ }, []);
5433
+
5434
+ var totalLength = parts.reduce(function(length, part) {
5435
+ return length + part.length;
5436
+ }, 0);
5437
+
5438
+ // find which segement contains middle point
5439
+ var midLength = totalLength / 2;
5440
+
5441
+ var i = 0;
5442
+ var midSegment = parts[i];
5443
+
5444
+ while (midSegment.endLength < midLength) {
5445
+ midSegment = parts[++i];
5446
+ }
5447
+
5448
+ // calculate relative position on mid segment
5449
+ var segmentProgress = (midLength - midSegment.startLength) / midSegment.length;
5450
+
5451
+ var midPoint = {
5452
+ x: midSegment.start.x + (midSegment.end.x - midSegment.start.x) * segmentProgress,
5453
+ y: midSegment.start.y + (midSegment.end.y - midSegment.start.y) * segmentProgress
5454
+ };
5455
+
5456
+ return midPoint;
5457
+ }
5458
+
5459
+
5460
+ /**
5461
+ * Get the mid of the given Element.
5462
+ *
5463
+ * @param {djs.Base.Connection} connection
5464
+ *
5465
+ * @return {Point}
5466
+ */
5467
+ function getMid(element) {
5468
+ if (isConnection(element)) {
5469
+ return getConnectionMid(element);
5470
+ }
5471
+
5472
+ return getBoundsMid(element);
5473
+ }
5474
+
5475
+ // helpers //////////////////////
5476
+
5477
+ function distance(a, b) {
5478
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
5479
+ }
5480
+
5481
+ function isConnection(element) {
5482
+ return !!element.waypoints;
5483
+ }
5484
+
5285
5485
  function elementToString(e) {
5286
5486
  if (!e) {
5287
5487
  return '<null>';
@@ -5924,10 +6124,13 @@
5924
6124
 
5925
6125
  var ALL_HIT_STYLE = createHitStyle('djs-hit djs-hit-all');
5926
6126
 
6127
+ var NO_MOVE_HIT_STYLE = createHitStyle('djs-hit djs-hit-no-move');
6128
+
5927
6129
  var HIT_TYPES = {
5928
6130
  'all': ALL_HIT_STYLE,
5929
6131
  'click-stroke': CLICK_STROKE_HIT_STYLE,
5930
- 'stroke': STROKE_HIT_STYLE
6132
+ 'stroke': STROKE_HIT_STYLE,
6133
+ 'no-move': NO_MOVE_HIT_STYLE
5931
6134
  };
5932
6135
 
5933
6136
  function createHitStyle(classNames, attrs) {
@@ -6180,7 +6383,9 @@
6180
6383
  * the array or the element primitive.
6181
6384
  *
6182
6385
  * @param {Array<djs.model.Shape>|djs.model.Shape} elements
6183
- * @param {boolean} stopRecursion
6386
+ * @param {boolean} [stopRecursion=false]
6387
+ *
6388
+ * @return {Bounds}
6184
6389
  */
6185
6390
  function getBBox(elements, stopRecursion) {
6186
6391
 
@@ -6276,6 +6481,7 @@
6276
6481
  attr(outline, assign({
6277
6482
  x: 10,
6278
6483
  y: 10,
6484
+ rx: 3,
6279
6485
  width: 100,
6280
6486
  height: 100
6281
6487
  }, OUTLINE_STYLE));
@@ -6467,6 +6673,8 @@
6467
6673
  var MARKER_HOVER = 'hover',
6468
6674
  MARKER_SELECTED = 'selected';
6469
6675
 
6676
+ var SELECTION_OUTLINE_PADDING = 6;
6677
+
6470
6678
 
6471
6679
  /**
6472
6680
  * A plugin that adds a visible selection UI to shapes and connections
@@ -6476,11 +6684,13 @@
6476
6684
  *
6477
6685
  * Makes elements selectable, too.
6478
6686
  *
6479
- * @param {EventBus} events
6480
- * @param {SelectionService} selection
6481
6687
  * @param {Canvas} canvas
6688
+ * @param {EventBus} eventBus
6482
6689
  */
6483
- function SelectionVisuals(events, canvas, selection, styles) {
6690
+ function SelectionVisuals(canvas, eventBus, selection) {
6691
+ this._canvas = canvas;
6692
+
6693
+ var self = this;
6484
6694
 
6485
6695
  this._multiSelectionBox = null;
6486
6696
 
@@ -6492,15 +6702,15 @@
6492
6702
  canvas.removeMarker(e, cls);
6493
6703
  }
6494
6704
 
6495
- events.on('element.hover', function(event) {
6705
+ eventBus.on('element.hover', function(event) {
6496
6706
  addMarker(event.element, MARKER_HOVER);
6497
6707
  });
6498
6708
 
6499
- events.on('element.out', function(event) {
6709
+ eventBus.on('element.out', function(event) {
6500
6710
  removeMarker(event.element, MARKER_HOVER);
6501
6711
  });
6502
6712
 
6503
- events.on('selection.changed', function(event) {
6713
+ eventBus.on('selection.changed', function(event) {
6504
6714
 
6505
6715
  function deselect(s) {
6506
6716
  removeMarker(s, MARKER_SELECTED);
@@ -6524,16 +6734,63 @@
6524
6734
  select(e);
6525
6735
  }
6526
6736
  });
6737
+
6738
+ self._updateSelectionOutline(newSelection);
6739
+ });
6740
+
6741
+
6742
+ eventBus.on('element.changed', function(event) {
6743
+ if (selection.isSelected(event.element)) {
6744
+ self._updateSelectionOutline(selection.get());
6745
+ }
6527
6746
  });
6528
6747
  }
6529
6748
 
6530
6749
  SelectionVisuals.$inject = [
6531
- 'eventBus',
6532
6750
  'canvas',
6533
- 'selection',
6534
- 'styles'
6751
+ 'eventBus',
6752
+ 'selection'
6535
6753
  ];
6536
6754
 
6755
+ SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
6756
+ var layer = this._canvas.getLayer('selectionOutline');
6757
+
6758
+ clear(layer);
6759
+
6760
+ var enabled = selection.length > 1;
6761
+
6762
+ var container = this._canvas.getContainer();
6763
+
6764
+ classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
6765
+
6766
+ if (!enabled) {
6767
+ return;
6768
+ }
6769
+
6770
+ var bBox = addSelectionOutlinePadding(getBBox(selection));
6771
+
6772
+ var rect = create('rect');
6773
+
6774
+ attr(rect, assign({
6775
+ rx: 3
6776
+ }, bBox));
6777
+
6778
+ classes(rect).add('djs-selection-outline');
6779
+
6780
+ append(layer, rect);
6781
+ };
6782
+
6783
+ // helpers //////////
6784
+
6785
+ function addSelectionOutlinePadding(bBox) {
6786
+ return {
6787
+ x: bBox.x - SELECTION_OUTLINE_PADDING,
6788
+ y: bBox.y - SELECTION_OUTLINE_PADDING,
6789
+ width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
6790
+ height: bBox.height + SELECTION_OUTLINE_PADDING * 2
6791
+ };
6792
+ }
6793
+
6537
6794
  function SelectionBehavior(eventBus, selection, canvas, elementRegistry) {
6538
6795
 
6539
6796
  // Select elements on create
@@ -6564,11 +6821,10 @@
6564
6821
  // Select connection targets on connect
6565
6822
  eventBus.on('connect.end', 500, function(event) {
6566
6823
  var context = event.context,
6567
- canExecute = context.canExecute,
6568
- hover = context.hover;
6824
+ connection = context.connection;
6569
6825
 
6570
- if (canExecute && hover) {
6571
- selection.select(hover);
6826
+ if (connection) {
6827
+ selection.select(connection);
6572
6828
  }
6573
6829
  });
6574
6830
 
@@ -7034,7 +7290,8 @@
7034
7290
 
7035
7291
 
7036
7292
  Overlays.prototype._createOverlayContainer = function(element) {
7037
- var html = domify('<div class="djs-overlays" style="position: absolute" />');
7293
+ var html = domify('<div class="djs-overlays" />');
7294
+ assign$1(html, { position: 'absolute' });
7038
7295
 
7039
7296
  this._overlayRoot.appendChild(html);
7040
7297
 
@@ -7105,7 +7362,8 @@
7105
7362
 
7106
7363
  overlayContainer = this._getOverlayContainer(element);
7107
7364
 
7108
- htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
7365
+ htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '">');
7366
+ assign$1(htmlContainer, { position: 'absolute' });
7109
7367
 
7110
7368
  htmlContainer.appendChild(html);
7111
7369
 
@@ -7290,18 +7548,30 @@
7290
7548
 
7291
7549
  function createRoot(parentNode) {
7292
7550
  var root = domify(
7293
- '<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'
7551
+ '<div class="djs-overlay-container" />'
7294
7552
  );
7295
7553
 
7554
+ assign$1(root, {
7555
+ position: 'absolute',
7556
+ width: 0,
7557
+ height: 0
7558
+ });
7559
+
7296
7560
  parentNode.insertBefore(root, parentNode.firstChild);
7297
7561
 
7298
7562
  return root;
7299
7563
  }
7300
7564
 
7301
7565
  function setPosition(el, x, y) {
7302
- assign(el.style, { left: x + 'px', top: y + 'px' });
7566
+ assign$1(el, { left: x + 'px', top: y + 'px' });
7303
7567
  }
7304
7568
 
7569
+ /**
7570
+ * Set element visible
7571
+ *
7572
+ * @param {DOMElement} el
7573
+ * @param {boolean} [visible=true]
7574
+ */
7305
7575
  function setVisible(el, visible) {
7306
7576
  el.style.display = visible === false ? 'none' : '';
7307
7577
  }
@@ -7399,7 +7669,7 @@
7399
7669
  *
7400
7670
  * @example
7401
7671
  *
7402
- * import inherits from 'inherits';
7672
+ * import inherits from 'inherits-browser';
7403
7673
  *
7404
7674
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7405
7675
  *
@@ -7555,7 +7825,7 @@
7555
7825
  });
7556
7826
  }
7557
7827
 
7558
- inherits_browser(RootElementsBehavior, CommandInterceptor);
7828
+ e(RootElementsBehavior, CommandInterceptor);
7559
7829
 
7560
7830
  RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
7561
7831
 
@@ -8015,7 +8285,7 @@
8015
8285
  collapsedElements.push(bo);
8016
8286
  }
8017
8287
 
8018
- if (is(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8288
+ if (shouldMoveToPlane(bo, plane)) {
8019
8289
 
8020
8290
  // don't change the array while we iterate over it
8021
8291
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8104,7 +8374,7 @@
8104
8374
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8105
8375
 
8106
8376
 
8107
- // helpers
8377
+ // helpers //////////////////////////
8108
8378
 
8109
8379
  function findRootDiagram(element) {
8110
8380
  if (is(element, 'bpmndi:BPMNDiagram')) {
@@ -8136,6 +8406,23 @@
8136
8406
  return asBounds(planeTrbl);
8137
8407
  }
8138
8408
 
8409
+ function shouldMoveToPlane(bo, plane) {
8410
+ var parent = bo.$parent;
8411
+
8412
+ // don't move elements that are already on the plane
8413
+ if (!is(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8414
+ return false;
8415
+ }
8416
+
8417
+ // dataAssociations are children of the subprocess but rendered on process level
8418
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8419
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8420
+ return false;
8421
+ }
8422
+
8423
+ return true;
8424
+ }
8425
+
8139
8426
  var LOW_PRIORITY$3 = 250;
8140
8427
  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>';
8141
8428
 
@@ -8211,7 +8498,7 @@
8211
8498
  }, true);
8212
8499
 
8213
8500
 
8214
- eventBus.on('import.done', function() {
8501
+ eventBus.on('import.render.complete', function() {
8215
8502
  elementRegistry.filter(function(e) {
8216
8503
  return self.canDrillDown(e);
8217
8504
  }).map(function(el) {
@@ -8221,7 +8508,7 @@
8221
8508
 
8222
8509
  }
8223
8510
 
8224
- inherits_browser(DrilldownOverlayBehavior, CommandInterceptor);
8511
+ e(DrilldownOverlayBehavior, CommandInterceptor);
8225
8512
 
8226
8513
  DrilldownOverlayBehavior.prototype.updateDrilldownOverlay = function(shape) {
8227
8514
  var canvas = this._canvas;
@@ -8322,22 +8609,50 @@
8322
8609
 
8323
8610
  var CLASS_PATTERN = /^class /;
8324
8611
 
8612
+
8613
+ /**
8614
+ * @param {function} fn
8615
+ *
8616
+ * @return {boolean}
8617
+ */
8325
8618
  function isClass(fn) {
8326
8619
  return CLASS_PATTERN.test(fn.toString());
8327
8620
  }
8328
8621
 
8329
- function isArray$1(obj) {
8622
+ /**
8623
+ * @param {any} obj
8624
+ *
8625
+ * @return {boolean}
8626
+ */
8627
+ function isArray$2(obj) {
8330
8628
  return Object.prototype.toString.call(obj) === '[object Array]';
8331
8629
  }
8332
8630
 
8631
+ /**
8632
+ * @param {any} obj
8633
+ * @param {string} prop
8634
+ *
8635
+ * @return {boolean}
8636
+ */
8333
8637
  function hasOwnProp(obj, prop) {
8334
8638
  return Object.prototype.hasOwnProperty.call(obj, prop);
8335
8639
  }
8336
8640
 
8641
+ /**
8642
+ * @typedef {import('./index').InjectAnnotated } InjectAnnotated
8643
+ */
8644
+
8645
+ /**
8646
+ * @template T
8647
+ *
8648
+ * @params {[...string[], T] | ...string[], T} args
8649
+ *
8650
+ * @return {T & InjectAnnotated}
8651
+ */
8337
8652
  function annotate() {
8338
8653
  var args = Array.prototype.slice.call(arguments);
8339
8654
 
8340
- if (args.length === 1 && isArray$1(args[0])) {
8655
+ if (args.length === 1 && isArray$2(args[0])) {
8341
8656
  args = args[0];
8342
8657
  }
8343
8658
 
@@ -8363,9 +8678,14 @@
8363
8678
  // of a nested class, too.
8364
8679
 
8365
8680
  var CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
8366
- var FN_ARGS = /^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m;
8681
+ var FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
8367
8682
  var FN_ARG = /\/\*([^*]*)\*\//m;
8368
8683
 
8684
+ /**
8685
+ * @param {unknown} fn
8686
+ *
8687
+ * @return {string[]}
8688
+ */
8369
8689
  function parseAnnotations(fn) {
8370
8690
 
8371
8691
  if (typeof fn !== 'function') {
@@ -8379,36 +8699,26 @@
8379
8699
  return [];
8380
8700
  }
8381
8701
 
8382
- return match[1] && match[1].split(',').map(function(arg) {
8383
- match = arg.match(FN_ARG);
8384
- return match ? match[1].trim() : arg.trim();
8702
+ var args = match[1] || match[2];
8703
+
8704
+ return args && args.split(',').map(function(arg) {
8705
+ var argMatch = arg.match(FN_ARG);
8706
+ return (argMatch && argMatch[1] || arg).trim();
8385
8707
  }) || [];
8386
8708
  }
8387
8709
 
8388
- function Module() {
8389
- var providers = [];
8390
-
8391
- this.factory = function(name, factory) {
8392
- providers.push([name, 'factory', factory]);
8393
- return this;
8394
- };
8395
-
8396
- this.value = function(name, value) {
8397
- providers.push([name, 'value', value]);
8398
- return this;
8399
- };
8400
-
8401
- this.type = function(name, type) {
8402
- providers.push([name, 'type', type]);
8403
- return this;
8404
- };
8405
-
8406
- this.forEach = function(iterator) {
8407
- providers.forEach(iterator);
8408
- };
8409
-
8410
- }
8710
+ /**
8711
+ * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
8712
+ * @typedef { import('./index').ModuleDefinition } ModuleDefinition
8713
+ * @typedef { import('./index').InjectorContext } InjectorContext
8714
+ */
8411
8715
 
8716
+ /**
8717
+ * Create a new injector with the given modules.
8718
+ *
8719
+ * @param {ModuleDefinition[]} modules
8720
+ * @param {InjectorContext} [parent]
8721
+ */
8412
8722
  function Injector(modules, parent) {
8413
8723
  parent = parent || {
8414
8724
  get: function(name, strict) {
@@ -8437,12 +8747,12 @@
8437
8747
  /**
8438
8748
  * Return a named service.
8439
8749
  *
8440
- * @param {String} name
8441
- * @param {Boolean} [strict=true] if false, resolve missing services to null
8750
+ * @param {string} name
8751
+ * @param {boolean} [strict=true] if false, resolve missing services to null
8442
8752
  *
8443
- * @return {Object}
8753
+ * @return {any}
8444
8754
  */
8445
- var get = function(name, strict) {
8755
+ function get(name, strict) {
8446
8756
  if (!providers[name] && name.indexOf('.') !== -1) {
8447
8757
  var parts = name.split('.');
8448
8758
  var pivot = get(parts.shift());
@@ -8472,16 +8782,16 @@
8472
8782
  }
8473
8783
 
8474
8784
  return parent.get(name, strict);
8475
- };
8785
+ }
8476
8786
 
8477
- var fnDef = function(fn, locals) {
8787
+ function fnDef(fn, locals) {
8478
8788
 
8479
8789
  if (typeof locals === 'undefined') {
8480
8790
  locals = {};
8481
8791
  }
8482
8792
 
8483
8793
  if (typeof fn !== 'function') {
8484
- if (isArray$1(fn)) {
8794
+ if (isArray$2(fn)) {
8485
8795
  fn = annotate(fn.slice());
8486
8796
  } else {
8487
8797
  throw new Error('Cannot invoke "' + fn + '". Expected a function!');
@@ -8501,9 +8811,9 @@
8501
8811
  fn: fn,
8502
8812
  dependencies: dependencies
8503
8813
  };
8504
- };
8814
+ }
8505
8815
 
8506
- var instantiate = function(Type) {
8816
+ function instantiate(Type) {
8507
8817
  var def = fnDef(Type);
8508
8818
 
8509
8819
  var fn = def.fn,
@@ -8513,25 +8823,35 @@
8513
8823
  var Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
8514
8824
 
8515
8825
  return new Constructor();
8516
- };
8826
+ }
8517
8827
 
8518
- var invoke = function(func, context, locals) {
8828
+ function invoke(func, context, locals) {
8519
8829
  var def = fnDef(func, locals);
8520
8830
 
8521
8831
  var fn = def.fn,
8522
8832
  dependencies = def.dependencies;
8523
8833
 
8524
8834
  return fn.apply(context, dependencies);
8525
- };
8526
-
8835
+ }
8527
8836
 
8528
- var createPrivateInjectorFactory = function(privateChildInjector) {
8837
+ /**
8838
+ * @param {Injector} childInjector
8839
+ *
8840
+ * @return {Function}
8841
+ */
8842
+ function createPrivateInjectorFactory(childInjector) {
8529
8843
  return annotate(function(key) {
8530
- return privateChildInjector.get(key);
8844
+ return childInjector.get(key);
8531
8845
  });
8532
- };
8846
+ }
8533
8847
 
8534
- var createChild = function(modules, forceNewInstances) {
8848
+ /**
8849
+ * @param {ModuleDefinition[]} modules
8850
+ * @param {string[]} [forceNewInstances]
8851
+ *
8852
+ * @return {Injector}
8853
+ */
8854
+ function createChild(modules, forceNewInstances) {
8535
8855
  if (forceNewInstances && forceNewInstances.length) {
8536
8856
  var fromParentModule = Object.create(null);
8537
8857
  var matchedScopes = Object.create(null);
@@ -8556,12 +8876,12 @@
8556
8876
  privateInjectorsCache.push(provider[3]);
8557
8877
  privateChildInjectors.push(privateChildInjector);
8558
8878
  privateChildFactories.push(privateChildInjectorFactory);
8559
- fromParentModule[name] = [privateChildInjectorFactory, name, 'private', privateChildInjector];
8879
+ fromParentModule[name] = [ privateChildInjectorFactory, name, 'private', privateChildInjector ];
8560
8880
  } else {
8561
- fromParentModule[name] = [privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx]];
8881
+ fromParentModule[name] = [ privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx] ];
8562
8882
  }
8563
8883
  } else {
8564
- fromParentModule[name] = [provider[2], provider[1]];
8884
+ fromParentModule[name] = [ provider[2], provider[1] ];
8565
8885
  }
8566
8886
  matchedScopes[name] = true;
8567
8887
  }
@@ -8570,7 +8890,7 @@
8570
8890
  /* jshint -W083 */
8571
8891
  forceNewInstances.forEach(function(scope) {
8572
8892
  if (provider[1].$scope.indexOf(scope) !== -1) {
8573
- fromParentModule[name] = [provider[2], provider[1]];
8893
+ fromParentModule[name] = [ provider[2], provider[1] ];
8574
8894
  matchedScopes[scope] = true;
8575
8895
  }
8576
8896
  });
@@ -8587,7 +8907,7 @@
8587
8907
  }
8588
8908
 
8589
8909
  return new Injector(modules, self);
8590
- };
8910
+ }
8591
8911
 
8592
8912
  var factoryMap = {
8593
8913
  factory: invoke,
@@ -8597,62 +8917,169 @@
8597
8917
  }
8598
8918
  };
8599
8919
 
8600
- modules.forEach(function(module) {
8920
+ /**
8921
+ * @param {ModuleDefinition} moduleDefinition
8922
+ * @param {Injector} injector
8923
+ */
8924
+ function createInitializer(moduleDefinition, injector) {
8601
8925
 
8602
- function arrayUnwrap(type, value) {
8603
- if (type !== 'value' && isArray$1(value)) {
8604
- value = annotate(value.slice());
8605
- }
8926
+ var initializers = moduleDefinition.__init__ || [];
8606
8927
 
8607
- return value;
8608
- }
8928
+ return function() {
8929
+ initializers.forEach(function(initializer) {
8609
8930
 
8610
- // TODO(vojta): handle wrong inputs (modules)
8611
- if (module instanceof Module) {
8612
- module.forEach(function(provider) {
8613
- var name = provider[0];
8614
- var type = provider[1];
8615
- var value = provider[2];
8931
+ try {
8616
8932
 
8617
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8618
- });
8619
- } else if (typeof module === 'object') {
8620
- if (module.__exports__) {
8621
- var clonedModule = Object.keys(module).reduce(function(m, key) {
8622
- if (key.substring(0, 2) !== '__') {
8623
- m[key] = module[key];
8933
+ // eagerly resolve component (fn or string)
8934
+ if (typeof initializer === 'string') {
8935
+ injector.get(initializer);
8936
+ } else {
8937
+ injector.invoke(initializer);
8624
8938
  }
8625
- return m;
8626
- }, Object.create(null));
8627
-
8628
- var privateInjector = new Injector((module.__modules__ || []).concat([clonedModule]), self);
8629
- var getFromPrivateInjector = annotate(function(key) {
8630
- return privateInjector.get(key);
8631
- });
8632
- module.__exports__.forEach(function(key) {
8633
- providers[key] = [getFromPrivateInjector, key, 'private', privateInjector];
8634
- });
8635
- } else {
8636
- Object.keys(module).forEach(function(name) {
8637
- if (module[name][2] === 'private') {
8638
- providers[name] = module[name];
8639
- return;
8939
+ } catch (error) {
8940
+ if (typeof AggregateError !== 'undefined') {
8941
+ throw new AggregateError([ error ], 'Failed to initialize!');
8640
8942
  }
8641
8943
 
8642
- var type = module[name][0];
8643
- var value = module[name][1];
8944
+ throw new Error('Failed to initialize! ' + error.message);
8945
+ }
8946
+ });
8947
+ };
8948
+ }
8644
8949
 
8645
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8646
- });
8950
+ /**
8951
+ * @param {ModuleDefinition} moduleDefinition
8952
+ */
8953
+ function loadModule(moduleDefinition) {
8954
+
8955
+ var moduleExports = moduleDefinition.__exports__;
8956
+
8957
+ // private module
8958
+ if (moduleExports) {
8959
+ var nestedModules = moduleDefinition.__modules__;
8960
+
8961
+ var clonedModule = Object.keys(moduleDefinition).reduce(function(clonedModule, key) {
8962
+
8963
+ if (key !== '__exports__' && key !== '__modules__' && key !== '__init__' && key !== '__depends__') {
8964
+ clonedModule[key] = moduleDefinition[key];
8965
+ }
8966
+
8967
+ return clonedModule;
8968
+ }, Object.create(null));
8969
+
8970
+ var childModules = (nestedModules || []).concat(clonedModule);
8971
+
8972
+ var privateInjector = createChild(childModules);
8973
+ var getFromPrivateInjector = annotate(function(key) {
8974
+ return privateInjector.get(key);
8975
+ });
8976
+
8977
+ moduleExports.forEach(function(key) {
8978
+ providers[key] = [ getFromPrivateInjector, key, 'private', privateInjector ];
8979
+ });
8980
+
8981
+ // ensure child injector initializes
8982
+ var initializers = (moduleDefinition.__init__ || []).slice();
8983
+
8984
+ initializers.unshift(function() {
8985
+ privateInjector.init();
8986
+ });
8987
+
8988
+ moduleDefinition = Object.assign({}, moduleDefinition, {
8989
+ __init__: initializers
8990
+ });
8991
+
8992
+ return createInitializer(moduleDefinition, privateInjector);
8993
+ }
8994
+
8995
+ // normal module
8996
+ Object.keys(moduleDefinition).forEach(function(key) {
8997
+
8998
+ if (key === '__init__' || key === '__depends__') {
8999
+ return;
9000
+ }
9001
+
9002
+ if (moduleDefinition[key][2] === 'private') {
9003
+ providers[key] = moduleDefinition[key];
9004
+ return;
8647
9005
  }
9006
+
9007
+ var type = moduleDefinition[key][0];
9008
+ var value = moduleDefinition[key][1];
9009
+
9010
+ providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
9011
+ });
9012
+
9013
+ return createInitializer(moduleDefinition, self);
9014
+ }
9015
+
9016
+ /**
9017
+ * @param {ModuleDefinition[]} moduleDefinitions
9018
+ * @param {ModuleDefinition} moduleDefinition
9019
+ *
9020
+ * @return {ModuleDefinition[]}
9021
+ */
9022
+ function resolveDependencies(moduleDefinitions, moduleDefinition) {
9023
+
9024
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9025
+ return moduleDefinitions;
8648
9026
  }
8649
- });
9027
+
9028
+ moduleDefinitions = (moduleDefinition.__depends__ || []).reduce(resolveDependencies, moduleDefinitions);
9029
+
9030
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9031
+ return moduleDefinitions;
9032
+ }
9033
+
9034
+ return moduleDefinitions.concat(moduleDefinition);
9035
+ }
9036
+
9037
+ /**
9038
+ * @param {ModuleDefinition[]} moduleDefinitions
9039
+ *
9040
+ * @return { () => void } initializerFn
9041
+ */
9042
+ function bootstrap(moduleDefinitions) {
9043
+
9044
+ var initializers = moduleDefinitions
9045
+ .reduce(resolveDependencies, [])
9046
+ .map(loadModule);
9047
+
9048
+ var initialized = false;
9049
+
9050
+ return function() {
9051
+
9052
+ if (initialized) {
9053
+ return;
9054
+ }
9055
+
9056
+ initialized = true;
9057
+
9058
+ initializers.forEach(function(initializer) {
9059
+ return initializer();
9060
+ });
9061
+ };
9062
+ }
8650
9063
 
8651
9064
  // public API
8652
9065
  this.get = get;
8653
9066
  this.invoke = invoke;
8654
9067
  this.instantiate = instantiate;
8655
9068
  this.createChild = createChild;
9069
+
9070
+ // setup
9071
+ this.init = bootstrap(modules);
9072
+ }
9073
+
9074
+
9075
+ // helpers ///////////////
9076
+
9077
+ function arrayUnwrap(type, value) {
9078
+ if (type !== 'value' && isArray$2(value)) {
9079
+ value = annotate(value.slice());
9080
+ }
9081
+
9082
+ return value;
8656
9083
  }
8657
9084
 
8658
9085
  // apply default renderer with lowest possible priority
@@ -8675,7 +9102,7 @@
8675
9102
  this.FRAME_STYLE = styles.style([ 'no-fill' ], { stroke: 'fuchsia', strokeDasharray: 4, strokeWidth: 2 });
8676
9103
  }
8677
9104
 
8678
- inherits_browser(DefaultRenderer, BaseRenderer);
9105
+ e(DefaultRenderer, BaseRenderer);
8679
9106
 
8680
9107
 
8681
9108
  DefaultRenderer.prototype.canRender = function() {
@@ -8931,7 +9358,7 @@
8931
9358
  var parent = document.createElement('div');
8932
9359
  parent.setAttribute('class', 'djs-container');
8933
9360
 
8934
- assign(parent.style, {
9361
+ assign$1(parent, {
8935
9362
  position: 'relative',
8936
9363
  overflow: 'hidden',
8937
9364
  width: ensurePx(options.width),
@@ -11010,7 +11437,7 @@
11010
11437
  attacherRefs.bind(this, 'attachers');
11011
11438
  }
11012
11439
 
11013
- inherits_browser(Shape, Base);
11440
+ e(Shape, Base);
11014
11441
 
11015
11442
 
11016
11443
  /**
@@ -11025,7 +11452,7 @@
11025
11452
  Shape.call(this);
11026
11453
  }
11027
11454
 
11028
- inherits_browser(Root, Shape);
11455
+ e(Root, Shape);
11029
11456
 
11030
11457
 
11031
11458
  /**
@@ -11048,7 +11475,7 @@
11048
11475
  labelRefs.bind(this, 'labelTarget');
11049
11476
  }
11050
11477
 
11051
- inherits_browser(Label, Shape);
11478
+ e(Label, Shape);
11052
11479
 
11053
11480
 
11054
11481
  /**
@@ -11079,7 +11506,7 @@
11079
11506
  incomingRefs.bind(this, 'target');
11080
11507
  }
11081
11508
 
11082
- inherits_browser(Connection, Base);
11509
+ e(Connection, Base);
11083
11510
 
11084
11511
 
11085
11512
  var types = {
@@ -11930,62 +12357,21 @@
11930
12357
  graphicsFactory: [ 'type', GraphicsFactory ]
11931
12358
  };
11932
12359
 
12360
+ /**
12361
+ * @typedef { import('didi').ModuleDeclaration } Module
12362
+ */
12363
+
11933
12364
  /**
11934
12365
  * Bootstrap an injector from a list of modules, instantiating a number of default components
11935
12366
  *
11936
- * @ignore
11937
- * @param {Array<didi.Module>} bootstrapModules
12367
+ * @param {Array<Module>} modules
11938
12368
  *
11939
- * @return {didi.Injector} a injector to use to access the components
12369
+ * @return {Injector} a injector to use to access the components
11940
12370
  */
11941
- function bootstrap(bootstrapModules) {
11942
-
11943
- var modules = [],
11944
- components = [];
11945
-
11946
- function hasModule(m) {
11947
- return modules.indexOf(m) >= 0;
11948
- }
11949
-
11950
- function addModule(m) {
11951
- modules.push(m);
11952
- }
11953
-
11954
- function visit(m) {
11955
- if (hasModule(m)) {
11956
- return;
11957
- }
11958
-
11959
- (m.__depends__ || []).forEach(visit);
11960
-
11961
- if (hasModule(m)) {
11962
- return;
11963
- }
11964
-
11965
- addModule(m);
11966
-
11967
- (m.__init__ || []).forEach(function(c) {
11968
- components.push(c);
11969
- });
11970
- }
11971
-
11972
- bootstrapModules.forEach(visit);
11973
-
12371
+ function bootstrap(modules) {
11974
12372
  var injector = new Injector(modules);
11975
12373
 
11976
- components.forEach(function(c) {
11977
-
11978
- try {
11979
-
11980
- // eagerly resolve component (fn or string)
11981
- injector[typeof c === 'string' ? 'get' : 'invoke'](c);
11982
- } catch (e) {
11983
- console.error('Failed to instantiate component');
11984
- console.error(e.stack);
11985
-
11986
- throw e;
11987
- }
11988
- });
12374
+ injector.init();
11989
12375
 
11990
12376
  return injector;
11991
12377
  }
@@ -11993,9 +12379,8 @@
11993
12379
  /**
11994
12380
  * Creates an injector from passed options.
11995
12381
  *
11996
- * @ignore
11997
- * @param {Object} options
11998
- * @return {didi.Injector}
12382
+ * @param {Object} options
12383
+ * @return {Injector}
11999
12384
  */
12000
12385
  function createInjector(options) {
12001
12386
 
@@ -12015,7 +12400,7 @@
12015
12400
  * The main diagram-js entry point that bootstraps the diagram with the given
12016
12401
  * configuration.
12017
12402
  *
12018
- * To register extensions with the diagram, pass them as Array<didi.Module> to the constructor.
12403
+ * To register extensions with the diagram, pass them as Array<Module> to the constructor.
12019
12404
  *
12020
12405
  * @class djs.Diagram
12021
12406
  * @memberOf djs
@@ -12057,8 +12442,8 @@
12057
12442
  * // 'shape ... was added to the diagram' logged to console
12058
12443
  *
12059
12444
  * @param {Object} options
12060
- * @param {Array<didi.Module>} [options.modules] external modules to instantiate with the diagram
12061
- * @param {didi.Injector} [injector] an (optional) injector to bootstrap the diagram with
12445
+ * @param {Array<Module>} [options.modules] external modules to instantiate with the diagram
12446
+ * @param {Injector} [injector] an (optional) injector to bootstrap the diagram with
12062
12447
  */
12063
12448
  function Diagram(options, injector) {
12064
12449
 
@@ -12723,7 +13108,7 @@
12723
13108
 
12724
13109
  var propertyName = property && property.name;
12725
13110
 
12726
- if (isUndefined$1(value)) {
13111
+ if (isUndefined$2(value)) {
12727
13112
  // unset the property, if the specified value is undefined;
12728
13113
  // delete from $attrs (for extensions) or the target itself
12729
13114
  if (property) {
@@ -12814,7 +13199,7 @@
12814
13199
  };
12815
13200
 
12816
13201
 
12817
- function isUndefined$1(val) {
13202
+ function isUndefined$2(val) {
12818
13203
  return typeof val === 'undefined';
12819
13204
  }
12820
13205
 
@@ -20261,7 +20646,7 @@
20261
20646
  }
20262
20647
 
20263
20648
  /**
20264
- * Returns all diagrams in the same hirarchy as the requested diagram.
20649
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20265
20650
  * Includes all parent and sub process diagrams.
20266
20651
  *
20267
20652
  * @param {Array} definitions
@@ -20369,53 +20754,53 @@
20369
20754
 
20370
20755
 
20371
20756
  // inlined ../../resources/logo.svg
20372
- 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>';
20757
+ 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>';
20373
20758
 
20374
20759
  var BPMNIO_IMG = BPMNIO_LOGO_SVG;
20375
20760
 
20376
- function css(attrs) {
20377
- return attrs.join(';');
20378
- }
20379
-
20380
- var LINK_STYLES = css([
20381
- 'color: #404040'
20382
- ]);
20383
-
20384
- var LIGHTBOX_STYLES = css([
20385
- 'z-index: 1001',
20386
- 'position: fixed',
20387
- 'top: 0',
20388
- 'left: 0',
20389
- 'right: 0',
20390
- 'bottom: 0'
20391
- ]);
20392
-
20393
- var BACKDROP_STYLES = css([
20394
- 'width: 100%',
20395
- 'height: 100%',
20396
- 'background: rgba(40,40,40,0.2)'
20397
- ]);
20398
-
20399
- var NOTICE_STYLES = css([
20400
- 'position: absolute',
20401
- 'left: 50%',
20402
- 'top: 40%',
20403
- 'transform: translate(-50%)',
20404
- 'width: 260px',
20405
- 'padding: 10px',
20406
- 'background: white',
20407
- 'box-shadow: 0 1px 4px rgba(0,0,0,0.3)',
20408
- 'font-family: Helvetica, Arial, sans-serif',
20409
- 'font-size: 14px',
20410
- 'display: flex',
20411
- 'line-height: 1.3'
20412
- ]);
20761
+ var LOGO_STYLES = {
20762
+ verticalAlign: 'middle'
20763
+ };
20764
+
20765
+ var LINK_STYLES = {
20766
+ 'color': '#404040'
20767
+ };
20768
+
20769
+ var LIGHTBOX_STYLES = {
20770
+ 'zIndex': '1001',
20771
+ 'position': 'fixed',
20772
+ 'top': '0',
20773
+ 'left': '0',
20774
+ 'right': '0',
20775
+ 'bottom': '0'
20776
+ };
20777
+
20778
+ var BACKDROP_STYLES = {
20779
+ 'width': '100%',
20780
+ 'height': '100%',
20781
+ 'background': 'rgba(40,40,40,0.2)'
20782
+ };
20783
+
20784
+ var NOTICE_STYLES = {
20785
+ 'position': 'absolute',
20786
+ 'left': '50%',
20787
+ 'top': '40%',
20788
+ 'transform': 'translate(-50%)',
20789
+ 'width': '260px',
20790
+ 'padding': '10px',
20791
+ 'background': 'white',
20792
+ 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',
20793
+ 'fontFamily': 'Helvetica, Arial, sans-serif',
20794
+ 'fontSize': '14px',
20795
+ 'display': 'flex',
20796
+ 'lineHeight': '1.3'
20797
+ };
20413
20798
 
20414
20799
  var LIGHTBOX_MARKUP =
20415
- '<div class="bjs-powered-by-lightbox" style="' + LIGHTBOX_STYLES + '">' +
20416
- '<div class="backdrop" style="' + BACKDROP_STYLES + '"></div>' +
20417
- '<div class="notice" style="' + NOTICE_STYLES + '">' +
20418
- '<a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;' + LINK_STYLES + '">' +
20800
+ '<div class="bjs-powered-by-lightbox">' +
20801
+ '<div class="backdrop"></div>' +
20802
+ '<div class="notice">' +
20803
+ '<a href="https://bpmn.io" target="_blank" rel="noopener" class="link">' +
20419
20804
  BPMNIO_IMG +
20420
20805
  '</a>' +
20421
20806
  '<span>' +
@@ -20428,10 +20813,23 @@
20428
20813
 
20429
20814
  var lightbox;
20430
20815
 
20816
+ function createLightbox() {
20817
+ lightbox = domify(LIGHTBOX_MARKUP);
20818
+
20819
+ assign$1(lightbox, LIGHTBOX_STYLES);
20820
+ assign$1(query('svg', lightbox), LOGO_STYLES);
20821
+ assign$1(query('.backdrop', lightbox), BACKDROP_STYLES);
20822
+ assign$1(query('.notice', lightbox), NOTICE_STYLES);
20823
+ assign$1(query('.link', lightbox), LINK_STYLES, {
20824
+ 'margin': '15px 20px 15px 10px',
20825
+ 'alignSelf': 'center'
20826
+ });
20827
+ }
20828
+
20431
20829
  function open() {
20432
20830
 
20433
20831
  if (!lightbox) {
20434
- lightbox = domify(LIGHTBOX_MARKUP);
20832
+ createLightbox();
20435
20833
 
20436
20834
  delegate.bind(lightbox, '.backdrop', 'click', function(event) {
20437
20835
  document.body.removeChild(lightbox);
@@ -20479,7 +20877,7 @@
20479
20877
  this._init(this._container, this._moddle, options);
20480
20878
  }
20481
20879
 
20482
- inherits_browser(BaseViewer, Diagram);
20880
+ e(BaseViewer, Diagram);
20483
20881
 
20484
20882
  /**
20485
20883
  * The importXML result.
@@ -21067,7 +21465,7 @@
21067
21465
 
21068
21466
  var container = domify('<div class="bjs-container"></div>');
21069
21467
 
21070
- assign(container.style, {
21468
+ assign$1(container, {
21071
21469
  width: ensureUnit(options.width),
21072
21470
  height: ensureUnit(options.height),
21073
21471
  position: options.position
@@ -21157,12 +21555,20 @@
21157
21555
  'target="_blank" ' +
21158
21556
  'class="bjs-powered-by" ' +
21159
21557
  'title="Powered by bpmn.io" ' +
21160
- 'style="position: absolute; bottom: 15px; right: 15px; z-index: 100; ' + LINK_STYLES + '">' +
21558
+ '>' +
21161
21559
  img +
21162
21560
  '</a>';
21163
21561
 
21164
21562
  var linkElement = domify(linkMarkup);
21165
21563
 
21564
+ assign$1(query('svg', linkElement), LOGO_STYLES);
21565
+ assign$1(linkElement, LINK_STYLES, {
21566
+ position: 'absolute',
21567
+ bottom: '15px',
21568
+ right: '15px',
21569
+ zIndex: '100'
21570
+ });
21571
+
21166
21572
  container.appendChild(linkElement);
21167
21573
 
21168
21574
  componentEvent.bind(linkElement, 'click', function(event) {
@@ -21225,7 +21631,7 @@
21225
21631
  BaseViewer.call(this, options);
21226
21632
  }
21227
21633
 
21228
- inherits_browser(Viewer, BaseViewer);
21634
+ e(Viewer, BaseViewer);
21229
21635
 
21230
21636
  // modules the viewer is composed of
21231
21637
  Viewer.prototype._modules = [
@@ -22199,7 +22605,7 @@
22199
22605
  Viewer.call(this, options);
22200
22606
  }
22201
22607
 
22202
- inherits_browser(NavigatedViewer, Viewer);
22608
+ e(NavigatedViewer, Viewer);
22203
22609
 
22204
22610
 
22205
22611
  NavigatedViewer.prototype._navigationModules = [
@@ -23385,27 +23791,27 @@
23385
23791
  emumerations: emumerations
23386
23792
  };
23387
23793
 
23388
- const commonModdleExtensions = {
23389
- camunda: camundaModdle
23794
+ const commonModdleExtensions = {
23795
+ camunda: camundaModdle
23390
23796
  };
23391
23797
 
23392
- /**
23393
- *
23394
- * @param {Object} options
23395
- */
23396
- function NavigatedViewer$1(options = {}) {
23397
-
23398
- options = {
23399
- ...options,
23400
- moddleExtensions: {
23401
- ...commonModdleExtensions,
23402
- ...options.moddleExtensions
23403
- }
23404
- };
23405
-
23406
- NavigatedViewer.call(this, options);
23407
- }
23408
-
23798
+ /**
23799
+ *
23800
+ * @param {Object} options
23801
+ */
23802
+ function NavigatedViewer$1(options = {}) {
23803
+
23804
+ options = {
23805
+ ...options,
23806
+ moddleExtensions: {
23807
+ ...commonModdleExtensions,
23808
+ ...options.moddleExtensions
23809
+ }
23810
+ };
23811
+
23812
+ NavigatedViewer.call(this, options);
23813
+ }
23814
+
23409
23815
  inherits_browser(NavigatedViewer$1, NavigatedViewer);
23410
23816
 
23411
23817
  return NavigatedViewer$1;