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>';
@@ -5907,10 +6107,13 @@
5907
6107
 
5908
6108
  var ALL_HIT_STYLE = createHitStyle('djs-hit djs-hit-all');
5909
6109
 
6110
+ var NO_MOVE_HIT_STYLE = createHitStyle('djs-hit djs-hit-no-move');
6111
+
5910
6112
  var HIT_TYPES = {
5911
6113
  'all': ALL_HIT_STYLE,
5912
6114
  'click-stroke': CLICK_STROKE_HIT_STYLE,
5913
- 'stroke': STROKE_HIT_STYLE
6115
+ 'stroke': STROKE_HIT_STYLE,
6116
+ 'no-move': NO_MOVE_HIT_STYLE
5914
6117
  };
5915
6118
 
5916
6119
  function createHitStyle(classNames, attrs) {
@@ -6163,7 +6366,9 @@
6163
6366
  * the array or the element primitive.
6164
6367
  *
6165
6368
  * @param {Array<djs.model.Shape>|djs.model.Shape} elements
6166
- * @param {boolean} stopRecursion
6369
+ * @param {boolean} [stopRecursion=false]
6370
+ *
6371
+ * @return {Bounds}
6167
6372
  */
6168
6373
  function getBBox(elements, stopRecursion) {
6169
6374
 
@@ -6259,6 +6464,7 @@
6259
6464
  attr(outline, assign({
6260
6465
  x: 10,
6261
6466
  y: 10,
6467
+ rx: 3,
6262
6468
  width: 100,
6263
6469
  height: 100
6264
6470
  }, OUTLINE_STYLE));
@@ -6450,6 +6656,8 @@
6450
6656
  var MARKER_HOVER = 'hover',
6451
6657
  MARKER_SELECTED = 'selected';
6452
6658
 
6659
+ var SELECTION_OUTLINE_PADDING = 6;
6660
+
6453
6661
 
6454
6662
  /**
6455
6663
  * A plugin that adds a visible selection UI to shapes and connections
@@ -6459,11 +6667,13 @@
6459
6667
  *
6460
6668
  * Makes elements selectable, too.
6461
6669
  *
6462
- * @param {EventBus} events
6463
- * @param {SelectionService} selection
6464
6670
  * @param {Canvas} canvas
6671
+ * @param {EventBus} eventBus
6465
6672
  */
6466
- function SelectionVisuals(events, canvas, selection, styles) {
6673
+ function SelectionVisuals(canvas, eventBus, selection) {
6674
+ this._canvas = canvas;
6675
+
6676
+ var self = this;
6467
6677
 
6468
6678
  this._multiSelectionBox = null;
6469
6679
 
@@ -6475,15 +6685,15 @@
6475
6685
  canvas.removeMarker(e, cls);
6476
6686
  }
6477
6687
 
6478
- events.on('element.hover', function(event) {
6688
+ eventBus.on('element.hover', function(event) {
6479
6689
  addMarker(event.element, MARKER_HOVER);
6480
6690
  });
6481
6691
 
6482
- events.on('element.out', function(event) {
6692
+ eventBus.on('element.out', function(event) {
6483
6693
  removeMarker(event.element, MARKER_HOVER);
6484
6694
  });
6485
6695
 
6486
- events.on('selection.changed', function(event) {
6696
+ eventBus.on('selection.changed', function(event) {
6487
6697
 
6488
6698
  function deselect(s) {
6489
6699
  removeMarker(s, MARKER_SELECTED);
@@ -6507,16 +6717,63 @@
6507
6717
  select(e);
6508
6718
  }
6509
6719
  });
6720
+
6721
+ self._updateSelectionOutline(newSelection);
6722
+ });
6723
+
6724
+
6725
+ eventBus.on('element.changed', function(event) {
6726
+ if (selection.isSelected(event.element)) {
6727
+ self._updateSelectionOutline(selection.get());
6728
+ }
6510
6729
  });
6511
6730
  }
6512
6731
 
6513
6732
  SelectionVisuals.$inject = [
6514
- 'eventBus',
6515
6733
  'canvas',
6516
- 'selection',
6517
- 'styles'
6734
+ 'eventBus',
6735
+ 'selection'
6518
6736
  ];
6519
6737
 
6738
+ SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
6739
+ var layer = this._canvas.getLayer('selectionOutline');
6740
+
6741
+ clear(layer);
6742
+
6743
+ var enabled = selection.length > 1;
6744
+
6745
+ var container = this._canvas.getContainer();
6746
+
6747
+ classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
6748
+
6749
+ if (!enabled) {
6750
+ return;
6751
+ }
6752
+
6753
+ var bBox = addSelectionOutlinePadding(getBBox(selection));
6754
+
6755
+ var rect = create('rect');
6756
+
6757
+ attr(rect, assign({
6758
+ rx: 3
6759
+ }, bBox));
6760
+
6761
+ classes(rect).add('djs-selection-outline');
6762
+
6763
+ append(layer, rect);
6764
+ };
6765
+
6766
+ // helpers //////////
6767
+
6768
+ function addSelectionOutlinePadding(bBox) {
6769
+ return {
6770
+ x: bBox.x - SELECTION_OUTLINE_PADDING,
6771
+ y: bBox.y - SELECTION_OUTLINE_PADDING,
6772
+ width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
6773
+ height: bBox.height + SELECTION_OUTLINE_PADDING * 2
6774
+ };
6775
+ }
6776
+
6520
6777
  function SelectionBehavior(eventBus, selection, canvas, elementRegistry) {
6521
6778
 
6522
6779
  // Select elements on create
@@ -6547,11 +6804,10 @@
6547
6804
  // Select connection targets on connect
6548
6805
  eventBus.on('connect.end', 500, function(event) {
6549
6806
  var context = event.context,
6550
- canExecute = context.canExecute,
6551
- hover = context.hover;
6807
+ connection = context.connection;
6552
6808
 
6553
- if (canExecute && hover) {
6554
- selection.select(hover);
6809
+ if (connection) {
6810
+ selection.select(connection);
6555
6811
  }
6556
6812
  });
6557
6813
 
@@ -7017,7 +7273,8 @@
7017
7273
 
7018
7274
 
7019
7275
  Overlays.prototype._createOverlayContainer = function(element) {
7020
- var html = domify('<div class="djs-overlays" style="position: absolute" />');
7276
+ var html = domify('<div class="djs-overlays" />');
7277
+ assign$1(html, { position: 'absolute' });
7021
7278
 
7022
7279
  this._overlayRoot.appendChild(html);
7023
7280
 
@@ -7088,7 +7345,8 @@
7088
7345
 
7089
7346
  overlayContainer = this._getOverlayContainer(element);
7090
7347
 
7091
- htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
7348
+ htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '">');
7349
+ assign$1(htmlContainer, { position: 'absolute' });
7092
7350
 
7093
7351
  htmlContainer.appendChild(html);
7094
7352
 
@@ -7273,18 +7531,30 @@
7273
7531
 
7274
7532
  function createRoot(parentNode) {
7275
7533
  var root = domify(
7276
- '<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'
7534
+ '<div class="djs-overlay-container" />'
7277
7535
  );
7278
7536
 
7537
+ assign$1(root, {
7538
+ position: 'absolute',
7539
+ width: 0,
7540
+ height: 0
7541
+ });
7542
+
7279
7543
  parentNode.insertBefore(root, parentNode.firstChild);
7280
7544
 
7281
7545
  return root;
7282
7546
  }
7283
7547
 
7284
7548
  function setPosition(el, x, y) {
7285
- assign(el.style, { left: x + 'px', top: y + 'px' });
7549
+ assign$1(el, { left: x + 'px', top: y + 'px' });
7286
7550
  }
7287
7551
 
7552
+ /**
7553
+ * Set element visible
7554
+ *
7555
+ * @param {DOMElement} el
7556
+ * @param {boolean} [visible=true]
7557
+ */
7288
7558
  function setVisible(el, visible) {
7289
7559
  el.style.display = visible === false ? 'none' : '';
7290
7560
  }
@@ -7382,7 +7652,7 @@
7382
7652
  *
7383
7653
  * @example
7384
7654
  *
7385
- * import inherits from 'inherits';
7655
+ * import inherits from 'inherits-browser';
7386
7656
  *
7387
7657
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7388
7658
  *
@@ -7538,7 +7808,7 @@
7538
7808
  });
7539
7809
  }
7540
7810
 
7541
- inherits_browser(RootElementsBehavior, CommandInterceptor);
7811
+ e(RootElementsBehavior, CommandInterceptor);
7542
7812
 
7543
7813
  RootElementsBehavior.$inject = [ 'canvas', 'injector' ];
7544
7814
 
@@ -7998,7 +8268,7 @@
7998
8268
  collapsedElements.push(bo);
7999
8269
  }
8000
8270
 
8001
- if (is(parent, 'bpmn:SubProcess') && parent !== plane.bpmnElement) {
8271
+ if (shouldMoveToPlane(bo, plane)) {
8002
8272
 
8003
8273
  // don't change the array while we iterate over it
8004
8274
  elementsToMove.push({ diElement: diElement, parent: parent });
@@ -8087,7 +8357,7 @@
8087
8357
  SubprocessCompatibility.$inject = [ 'eventBus', 'moddle' ];
8088
8358
 
8089
8359
 
8090
- // helpers
8360
+ // helpers //////////////////////////
8091
8361
 
8092
8362
  function findRootDiagram(element) {
8093
8363
  if (is(element, 'bpmndi:BPMNDiagram')) {
@@ -8119,6 +8389,23 @@
8119
8389
  return asBounds(planeTrbl);
8120
8390
  }
8121
8391
 
8392
+ function shouldMoveToPlane(bo, plane) {
8393
+ var parent = bo.$parent;
8394
+
8395
+ // don't move elements that are already on the plane
8396
+ if (!is(parent, 'bpmn:SubProcess') || parent === plane.bpmnElement) {
8397
+ return false;
8398
+ }
8399
+
8400
+ // dataAssociations are children of the subprocess but rendered on process level
8401
+ // cf. https://github.com/bpmn-io/bpmn-js/issues/1619
8402
+ if (isAny(bo, ['bpmn:DataInputAssociation', 'bpmn:DataOutputAssociation'])) {
8403
+ return false;
8404
+ }
8405
+
8406
+ return true;
8407
+ }
8408
+
8122
8409
  var LOW_PRIORITY$3 = 250;
8123
8410
  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>';
8124
8411
 
@@ -8194,7 +8481,7 @@
8194
8481
  }, true);
8195
8482
 
8196
8483
 
8197
- eventBus.on('import.done', function() {
8484
+ eventBus.on('import.render.complete', function() {
8198
8485
  elementRegistry.filter(function(e) {
8199
8486
  return self.canDrillDown(e);
8200
8487
  }).map(function(el) {
@@ -8204,7 +8491,7 @@
8204
8491
 
8205
8492
  }
8206
8493
 
8207
- inherits_browser(DrilldownOverlayBehavior, CommandInterceptor);
8494
+ e(DrilldownOverlayBehavior, CommandInterceptor);
8208
8495
 
8209
8496
  DrilldownOverlayBehavior.prototype.updateDrilldownOverlay = function(shape) {
8210
8497
  var canvas = this._canvas;
@@ -8305,22 +8592,50 @@
8305
8592
 
8306
8593
  var CLASS_PATTERN = /^class /;
8307
8594
 
8595
+
8596
+ /**
8597
+ * @param {function} fn
8598
+ *
8599
+ * @return {boolean}
8600
+ */
8308
8601
  function isClass(fn) {
8309
8602
  return CLASS_PATTERN.test(fn.toString());
8310
8603
  }
8311
8604
 
8312
- function isArray$1(obj) {
8605
+ /**
8606
+ * @param {any} obj
8607
+ *
8608
+ * @return {boolean}
8609
+ */
8610
+ function isArray$2(obj) {
8313
8611
  return Object.prototype.toString.call(obj) === '[object Array]';
8314
8612
  }
8315
8613
 
8614
+ /**
8615
+ * @param {any} obj
8616
+ * @param {string} prop
8617
+ *
8618
+ * @return {boolean}
8619
+ */
8316
8620
  function hasOwnProp(obj, prop) {
8317
8621
  return Object.prototype.hasOwnProperty.call(obj, prop);
8318
8622
  }
8319
8623
 
8624
+ /**
8625
+ * @typedef {import('./index').InjectAnnotated } InjectAnnotated
8626
+ */
8627
+
8628
+ /**
8629
+ * @template T
8630
+ *
8631
+ * @params {[...string[], T] | ...string[], T} args
8632
+ *
8633
+ * @return {T & InjectAnnotated}
8634
+ */
8320
8635
  function annotate() {
8321
8636
  var args = Array.prototype.slice.call(arguments);
8322
8637
 
8323
- if (args.length === 1 && isArray$1(args[0])) {
8638
+ if (args.length === 1 && isArray$2(args[0])) {
8324
8639
  args = args[0];
8325
8640
  }
8326
8641
 
@@ -8346,9 +8661,14 @@
8346
8661
  // of a nested class, too.
8347
8662
 
8348
8663
  var CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
8349
- var FN_ARGS = /^(?:async )?(?:function\s*)?[^(]*\(\s*([^)]*)\)/m;
8664
+ var FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
8350
8665
  var FN_ARG = /\/\*([^*]*)\*\//m;
8351
8666
 
8667
+ /**
8668
+ * @param {unknown} fn
8669
+ *
8670
+ * @return {string[]}
8671
+ */
8352
8672
  function parseAnnotations(fn) {
8353
8673
 
8354
8674
  if (typeof fn !== 'function') {
@@ -8362,36 +8682,26 @@
8362
8682
  return [];
8363
8683
  }
8364
8684
 
8365
- return match[1] && match[1].split(',').map(function(arg) {
8366
- match = arg.match(FN_ARG);
8367
- return match ? match[1].trim() : arg.trim();
8685
+ var args = match[1] || match[2];
8686
+
8687
+ return args && args.split(',').map(function(arg) {
8688
+ var argMatch = arg.match(FN_ARG);
8689
+ return (argMatch && argMatch[1] || arg).trim();
8368
8690
  }) || [];
8369
8691
  }
8370
8692
 
8371
- function Module() {
8372
- var providers = [];
8373
-
8374
- this.factory = function(name, factory) {
8375
- providers.push([name, 'factory', factory]);
8376
- return this;
8377
- };
8378
-
8379
- this.value = function(name, value) {
8380
- providers.push([name, 'value', value]);
8381
- return this;
8382
- };
8383
-
8384
- this.type = function(name, type) {
8385
- providers.push([name, 'type', type]);
8386
- return this;
8387
- };
8388
-
8389
- this.forEach = function(iterator) {
8390
- providers.forEach(iterator);
8391
- };
8392
-
8393
- }
8693
+ /**
8694
+ * @typedef { import('./index').ModuleDeclaration } ModuleDeclaration
8695
+ * @typedef { import('./index').ModuleDefinition } ModuleDefinition
8696
+ * @typedef { import('./index').InjectorContext } InjectorContext
8697
+ */
8394
8698
 
8699
+ /**
8700
+ * Create a new injector with the given modules.
8701
+ *
8702
+ * @param {ModuleDefinition[]} modules
8703
+ * @param {InjectorContext} [parent]
8704
+ */
8395
8705
  function Injector(modules, parent) {
8396
8706
  parent = parent || {
8397
8707
  get: function(name, strict) {
@@ -8420,12 +8730,12 @@
8420
8730
  /**
8421
8731
  * Return a named service.
8422
8732
  *
8423
- * @param {String} name
8424
- * @param {Boolean} [strict=true] if false, resolve missing services to null
8733
+ * @param {string} name
8734
+ * @param {boolean} [strict=true] if false, resolve missing services to null
8425
8735
  *
8426
- * @return {Object}
8736
+ * @return {any}
8427
8737
  */
8428
- var get = function(name, strict) {
8738
+ function get(name, strict) {
8429
8739
  if (!providers[name] && name.indexOf('.') !== -1) {
8430
8740
  var parts = name.split('.');
8431
8741
  var pivot = get(parts.shift());
@@ -8455,16 +8765,16 @@
8455
8765
  }
8456
8766
 
8457
8767
  return parent.get(name, strict);
8458
- };
8768
+ }
8459
8769
 
8460
- var fnDef = function(fn, locals) {
8770
+ function fnDef(fn, locals) {
8461
8771
 
8462
8772
  if (typeof locals === 'undefined') {
8463
8773
  locals = {};
8464
8774
  }
8465
8775
 
8466
8776
  if (typeof fn !== 'function') {
8467
- if (isArray$1(fn)) {
8777
+ if (isArray$2(fn)) {
8468
8778
  fn = annotate(fn.slice());
8469
8779
  } else {
8470
8780
  throw new Error('Cannot invoke "' + fn + '". Expected a function!');
@@ -8484,9 +8794,9 @@
8484
8794
  fn: fn,
8485
8795
  dependencies: dependencies
8486
8796
  };
8487
- };
8797
+ }
8488
8798
 
8489
- var instantiate = function(Type) {
8799
+ function instantiate(Type) {
8490
8800
  var def = fnDef(Type);
8491
8801
 
8492
8802
  var fn = def.fn,
@@ -8496,25 +8806,35 @@
8496
8806
  var Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
8497
8807
 
8498
8808
  return new Constructor();
8499
- };
8809
+ }
8500
8810
 
8501
- var invoke = function(func, context, locals) {
8811
+ function invoke(func, context, locals) {
8502
8812
  var def = fnDef(func, locals);
8503
8813
 
8504
8814
  var fn = def.fn,
8505
8815
  dependencies = def.dependencies;
8506
8816
 
8507
8817
  return fn.apply(context, dependencies);
8508
- };
8509
-
8818
+ }
8510
8819
 
8511
- var createPrivateInjectorFactory = function(privateChildInjector) {
8820
+ /**
8821
+ * @param {Injector} childInjector
8822
+ *
8823
+ * @return {Function}
8824
+ */
8825
+ function createPrivateInjectorFactory(childInjector) {
8512
8826
  return annotate(function(key) {
8513
- return privateChildInjector.get(key);
8827
+ return childInjector.get(key);
8514
8828
  });
8515
- };
8829
+ }
8516
8830
 
8517
- var createChild = function(modules, forceNewInstances) {
8831
+ /**
8832
+ * @param {ModuleDefinition[]} modules
8833
+ * @param {string[]} [forceNewInstances]
8834
+ *
8835
+ * @return {Injector}
8836
+ */
8837
+ function createChild(modules, forceNewInstances) {
8518
8838
  if (forceNewInstances && forceNewInstances.length) {
8519
8839
  var fromParentModule = Object.create(null);
8520
8840
  var matchedScopes = Object.create(null);
@@ -8539,12 +8859,12 @@
8539
8859
  privateInjectorsCache.push(provider[3]);
8540
8860
  privateChildInjectors.push(privateChildInjector);
8541
8861
  privateChildFactories.push(privateChildInjectorFactory);
8542
- fromParentModule[name] = [privateChildInjectorFactory, name, 'private', privateChildInjector];
8862
+ fromParentModule[name] = [ privateChildInjectorFactory, name, 'private', privateChildInjector ];
8543
8863
  } else {
8544
- fromParentModule[name] = [privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx]];
8864
+ fromParentModule[name] = [ privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx] ];
8545
8865
  }
8546
8866
  } else {
8547
- fromParentModule[name] = [provider[2], provider[1]];
8867
+ fromParentModule[name] = [ provider[2], provider[1] ];
8548
8868
  }
8549
8869
  matchedScopes[name] = true;
8550
8870
  }
@@ -8553,7 +8873,7 @@
8553
8873
  /* jshint -W083 */
8554
8874
  forceNewInstances.forEach(function(scope) {
8555
8875
  if (provider[1].$scope.indexOf(scope) !== -1) {
8556
- fromParentModule[name] = [provider[2], provider[1]];
8876
+ fromParentModule[name] = [ provider[2], provider[1] ];
8557
8877
  matchedScopes[scope] = true;
8558
8878
  }
8559
8879
  });
@@ -8570,7 +8890,7 @@
8570
8890
  }
8571
8891
 
8572
8892
  return new Injector(modules, self);
8573
- };
8893
+ }
8574
8894
 
8575
8895
  var factoryMap = {
8576
8896
  factory: invoke,
@@ -8580,62 +8900,169 @@
8580
8900
  }
8581
8901
  };
8582
8902
 
8583
- modules.forEach(function(module) {
8903
+ /**
8904
+ * @param {ModuleDefinition} moduleDefinition
8905
+ * @param {Injector} injector
8906
+ */
8907
+ function createInitializer(moduleDefinition, injector) {
8584
8908
 
8585
- function arrayUnwrap(type, value) {
8586
- if (type !== 'value' && isArray$1(value)) {
8587
- value = annotate(value.slice());
8588
- }
8909
+ var initializers = moduleDefinition.__init__ || [];
8589
8910
 
8590
- return value;
8591
- }
8911
+ return function() {
8912
+ initializers.forEach(function(initializer) {
8592
8913
 
8593
- // TODO(vojta): handle wrong inputs (modules)
8594
- if (module instanceof Module) {
8595
- module.forEach(function(provider) {
8596
- var name = provider[0];
8597
- var type = provider[1];
8598
- var value = provider[2];
8914
+ try {
8599
8915
 
8600
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8601
- });
8602
- } else if (typeof module === 'object') {
8603
- if (module.__exports__) {
8604
- var clonedModule = Object.keys(module).reduce(function(m, key) {
8605
- if (key.substring(0, 2) !== '__') {
8606
- m[key] = module[key];
8916
+ // eagerly resolve component (fn or string)
8917
+ if (typeof initializer === 'string') {
8918
+ injector.get(initializer);
8919
+ } else {
8920
+ injector.invoke(initializer);
8607
8921
  }
8608
- return m;
8609
- }, Object.create(null));
8610
-
8611
- var privateInjector = new Injector((module.__modules__ || []).concat([clonedModule]), self);
8612
- var getFromPrivateInjector = annotate(function(key) {
8613
- return privateInjector.get(key);
8614
- });
8615
- module.__exports__.forEach(function(key) {
8616
- providers[key] = [getFromPrivateInjector, key, 'private', privateInjector];
8617
- });
8618
- } else {
8619
- Object.keys(module).forEach(function(name) {
8620
- if (module[name][2] === 'private') {
8621
- providers[name] = module[name];
8622
- return;
8922
+ } catch (error) {
8923
+ if (typeof AggregateError !== 'undefined') {
8924
+ throw new AggregateError([ error ], 'Failed to initialize!');
8623
8925
  }
8624
8926
 
8625
- var type = module[name][0];
8626
- var value = module[name][1];
8927
+ throw new Error('Failed to initialize! ' + error.message);
8928
+ }
8929
+ });
8930
+ };
8931
+ }
8627
8932
 
8628
- providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
8629
- });
8933
+ /**
8934
+ * @param {ModuleDefinition} moduleDefinition
8935
+ */
8936
+ function loadModule(moduleDefinition) {
8937
+
8938
+ var moduleExports = moduleDefinition.__exports__;
8939
+
8940
+ // private module
8941
+ if (moduleExports) {
8942
+ var nestedModules = moduleDefinition.__modules__;
8943
+
8944
+ var clonedModule = Object.keys(moduleDefinition).reduce(function(clonedModule, key) {
8945
+
8946
+ if (key !== '__exports__' && key !== '__modules__' && key !== '__init__' && key !== '__depends__') {
8947
+ clonedModule[key] = moduleDefinition[key];
8948
+ }
8949
+
8950
+ return clonedModule;
8951
+ }, Object.create(null));
8952
+
8953
+ var childModules = (nestedModules || []).concat(clonedModule);
8954
+
8955
+ var privateInjector = createChild(childModules);
8956
+ var getFromPrivateInjector = annotate(function(key) {
8957
+ return privateInjector.get(key);
8958
+ });
8959
+
8960
+ moduleExports.forEach(function(key) {
8961
+ providers[key] = [ getFromPrivateInjector, key, 'private', privateInjector ];
8962
+ });
8963
+
8964
+ // ensure child injector initializes
8965
+ var initializers = (moduleDefinition.__init__ || []).slice();
8966
+
8967
+ initializers.unshift(function() {
8968
+ privateInjector.init();
8969
+ });
8970
+
8971
+ moduleDefinition = Object.assign({}, moduleDefinition, {
8972
+ __init__: initializers
8973
+ });
8974
+
8975
+ return createInitializer(moduleDefinition, privateInjector);
8976
+ }
8977
+
8978
+ // normal module
8979
+ Object.keys(moduleDefinition).forEach(function(key) {
8980
+
8981
+ if (key === '__init__' || key === '__depends__') {
8982
+ return;
8983
+ }
8984
+
8985
+ if (moduleDefinition[key][2] === 'private') {
8986
+ providers[key] = moduleDefinition[key];
8987
+ return;
8630
8988
  }
8989
+
8990
+ var type = moduleDefinition[key][0];
8991
+ var value = moduleDefinition[key][1];
8992
+
8993
+ providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
8994
+ });
8995
+
8996
+ return createInitializer(moduleDefinition, self);
8997
+ }
8998
+
8999
+ /**
9000
+ * @param {ModuleDefinition[]} moduleDefinitions
9001
+ * @param {ModuleDefinition} moduleDefinition
9002
+ *
9003
+ * @return {ModuleDefinition[]}
9004
+ */
9005
+ function resolveDependencies(moduleDefinitions, moduleDefinition) {
9006
+
9007
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9008
+ return moduleDefinitions;
8631
9009
  }
8632
- });
9010
+
9011
+ moduleDefinitions = (moduleDefinition.__depends__ || []).reduce(resolveDependencies, moduleDefinitions);
9012
+
9013
+ if (moduleDefinitions.indexOf(moduleDefinition) !== -1) {
9014
+ return moduleDefinitions;
9015
+ }
9016
+
9017
+ return moduleDefinitions.concat(moduleDefinition);
9018
+ }
9019
+
9020
+ /**
9021
+ * @param {ModuleDefinition[]} moduleDefinitions
9022
+ *
9023
+ * @return { () => void } initializerFn
9024
+ */
9025
+ function bootstrap(moduleDefinitions) {
9026
+
9027
+ var initializers = moduleDefinitions
9028
+ .reduce(resolveDependencies, [])
9029
+ .map(loadModule);
9030
+
9031
+ var initialized = false;
9032
+
9033
+ return function() {
9034
+
9035
+ if (initialized) {
9036
+ return;
9037
+ }
9038
+
9039
+ initialized = true;
9040
+
9041
+ initializers.forEach(function(initializer) {
9042
+ return initializer();
9043
+ });
9044
+ };
9045
+ }
8633
9046
 
8634
9047
  // public API
8635
9048
  this.get = get;
8636
9049
  this.invoke = invoke;
8637
9050
  this.instantiate = instantiate;
8638
9051
  this.createChild = createChild;
9052
+
9053
+ // setup
9054
+ this.init = bootstrap(modules);
9055
+ }
9056
+
9057
+
9058
+ // helpers ///////////////
9059
+
9060
+ function arrayUnwrap(type, value) {
9061
+ if (type !== 'value' && isArray$2(value)) {
9062
+ value = annotate(value.slice());
9063
+ }
9064
+
9065
+ return value;
8639
9066
  }
8640
9067
 
8641
9068
  // apply default renderer with lowest possible priority
@@ -8658,7 +9085,7 @@
8658
9085
  this.FRAME_STYLE = styles.style([ 'no-fill' ], { stroke: 'fuchsia', strokeDasharray: 4, strokeWidth: 2 });
8659
9086
  }
8660
9087
 
8661
- inherits_browser(DefaultRenderer, BaseRenderer);
9088
+ e(DefaultRenderer, BaseRenderer);
8662
9089
 
8663
9090
 
8664
9091
  DefaultRenderer.prototype.canRender = function() {
@@ -8914,7 +9341,7 @@
8914
9341
  var parent = document.createElement('div');
8915
9342
  parent.setAttribute('class', 'djs-container');
8916
9343
 
8917
- assign(parent.style, {
9344
+ assign$1(parent, {
8918
9345
  position: 'relative',
8919
9346
  overflow: 'hidden',
8920
9347
  width: ensurePx(options.width),
@@ -10993,7 +11420,7 @@
10993
11420
  attacherRefs.bind(this, 'attachers');
10994
11421
  }
10995
11422
 
10996
- inherits_browser(Shape, Base);
11423
+ e(Shape, Base);
10997
11424
 
10998
11425
 
10999
11426
  /**
@@ -11008,7 +11435,7 @@
11008
11435
  Shape.call(this);
11009
11436
  }
11010
11437
 
11011
- inherits_browser(Root, Shape);
11438
+ e(Root, Shape);
11012
11439
 
11013
11440
 
11014
11441
  /**
@@ -11031,7 +11458,7 @@
11031
11458
  labelRefs.bind(this, 'labelTarget');
11032
11459
  }
11033
11460
 
11034
- inherits_browser(Label, Shape);
11461
+ e(Label, Shape);
11035
11462
 
11036
11463
 
11037
11464
  /**
@@ -11062,7 +11489,7 @@
11062
11489
  incomingRefs.bind(this, 'target');
11063
11490
  }
11064
11491
 
11065
- inherits_browser(Connection, Base);
11492
+ e(Connection, Base);
11066
11493
 
11067
11494
 
11068
11495
  var types = {
@@ -11913,62 +12340,21 @@
11913
12340
  graphicsFactory: [ 'type', GraphicsFactory ]
11914
12341
  };
11915
12342
 
12343
+ /**
12344
+ * @typedef { import('didi').ModuleDeclaration } Module
12345
+ */
12346
+
11916
12347
  /**
11917
12348
  * Bootstrap an injector from a list of modules, instantiating a number of default components
11918
12349
  *
11919
- * @ignore
11920
- * @param {Array<didi.Module>} bootstrapModules
12350
+ * @param {Array<Module>} modules
11921
12351
  *
11922
- * @return {didi.Injector} a injector to use to access the components
12352
+ * @return {Injector} a injector to use to access the components
11923
12353
  */
11924
- function bootstrap(bootstrapModules) {
11925
-
11926
- var modules = [],
11927
- components = [];
11928
-
11929
- function hasModule(m) {
11930
- return modules.indexOf(m) >= 0;
11931
- }
11932
-
11933
- function addModule(m) {
11934
- modules.push(m);
11935
- }
11936
-
11937
- function visit(m) {
11938
- if (hasModule(m)) {
11939
- return;
11940
- }
11941
-
11942
- (m.__depends__ || []).forEach(visit);
11943
-
11944
- if (hasModule(m)) {
11945
- return;
11946
- }
11947
-
11948
- addModule(m);
11949
-
11950
- (m.__init__ || []).forEach(function(c) {
11951
- components.push(c);
11952
- });
11953
- }
11954
-
11955
- bootstrapModules.forEach(visit);
11956
-
12354
+ function bootstrap(modules) {
11957
12355
  var injector = new Injector(modules);
11958
12356
 
11959
- components.forEach(function(c) {
11960
-
11961
- try {
11962
-
11963
- // eagerly resolve component (fn or string)
11964
- injector[typeof c === 'string' ? 'get' : 'invoke'](c);
11965
- } catch (e) {
11966
- console.error('Failed to instantiate component');
11967
- console.error(e.stack);
11968
-
11969
- throw e;
11970
- }
11971
- });
12357
+ injector.init();
11972
12358
 
11973
12359
  return injector;
11974
12360
  }
@@ -11976,9 +12362,8 @@
11976
12362
  /**
11977
12363
  * Creates an injector from passed options.
11978
12364
  *
11979
- * @ignore
11980
- * @param {Object} options
11981
- * @return {didi.Injector}
12365
+ * @param {Object} options
12366
+ * @return {Injector}
11982
12367
  */
11983
12368
  function createInjector(options) {
11984
12369
 
@@ -11998,7 +12383,7 @@
11998
12383
  * The main diagram-js entry point that bootstraps the diagram with the given
11999
12384
  * configuration.
12000
12385
  *
12001
- * To register extensions with the diagram, pass them as Array<didi.Module> to the constructor.
12386
+ * To register extensions with the diagram, pass them as Array<Module> to the constructor.
12002
12387
  *
12003
12388
  * @class djs.Diagram
12004
12389
  * @memberOf djs
@@ -12040,8 +12425,8 @@
12040
12425
  * // 'shape ... was added to the diagram' logged to console
12041
12426
  *
12042
12427
  * @param {Object} options
12043
- * @param {Array<didi.Module>} [options.modules] external modules to instantiate with the diagram
12044
- * @param {didi.Injector} [injector] an (optional) injector to bootstrap the diagram with
12428
+ * @param {Array<Module>} [options.modules] external modules to instantiate with the diagram
12429
+ * @param {Injector} [injector] an (optional) injector to bootstrap the diagram with
12045
12430
  */
12046
12431
  function Diagram(options, injector) {
12047
12432
 
@@ -12706,7 +13091,7 @@
12706
13091
 
12707
13092
  var propertyName = property && property.name;
12708
13093
 
12709
- if (isUndefined$1(value)) {
13094
+ if (isUndefined$2(value)) {
12710
13095
  // unset the property, if the specified value is undefined;
12711
13096
  // delete from $attrs (for extensions) or the target itself
12712
13097
  if (property) {
@@ -12797,7 +13182,7 @@
12797
13182
  };
12798
13183
 
12799
13184
 
12800
- function isUndefined$1(val) {
13185
+ function isUndefined$2(val) {
12801
13186
  return typeof val === 'undefined';
12802
13187
  }
12803
13188
 
@@ -20244,7 +20629,7 @@
20244
20629
  }
20245
20630
 
20246
20631
  /**
20247
- * Returns all diagrams in the same hirarchy as the requested diagram.
20632
+ * Returns all diagrams in the same hierarchy as the requested diagram.
20248
20633
  * Includes all parent and sub process diagrams.
20249
20634
  *
20250
20635
  * @param {Array} definitions
@@ -20352,53 +20737,53 @@
20352
20737
 
20353
20738
 
20354
20739
  // inlined ../../resources/logo.svg
20355
- 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>';
20740
+ 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>';
20356
20741
 
20357
20742
  var BPMNIO_IMG = BPMNIO_LOGO_SVG;
20358
20743
 
20359
- function css(attrs) {
20360
- return attrs.join(';');
20361
- }
20362
-
20363
- var LINK_STYLES = css([
20364
- 'color: #404040'
20365
- ]);
20366
-
20367
- var LIGHTBOX_STYLES = css([
20368
- 'z-index: 1001',
20369
- 'position: fixed',
20370
- 'top: 0',
20371
- 'left: 0',
20372
- 'right: 0',
20373
- 'bottom: 0'
20374
- ]);
20375
-
20376
- var BACKDROP_STYLES = css([
20377
- 'width: 100%',
20378
- 'height: 100%',
20379
- 'background: rgba(40,40,40,0.2)'
20380
- ]);
20381
-
20382
- var NOTICE_STYLES = css([
20383
- 'position: absolute',
20384
- 'left: 50%',
20385
- 'top: 40%',
20386
- 'transform: translate(-50%)',
20387
- 'width: 260px',
20388
- 'padding: 10px',
20389
- 'background: white',
20390
- 'box-shadow: 0 1px 4px rgba(0,0,0,0.3)',
20391
- 'font-family: Helvetica, Arial, sans-serif',
20392
- 'font-size: 14px',
20393
- 'display: flex',
20394
- 'line-height: 1.3'
20395
- ]);
20744
+ var LOGO_STYLES = {
20745
+ verticalAlign: 'middle'
20746
+ };
20747
+
20748
+ var LINK_STYLES = {
20749
+ 'color': '#404040'
20750
+ };
20751
+
20752
+ var LIGHTBOX_STYLES = {
20753
+ 'zIndex': '1001',
20754
+ 'position': 'fixed',
20755
+ 'top': '0',
20756
+ 'left': '0',
20757
+ 'right': '0',
20758
+ 'bottom': '0'
20759
+ };
20760
+
20761
+ var BACKDROP_STYLES = {
20762
+ 'width': '100%',
20763
+ 'height': '100%',
20764
+ 'background': 'rgba(40,40,40,0.2)'
20765
+ };
20766
+
20767
+ var NOTICE_STYLES = {
20768
+ 'position': 'absolute',
20769
+ 'left': '50%',
20770
+ 'top': '40%',
20771
+ 'transform': 'translate(-50%)',
20772
+ 'width': '260px',
20773
+ 'padding': '10px',
20774
+ 'background': 'white',
20775
+ 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',
20776
+ 'fontFamily': 'Helvetica, Arial, sans-serif',
20777
+ 'fontSize': '14px',
20778
+ 'display': 'flex',
20779
+ 'lineHeight': '1.3'
20780
+ };
20396
20781
 
20397
20782
  var LIGHTBOX_MARKUP =
20398
- '<div class="bjs-powered-by-lightbox" style="' + LIGHTBOX_STYLES + '">' +
20399
- '<div class="backdrop" style="' + BACKDROP_STYLES + '"></div>' +
20400
- '<div class="notice" style="' + NOTICE_STYLES + '">' +
20401
- '<a href="https://bpmn.io" target="_blank" rel="noopener" style="margin: 15px 20px 15px 10px; align-self: center;' + LINK_STYLES + '">' +
20783
+ '<div class="bjs-powered-by-lightbox">' +
20784
+ '<div class="backdrop"></div>' +
20785
+ '<div class="notice">' +
20786
+ '<a href="https://bpmn.io" target="_blank" rel="noopener" class="link">' +
20402
20787
  BPMNIO_IMG +
20403
20788
  '</a>' +
20404
20789
  '<span>' +
@@ -20411,10 +20796,23 @@
20411
20796
 
20412
20797
  var lightbox;
20413
20798
 
20799
+ function createLightbox() {
20800
+ lightbox = domify(LIGHTBOX_MARKUP);
20801
+
20802
+ assign$1(lightbox, LIGHTBOX_STYLES);
20803
+ assign$1(query('svg', lightbox), LOGO_STYLES);
20804
+ assign$1(query('.backdrop', lightbox), BACKDROP_STYLES);
20805
+ assign$1(query('.notice', lightbox), NOTICE_STYLES);
20806
+ assign$1(query('.link', lightbox), LINK_STYLES, {
20807
+ 'margin': '15px 20px 15px 10px',
20808
+ 'alignSelf': 'center'
20809
+ });
20810
+ }
20811
+
20414
20812
  function open() {
20415
20813
 
20416
20814
  if (!lightbox) {
20417
- lightbox = domify(LIGHTBOX_MARKUP);
20815
+ createLightbox();
20418
20816
 
20419
20817
  delegate.bind(lightbox, '.backdrop', 'click', function(event) {
20420
20818
  document.body.removeChild(lightbox);
@@ -20462,7 +20860,7 @@
20462
20860
  this._init(this._container, this._moddle, options);
20463
20861
  }
20464
20862
 
20465
- inherits_browser(BaseViewer, Diagram);
20863
+ e(BaseViewer, Diagram);
20466
20864
 
20467
20865
  /**
20468
20866
  * The importXML result.
@@ -21050,7 +21448,7 @@
21050
21448
 
21051
21449
  var container = domify('<div class="bjs-container"></div>');
21052
21450
 
21053
- assign(container.style, {
21451
+ assign$1(container, {
21054
21452
  width: ensureUnit(options.width),
21055
21453
  height: ensureUnit(options.height),
21056
21454
  position: options.position
@@ -21140,12 +21538,20 @@
21140
21538
  'target="_blank" ' +
21141
21539
  'class="bjs-powered-by" ' +
21142
21540
  'title="Powered by bpmn.io" ' +
21143
- 'style="position: absolute; bottom: 15px; right: 15px; z-index: 100; ' + LINK_STYLES + '">' +
21541
+ '>' +
21144
21542
  img +
21145
21543
  '</a>';
21146
21544
 
21147
21545
  var linkElement = domify(linkMarkup);
21148
21546
 
21547
+ assign$1(query('svg', linkElement), LOGO_STYLES);
21548
+ assign$1(linkElement, LINK_STYLES, {
21549
+ position: 'absolute',
21550
+ bottom: '15px',
21551
+ right: '15px',
21552
+ zIndex: '100'
21553
+ });
21554
+
21149
21555
  container.appendChild(linkElement);
21150
21556
 
21151
21557
  componentEvent.bind(linkElement, 'click', function(event) {
@@ -21208,7 +21614,7 @@
21208
21614
  BaseViewer.call(this, options);
21209
21615
  }
21210
21616
 
21211
- inherits_browser(Viewer, BaseViewer);
21617
+ e(Viewer, BaseViewer);
21212
21618
 
21213
21619
  // modules the viewer is composed of
21214
21620
  Viewer.prototype._modules = [
@@ -22394,27 +22800,27 @@
22394
22800
  emumerations: emumerations
22395
22801
  };
22396
22802
 
22397
- const commonModdleExtensions = {
22398
- camunda: camundaModdle
22803
+ const commonModdleExtensions = {
22804
+ camunda: camundaModdle
22399
22805
  };
22400
22806
 
22401
- /**
22402
- *
22403
- * @param {Object} options
22404
- */
22405
- function Viewer$1(options = {}) {
22406
-
22407
- options = {
22408
- ...options,
22409
- moddleExtensions: {
22410
- ...commonModdleExtensions,
22411
- ...options.moddleExtensions
22412
- }
22413
- };
22414
-
22415
- Viewer.call(this, options);
22416
- }
22417
-
22807
+ /**
22808
+ *
22809
+ * @param {Object} options
22810
+ */
22811
+ function Viewer$1(options = {}) {
22812
+
22813
+ options = {
22814
+ ...options,
22815
+ moddleExtensions: {
22816
+ ...commonModdleExtensions,
22817
+ ...options.moddleExtensions
22818
+ }
22819
+ };
22820
+
22821
+ Viewer.call(this, options);
22822
+ }
22823
+
22418
22824
  inherits_browser(Viewer$1, Viewer);
22419
22825
 
22420
22826
  return Viewer$1;