camunda-bpmn-js 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +3 -5
  2. package/dist/assets/bpmn-font/css/bpmn-codes.css +6 -6
  3. package/dist/assets/bpmn-font/css/bpmn-embedded.css +18 -13
  4. package/dist/assets/bpmn-font/css/bpmn.css +14 -15
  5. package/dist/assets/bpmn-font/font/bpmn.eot +0 -0
  6. package/dist/assets/bpmn-font/font/bpmn.svg +12 -12
  7. package/dist/assets/bpmn-font/font/bpmn.ttf +0 -0
  8. package/dist/assets/bpmn-font/font/bpmn.woff +0 -0
  9. package/dist/assets/bpmn-font/font/bpmn.woff2 +0 -0
  10. package/dist/assets/diagram-js.css +6 -3
  11. package/dist/assets/properties-panel.css +4 -0
  12. package/dist/base-modeler.development.js +2520 -1105
  13. package/dist/base-modeler.production.min.js +39 -39
  14. package/dist/base-navigated-viewer.development.js +324 -219
  15. package/dist/base-navigated-viewer.production.min.js +2 -2
  16. package/dist/base-viewer.development.js +324 -219
  17. package/dist/base-viewer.production.min.js +2 -2
  18. package/dist/camunda-cloud-modeler.development.js +2546 -1118
  19. package/dist/camunda-cloud-modeler.production.min.js +39 -39
  20. package/dist/camunda-cloud-navigated-viewer.development.js +324 -219
  21. package/dist/camunda-cloud-navigated-viewer.production.min.js +2 -2
  22. package/dist/camunda-cloud-viewer.development.js +324 -219
  23. package/dist/camunda-cloud-viewer.production.min.js +2 -2
  24. package/dist/camunda-platform-modeler.development.js +2530 -1116
  25. package/dist/camunda-platform-modeler.production.min.js +39 -39
  26. package/dist/camunda-platform-navigated-viewer.development.js +324 -219
  27. package/dist/camunda-platform-navigated-viewer.production.min.js +2 -2
  28. package/dist/camunda-platform-viewer.development.js +324 -219
  29. package/dist/camunda-platform-viewer.production.min.js +2 -2
  30. package/lib/camunda-cloud/Modeler.js +12 -0
  31. package/package.json +20 -7
  32. package/dist/assets/bpmn-font/bpmn-codes.css +0 -108
  33. package/dist/assets/bpmn-font/bpmn-embedded.css +0 -161
  34. package/dist/assets/bpmn-font/bpmn.css +0 -164
  35. package/dist/assets/bpmn-font/bpmn.eot +0 -0
  36. package/dist/assets/bpmn-font/bpmn.svg +0 -224
  37. package/dist/assets/bpmn-font/bpmn.ttf +0 -0
  38. package/dist/assets/bpmn-font/bpmn.woff +0 -0
  39. package/dist/assets/bpmn-font/bpmn.woff2 +0 -0
@@ -1291,9 +1291,13 @@
1291
1291
 
1292
1292
  var componentEvent = {};
1293
1293
 
1294
- var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
1295
- unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
1296
- prefix$7 = bind$1 !== 'addEventListener' ? 'on' : '';
1294
+ var bind$1, unbind$1, prefix$7;
1295
+
1296
+ function detect () {
1297
+ bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent';
1298
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
1299
+ prefix$7 = bind$1 !== 'addEventListener' ? 'on' : '';
1300
+ }
1297
1301
 
1298
1302
  /**
1299
1303
  * Bind `el` event `type` to `fn`.
@@ -1307,6 +1311,7 @@
1307
1311
  */
1308
1312
 
1309
1313
  var bind_1 = componentEvent.bind = function(el, type, fn, capture){
1314
+ if (!bind$1) detect();
1310
1315
  el[bind$1](prefix$7 + type, fn, capture || false);
1311
1316
  return fn;
1312
1317
  };
@@ -1323,6 +1328,7 @@
1323
1328
  */
1324
1329
 
1325
1330
  var unbind_1 = componentEvent.unbind = function(el, type, fn, capture){
1331
+ if (!unbind$1) detect();
1326
1332
  el[unbind$1](prefix$7 + type, fn, capture || false);
1327
1333
  return fn;
1328
1334
  };
@@ -2755,34 +2761,128 @@
2755
2761
  */
2756
2762
  BaseRenderer.prototype.getConnectionPath = function() {};
2757
2763
 
2764
+ /**
2765
+ * @param { [ string, ...any[] ][] } elements
2766
+ *
2767
+ * @return { string }
2768
+ */
2758
2769
  function componentsToPath(elements) {
2759
- return elements.join(',').replace(/,?([A-z]),?/g, '$1');
2770
+ return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
2760
2771
  }
2761
2772
 
2762
- function toSVGPoints(points) {
2763
- var result = '';
2773
+ function move(point) {
2774
+ return [ 'M', point.x, point.y ];
2775
+ }
2776
+
2777
+ function lineTo(point) {
2778
+ return [ 'L', point.x, point.y ];
2779
+ }
2764
2780
 
2765
- for (var i = 0, p; (p = points[i]); i++) {
2766
- result += p.x + ',' + p.y + ' ';
2781
+ function curveTo(p1, p2, p3) {
2782
+ return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
2783
+ }
2784
+
2785
+ function drawPath(waypoints, cornerRadius) {
2786
+ const pointCount = waypoints.length;
2787
+
2788
+ const path = [ move(waypoints[0]) ];
2789
+
2790
+ for (let i = 1; i < pointCount; i++) {
2791
+
2792
+ const pointBefore = waypoints[i - 1];
2793
+ const point = waypoints[i];
2794
+ const pointAfter = waypoints[i + 1];
2795
+
2796
+ if (!pointAfter || !cornerRadius) {
2797
+ path.push(lineTo(point));
2798
+
2799
+ continue;
2800
+ }
2801
+
2802
+ const effectiveRadius = Math.min(
2803
+ cornerRadius,
2804
+ vectorLength$1(point.x - pointBefore.x, point.y - pointBefore.y),
2805
+ vectorLength$1(pointAfter.x - point.x, pointAfter.y - point.y)
2806
+ );
2807
+
2808
+ if (!effectiveRadius) {
2809
+ path.push(lineTo(point));
2810
+
2811
+ continue;
2812
+ }
2813
+
2814
+ const beforePoint = getPointAtLength(point, pointBefore, effectiveRadius);
2815
+ const beforePoint2 = getPointAtLength(point, pointBefore, effectiveRadius * .5);
2816
+
2817
+ const afterPoint = getPointAtLength(point, pointAfter, effectiveRadius);
2818
+ const afterPoint2 = getPointAtLength(point, pointAfter, effectiveRadius * .5);
2819
+
2820
+ path.push(lineTo(beforePoint));
2821
+ path.push(curveTo(beforePoint2, afterPoint2, afterPoint));
2767
2822
  }
2768
2823
 
2769
- return result;
2824
+ return path;
2770
2825
  }
2771
2826
 
2772
- function createLine(points, attrs) {
2827
+ function getPointAtLength(start, end, length) {
2773
2828
 
2774
- var line = create$1('polyline');
2775
- attr(line, { points: toSVGPoints(points) });
2829
+ const deltaX = end.x - start.x;
2830
+ const deltaY = end.y - start.y;
2776
2831
 
2777
- if (attrs) {
2778
- attr(line, attrs);
2832
+ const totalLength = vectorLength$1(deltaX, deltaY);
2833
+
2834
+ const percent = length / totalLength;
2835
+
2836
+ return {
2837
+ x: start.x + deltaX * percent,
2838
+ y: start.y + deltaY * percent
2839
+ };
2840
+ }
2841
+
2842
+ function vectorLength$1(x, y) {
2843
+ return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
2844
+ }
2845
+
2846
+ /**
2847
+ * @param { { x: number, y: number }[] } points
2848
+ * @param { any } [attrs]
2849
+ * @param { number } [radius]
2850
+ *
2851
+ * @return {SVGElement}
2852
+ */
2853
+ function createLine(points, attrs, radius) {
2854
+
2855
+ if (isNumber(attrs)) {
2856
+ radius = attrs;
2857
+ attrs = null;
2779
2858
  }
2780
2859
 
2781
- return line;
2860
+ if (!attrs) {
2861
+ attrs = {};
2862
+ }
2863
+
2864
+ const line = create$1('path', attrs);
2865
+
2866
+ if (isNumber(radius)) {
2867
+ line.dataset.cornerRadius = String(radius);
2868
+ }
2869
+
2870
+ return updateLine(line, points);
2782
2871
  }
2783
2872
 
2873
+ /**
2874
+ * @param { SVGElement } gfx
2875
+ * @param { { x: number, y: number }[]} points
2876
+ *
2877
+ * @return {SVGElement}
2878
+ */
2784
2879
  function updateLine(gfx, points) {
2785
- attr(gfx, { points: toSVGPoints(points) });
2880
+
2881
+ const cornerRadius = parseInt(gfx.dataset.cornerRadius, 10) || 0;
2882
+
2883
+ attr(gfx, {
2884
+ d: componentsToPath(drawPath(points, cornerRadius))
2885
+ });
2786
2886
 
2787
2887
  return gfx;
2788
2888
  }
@@ -3443,65 +3543,42 @@
3443
3543
  /**
3444
3544
  * Check whether two points are horizontally or vertically aligned.
3445
3545
  *
3446
- * @param {Array<Point>|Point}
3447
- * @param {Point}
3546
+ * @param {Point[]|Point} a
3547
+ * @param {Point} [b]
3448
3548
  *
3449
- * @return {string|boolean}
3549
+ * @return {'h'|'v'|false} axis or false
3450
3550
  */
3451
3551
  function pointsAligned(a, b) {
3452
- var points;
3453
-
3454
- if (isArray$3(a)) {
3455
- points = a;
3456
- } else {
3457
- points = [ a, b ];
3458
- }
3552
+ var points = Array.from(arguments).flat();
3459
3553
 
3460
- if (pointsAlignedHorizontally(points)) {
3461
- return 'h';
3462
- }
3554
+ const axisMap = {
3555
+ 'x': 'v',
3556
+ 'y': 'h'
3557
+ };
3463
3558
 
3464
- if (pointsAlignedVertically(points)) {
3465
- return 'v';
3559
+ for (const [ axis, orientation ] of Object.entries(axisMap)) {
3560
+ if (pointsAlignedOnAxis(axis, points)) {
3561
+ return orientation;
3562
+ }
3466
3563
  }
3467
3564
 
3468
3565
  return false;
3469
3566
  }
3470
3567
 
3471
- function pointsAlignedHorizontally(a, b) {
3472
- var points;
3473
-
3474
- if (isArray$3(a)) {
3475
- points = a;
3476
- } else {
3477
- points = [ a, b ];
3478
- }
3479
-
3480
- var firstPoint = points.slice().shift();
3481
-
3482
- return every(points, function(point) {
3483
- return Math.abs(firstPoint.y - point.y) <= ALIGNED_THRESHOLD;
3484
- });
3485
- }
3486
-
3487
- function pointsAlignedVertically(a, b) {
3488
- var points;
3489
-
3490
- if (isArray$3(a)) {
3491
- points = a;
3492
- } else {
3493
- points = [ a, b ];
3494
- }
3495
-
3496
- var firstPoint = points.slice().shift();
3568
+ /**
3569
+ * @param { 'x' | 'y' } axis
3570
+ * @param { Point[] } points
3571
+ *
3572
+ * @return {boolean}
3573
+ */
3574
+ function pointsAlignedOnAxis(axis, points) {
3575
+ const referencePoint = points[0];
3497
3576
 
3498
3577
  return every(points, function(point) {
3499
- return Math.abs(firstPoint.x - point.x) <= ALIGNED_THRESHOLD;
3578
+ return Math.abs(referencePoint[axis] - point[axis]) <= ALIGNED_THRESHOLD;
3500
3579
  });
3501
3580
  }
3502
3581
 
3503
-
3504
-
3505
3582
  /**
3506
3583
  * Returns true if the point p is inside the rectangle rect
3507
3584
  *
@@ -4625,7 +4702,7 @@
4625
4702
  * @return {Point}
4626
4703
  */
4627
4704
  function getMid(element) {
4628
- if (isConnection$g(element)) {
4705
+ if (isConnection$h(element)) {
4629
4706
  return getConnectionMid(element);
4630
4707
  }
4631
4708
 
@@ -4765,7 +4842,7 @@
4765
4842
  return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
4766
4843
  }
4767
4844
 
4768
- function isConnection$g(element) {
4845
+ function isConnection$h(element) {
4769
4846
  return !!element.waypoints;
4770
4847
  }
4771
4848
 
@@ -16424,6 +16501,11 @@
16424
16501
  * @see http://bpmn.io/license for more information.
16425
16502
  */
16426
16503
 
16504
+
16505
+ /**
16506
+ * @typedef { import('didi').ModuleDeclaration } Module
16507
+ */
16508
+
16427
16509
  /**
16428
16510
  * A base viewer for BPMN 2.0 diagrams.
16429
16511
  *
@@ -16435,8 +16517,8 @@
16435
16517
  * @param {string|number} [options.width] the width of the viewer
16436
16518
  * @param {string|number} [options.height] the height of the viewer
16437
16519
  * @param {Object} [options.moddleExtensions] extension packages to provide
16438
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
16439
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
16520
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
16521
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
16440
16522
  */
16441
16523
  function BaseViewer(options) {
16442
16524
 
@@ -16865,7 +16947,14 @@
16865
16947
  this._definitions = definitions;
16866
16948
  };
16867
16949
 
16868
- BaseViewer.prototype.getModules = function() {
16950
+ /**
16951
+ * Return modules to instantiate with.
16952
+ *
16953
+ * @param {any} options the instance got created with
16954
+ *
16955
+ * @return {Module[]}
16956
+ */
16957
+ BaseViewer.prototype.getModules = function(options) {
16869
16958
  return this._modules;
16870
16959
  };
16871
16960
 
@@ -16971,7 +17060,7 @@
16971
17060
 
16972
17061
  BaseViewer.prototype._init = function(container, moddle, options) {
16973
17062
 
16974
- const baseModules = options.modules || this.getModules(),
17063
+ const baseModules = options.modules || this.getModules(options),
16975
17064
  additionalModules = options.additionalModules || [],
16976
17065
  staticModules = [
16977
17066
  {
@@ -17126,6 +17215,10 @@
17126
17215
 
17127
17216
  /* </project-logo> */
17128
17217
 
17218
+ /**
17219
+ * @typedef { import('didi').ModuleDeclaration } Module
17220
+ */
17221
+
17129
17222
  /**
17130
17223
  * A base modeler for BPMN 2.0 diagrams.
17131
17224
  *
@@ -17136,8 +17229,8 @@
17136
17229
  * @param {string|number} [options.width] the width of the viewer
17137
17230
  * @param {string|number} [options.height] the height of the viewer
17138
17231
  * @param {Object} [options.moddleExtensions] extension packages to provide
17139
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
17140
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
17232
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
17233
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
17141
17234
  */
17142
17235
  function BaseModeler(options) {
17143
17236
  BaseViewer.call(this, options);
@@ -17225,7 +17318,7 @@
17225
17318
  return element && !!getBusinessObject$1(element).triggeredByEvent;
17226
17319
  }
17227
17320
 
17228
- function hasEventDefinition$2(element, eventType) {
17321
+ function hasEventDefinition$3(element, eventType) {
17229
17322
  var bo = getBusinessObject$1(element),
17230
17323
  hasEventDefinition = false;
17231
17324
 
@@ -17241,15 +17334,15 @@
17241
17334
  }
17242
17335
 
17243
17336
  function hasErrorEventDefinition(element) {
17244
- return hasEventDefinition$2(element, 'bpmn:ErrorEventDefinition');
17337
+ return hasEventDefinition$3(element, 'bpmn:ErrorEventDefinition');
17245
17338
  }
17246
17339
 
17247
17340
  function hasEscalationEventDefinition(element) {
17248
- return hasEventDefinition$2(element, 'bpmn:EscalationEventDefinition');
17341
+ return hasEventDefinition$3(element, 'bpmn:EscalationEventDefinition');
17249
17342
  }
17250
17343
 
17251
17344
  function hasCompensateEventDefinition(element) {
17252
- return hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
17345
+ return hasEventDefinition$3(element, 'bpmn:CompensateEventDefinition');
17253
17346
  }
17254
17347
 
17255
17348
  function getLabelAttr(semantic) {
@@ -17484,33 +17577,33 @@
17484
17577
 
17485
17578
  var markers = {};
17486
17579
 
17487
- var computeStyle = styles.computeStyle;
17488
-
17489
- function addMarker(id, options) {
17490
- var attrs = assign$1({
17491
- fill: black,
17492
- strokeWidth: 1,
17580
+ function shapeStyle(attrs) {
17581
+ return styles.computeStyle(attrs, {
17493
17582
  strokeLinecap: 'round',
17494
- strokeDasharray: 'none'
17495
- }, options.attrs);
17496
-
17497
- var ref = options.ref || { x: 0, y: 0 };
17498
-
17499
- var scale = options.scale || 1;
17500
-
17501
- // fix for safari / chrome / firefox bug not correctly
17502
- // resetting stroke dash array
17503
- if (attrs.strokeDasharray === 'none') {
17504
- attrs.strokeDasharray = [ 10000, 1 ];
17505
- }
17506
-
17507
- var marker = create$1('marker');
17583
+ strokeLinejoin: 'round',
17584
+ stroke: black,
17585
+ strokeWidth: 2,
17586
+ fill: 'white'
17587
+ });
17588
+ }
17508
17589
 
17509
- attr(options.element, attrs);
17590
+ function lineStyle(attrs) {
17591
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
17592
+ strokeLinecap: 'round',
17593
+ strokeLinejoin: 'round',
17594
+ stroke: black,
17595
+ strokeWidth: 2
17596
+ });
17597
+ }
17510
17598
 
17511
- append(marker, options.element);
17599
+ function addMarker(id, options) {
17600
+ var {
17601
+ ref = { x: 0, y: 0 },
17602
+ scale = 1,
17603
+ element
17604
+ } = options;
17512
17605
 
17513
- attr(marker, {
17606
+ var marker = create$1('marker', {
17514
17607
  id: id,
17515
17608
  viewBox: '0 0 20 20',
17516
17609
  refX: ref.x,
@@ -17520,6 +17613,8 @@
17520
17613
  orient: 'auto'
17521
17614
  });
17522
17615
 
17616
+ append(marker, element);
17617
+
17523
17618
  var defs = query('defs', canvas._svg);
17524
17619
 
17525
17620
  if (!defs) {
@@ -17552,105 +17647,116 @@
17552
17647
  function createMarker(id, type, fill, stroke) {
17553
17648
 
17554
17649
  if (type === 'sequenceflow-end') {
17555
- var sequenceflowEnd = create$1('path');
17556
- attr(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
17650
+ var sequenceflowEnd = create$1('path', {
17651
+ d: 'M 1 5 L 11 10 L 1 15 Z',
17652
+ ...shapeStyle({
17653
+ fill: stroke,
17654
+ stroke: stroke,
17655
+ strokeWidth: 1
17656
+ })
17657
+ });
17557
17658
 
17558
17659
  addMarker(id, {
17559
17660
  element: sequenceflowEnd,
17560
17661
  ref: { x: 11, y: 10 },
17561
- scale: 0.5,
17562
- attrs: {
17563
- fill: stroke,
17564
- stroke: stroke
17565
- }
17662
+ scale: 0.5
17566
17663
  });
17567
17664
  }
17568
17665
 
17569
17666
  if (type === 'messageflow-start') {
17570
- var messageflowStart = create$1('circle');
17571
- attr(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
17667
+ var messageflowStart = create$1('circle', {
17668
+ cx: 6,
17669
+ cy: 6,
17670
+ r: 3.5,
17671
+ ...shapeStyle({
17672
+ fill: fill,
17673
+ stroke: stroke,
17674
+ strokeWidth: 1
17675
+ })
17676
+ });
17572
17677
 
17573
17678
  addMarker(id, {
17574
17679
  element: messageflowStart,
17575
- attrs: {
17576
- fill: fill,
17577
- stroke: stroke
17578
- },
17579
17680
  ref: { x: 6, y: 6 }
17580
17681
  });
17581
17682
  }
17582
17683
 
17583
17684
  if (type === 'messageflow-end') {
17584
- var messageflowEnd = create$1('path');
17585
- attr(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
17685
+ var messageflowEnd = create$1('path', {
17686
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
17687
+ ...shapeStyle({
17688
+ fill: fill,
17689
+ stroke: stroke,
17690
+ strokeWidth: 1
17691
+ })
17692
+ });
17586
17693
 
17587
17694
  addMarker(id, {
17588
17695
  element: messageflowEnd,
17589
- attrs: {
17590
- fill: fill,
17591
- stroke: stroke,
17592
- strokeLinecap: 'butt'
17593
- },
17594
17696
  ref: { x: 8.5, y: 5 }
17595
17697
  });
17596
17698
  }
17597
17699
 
17598
17700
  if (type === 'association-start') {
17599
- var associationStart = create$1('path');
17600
- attr(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
17601
-
17602
- addMarker(id, {
17603
- element: associationStart,
17604
- attrs: {
17701
+ var associationStart = create$1('path', {
17702
+ d: 'M 11 5 L 1 10 L 11 15',
17703
+ ...lineStyle({
17605
17704
  fill: 'none',
17606
17705
  stroke: stroke,
17607
17706
  strokeWidth: 1.5
17608
- },
17707
+ })
17708
+ });
17709
+
17710
+ addMarker(id, {
17711
+ element: associationStart,
17609
17712
  ref: { x: 1, y: 10 },
17610
17713
  scale: 0.5
17611
17714
  });
17612
17715
  }
17613
17716
 
17614
17717
  if (type === 'association-end') {
17615
- var associationEnd = create$1('path');
17616
- attr(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
17617
-
17618
- addMarker(id, {
17619
- element: associationEnd,
17620
- attrs: {
17718
+ var associationEnd = create$1('path', {
17719
+ d: 'M 1 5 L 11 10 L 1 15',
17720
+ ...lineStyle({
17621
17721
  fill: 'none',
17622
17722
  stroke: stroke,
17623
17723
  strokeWidth: 1.5
17624
- },
17625
- ref: { x: 12, y: 10 },
17724
+ })
17725
+ });
17726
+
17727
+ addMarker(id, {
17728
+ element: associationEnd,
17729
+ ref: { x: 11, y: 10 },
17626
17730
  scale: 0.5
17627
17731
  });
17628
17732
  }
17629
17733
 
17630
17734
  if (type === 'conditional-flow-marker') {
17631
- var conditionalflowMarker = create$1('path');
17632
- attr(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
17633
-
17634
- addMarker(id, {
17635
- element: conditionalflowMarker,
17636
- attrs: {
17735
+ var conditionalFlowMarker = create$1('path', {
17736
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
17737
+ ...shapeStyle({
17637
17738
  fill: fill,
17638
17739
  stroke: stroke
17639
- },
17740
+ })
17741
+ });
17742
+
17743
+ addMarker(id, {
17744
+ element: conditionalFlowMarker,
17640
17745
  ref: { x: -1, y: 10 },
17641
17746
  scale: 0.5
17642
17747
  });
17643
17748
  }
17644
17749
 
17645
17750
  if (type === 'conditional-default-flow-marker') {
17646
- var conditionaldefaultflowMarker = create$1('path');
17647
- attr(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
17751
+ var defaultFlowMarker = create$1('path', {
17752
+ d: 'M 6 4 L 10 16',
17753
+ ...shapeStyle({
17754
+ stroke: stroke
17755
+ })
17756
+ });
17648
17757
 
17649
17758
  addMarker(id, {
17650
- element: conditionaldefaultflowMarker,
17651
- attrs: {
17652
- stroke: stroke
17653
- },
17759
+ element: defaultFlowMarker,
17654
17760
  ref: { x: 0, y: 10 },
17655
17761
  scale: 0.5
17656
17762
  });
@@ -17666,11 +17772,7 @@
17666
17772
 
17667
17773
  offset = offset || 0;
17668
17774
 
17669
- attrs = computeStyle(attrs, {
17670
- stroke: black,
17671
- strokeWidth: 2,
17672
- fill: 'white'
17673
- });
17775
+ attrs = shapeStyle(attrs);
17674
17776
 
17675
17777
  if (attrs.fill === 'none') {
17676
17778
  delete attrs.fillOpacity;
@@ -17679,13 +17781,12 @@
17679
17781
  var cx = width / 2,
17680
17782
  cy = height / 2;
17681
17783
 
17682
- var circle = create$1('circle');
17683
- attr(circle, {
17784
+ var circle = create$1('circle', {
17684
17785
  cx: cx,
17685
17786
  cy: cy,
17686
- r: Math.round((width + height) / 4 - offset)
17787
+ r: Math.round((width + height) / 4 - offset),
17788
+ ...attrs
17687
17789
  });
17688
- attr(circle, attrs);
17689
17790
 
17690
17791
  append(parentGfx, circle);
17691
17792
 
@@ -17701,22 +17802,17 @@
17701
17802
 
17702
17803
  offset = offset || 0;
17703
17804
 
17704
- attrs = computeStyle(attrs, {
17705
- stroke: black,
17706
- strokeWidth: 2,
17707
- fill: 'white'
17708
- });
17805
+ attrs = shapeStyle(attrs);
17709
17806
 
17710
- var rect = create$1('rect');
17711
- attr(rect, {
17807
+ var rect = create$1('rect', {
17712
17808
  x: offset,
17713
17809
  y: offset,
17714
17810
  width: width - offset * 2,
17715
17811
  height: height - offset * 2,
17716
17812
  rx: r,
17717
- ry: r
17813
+ ry: r,
17814
+ ...attrs
17718
17815
  });
17719
- attr(rect, attrs);
17720
17816
 
17721
17817
  append(parentGfx, rect);
17722
17818
 
@@ -17728,53 +17824,66 @@
17728
17824
  var x_2 = width / 2;
17729
17825
  var y_2 = height / 2;
17730
17826
 
17731
- var points = [ { x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 } ];
17827
+ var points = [
17828
+ { x: x_2, y: 0 },
17829
+ { x: width, y: y_2 },
17830
+ { x: x_2, y: height },
17831
+ { x: 0, y: y_2 }
17832
+ ];
17732
17833
 
17733
17834
  var pointsString = points.map(function(point) {
17734
17835
  return point.x + ',' + point.y;
17735
17836
  }).join(' ');
17736
17837
 
17737
- attrs = computeStyle(attrs, {
17738
- stroke: black,
17739
- strokeWidth: 2,
17740
- fill: 'white'
17741
- });
17838
+ attrs = shapeStyle(attrs);
17742
17839
 
17743
- var polygon = create$1('polygon');
17744
- attr(polygon, {
17840
+ var polygon = create$1('polygon', {
17841
+ ...attrs,
17745
17842
  points: pointsString
17746
17843
  });
17747
- attr(polygon, attrs);
17748
17844
 
17749
17845
  append(parentGfx, polygon);
17750
17846
 
17751
17847
  return polygon;
17752
17848
  }
17753
17849
 
17754
- function drawLine(parentGfx, waypoints, attrs) {
17755
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17756
- stroke: black,
17757
- strokeWidth: 2,
17758
- fill: 'none'
17759
- });
17850
+ /**
17851
+ * @param {SVGElement} parentGfx
17852
+ * @param {Point[]} waypoints
17853
+ * @param {any} attrs
17854
+ * @param {number} [radius]
17855
+ *
17856
+ * @return {SVGElement}
17857
+ */
17858
+ function drawLine(parentGfx, waypoints, attrs, radius) {
17859
+ attrs = lineStyle(attrs);
17760
17860
 
17761
- var line = createLine(waypoints, attrs);
17861
+ var line = createLine(waypoints, attrs, radius);
17762
17862
 
17763
17863
  append(parentGfx, line);
17764
17864
 
17765
17865
  return line;
17766
17866
  }
17767
17867
 
17868
+ /**
17869
+ * @param {SVGElement} parentGfx
17870
+ * @param {Point[]} waypoints
17871
+ * @param {any} attrs
17872
+ *
17873
+ * @return {SVGElement}
17874
+ */
17875
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
17876
+ return drawLine(parentGfx, waypoints, attrs, 5);
17877
+ }
17878
+
17768
17879
  function drawPath(parentGfx, d, attrs) {
17769
17880
 
17770
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17771
- strokeWidth: 2,
17772
- stroke: black
17773
- });
17881
+ attrs = lineStyle(attrs);
17774
17882
 
17775
- var path = create$1('path');
17776
- attr(path, { d: d });
17777
- attr(path, attrs);
17883
+ var path = create$1('path', {
17884
+ ...attrs,
17885
+ d
17886
+ });
17778
17887
 
17779
17888
  append(parentGfx, path);
17780
17889
 
@@ -17875,7 +17984,7 @@
17875
17984
  return renderLabel(parentGfx, semantic.name, {
17876
17985
  box: element,
17877
17986
  align: align,
17878
- padding: 5,
17987
+ padding: 7,
17879
17988
  style: {
17880
17989
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17881
17990
  }
@@ -17921,16 +18030,6 @@
17921
18030
  transform(textBox, 0, -top, 270);
17922
18031
  }
17923
18032
 
17924
- function createPathFromConnection(connection) {
17925
- var waypoints = connection.waypoints;
17926
-
17927
- var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
17928
- for (var i = 1; i < waypoints.length; i++) {
17929
- pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
17930
- }
17931
- return pathData;
17932
- }
17933
-
17934
18033
  var handlers = this.handlers = {
17935
18034
  'bpmn:Event': function(parentGfx, element, attrs) {
17936
18035
 
@@ -17951,7 +18050,6 @@
17951
18050
  if (!semantic.isInterrupting) {
17952
18051
  attrs = {
17953
18052
  strokeDasharray: '6',
17954
- strokeLinecap: 'round',
17955
18053
  fill: getFillColor(element, defaultFillColor),
17956
18054
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17957
18055
  };
@@ -18006,7 +18104,6 @@
18006
18104
 
18007
18105
  drawPath(parentGfx, pathData, {
18008
18106
  strokeWidth: 2,
18009
- strokeLinecap: 'square',
18010
18107
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18011
18108
  });
18012
18109
 
@@ -18028,7 +18125,6 @@
18028
18125
 
18029
18126
  drawPath(parentGfx, linePathData, {
18030
18127
  strokeWidth: 1,
18031
- strokeLinecap: 'square',
18032
18128
  transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
18033
18129
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18034
18130
  });
@@ -18236,14 +18332,14 @@
18236
18332
  },
18237
18333
  'bpmn:IntermediateEvent': function(parentGfx, element) {
18238
18334
  var outer = renderer('bpmn:Event')(parentGfx, element, {
18239
- strokeWidth: 1,
18335
+ strokeWidth: 1.5,
18240
18336
  fill: getFillColor(element, defaultFillColor),
18241
18337
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18242
18338
  });
18243
18339
 
18244
18340
  /* inner */
18245
18341
  drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
18246
- strokeWidth: 1,
18342
+ strokeWidth: 1.5,
18247
18343
  fill: getFillColor(element, 'none'),
18248
18344
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18249
18345
  });
@@ -18496,10 +18592,11 @@
18496
18592
  return task;
18497
18593
  },
18498
18594
  'bpmn:SubProcess': function(parentGfx, element, attrs) {
18499
- attrs = assign$1({
18595
+ attrs = {
18500
18596
  fill: getFillColor(element, defaultFillColor),
18501
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18502
- }, attrs);
18597
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18598
+ ...attrs
18599
+ };
18503
18600
 
18504
18601
  var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
18505
18602
 
@@ -18507,7 +18604,8 @@
18507
18604
 
18508
18605
  if (isEventSubProcess(element)) {
18509
18606
  attr(rect, {
18510
- strokeDasharray: '1,2'
18607
+ strokeDasharray: '0, 5.5',
18608
+ strokeWidth: 2.5
18511
18609
  });
18512
18610
  }
18513
18611
 
@@ -18525,13 +18623,14 @@
18525
18623
  return renderer('bpmn:SubProcess')(parentGfx, element);
18526
18624
  },
18527
18625
  'bpmn:Transaction': function(parentGfx, element) {
18528
- var outer = renderer('bpmn:SubProcess')(parentGfx, element);
18626
+ var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
18529
18627
 
18530
18628
  var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
18531
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18629
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18630
+ strokeWidth: 1.5
18532
18631
  });
18533
18632
 
18534
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
18633
+ /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
18535
18634
 
18536
18635
  return outer;
18537
18636
  },
@@ -18542,10 +18641,13 @@
18542
18641
  },
18543
18642
  'bpmn:Participant': function(parentGfx, element) {
18544
18643
 
18644
+ var strokeWidth = 1.5;
18645
+
18545
18646
  var attrs = {
18546
18647
  fillOpacity: DEFAULT_FILL_OPACITY,
18547
18648
  fill: getFillColor(element, defaultFillColor),
18548
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18649
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18650
+ strokeWidth
18549
18651
  };
18550
18652
 
18551
18653
  var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
@@ -18557,13 +18659,14 @@
18557
18659
  { x: 30, y: 0 },
18558
18660
  { x: 30, y: element.height }
18559
18661
  ], {
18560
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18662
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18663
+ strokeWidth
18561
18664
  });
18562
18665
  var text = getSemantic(element).name;
18563
18666
  renderLaneLabel(parentGfx, text, element);
18564
18667
  } else {
18565
18668
 
18566
- // Collapsed pool draw text inline
18669
+ // collapsed pool draw text inline
18567
18670
  var text2 = getSemantic(element).name;
18568
18671
  renderLabel(parentGfx, text2, {
18569
18672
  box: element, align: 'center-middle',
@@ -18582,11 +18685,13 @@
18582
18685
  return lane;
18583
18686
  },
18584
18687
  'bpmn:Lane': function(parentGfx, element, attrs) {
18585
- var rect = drawRect(parentGfx, element.width, element.height, 0, assign$1({
18688
+ var rect = drawRect(parentGfx, element.width, element.height, 0, {
18586
18689
  fill: getFillColor(element, defaultFillColor),
18587
18690
  fillOpacity: HIGH_FILL_OPACITY,
18588
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18589
- }, attrs));
18691
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18692
+ strokeWidth: 1.5,
18693
+ ...attrs
18694
+ });
18590
18695
 
18591
18696
  var semantic = getSemantic(element);
18592
18697
 
@@ -18705,13 +18810,11 @@
18705
18810
  }
18706
18811
  });
18707
18812
 
18708
- var attrs = {
18813
+ /* event path */ drawPath(parentGfx, pathData, {
18709
18814
  strokeWidth: 2,
18710
18815
  fill: getFillColor(element, 'none'),
18711
18816
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18712
- };
18713
-
18714
- /* event path */ drawPath(parentGfx, pathData, attrs);
18817
+ });
18715
18818
  }
18716
18819
 
18717
18820
  if (type === 'Parallel') {
@@ -18727,16 +18830,14 @@
18727
18830
  }
18728
18831
  });
18729
18832
 
18730
- var parallelPath = drawPath(parentGfx, pathData);
18731
- attr(parallelPath, {
18833
+ drawPath(parentGfx, pathData, {
18732
18834
  strokeWidth: 1,
18733
18835
  fill: 'none'
18734
18836
  });
18735
18837
  } else if (type === 'Exclusive') {
18736
18838
 
18737
18839
  if (!instantiate) {
18738
- var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
18739
- attr(innerCircle, {
18840
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
18740
18841
  strokeWidth: 1,
18741
18842
  fill: 'none',
18742
18843
  stroke: getStrokeColor$1(element, defaultStrokeColor)
@@ -18750,27 +18851,20 @@
18750
18851
  return diamond;
18751
18852
  },
18752
18853
  'bpmn:Gateway': function(parentGfx, element) {
18753
- var attrs = {
18854
+ return drawDiamond(parentGfx, element.width, element.height, {
18754
18855
  fill: getFillColor(element, defaultFillColor),
18755
18856
  fillOpacity: DEFAULT_FILL_OPACITY,
18756
18857
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18757
- };
18758
-
18759
- return drawDiamond(parentGfx, element.width, element.height, attrs);
18858
+ });
18760
18859
  },
18761
18860
  'bpmn:SequenceFlow': function(parentGfx, element) {
18762
- var pathData = createPathFromConnection(element);
18763
-
18764
18861
  var fill = getFillColor(element, defaultFillColor),
18765
18862
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18766
18863
 
18767
- var attrs = {
18768
- strokeLinejoin: 'round',
18864
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18769
18865
  markerEnd: marker('sequenceflow-end', fill, stroke),
18770
18866
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18771
- };
18772
-
18773
- var path = drawPath(parentGfx, pathData, attrs);
18867
+ });
18774
18868
 
18775
18869
  var sequenceFlow = getSemantic(element);
18776
18870
 
@@ -18804,12 +18898,11 @@
18804
18898
  var fill = getFillColor(element, defaultFillColor),
18805
18899
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18806
18900
 
18807
- attrs = assign$1({
18808
- strokeDasharray: '0.5, 5',
18809
- strokeLinecap: 'round',
18810
- strokeLinejoin: 'round',
18811
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18812
- }, attrs || {});
18901
+ attrs = {
18902
+ strokeDasharray: '0, 5',
18903
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18904
+ ...attrs
18905
+ };
18813
18906
 
18814
18907
  if (semantic.associationDirection === 'One' ||
18815
18908
  semantic.associationDirection === 'Both') {
@@ -18820,7 +18913,7 @@
18820
18913
  attrs.markerStart = marker('association-start', fill, stroke);
18821
18914
  }
18822
18915
 
18823
- return drawLine(parentGfx, element.waypoints, attrs);
18916
+ return drawConnectionSegments(parentGfx, element.waypoints, attrs);
18824
18917
  },
18825
18918
  'bpmn:DataInputAssociation': function(parentGfx, element) {
18826
18919
  var fill = getFillColor(element, defaultFillColor),
@@ -18846,19 +18939,13 @@
18846
18939
  var fill = getFillColor(element, defaultFillColor),
18847
18940
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18848
18941
 
18849
- var pathData = createPathFromConnection(element);
18850
-
18851
- var attrs = {
18942
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18852
18943
  markerEnd: marker('messageflow-end', fill, stroke),
18853
18944
  markerStart: marker('messageflow-start', fill, stroke),
18854
- strokeDasharray: '10, 12',
18855
- strokeLinecap: 'round',
18856
- strokeLinejoin: 'round',
18857
- strokeWidth: '1.5px',
18945
+ strokeDasharray: '10, 11',
18946
+ strokeWidth: 1.5,
18858
18947
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18859
- };
18860
-
18861
- var path = drawPath(parentGfx, pathData, attrs);
18948
+ });
18862
18949
 
18863
18950
  if (semantic.messageRef) {
18864
18951
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
@@ -18981,25 +19068,26 @@
18981
19068
  cancel = semantic.cancelActivity;
18982
19069
 
18983
19070
  var attrs = {
18984
- strokeWidth: 1,
19071
+ strokeWidth: 1.5,
18985
19072
  fill: getFillColor(element, defaultFillColor),
18986
19073
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18987
19074
  };
18988
19075
 
18989
19076
  if (!cancel) {
18990
19077
  attrs.strokeDasharray = '6';
18991
- attrs.strokeLinecap = 'round';
18992
19078
  }
18993
19079
 
18994
19080
  // apply fillOpacity
18995
- var outerAttrs = assign$1({}, attrs, {
19081
+ var outerAttrs = {
19082
+ ...attrs,
18996
19083
  fillOpacity: 1
18997
- });
19084
+ };
18998
19085
 
18999
19086
  // apply no-fill
19000
- var innerAttrs = assign$1({}, attrs, {
19087
+ var innerAttrs = {
19088
+ ...attrs,
19001
19089
  fill: 'none'
19002
- });
19090
+ };
19003
19091
 
19004
19092
  var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
19005
19093
 
@@ -19010,27 +19098,22 @@
19010
19098
  return outer;
19011
19099
  },
19012
19100
  'bpmn:Group': function(parentGfx, element) {
19013
-
19014
- var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
19101
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
19015
19102
  stroke: getStrokeColor$1(element, defaultStrokeColor),
19016
- strokeWidth: 1,
19017
- strokeDasharray: '8,3,1,3',
19103
+ strokeWidth: 1.5,
19104
+ strokeDasharray: '10,6,0,6',
19018
19105
  fill: 'none',
19019
19106
  pointerEvents: 'none'
19020
19107
  });
19021
-
19022
- return group;
19023
19108
  },
19024
19109
  'label': function(parentGfx, element) {
19025
19110
  return renderExternalLabel(parentGfx, element);
19026
19111
  },
19027
19112
  'bpmn:TextAnnotation': function(parentGfx, element) {
19028
- var style = {
19113
+ var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
19029
19114
  'fill': 'none',
19030
19115
  'stroke': 'none'
19031
- };
19032
-
19033
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
19116
+ });
19034
19117
 
19035
19118
  var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
19036
19119
  xScaleFactor: 1,
@@ -19051,7 +19134,7 @@
19051
19134
  renderLabel(parentGfx, text, {
19052
19135
  box: element,
19053
19136
  align: 'left-top',
19054
- padding: 5,
19137
+ padding: 7,
19055
19138
  style: {
19056
19139
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
19057
19140
  }
@@ -19169,10 +19252,9 @@
19169
19252
  });
19170
19253
 
19171
19254
  drawMarker('loop', parentGfx, markerPath, {
19172
- strokeWidth: 1,
19255
+ strokeWidth: 1.5,
19173
19256
  fill: getFillColor(element, defaultFillColor),
19174
19257
  stroke: getStrokeColor$1(element, defaultStrokeColor),
19175
- strokeLinecap: 'round',
19176
19258
  strokeMiterlimit: 0.5
19177
19259
  });
19178
19260
  },
@@ -20886,7 +20968,7 @@
20886
20968
  return isPrimaryButton(event) || isAuxiliaryButton(event);
20887
20969
  }
20888
20970
 
20889
- var LOW_PRIORITY$t = 500;
20971
+ var LOW_PRIORITY$u = 500;
20890
20972
 
20891
20973
 
20892
20974
  /**
@@ -21081,7 +21163,7 @@
21081
21163
  eventBus.on([
21082
21164
  'shape.changed',
21083
21165
  'connection.changed'
21084
- ], LOW_PRIORITY$t, function(event) {
21166
+ ], LOW_PRIORITY$u, function(event) {
21085
21167
 
21086
21168
  var element = event.element,
21087
21169
  gfx = event.gfx;
@@ -21089,7 +21171,7 @@
21089
21171
  eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
21090
21172
  });
21091
21173
 
21092
- eventBus.on('interactionEvents.createHit', LOW_PRIORITY$t, function(event) {
21174
+ eventBus.on('interactionEvents.createHit', LOW_PRIORITY$u, function(event) {
21093
21175
  var element = event.element,
21094
21176
  gfx = event.gfx;
21095
21177
 
@@ -21366,7 +21448,7 @@
21366
21448
  interactionEvents: [ 'type', InteractionEvents ]
21367
21449
  };
21368
21450
 
21369
- var LOW_PRIORITY$s = 500;
21451
+ var LOW_PRIORITY$t = 500;
21370
21452
 
21371
21453
 
21372
21454
  /**
@@ -21393,7 +21475,7 @@
21393
21475
  attr(outline, assign$1({
21394
21476
  x: 10,
21395
21477
  y: 10,
21396
- rx: 3,
21478
+ rx: 4,
21397
21479
  width: 100,
21398
21480
  height: 100
21399
21481
  }, OUTLINE_STYLE));
@@ -21405,7 +21487,7 @@
21405
21487
 
21406
21488
  // A low priortity is necessary, because outlines of labels have to be updated
21407
21489
  // after the label bounds have been updated in the renderer.
21408
- eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$s, function(event) {
21490
+ eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$t, function(event) {
21409
21491
  var element = event.element,
21410
21492
  gfx = event.gfx;
21411
21493
 
@@ -21851,7 +21933,7 @@
21851
21933
  // document wide unique overlay ids
21852
21934
  var ids$2 = new IdGenerator('ov');
21853
21935
 
21854
- var LOW_PRIORITY$r = 500;
21936
+ var LOW_PRIORITY$s = 500;
21855
21937
 
21856
21938
 
21857
21939
  /**
@@ -22423,7 +22505,7 @@
22423
22505
 
22424
22506
  // move integration
22425
22507
 
22426
- eventBus.on('element.changed', LOW_PRIORITY$r, function(e) {
22508
+ eventBus.on('element.changed', LOW_PRIORITY$s, function(e) {
22427
22509
  var element = e.element;
22428
22510
 
22429
22511
  var container = self._getOverlayContainer(element, true);
@@ -23383,7 +23465,7 @@
23383
23465
  return true;
23384
23466
  }
23385
23467
 
23386
- var LOW_PRIORITY$q = 250;
23468
+ var LOW_PRIORITY$r = 250;
23387
23469
  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>';
23388
23470
 
23389
23471
  var EMPTY_MARKER = 'bjs-drilldown-empty';
@@ -23400,7 +23482,7 @@
23400
23482
 
23401
23483
  var self = this;
23402
23484
 
23403
- this.executed('shape.toggleCollapse', LOW_PRIORITY$q, function(context) {
23485
+ this.executed('shape.toggleCollapse', LOW_PRIORITY$r, function(context) {
23404
23486
  var shape = context.shape;
23405
23487
 
23406
23488
  // Add overlay to the collapsed shape
@@ -23412,7 +23494,7 @@
23412
23494
  }, true);
23413
23495
 
23414
23496
 
23415
- this.reverted('shape.toggleCollapse', LOW_PRIORITY$q, function(context) {
23497
+ this.reverted('shape.toggleCollapse', LOW_PRIORITY$r, function(context) {
23416
23498
  var shape = context.shape;
23417
23499
 
23418
23500
  // Add overlay to the collapsed shape
@@ -23424,7 +23506,7 @@
23424
23506
  }, true);
23425
23507
 
23426
23508
 
23427
- this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$q,
23509
+ this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$r,
23428
23510
  function(context) {
23429
23511
  var oldParent = context.oldParent,
23430
23512
  newParent = context.newParent || context.parent,
@@ -23441,7 +23523,7 @@
23441
23523
  }, true);
23442
23524
 
23443
23525
 
23444
- this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$q,
23526
+ this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$r,
23445
23527
  function(context) {
23446
23528
  var oldParent = context.oldParent,
23447
23529
  newParent = context.newParent || context.parent,
@@ -23567,6 +23649,10 @@
23567
23649
  subprocessCompatibility: [ 'type', SubprocessCompatibility ]
23568
23650
  };
23569
23651
 
23652
+ /**
23653
+ * @typedef { import('didi').ModuleDeclaration } Module
23654
+ */
23655
+
23570
23656
  /**
23571
23657
  * A viewer for BPMN 2.0 diagrams.
23572
23658
  *
@@ -23611,8 +23697,8 @@
23611
23697
  * @param {string|number} [options.width] the width of the viewer
23612
23698
  * @param {string|number} [options.height] the height of the viewer
23613
23699
  * @param {Object} [options.moddleExtensions] extension packages to provide
23614
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
23615
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
23700
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
23701
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
23616
23702
  */
23617
23703
  function Viewer(options) {
23618
23704
  BaseViewer.call(this, options);
@@ -23890,7 +23976,7 @@
23890
23976
  return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
23891
23977
  }
23892
23978
 
23893
- var LOW_PRIORITY$p = 500;
23979
+ var LOW_PRIORITY$q = 500;
23894
23980
 
23895
23981
 
23896
23982
  /**
@@ -23906,7 +23992,7 @@
23906
23992
 
23907
23993
  var self = this;
23908
23994
 
23909
- eventBus.on('editorActions.init', LOW_PRIORITY$p, function(event) {
23995
+ eventBus.on('editorActions.init', LOW_PRIORITY$q, function(event) {
23910
23996
 
23911
23997
  var editorActions = event.editorActions;
23912
23998
 
@@ -28568,41 +28654,21 @@
28568
28654
 
28569
28655
  const [ value, setValue ] = p$3('');
28570
28656
 
28571
- const [ entries, setEntries ] = p$3(originalEntries);
28572
- const [ selectedEntry, setSelectedEntry ] = p$3(entries[0]);
28573
-
28574
- h$2(() => {
28575
- onOpened();
28576
-
28577
- return () => {
28578
- onClosed();
28579
- };
28580
- }, []);
28581
-
28582
- const updateEntries = T$3((newEntries) => {
28583
-
28584
- // select first entry if non is selected
28585
- if (!selectedEntry || !newEntries.includes(selectedEntry)) {
28586
- setSelectedEntry(newEntries[0]);
28587
- }
28588
-
28589
- setEntries(newEntries);
28590
- }, [ selectedEntry, setEntries, setSelectedEntry ]);
28657
+ const filterEntries = T$3((originalEntries, value) => {
28591
28658
 
28592
- // filter entries on value change
28593
- h$2(() => {
28594
28659
  if (!searchable) {
28595
- return;
28660
+ return originalEntries;
28596
28661
  }
28597
28662
 
28598
28663
  const filter = entry => {
28599
28664
  if (!value) {
28600
- return true;
28665
+ return (entry.rank || 0) >= 0;
28601
28666
  }
28602
28667
 
28603
28668
  const search = [
28604
28669
  entry.description || '',
28605
- entry.label || ''
28670
+ entry.label || '',
28671
+ entry.search || ''
28606
28672
  ]
28607
28673
  .join('---')
28608
28674
  .toLowerCase();
@@ -28613,10 +28679,26 @@
28613
28679
  .every(term => search.includes(term));
28614
28680
  };
28615
28681
 
28616
- const entries = originalEntries.filter(filter);
28682
+ return originalEntries.filter(filter);
28683
+ }, [ searchable ]);
28684
+
28685
+ const [ entries, setEntries ] = p$3(filterEntries(originalEntries, value));
28686
+ const [ selectedEntry, setSelectedEntry ] = p$3(entries[0]);
28687
+
28688
+ const updateEntries = T$3((newEntries) => {
28689
+
28690
+ // select first entry if non is selected
28691
+ if (!selectedEntry || !newEntries.includes(selectedEntry)) {
28692
+ setSelectedEntry(newEntries[0]);
28693
+ }
28694
+
28695
+ setEntries(newEntries);
28696
+ }, [ selectedEntry, setEntries, setSelectedEntry ]);
28617
28697
 
28618
- updateEntries(entries);
28619
- }, [ value, originalEntries, searchable ]);
28698
+ // filter entries on value change
28699
+ h$2(() => {
28700
+ updateEntries(filterEntries(originalEntries, value));
28701
+ }, [ value, originalEntries ]);
28620
28702
 
28621
28703
  // register global <Escape> handler
28622
28704
  h$2(() => {
@@ -28662,10 +28744,6 @@
28662
28744
  return onSelect(event, selectedEntry);
28663
28745
  }
28664
28746
 
28665
- if (event.key === 'Escape') {
28666
- return onClose();
28667
- }
28668
-
28669
28747
  // ARROW_UP or SHIFT + TAB navigation
28670
28748
  if (event.key === 'ArrowUp' || (event.key === 'Tab' && event.shiftKey)) {
28671
28749
  keyboardSelect(-1);
@@ -28687,6 +28765,14 @@
28687
28765
  }
28688
28766
  }, [ setValue ]);
28689
28767
 
28768
+ h$2(() => {
28769
+ onOpened();
28770
+
28771
+ return () => {
28772
+ onClosed();
28773
+ };
28774
+ }, []);
28775
+
28690
28776
  const displayHeader = F$2(() => title || headerEntries.length > 0, [ title, headerEntries ]);
28691
28777
 
28692
28778
  return m$3`
@@ -29387,14 +29473,14 @@
29387
29473
 
29388
29474
  var ICONS$1 = icons$1;
29389
29475
 
29390
- var LOW_PRIORITY$o = 900;
29476
+ var LOW_PRIORITY$p = 900;
29391
29477
 
29392
29478
  /**
29393
29479
  * A provider for align elements context pad button
29394
29480
  */
29395
29481
  function AlignElementsContextPadProvider(contextPad, popupMenu, translate, canvas) {
29396
29482
 
29397
- contextPad.registerProvider(LOW_PRIORITY$o, this);
29483
+ contextPad.registerProvider(LOW_PRIORITY$p, this);
29398
29484
 
29399
29485
  this._contextPad = contextPad;
29400
29486
  this._popupMenu = popupMenu;
@@ -29948,7 +30034,7 @@
29948
30034
  return true;
29949
30035
  }
29950
30036
 
29951
- var LOW_PRIORITY$n = 100;
30037
+ var LOW_PRIORITY$o = 100;
29952
30038
 
29953
30039
 
29954
30040
  /**
@@ -29960,7 +30046,7 @@
29960
30046
  */
29961
30047
  function AutoPlace$1(eventBus, modeling, canvas) {
29962
30048
 
29963
- eventBus.on('autoPlace', LOW_PRIORITY$n, function(context) {
30049
+ eventBus.on('autoPlace', LOW_PRIORITY$o, function(context) {
29964
30050
  var shape = context.shape,
29965
30051
  source = context.source;
29966
30052
 
@@ -30178,7 +30264,7 @@
30178
30264
  y: sourceTrbl.top - 50 - element.height / 2
30179
30265
  };
30180
30266
 
30181
- if (isConnection$f(source)) {
30267
+ if (isConnection$g(source)) {
30182
30268
  position = getMid(source);
30183
30269
  position.x += 100;
30184
30270
  position.y -= 50;
@@ -30217,7 +30303,7 @@
30217
30303
  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
30218
30304
  }
30219
30305
 
30220
- function isConnection$f(element) {
30306
+ function isConnection$g(element) {
30221
30307
  return !!element.waypoints;
30222
30308
  }
30223
30309
 
@@ -31643,7 +31729,7 @@
31643
31729
  * Returns the length of a vector
31644
31730
  *
31645
31731
  * @param {Vector}
31646
- * @return {Float}
31732
+ * @return {number}
31647
31733
  */
31648
31734
  function vectorLength(v) {
31649
31735
  return Math.sqrt(Math.pow(v.x, 2) + Math.pow(v.y, 2));
@@ -31654,7 +31740,7 @@
31654
31740
  * Calculates the angle between a line a the yAxis
31655
31741
  *
31656
31742
  * @param {Array}
31657
- * @return {Float}
31743
+ * @return {number}
31658
31744
  */
31659
31745
  function getAngle(line) {
31660
31746
 
@@ -31668,7 +31754,7 @@
31668
31754
  * Rotates a vector by a given angle
31669
31755
  *
31670
31756
  * @param {Vector}
31671
- * @param {Float} Angle in radians
31757
+ * @param {number} Angle in radians
31672
31758
  * @return {Vector}
31673
31759
  */
31674
31760
  function rotateVector(vector, angle) {
@@ -31686,7 +31772,7 @@
31686
31772
  * @param {Vector}
31687
31773
  * @param {Vector}
31688
31774
  * @param {Vector}
31689
- * @return {Float}
31775
+ * @return {number}
31690
31776
  */
31691
31777
  function solveLambaSystem(a, b, c) {
31692
31778
 
@@ -31708,7 +31794,7 @@
31708
31794
  * Position of perpendicular foot
31709
31795
  *
31710
31796
  * @param {Point}
31711
- * @param [ {Point}, {Point} ] line defined through two points
31797
+ * @param {[ Point, Point ]} line defined through two points
31712
31798
  * @return {Point} the perpendicular foot position
31713
31799
  */
31714
31800
  function perpendicularFoot(point, line) {
@@ -31728,9 +31814,10 @@
31728
31814
  /**
31729
31815
  * Calculates the distance between a point and a line
31730
31816
  *
31731
- * @param {Point}
31732
- * @param [ {Point}, {Point} ] line defined through two points
31733
- * @return {Float} distance
31817
+ * @param { Point }
31818
+ * @param { [ Point, Point ] } line defined through two points
31819
+ *
31820
+ * @return { number } distance
31734
31821
  */
31735
31822
  function getDistancePointLine(point, line) {
31736
31823
 
@@ -31751,7 +31838,8 @@
31751
31838
  *
31752
31839
  * @param {Point}
31753
31840
  * @param {Point}
31754
- * @return {Float} distance
31841
+ *
31842
+ * @return {number} distance
31755
31843
  */
31756
31844
  function getDistancePointPoint(point1, point2) {
31757
31845
 
@@ -33457,7 +33545,7 @@
33457
33545
  hoverMid = hover && getSnapPoint(hover, event);
33458
33546
 
33459
33547
  // only snap on connections, elements can have multiple connect endpoints
33460
- if (!isConnection$e(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33548
+ if (!isConnection$f(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33461
33549
  return;
33462
33550
  }
33463
33551
 
@@ -33512,7 +33600,7 @@
33512
33600
 
33513
33601
  // helpers //////////////////////
33514
33602
 
33515
- function isConnection$e(element) {
33603
+ function isConnection$f(element) {
33516
33604
  return element && !!element.waypoints;
33517
33605
  }
33518
33606
 
@@ -33670,7 +33758,7 @@
33670
33758
  }
33671
33759
 
33672
33760
  var HIGH_PRIORITY$n = 1100,
33673
- LOW_PRIORITY$m = 900;
33761
+ LOW_PRIORITY$n = 900;
33674
33762
 
33675
33763
  var MARKER_OK$3 = 'connect-ok',
33676
33764
  MARKER_NOT_OK$3 = 'connect-not-ok';
@@ -33714,7 +33802,7 @@
33714
33802
  });
33715
33803
  });
33716
33804
 
33717
- eventBus.on('connect.hover', LOW_PRIORITY$m, function(event) {
33805
+ eventBus.on('connect.hover', LOW_PRIORITY$n, function(event) {
33718
33806
  var context = event.context,
33719
33807
  hover = event.hover,
33720
33808
  canExecute = context.canExecute;
@@ -33981,18 +34069,12 @@
33981
34069
  * @returns {SVGElement}
33982
34070
  */
33983
34071
  ConnectionPreview.prototype.createNoopConnection = function(start, end) {
33984
- var connection = create$1('polyline');
33985
-
33986
- attr(connection, {
34072
+ return createLine([ start, end ], {
33987
34073
  'stroke': '#333',
33988
34074
  'strokeDasharray': [ 1 ],
33989
34075
  'strokeWidth': 2,
33990
34076
  'pointer-events': 'none'
33991
34077
  });
33992
-
33993
- attr(connection, { 'points': [ start.x, start.y, end.x, end.y ] });
33994
-
33995
- return connection;
33996
34078
  };
33997
34079
 
33998
34080
  // helpers //////////
@@ -34699,6 +34781,7 @@
34699
34781
  'path',
34700
34782
  'polygon',
34701
34783
  'polyline',
34784
+ 'path',
34702
34785
  'rect'
34703
34786
  ];
34704
34787
 
@@ -34973,7 +35056,7 @@
34973
35056
  });
34974
35057
 
34975
35058
  var shape = find$1(elements, function(element) {
34976
- return !isConnection$d(element);
35059
+ return !isConnection$e(element);
34977
35060
  });
34978
35061
 
34979
35062
  var attach = false,
@@ -35128,7 +35211,7 @@
35128
35211
 
35129
35212
  // update shape
35130
35213
  shape = find$1(elements, function(element) {
35131
- return !isConnection$d(element);
35214
+ return !isConnection$e(element);
35132
35215
  });
35133
35216
  }
35134
35217
 
@@ -35169,7 +35252,7 @@
35169
35252
  }
35170
35253
 
35171
35254
  var shape = find$1(elements, function(element) {
35172
- return !isConnection$d(element);
35255
+ return !isConnection$e(element);
35173
35256
  });
35174
35257
 
35175
35258
  if (!shape) {
@@ -35203,7 +35286,7 @@
35203
35286
 
35204
35287
  // center elements around cursor
35205
35288
  forEach$1(elements, function(element) {
35206
- if (isConnection$d(element)) {
35289
+ if (isConnection$e(element)) {
35207
35290
  element.waypoints = map$2(element.waypoints, function(waypoint) {
35208
35291
  return {
35209
35292
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35265,19 +35348,19 @@
35265
35348
  }
35266
35349
  }
35267
35350
 
35268
- function isConnection$d(element) {
35351
+ function isConnection$e(element) {
35269
35352
  return !!element.waypoints;
35270
35353
  }
35271
35354
 
35272
35355
  function isSingleShape(elements) {
35273
- return elements && elements.length === 1 && !isConnection$d(elements[0]);
35356
+ return elements && elements.length === 1 && !isConnection$e(elements[0]);
35274
35357
  }
35275
35358
 
35276
35359
  function isLabel$5(element) {
35277
35360
  return !!element.labelTarget;
35278
35361
  }
35279
35362
 
35280
- var LOW_PRIORITY$l = 750;
35363
+ var LOW_PRIORITY$m = 750;
35281
35364
 
35282
35365
 
35283
35366
  function CreatePreview(
@@ -35322,7 +35405,7 @@
35322
35405
  return dragGroup;
35323
35406
  }
35324
35407
 
35325
- eventBus.on('create.move', LOW_PRIORITY$l, function(event) {
35408
+ eventBus.on('create.move', LOW_PRIORITY$m, function(event) {
35326
35409
 
35327
35410
  var hover = event.hover,
35328
35411
  context = event.context,
@@ -35587,7 +35670,7 @@
35587
35670
  }
35588
35671
 
35589
35672
  // connections (priority = 3)
35590
- if (isConnection$c(element)) {
35673
+ if (isConnection$d(element)) {
35591
35674
  descriptor.priority = 3;
35592
35675
 
35593
35676
  descriptor.source = element.source.id;
@@ -35730,7 +35813,7 @@
35730
35813
 
35731
35814
  // center elements around cursor
35732
35815
  forEach$1(elements, function(element) {
35733
- if (isConnection$c(element)) {
35816
+ if (isConnection$d(element)) {
35734
35817
  element.waypoints = map$2(element.waypoints, function(waypoint) {
35735
35818
  return {
35736
35819
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35783,7 +35866,7 @@
35783
35866
 
35784
35867
  var element;
35785
35868
 
35786
- if (isConnection$c(attrs)) {
35869
+ if (isConnection$d(attrs)) {
35787
35870
  attrs.source = cache[ descriptor.source ];
35788
35871
  attrs.target = cache[ descriptor.target ];
35789
35872
 
@@ -35849,7 +35932,7 @@
35849
35932
  source,
35850
35933
  target;
35851
35934
 
35852
- if (isConnection$c(element)) {
35935
+ if (isConnection$d(element)) {
35853
35936
  source = find$1(elements, matchPattern({ id: element.source.id }));
35854
35937
  target = find$1(elements, matchPattern({ id: element.target.id }));
35855
35938
 
@@ -36046,7 +36129,7 @@
36046
36129
  return !!element.host;
36047
36130
  }
36048
36131
 
36049
- function isConnection$c(element) {
36132
+ function isConnection$d(element) {
36050
36133
  return !!element.waypoints;
36051
36134
  }
36052
36135
 
@@ -36104,7 +36187,7 @@
36104
36187
  });
36105
36188
  }
36106
36189
 
36107
- var LOW_PRIORITY$k = 750;
36190
+ var LOW_PRIORITY$l = 750;
36108
36191
 
36109
36192
 
36110
36193
  function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
@@ -36115,7 +36198,7 @@
36115
36198
  return moddleCopy.copyElement(bo, targetBo, null, clone);
36116
36199
  }
36117
36200
 
36118
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$k, function(context) {
36201
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$l, function(context) {
36119
36202
  var descriptor = context.descriptor,
36120
36203
  element = context.element,
36121
36204
  businessObject = getBusinessObject$1(element);
@@ -36212,7 +36295,7 @@
36212
36295
 
36213
36296
  // copy + paste processRef with participant
36214
36297
 
36215
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$k, function(context) {
36298
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$l, function(context) {
36216
36299
  var descriptor = context.descriptor,
36217
36300
  element = context.element;
36218
36301
 
@@ -36238,7 +36321,7 @@
36238
36321
 
36239
36322
  // resolve references
36240
36323
 
36241
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$k, function(context) {
36324
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$l, function(context) {
36242
36325
  var cache = context.cache,
36243
36326
  descriptor = context.descriptor;
36244
36327
 
@@ -36749,7 +36832,7 @@
36749
36832
 
36750
36833
  // copying event definitions, unless we replace
36751
36834
  if (propertyName === 'eventDefinitions') {
36752
- return hasEventDefinition$1(element, target.eventDefinitionType);
36835
+ return hasEventDefinition$2(element, target.eventDefinitionType);
36753
36836
  }
36754
36837
 
36755
36838
  // retain loop characteristics if the target element
@@ -36786,7 +36869,7 @@
36786
36869
  // only initialize with new eventDefinition
36787
36870
  // if we did not set an event definition yet,
36788
36871
  // i.e. because we copied it
36789
- if (!hasEventDefinition$1(newBusinessObject, target.eventDefinitionType)) {
36872
+ if (!hasEventDefinition$2(newBusinessObject, target.eventDefinitionType)) {
36790
36873
  newElement.eventDefinitionType = target.eventDefinitionType;
36791
36874
  newElement.eventDefinitionAttrs = target.eventDefinitionAttrs;
36792
36875
  }
@@ -36916,7 +36999,7 @@
36916
36999
  return is$5(bo, 'bpmn:SubProcess');
36917
37000
  }
36918
37001
 
36919
- function hasEventDefinition$1(element, type) {
37002
+ function hasEventDefinition$2(element, type) {
36920
37003
 
36921
37004
  var bo = getBusinessObject$1(element);
36922
37005
 
@@ -37284,7 +37367,7 @@
37284
37367
  }
37285
37368
  ];
37286
37369
 
37287
- var GATEWAY = [
37370
+ var GATEWAY$1 = [
37288
37371
  {
37289
37372
  label: 'Exclusive Gateway',
37290
37373
  actionName: 'replace-with-exclusive-gateway',
@@ -37417,7 +37500,7 @@
37417
37500
 
37418
37501
  var EVENT_SUB_PROCESS = TRANSACTION;
37419
37502
 
37420
- var TASK = [
37503
+ var TASK$1 = [
37421
37504
  {
37422
37505
  label: 'Task',
37423
37506
  actionName: 'replace-with-task',
@@ -37426,6 +37509,22 @@
37426
37509
  type: 'bpmn:Task'
37427
37510
  }
37428
37511
  },
37512
+ {
37513
+ label: 'User Task',
37514
+ actionName: 'replace-with-user-task',
37515
+ className: 'bpmn-icon-user',
37516
+ target: {
37517
+ type: 'bpmn:UserTask'
37518
+ }
37519
+ },
37520
+ {
37521
+ label: 'Service Task',
37522
+ actionName: 'replace-with-service-task',
37523
+ className: 'bpmn-icon-service',
37524
+ target: {
37525
+ type: 'bpmn:ServiceTask'
37526
+ }
37527
+ },
37429
37528
  {
37430
37529
  label: 'Send Task',
37431
37530
  actionName: 'replace-with-send-task',
@@ -37442,14 +37541,6 @@
37442
37541
  type: 'bpmn:ReceiveTask'
37443
37542
  }
37444
37543
  },
37445
- {
37446
- label: 'User Task',
37447
- actionName: 'replace-with-user-task',
37448
- className: 'bpmn-icon-user',
37449
- target: {
37450
- type: 'bpmn:UserTask'
37451
- }
37452
- },
37453
37544
  {
37454
37545
  label: 'Manual Task',
37455
37546
  actionName: 'replace-with-manual-task',
@@ -37466,14 +37557,6 @@
37466
37557
  type: 'bpmn:BusinessRuleTask'
37467
37558
  }
37468
37559
  },
37469
- {
37470
- label: 'Service Task',
37471
- actionName: 'replace-with-service-task',
37472
- className: 'bpmn-icon-service',
37473
- target: {
37474
- type: 'bpmn:ServiceTask'
37475
- }
37476
- },
37477
37560
  {
37478
37561
  label: 'Script Task',
37479
37562
  actionName: 'replace-with-script-task',
@@ -37791,7 +37874,7 @@
37791
37874
  }
37792
37875
  ];
37793
37876
 
37794
- var PARTICIPANT = [
37877
+ var PARTICIPANT$1 = [
37795
37878
  {
37796
37879
  label: 'Expanded Pool',
37797
37880
  actionName: 'replace-with-expanded-pool',
@@ -37828,17 +37911,17 @@
37828
37911
  START_EVENT_SUB_PROCESS: START_EVENT_SUB_PROCESS,
37829
37912
  INTERMEDIATE_EVENT: INTERMEDIATE_EVENT,
37830
37913
  END_EVENT: END_EVENT,
37831
- GATEWAY: GATEWAY,
37914
+ GATEWAY: GATEWAY$1,
37832
37915
  SUBPROCESS_EXPANDED: SUBPROCESS_EXPANDED,
37833
37916
  TRANSACTION: TRANSACTION,
37834
37917
  EVENT_SUB_PROCESS: EVENT_SUB_PROCESS,
37835
- TASK: TASK,
37918
+ TASK: TASK$1,
37836
37919
  DATA_OBJECT_REFERENCE: DATA_OBJECT_REFERENCE,
37837
37920
  DATA_STORE_REFERENCE: DATA_STORE_REFERENCE,
37838
37921
  BOUNDARY_EVENT: BOUNDARY_EVENT,
37839
37922
  EVENT_SUB_PROCESS_START_EVENT: EVENT_SUB_PROCESS_START_EVENT,
37840
37923
  SEQUENCE_FLOW: SEQUENCE_FLOW,
37841
- PARTICIPANT: PARTICIPANT
37924
+ PARTICIPANT: PARTICIPANT$1
37842
37925
  });
37843
37926
 
37844
37927
  /**
@@ -37919,7 +38002,7 @@
37919
38002
  // expanded/collapsed pools
37920
38003
  if (is$5(businessObject, 'bpmn:Participant')) {
37921
38004
 
37922
- entries = filter(PARTICIPANT, function(entry) {
38005
+ entries = filter(PARTICIPANT$1, function(entry) {
37923
38006
  return isExpanded(element) !== entry.target.isExpanded;
37924
38007
  });
37925
38008
 
@@ -38002,7 +38085,7 @@
38002
38085
  // gateways
38003
38086
  if (is$5(businessObject, 'bpmn:Gateway')) {
38004
38087
 
38005
- entries = filter(GATEWAY, differentType);
38088
+ entries = filter(GATEWAY$1, differentType);
38006
38089
 
38007
38090
  return this._createEntries(element, entries);
38008
38091
  }
@@ -38034,7 +38117,7 @@
38034
38117
  // collapsed ad hoc sub processes
38035
38118
  if (is$5(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
38036
38119
 
38037
- entries = filter(TASK, function(entry) {
38120
+ entries = filter(TASK$1, function(entry) {
38038
38121
 
38039
38122
  var target = entry.target;
38040
38123
 
@@ -38055,7 +38138,7 @@
38055
38138
 
38056
38139
  // flow nodes
38057
38140
  if (is$5(businessObject, 'bpmn:FlowNode')) {
38058
- entries = filter(TASK, differentType);
38141
+ entries = filter(TASK$1, differentType);
38059
38142
 
38060
38143
  // collapsed SubProcess can not be replaced with itself
38061
38144
  if (is$5(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
@@ -38325,6 +38408,12 @@
38325
38408
  var self = this;
38326
38409
  var translate = this._translate;
38327
38410
 
38411
+ var dataObject = element.businessObject.dataObjectRef;
38412
+
38413
+ if (!dataObject) {
38414
+ return [];
38415
+ }
38416
+
38328
38417
  function toggleIsCollection(event, entry) {
38329
38418
  self._modeling.updateModdleProperties(
38330
38419
  element,
@@ -38332,8 +38421,7 @@
38332
38421
  { isCollection: !entry.active });
38333
38422
  }
38334
38423
 
38335
- var dataObject = element.businessObject.dataObjectRef,
38336
- isCollection = dataObject.isCollection;
38424
+ var isCollection = dataObject.isCollection;
38337
38425
 
38338
38426
  var dataObjectEntries = [
38339
38427
  {
@@ -38429,9 +38517,12 @@
38429
38517
  var PopupMenuModule = {
38430
38518
  __depends__: [
38431
38519
  PopupMenuModule$1,
38432
- ReplaceModule
38520
+ ReplaceModule,
38521
+ AutoPlaceModule
38522
+ ],
38523
+ __init__: [
38524
+ 'replaceMenuProvider'
38433
38525
  ],
38434
- __init__: [ 'replaceMenuProvider' ],
38435
38526
  replaceMenuProvider: [ 'type', ReplaceMenuProvider ]
38436
38527
  };
38437
38528
 
@@ -38940,7 +39031,6 @@
38940
39031
  return pos;
38941
39032
  }
38942
39033
 
38943
-
38944
39034
  /**
38945
39035
  * Create an append action
38946
39036
  *
@@ -39303,329 +39393,2078 @@
39303
39393
  contextPadProvider: [ 'type', ContextPadProvider ]
39304
39394
  };
39305
39395
 
39306
- var AXIS_DIMENSIONS = {
39307
- horizontal: [ 'x', 'width' ],
39308
- vertical: [ 'y', 'height' ]
39309
- };
39396
+ var TOGGLE_SELECTOR = '.djs-palette-toggle',
39397
+ ENTRY_SELECTOR = '.entry',
39398
+ ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
39310
39399
 
39311
- var THRESHOLD = 5;
39400
+ var PALETTE_PREFIX = 'djs-palette-',
39401
+ PALETTE_SHOWN_CLS = 'shown',
39402
+ PALETTE_OPEN_CLS = 'open',
39403
+ PALETTE_TWO_COLUMN_CLS = 'two-column';
39404
+
39405
+ var DEFAULT_PRIORITY$1 = 1000;
39312
39406
 
39313
39407
 
39314
39408
  /**
39315
- * Groups and filters elements and then trigger even distribution.
39409
+ * A palette containing modeling elements.
39316
39410
  */
39317
- function DistributeElements$1(modeling, rules) {
39318
- this._modeling = modeling;
39411
+ function Palette(eventBus, canvas) {
39319
39412
 
39320
- this._filters = [];
39413
+ this._eventBus = eventBus;
39414
+ this._canvas = canvas;
39321
39415
 
39322
- this.registerFilter(function(elements) {
39323
- var allowed = rules.allowed('elements.distribute', { elements: elements });
39416
+ var self = this;
39324
39417
 
39325
- if (isArray$3(allowed)) {
39326
- return allowed;
39327
- }
39418
+ eventBus.on('tool-manager.update', function(event) {
39419
+ var tool = event.tool;
39328
39420
 
39329
- return allowed ? elements : [];
39421
+ self.updateToolHighlight(tool);
39422
+ });
39423
+
39424
+ eventBus.on('i18n.changed', function() {
39425
+ self._update();
39426
+ });
39427
+
39428
+ eventBus.on('diagram.init', function() {
39429
+
39430
+ self._diagramInitialized = true;
39431
+
39432
+ self._rebuild();
39330
39433
  });
39331
39434
  }
39332
39435
 
39333
- DistributeElements$1.$inject = [ 'modeling', 'rules' ];
39436
+ Palette.$inject = [ 'eventBus', 'canvas' ];
39334
39437
 
39335
39438
 
39336
39439
  /**
39337
- * Registers filter functions that allow external parties to filter
39338
- * out certain elements.
39440
+ * Register a provider with the palette
39339
39441
  *
39340
- * @param {Function} filterFn
39442
+ * @param {number} [priority=1000]
39443
+ * @param {PaletteProvider} provider
39444
+ *
39445
+ * @example
39446
+ * const paletteProvider = {
39447
+ * getPaletteEntries: function() {
39448
+ * return function(entries) {
39449
+ * return {
39450
+ * ...entries,
39451
+ * 'entry-1': {
39452
+ * label: 'My Entry',
39453
+ * action: function() { alert("I have been clicked!"); }
39454
+ * }
39455
+ * };
39456
+ * }
39457
+ * }
39458
+ * };
39459
+ *
39460
+ * palette.registerProvider(800, paletteProvider);
39341
39461
  */
39342
- DistributeElements$1.prototype.registerFilter = function(filterFn) {
39343
- if (typeof filterFn !== 'function') {
39344
- throw new Error('the filter has to be a function');
39462
+ Palette.prototype.registerProvider = function(priority, provider) {
39463
+ if (!provider) {
39464
+ provider = priority;
39465
+ priority = DEFAULT_PRIORITY$1;
39345
39466
  }
39346
39467
 
39347
- this._filters.push(filterFn);
39468
+ this._eventBus.on('palette.getProviders', priority, function(event) {
39469
+ event.providers.push(provider);
39470
+ });
39471
+
39472
+ this._rebuild();
39348
39473
  };
39349
39474
 
39475
+
39350
39476
  /**
39351
- * Distributes the elements with a given orientation
39477
+ * Returns the palette entries
39352
39478
  *
39353
- * @param {Array} elements
39354
- * @param {string} orientation
39479
+ * @return {Object<string, PaletteEntryDescriptor>} map of entries
39355
39480
  */
39356
- DistributeElements$1.prototype.trigger = function(elements, orientation) {
39357
- var modeling = this._modeling;
39481
+ Palette.prototype.getEntries = function() {
39482
+ var providers = this._getProviders();
39358
39483
 
39359
- var groups,
39360
- distributableElements;
39484
+ return providers.reduce(addPaletteEntries, {});
39485
+ };
39361
39486
 
39362
- if (elements.length < 3) {
39487
+ Palette.prototype._rebuild = function() {
39488
+
39489
+ if (!this._diagramInitialized) {
39363
39490
  return;
39364
39491
  }
39365
39492
 
39366
- this._setOrientation(orientation);
39367
-
39368
- distributableElements = this._filterElements(elements);
39369
-
39370
- groups = this._createGroups(distributableElements);
39493
+ var providers = this._getProviders();
39371
39494
 
39372
- // nothing to distribute
39373
- if (groups.length <= 2) {
39495
+ if (!providers.length) {
39374
39496
  return;
39375
39497
  }
39376
39498
 
39377
- modeling.distributeElements(groups, this._axis, this._dimension);
39499
+ if (!this._container) {
39500
+ this._init();
39501
+ }
39378
39502
 
39379
- return groups;
39503
+ this._update();
39380
39504
  };
39381
39505
 
39382
39506
  /**
39383
- * Filters the elements with provided filters by external parties
39384
- *
39385
- * @param {Array[Elements]} elements
39386
- *
39387
- * @return {Array[Elements]}
39507
+ * Initialize
39388
39508
  */
39389
- DistributeElements$1.prototype._filterElements = function(elements) {
39390
- var filters = this._filters,
39391
- axis = this._axis,
39392
- dimension = this._dimension,
39393
- distributableElements = [].concat(elements);
39509
+ Palette.prototype._init = function() {
39394
39510
 
39395
- if (!filters.length) {
39396
- return elements;
39397
- }
39511
+ var self = this;
39398
39512
 
39399
- forEach$1(filters, function(filterFn) {
39400
- distributableElements = filterFn(distributableElements, axis, dimension);
39401
- });
39513
+ var eventBus = this._eventBus;
39402
39514
 
39403
- return distributableElements;
39404
- };
39515
+ var parentContainer = this._getParentContainer();
39405
39516
 
39517
+ var container = this._container = domify$1(Palette.HTML_MARKUP);
39406
39518
 
39407
- /**
39408
- * Create range (min, max) groups. Also tries to group elements
39409
- * together that share the same range.
39410
- *
39411
- * @example
39412
- * var distributableElements = [
39413
- * {
39414
- * range: {
39415
- * min: 100,
39416
- * max: 200
39417
- * },
39418
- * elements: [ { id: 'shape1', .. }]
39419
- * }
39420
- * ]
39421
- *
39422
- * @param {Array} elements
39423
- *
39424
- * @return {Array[Objects]}
39425
- */
39426
- DistributeElements$1.prototype._createGroups = function(elements) {
39427
- var rangeGroups = [],
39428
- self = this,
39429
- axis = this._axis,
39430
- dimension = this._dimension;
39519
+ parentContainer.appendChild(container);
39520
+ classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
39431
39521
 
39432
- if (!axis) {
39433
- throw new Error('must have a defined "axis" and "dimension"');
39434
- }
39522
+ delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
39435
39523
 
39436
- // sort by 'left->right' or 'top->bottom'
39437
- var sortedElements = sortBy(elements, axis);
39524
+ var target = event.delegateTarget;
39438
39525
 
39439
- forEach$1(sortedElements, function(element, idx) {
39440
- var elementRange = self._findRange(element, axis, dimension),
39441
- range;
39526
+ if (matches(target, TOGGLE_SELECTOR)) {
39527
+ return self.toggle();
39528
+ }
39442
39529
 
39443
- var previous = rangeGroups[rangeGroups.length - 1];
39530
+ self.trigger('click', event);
39531
+ });
39444
39532
 
39445
- if (previous && self._hasIntersection(previous.range, elementRange)) {
39446
- rangeGroups[rangeGroups.length - 1].elements.push(element);
39447
- } else {
39448
- range = { range: elementRange, elements: [ element ] };
39533
+ // prevent drag propagation
39534
+ event.bind(container, 'mousedown', function(event) {
39535
+ event.stopPropagation();
39536
+ });
39449
39537
 
39450
- rangeGroups.push(range);
39451
- }
39538
+ // prevent drag propagation
39539
+ delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
39540
+ self.trigger('dragstart', event);
39452
39541
  });
39453
39542
 
39454
- return rangeGroups;
39455
- };
39543
+ eventBus.on('canvas.resized', this._layoutChanged, this);
39456
39544
 
39545
+ eventBus.fire('palette.create', {
39546
+ container: container
39547
+ });
39548
+ };
39457
39549
 
39458
- /**
39459
- * Maps a direction to the according axis and dimension
39460
- *
39461
- * @param {string} direction 'horizontal' or 'vertical'
39462
- */
39463
- DistributeElements$1.prototype._setOrientation = function(direction) {
39464
- var orientation = AXIS_DIMENSIONS[direction];
39550
+ Palette.prototype._getProviders = function(id) {
39465
39551
 
39466
- this._axis = orientation[0];
39467
- this._dimension = orientation[1];
39468
- };
39552
+ var event = this._eventBus.createEvent({
39553
+ type: 'palette.getProviders',
39554
+ providers: []
39555
+ });
39469
39556
 
39557
+ this._eventBus.fire(event);
39470
39558
 
39471
- /**
39472
- * Checks if the two ranges intercept each other
39473
- *
39474
- * @param {Object} rangeA {min, max}
39475
- * @param {Object} rangeB {min, max}
39476
- *
39477
- * @return {boolean}
39478
- */
39479
- DistributeElements$1.prototype._hasIntersection = function(rangeA, rangeB) {
39480
- return Math.max(rangeA.min, rangeA.max) >= Math.min(rangeB.min, rangeB.max) &&
39481
- Math.min(rangeA.min, rangeA.max) <= Math.max(rangeB.min, rangeB.max);
39559
+ return event.providers;
39482
39560
  };
39483
39561
 
39484
-
39485
39562
  /**
39486
- * Returns the min and max values for an element
39487
- *
39488
- * @param {Bounds} element
39489
- * @param {string} axis
39490
- * @param {string} dimension
39563
+ * Update palette state.
39491
39564
  *
39492
- * @return {{ min: number, max: number }}
39565
+ * @param {Object} [state] { open, twoColumn }
39493
39566
  */
39494
- DistributeElements$1.prototype._findRange = function(element) {
39495
- var axis = element[this._axis],
39496
- dimension = element[this._dimension];
39497
-
39498
- return {
39499
- min: axis + THRESHOLD,
39500
- max: axis + dimension - THRESHOLD
39501
- };
39502
- };
39503
-
39504
- var DistributeElementsModule$1 = {
39505
- __init__: [ 'distributeElements' ],
39506
- distributeElements: [ 'type', DistributeElements$1 ]
39507
- };
39567
+ Palette.prototype._toggleState = function(state) {
39508
39568
 
39509
- /**
39510
- * Registers element exclude filters for elements that
39511
- * currently do not support distribution.
39512
- */
39513
- function BpmnDistributeElements(distributeElements, eventBus, rules) {
39514
- RuleProvider.call(this, eventBus);
39515
- }
39569
+ state = state || {};
39516
39570
 
39517
- BpmnDistributeElements.$inject = [ 'distributeElements', 'eventBus', 'rules' ];
39571
+ var parent = this._getParentContainer(),
39572
+ container = this._container;
39518
39573
 
39519
- e$6(BpmnDistributeElements, RuleProvider);
39574
+ var eventBus = this._eventBus;
39520
39575
 
39521
- BpmnDistributeElements.prototype.init = function() {
39522
- this.addRule('elements.distribute', function(context) {
39523
- var elements = context.elements;
39576
+ var twoColumn;
39524
39577
 
39525
- elements = filter(elements, function(element) {
39526
- var cannotDistribute = isAny(element, [
39527
- 'bpmn:Association',
39528
- 'bpmn:BoundaryEvent',
39529
- 'bpmn:DataInputAssociation',
39530
- 'bpmn:DataOutputAssociation',
39531
- 'bpmn:Lane',
39532
- 'bpmn:MessageFlow',
39533
- 'bpmn:SequenceFlow',
39534
- 'bpmn:TextAnnotation'
39535
- ]);
39578
+ var cls = classes$1(container),
39579
+ parentCls = classes$1(parent);
39536
39580
 
39537
- return !(element.labelTarget || cannotDistribute);
39538
- });
39581
+ if ('twoColumn' in state) {
39582
+ twoColumn = state.twoColumn;
39583
+ } else {
39584
+ twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
39585
+ }
39539
39586
 
39540
- // filter out elements which are children of any of the selected elements
39541
- elements = getParents$3(elements);
39587
+ // always update two column
39588
+ cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
39589
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
39542
39590
 
39543
- if (elements.length < 3) {
39544
- return false;
39545
- }
39591
+ if ('open' in state) {
39592
+ cls.toggle(PALETTE_OPEN_CLS, state.open);
39593
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
39594
+ }
39546
39595
 
39547
- return elements;
39596
+ eventBus.fire('palette.changed', {
39597
+ twoColumn: twoColumn,
39598
+ open: this.isOpen()
39548
39599
  });
39549
39600
  };
39550
39601
 
39551
- /**
39552
- * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
39553
- * and then replace respective icons with the optimized data URIs in `./dist`.
39554
- */
39555
- var icons = {
39556
- horizontal: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M450%20400V150h900v250%22%2F%3E%3Crect%20x%3D%22150%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%221200%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%221050%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%22800%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E',
39557
- vertical: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M400%201350H150V450h250%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%22150%22%20width%3D%221200%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%221050%22%20width%3D%22800%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E',
39558
- };
39602
+ Palette.prototype._update = function() {
39559
39603
 
39560
- var ICONS = icons;
39604
+ var entriesContainer = query('.djs-palette-entries', this._container),
39605
+ entries = this._entries = this.getEntries();
39561
39606
 
39562
- var LOW_PRIORITY$j = 900;
39607
+ clear$1(entriesContainer);
39563
39608
 
39564
- /**
39565
- * A provider for distribute elements popup menu.
39566
- */
39567
- function DistributeElementsMenuProvider(
39568
- popupMenu, distributeElements, translate, rules) {
39569
- this._distributeElements = distributeElements;
39570
- this._translate = translate;
39571
- this._popupMenu = popupMenu;
39572
- this._rules = rules;
39609
+ forEach$1(entries, function(entry, id) {
39573
39610
 
39574
- popupMenu.registerProvider('align-elements', LOW_PRIORITY$j, this);
39575
- }
39611
+ var grouping = entry.group || 'default';
39576
39612
 
39577
- DistributeElementsMenuProvider.$inject = [
39578
- 'popupMenu',
39579
- 'distributeElements',
39580
- 'translate',
39581
- 'rules'
39582
- ];
39613
+ var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
39614
+ if (!container) {
39615
+ container = domify$1('<div class="group"></div>');
39616
+ attr$1(container, 'data-group', grouping);
39583
39617
 
39584
- DistributeElementsMenuProvider.prototype.getPopupMenuEntries = function(elements) {
39585
- var entries = {};
39618
+ entriesContainer.appendChild(container);
39619
+ }
39586
39620
 
39587
- if (this._isAllowed(elements)) {
39588
- assign$1(entries, this._getEntries(elements));
39589
- }
39621
+ var html = entry.html || (
39622
+ entry.separator ?
39623
+ '<hr class="separator" />' :
39624
+ '<div class="entry" draggable="true"></div>');
39590
39625
 
39591
- return entries;
39592
- };
39593
39626
 
39594
- DistributeElementsMenuProvider.prototype._isAllowed = function(elements) {
39595
- return this._rules.allowed('elements.distribute', { elements: elements });
39596
- };
39627
+ var control = domify$1(html);
39628
+ container.appendChild(control);
39597
39629
 
39598
- DistributeElementsMenuProvider.prototype._getEntries = function(elements) {
39599
- var distributeElements = this._distributeElements,
39600
- translate = this._translate,
39601
- popupMenu = this._popupMenu;
39630
+ if (!entry.separator) {
39631
+ attr$1(control, 'data-action', id);
39602
39632
 
39603
- var entries = {
39604
- 'distribute-elements-horizontal': {
39605
- group: 'distribute',
39606
- title: translate('Distribute elements horizontally'),
39607
- className: 'bjs-align-elements-menu-entry',
39608
- imageUrl: ICONS['horizontal'],
39609
- action: function(event, entry) {
39610
- distributeElements.trigger(elements, 'horizontal');
39611
- popupMenu.close();
39633
+ if (entry.title) {
39634
+ attr$1(control, 'title', entry.title);
39612
39635
  }
39613
- },
39614
- 'distribute-elements-vertical': {
39615
- group: 'distribute',
39616
- title: translate('Distribute elements vertically'),
39617
- imageUrl: ICONS['vertical'],
39618
- action: function(event, entry) {
39619
- distributeElements.trigger(elements, 'vertical');
39620
- popupMenu.close();
39636
+
39637
+ if (entry.className) {
39638
+ addClasses(control, entry.className);
39621
39639
  }
39622
- },
39623
- };
39624
39640
 
39625
- return entries;
39626
- };
39641
+ if (entry.imageUrl) {
39642
+ var image = domify$1('<img>');
39643
+ attr$1(image, 'src', entry.imageUrl);
39627
39644
 
39628
- var DistributeElementsModule = {
39645
+ control.appendChild(image);
39646
+ }
39647
+ }
39648
+ });
39649
+
39650
+ // open after update
39651
+ this.open();
39652
+ };
39653
+
39654
+
39655
+ /**
39656
+ * Trigger an action available on the palette
39657
+ *
39658
+ * @param {string} action
39659
+ * @param {Event} event
39660
+ */
39661
+ Palette.prototype.trigger = function(action, event, autoActivate) {
39662
+ var entry,
39663
+ originalEvent,
39664
+ button = event.delegateTarget || event.target;
39665
+
39666
+ if (!button) {
39667
+ return event.preventDefault();
39668
+ }
39669
+
39670
+ entry = attr$1(button, 'data-action');
39671
+ originalEvent = event.originalEvent || event;
39672
+
39673
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
39674
+ };
39675
+
39676
+ Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
39677
+ var entries = this._entries,
39678
+ entry,
39679
+ handler;
39680
+
39681
+ entry = entries[entryId];
39682
+
39683
+ // when user clicks on the palette and not on an action
39684
+ if (!entry) {
39685
+ return;
39686
+ }
39687
+
39688
+ handler = entry.action;
39689
+
39690
+ // simple action (via callback function)
39691
+ if (isFunction(handler)) {
39692
+ if (action === 'click') {
39693
+ return handler(event, autoActivate);
39694
+ }
39695
+ } else {
39696
+ if (handler[action]) {
39697
+ return handler[action](event, autoActivate);
39698
+ }
39699
+ }
39700
+
39701
+ // silence other actions
39702
+ event.preventDefault();
39703
+ };
39704
+
39705
+ Palette.prototype._layoutChanged = function() {
39706
+ this._toggleState({});
39707
+ };
39708
+
39709
+ /**
39710
+ * Do we need to collapse to two columns?
39711
+ *
39712
+ * @param {number} availableHeight
39713
+ * @param {Object} entries
39714
+ *
39715
+ * @return {boolean}
39716
+ */
39717
+ Palette.prototype._needsCollapse = function(availableHeight, entries) {
39718
+
39719
+ // top margin + bottom toggle + bottom margin
39720
+ // implementors must override this method if they
39721
+ // change the palette styles
39722
+ var margin = 20 + 10 + 20;
39723
+
39724
+ var entriesHeight = Object.keys(entries).length * 46;
39725
+
39726
+ return availableHeight < entriesHeight + margin;
39727
+ };
39728
+
39729
+ /**
39730
+ * Close the palette
39731
+ */
39732
+ Palette.prototype.close = function() {
39733
+
39734
+ this._toggleState({
39735
+ open: false,
39736
+ twoColumn: false
39737
+ });
39738
+ };
39739
+
39740
+
39741
+ /**
39742
+ * Open the palette
39743
+ */
39744
+ Palette.prototype.open = function() {
39745
+ this._toggleState({ open: true });
39746
+ };
39747
+
39748
+
39749
+ Palette.prototype.toggle = function(open) {
39750
+ if (this.isOpen()) {
39751
+ this.close();
39752
+ } else {
39753
+ this.open();
39754
+ }
39755
+ };
39756
+
39757
+ Palette.prototype.isActiveTool = function(tool) {
39758
+ return tool && this._activeTool === tool;
39759
+ };
39760
+
39761
+ Palette.prototype.updateToolHighlight = function(name) {
39762
+ var entriesContainer,
39763
+ toolsContainer;
39764
+
39765
+ if (!this._toolsContainer) {
39766
+ entriesContainer = query('.djs-palette-entries', this._container);
39767
+
39768
+ this._toolsContainer = query('[data-group=tools]', entriesContainer);
39769
+ }
39770
+
39771
+ toolsContainer = this._toolsContainer;
39772
+
39773
+ forEach$1(toolsContainer.children, function(tool) {
39774
+ var actionName = tool.getAttribute('data-action');
39775
+
39776
+ if (!actionName) {
39777
+ return;
39778
+ }
39779
+
39780
+ var toolClasses = classes$1(tool);
39781
+
39782
+ actionName = actionName.replace('-tool', '');
39783
+
39784
+ if (toolClasses.contains('entry') && actionName === name) {
39785
+ toolClasses.add('highlighted-entry');
39786
+ } else {
39787
+ toolClasses.remove('highlighted-entry');
39788
+ }
39789
+ });
39790
+ };
39791
+
39792
+
39793
+ /**
39794
+ * Return true if the palette is opened.
39795
+ *
39796
+ * @example
39797
+ *
39798
+ * palette.open();
39799
+ *
39800
+ * if (palette.isOpen()) {
39801
+ * // yes, we are open
39802
+ * }
39803
+ *
39804
+ * @return {boolean} true if palette is opened
39805
+ */
39806
+ Palette.prototype.isOpen = function() {
39807
+ return classes$1(this._container).has(PALETTE_OPEN_CLS);
39808
+ };
39809
+
39810
+ /**
39811
+ * Get container the palette lives in.
39812
+ *
39813
+ * @return {Element}
39814
+ */
39815
+ Palette.prototype._getParentContainer = function() {
39816
+ return this._canvas.getContainer();
39817
+ };
39818
+
39819
+
39820
+ /* markup definition */
39821
+
39822
+ Palette.HTML_MARKUP =
39823
+ '<div class="djs-palette">' +
39824
+ '<div class="djs-palette-entries"></div>' +
39825
+ '<div class="djs-palette-toggle"></div>' +
39826
+ '</div>';
39827
+
39828
+
39829
+ // helpers //////////////////////
39830
+
39831
+ function addClasses(element, classNames) {
39832
+
39833
+ var classes = classes$1(element);
39834
+
39835
+ var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
39836
+ actualClassNames.forEach(function(cls) {
39837
+ classes.add(cls);
39838
+ });
39839
+ }
39840
+
39841
+ function addPaletteEntries(entries, provider) {
39842
+
39843
+ var entriesOrUpdater = provider.getPaletteEntries();
39844
+
39845
+ if (isFunction(entriesOrUpdater)) {
39846
+ return entriesOrUpdater(entries);
39847
+ }
39848
+
39849
+ forEach$1(entriesOrUpdater, function(entry, id) {
39850
+ entries[id] = entry;
39851
+ });
39852
+
39853
+ return entries;
39854
+ }
39855
+
39856
+ var PaletteModule$1 = {
39857
+ __init__: [ 'palette' ],
39858
+ palette: [ 'type', Palette ]
39859
+ };
39860
+
39861
+ var EVENT_GROUP = {
39862
+ id: 'events',
39863
+ name: 'Events'
39864
+ };
39865
+
39866
+ var TASK_GROUP = {
39867
+ id: 'tasks',
39868
+ name: 'Tasks'
39869
+ };
39870
+
39871
+ var DATA_GROUP = {
39872
+ id: 'data',
39873
+ name: 'Data'
39874
+ };
39875
+
39876
+ var PARTICIPANT_GROUP = {
39877
+ id: 'participants',
39878
+ name: 'Participants'
39879
+ };
39880
+
39881
+ var SUBPROCESS_GROUP = {
39882
+ id: 'subprocess',
39883
+ name: 'Sub Processes'
39884
+ };
39885
+
39886
+ var GATEWAY_GROUP = {
39887
+ id: 'gateways',
39888
+ name: 'Gateways'
39889
+ };
39890
+
39891
+ var NONE_EVENTS = [
39892
+ {
39893
+ label: 'Start Event',
39894
+ actionName: 'none-start-event',
39895
+ className: 'bpmn-icon-start-event-none',
39896
+ target: {
39897
+ type: 'bpmn:StartEvent'
39898
+ }
39899
+ },
39900
+ {
39901
+ label: 'Intermediate Throw Event',
39902
+ actionName: 'none-intermediate-throwing',
39903
+ className: 'bpmn-icon-intermediate-event-none',
39904
+ target: {
39905
+ type: 'bpmn:IntermediateThrowEvent'
39906
+ }
39907
+ },
39908
+ {
39909
+ label: 'Boundary Event',
39910
+ actionName: 'none-boundary-event',
39911
+ className: 'bpmn-icon-intermediate-event-none',
39912
+ target: {
39913
+ type: 'bpmn:BoundaryEvent'
39914
+ }
39915
+ },
39916
+ {
39917
+ label: 'End Event',
39918
+ actionName: 'none-end-event',
39919
+ className: 'bpmn-icon-end-event-none',
39920
+ target: {
39921
+ type: 'bpmn:EndEvent'
39922
+ }
39923
+ }
39924
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39925
+
39926
+ var TYPED_START_EVENTS = [
39927
+ {
39928
+ label: 'Message Start Event',
39929
+ actionName: 'message-start',
39930
+ className: 'bpmn-icon-start-event-message',
39931
+ target: {
39932
+ type: 'bpmn:StartEvent',
39933
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39934
+ }
39935
+ },
39936
+ {
39937
+ label: 'Timer Start Event',
39938
+ actionName: 'timer-start',
39939
+ className: 'bpmn-icon-start-event-timer',
39940
+ target: {
39941
+ type: 'bpmn:StartEvent',
39942
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39943
+ }
39944
+ },
39945
+ {
39946
+ label: 'Conditional Start Event',
39947
+ actionName: 'conditional-start',
39948
+ className: 'bpmn-icon-start-event-condition',
39949
+ target: {
39950
+ type: 'bpmn:StartEvent',
39951
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39952
+ }
39953
+ },
39954
+ {
39955
+ label: 'Signal Start Event',
39956
+ actionName: 'signal-start',
39957
+ className: 'bpmn-icon-start-event-signal',
39958
+ target: {
39959
+ type: 'bpmn:StartEvent',
39960
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39961
+ }
39962
+ }
39963
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39964
+
39965
+ var TYPED_INTERMEDIATE_EVENT = [
39966
+ {
39967
+ label: 'Message Intermediate Catch Event',
39968
+ actionName: 'message-intermediate-catch',
39969
+ className: 'bpmn-icon-intermediate-event-catch-message',
39970
+ target: {
39971
+ type: 'bpmn:IntermediateCatchEvent',
39972
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39973
+ }
39974
+ },
39975
+ {
39976
+ label: 'Message Intermediate Throw Event',
39977
+ actionName: 'message-intermediate-throw',
39978
+ className: 'bpmn-icon-intermediate-event-throw-message',
39979
+ target: {
39980
+ type: 'bpmn:IntermediateThrowEvent',
39981
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39982
+ }
39983
+ },
39984
+ {
39985
+ label: 'Timer Intermediate Catch Event',
39986
+ actionName: 'timer-intermediate-catch',
39987
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39988
+ target: {
39989
+ type: 'bpmn:IntermediateCatchEvent',
39990
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39991
+ }
39992
+ },
39993
+ {
39994
+ label: 'Escalation Intermediate Throw Event',
39995
+ actionName: 'escalation-intermediate-throw',
39996
+ className: 'bpmn-icon-intermediate-event-throw-escalation',
39997
+ target: {
39998
+ type: 'bpmn:IntermediateThrowEvent',
39999
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40000
+ }
40001
+ },
40002
+ {
40003
+ label: 'Conditional Intermediate Catch Event',
40004
+ actionName: 'conditional-intermediate-catch',
40005
+ className: 'bpmn-icon-intermediate-event-catch-condition',
40006
+ target: {
40007
+ type: 'bpmn:IntermediateCatchEvent',
40008
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
40009
+ }
40010
+ },
40011
+ {
40012
+ label: 'Link Intermediate Catch Event',
40013
+ actionName: 'link-intermediate-catch',
40014
+ className: 'bpmn-icon-intermediate-event-catch-link',
40015
+ target: {
40016
+ type: 'bpmn:IntermediateCatchEvent',
40017
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
40018
+ eventDefinitionAttrs: {
40019
+ name: ''
40020
+ }
40021
+ }
40022
+ },
40023
+ {
40024
+ label: 'Link Intermediate Throw Event',
40025
+ actionName: 'link-intermediate-throw',
40026
+ className: 'bpmn-icon-intermediate-event-throw-link',
40027
+ target: {
40028
+ type: 'bpmn:IntermediateThrowEvent',
40029
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
40030
+ eventDefinitionAttrs: {
40031
+ name: ''
40032
+ }
40033
+ }
40034
+ },
40035
+ {
40036
+ label: 'Compensation Intermediate Throw Event',
40037
+ actionName: 'compensation-intermediate-throw',
40038
+ className: 'bpmn-icon-intermediate-event-throw-compensation',
40039
+ target: {
40040
+ type: 'bpmn:IntermediateThrowEvent',
40041
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40042
+ }
40043
+ },
40044
+ {
40045
+ label: 'Signal Intermediate Catch Event',
40046
+ actionName: 'signal-intermediate-catch',
40047
+ className: 'bpmn-icon-intermediate-event-catch-signal',
40048
+ target: {
40049
+ type: 'bpmn:IntermediateCatchEvent',
40050
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40051
+ }
40052
+ },
40053
+ {
40054
+ label: 'Signal Intermediate Throw Event',
40055
+ actionName: 'signal-intermediate-throw',
40056
+ className: 'bpmn-icon-intermediate-event-throw-signal',
40057
+ target: {
40058
+ type: 'bpmn:IntermediateThrowEvent',
40059
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40060
+ }
40061
+ }
40062
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40063
+
40064
+ var TYPED_BOUNDARY_EVENT = [
40065
+ {
40066
+ label: 'Message Boundary Event',
40067
+ actionName: 'message-boundary',
40068
+ className: 'bpmn-icon-intermediate-event-catch-message',
40069
+ target: {
40070
+ type: 'bpmn:BoundaryEvent',
40071
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
40072
+ }
40073
+ },
40074
+ {
40075
+ label: 'Timer Boundary Event',
40076
+ actionName: 'timer-boundary',
40077
+ className: 'bpmn-icon-intermediate-event-catch-timer',
40078
+ target: {
40079
+ type: 'bpmn:BoundaryEvent',
40080
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
40081
+ }
40082
+ },
40083
+ {
40084
+ label: 'Escalation Boundary Event',
40085
+ actionName: 'escalation-boundary',
40086
+ className: 'bpmn-icon-intermediate-event-catch-escalation',
40087
+ target: {
40088
+ type: 'bpmn:BoundaryEvent',
40089
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40090
+ }
40091
+ },
40092
+ {
40093
+ label: 'Conditional Boundary Event',
40094
+ actionName: 'conditional-boundary',
40095
+ className: 'bpmn-icon-intermediate-event-catch-condition',
40096
+ target: {
40097
+ type: 'bpmn:BoundaryEvent',
40098
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
40099
+ }
40100
+ },
40101
+ {
40102
+ label: 'Error Boundary Event',
40103
+ actionName: 'error-boundary',
40104
+ className: 'bpmn-icon-intermediate-event-catch-error',
40105
+ target: {
40106
+ type: 'bpmn:BoundaryEvent',
40107
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
40108
+ }
40109
+ },
40110
+ {
40111
+ label: 'Cancel Boundary Event',
40112
+ actionName: 'cancel-boundary',
40113
+ className: 'bpmn-icon-intermediate-event-catch-cancel',
40114
+ target: {
40115
+ type: 'bpmn:BoundaryEvent',
40116
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
40117
+ }
40118
+ },
40119
+ {
40120
+ label: 'Signal Boundary Event',
40121
+ actionName: 'signal-boundary',
40122
+ className: 'bpmn-icon-intermediate-event-catch-signal',
40123
+ target: {
40124
+ type: 'bpmn:BoundaryEvent',
40125
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40126
+ }
40127
+ },
40128
+ {
40129
+ label: 'Compensation Boundary Event',
40130
+ actionName: 'compensation-boundary',
40131
+ className: 'bpmn-icon-intermediate-event-catch-compensation',
40132
+ target: {
40133
+ type: 'bpmn:BoundaryEvent',
40134
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40135
+ }
40136
+ },
40137
+ {
40138
+ label: 'Message Boundary Event (non-interrupting)',
40139
+ actionName: 'non-interrupting-message-boundary',
40140
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
40141
+ target: {
40142
+ type: 'bpmn:BoundaryEvent',
40143
+ eventDefinitionType: 'bpmn:MessageEventDefinition',
40144
+ cancelActivity: false
40145
+ }
40146
+ },
40147
+ {
40148
+ label: 'Timer Boundary Event (non-interrupting)',
40149
+ actionName: 'non-interrupting-timer-boundary',
40150
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
40151
+ target: {
40152
+ type: 'bpmn:BoundaryEvent',
40153
+ eventDefinitionType: 'bpmn:TimerEventDefinition',
40154
+ cancelActivity: false
40155
+ }
40156
+ },
40157
+ {
40158
+ label: 'Escalation Boundary Event (non-interrupting)',
40159
+ actionName: 'non-interrupting-escalation-boundary',
40160
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
40161
+ target: {
40162
+ type: 'bpmn:BoundaryEvent',
40163
+ eventDefinitionType: 'bpmn:EscalationEventDefinition',
40164
+ cancelActivity: false
40165
+ }
40166
+ },
40167
+ {
40168
+ label: 'Conditional Boundary Event (non-interrupting)',
40169
+ actionName: 'non-interrupting-conditional-boundary',
40170
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
40171
+ target: {
40172
+ type: 'bpmn:BoundaryEvent',
40173
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition',
40174
+ cancelActivity: false
40175
+ }
40176
+ },
40177
+ {
40178
+ label: 'Signal Boundary Event (non-interrupting)',
40179
+ actionName: 'non-interrupting-signal-boundary',
40180
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
40181
+ target: {
40182
+ type: 'bpmn:BoundaryEvent',
40183
+ eventDefinitionType: 'bpmn:SignalEventDefinition',
40184
+ cancelActivity: false
40185
+ }
40186
+ }
40187
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40188
+
40189
+ var TYPED_END_EVENT = [
40190
+ {
40191
+ label: 'Message End Event',
40192
+ actionName: 'message-end',
40193
+ className: 'bpmn-icon-end-event-message',
40194
+ target: {
40195
+ type: 'bpmn:EndEvent',
40196
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
40197
+ }
40198
+ },
40199
+ {
40200
+ label: 'Escalation End Event',
40201
+ actionName: 'escalation-end',
40202
+ className: 'bpmn-icon-end-event-escalation',
40203
+ target: {
40204
+ type: 'bpmn:EndEvent',
40205
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40206
+ }
40207
+ },
40208
+ {
40209
+ label: 'Error End Event',
40210
+ actionName: 'error-end',
40211
+ className: 'bpmn-icon-end-event-error',
40212
+ target: {
40213
+ type: 'bpmn:EndEvent',
40214
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
40215
+ }
40216
+ },
40217
+ {
40218
+ label: 'Cancel End Event',
40219
+ actionName: 'cancel-end',
40220
+ className: 'bpmn-icon-end-event-cancel',
40221
+ target: {
40222
+ type: 'bpmn:EndEvent',
40223
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
40224
+ }
40225
+ },
40226
+ {
40227
+ label: 'Compensation End Event',
40228
+ actionName: 'compensation-end',
40229
+ className: 'bpmn-icon-end-event-compensation',
40230
+ target: {
40231
+ type: 'bpmn:EndEvent',
40232
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40233
+ }
40234
+ },
40235
+ {
40236
+ label: 'Signal End Event',
40237
+ actionName: 'signal-end',
40238
+ className: 'bpmn-icon-end-event-signal',
40239
+ target: {
40240
+ type: 'bpmn:EndEvent',
40241
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40242
+ }
40243
+ },
40244
+ {
40245
+ label: 'Terminate End Event',
40246
+ actionName: 'terminate-end',
40247
+ className: 'bpmn-icon-end-event-terminate',
40248
+ target: {
40249
+ type: 'bpmn:EndEvent',
40250
+ eventDefinitionType: 'bpmn:TerminateEventDefinition'
40251
+ }
40252
+ }
40253
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40254
+
40255
+ var GATEWAY = [
40256
+ {
40257
+ label: 'Exclusive Gateway',
40258
+ actionName: 'exclusive-gateway',
40259
+ className: 'bpmn-icon-gateway-xor',
40260
+ target: {
40261
+ type: 'bpmn:ExclusiveGateway'
40262
+ }
40263
+ },
40264
+ {
40265
+ label: 'Parallel Gateway',
40266
+ actionName: 'parallel-gateway',
40267
+ className: 'bpmn-icon-gateway-parallel',
40268
+ target: {
40269
+ type: 'bpmn:ParallelGateway'
40270
+ }
40271
+ },
40272
+ {
40273
+ label: 'Inclusive Gateway',
40274
+ search: 'or',
40275
+ actionName: 'inclusive-gateway',
40276
+ className: 'bpmn-icon-gateway-or',
40277
+ target: {
40278
+ type: 'bpmn:InclusiveGateway'
40279
+ },
40280
+ rank: -1
40281
+ },
40282
+ {
40283
+ label: 'Complex Gateway',
40284
+ actionName: 'complex-gateway',
40285
+ className: 'bpmn-icon-gateway-complex',
40286
+ target: {
40287
+ type: 'bpmn:ComplexGateway'
40288
+ },
40289
+ rank: -1
40290
+ },
40291
+ {
40292
+ label: 'Event based Gateway',
40293
+ actionName: 'event-based-gateway',
40294
+ className: 'bpmn-icon-gateway-eventbased',
40295
+ target: {
40296
+ type: 'bpmn:EventBasedGateway',
40297
+ instantiate: false,
40298
+ eventGatewayType: 'Exclusive'
40299
+ }
40300
+ }
40301
+ ].map(option => ({ ...option, group: GATEWAY_GROUP }));
40302
+
40303
+ var SUBPROCESS = [
40304
+ {
40305
+ label: 'Transaction',
40306
+ actionName: 'transaction',
40307
+ className: 'bpmn-icon-transaction',
40308
+ target: {
40309
+ type: 'bpmn:Transaction',
40310
+ isExpanded: true
40311
+ }
40312
+ },
40313
+ {
40314
+ label: 'Event Sub Process',
40315
+ search: 'subprocess',
40316
+ actionName: 'event-subprocess',
40317
+ className: 'bpmn-icon-event-subprocess-expanded',
40318
+ target: {
40319
+ type: 'bpmn:SubProcess',
40320
+ triggeredByEvent: true,
40321
+ isExpanded: true
40322
+ }
40323
+ },
40324
+ {
40325
+ label: 'Sub Process (collapsed)',
40326
+ search: 'subprocess',
40327
+ actionName: 'collapsed-subprocess',
40328
+ className: 'bpmn-icon-subprocess-collapsed',
40329
+ target: {
40330
+ type: 'bpmn:SubProcess',
40331
+ isExpanded: false
40332
+ }
40333
+ },
40334
+ {
40335
+ label: 'Sub Process (expanded)',
40336
+ search: 'subprocess',
40337
+ actionName: 'expanded-subprocess',
40338
+ className: 'bpmn-icon-subprocess-collapsed',
40339
+ target: {
40340
+ type: 'bpmn:SubProcess',
40341
+ isExpanded: true
40342
+ }
40343
+ }
40344
+ ].map(option => ({ ...option, group: SUBPROCESS_GROUP }));
40345
+
40346
+ var TASK = [
40347
+ {
40348
+ label: 'Task',
40349
+ actionName: 'task',
40350
+ className: 'bpmn-icon-task',
40351
+ target: {
40352
+ type: 'bpmn:Task'
40353
+ }
40354
+ },
40355
+ {
40356
+ label: 'User Task',
40357
+ actionName: 'user-task',
40358
+ className: 'bpmn-icon-user',
40359
+ target: {
40360
+ type: 'bpmn:UserTask'
40361
+ }
40362
+ },
40363
+ {
40364
+ label: 'Service Task',
40365
+ actionName: 'service-task',
40366
+ className: 'bpmn-icon-service',
40367
+ target: {
40368
+ type: 'bpmn:ServiceTask'
40369
+ }
40370
+ },
40371
+ {
40372
+ label: 'Send Task',
40373
+ actionName: 'send-task',
40374
+ className: 'bpmn-icon-send',
40375
+ target: {
40376
+ type: 'bpmn:SendTask'
40377
+ },
40378
+ rank: -1
40379
+ },
40380
+ {
40381
+ label: 'Receive Task',
40382
+ actionName: 'receive-task',
40383
+ className: 'bpmn-icon-receive',
40384
+ target: {
40385
+ type: 'bpmn:ReceiveTask'
40386
+ },
40387
+ rank: -1
40388
+ },
40389
+ {
40390
+ label: 'Manual Task',
40391
+ actionName: 'manual-task',
40392
+ className: 'bpmn-icon-manual',
40393
+ target: {
40394
+ type: 'bpmn:ManualTask'
40395
+ },
40396
+ rank: -1
40397
+ },
40398
+ {
40399
+ label: 'Business Rule Task',
40400
+ actionName: 'rule-task',
40401
+ className: 'bpmn-icon-business-rule',
40402
+ target: {
40403
+ type: 'bpmn:BusinessRuleTask'
40404
+ }
40405
+ },
40406
+ {
40407
+ label: 'Script Task',
40408
+ actionName: 'script-task',
40409
+ className: 'bpmn-icon-script',
40410
+ target: {
40411
+ type: 'bpmn:ScriptTask'
40412
+ }
40413
+ },
40414
+ {
40415
+ label: 'Call Activity',
40416
+ actionName: 'call-activity',
40417
+ className: 'bpmn-icon-call-activity',
40418
+ target: {
40419
+ type: 'bpmn:CallActivity'
40420
+ }
40421
+ }
40422
+ ].map(option => ({ ...option, group: TASK_GROUP }));
40423
+
40424
+ var DATA_OBJECTS = [
40425
+ {
40426
+ label: 'Data Store Reference',
40427
+ actionName: 'data-store-reference',
40428
+ className: 'bpmn-icon-data-store',
40429
+ target: {
40430
+ type: 'bpmn:DataStoreReference'
40431
+ }
40432
+ },
40433
+ {
40434
+ label: 'Data Object Reference',
40435
+ actionName: 'data-object-reference',
40436
+ className: 'bpmn-icon-data-object',
40437
+ target: {
40438
+ type: 'bpmn:DataObjectReference'
40439
+ }
40440
+ }
40441
+ ].map(option => ({ ...option, group: DATA_GROUP }));
40442
+
40443
+ var PARTICIPANT = [
40444
+ {
40445
+ label: 'Expanded Pool',
40446
+ search: 'Participant',
40447
+ actionName: 'expanded-pool',
40448
+ className: 'bpmn-icon-participant',
40449
+ target: {
40450
+ type: 'bpmn:Participant',
40451
+ isExpanded: true
40452
+ }
40453
+ },
40454
+ {
40455
+ label: 'Empty Pool',
40456
+ search: 'Collapsed Participant',
40457
+ actionName: 'collapsed-pool',
40458
+ className: 'bpmn-icon-lane',
40459
+ target: {
40460
+ type: 'bpmn:Participant',
40461
+ isExpanded: false
40462
+ }
40463
+ }
40464
+ ].map(option => ({ ...option, group: PARTICIPANT_GROUP }));
40465
+
40466
+ var CREATE_OPTIONS = [
40467
+ ...GATEWAY,
40468
+ ...TASK,
40469
+ ...SUBPROCESS,
40470
+ ...NONE_EVENTS,
40471
+ ...TYPED_START_EVENTS,
40472
+ ...TYPED_INTERMEDIATE_EVENT,
40473
+ ...TYPED_END_EVENT,
40474
+ ...TYPED_BOUNDARY_EVENT,
40475
+ ...DATA_OBJECTS,
40476
+ ...PARTICIPANT
40477
+ ];
40478
+
40479
+ /**
40480
+ * This module is a create menu provider for the popup menu.
40481
+ */
40482
+ function CreateMenuProvider(
40483
+ elementFactory, popupMenu, create,
40484
+ autoPlace, mouse, translate
40485
+ ) {
40486
+ this._elementFactory = elementFactory;
40487
+ this._popupMenu = popupMenu;
40488
+ this._create = create;
40489
+ this._autoPlace = autoPlace;
40490
+ this._mouse = mouse;
40491
+ this._translate = translate;
40492
+
40493
+ this.register();
40494
+ }
40495
+
40496
+ CreateMenuProvider.$inject = [
40497
+ 'elementFactory',
40498
+ 'popupMenu',
40499
+ 'create',
40500
+ 'autoPlace',
40501
+ 'mouse',
40502
+ 'translate'
40503
+ ];
40504
+
40505
+ /**
40506
+ * Register create menu provider in the popup menu
40507
+ */
40508
+ CreateMenuProvider.prototype.register = function() {
40509
+ this._popupMenu.registerProvider('bpmn-create', this);
40510
+ };
40511
+
40512
+ /**
40513
+ * Get all entries
40514
+ *
40515
+ * @param {djs.model.Base} element
40516
+ *
40517
+ * @return {Array<Object>} a list of menu entry items
40518
+ */
40519
+ CreateMenuProvider.prototype.getPopupMenuEntries = function() {
40520
+
40521
+ const entries = {};
40522
+
40523
+ // map options to menu entries
40524
+ CREATE_OPTIONS.forEach(option => {
40525
+ const {
40526
+ actionName,
40527
+ className,
40528
+ label,
40529
+ target,
40530
+ description,
40531
+ group,
40532
+ search,
40533
+ rank
40534
+ } = option;
40535
+
40536
+ const targetAction = this._createEntryAction(target);
40537
+
40538
+ entries[`create-${actionName}`] = {
40539
+ label: label && this._translate(label),
40540
+ className,
40541
+ description,
40542
+ group: group && {
40543
+ ...group,
40544
+ name: this._translate(group.name)
40545
+ },
40546
+ search,
40547
+ rank,
40548
+ action: {
40549
+ click: targetAction,
40550
+ dragstart: targetAction
40551
+ }
40552
+ };
40553
+ });
40554
+
40555
+ return entries;
40556
+ };
40557
+
40558
+ /**
40559
+ * Create an action for a given target
40560
+ *
40561
+ * @param {Object} target
40562
+ * @returns {Object}
40563
+ */
40564
+ CreateMenuProvider.prototype._createEntryAction = function(target) {
40565
+
40566
+ const create = this._create;
40567
+ const mouse = this._mouse;
40568
+ const popupMenu = this._popupMenu;
40569
+ const elementFactory = this._elementFactory;
40570
+
40571
+ let newElement;
40572
+
40573
+ return (event) => {
40574
+ popupMenu.close();
40575
+
40576
+ // create the new element
40577
+ if (target.type === 'bpmn:Participant') {
40578
+ newElement = elementFactory.createParticipantShape(target);
40579
+ } else {
40580
+ newElement = elementFactory.create('shape', target);
40581
+ }
40582
+
40583
+ // use last mouse event if triggered via keyboard
40584
+ if (event instanceof KeyboardEvent) {
40585
+ event = mouse.getLastMoveEvent();
40586
+ }
40587
+
40588
+ return create.start(event, newElement);
40589
+ };
40590
+ };
40591
+
40592
+ /**
40593
+ * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
40594
+ * and then replace respective icons with the optimized data URIs in `./dist`.
40595
+ */
40596
+ const appendIcon = 'data:image/svg+xml,%3Csvg%20width%3D%2222%22%20height%3D%2222%22%20viewBox%3D%220%200%205.82%205.82%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cpath%20d%3D%22M1.3%203.4c.3%200%20.5-.2.5-.5s-.2-.4-.5-.4c-.2%200-.4.1-.4.4%200%20.3.2.5.4.5zM3%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5zM4.6%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5z%22%2F%3E%0A%3C%2Fsvg%3E';
40597
+ const createIcon = 'data:image/svg+xml,%3Csvg%20width%3D%2246%22%20height%3D%2246%22%20viewBox%3D%22-2%20-2%209.82%209.82%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M1.3%203.4c.3%200%20.5-.2.5-.5s-.2-.4-.5-.4c-.2%200-.4.1-.4.4%200%20.3.2.5.4.5zM3%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5zM4.6%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5z%22%2F%3E%0A%3C%2Fsvg%3E';
40598
+
40599
+ /**
40600
+ * A palette provider for the create elements menu.
40601
+ */
40602
+ function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
40603
+
40604
+ this._translate = translate;
40605
+ this._popupMenu = popupMenu;
40606
+ this._canvas = canvas;
40607
+ this._mouse = mouse;
40608
+
40609
+ palette.registerProvider(800,this);
40610
+ }
40611
+
40612
+ CreatePaletteProvider.$inject = [
40613
+ 'palette',
40614
+ 'translate',
40615
+ 'popupMenu',
40616
+ 'canvas',
40617
+ 'mouse'
40618
+ ];
40619
+
40620
+
40621
+ CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
40622
+ const translate = this._translate,
40623
+ popupMenu = this._popupMenu,
40624
+ canvas = this._canvas,
40625
+ mouse = this._mouse;
40626
+
40627
+ const getPosition = (event) => {
40628
+ const X_OFFSET = 35;
40629
+ const Y_OFFSET = 10;
40630
+
40631
+ if (event instanceof KeyboardEvent) {
40632
+ event = mouse.getLastMoveEvent();
40633
+ return { x: event.x, y: event.y };
40634
+ }
40635
+
40636
+ const target = event && event.target || query('.djs-palette [data-action="create"]');
40637
+ const targetPosition = target.getBoundingClientRect();
40638
+
40639
+ return target && {
40640
+ x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
40641
+ y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
40642
+ };
40643
+ };
40644
+
40645
+ return {
40646
+ 'create': {
40647
+ group: 'create',
40648
+ imageUrl: createIcon,
40649
+ title: translate('Create element'),
40650
+ action: {
40651
+ click: function(event) {
40652
+ const position = getPosition(event);
40653
+
40654
+ const element = canvas.getRootElement();
40655
+
40656
+ popupMenu.open(element, 'bpmn-create', position, {
40657
+ title: translate('Create element'),
40658
+ width: 300,
40659
+ search: true
40660
+ });
40661
+ }
40662
+ }
40663
+ }
40664
+ };
40665
+ };
40666
+
40667
+ /**
40668
+ * Registers and executes BPMN specific editor actions.
40669
+ *
40670
+ * @param {Injector} injector
40671
+ */
40672
+ function CreateAppendEditorActions(injector) {
40673
+ this._injector = injector;
40674
+
40675
+ this.registerActions();
40676
+ }
40677
+
40678
+ CreateAppendEditorActions.$inject = [
40679
+ 'injector'
40680
+ ];
40681
+
40682
+ /**
40683
+ * Register actions.
40684
+ *
40685
+ * @param {Injector} injector
40686
+ */
40687
+ CreateAppendEditorActions.prototype.registerActions = function() {
40688
+ var editorActions = this._injector.get('editorActions', false);
40689
+ var selection = this._injector.get('selection', false);
40690
+ var contextPad = this._injector.get('contextPad', false);
40691
+ var palette = this._injector.get('palette', false);
40692
+
40693
+ const actions = {};
40694
+
40695
+ // append
40696
+ if (selection && contextPad) {
40697
+ assign$1(actions, {
40698
+ 'appendElement': function(event) {
40699
+ contextPad.triggerEntry('append', 'click', event);
40700
+ } }
40701
+ );
40702
+ }
40703
+
40704
+ // create
40705
+ if (palette) {
40706
+ assign$1(actions, {
40707
+ 'createElement': function(event) {
40708
+ palette.triggerEntry('create', 'click', event);
40709
+ } }
40710
+ );
40711
+ }
40712
+
40713
+ editorActions && editorActions.register(actions);
40714
+
40715
+ };
40716
+
40717
+ /**
40718
+ * BPMN 2.0 specific keyboard bindings.
40719
+ *
40720
+ * @param {Injector} injector
40721
+ */
40722
+ function CreateAppendKeyboardBindings(injector) {
40723
+
40724
+ this._injector = injector;
40725
+ this._keyboard = this._injector.get('keyboard', false);
40726
+ this._editorActions = this._injector.get('editorActions', false);
40727
+ this._selection = this._injector.get('selection', false);
40728
+
40729
+ if (this._keyboard) {
40730
+ this._injector.invoke(KeyboardBindings, this);
40731
+ }
40732
+ }
40733
+
40734
+ e$6(CreateAppendKeyboardBindings, KeyboardBindings);
40735
+
40736
+ CreateAppendKeyboardBindings.$inject = [
40737
+ 'injector'
40738
+ ];
40739
+
40740
+
40741
+ /**
40742
+ * Register available keyboard bindings.
40743
+ *
40744
+ * @param {Keyboard} keyboard
40745
+ * @param {EditorActions} editorActions
40746
+ */
40747
+ CreateAppendKeyboardBindings.prototype.registerBindings = function() {
40748
+
40749
+ var keyboard = this._keyboard;
40750
+ var editorActions = this._editorActions;
40751
+ var selection = this._selection;
40752
+
40753
+ // inherit default bindings
40754
+ KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
40755
+
40756
+ /**
40757
+ * Add keyboard binding if respective editor action
40758
+ * is registered.
40759
+ *
40760
+ * @param {string} action name
40761
+ * @param {Function} fn that implements the key binding
40762
+ */
40763
+ function addListener(action, fn) {
40764
+
40765
+ if (editorActions && editorActions.isRegistered(action)) {
40766
+ keyboard && keyboard.addListener(fn);
40767
+ }
40768
+ }
40769
+
40770
+ // activate append/create element
40771
+ // A
40772
+ addListener('appendElement', function(context) {
40773
+
40774
+ var event = context.keyEvent;
40775
+
40776
+ if (keyboard && keyboard.hasModifier(event)) {
40777
+ return;
40778
+ }
40779
+
40780
+ if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
40781
+
40782
+ if (selection && selection.get().length == 1) {
40783
+ editorActions && editorActions.trigger('appendElement', event);
40784
+ } else {
40785
+ editorActions && editorActions.trigger('createElement', event);
40786
+ }
40787
+
40788
+ return true;
40789
+ }
40790
+ });
40791
+
40792
+ // N
40793
+ addListener('createElement', function(context) {
40794
+
40795
+ var event = context.keyEvent;
40796
+
40797
+ if (keyboard && keyboard.hasModifier(event)) {
40798
+ return;
40799
+ }
40800
+
40801
+ if (keyboard && keyboard.isKey([ 'n', 'N' ], event)) {
40802
+ editorActions && editorActions.trigger('createElement', event);
40803
+
40804
+ return true;
40805
+ }
40806
+ });
40807
+
40808
+ };
40809
+
40810
+ /**
40811
+ * This module is an append menu provider for the popup menu.
40812
+ */
40813
+ function AppendMenuProvider(
40814
+ elementFactory,
40815
+ popupMenu,
40816
+ create,
40817
+ autoPlace,
40818
+ rules,
40819
+ mouse
40820
+ ) {
40821
+ this._elementFactory = elementFactory;
40822
+ this._popupMenu = popupMenu;
40823
+ this._create = create;
40824
+ this._autoPlace = autoPlace;
40825
+ this._rules = rules;
40826
+ this._create = create;
40827
+ this._mouse = mouse;
40828
+
40829
+ this.register();
40830
+ }
40831
+
40832
+ AppendMenuProvider.$inject = [
40833
+ 'elementFactory',
40834
+ 'popupMenu',
40835
+ 'create',
40836
+ 'autoPlace',
40837
+ 'rules',
40838
+ 'mouse'
40839
+ ];
40840
+
40841
+ /**
40842
+ * Register append menu provider in the popup menu
40843
+ */
40844
+ AppendMenuProvider.prototype.register = function() {
40845
+ this._popupMenu.registerProvider('bpmn-append', this);
40846
+ };
40847
+
40848
+ /**
40849
+ * Get all entries from createOptions for the given element.
40850
+ *
40851
+ * @param {djs.model.Base} element
40852
+ *
40853
+ * @return {Array<Object>} a list of menu entry items
40854
+ */
40855
+ AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40856
+ const rules = this._rules;
40857
+ const entries = {};
40858
+
40859
+ if (!rules.allowed('shape.append', { element: element })) {
40860
+ return [];
40861
+ }
40862
+
40863
+ // filter out elements with no incoming connections
40864
+ const appendOptions = this._filterEntries(CREATE_OPTIONS);
40865
+
40866
+ // map options to menu entries
40867
+ appendOptions.forEach(option => {
40868
+ const {
40869
+ actionName,
40870
+ className,
40871
+ label,
40872
+ target,
40873
+ description,
40874
+ group,
40875
+ search,
40876
+ rank
40877
+ } = option;
40878
+
40879
+ entries[`append-${actionName}`] = {
40880
+ label,
40881
+ className,
40882
+ description,
40883
+ group,
40884
+ search,
40885
+ rank,
40886
+ action: this._createEntryAction(element, target)
40887
+ };
40888
+ });
40889
+
40890
+ return entries;
40891
+ };
40892
+
40893
+ /**
40894
+ * Filter out entries from the options.
40895
+ *
40896
+ * @param {Array<Object>} entries
40897
+ *
40898
+ * @return {Array<Object>} filtered entries
40899
+ */
40900
+ AppendMenuProvider.prototype._filterEntries = function(entries) {
40901
+ return entries.filter(option => {
40902
+
40903
+ const target = option.target;
40904
+ const {
40905
+ type,
40906
+ eventDefinitionType
40907
+ } = target;
40908
+
40909
+ if ([
40910
+ 'bpmn:StartEvent',
40911
+ 'bpmn:Participant'
40912
+ ].includes(type)) {
40913
+ return false;
40914
+ }
40915
+
40916
+ if (type === 'bpmn:BoundaryEvent' && isUndefined$2(eventDefinitionType)) {
40917
+ return false;
40918
+ }
40919
+
40920
+ return true;
40921
+ });
40922
+ };
40923
+
40924
+ /**
40925
+ * Create an action for a given target.
40926
+ *
40927
+ * @param {djs.model.Base} element
40928
+ * @param {Object} target
40929
+ *
40930
+ * @return {Object}
40931
+ */
40932
+ AppendMenuProvider.prototype._createEntryAction = function(element, target) {
40933
+ const elementFactory = this._elementFactory;
40934
+ const autoPlace = this._autoPlace;
40935
+ const create = this._create;
40936
+ const mouse = this._mouse;
40937
+
40938
+
40939
+ const autoPlaceElement = () => {
40940
+ const newElement = elementFactory.create('shape', target);
40941
+ autoPlace.append(element, newElement);
40942
+ };
40943
+
40944
+ const manualPlaceElement = (event) => {
40945
+ const newElement = elementFactory.create('shape', target);
40946
+
40947
+ if (event instanceof KeyboardEvent) {
40948
+ event = mouse.getLastMoveEvent();
40949
+ }
40950
+
40951
+ return create.start(event, newElement);
40952
+ };
40953
+
40954
+ return {
40955
+ click: this._canAutoPlaceElement(target) ? autoPlaceElement : manualPlaceElement,
40956
+ dragstart: manualPlaceElement
40957
+ };
40958
+ };
40959
+
40960
+ /**
40961
+ * Check if the element should be auto placed.
40962
+ *
40963
+ * @param {Object} target
40964
+ *
40965
+ * @return {Boolean}
40966
+ */
40967
+ AppendMenuProvider.prototype._canAutoPlaceElement = (target) => {
40968
+ const { type } = target;
40969
+
40970
+ if (type === 'bpmn:BoundaryEvent') {
40971
+ return false;
40972
+ }
40973
+
40974
+ if (type === 'bpmn:SubProcess' && target.triggeredByEvent) {
40975
+ return false;
40976
+ }
40977
+
40978
+ if (type === 'bpmn:IntermediateCatchEvent' && target.eventDefinitionType === 'bpmn:LinkEventDefinition') {
40979
+ return false;
40980
+ }
40981
+
40982
+ return true;
40983
+ };
40984
+
40985
+ var LOW_PRIORITY$k = 900;
40986
+
40987
+ /**
40988
+ * A provider for align elements context pad button
40989
+ */
40990
+ function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
40991
+ contextPad.registerProvider(LOW_PRIORITY$k, this);
40992
+
40993
+ this._contextPad = contextPad;
40994
+ this._popupMenu = popupMenu;
40995
+ this._translate = translate;
40996
+ this._canvas = canvas;
40997
+ }
40998
+
40999
+ AppendContextPadProvider.$inject = [
41000
+ 'contextPad',
41001
+ 'popupMenu',
41002
+ 'translate',
41003
+ 'canvas'
41004
+ ];
41005
+
41006
+ AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
41007
+ const popupMenu = this._popupMenu;
41008
+ const translate = this._translate;
41009
+ const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
41010
+
41011
+ if (!popupMenu.isEmpty(element, 'bpmn-append')) {
41012
+
41013
+ // append menu entry
41014
+ return {
41015
+ 'append': {
41016
+ group: 'model',
41017
+ imageUrl: appendIcon,
41018
+ title: translate('Append element'),
41019
+ action: {
41020
+ click: function(event, element) {
41021
+
41022
+ var position = assign$1(getAppendMenuPosition(element), {
41023
+ cursor: { x: event.x, y: event.y }
41024
+ });
41025
+
41026
+ popupMenu.open(element, 'bpmn-append', position, {
41027
+ title: translate('Append element'),
41028
+ width: 300,
41029
+ search: true
41030
+ });
41031
+ }
41032
+ }
41033
+ }
41034
+ };
41035
+ }
41036
+ };
41037
+
41038
+ AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
41039
+ const contextPad = this._contextPad;
41040
+
41041
+ const X_OFFSET = 5;
41042
+
41043
+ const pad = contextPad.getPad(element).html;
41044
+
41045
+ const padRect = pad.getBoundingClientRect();
41046
+
41047
+ const pos = {
41048
+ x: padRect.right + X_OFFSET,
41049
+ y: padRect.top
41050
+ };
41051
+
41052
+ return pos;
41053
+ };
41054
+
41055
+ /**
41056
+ * Append anything modeling rules
41057
+ */
41058
+ function AppendRules(eventBus) {
41059
+ RuleProvider.call(this, eventBus);
41060
+ }
41061
+
41062
+ e$6(AppendRules, RuleProvider);
41063
+
41064
+ AppendRules.$inject = [
41065
+ 'eventBus'
41066
+ ];
41067
+
41068
+ AppendRules.prototype.init = function() {
41069
+ this.addRule('shape.append', function(context) {
41070
+
41071
+ var source = context.element;
41072
+
41073
+ const businessObject = getBusinessObject$1(source);
41074
+
41075
+ if (isLabel$6(source)) {
41076
+ return false;
41077
+ }
41078
+
41079
+ if (isAny(source, [
41080
+ 'bpmn:EndEvent',
41081
+ 'bpmn:Group',
41082
+ 'bpmn:TextAnnotation',
41083
+ 'bpmn:Lane',
41084
+ 'bpmn:Participant',
41085
+ 'bpmn:DataStoreReference',
41086
+ 'bpmn:DataObjectReference'
41087
+ ])) {
41088
+ return false;
41089
+ }
41090
+
41091
+ if (isConnection$c(source)) {
41092
+ return false;
41093
+ }
41094
+
41095
+ if (is$5(source, 'bpmn:IntermediateThrowEvent') && hasEventDefinition$1(source, 'bpmn:LinkEventDefinition')) {
41096
+ return false;
41097
+ }
41098
+
41099
+ if (is$5(source, 'bpmn:SubProcess') && businessObject.triggeredByEvent) {
41100
+ return false;
41101
+ }
41102
+ });
41103
+
41104
+ };
41105
+
41106
+
41107
+ // helpers //////////////
41108
+ function hasEventDefinition$1(element, eventDefinition) {
41109
+ var bo = getBusinessObject$1(element);
41110
+
41111
+ return !!find$1(bo.eventDefinitions || [], function(definition) {
41112
+ return is$5(definition, eventDefinition);
41113
+ });
41114
+ }
41115
+
41116
+ function isConnection$c(element) {
41117
+ return element.waypoints;
41118
+ }
41119
+
41120
+ var createAppendAnythingModule = {
41121
+ __depends__: [
41122
+ PaletteModule$1,
41123
+ PopupMenuModule$1,
41124
+ AutoPlaceModule$1,
41125
+ ContextPadModule$1
41126
+ ],
41127
+ __init__: [
41128
+ 'createMenuProvider',
41129
+ 'createPaletteProvider',
41130
+ 'createAppendEditorActions',
41131
+ 'createAppendKeyboardBindings',
41132
+ 'appendMenuProvider',
41133
+ 'appendContextPadProvider',
41134
+ 'appendRules'
41135
+ ],
41136
+ createMenuProvider: [ 'type', CreateMenuProvider ],
41137
+ createPaletteProvider: [ 'type', CreatePaletteProvider ],
41138
+ createAppendEditorActions: [ 'type', CreateAppendEditorActions ],
41139
+ createAppendKeyboardBindings: [ 'type', CreateAppendKeyboardBindings ],
41140
+ appendMenuProvider: [ 'type', AppendMenuProvider ],
41141
+ appendContextPadProvider: [ 'type', AppendContextPadProvider ],
41142
+ appendRules: [ 'type', AppendRules ]
41143
+ };
41144
+
41145
+ var AXIS_DIMENSIONS = {
41146
+ horizontal: [ 'x', 'width' ],
41147
+ vertical: [ 'y', 'height' ]
41148
+ };
41149
+
41150
+ var THRESHOLD = 5;
41151
+
41152
+
41153
+ /**
41154
+ * Groups and filters elements and then trigger even distribution.
41155
+ */
41156
+ function DistributeElements$1(modeling, rules) {
41157
+ this._modeling = modeling;
41158
+
41159
+ this._filters = [];
41160
+
41161
+ this.registerFilter(function(elements) {
41162
+ var allowed = rules.allowed('elements.distribute', { elements: elements });
41163
+
41164
+ if (isArray$3(allowed)) {
41165
+ return allowed;
41166
+ }
41167
+
41168
+ return allowed ? elements : [];
41169
+ });
41170
+ }
41171
+
41172
+ DistributeElements$1.$inject = [ 'modeling', 'rules' ];
41173
+
41174
+
41175
+ /**
41176
+ * Registers filter functions that allow external parties to filter
41177
+ * out certain elements.
41178
+ *
41179
+ * @param {Function} filterFn
41180
+ */
41181
+ DistributeElements$1.prototype.registerFilter = function(filterFn) {
41182
+ if (typeof filterFn !== 'function') {
41183
+ throw new Error('the filter has to be a function');
41184
+ }
41185
+
41186
+ this._filters.push(filterFn);
41187
+ };
41188
+
41189
+ /**
41190
+ * Distributes the elements with a given orientation
41191
+ *
41192
+ * @param {Array} elements
41193
+ * @param {string} orientation
41194
+ */
41195
+ DistributeElements$1.prototype.trigger = function(elements, orientation) {
41196
+ var modeling = this._modeling;
41197
+
41198
+ var groups,
41199
+ distributableElements;
41200
+
41201
+ if (elements.length < 3) {
41202
+ return;
41203
+ }
41204
+
41205
+ this._setOrientation(orientation);
41206
+
41207
+ distributableElements = this._filterElements(elements);
41208
+
41209
+ groups = this._createGroups(distributableElements);
41210
+
41211
+ // nothing to distribute
41212
+ if (groups.length <= 2) {
41213
+ return;
41214
+ }
41215
+
41216
+ modeling.distributeElements(groups, this._axis, this._dimension);
41217
+
41218
+ return groups;
41219
+ };
41220
+
41221
+ /**
41222
+ * Filters the elements with provided filters by external parties
41223
+ *
41224
+ * @param {Array[Elements]} elements
41225
+ *
41226
+ * @return {Array[Elements]}
41227
+ */
41228
+ DistributeElements$1.prototype._filterElements = function(elements) {
41229
+ var filters = this._filters,
41230
+ axis = this._axis,
41231
+ dimension = this._dimension,
41232
+ distributableElements = [].concat(elements);
41233
+
41234
+ if (!filters.length) {
41235
+ return elements;
41236
+ }
41237
+
41238
+ forEach$1(filters, function(filterFn) {
41239
+ distributableElements = filterFn(distributableElements, axis, dimension);
41240
+ });
41241
+
41242
+ return distributableElements;
41243
+ };
41244
+
41245
+
41246
+ /**
41247
+ * Create range (min, max) groups. Also tries to group elements
41248
+ * together that share the same range.
41249
+ *
41250
+ * @example
41251
+ * var distributableElements = [
41252
+ * {
41253
+ * range: {
41254
+ * min: 100,
41255
+ * max: 200
41256
+ * },
41257
+ * elements: [ { id: 'shape1', .. }]
41258
+ * }
41259
+ * ]
41260
+ *
41261
+ * @param {Array} elements
41262
+ *
41263
+ * @return {Array[Objects]}
41264
+ */
41265
+ DistributeElements$1.prototype._createGroups = function(elements) {
41266
+ var rangeGroups = [],
41267
+ self = this,
41268
+ axis = this._axis,
41269
+ dimension = this._dimension;
41270
+
41271
+ if (!axis) {
41272
+ throw new Error('must have a defined "axis" and "dimension"');
41273
+ }
41274
+
41275
+ // sort by 'left->right' or 'top->bottom'
41276
+ var sortedElements = sortBy(elements, axis);
41277
+
41278
+ forEach$1(sortedElements, function(element, idx) {
41279
+ var elementRange = self._findRange(element, axis, dimension),
41280
+ range;
41281
+
41282
+ var previous = rangeGroups[rangeGroups.length - 1];
41283
+
41284
+ if (previous && self._hasIntersection(previous.range, elementRange)) {
41285
+ rangeGroups[rangeGroups.length - 1].elements.push(element);
41286
+ } else {
41287
+ range = { range: elementRange, elements: [ element ] };
41288
+
41289
+ rangeGroups.push(range);
41290
+ }
41291
+ });
41292
+
41293
+ return rangeGroups;
41294
+ };
41295
+
41296
+
41297
+ /**
41298
+ * Maps a direction to the according axis and dimension
41299
+ *
41300
+ * @param {string} direction 'horizontal' or 'vertical'
41301
+ */
41302
+ DistributeElements$1.prototype._setOrientation = function(direction) {
41303
+ var orientation = AXIS_DIMENSIONS[direction];
41304
+
41305
+ this._axis = orientation[0];
41306
+ this._dimension = orientation[1];
41307
+ };
41308
+
41309
+
41310
+ /**
41311
+ * Checks if the two ranges intercept each other
41312
+ *
41313
+ * @param {Object} rangeA {min, max}
41314
+ * @param {Object} rangeB {min, max}
41315
+ *
41316
+ * @return {boolean}
41317
+ */
41318
+ DistributeElements$1.prototype._hasIntersection = function(rangeA, rangeB) {
41319
+ return Math.max(rangeA.min, rangeA.max) >= Math.min(rangeB.min, rangeB.max) &&
41320
+ Math.min(rangeA.min, rangeA.max) <= Math.max(rangeB.min, rangeB.max);
41321
+ };
41322
+
41323
+
41324
+ /**
41325
+ * Returns the min and max values for an element
41326
+ *
41327
+ * @param {Bounds} element
41328
+ * @param {string} axis
41329
+ * @param {string} dimension
41330
+ *
41331
+ * @return {{ min: number, max: number }}
41332
+ */
41333
+ DistributeElements$1.prototype._findRange = function(element) {
41334
+ var axis = element[this._axis],
41335
+ dimension = element[this._dimension];
41336
+
41337
+ return {
41338
+ min: axis + THRESHOLD,
41339
+ max: axis + dimension - THRESHOLD
41340
+ };
41341
+ };
41342
+
41343
+ var DistributeElementsModule$1 = {
41344
+ __init__: [ 'distributeElements' ],
41345
+ distributeElements: [ 'type', DistributeElements$1 ]
41346
+ };
41347
+
41348
+ /**
41349
+ * Registers element exclude filters for elements that
41350
+ * currently do not support distribution.
41351
+ */
41352
+ function BpmnDistributeElements(distributeElements, eventBus, rules) {
41353
+ RuleProvider.call(this, eventBus);
41354
+ }
41355
+
41356
+ BpmnDistributeElements.$inject = [ 'distributeElements', 'eventBus', 'rules' ];
41357
+
41358
+ e$6(BpmnDistributeElements, RuleProvider);
41359
+
41360
+ BpmnDistributeElements.prototype.init = function() {
41361
+ this.addRule('elements.distribute', function(context) {
41362
+ var elements = context.elements;
41363
+
41364
+ elements = filter(elements, function(element) {
41365
+ var cannotDistribute = isAny(element, [
41366
+ 'bpmn:Association',
41367
+ 'bpmn:BoundaryEvent',
41368
+ 'bpmn:DataInputAssociation',
41369
+ 'bpmn:DataOutputAssociation',
41370
+ 'bpmn:Lane',
41371
+ 'bpmn:MessageFlow',
41372
+ 'bpmn:SequenceFlow',
41373
+ 'bpmn:TextAnnotation'
41374
+ ]);
41375
+
41376
+ return !(element.labelTarget || cannotDistribute);
41377
+ });
41378
+
41379
+ // filter out elements which are children of any of the selected elements
41380
+ elements = getParents$3(elements);
41381
+
41382
+ if (elements.length < 3) {
41383
+ return false;
41384
+ }
41385
+
41386
+ return elements;
41387
+ });
41388
+ };
41389
+
41390
+ /**
41391
+ * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
41392
+ * and then replace respective icons with the optimized data URIs in `./dist`.
41393
+ */
41394
+ var icons = {
41395
+ horizontal: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M450%20400V150h900v250%22%2F%3E%3Crect%20x%3D%22150%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%221200%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%221050%22%20y%3D%22450%22%20width%3D%22600%22%20height%3D%22800%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E',
41396
+ vertical: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201800%201800%22%3E%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bstroke-linejoin%3Around%22%20d%3D%22M400%201350H150V450h250%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%22150%22%20width%3D%221200%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3Anone%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%22%2F%3E%3Crect%20x%3D%22450%22%20y%3D%221050%22%20width%3D%22800%22%20height%3D%22600%22%20rx%3D%221%22%20style%3D%22fill%3AcurrentColor%3Bstroke%3AcurrentColor%3Bstroke-width%3A100%3Bopacity%3A.5%22%2F%3E%3C%2Fsvg%3E',
41397
+ };
41398
+
41399
+ var ICONS = icons;
41400
+
41401
+ var LOW_PRIORITY$j = 900;
41402
+
41403
+ /**
41404
+ * A provider for distribute elements popup menu.
41405
+ */
41406
+ function DistributeElementsMenuProvider(
41407
+ popupMenu, distributeElements, translate, rules) {
41408
+ this._distributeElements = distributeElements;
41409
+ this._translate = translate;
41410
+ this._popupMenu = popupMenu;
41411
+ this._rules = rules;
41412
+
41413
+ popupMenu.registerProvider('align-elements', LOW_PRIORITY$j, this);
41414
+ }
41415
+
41416
+ DistributeElementsMenuProvider.$inject = [
41417
+ 'popupMenu',
41418
+ 'distributeElements',
41419
+ 'translate',
41420
+ 'rules'
41421
+ ];
41422
+
41423
+ DistributeElementsMenuProvider.prototype.getPopupMenuEntries = function(elements) {
41424
+ var entries = {};
41425
+
41426
+ if (this._isAllowed(elements)) {
41427
+ assign$1(entries, this._getEntries(elements));
41428
+ }
41429
+
41430
+ return entries;
41431
+ };
41432
+
41433
+ DistributeElementsMenuProvider.prototype._isAllowed = function(elements) {
41434
+ return this._rules.allowed('elements.distribute', { elements: elements });
41435
+ };
41436
+
41437
+ DistributeElementsMenuProvider.prototype._getEntries = function(elements) {
41438
+ var distributeElements = this._distributeElements,
41439
+ translate = this._translate,
41440
+ popupMenu = this._popupMenu;
41441
+
41442
+ var entries = {
41443
+ 'distribute-elements-horizontal': {
41444
+ group: 'distribute',
41445
+ title: translate('Distribute elements horizontally'),
41446
+ className: 'bjs-align-elements-menu-entry',
41447
+ imageUrl: ICONS['horizontal'],
41448
+ action: function(event, entry) {
41449
+ distributeElements.trigger(elements, 'horizontal');
41450
+ popupMenu.close();
41451
+ }
41452
+ },
41453
+ 'distribute-elements-vertical': {
41454
+ group: 'distribute',
41455
+ title: translate('Distribute elements vertically'),
41456
+ imageUrl: ICONS['vertical'],
41457
+ action: function(event, entry) {
41458
+ distributeElements.trigger(elements, 'vertical');
41459
+ popupMenu.close();
41460
+ }
41461
+ },
41462
+ };
41463
+
41464
+ return entries;
41465
+ };
41466
+
41467
+ var DistributeElementsModule = {
39629
41468
  __depends__: [
39630
41469
  PopupMenuModule$1,
39631
41470
  DistributeElementsModule$1
@@ -46753,7 +48592,7 @@
46753
48592
  }
46754
48593
 
46755
48594
  return some(types, function(type) {
46756
- return hasEventDefinition$2(element, type);
48595
+ return hasEventDefinition$3(element, type);
46757
48596
  });
46758
48597
  }
46759
48598
 
@@ -52711,6 +54550,16 @@
52711
54550
  di.isMarkerVisible = true;
52712
54551
  }
52713
54552
 
54553
+ if (isDefined(attrs.triggeredByEvent)) {
54554
+ businessObject.triggeredByEvent = attrs.triggeredByEvent;
54555
+ delete attrs.triggeredByEvent;
54556
+ }
54557
+
54558
+ if (isDefined(attrs.cancelActivity)) {
54559
+ businessObject.cancelActivity = attrs.cancelActivity;
54560
+ delete attrs.cancelActivity;
54561
+ }
54562
+
52714
54563
  var eventDefinitions,
52715
54564
  newEventDefinition;
52716
54565
 
@@ -58329,471 +60178,6 @@
58329
60178
  movePreview: [ 'type', MovePreview ]
58330
60179
  };
58331
60180
 
58332
- var TOGGLE_SELECTOR = '.djs-palette-toggle',
58333
- ENTRY_SELECTOR = '.entry',
58334
- ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
58335
-
58336
- var PALETTE_PREFIX = 'djs-palette-',
58337
- PALETTE_SHOWN_CLS = 'shown',
58338
- PALETTE_OPEN_CLS = 'open',
58339
- PALETTE_TWO_COLUMN_CLS = 'two-column';
58340
-
58341
- var DEFAULT_PRIORITY$1 = 1000;
58342
-
58343
-
58344
- /**
58345
- * A palette containing modeling elements.
58346
- */
58347
- function Palette(eventBus, canvas) {
58348
-
58349
- this._eventBus = eventBus;
58350
- this._canvas = canvas;
58351
-
58352
- var self = this;
58353
-
58354
- eventBus.on('tool-manager.update', function(event) {
58355
- var tool = event.tool;
58356
-
58357
- self.updateToolHighlight(tool);
58358
- });
58359
-
58360
- eventBus.on('i18n.changed', function() {
58361
- self._update();
58362
- });
58363
-
58364
- eventBus.on('diagram.init', function() {
58365
-
58366
- self._diagramInitialized = true;
58367
-
58368
- self._rebuild();
58369
- });
58370
- }
58371
-
58372
- Palette.$inject = [ 'eventBus', 'canvas' ];
58373
-
58374
-
58375
- /**
58376
- * Register a provider with the palette
58377
- *
58378
- * @param {number} [priority=1000]
58379
- * @param {PaletteProvider} provider
58380
- *
58381
- * @example
58382
- * const paletteProvider = {
58383
- * getPaletteEntries: function() {
58384
- * return function(entries) {
58385
- * return {
58386
- * ...entries,
58387
- * 'entry-1': {
58388
- * label: 'My Entry',
58389
- * action: function() { alert("I have been clicked!"); }
58390
- * }
58391
- * };
58392
- * }
58393
- * }
58394
- * };
58395
- *
58396
- * palette.registerProvider(800, paletteProvider);
58397
- */
58398
- Palette.prototype.registerProvider = function(priority, provider) {
58399
- if (!provider) {
58400
- provider = priority;
58401
- priority = DEFAULT_PRIORITY$1;
58402
- }
58403
-
58404
- this._eventBus.on('palette.getProviders', priority, function(event) {
58405
- event.providers.push(provider);
58406
- });
58407
-
58408
- this._rebuild();
58409
- };
58410
-
58411
-
58412
- /**
58413
- * Returns the palette entries
58414
- *
58415
- * @return {Object<string, PaletteEntryDescriptor>} map of entries
58416
- */
58417
- Palette.prototype.getEntries = function() {
58418
- var providers = this._getProviders();
58419
-
58420
- return providers.reduce(addPaletteEntries, {});
58421
- };
58422
-
58423
- Palette.prototype._rebuild = function() {
58424
-
58425
- if (!this._diagramInitialized) {
58426
- return;
58427
- }
58428
-
58429
- var providers = this._getProviders();
58430
-
58431
- if (!providers.length) {
58432
- return;
58433
- }
58434
-
58435
- if (!this._container) {
58436
- this._init();
58437
- }
58438
-
58439
- this._update();
58440
- };
58441
-
58442
- /**
58443
- * Initialize
58444
- */
58445
- Palette.prototype._init = function() {
58446
-
58447
- var self = this;
58448
-
58449
- var eventBus = this._eventBus;
58450
-
58451
- var parentContainer = this._getParentContainer();
58452
-
58453
- var container = this._container = domify$1(Palette.HTML_MARKUP);
58454
-
58455
- parentContainer.appendChild(container);
58456
- classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
58457
-
58458
- delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
58459
-
58460
- var target = event.delegateTarget;
58461
-
58462
- if (matches(target, TOGGLE_SELECTOR)) {
58463
- return self.toggle();
58464
- }
58465
-
58466
- self.trigger('click', event);
58467
- });
58468
-
58469
- // prevent drag propagation
58470
- event.bind(container, 'mousedown', function(event) {
58471
- event.stopPropagation();
58472
- });
58473
-
58474
- // prevent drag propagation
58475
- delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
58476
- self.trigger('dragstart', event);
58477
- });
58478
-
58479
- eventBus.on('canvas.resized', this._layoutChanged, this);
58480
-
58481
- eventBus.fire('palette.create', {
58482
- container: container
58483
- });
58484
- };
58485
-
58486
- Palette.prototype._getProviders = function(id) {
58487
-
58488
- var event = this._eventBus.createEvent({
58489
- type: 'palette.getProviders',
58490
- providers: []
58491
- });
58492
-
58493
- this._eventBus.fire(event);
58494
-
58495
- return event.providers;
58496
- };
58497
-
58498
- /**
58499
- * Update palette state.
58500
- *
58501
- * @param {Object} [state] { open, twoColumn }
58502
- */
58503
- Palette.prototype._toggleState = function(state) {
58504
-
58505
- state = state || {};
58506
-
58507
- var parent = this._getParentContainer(),
58508
- container = this._container;
58509
-
58510
- var eventBus = this._eventBus;
58511
-
58512
- var twoColumn;
58513
-
58514
- var cls = classes$1(container),
58515
- parentCls = classes$1(parent);
58516
-
58517
- if ('twoColumn' in state) {
58518
- twoColumn = state.twoColumn;
58519
- } else {
58520
- twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
58521
- }
58522
-
58523
- // always update two column
58524
- cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
58525
- parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
58526
-
58527
- if ('open' in state) {
58528
- cls.toggle(PALETTE_OPEN_CLS, state.open);
58529
- parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
58530
- }
58531
-
58532
- eventBus.fire('palette.changed', {
58533
- twoColumn: twoColumn,
58534
- open: this.isOpen()
58535
- });
58536
- };
58537
-
58538
- Palette.prototype._update = function() {
58539
-
58540
- var entriesContainer = query('.djs-palette-entries', this._container),
58541
- entries = this._entries = this.getEntries();
58542
-
58543
- clear$1(entriesContainer);
58544
-
58545
- forEach$1(entries, function(entry, id) {
58546
-
58547
- var grouping = entry.group || 'default';
58548
-
58549
- var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
58550
- if (!container) {
58551
- container = domify$1('<div class="group"></div>');
58552
- attr$1(container, 'data-group', grouping);
58553
-
58554
- entriesContainer.appendChild(container);
58555
- }
58556
-
58557
- var html = entry.html || (
58558
- entry.separator ?
58559
- '<hr class="separator" />' :
58560
- '<div class="entry" draggable="true"></div>');
58561
-
58562
-
58563
- var control = domify$1(html);
58564
- container.appendChild(control);
58565
-
58566
- if (!entry.separator) {
58567
- attr$1(control, 'data-action', id);
58568
-
58569
- if (entry.title) {
58570
- attr$1(control, 'title', entry.title);
58571
- }
58572
-
58573
- if (entry.className) {
58574
- addClasses(control, entry.className);
58575
- }
58576
-
58577
- if (entry.imageUrl) {
58578
- var image = domify$1('<img>');
58579
- attr$1(image, 'src', entry.imageUrl);
58580
-
58581
- control.appendChild(image);
58582
- }
58583
- }
58584
- });
58585
-
58586
- // open after update
58587
- this.open();
58588
- };
58589
-
58590
-
58591
- /**
58592
- * Trigger an action available on the palette
58593
- *
58594
- * @param {string} action
58595
- * @param {Event} event
58596
- */
58597
- Palette.prototype.trigger = function(action, event, autoActivate) {
58598
- var entry,
58599
- originalEvent,
58600
- button = event.delegateTarget || event.target;
58601
-
58602
- if (!button) {
58603
- return event.preventDefault();
58604
- }
58605
-
58606
- entry = attr$1(button, 'data-action');
58607
- originalEvent = event.originalEvent || event;
58608
-
58609
- return this.triggerEntry(entry, action, originalEvent, autoActivate);
58610
- };
58611
-
58612
- Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
58613
- var entries = this._entries,
58614
- entry,
58615
- handler;
58616
-
58617
- entry = entries[entryId];
58618
-
58619
- // when user clicks on the palette and not on an action
58620
- if (!entry) {
58621
- return;
58622
- }
58623
-
58624
- handler = entry.action;
58625
-
58626
- // simple action (via callback function)
58627
- if (isFunction(handler)) {
58628
- if (action === 'click') {
58629
- return handler(event, autoActivate);
58630
- }
58631
- } else {
58632
- if (handler[action]) {
58633
- return handler[action](event, autoActivate);
58634
- }
58635
- }
58636
-
58637
- // silence other actions
58638
- event.preventDefault();
58639
- };
58640
-
58641
- Palette.prototype._layoutChanged = function() {
58642
- this._toggleState({});
58643
- };
58644
-
58645
- /**
58646
- * Do we need to collapse to two columns?
58647
- *
58648
- * @param {number} availableHeight
58649
- * @param {Object} entries
58650
- *
58651
- * @return {boolean}
58652
- */
58653
- Palette.prototype._needsCollapse = function(availableHeight, entries) {
58654
-
58655
- // top margin + bottom toggle + bottom margin
58656
- // implementors must override this method if they
58657
- // change the palette styles
58658
- var margin = 20 + 10 + 20;
58659
-
58660
- var entriesHeight = Object.keys(entries).length * 46;
58661
-
58662
- return availableHeight < entriesHeight + margin;
58663
- };
58664
-
58665
- /**
58666
- * Close the palette
58667
- */
58668
- Palette.prototype.close = function() {
58669
-
58670
- this._toggleState({
58671
- open: false,
58672
- twoColumn: false
58673
- });
58674
- };
58675
-
58676
-
58677
- /**
58678
- * Open the palette
58679
- */
58680
- Palette.prototype.open = function() {
58681
- this._toggleState({ open: true });
58682
- };
58683
-
58684
-
58685
- Palette.prototype.toggle = function(open) {
58686
- if (this.isOpen()) {
58687
- this.close();
58688
- } else {
58689
- this.open();
58690
- }
58691
- };
58692
-
58693
- Palette.prototype.isActiveTool = function(tool) {
58694
- return tool && this._activeTool === tool;
58695
- };
58696
-
58697
- Palette.prototype.updateToolHighlight = function(name) {
58698
- var entriesContainer,
58699
- toolsContainer;
58700
-
58701
- if (!this._toolsContainer) {
58702
- entriesContainer = query('.djs-palette-entries', this._container);
58703
-
58704
- this._toolsContainer = query('[data-group=tools]', entriesContainer);
58705
- }
58706
-
58707
- toolsContainer = this._toolsContainer;
58708
-
58709
- forEach$1(toolsContainer.children, function(tool) {
58710
- var actionName = tool.getAttribute('data-action');
58711
-
58712
- if (!actionName) {
58713
- return;
58714
- }
58715
-
58716
- var toolClasses = classes$1(tool);
58717
-
58718
- actionName = actionName.replace('-tool', '');
58719
-
58720
- if (toolClasses.contains('entry') && actionName === name) {
58721
- toolClasses.add('highlighted-entry');
58722
- } else {
58723
- toolClasses.remove('highlighted-entry');
58724
- }
58725
- });
58726
- };
58727
-
58728
-
58729
- /**
58730
- * Return true if the palette is opened.
58731
- *
58732
- * @example
58733
- *
58734
- * palette.open();
58735
- *
58736
- * if (palette.isOpen()) {
58737
- * // yes, we are open
58738
- * }
58739
- *
58740
- * @return {boolean} true if palette is opened
58741
- */
58742
- Palette.prototype.isOpen = function() {
58743
- return classes$1(this._container).has(PALETTE_OPEN_CLS);
58744
- };
58745
-
58746
- /**
58747
- * Get container the palette lives in.
58748
- *
58749
- * @return {Element}
58750
- */
58751
- Palette.prototype._getParentContainer = function() {
58752
- return this._canvas.getContainer();
58753
- };
58754
-
58755
-
58756
- /* markup definition */
58757
-
58758
- Palette.HTML_MARKUP =
58759
- '<div class="djs-palette">' +
58760
- '<div class="djs-palette-entries"></div>' +
58761
- '<div class="djs-palette-toggle"></div>' +
58762
- '</div>';
58763
-
58764
-
58765
- // helpers //////////////////////
58766
-
58767
- function addClasses(element, classNames) {
58768
-
58769
- var classes = classes$1(element);
58770
-
58771
- var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
58772
- actualClassNames.forEach(function(cls) {
58773
- classes.add(cls);
58774
- });
58775
- }
58776
-
58777
- function addPaletteEntries(entries, provider) {
58778
-
58779
- var entriesOrUpdater = provider.getPaletteEntries();
58780
-
58781
- if (isFunction(entriesOrUpdater)) {
58782
- return entriesOrUpdater(entries);
58783
- }
58784
-
58785
- forEach$1(entriesOrUpdater, function(entry, id) {
58786
- entries[id] = entry;
58787
- });
58788
-
58789
- return entries;
58790
- }
58791
-
58792
- var PaletteModule$1 = {
58793
- __init__: [ 'palette' ],
58794
- palette: [ 'type', Palette ]
58795
- };
58796
-
58797
60181
  var LASSO_TOOL_CURSOR = 'crosshair';
58798
60182
 
58799
60183
 
@@ -61444,6 +62828,10 @@
61444
62828
  '</bpmn:definitions>';
61445
62829
 
61446
62830
 
62831
+ /**
62832
+ * @typedef { import('didi').ModuleDeclaration } Module
62833
+ */
62834
+
61447
62835
  /**
61448
62836
  * A modeler for BPMN 2.0 diagrams.
61449
62837
  *
@@ -61513,8 +62901,8 @@
61513
62901
  * @param {string|number} [options.width] the width of the viewer
61514
62902
  * @param {string|number} [options.height] the height of the viewer
61515
62903
  * @param {Object} [options.moddleExtensions] extension packages to provide
61516
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
61517
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
62904
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
62905
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
61518
62906
  */
61519
62907
  function Modeler$2(options) {
61520
62908
  BaseModeler.call(this, options);
@@ -61574,6 +62962,7 @@
61574
62962
  ContextPadModule,
61575
62963
  CopyPasteModule,
61576
62964
  CreateModule,
62965
+ createAppendAnythingModule,
61577
62966
  DistributeElementsModule,
61578
62967
  EditorActionsModule,
61579
62968
  GridSnappingModule,
@@ -87318,18 +88707,26 @@
87318
88707
  return `bio-properties-panel-${id}`;
87319
88708
  }
87320
88709
 
88710
+ function resizeToContents(element) {
88711
+ element.style.height = 'auto';
88712
+
88713
+ // a 2px pixel offset is required to prevent scrollbar from
88714
+ // appearing on OS with a full length scroll bar (Windows/Linux)
88715
+ element.style.height = `${element.scrollHeight + 2}px`;
88716
+ }
87321
88717
  function TextArea(props) {
87322
88718
  const {
87323
88719
  id,
87324
88720
  label,
87325
- rows = 2,
87326
88721
  debounce,
87327
88722
  onInput,
87328
88723
  value = '',
87329
88724
  disabled,
87330
88725
  monospace,
87331
88726
  onFocus,
87332
- onBlur
88727
+ onBlur,
88728
+ autoResize,
88729
+ rows = autoResize ? 1 : 2
87333
88730
  } = props;
87334
88731
  const [localValue, setLocalValue] = l$1(value);
87335
88732
  const ref = useShowEntryEvent(id);
@@ -87340,8 +88737,12 @@
87340
88737
  }, [onInput, debounce]);
87341
88738
  const handleInput = e => {
87342
88739
  handleInputCallback(e);
88740
+ autoResize && resizeToContents(e.target);
87343
88741
  setLocalValue(e.target.value);
87344
88742
  };
88743
+ h(() => {
88744
+ autoResize && resizeToContents(ref.current);
88745
+ }, []);
87345
88746
  y(() => {
87346
88747
  if (value === localValue) {
87347
88748
  return;
@@ -87359,7 +88760,7 @@
87359
88760
  id: prefixId$2(id),
87360
88761
  name: id,
87361
88762
  spellCheck: "false",
87362
- class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : ''),
88763
+ class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''),
87363
88764
  onInput: handleInput,
87364
88765
  onFocus: onFocus,
87365
88766
  onBlur: onBlur,
@@ -87399,7 +88800,8 @@
87399
88800
  monospace,
87400
88801
  disabled,
87401
88802
  onFocus,
87402
- onBlur
88803
+ onBlur,
88804
+ autoResize
87403
88805
  } = props;
87404
88806
  const value = getValue(element);
87405
88807
  const error = useError(id);
@@ -87416,7 +88818,8 @@
87416
88818
  rows: rows,
87417
88819
  debounce: debounce,
87418
88820
  monospace: monospace,
87419
- disabled: disabled
88821
+ disabled: disabled,
88822
+ autoResize: autoResize
87420
88823
  }, element), error && o$1("div", {
87421
88824
  class: "bio-properties-panel-error",
87422
88825
  children: error
@@ -87786,6 +89189,16 @@
87786
89189
  }
87787
89190
 
87788
89191
 
89192
+ /**
89193
+ * Get a script from the business object
89194
+ *
89195
+ * @param {MoodleElement} element
89196
+ * @returns {MoodleElement} the script object
89197
+ */
89198
+ function getScript$2(element) {
89199
+ return (getElements$2(element, 'zeebe:Script') || [])[0];
89200
+ }
89201
+
87789
89202
  // helpers //////////
87790
89203
 
87791
89204
  function getElements$2(element, type, property) {
@@ -88214,13 +89627,14 @@
88214
89627
 
88215
89628
  minDash$1.forEach(elements, function(element) {
88216
89629
 
88217
- var calledDecision = getCalledDecision$3(element);
89630
+ var baseElement = getCalledDecision$3(element) ||
89631
+ getScript$2(element);
88218
89632
 
88219
- if (!calledDecision) {
89633
+ if (!baseElement) {
88220
89634
  return;
88221
89635
  }
88222
89636
 
88223
- var resultVariable = calledDecision.resultVariable;
89637
+ var resultVariable = baseElement.resultVariable;
88224
89638
 
88225
89639
  if (resultVariable) {
88226
89640
  var newVariable = createProcessVariable$1(
@@ -93053,7 +94467,7 @@
93053
94467
  return [{
93054
94468
  id: 'name',
93055
94469
  component: Name$3,
93056
- isEdited: isEdited$1
94470
+ isEdited: isEdited$2
93057
94471
  }];
93058
94472
  }
93059
94473
  function Name$3(props) {
@@ -93079,7 +94493,8 @@
93079
94493
  },
93080
94494
  getValue: element => {
93081
94495
  return element.businessObject.name;
93082
- }
94496
+ },
94497
+ autoResize: true
93083
94498
  };
93084
94499
 
93085
94500
  // (2) text annotations
@@ -93121,7 +94536,7 @@
93121
94536
  else if (is$5(element, 'bpmn:Participant')) {
93122
94537
  options.label = translate('Participant Name');
93123
94538
  }
93124
- return TextfieldEntry(options);
94539
+ return TextAreaEntry(options);
93125
94540
  }
93126
94541
 
93127
94542
  // helpers ////////////////////////
@@ -95197,7 +96612,8 @@
95197
96612
  bpmnFactory,
95198
96613
  commandStack,
95199
96614
  element
95200
- })
96615
+ }),
96616
+ shouldSort: false
95201
96617
  };
95202
96618
  }
95203
96619
  function removeFactory$c({
@@ -97276,9 +98692,6 @@
97276
98692
  injector,
97277
98693
  namespace = 'camunda'
97278
98694
  }) {
97279
- if (namespace === 'zeebe' && !is$5(element, 'zeebe:PropertiesHolder')) {
97280
- return [];
97281
- }
97282
98695
  let businessObject = getRelevantBusinessObject(element);
97283
98696
 
97284
98697
  // do not offer for empty pools
@@ -97314,7 +98727,8 @@
97314
98727
  commandStack,
97315
98728
  element,
97316
98729
  namespace
97317
- })
98730
+ }),
98731
+ shouldSort: false
97318
98732
  };
97319
98733
  }
97320
98734
  function removeFactory$9({
@@ -97327,6 +98741,7 @@
97327
98741
  event.stopPropagation();
97328
98742
  const commands = [];
97329
98743
  const businessObject = getRelevantBusinessObject(element);
98744
+ const extensionElements = businessObject.get('extensionElements');
97330
98745
  const properties = getProperties(businessObject, namespace);
97331
98746
  if (!properties) {
97332
98747
  return;
@@ -97346,8 +98761,6 @@
97346
98761
 
97347
98762
  // remove camunda:Properties if there are no properties anymore
97348
98763
  if (!values.length) {
97349
- const businessObject = getBusinessObject$1(element),
97350
- extensionElements = businessObject.get('extensionElements');
97351
98764
  commands.push({
97352
98765
  cmd: 'element.updateModdleProperties',
97353
98766
  context: {
@@ -97447,10 +98860,12 @@
97447
98860
  return 'values';
97448
98861
  }
97449
98862
  function getProperties(element, namespace = 'camunda') {
97450
- return getExtensionElementsList$1(getBusinessObject$1(element), `${namespace}:Properties`)[0];
98863
+ const businessObject = getRelevantBusinessObject(element);
98864
+ return getExtensionElementsList$1(businessObject, `${namespace}:Properties`)[0];
97451
98865
  }
97452
98866
  function getPropertiesList(element, namespace = 'camunda') {
97453
- const properties = getProperties(getBusinessObject$1(element), namespace);
98867
+ const businessObject = getRelevantBusinessObject(element);
98868
+ const properties = getProperties(businessObject, namespace);
97454
98869
  return properties && properties.get(getPropertyName(namespace));
97455
98870
  }
97456
98871
 
@@ -101366,7 +102781,8 @@
101366
102781
  description,
101367
102782
  editable,
101368
102783
  label,
101369
- feel
102784
+ feel,
102785
+ language
101370
102786
  } = property;
101371
102787
  const bpmnFactory = useService('bpmnFactory'),
101372
102788
  commandStack = useService('commandStack'),
@@ -101377,6 +102793,8 @@
101377
102793
  id,
101378
102794
  label,
101379
102795
  feel,
102796
+ monospace: !!language,
102797
+ autoResize: true,
101380
102798
  description: PropertyDescription({
101381
102799
  description
101382
102800
  }),
@@ -104132,11 +105550,21 @@
104132
105550
  }
104133
105551
  };
104134
105552
 
105553
+ this._removeCreateAppendAnything(options);
105554
+
104135
105555
  Modeler$1.call(this, options);
104136
105556
  }
104137
105557
 
104138
105558
  e$6(Modeler, Modeler$1);
104139
105559
 
105560
+ Modeler.prototype._removeCreateAppendAnything = function(options) {
105561
+ const { connectorsExtension } = options;
105562
+
105563
+ if (connectorsExtension && connectorsExtension.appendAnything === false) {
105564
+ this._modules = without(this._modules, createAppendAnythingModule);
105565
+ }
105566
+ };
105567
+
104140
105568
  Modeler.prototype._camundaCloudModules = [
104141
105569
  ...commonModules,
104142
105570
  behaviorsModule,