bpmn-js 11.1.0 → 11.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +0 -8
  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 +7 -6
  11. package/dist/bpmn-modeler.development.js +2560 -1187
  12. package/dist/bpmn-modeler.production.min.js +44 -42
  13. package/dist/bpmn-navigated-viewer.development.js +310 -219
  14. package/dist/bpmn-navigated-viewer.production.min.js +6 -6
  15. package/dist/bpmn-viewer.development.js +310 -219
  16. package/dist/bpmn-viewer.production.min.js +6 -6
  17. package/lib/Modeler.js +2 -0
  18. package/lib/draw/BpmnRenderer.js +185 -196
  19. package/lib/features/align-elements/dist/align-bottom-tool.svg +1 -0
  20. package/lib/features/align-elements/dist/align-horizontal-center-tool.svg +1 -0
  21. package/lib/features/align-elements/dist/align-left-tool.svg +1 -0
  22. package/lib/features/align-elements/dist/align-right-tool.svg +1 -0
  23. package/lib/features/align-elements/dist/align-tool.svg +1 -0
  24. package/lib/features/align-elements/dist/align-top-tool.svg +1 -0
  25. package/lib/features/align-elements/dist/align-vertical-center-tool.svg +1 -0
  26. package/lib/features/context-pad/ContextPadProvider.js +0 -1
  27. package/lib/features/create-append-anything/AppendContextPadProvider.js +77 -0
  28. package/lib/features/create-append-anything/AppendMenuProvider.js +175 -0
  29. package/lib/features/create-append-anything/AppendRules.js +83 -0
  30. package/lib/features/create-append-anything/CreateAppendEditorActions.js +51 -0
  31. package/lib/features/create-append-anything/CreateAppendKeyboardBindings.js +97 -0
  32. package/lib/features/create-append-anything/CreateMenuProvider.js +112 -0
  33. package/lib/features/create-append-anything/CreatePaletteProvider.js +77 -0
  34. package/lib/features/create-append-anything/index.js +37 -0
  35. package/lib/features/create-append-anything/util/OptionsUtil.js +612 -0
  36. package/lib/features/editor-actions/BpmnEditorActions.js +0 -1
  37. package/lib/features/modeling/ElementFactory.js +11 -0
  38. package/lib/features/palette/dist/create.svg +1 -0
  39. package/lib/features/popup-menu/ReplaceMenuProvider.js +7 -2
  40. package/lib/features/popup-menu/index.js +6 -3
  41. package/lib/icons/Icons.js +11 -0
  42. package/lib/icons/resources/append.svg +3 -0
  43. package/lib/icons/resources/create.svg +3 -0
  44. package/package.json +20 -7
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v11.1.0
2
+ * bpmn-js - bpmn-modeler v11.2.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2022-12-12
11
+ * Date: 2023-02-03
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -807,14 +807,17 @@
807
807
  * @return {Array<?>}
808
808
  */
809
809
 
810
- var nativeToString = Object.prototype.toString;
811
- var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
810
+ const nativeToString = Object.prototype.toString;
811
+ const nativeHasOwnProperty = Object.prototype.hasOwnProperty;
812
+
812
813
  function isUndefined$1(obj) {
813
814
  return obj === undefined;
814
815
  }
816
+
815
817
  function isArray$2(obj) {
816
818
  return nativeToString.call(obj) === '[object Array]';
817
819
  }
820
+
818
821
  /**
819
822
  * Return true, if target owns a property with the given key.
820
823
  *
@@ -823,10 +826,11 @@
823
826
  *
824
827
  * @return {Boolean}
825
828
  */
826
-
827
829
  function has(target, key) {
828
830
  return nativeHasOwnProperty.call(target, key);
829
831
  }
832
+
833
+
830
834
  /**
831
835
  * Iterate over collection; returning something
832
836
  * (non-undefined) will stop iteration.
@@ -836,19 +840,22 @@
836
840
  *
837
841
  * @return {Object} return result that stopped the iteration
838
842
  */
839
-
840
843
  function forEach(collection, iterator) {
841
- var val, result;
844
+
845
+ let val,
846
+ result;
842
847
 
843
848
  if (isUndefined$1(collection)) {
844
849
  return;
845
850
  }
846
851
 
847
- var convertKey = isArray$2(collection) ? toNum : identity;
852
+ const convertKey = isArray$2(collection) ? toNum : identity;
853
+
854
+ for (let key in collection) {
848
855
 
849
- for (var key in collection) {
850
856
  if (has(collection, key)) {
851
857
  val = collection[key];
858
+
852
859
  result = iterator(val, convertKey(key));
853
860
 
854
861
  if (result === false) {
@@ -858,6 +865,7 @@
858
865
  }
859
866
  }
860
867
 
868
+
861
869
  function identity(arg) {
862
870
  return arg;
863
871
  }
@@ -2566,34 +2574,128 @@
2566
2574
  */
2567
2575
  BaseRenderer.prototype.getConnectionPath = function() {};
2568
2576
 
2577
+ /**
2578
+ * @param { [ string, ...any[] ][] } elements
2579
+ *
2580
+ * @return { string }
2581
+ */
2569
2582
  function componentsToPath(elements) {
2570
- return elements.join(',').replace(/,?([A-z]),?/g, '$1');
2583
+ return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
2571
2584
  }
2572
2585
 
2573
- function toSVGPoints(points) {
2574
- var result = '';
2586
+ function move(point) {
2587
+ return [ 'M', point.x, point.y ];
2588
+ }
2589
+
2590
+ function lineTo(point) {
2591
+ return [ 'L', point.x, point.y ];
2592
+ }
2593
+
2594
+ function curveTo(p1, p2, p3) {
2595
+ return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
2596
+ }
2597
+
2598
+ function drawPath(waypoints, cornerRadius) {
2599
+ const pointCount = waypoints.length;
2600
+
2601
+ const path = [ move(waypoints[0]) ];
2602
+
2603
+ for (let i = 1; i < pointCount; i++) {
2604
+
2605
+ const pointBefore = waypoints[i - 1];
2606
+ const point = waypoints[i];
2607
+ const pointAfter = waypoints[i + 1];
2608
+
2609
+ if (!pointAfter || !cornerRadius) {
2610
+ path.push(lineTo(point));
2611
+
2612
+ continue;
2613
+ }
2614
+
2615
+ const effectiveRadius = Math.min(
2616
+ cornerRadius,
2617
+ vectorLength$1(point.x - pointBefore.x, point.y - pointBefore.y),
2618
+ vectorLength$1(pointAfter.x - point.x, pointAfter.y - point.y)
2619
+ );
2620
+
2621
+ if (!effectiveRadius) {
2622
+ path.push(lineTo(point));
2575
2623
 
2576
- for (var i = 0, p; (p = points[i]); i++) {
2577
- result += p.x + ',' + p.y + ' ';
2624
+ continue;
2625
+ }
2626
+
2627
+ const beforePoint = getPointAtLength(point, pointBefore, effectiveRadius);
2628
+ const beforePoint2 = getPointAtLength(point, pointBefore, effectiveRadius * .5);
2629
+
2630
+ const afterPoint = getPointAtLength(point, pointAfter, effectiveRadius);
2631
+ const afterPoint2 = getPointAtLength(point, pointAfter, effectiveRadius * .5);
2632
+
2633
+ path.push(lineTo(beforePoint));
2634
+ path.push(curveTo(beforePoint2, afterPoint2, afterPoint));
2578
2635
  }
2579
2636
 
2580
- return result;
2637
+ return path;
2581
2638
  }
2582
2639
 
2583
- function createLine(points, attrs) {
2640
+ function getPointAtLength(start, end, length) {
2584
2641
 
2585
- var line = create$1('polyline');
2586
- attr(line, { points: toSVGPoints(points) });
2642
+ const deltaX = end.x - start.x;
2643
+ const deltaY = end.y - start.y;
2587
2644
 
2588
- if (attrs) {
2589
- attr(line, attrs);
2645
+ const totalLength = vectorLength$1(deltaX, deltaY);
2646
+
2647
+ const percent = length / totalLength;
2648
+
2649
+ return {
2650
+ x: start.x + deltaX * percent,
2651
+ y: start.y + deltaY * percent
2652
+ };
2653
+ }
2654
+
2655
+ function vectorLength$1(x, y) {
2656
+ return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
2657
+ }
2658
+
2659
+ /**
2660
+ * @param { { x: number, y: number }[] } points
2661
+ * @param { any } [attrs]
2662
+ * @param { number } [radius]
2663
+ *
2664
+ * @return {SVGElement}
2665
+ */
2666
+ function createLine(points, attrs, radius) {
2667
+
2668
+ if (isNumber(attrs)) {
2669
+ radius = attrs;
2670
+ attrs = null;
2590
2671
  }
2591
2672
 
2592
- return line;
2673
+ if (!attrs) {
2674
+ attrs = {};
2675
+ }
2676
+
2677
+ const line = create$1('path', attrs);
2678
+
2679
+ if (isNumber(radius)) {
2680
+ line.dataset.cornerRadius = String(radius);
2681
+ }
2682
+
2683
+ return updateLine(line, points);
2593
2684
  }
2594
2685
 
2686
+ /**
2687
+ * @param { SVGElement } gfx
2688
+ * @param { { x: number, y: number }[]} points
2689
+ *
2690
+ * @return {SVGElement}
2691
+ */
2595
2692
  function updateLine(gfx, points) {
2596
- attr(gfx, { points: toSVGPoints(points) });
2693
+
2694
+ const cornerRadius = parseInt(gfx.dataset.cornerRadius, 10) || 0;
2695
+
2696
+ attr(gfx, {
2697
+ d: componentsToPath(drawPath(points, cornerRadius))
2698
+ });
2597
2699
 
2598
2700
  return gfx;
2599
2701
  }
@@ -3254,65 +3356,42 @@
3254
3356
  /**
3255
3357
  * Check whether two points are horizontally or vertically aligned.
3256
3358
  *
3257
- * @param {Array<Point>|Point}
3258
- * @param {Point}
3359
+ * @param {Point[]|Point} a
3360
+ * @param {Point} [b]
3259
3361
  *
3260
- * @return {string|boolean}
3362
+ * @return {'h'|'v'|false} axis or false
3261
3363
  */
3262
3364
  function pointsAligned(a, b) {
3263
- var points;
3365
+ var points = Array.from(arguments).flat();
3264
3366
 
3265
- if (isArray$3(a)) {
3266
- points = a;
3267
- } else {
3268
- points = [ a, b ];
3269
- }
3270
-
3271
- if (pointsAlignedHorizontally(points)) {
3272
- return 'h';
3273
- }
3367
+ const axisMap = {
3368
+ 'x': 'v',
3369
+ 'y': 'h'
3370
+ };
3274
3371
 
3275
- if (pointsAlignedVertically(points)) {
3276
- return 'v';
3372
+ for (const [ axis, orientation ] of Object.entries(axisMap)) {
3373
+ if (pointsAlignedOnAxis(axis, points)) {
3374
+ return orientation;
3375
+ }
3277
3376
  }
3278
3377
 
3279
3378
  return false;
3280
3379
  }
3281
3380
 
3282
- function pointsAlignedHorizontally(a, b) {
3283
- var points;
3284
-
3285
- if (isArray$3(a)) {
3286
- points = a;
3287
- } else {
3288
- points = [ a, b ];
3289
- }
3290
-
3291
- var firstPoint = points.slice().shift();
3292
-
3293
- return every(points, function(point) {
3294
- return Math.abs(firstPoint.y - point.y) <= ALIGNED_THRESHOLD;
3295
- });
3296
- }
3297
-
3298
- function pointsAlignedVertically(a, b) {
3299
- var points;
3300
-
3301
- if (isArray$3(a)) {
3302
- points = a;
3303
- } else {
3304
- points = [ a, b ];
3305
- }
3306
-
3307
- var firstPoint = points.slice().shift();
3381
+ /**
3382
+ * @param { 'x' | 'y' } axis
3383
+ * @param { Point[] } points
3384
+ *
3385
+ * @return {boolean}
3386
+ */
3387
+ function pointsAlignedOnAxis(axis, points) {
3388
+ const referencePoint = points[0];
3308
3389
 
3309
3390
  return every(points, function(point) {
3310
- return Math.abs(firstPoint.x - point.x) <= ALIGNED_THRESHOLD;
3391
+ return Math.abs(referencePoint[axis] - point[axis]) <= ALIGNED_THRESHOLD;
3311
3392
  });
3312
3393
  }
3313
3394
 
3314
-
3315
-
3316
3395
  /**
3317
3396
  * Returns true if the point p is inside the rectangle rect
3318
3397
  *
@@ -4415,7 +4494,7 @@
4415
4494
  * @return {Point}
4416
4495
  */
4417
4496
  function getMid(element) {
4418
- if (isConnection$f(element)) {
4497
+ if (isConnection$g(element)) {
4419
4498
  return getConnectionMid(element);
4420
4499
  }
4421
4500
 
@@ -4555,7 +4634,7 @@
4555
4634
  return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
4556
4635
  }
4557
4636
 
4558
- function isConnection$f(element) {
4637
+ function isConnection$g(element) {
4559
4638
  return !!element.waypoints;
4560
4639
  }
4561
4640
 
@@ -17015,7 +17094,7 @@
17015
17094
  return element && !!getBusinessObject(element).triggeredByEvent;
17016
17095
  }
17017
17096
 
17018
- function hasEventDefinition$2(element, eventType) {
17097
+ function hasEventDefinition$3(element, eventType) {
17019
17098
  var bo = getBusinessObject(element),
17020
17099
  hasEventDefinition = false;
17021
17100
 
@@ -17031,15 +17110,15 @@
17031
17110
  }
17032
17111
 
17033
17112
  function hasErrorEventDefinition(element) {
17034
- return hasEventDefinition$2(element, 'bpmn:ErrorEventDefinition');
17113
+ return hasEventDefinition$3(element, 'bpmn:ErrorEventDefinition');
17035
17114
  }
17036
17115
 
17037
17116
  function hasEscalationEventDefinition(element) {
17038
- return hasEventDefinition$2(element, 'bpmn:EscalationEventDefinition');
17117
+ return hasEventDefinition$3(element, 'bpmn:EscalationEventDefinition');
17039
17118
  }
17040
17119
 
17041
17120
  function hasCompensateEventDefinition(element) {
17042
- return hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
17121
+ return hasEventDefinition$3(element, 'bpmn:CompensateEventDefinition');
17043
17122
  }
17044
17123
 
17045
17124
  function getLabelAttr(semantic) {
@@ -17274,33 +17353,33 @@
17274
17353
 
17275
17354
  var markers = {};
17276
17355
 
17277
- var computeStyle = styles.computeStyle;
17278
-
17279
- function addMarker(id, options) {
17280
- var attrs = assign$1({
17281
- fill: black,
17282
- strokeWidth: 1,
17356
+ function shapeStyle(attrs) {
17357
+ return styles.computeStyle(attrs, {
17283
17358
  strokeLinecap: 'round',
17284
- strokeDasharray: 'none'
17285
- }, options.attrs);
17286
-
17287
- var ref = options.ref || { x: 0, y: 0 };
17288
-
17289
- var scale = options.scale || 1;
17290
-
17291
- // fix for safari / chrome / firefox bug not correctly
17292
- // resetting stroke dash array
17293
- if (attrs.strokeDasharray === 'none') {
17294
- attrs.strokeDasharray = [ 10000, 1 ];
17295
- }
17296
-
17297
- var marker = create$1('marker');
17359
+ strokeLinejoin: 'round',
17360
+ stroke: black,
17361
+ strokeWidth: 2,
17362
+ fill: 'white'
17363
+ });
17364
+ }
17298
17365
 
17299
- attr(options.element, attrs);
17366
+ function lineStyle(attrs) {
17367
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
17368
+ strokeLinecap: 'round',
17369
+ strokeLinejoin: 'round',
17370
+ stroke: black,
17371
+ strokeWidth: 2
17372
+ });
17373
+ }
17300
17374
 
17301
- append(marker, options.element);
17375
+ function addMarker(id, options) {
17376
+ var {
17377
+ ref = { x: 0, y: 0 },
17378
+ scale = 1,
17379
+ element
17380
+ } = options;
17302
17381
 
17303
- attr(marker, {
17382
+ var marker = create$1('marker', {
17304
17383
  id: id,
17305
17384
  viewBox: '0 0 20 20',
17306
17385
  refX: ref.x,
@@ -17310,6 +17389,8 @@
17310
17389
  orient: 'auto'
17311
17390
  });
17312
17391
 
17392
+ append(marker, element);
17393
+
17313
17394
  var defs = query('defs', canvas._svg);
17314
17395
 
17315
17396
  if (!defs) {
@@ -17342,105 +17423,116 @@
17342
17423
  function createMarker(id, type, fill, stroke) {
17343
17424
 
17344
17425
  if (type === 'sequenceflow-end') {
17345
- var sequenceflowEnd = create$1('path');
17346
- attr(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
17426
+ var sequenceflowEnd = create$1('path', {
17427
+ d: 'M 1 5 L 11 10 L 1 15 Z',
17428
+ ...shapeStyle({
17429
+ fill: stroke,
17430
+ stroke: stroke,
17431
+ strokeWidth: 1
17432
+ })
17433
+ });
17347
17434
 
17348
17435
  addMarker(id, {
17349
17436
  element: sequenceflowEnd,
17350
17437
  ref: { x: 11, y: 10 },
17351
- scale: 0.5,
17352
- attrs: {
17353
- fill: stroke,
17354
- stroke: stroke
17355
- }
17438
+ scale: 0.5
17356
17439
  });
17357
17440
  }
17358
17441
 
17359
17442
  if (type === 'messageflow-start') {
17360
- var messageflowStart = create$1('circle');
17361
- attr(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
17443
+ var messageflowStart = create$1('circle', {
17444
+ cx: 6,
17445
+ cy: 6,
17446
+ r: 3.5,
17447
+ ...shapeStyle({
17448
+ fill: fill,
17449
+ stroke: stroke,
17450
+ strokeWidth: 1
17451
+ })
17452
+ });
17362
17453
 
17363
17454
  addMarker(id, {
17364
17455
  element: messageflowStart,
17365
- attrs: {
17366
- fill: fill,
17367
- stroke: stroke
17368
- },
17369
17456
  ref: { x: 6, y: 6 }
17370
17457
  });
17371
17458
  }
17372
17459
 
17373
17460
  if (type === 'messageflow-end') {
17374
- var messageflowEnd = create$1('path');
17375
- attr(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
17461
+ var messageflowEnd = create$1('path', {
17462
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
17463
+ ...shapeStyle({
17464
+ fill: fill,
17465
+ stroke: stroke,
17466
+ strokeWidth: 1
17467
+ })
17468
+ });
17376
17469
 
17377
17470
  addMarker(id, {
17378
17471
  element: messageflowEnd,
17379
- attrs: {
17380
- fill: fill,
17381
- stroke: stroke,
17382
- strokeLinecap: 'butt'
17383
- },
17384
17472
  ref: { x: 8.5, y: 5 }
17385
17473
  });
17386
17474
  }
17387
17475
 
17388
17476
  if (type === 'association-start') {
17389
- var associationStart = create$1('path');
17390
- attr(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
17391
-
17392
- addMarker(id, {
17393
- element: associationStart,
17394
- attrs: {
17477
+ var associationStart = create$1('path', {
17478
+ d: 'M 11 5 L 1 10 L 11 15',
17479
+ ...lineStyle({
17395
17480
  fill: 'none',
17396
17481
  stroke: stroke,
17397
17482
  strokeWidth: 1.5
17398
- },
17483
+ })
17484
+ });
17485
+
17486
+ addMarker(id, {
17487
+ element: associationStart,
17399
17488
  ref: { x: 1, y: 10 },
17400
17489
  scale: 0.5
17401
17490
  });
17402
17491
  }
17403
17492
 
17404
17493
  if (type === 'association-end') {
17405
- var associationEnd = create$1('path');
17406
- attr(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
17407
-
17408
- addMarker(id, {
17409
- element: associationEnd,
17410
- attrs: {
17494
+ var associationEnd = create$1('path', {
17495
+ d: 'M 1 5 L 11 10 L 1 15',
17496
+ ...lineStyle({
17411
17497
  fill: 'none',
17412
17498
  stroke: stroke,
17413
17499
  strokeWidth: 1.5
17414
- },
17415
- ref: { x: 12, y: 10 },
17500
+ })
17501
+ });
17502
+
17503
+ addMarker(id, {
17504
+ element: associationEnd,
17505
+ ref: { x: 11, y: 10 },
17416
17506
  scale: 0.5
17417
17507
  });
17418
17508
  }
17419
17509
 
17420
17510
  if (type === 'conditional-flow-marker') {
17421
- var conditionalflowMarker = create$1('path');
17422
- attr(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
17423
-
17424
- addMarker(id, {
17425
- element: conditionalflowMarker,
17426
- attrs: {
17511
+ var conditionalFlowMarker = create$1('path', {
17512
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
17513
+ ...shapeStyle({
17427
17514
  fill: fill,
17428
17515
  stroke: stroke
17429
- },
17516
+ })
17517
+ });
17518
+
17519
+ addMarker(id, {
17520
+ element: conditionalFlowMarker,
17430
17521
  ref: { x: -1, y: 10 },
17431
17522
  scale: 0.5
17432
17523
  });
17433
17524
  }
17434
17525
 
17435
17526
  if (type === 'conditional-default-flow-marker') {
17436
- var conditionaldefaultflowMarker = create$1('path');
17437
- attr(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
17527
+ var defaultFlowMarker = create$1('path', {
17528
+ d: 'M 6 4 L 10 16',
17529
+ ...shapeStyle({
17530
+ stroke: stroke
17531
+ })
17532
+ });
17438
17533
 
17439
17534
  addMarker(id, {
17440
- element: conditionaldefaultflowMarker,
17441
- attrs: {
17442
- stroke: stroke
17443
- },
17535
+ element: defaultFlowMarker,
17444
17536
  ref: { x: 0, y: 10 },
17445
17537
  scale: 0.5
17446
17538
  });
@@ -17456,11 +17548,7 @@
17456
17548
 
17457
17549
  offset = offset || 0;
17458
17550
 
17459
- attrs = computeStyle(attrs, {
17460
- stroke: black,
17461
- strokeWidth: 2,
17462
- fill: 'white'
17463
- });
17551
+ attrs = shapeStyle(attrs);
17464
17552
 
17465
17553
  if (attrs.fill === 'none') {
17466
17554
  delete attrs.fillOpacity;
@@ -17469,13 +17557,12 @@
17469
17557
  var cx = width / 2,
17470
17558
  cy = height / 2;
17471
17559
 
17472
- var circle = create$1('circle');
17473
- attr(circle, {
17560
+ var circle = create$1('circle', {
17474
17561
  cx: cx,
17475
17562
  cy: cy,
17476
- r: Math.round((width + height) / 4 - offset)
17563
+ r: Math.round((width + height) / 4 - offset),
17564
+ ...attrs
17477
17565
  });
17478
- attr(circle, attrs);
17479
17566
 
17480
17567
  append(parentGfx, circle);
17481
17568
 
@@ -17491,22 +17578,17 @@
17491
17578
 
17492
17579
  offset = offset || 0;
17493
17580
 
17494
- attrs = computeStyle(attrs, {
17495
- stroke: black,
17496
- strokeWidth: 2,
17497
- fill: 'white'
17498
- });
17581
+ attrs = shapeStyle(attrs);
17499
17582
 
17500
- var rect = create$1('rect');
17501
- attr(rect, {
17583
+ var rect = create$1('rect', {
17502
17584
  x: offset,
17503
17585
  y: offset,
17504
17586
  width: width - offset * 2,
17505
17587
  height: height - offset * 2,
17506
17588
  rx: r,
17507
- ry: r
17589
+ ry: r,
17590
+ ...attrs
17508
17591
  });
17509
- attr(rect, attrs);
17510
17592
 
17511
17593
  append(parentGfx, rect);
17512
17594
 
@@ -17518,53 +17600,66 @@
17518
17600
  var x_2 = width / 2;
17519
17601
  var y_2 = height / 2;
17520
17602
 
17521
- var points = [ { x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 } ];
17603
+ var points = [
17604
+ { x: x_2, y: 0 },
17605
+ { x: width, y: y_2 },
17606
+ { x: x_2, y: height },
17607
+ { x: 0, y: y_2 }
17608
+ ];
17522
17609
 
17523
17610
  var pointsString = points.map(function(point) {
17524
17611
  return point.x + ',' + point.y;
17525
17612
  }).join(' ');
17526
17613
 
17527
- attrs = computeStyle(attrs, {
17528
- stroke: black,
17529
- strokeWidth: 2,
17530
- fill: 'white'
17531
- });
17614
+ attrs = shapeStyle(attrs);
17532
17615
 
17533
- var polygon = create$1('polygon');
17534
- attr(polygon, {
17616
+ var polygon = create$1('polygon', {
17617
+ ...attrs,
17535
17618
  points: pointsString
17536
17619
  });
17537
- attr(polygon, attrs);
17538
17620
 
17539
17621
  append(parentGfx, polygon);
17540
17622
 
17541
17623
  return polygon;
17542
17624
  }
17543
17625
 
17544
- function drawLine(parentGfx, waypoints, attrs) {
17545
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17546
- stroke: black,
17547
- strokeWidth: 2,
17548
- fill: 'none'
17549
- });
17626
+ /**
17627
+ * @param {SVGElement} parentGfx
17628
+ * @param {Point[]} waypoints
17629
+ * @param {any} attrs
17630
+ * @param {number} [radius]
17631
+ *
17632
+ * @return {SVGElement}
17633
+ */
17634
+ function drawLine(parentGfx, waypoints, attrs, radius) {
17635
+ attrs = lineStyle(attrs);
17550
17636
 
17551
- var line = createLine(waypoints, attrs);
17637
+ var line = createLine(waypoints, attrs, radius);
17552
17638
 
17553
17639
  append(parentGfx, line);
17554
17640
 
17555
17641
  return line;
17556
17642
  }
17557
17643
 
17644
+ /**
17645
+ * @param {SVGElement} parentGfx
17646
+ * @param {Point[]} waypoints
17647
+ * @param {any} attrs
17648
+ *
17649
+ * @return {SVGElement}
17650
+ */
17651
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
17652
+ return drawLine(parentGfx, waypoints, attrs, 5);
17653
+ }
17654
+
17558
17655
  function drawPath(parentGfx, d, attrs) {
17559
17656
 
17560
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17561
- strokeWidth: 2,
17562
- stroke: black
17563
- });
17657
+ attrs = lineStyle(attrs);
17564
17658
 
17565
- var path = create$1('path');
17566
- attr(path, { d: d });
17567
- attr(path, attrs);
17659
+ var path = create$1('path', {
17660
+ ...attrs,
17661
+ d
17662
+ });
17568
17663
 
17569
17664
  append(parentGfx, path);
17570
17665
 
@@ -17665,7 +17760,7 @@
17665
17760
  return renderLabel(parentGfx, semantic.name, {
17666
17761
  box: element,
17667
17762
  align: align,
17668
- padding: 5,
17763
+ padding: 7,
17669
17764
  style: {
17670
17765
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17671
17766
  }
@@ -17711,16 +17806,6 @@
17711
17806
  transform(textBox, 0, -top, 270);
17712
17807
  }
17713
17808
 
17714
- function createPathFromConnection(connection) {
17715
- var waypoints = connection.waypoints;
17716
-
17717
- var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
17718
- for (var i = 1; i < waypoints.length; i++) {
17719
- pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
17720
- }
17721
- return pathData;
17722
- }
17723
-
17724
17809
  var handlers = this.handlers = {
17725
17810
  'bpmn:Event': function(parentGfx, element, attrs) {
17726
17811
 
@@ -17741,7 +17826,6 @@
17741
17826
  if (!semantic.isInterrupting) {
17742
17827
  attrs = {
17743
17828
  strokeDasharray: '6',
17744
- strokeLinecap: 'round',
17745
17829
  fill: getFillColor(element, defaultFillColor),
17746
17830
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17747
17831
  };
@@ -17796,7 +17880,6 @@
17796
17880
 
17797
17881
  drawPath(parentGfx, pathData, {
17798
17882
  strokeWidth: 2,
17799
- strokeLinecap: 'square',
17800
17883
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17801
17884
  });
17802
17885
 
@@ -17818,7 +17901,6 @@
17818
17901
 
17819
17902
  drawPath(parentGfx, linePathData, {
17820
17903
  strokeWidth: 1,
17821
- strokeLinecap: 'square',
17822
17904
  transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
17823
17905
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17824
17906
  });
@@ -18026,14 +18108,14 @@
18026
18108
  },
18027
18109
  'bpmn:IntermediateEvent': function(parentGfx, element) {
18028
18110
  var outer = renderer('bpmn:Event')(parentGfx, element, {
18029
- strokeWidth: 1,
18111
+ strokeWidth: 1.5,
18030
18112
  fill: getFillColor(element, defaultFillColor),
18031
18113
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18032
18114
  });
18033
18115
 
18034
18116
  /* inner */
18035
18117
  drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
18036
- strokeWidth: 1,
18118
+ strokeWidth: 1.5,
18037
18119
  fill: getFillColor(element, 'none'),
18038
18120
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18039
18121
  });
@@ -18286,10 +18368,11 @@
18286
18368
  return task;
18287
18369
  },
18288
18370
  'bpmn:SubProcess': function(parentGfx, element, attrs) {
18289
- attrs = assign$1({
18371
+ attrs = {
18290
18372
  fill: getFillColor(element, defaultFillColor),
18291
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18292
- }, attrs);
18373
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18374
+ ...attrs
18375
+ };
18293
18376
 
18294
18377
  var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
18295
18378
 
@@ -18297,7 +18380,8 @@
18297
18380
 
18298
18381
  if (isEventSubProcess(element)) {
18299
18382
  attr(rect, {
18300
- strokeDasharray: '1,2'
18383
+ strokeDasharray: '0, 5.5',
18384
+ strokeWidth: 2.5
18301
18385
  });
18302
18386
  }
18303
18387
 
@@ -18315,13 +18399,14 @@
18315
18399
  return renderer('bpmn:SubProcess')(parentGfx, element);
18316
18400
  },
18317
18401
  'bpmn:Transaction': function(parentGfx, element) {
18318
- var outer = renderer('bpmn:SubProcess')(parentGfx, element);
18402
+ var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
18319
18403
 
18320
18404
  var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
18321
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18405
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18406
+ strokeWidth: 1.5
18322
18407
  });
18323
18408
 
18324
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
18409
+ /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
18325
18410
 
18326
18411
  return outer;
18327
18412
  },
@@ -18332,10 +18417,13 @@
18332
18417
  },
18333
18418
  'bpmn:Participant': function(parentGfx, element) {
18334
18419
 
18420
+ var strokeWidth = 1.5;
18421
+
18335
18422
  var attrs = {
18336
18423
  fillOpacity: DEFAULT_FILL_OPACITY,
18337
18424
  fill: getFillColor(element, defaultFillColor),
18338
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18425
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18426
+ strokeWidth
18339
18427
  };
18340
18428
 
18341
18429
  var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
@@ -18347,13 +18435,14 @@
18347
18435
  { x: 30, y: 0 },
18348
18436
  { x: 30, y: element.height }
18349
18437
  ], {
18350
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18438
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18439
+ strokeWidth
18351
18440
  });
18352
18441
  var text = getSemantic(element).name;
18353
18442
  renderLaneLabel(parentGfx, text, element);
18354
18443
  } else {
18355
18444
 
18356
- // Collapsed pool draw text inline
18445
+ // collapsed pool draw text inline
18357
18446
  var text2 = getSemantic(element).name;
18358
18447
  renderLabel(parentGfx, text2, {
18359
18448
  box: element, align: 'center-middle',
@@ -18372,11 +18461,13 @@
18372
18461
  return lane;
18373
18462
  },
18374
18463
  'bpmn:Lane': function(parentGfx, element, attrs) {
18375
- var rect = drawRect(parentGfx, element.width, element.height, 0, assign$1({
18464
+ var rect = drawRect(parentGfx, element.width, element.height, 0, {
18376
18465
  fill: getFillColor(element, defaultFillColor),
18377
18466
  fillOpacity: HIGH_FILL_OPACITY,
18378
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18379
- }, attrs));
18467
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18468
+ strokeWidth: 1.5,
18469
+ ...attrs
18470
+ });
18380
18471
 
18381
18472
  var semantic = getSemantic(element);
18382
18473
 
@@ -18495,13 +18586,11 @@
18495
18586
  }
18496
18587
  });
18497
18588
 
18498
- var attrs = {
18589
+ /* event path */ drawPath(parentGfx, pathData, {
18499
18590
  strokeWidth: 2,
18500
18591
  fill: getFillColor(element, 'none'),
18501
18592
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18502
- };
18503
-
18504
- /* event path */ drawPath(parentGfx, pathData, attrs);
18593
+ });
18505
18594
  }
18506
18595
 
18507
18596
  if (type === 'Parallel') {
@@ -18517,16 +18606,14 @@
18517
18606
  }
18518
18607
  });
18519
18608
 
18520
- var parallelPath = drawPath(parentGfx, pathData);
18521
- attr(parallelPath, {
18609
+ drawPath(parentGfx, pathData, {
18522
18610
  strokeWidth: 1,
18523
18611
  fill: 'none'
18524
18612
  });
18525
18613
  } else if (type === 'Exclusive') {
18526
18614
 
18527
18615
  if (!instantiate) {
18528
- var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
18529
- attr(innerCircle, {
18616
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
18530
18617
  strokeWidth: 1,
18531
18618
  fill: 'none',
18532
18619
  stroke: getStrokeColor$1(element, defaultStrokeColor)
@@ -18540,27 +18627,20 @@
18540
18627
  return diamond;
18541
18628
  },
18542
18629
  'bpmn:Gateway': function(parentGfx, element) {
18543
- var attrs = {
18630
+ return drawDiamond(parentGfx, element.width, element.height, {
18544
18631
  fill: getFillColor(element, defaultFillColor),
18545
18632
  fillOpacity: DEFAULT_FILL_OPACITY,
18546
18633
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18547
- };
18548
-
18549
- return drawDiamond(parentGfx, element.width, element.height, attrs);
18634
+ });
18550
18635
  },
18551
18636
  'bpmn:SequenceFlow': function(parentGfx, element) {
18552
- var pathData = createPathFromConnection(element);
18553
-
18554
18637
  var fill = getFillColor(element, defaultFillColor),
18555
18638
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18556
18639
 
18557
- var attrs = {
18558
- strokeLinejoin: 'round',
18640
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18559
18641
  markerEnd: marker('sequenceflow-end', fill, stroke),
18560
18642
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18561
- };
18562
-
18563
- var path = drawPath(parentGfx, pathData, attrs);
18643
+ });
18564
18644
 
18565
18645
  var sequenceFlow = getSemantic(element);
18566
18646
 
@@ -18594,12 +18674,11 @@
18594
18674
  var fill = getFillColor(element, defaultFillColor),
18595
18675
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18596
18676
 
18597
- attrs = assign$1({
18598
- strokeDasharray: '0.5, 5',
18599
- strokeLinecap: 'round',
18600
- strokeLinejoin: 'round',
18601
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18602
- }, attrs || {});
18677
+ attrs = {
18678
+ strokeDasharray: '0, 5',
18679
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18680
+ ...attrs
18681
+ };
18603
18682
 
18604
18683
  if (semantic.associationDirection === 'One' ||
18605
18684
  semantic.associationDirection === 'Both') {
@@ -18610,7 +18689,7 @@
18610
18689
  attrs.markerStart = marker('association-start', fill, stroke);
18611
18690
  }
18612
18691
 
18613
- return drawLine(parentGfx, element.waypoints, attrs);
18692
+ return drawConnectionSegments(parentGfx, element.waypoints, attrs);
18614
18693
  },
18615
18694
  'bpmn:DataInputAssociation': function(parentGfx, element) {
18616
18695
  var fill = getFillColor(element, defaultFillColor),
@@ -18636,19 +18715,13 @@
18636
18715
  var fill = getFillColor(element, defaultFillColor),
18637
18716
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18638
18717
 
18639
- var pathData = createPathFromConnection(element);
18640
-
18641
- var attrs = {
18718
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18642
18719
  markerEnd: marker('messageflow-end', fill, stroke),
18643
18720
  markerStart: marker('messageflow-start', fill, stroke),
18644
- strokeDasharray: '10, 12',
18645
- strokeLinecap: 'round',
18646
- strokeLinejoin: 'round',
18647
- strokeWidth: '1.5px',
18721
+ strokeDasharray: '10, 11',
18722
+ strokeWidth: 1.5,
18648
18723
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18649
- };
18650
-
18651
- var path = drawPath(parentGfx, pathData, attrs);
18724
+ });
18652
18725
 
18653
18726
  if (semantic.messageRef) {
18654
18727
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
@@ -18771,25 +18844,26 @@
18771
18844
  cancel = semantic.cancelActivity;
18772
18845
 
18773
18846
  var attrs = {
18774
- strokeWidth: 1,
18847
+ strokeWidth: 1.5,
18775
18848
  fill: getFillColor(element, defaultFillColor),
18776
18849
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18777
18850
  };
18778
18851
 
18779
18852
  if (!cancel) {
18780
18853
  attrs.strokeDasharray = '6';
18781
- attrs.strokeLinecap = 'round';
18782
18854
  }
18783
18855
 
18784
18856
  // apply fillOpacity
18785
- var outerAttrs = assign$1({}, attrs, {
18857
+ var outerAttrs = {
18858
+ ...attrs,
18786
18859
  fillOpacity: 1
18787
- });
18860
+ };
18788
18861
 
18789
18862
  // apply no-fill
18790
- var innerAttrs = assign$1({}, attrs, {
18863
+ var innerAttrs = {
18864
+ ...attrs,
18791
18865
  fill: 'none'
18792
- });
18866
+ };
18793
18867
 
18794
18868
  var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
18795
18869
 
@@ -18800,27 +18874,22 @@
18800
18874
  return outer;
18801
18875
  },
18802
18876
  'bpmn:Group': function(parentGfx, element) {
18803
-
18804
- var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
18877
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
18805
18878
  stroke: getStrokeColor$1(element, defaultStrokeColor),
18806
- strokeWidth: 1,
18807
- strokeDasharray: '8,3,1,3',
18879
+ strokeWidth: 1.5,
18880
+ strokeDasharray: '10,6,0,6',
18808
18881
  fill: 'none',
18809
18882
  pointerEvents: 'none'
18810
18883
  });
18811
-
18812
- return group;
18813
18884
  },
18814
18885
  'label': function(parentGfx, element) {
18815
18886
  return renderExternalLabel(parentGfx, element);
18816
18887
  },
18817
18888
  'bpmn:TextAnnotation': function(parentGfx, element) {
18818
- var style = {
18889
+ var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
18819
18890
  'fill': 'none',
18820
18891
  'stroke': 'none'
18821
- };
18822
-
18823
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
18892
+ });
18824
18893
 
18825
18894
  var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
18826
18895
  xScaleFactor: 1,
@@ -18841,7 +18910,7 @@
18841
18910
  renderLabel(parentGfx, text, {
18842
18911
  box: element,
18843
18912
  align: 'left-top',
18844
- padding: 5,
18913
+ padding: 7,
18845
18914
  style: {
18846
18915
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
18847
18916
  }
@@ -18959,10 +19028,9 @@
18959
19028
  });
18960
19029
 
18961
19030
  drawMarker('loop', parentGfx, markerPath, {
18962
- strokeWidth: 1,
19031
+ strokeWidth: 1.5,
18963
19032
  fill: getFillColor(element, defaultFillColor),
18964
19033
  stroke: getStrokeColor$1(element, defaultStrokeColor),
18965
- strokeLinecap: 'round',
18966
19034
  strokeMiterlimit: 0.5
18967
19035
  });
18968
19036
  },
@@ -20676,7 +20744,7 @@
20676
20744
  return isPrimaryButton(event) || isAuxiliaryButton(event);
20677
20745
  }
20678
20746
 
20679
- var LOW_PRIORITY$q = 500;
20747
+ var LOW_PRIORITY$r = 500;
20680
20748
 
20681
20749
 
20682
20750
  /**
@@ -20871,7 +20939,7 @@
20871
20939
  eventBus.on([
20872
20940
  'shape.changed',
20873
20941
  'connection.changed'
20874
- ], LOW_PRIORITY$q, function(event) {
20942
+ ], LOW_PRIORITY$r, function(event) {
20875
20943
 
20876
20944
  var element = event.element,
20877
20945
  gfx = event.gfx;
@@ -20879,7 +20947,7 @@
20879
20947
  eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
20880
20948
  });
20881
20949
 
20882
- eventBus.on('interactionEvents.createHit', LOW_PRIORITY$q, function(event) {
20950
+ eventBus.on('interactionEvents.createHit', LOW_PRIORITY$r, function(event) {
20883
20951
  var element = event.element,
20884
20952
  gfx = event.gfx;
20885
20953
 
@@ -21156,7 +21224,7 @@
21156
21224
  interactionEvents: [ 'type', InteractionEvents ]
21157
21225
  };
21158
21226
 
21159
- var LOW_PRIORITY$p = 500;
21227
+ var LOW_PRIORITY$q = 500;
21160
21228
 
21161
21229
 
21162
21230
  /**
@@ -21183,7 +21251,7 @@
21183
21251
  attr(outline, assign$1({
21184
21252
  x: 10,
21185
21253
  y: 10,
21186
- rx: 3,
21254
+ rx: 4,
21187
21255
  width: 100,
21188
21256
  height: 100
21189
21257
  }, OUTLINE_STYLE));
@@ -21195,7 +21263,7 @@
21195
21263
 
21196
21264
  // A low priortity is necessary, because outlines of labels have to be updated
21197
21265
  // after the label bounds have been updated in the renderer.
21198
- eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$p, function(event) {
21266
+ eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$q, function(event) {
21199
21267
  var element = event.element,
21200
21268
  gfx = event.gfx;
21201
21269
 
@@ -21641,7 +21709,7 @@
21641
21709
  // document wide unique overlay ids
21642
21710
  var ids$1 = new IdGenerator('ov');
21643
21711
 
21644
- var LOW_PRIORITY$o = 500;
21712
+ var LOW_PRIORITY$p = 500;
21645
21713
 
21646
21714
 
21647
21715
  /**
@@ -22213,7 +22281,7 @@
22213
22281
 
22214
22282
  // move integration
22215
22283
 
22216
- eventBus.on('element.changed', LOW_PRIORITY$o, function(e) {
22284
+ eventBus.on('element.changed', LOW_PRIORITY$p, function(e) {
22217
22285
  var element = e.element;
22218
22286
 
22219
22287
  var container = self._getOverlayContainer(element, true);
@@ -23173,7 +23241,7 @@
23173
23241
  return true;
23174
23242
  }
23175
23243
 
23176
- var LOW_PRIORITY$n = 250;
23244
+ var LOW_PRIORITY$o = 250;
23177
23245
  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>';
23178
23246
 
23179
23247
  var EMPTY_MARKER = 'bjs-drilldown-empty';
@@ -23190,7 +23258,7 @@
23190
23258
 
23191
23259
  var self = this;
23192
23260
 
23193
- this.executed('shape.toggleCollapse', LOW_PRIORITY$n, function(context) {
23261
+ this.executed('shape.toggleCollapse', LOW_PRIORITY$o, function(context) {
23194
23262
  var shape = context.shape;
23195
23263
 
23196
23264
  // Add overlay to the collapsed shape
@@ -23202,7 +23270,7 @@
23202
23270
  }, true);
23203
23271
 
23204
23272
 
23205
- this.reverted('shape.toggleCollapse', LOW_PRIORITY$n, function(context) {
23273
+ this.reverted('shape.toggleCollapse', LOW_PRIORITY$o, function(context) {
23206
23274
  var shape = context.shape;
23207
23275
 
23208
23276
  // Add overlay to the collapsed shape
@@ -23214,7 +23282,7 @@
23214
23282
  }, true);
23215
23283
 
23216
23284
 
23217
- this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$n,
23285
+ this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$o,
23218
23286
  function(context) {
23219
23287
  var oldParent = context.oldParent,
23220
23288
  newParent = context.newParent || context.parent,
@@ -23231,7 +23299,7 @@
23231
23299
  }, true);
23232
23300
 
23233
23301
 
23234
- this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$n,
23302
+ this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$o,
23235
23303
  function(context) {
23236
23304
  var oldParent = context.oldParent,
23237
23305
  newParent = context.newParent || context.parent,
@@ -23680,7 +23748,7 @@
23680
23748
  return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
23681
23749
  }
23682
23750
 
23683
- var LOW_PRIORITY$m = 500;
23751
+ var LOW_PRIORITY$n = 500;
23684
23752
 
23685
23753
 
23686
23754
  /**
@@ -23696,7 +23764,7 @@
23696
23764
 
23697
23765
  var self = this;
23698
23766
 
23699
- eventBus.on('editorActions.init', LOW_PRIORITY$m, function(event) {
23767
+ eventBus.on('editorActions.init', LOW_PRIORITY$n, function(event) {
23700
23768
 
23701
23769
  var editorActions = event.editorActions;
23702
23770
 
@@ -28135,11 +28203,11 @@
28135
28203
 
28136
28204
  var n$1,l$1,u$1,t$2,o$1,f$1={},e$2=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$1(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n$1.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function p$1(n){return n.children}function d$1(n,l){this.props=n,this.context=l;}function _$1(n,l){if(null==l)return n.__?_$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$1(n):null}function k$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t$2.push(n)&&!g$1.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||setTimeout)(g$1);}function g$1(){for(var n;g$1.__r=t$2.length;)n=t$2.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$2=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$1({},t)).__v=t.__v+1,j$1(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$1(t):o,t.__h),z$1(u,t),t.__e!=o&&k$1(t)));});}function w$1(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$2,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p$1,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$1(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$2(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$1(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h]);}function m$2(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$2(i,l,u):A(u,i,i,t,i.__e,l));return l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$1:I,o):n.removeEventListener(l,o?T$1:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T$1(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$1(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$1(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$1({},h.__s)),s$1(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$1.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s$1(s$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$1&&null==a.key?a.props.children:a,w$1(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n$1.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$1(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$1(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__=n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$1(i,u=(!o&&t||i).__k=h$1(p$1,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n$1.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$1(e,u);}n$1=e$2.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,d$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$1({},this.state),"function"==typeof n&&(n=n(s$1({},u),this.props)),n&&s$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$1(this));},d$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d$1.prototype.render=p$1,t$2=[],g$1.__r=0;
28137
28205
 
28138
- var t$1,r$1,u,i,o=0,f=[],c=[],e$1=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m$1=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r$1,t,o||u),o=0;var i=r$1.__H||(r$1.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y(B,n)}function y(n,u,i){var o=d(t$1++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$1,!r$1.u)){r$1.u=!0;var f=r$1.shouldComponentUpdate;r$1.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h(u,i){var o=d(t$1++,3);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r$1.__H.__h.push(o));}function s(u,i){var o=d(t$1++,4);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r$1.__h.push(o));}function _(n){return o=5,F(function(){return {current:n}},[])}function F(n,r){var u=d(t$1++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r$1=null,e$1&&e$1(n);},l$1.__r=function(n){a&&a(n),t$1=0;var i=(r$1=n.__c).__H;i&&(u===r$1?(i.__h=[],r$1.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r$1;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r$1=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m$1&&m$1(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r$1,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$1=t;}function w(n){var t=r$1;n.__c=n.__(),r$1=t;}function z(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return "function"==typeof t?t(n):t}
28206
+ var n=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a);}return e},t$1=new Map;function e$1(s){var r=t$1.get(this);return r||(r=new Map,t$1.set(this,r)),(r=n(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e="";},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0]);}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
28139
28207
 
28140
- var n=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a);}return e},t=new Map;function e(s){var r=t.get(this);return r||(r=new Map,t.set(this,r)),(r=n(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e="";},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0]);}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
28208
+ var m$1=e$1.bind(h$1);
28141
28209
 
28142
- var m=e.bind(h$1);
28210
+ var t,r$1,u,i,o=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r$1,t,o||u),o=0;var i=r$1.__H||(r$1.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y(B,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$1,!r$1.u)){r$1.u=!0;var f=r$1.shouldComponentUpdate;r$1.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h(u,i){var o=d(t++,3);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r$1.__H.__h.push(o));}function s(u,i){var o=d(t++,4);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r$1.__h.push(o));}function _(n){return o=5,F(function(){return {current:n}},[])}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r$1=null,e&&e(n);},l$1.__r=function(n){a&&a(n),t=0;var i=(r$1=n.__c).__H;i&&(u===r$1?(i.__h=[],r$1.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r$1;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r$1=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r$1,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$1=t;}function w(n){var t=r$1;n.__c=n.__(),r$1=t;}function z(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return "function"==typeof t?t(n):t}
28143
28211
 
28144
28212
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
28145
28213
 
@@ -28151,7 +28219,7 @@
28151
28219
  * @param {boolean} selected
28152
28220
  * @param {function} onMouseEnter
28153
28221
  * @param {function} onMouseLeave
28154
- * @param {function} onClick
28222
+ * @param {function} onAction
28155
28223
  */
28156
28224
  function PopupMenuItem(props) {
28157
28225
  const {
@@ -28159,33 +28227,35 @@
28159
28227
  selected,
28160
28228
  onMouseEnter,
28161
28229
  onMouseLeave,
28162
- onClick
28230
+ onAction
28163
28231
  } = props;
28164
28232
 
28165
- return m`
28233
+ return m$1`
28166
28234
  <li
28167
28235
  class=${ clsx('entry', { selected }) }
28168
28236
  data-id=${ entry.id }
28169
28237
  title=${ entry.title || entry.label }
28170
- onClick=${ onClick }
28238
+ onClick=${ onAction }
28171
28239
  onMouseEnter=${ onMouseEnter }
28172
28240
  onMouseLeave=${ onMouseLeave }
28241
+ onDragStart=${ (event) => onAction(event, entry, 'dragstart') }
28242
+ draggable=${ true }
28173
28243
  >
28174
28244
  <div class="djs-popup-entry-content">
28175
28245
  <span
28176
28246
  class=${ clsx('djs-popup-entry-name', entry.className) }
28177
28247
  >
28178
- ${ entry.imageUrl ? m`
28179
- <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28248
+ ${ entry.imageUrl ? m$1`
28249
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />
28180
28250
  ` : null }
28181
28251
 
28182
- ${ entry.label ? m`
28252
+ ${ entry.label ? m$1`
28183
28253
  <span class="djs-popup-label">
28184
28254
  ${ entry.label }
28185
28255
  </span>
28186
28256
  ` : null }
28187
28257
  </span>
28188
- ${ entry.description && m`
28258
+ ${ entry.description && m$1`
28189
28259
  <span
28190
28260
  class="djs-popup-entry-description"
28191
28261
  title=${ entry.description }
@@ -28194,7 +28264,7 @@
28194
28264
  </span>
28195
28265
  ` }
28196
28266
  </div>
28197
- ${ entry.documentationRef && m`
28267
+ ${ entry.documentationRef && m$1`
28198
28268
  <div class="djs-popup-entry-docs">
28199
28269
  <a
28200
28270
  href="${ entry.documentationRef }"
@@ -28219,7 +28289,7 @@
28219
28289
  * @param {Array} entries
28220
28290
  * @param {Object} selectedEntry
28221
28291
  * @param {function} setSelectedEntry
28222
- * @param {function} onClick
28292
+ * @param {function} onAction
28223
28293
  * @param {Object} resultsRef
28224
28294
  */
28225
28295
 
@@ -28227,8 +28297,8 @@
28227
28297
  const {
28228
28298
  selectedEntry,
28229
28299
  setSelectedEntry,
28230
- onClick,
28231
- entries
28300
+ entries,
28301
+ ...restProps
28232
28302
  } = props;
28233
28303
 
28234
28304
  const resultsRef = _();
@@ -28249,23 +28319,23 @@
28249
28319
  }
28250
28320
  }, [ selectedEntry ]);
28251
28321
 
28252
- return m`
28322
+ return m$1`
28253
28323
  <div class="djs-popup-results" ref=${ resultsRef }>
28254
- ${ groups.map(group => m`
28255
- ${ group.name && m`
28324
+ ${ groups.map(group => m$1`
28325
+ ${ group.name && m$1`
28256
28326
  <div key=${ group.id } class="entry-header" title=${ group.name }>
28257
28327
  ${ group.name }
28258
28328
  </div>
28259
28329
  ` }
28260
28330
  <ul class="djs-popup-group" data-group=${ group.id }>
28261
- ${ group.entries.map(entry => m`
28331
+ ${ group.entries.map(entry => m$1`
28262
28332
  <${PopupMenuItem}
28263
28333
  key=${ entry.id }
28264
28334
  entry=${ entry }
28265
28335
  selected=${ entry === selectedEntry }
28266
28336
  onMouseEnter=${ () => setSelectedEntry(entry) }
28267
28337
  onMouseLeave=${ () => setSelectedEntry(null) }
28268
- onClick=${ onClick }
28338
+ ...${ restProps }
28269
28339
  />
28270
28340
  `) }
28271
28341
  </ul>
@@ -28390,7 +28460,8 @@
28390
28460
 
28391
28461
  const search = [
28392
28462
  entry.description || '',
28393
- entry.label || ''
28463
+ entry.label || '',
28464
+ entry.search || ''
28394
28465
  ]
28395
28466
  .join('---')
28396
28467
  .toLowerCase();
@@ -28477,7 +28548,7 @@
28477
28548
 
28478
28549
  const displayHeader = F(() => title || headerEntries.length > 0, [ title, headerEntries ]);
28479
28550
 
28480
- return m`
28551
+ return m$1`
28481
28552
  <${PopupMenuWrapper}
28482
28553
  onClose=${ onClose }
28483
28554
  onKeyup=${ handleKey }
@@ -28487,10 +28558,10 @@
28487
28558
  width=${ width }
28488
28559
  scale=${ scale }
28489
28560
  >
28490
- ${ displayHeader && m`
28561
+ ${ displayHeader && m$1`
28491
28562
  <div class="djs-popup-header">
28492
28563
  <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
28493
- ${ headerEntries.map(entry => m`
28564
+ ${ headerEntries.map(entry => m$1`
28494
28565
  <span
28495
28566
  class=${ getHeaderClasses(entry, entry === selectedEntry) }
28496
28567
  onClick=${ event => onSelect(event, entry) }
@@ -28499,21 +28570,21 @@
28499
28570
  onMouseEnter=${ () => setSelectedEntry(entry) }
28500
28571
  onMouseLeave=${ () => setSelectedEntry(null) }
28501
28572
  >
28502
- ${ entry.imageUrl ? m`
28503
- <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28573
+ ${ entry.imageUrl ? m$1`
28574
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />
28504
28575
  ` : null }
28505
28576
 
28506
- ${ entry.label ? m`
28577
+ ${ entry.label ? m$1`
28507
28578
  <span class="djs-popup-label">${ entry.label }</span>
28508
28579
  ` : null }
28509
28580
  </span>
28510
28581
  `) }
28511
28582
  </div>
28512
28583
  ` }
28513
- ${ originalEntries.length > 0 && m`
28584
+ ${ originalEntries.length > 0 && m$1`
28514
28585
  <div class="djs-popup-body">
28515
28586
 
28516
- ${ searchable && m`
28587
+ ${ searchable && m$1`
28517
28588
  <div class="djs-popup-search">
28518
28589
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
28519
28590
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -28529,10 +28600,10 @@
28529
28600
  entries=${ entries }
28530
28601
  selectedEntry=${ selectedEntry }
28531
28602
  setSelectedEntry=${ setSelectedEntry }
28532
- onClick=${ onSelect }
28603
+ onAction=${ onSelect }
28533
28604
  />
28534
28605
  </div>
28535
- ${ entries.length === 0 && m`
28606
+ ${ entries.length === 0 && m$1`
28536
28607
  <div class="djs-popup-no-results">No matching entries found.</div>
28537
28608
  ` }
28538
28609
  ` }
@@ -28585,7 +28656,7 @@
28585
28656
  popupRef.current && popupRef.current.focus();
28586
28657
  }, []);
28587
28658
 
28588
- return m`
28659
+ return m$1`
28589
28660
  <div
28590
28661
  class="djs-popup-backdrop"
28591
28662
  onClick=${ checkClose }
@@ -28694,17 +28765,13 @@
28694
28765
  options
28695
28766
  } = this._current;
28696
28767
 
28697
- const entriesArray = [
28698
- ...Object.entries(entries).map(
28699
- ([ key, value ]) => ({ id: key, ...value })
28700
- )
28701
- ];
28768
+ const entriesArray = Object.entries(entries).map(
28769
+ ([ key, value ]) => ({ id: key, ...value })
28770
+ );
28702
28771
 
28703
- const headerEntriesArray = [
28704
- ...Object.entries(headerEntries).map(
28705
- ([ key, value ]) => ({ id: key, ...value })
28706
- )
28707
- ];
28772
+ const headerEntriesArray = Object.entries(headerEntries).map(
28773
+ ([ key, value ]) => ({ id: key, ...value })
28774
+ );
28708
28775
 
28709
28776
  const position = _position && (
28710
28777
  (container) => this._ensureVisible(container, _position)
@@ -28713,10 +28780,10 @@
28713
28780
  const scale = this._updateScale(this._current.container);
28714
28781
 
28715
28782
  const onClose = result => this.close(result);
28716
- const onSelect = (event, entry) => this.trigger(event, entry);
28783
+ const onSelect = (event, entry, action) => this.trigger(event, entry, action);
28717
28784
 
28718
28785
  P(
28719
- m`
28786
+ m$1`
28720
28787
  <${PopupMenuComponent}
28721
28788
  onClose=${ onClose }
28722
28789
  onSelect=${ onSelect }
@@ -28840,13 +28907,10 @@
28840
28907
 
28841
28908
  PopupMenu.prototype._createContainer = function(config) {
28842
28909
 
28843
- let parent = config && config.parent || 'body';
28844
-
28845
- if (typeof parent === 'string') {
28846
- parent = document.querySelector(parent);
28847
- }
28910
+ var canvas = this._canvas,
28911
+ parent = canvas.getContainer();
28848
28912
 
28849
- const container = domify$1(`<div class="djs-popup-parent djs-parent" data-popup=${config.provider}></div>`);
28913
+ const container = domify$1(`<div class="djs-popup-parent djs-scrollable" data-popup=${config.provider}></div>`);
28850
28914
 
28851
28915
  parent.appendChild(container);
28852
28916
 
@@ -29113,10 +29177,11 @@
29113
29177
  *
29114
29178
  * @param {Object} event
29115
29179
  * @param {Object} entry
29180
+ * @param {string} [action='click'] the action to trigger
29116
29181
  *
29117
29182
  * @return the result of the action callback, if any
29118
29183
  */
29119
- PopupMenu.prototype.trigger = function(event, entry) {
29184
+ PopupMenu.prototype.trigger = function(event, entry, action = 'click') {
29120
29185
 
29121
29186
  // silence other actions
29122
29187
  event.preventDefault();
@@ -29128,8 +29193,16 @@
29128
29193
  entry = this._getEntry(entryId);
29129
29194
  }
29130
29195
 
29131
- if (entry.action) {
29132
- return entry.action.call(null, event, entry);
29196
+ const handler = entry.action;
29197
+
29198
+ if (isFunction(handler)) {
29199
+ if (action === 'click') {
29200
+ return handler(event, entry);
29201
+ }
29202
+ } else {
29203
+ if (handler[action]) {
29204
+ return handler[action](event, entry);
29205
+ }
29133
29206
  }
29134
29207
  };
29135
29208
 
@@ -29173,14 +29246,14 @@
29173
29246
 
29174
29247
  var ICONS$1 = icons$1;
29175
29248
 
29176
- var LOW_PRIORITY$l = 900;
29249
+ var LOW_PRIORITY$m = 900;
29177
29250
 
29178
29251
  /**
29179
29252
  * A provider for align elements context pad button
29180
29253
  */
29181
29254
  function AlignElementsContextPadProvider(contextPad, popupMenu, translate, canvas) {
29182
29255
 
29183
- contextPad.registerProvider(LOW_PRIORITY$l, this);
29256
+ contextPad.registerProvider(LOW_PRIORITY$m, this);
29184
29257
 
29185
29258
  this._contextPad = contextPad;
29186
29259
  this._popupMenu = popupMenu;
@@ -29734,7 +29807,7 @@
29734
29807
  return true;
29735
29808
  }
29736
29809
 
29737
- var LOW_PRIORITY$k = 100;
29810
+ var LOW_PRIORITY$l = 100;
29738
29811
 
29739
29812
 
29740
29813
  /**
@@ -29746,7 +29819,7 @@
29746
29819
  */
29747
29820
  function AutoPlace$1(eventBus, modeling, canvas) {
29748
29821
 
29749
- eventBus.on('autoPlace', LOW_PRIORITY$k, function(context) {
29822
+ eventBus.on('autoPlace', LOW_PRIORITY$l, function(context) {
29750
29823
  var shape = context.shape,
29751
29824
  source = context.source;
29752
29825
 
@@ -29964,7 +30037,7 @@
29964
30037
  y: sourceTrbl.top - 50 - element.height / 2
29965
30038
  };
29966
30039
 
29967
- if (isConnection$e(source)) {
30040
+ if (isConnection$f(source)) {
29968
30041
  position = getMid(source);
29969
30042
  position.x += 100;
29970
30043
  position.y -= 50;
@@ -30003,7 +30076,7 @@
30003
30076
  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
30004
30077
  }
30005
30078
 
30006
- function isConnection$e(element) {
30079
+ function isConnection$f(element) {
30007
30080
  return !!element.waypoints;
30008
30081
  }
30009
30082
 
@@ -31429,7 +31502,7 @@
31429
31502
  * Returns the length of a vector
31430
31503
  *
31431
31504
  * @param {Vector}
31432
- * @return {Float}
31505
+ * @return {number}
31433
31506
  */
31434
31507
  function vectorLength(v) {
31435
31508
  return Math.sqrt(Math.pow(v.x, 2) + Math.pow(v.y, 2));
@@ -31440,7 +31513,7 @@
31440
31513
  * Calculates the angle between a line a the yAxis
31441
31514
  *
31442
31515
  * @param {Array}
31443
- * @return {Float}
31516
+ * @return {number}
31444
31517
  */
31445
31518
  function getAngle(line) {
31446
31519
 
@@ -31454,7 +31527,7 @@
31454
31527
  * Rotates a vector by a given angle
31455
31528
  *
31456
31529
  * @param {Vector}
31457
- * @param {Float} Angle in radians
31530
+ * @param {number} Angle in radians
31458
31531
  * @return {Vector}
31459
31532
  */
31460
31533
  function rotateVector(vector, angle) {
@@ -31472,7 +31545,7 @@
31472
31545
  * @param {Vector}
31473
31546
  * @param {Vector}
31474
31547
  * @param {Vector}
31475
- * @return {Float}
31548
+ * @return {number}
31476
31549
  */
31477
31550
  function solveLambaSystem(a, b, c) {
31478
31551
 
@@ -31494,7 +31567,7 @@
31494
31567
  * Position of perpendicular foot
31495
31568
  *
31496
31569
  * @param {Point}
31497
- * @param [ {Point}, {Point} ] line defined through two points
31570
+ * @param {[ Point, Point ]} line defined through two points
31498
31571
  * @return {Point} the perpendicular foot position
31499
31572
  */
31500
31573
  function perpendicularFoot(point, line) {
@@ -31514,9 +31587,10 @@
31514
31587
  /**
31515
31588
  * Calculates the distance between a point and a line
31516
31589
  *
31517
- * @param {Point}
31518
- * @param [ {Point}, {Point} ] line defined through two points
31519
- * @return {Float} distance
31590
+ * @param { Point }
31591
+ * @param { [ Point, Point ] } line defined through two points
31592
+ *
31593
+ * @return { number } distance
31520
31594
  */
31521
31595
  function getDistancePointLine(point, line) {
31522
31596
 
@@ -31537,7 +31611,8 @@
31537
31611
  *
31538
31612
  * @param {Point}
31539
31613
  * @param {Point}
31540
- * @return {Float} distance
31614
+ *
31615
+ * @return {number} distance
31541
31616
  */
31542
31617
  function getDistancePointPoint(point1, point2) {
31543
31618
 
@@ -33243,7 +33318,7 @@
33243
33318
  hoverMid = hover && getSnapPoint(hover, event);
33244
33319
 
33245
33320
  // only snap on connections, elements can have multiple connect endpoints
33246
- if (!isConnection$d(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33321
+ if (!isConnection$e(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33247
33322
  return;
33248
33323
  }
33249
33324
 
@@ -33298,7 +33373,7 @@
33298
33373
 
33299
33374
  // helpers //////////////////////
33300
33375
 
33301
- function isConnection$d(element) {
33376
+ function isConnection$e(element) {
33302
33377
  return element && !!element.waypoints;
33303
33378
  }
33304
33379
 
@@ -33456,7 +33531,7 @@
33456
33531
  }
33457
33532
 
33458
33533
  var HIGH_PRIORITY$h = 1100,
33459
- LOW_PRIORITY$j = 900;
33534
+ LOW_PRIORITY$k = 900;
33460
33535
 
33461
33536
  var MARKER_OK$3 = 'connect-ok',
33462
33537
  MARKER_NOT_OK$3 = 'connect-not-ok';
@@ -33500,7 +33575,7 @@
33500
33575
  });
33501
33576
  });
33502
33577
 
33503
- eventBus.on('connect.hover', LOW_PRIORITY$j, function(event) {
33578
+ eventBus.on('connect.hover', LOW_PRIORITY$k, function(event) {
33504
33579
  var context = event.context,
33505
33580
  hover = event.hover,
33506
33581
  canExecute = context.canExecute;
@@ -33767,18 +33842,12 @@
33767
33842
  * @returns {SVGElement}
33768
33843
  */
33769
33844
  ConnectionPreview.prototype.createNoopConnection = function(start, end) {
33770
- var connection = create$1('polyline');
33771
-
33772
- attr(connection, {
33845
+ return createLine([ start, end ], {
33773
33846
  'stroke': '#333',
33774
33847
  'strokeDasharray': [ 1 ],
33775
33848
  'strokeWidth': 2,
33776
33849
  'pointer-events': 'none'
33777
33850
  });
33778
-
33779
- attr(connection, { 'points': [ start.x, start.y, end.x, end.y ] });
33780
-
33781
- return connection;
33782
33851
  };
33783
33852
 
33784
33853
  // helpers //////////
@@ -34485,6 +34554,7 @@
34485
34554
  'path',
34486
34555
  'polygon',
34487
34556
  'polyline',
34557
+ 'path',
34488
34558
  'rect'
34489
34559
  ];
34490
34560
 
@@ -34759,7 +34829,7 @@
34759
34829
  });
34760
34830
 
34761
34831
  var shape = find(elements, function(element) {
34762
- return !isConnection$c(element);
34832
+ return !isConnection$d(element);
34763
34833
  });
34764
34834
 
34765
34835
  var attach = false,
@@ -34914,7 +34984,7 @@
34914
34984
 
34915
34985
  // update shape
34916
34986
  shape = find(elements, function(element) {
34917
- return !isConnection$c(element);
34987
+ return !isConnection$d(element);
34918
34988
  });
34919
34989
  }
34920
34990
 
@@ -34955,7 +35025,7 @@
34955
35025
  }
34956
35026
 
34957
35027
  var shape = find(elements, function(element) {
34958
- return !isConnection$c(element);
35028
+ return !isConnection$d(element);
34959
35029
  });
34960
35030
 
34961
35031
  if (!shape) {
@@ -34989,7 +35059,7 @@
34989
35059
 
34990
35060
  // center elements around cursor
34991
35061
  forEach$1(elements, function(element) {
34992
- if (isConnection$c(element)) {
35062
+ if (isConnection$d(element)) {
34993
35063
  element.waypoints = map$1(element.waypoints, function(waypoint) {
34994
35064
  return {
34995
35065
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35051,19 +35121,19 @@
35051
35121
  }
35052
35122
  }
35053
35123
 
35054
- function isConnection$c(element) {
35124
+ function isConnection$d(element) {
35055
35125
  return !!element.waypoints;
35056
35126
  }
35057
35127
 
35058
35128
  function isSingleShape(elements) {
35059
- return elements && elements.length === 1 && !isConnection$c(elements[0]);
35129
+ return elements && elements.length === 1 && !isConnection$d(elements[0]);
35060
35130
  }
35061
35131
 
35062
35132
  function isLabel$5(element) {
35063
35133
  return !!element.labelTarget;
35064
35134
  }
35065
35135
 
35066
- var LOW_PRIORITY$i = 750;
35136
+ var LOW_PRIORITY$j = 750;
35067
35137
 
35068
35138
 
35069
35139
  function CreatePreview(
@@ -35108,7 +35178,7 @@
35108
35178
  return dragGroup;
35109
35179
  }
35110
35180
 
35111
- eventBus.on('create.move', LOW_PRIORITY$i, function(event) {
35181
+ eventBus.on('create.move', LOW_PRIORITY$j, function(event) {
35112
35182
 
35113
35183
  var hover = event.hover,
35114
35184
  context = event.context,
@@ -35373,7 +35443,7 @@
35373
35443
  }
35374
35444
 
35375
35445
  // connections (priority = 3)
35376
- if (isConnection$b(element)) {
35446
+ if (isConnection$c(element)) {
35377
35447
  descriptor.priority = 3;
35378
35448
 
35379
35449
  descriptor.source = element.source.id;
@@ -35516,7 +35586,7 @@
35516
35586
 
35517
35587
  // center elements around cursor
35518
35588
  forEach$1(elements, function(element) {
35519
- if (isConnection$b(element)) {
35589
+ if (isConnection$c(element)) {
35520
35590
  element.waypoints = map$1(element.waypoints, function(waypoint) {
35521
35591
  return {
35522
35592
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35569,7 +35639,7 @@
35569
35639
 
35570
35640
  var element;
35571
35641
 
35572
- if (isConnection$b(attrs)) {
35642
+ if (isConnection$c(attrs)) {
35573
35643
  attrs.source = cache[ descriptor.source ];
35574
35644
  attrs.target = cache[ descriptor.target ];
35575
35645
 
@@ -35635,7 +35705,7 @@
35635
35705
  source,
35636
35706
  target;
35637
35707
 
35638
- if (isConnection$b(element)) {
35708
+ if (isConnection$c(element)) {
35639
35709
  source = find(elements, matchPattern({ id: element.source.id }));
35640
35710
  target = find(elements, matchPattern({ id: element.target.id }));
35641
35711
 
@@ -35832,7 +35902,7 @@
35832
35902
  return !!element.host;
35833
35903
  }
35834
35904
 
35835
- function isConnection$b(element) {
35905
+ function isConnection$c(element) {
35836
35906
  return !!element.waypoints;
35837
35907
  }
35838
35908
 
@@ -35890,7 +35960,7 @@
35890
35960
  });
35891
35961
  }
35892
35962
 
35893
- var LOW_PRIORITY$h = 750;
35963
+ var LOW_PRIORITY$i = 750;
35894
35964
 
35895
35965
 
35896
35966
  function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
@@ -35901,7 +35971,7 @@
35901
35971
  return moddleCopy.copyElement(bo, targetBo, null, clone);
35902
35972
  }
35903
35973
 
35904
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$h, function(context) {
35974
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$i, function(context) {
35905
35975
  var descriptor = context.descriptor,
35906
35976
  element = context.element,
35907
35977
  businessObject = getBusinessObject(element);
@@ -35998,7 +36068,7 @@
35998
36068
 
35999
36069
  // copy + paste processRef with participant
36000
36070
 
36001
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$h, function(context) {
36071
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$i, function(context) {
36002
36072
  var descriptor = context.descriptor,
36003
36073
  element = context.element;
36004
36074
 
@@ -36024,7 +36094,7 @@
36024
36094
 
36025
36095
  // resolve references
36026
36096
 
36027
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$h, function(context) {
36097
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$i, function(context) {
36028
36098
  var cache = context.cache,
36029
36099
  descriptor = context.descriptor;
36030
36100
 
@@ -36535,7 +36605,7 @@
36535
36605
 
36536
36606
  // copying event definitions, unless we replace
36537
36607
  if (propertyName === 'eventDefinitions') {
36538
- return hasEventDefinition$1(element, target.eventDefinitionType);
36608
+ return hasEventDefinition$2(element, target.eventDefinitionType);
36539
36609
  }
36540
36610
 
36541
36611
  // retain loop characteristics if the target element
@@ -36572,7 +36642,7 @@
36572
36642
  // only initialize with new eventDefinition
36573
36643
  // if we did not set an event definition yet,
36574
36644
  // i.e. because we copied it
36575
- if (!hasEventDefinition$1(newBusinessObject, target.eventDefinitionType)) {
36645
+ if (!hasEventDefinition$2(newBusinessObject, target.eventDefinitionType)) {
36576
36646
  newElement.eventDefinitionType = target.eventDefinitionType;
36577
36647
  newElement.eventDefinitionAttrs = target.eventDefinitionAttrs;
36578
36648
  }
@@ -36702,7 +36772,7 @@
36702
36772
  return is$1(bo, 'bpmn:SubProcess');
36703
36773
  }
36704
36774
 
36705
- function hasEventDefinition$1(element, type) {
36775
+ function hasEventDefinition$2(element, type) {
36706
36776
 
36707
36777
  var bo = getBusinessObject(element);
36708
36778
 
@@ -37070,7 +37140,7 @@
37070
37140
  }
37071
37141
  ];
37072
37142
 
37073
- var GATEWAY = [
37143
+ var GATEWAY$1 = [
37074
37144
  {
37075
37145
  label: 'Exclusive Gateway',
37076
37146
  actionName: 'replace-with-exclusive-gateway',
@@ -37203,7 +37273,7 @@
37203
37273
 
37204
37274
  var EVENT_SUB_PROCESS = TRANSACTION;
37205
37275
 
37206
- var TASK = [
37276
+ var TASK$1 = [
37207
37277
  {
37208
37278
  label: 'Task',
37209
37279
  actionName: 'replace-with-task',
@@ -37577,7 +37647,7 @@
37577
37647
  }
37578
37648
  ];
37579
37649
 
37580
- var PARTICIPANT = [
37650
+ var PARTICIPANT$1 = [
37581
37651
  {
37582
37652
  label: 'Expanded Pool',
37583
37653
  actionName: 'replace-with-expanded-pool',
@@ -37686,7 +37756,7 @@
37686
37756
  // expanded/collapsed pools
37687
37757
  if (is$1(businessObject, 'bpmn:Participant')) {
37688
37758
 
37689
- entries = filter(PARTICIPANT, function(entry) {
37759
+ entries = filter(PARTICIPANT$1, function(entry) {
37690
37760
  return isExpanded(element) !== entry.target.isExpanded;
37691
37761
  });
37692
37762
 
@@ -37769,7 +37839,7 @@
37769
37839
  // gateways
37770
37840
  if (is$1(businessObject, 'bpmn:Gateway')) {
37771
37841
 
37772
- entries = filter(GATEWAY, differentType);
37842
+ entries = filter(GATEWAY$1, differentType);
37773
37843
 
37774
37844
  return this._createEntries(element, entries);
37775
37845
  }
@@ -37801,7 +37871,7 @@
37801
37871
  // collapsed ad hoc sub processes
37802
37872
  if (is$1(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
37803
37873
 
37804
- entries = filter(TASK, function(entry) {
37874
+ entries = filter(TASK$1, function(entry) {
37805
37875
 
37806
37876
  var target = entry.target;
37807
37877
 
@@ -37822,7 +37892,7 @@
37822
37892
 
37823
37893
  // flow nodes
37824
37894
  if (is$1(businessObject, 'bpmn:FlowNode')) {
37825
- entries = filter(TASK, differentType);
37895
+ entries = filter(TASK$1, differentType);
37826
37896
 
37827
37897
  // collapsed SubProcess can not be replaced with itself
37828
37898
  if (is$1(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
@@ -38092,6 +38162,12 @@
38092
38162
  var self = this;
38093
38163
  var translate = this._translate;
38094
38164
 
38165
+ var dataObject = element.businessObject.dataObjectRef;
38166
+
38167
+ if (!dataObject) {
38168
+ return [];
38169
+ }
38170
+
38095
38171
  function toggleIsCollection(event, entry) {
38096
38172
  self._modeling.updateModdleProperties(
38097
38173
  element,
@@ -38099,8 +38175,7 @@
38099
38175
  { isCollection: !entry.active });
38100
38176
  }
38101
38177
 
38102
- var dataObject = element.businessObject.dataObjectRef,
38103
- isCollection = dataObject.isCollection;
38178
+ var isCollection = dataObject.isCollection;
38104
38179
 
38105
38180
  var dataObjectEntries = [
38106
38181
  {
@@ -38196,9 +38271,12 @@
38196
38271
  var PopupMenuModule = {
38197
38272
  __depends__: [
38198
38273
  PopupMenuModule$1,
38199
- ReplaceModule
38274
+ ReplaceModule,
38275
+ AutoPlaceModule
38276
+ ],
38277
+ __init__: [
38278
+ 'replaceMenuProvider'
38200
38279
  ],
38201
- __init__: [ 'replaceMenuProvider' ],
38202
38280
  replaceMenuProvider: [ 'type', ReplaceMenuProvider ]
38203
38281
  };
38204
38282
 
@@ -38641,433 +38719,2175 @@
38641
38719
  });
38642
38720
  }
38643
38721
 
38644
- return actions;
38722
+ return actions;
38723
+ };
38724
+
38725
+ /**
38726
+ * @param {djs.model.Base[]} elements
38727
+ * @return {boolean}
38728
+ */
38729
+ ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
38730
+
38731
+ var baseAllowed = this._rules.allowed('elements.delete', {
38732
+ elements: elements
38733
+ });
38734
+
38735
+ if (isArray$3(baseAllowed)) {
38736
+ return every(baseAllowed, function(element) {
38737
+ return includes$7(baseAllowed, element);
38738
+ });
38739
+ }
38740
+
38741
+ return baseAllowed;
38742
+ };
38743
+
38744
+ ContextPadProvider.prototype.getContextPadEntries = function(element) {
38745
+ var contextPad = this._contextPad,
38746
+ modeling = this._modeling,
38747
+
38748
+ elementFactory = this._elementFactory,
38749
+ connect = this._connect,
38750
+ create = this._create,
38751
+ popupMenu = this._popupMenu,
38752
+ rules = this._rules,
38753
+ autoPlace = this._autoPlace,
38754
+ translate = this._translate;
38755
+
38756
+ var actions = {};
38757
+
38758
+ if (element.type === 'label') {
38759
+ return actions;
38760
+ }
38761
+
38762
+ var businessObject = element.businessObject;
38763
+
38764
+ function startConnect(event, element) {
38765
+ connect.start(event, element);
38766
+ }
38767
+
38768
+ function removeElement(e, element) {
38769
+ modeling.removeElements([ element ]);
38770
+ }
38771
+
38772
+ function getReplaceMenuPosition(element) {
38773
+
38774
+ var Y_OFFSET = 5;
38775
+
38776
+ var pad = contextPad.getPad(element).html;
38777
+
38778
+ var padRect = pad.getBoundingClientRect();
38779
+
38780
+ var pos = {
38781
+ x: padRect.left,
38782
+ y: padRect.bottom + Y_OFFSET
38783
+ };
38784
+
38785
+ return pos;
38786
+ }
38787
+
38788
+ /**
38789
+ * Create an append action
38790
+ *
38791
+ * @param {string} type
38792
+ * @param {string} className
38793
+ * @param {string} [title]
38794
+ * @param {Object} [options]
38795
+ *
38796
+ * @return {Object} descriptor
38797
+ */
38798
+ function appendAction(type, className, title, options) {
38799
+
38800
+ if (typeof title !== 'string') {
38801
+ options = title;
38802
+ title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
38803
+ }
38804
+
38805
+ function appendStart(event, element) {
38806
+
38807
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
38808
+ create.start(event, shape, {
38809
+ source: element
38810
+ });
38811
+ }
38812
+
38813
+
38814
+ var append = autoPlace ? function(event, element) {
38815
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
38816
+
38817
+ autoPlace.append(element, shape);
38818
+ } : appendStart;
38819
+
38820
+
38821
+ return {
38822
+ group: 'model',
38823
+ className: className,
38824
+ title: title,
38825
+ action: {
38826
+ dragstart: appendStart,
38827
+ click: append
38828
+ }
38829
+ };
38830
+ }
38831
+
38832
+ function splitLaneHandler(count) {
38833
+
38834
+ return function(event, element) {
38835
+
38836
+ // actual split
38837
+ modeling.splitLane(element, count);
38838
+
38839
+ // refresh context pad after split to
38840
+ // get rid of split icons
38841
+ contextPad.open(element, true);
38842
+ };
38843
+ }
38844
+
38845
+
38846
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
38847
+
38848
+ var childLanes = getChildLanes(element);
38849
+
38850
+ assign$1(actions, {
38851
+ 'lane-insert-above': {
38852
+ group: 'lane-insert-above',
38853
+ className: 'bpmn-icon-lane-insert-above',
38854
+ title: translate('Add Lane above'),
38855
+ action: {
38856
+ click: function(event, element) {
38857
+ modeling.addLane(element, 'top');
38858
+ }
38859
+ }
38860
+ }
38861
+ });
38862
+
38863
+ if (childLanes.length < 2) {
38864
+
38865
+ if (element.height >= 120) {
38866
+ assign$1(actions, {
38867
+ 'lane-divide-two': {
38868
+ group: 'lane-divide',
38869
+ className: 'bpmn-icon-lane-divide-two',
38870
+ title: translate('Divide into two Lanes'),
38871
+ action: {
38872
+ click: splitLaneHandler(2)
38873
+ }
38874
+ }
38875
+ });
38876
+ }
38877
+
38878
+ if (element.height >= 180) {
38879
+ assign$1(actions, {
38880
+ 'lane-divide-three': {
38881
+ group: 'lane-divide',
38882
+ className: 'bpmn-icon-lane-divide-three',
38883
+ title: translate('Divide into three Lanes'),
38884
+ action: {
38885
+ click: splitLaneHandler(3)
38886
+ }
38887
+ }
38888
+ });
38889
+ }
38890
+ }
38891
+
38892
+ assign$1(actions, {
38893
+ 'lane-insert-below': {
38894
+ group: 'lane-insert-below',
38895
+ className: 'bpmn-icon-lane-insert-below',
38896
+ title: translate('Add Lane below'),
38897
+ action: {
38898
+ click: function(event, element) {
38899
+ modeling.addLane(element, 'bottom');
38900
+ }
38901
+ }
38902
+ }
38903
+ });
38904
+
38905
+ }
38906
+
38907
+ if (is$1(businessObject, 'bpmn:FlowNode')) {
38908
+
38909
+ if (is$1(businessObject, 'bpmn:EventBasedGateway')) {
38910
+
38911
+ assign$1(actions, {
38912
+ 'append.receive-task': appendAction(
38913
+ 'bpmn:ReceiveTask',
38914
+ 'bpmn-icon-receive-task',
38915
+ translate('Append ReceiveTask')
38916
+ ),
38917
+ 'append.message-intermediate-event': appendAction(
38918
+ 'bpmn:IntermediateCatchEvent',
38919
+ 'bpmn-icon-intermediate-event-catch-message',
38920
+ translate('Append MessageIntermediateCatchEvent'),
38921
+ { eventDefinitionType: 'bpmn:MessageEventDefinition' }
38922
+ ),
38923
+ 'append.timer-intermediate-event': appendAction(
38924
+ 'bpmn:IntermediateCatchEvent',
38925
+ 'bpmn-icon-intermediate-event-catch-timer',
38926
+ translate('Append TimerIntermediateCatchEvent'),
38927
+ { eventDefinitionType: 'bpmn:TimerEventDefinition' }
38928
+ ),
38929
+ 'append.condition-intermediate-event': appendAction(
38930
+ 'bpmn:IntermediateCatchEvent',
38931
+ 'bpmn-icon-intermediate-event-catch-condition',
38932
+ translate('Append ConditionIntermediateCatchEvent'),
38933
+ { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
38934
+ ),
38935
+ 'append.signal-intermediate-event': appendAction(
38936
+ 'bpmn:IntermediateCatchEvent',
38937
+ 'bpmn-icon-intermediate-event-catch-signal',
38938
+ translate('Append SignalIntermediateCatchEvent'),
38939
+ { eventDefinitionType: 'bpmn:SignalEventDefinition' }
38940
+ )
38941
+ });
38942
+ } else
38943
+
38944
+ if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
38945
+
38946
+ assign$1(actions, {
38947
+ 'append.compensation-activity':
38948
+ appendAction(
38949
+ 'bpmn:Task',
38950
+ 'bpmn-icon-task',
38951
+ translate('Append compensation activity'),
38952
+ {
38953
+ isForCompensation: true
38954
+ }
38955
+ )
38956
+ });
38957
+ } else
38958
+
38959
+ if (!is$1(businessObject, 'bpmn:EndEvent') &&
38960
+ !businessObject.isForCompensation &&
38961
+ !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
38962
+ !isEventSubProcess(businessObject)) {
38963
+
38964
+ assign$1(actions, {
38965
+ 'append.end-event': appendAction(
38966
+ 'bpmn:EndEvent',
38967
+ 'bpmn-icon-end-event-none',
38968
+ translate('Append EndEvent')
38969
+ ),
38970
+ 'append.gateway': appendAction(
38971
+ 'bpmn:ExclusiveGateway',
38972
+ 'bpmn-icon-gateway-none',
38973
+ translate('Append Gateway')
38974
+ ),
38975
+ 'append.append-task': appendAction(
38976
+ 'bpmn:Task',
38977
+ 'bpmn-icon-task',
38978
+ translate('Append Task')
38979
+ ),
38980
+ 'append.intermediate-event': appendAction(
38981
+ 'bpmn:IntermediateThrowEvent',
38982
+ 'bpmn-icon-intermediate-event-none',
38983
+ translate('Append Intermediate/Boundary Event')
38984
+ )
38985
+ });
38986
+ }
38987
+ }
38988
+
38989
+ if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
38990
+
38991
+ // Replace menu entry
38992
+ assign$1(actions, {
38993
+ 'replace': {
38994
+ group: 'edit',
38995
+ className: 'bpmn-icon-screw-wrench',
38996
+ title: translate('Change type'),
38997
+ action: {
38998
+ click: function(event, element) {
38999
+
39000
+ var position = assign$1(getReplaceMenuPosition(element), {
39001
+ cursor: { x: event.x, y: event.y }
39002
+ });
39003
+
39004
+ popupMenu.open(element, 'bpmn-replace', position, {
39005
+ title: translate('Change element'),
39006
+ width: 300,
39007
+ search: true
39008
+ });
39009
+ }
39010
+ }
39011
+ }
39012
+ });
39013
+ }
39014
+
39015
+ if (is$1(businessObject, 'bpmn:SequenceFlow')) {
39016
+ assign$1(actions, {
39017
+ 'append.text-annotation': appendAction(
39018
+ 'bpmn:TextAnnotation',
39019
+ 'bpmn-icon-text-annotation'
39020
+ )
39021
+ });
39022
+ }
39023
+
39024
+ if (
39025
+ isAny(businessObject, [
39026
+ 'bpmn:FlowNode',
39027
+ 'bpmn:InteractionNode',
39028
+ 'bpmn:DataObjectReference',
39029
+ 'bpmn:DataStoreReference',
39030
+ ])
39031
+ ) {
39032
+ assign$1(actions, {
39033
+ 'append.text-annotation': appendAction(
39034
+ 'bpmn:TextAnnotation',
39035
+ 'bpmn-icon-text-annotation'
39036
+ ),
39037
+
39038
+ 'connect': {
39039
+ group: 'connect',
39040
+ className: 'bpmn-icon-connection-multi',
39041
+ title: translate(
39042
+ 'Connect using ' +
39043
+ (businessObject.isForCompensation
39044
+ ? ''
39045
+ : 'Sequence/MessageFlow or ') +
39046
+ 'Association'
39047
+ ),
39048
+ action: {
39049
+ click: startConnect,
39050
+ dragstart: startConnect,
39051
+ },
39052
+ },
39053
+ });
39054
+ }
39055
+
39056
+ if (is$1(businessObject, 'bpmn:TextAnnotation')) {
39057
+ assign$1(actions, {
39058
+ 'connect': {
39059
+ group: 'connect',
39060
+ className: 'bpmn-icon-connection-multi',
39061
+ title: translate('Connect using Association'),
39062
+ action: {
39063
+ click: startConnect,
39064
+ dragstart: startConnect,
39065
+ },
39066
+ },
39067
+ });
39068
+ }
39069
+
39070
+ if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
39071
+ assign$1(actions, {
39072
+ 'connect': {
39073
+ group: 'connect',
39074
+ className: 'bpmn-icon-connection-multi',
39075
+ title: translate('Connect using DataInputAssociation'),
39076
+ action: {
39077
+ click: startConnect,
39078
+ dragstart: startConnect
39079
+ }
39080
+ }
39081
+ });
39082
+ }
39083
+
39084
+ if (is$1(businessObject, 'bpmn:Group')) {
39085
+ assign$1(actions, {
39086
+ 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39087
+ });
39088
+ }
39089
+
39090
+ // delete element entry, only show if allowed by rules
39091
+ var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
39092
+
39093
+ if (isArray$3(deleteAllowed)) {
39094
+
39095
+ // was the element returned as a deletion candidate?
39096
+ deleteAllowed = deleteAllowed[0] === element;
39097
+ }
39098
+
39099
+ if (deleteAllowed) {
39100
+ assign$1(actions, {
39101
+ 'delete': {
39102
+ group: 'edit',
39103
+ className: 'bpmn-icon-trash',
39104
+ title: translate('Remove'),
39105
+ action: {
39106
+ click: removeElement
39107
+ }
39108
+ }
39109
+ });
39110
+ }
39111
+
39112
+ return actions;
39113
+ };
39114
+
39115
+
39116
+ // helpers /////////
39117
+
39118
+ function isEventType(eventBo, type, definition) {
39119
+
39120
+ var isType = eventBo.$instanceOf(type);
39121
+ var isDefinition = false;
39122
+
39123
+ var definitions = eventBo.eventDefinitions || [];
39124
+ forEach$1(definitions, function(def) {
39125
+ if (def.$type === definition) {
39126
+ isDefinition = true;
39127
+ }
39128
+ });
39129
+
39130
+ return isType && isDefinition;
39131
+ }
39132
+
39133
+ function includes$7(array, item) {
39134
+ return array.indexOf(item) !== -1;
39135
+ }
39136
+
39137
+ var ContextPadModule = {
39138
+ __depends__: [
39139
+ DirectEditingModule,
39140
+ ContextPadModule$1,
39141
+ SelectionModule,
39142
+ ConnectModule,
39143
+ CreateModule,
39144
+ PopupMenuModule
39145
+ ],
39146
+ __init__: [ 'contextPadProvider' ],
39147
+ contextPadProvider: [ 'type', ContextPadProvider ]
39148
+ };
39149
+
39150
+ var TOGGLE_SELECTOR = '.djs-palette-toggle',
39151
+ ENTRY_SELECTOR = '.entry',
39152
+ ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
39153
+
39154
+ var PALETTE_PREFIX = 'djs-palette-',
39155
+ PALETTE_SHOWN_CLS = 'shown',
39156
+ PALETTE_OPEN_CLS = 'open',
39157
+ PALETTE_TWO_COLUMN_CLS = 'two-column';
39158
+
39159
+ var DEFAULT_PRIORITY = 1000;
39160
+
39161
+
39162
+ /**
39163
+ * A palette containing modeling elements.
39164
+ */
39165
+ function Palette(eventBus, canvas) {
39166
+
39167
+ this._eventBus = eventBus;
39168
+ this._canvas = canvas;
39169
+
39170
+ var self = this;
39171
+
39172
+ eventBus.on('tool-manager.update', function(event) {
39173
+ var tool = event.tool;
39174
+
39175
+ self.updateToolHighlight(tool);
39176
+ });
39177
+
39178
+ eventBus.on('i18n.changed', function() {
39179
+ self._update();
39180
+ });
39181
+
39182
+ eventBus.on('diagram.init', function() {
39183
+
39184
+ self._diagramInitialized = true;
39185
+
39186
+ self._rebuild();
39187
+ });
39188
+ }
39189
+
39190
+ Palette.$inject = [ 'eventBus', 'canvas' ];
39191
+
39192
+
39193
+ /**
39194
+ * Register a provider with the palette
39195
+ *
39196
+ * @param {number} [priority=1000]
39197
+ * @param {PaletteProvider} provider
39198
+ *
39199
+ * @example
39200
+ * const paletteProvider = {
39201
+ * getPaletteEntries: function() {
39202
+ * return function(entries) {
39203
+ * return {
39204
+ * ...entries,
39205
+ * 'entry-1': {
39206
+ * label: 'My Entry',
39207
+ * action: function() { alert("I have been clicked!"); }
39208
+ * }
39209
+ * };
39210
+ * }
39211
+ * }
39212
+ * };
39213
+ *
39214
+ * palette.registerProvider(800, paletteProvider);
39215
+ */
39216
+ Palette.prototype.registerProvider = function(priority, provider) {
39217
+ if (!provider) {
39218
+ provider = priority;
39219
+ priority = DEFAULT_PRIORITY;
39220
+ }
39221
+
39222
+ this._eventBus.on('palette.getProviders', priority, function(event) {
39223
+ event.providers.push(provider);
39224
+ });
39225
+
39226
+ this._rebuild();
39227
+ };
39228
+
39229
+
39230
+ /**
39231
+ * Returns the palette entries
39232
+ *
39233
+ * @return {Object<string, PaletteEntryDescriptor>} map of entries
39234
+ */
39235
+ Palette.prototype.getEntries = function() {
39236
+ var providers = this._getProviders();
39237
+
39238
+ return providers.reduce(addPaletteEntries, {});
39239
+ };
39240
+
39241
+ Palette.prototype._rebuild = function() {
39242
+
39243
+ if (!this._diagramInitialized) {
39244
+ return;
39245
+ }
39246
+
39247
+ var providers = this._getProviders();
39248
+
39249
+ if (!providers.length) {
39250
+ return;
39251
+ }
39252
+
39253
+ if (!this._container) {
39254
+ this._init();
39255
+ }
39256
+
39257
+ this._update();
39258
+ };
39259
+
39260
+ /**
39261
+ * Initialize
39262
+ */
39263
+ Palette.prototype._init = function() {
39264
+
39265
+ var self = this;
39266
+
39267
+ var eventBus = this._eventBus;
39268
+
39269
+ var parentContainer = this._getParentContainer();
39270
+
39271
+ var container = this._container = domify$1(Palette.HTML_MARKUP);
39272
+
39273
+ parentContainer.appendChild(container);
39274
+ classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
39275
+
39276
+ delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
39277
+
39278
+ var target = event.delegateTarget;
39279
+
39280
+ if (matches(target, TOGGLE_SELECTOR)) {
39281
+ return self.toggle();
39282
+ }
39283
+
39284
+ self.trigger('click', event);
39285
+ });
39286
+
39287
+ // prevent drag propagation
39288
+ event.bind(container, 'mousedown', function(event) {
39289
+ event.stopPropagation();
39290
+ });
39291
+
39292
+ // prevent drag propagation
39293
+ delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
39294
+ self.trigger('dragstart', event);
39295
+ });
39296
+
39297
+ eventBus.on('canvas.resized', this._layoutChanged, this);
39298
+
39299
+ eventBus.fire('palette.create', {
39300
+ container: container
39301
+ });
39302
+ };
39303
+
39304
+ Palette.prototype._getProviders = function(id) {
39305
+
39306
+ var event = this._eventBus.createEvent({
39307
+ type: 'palette.getProviders',
39308
+ providers: []
39309
+ });
39310
+
39311
+ this._eventBus.fire(event);
39312
+
39313
+ return event.providers;
39314
+ };
39315
+
39316
+ /**
39317
+ * Update palette state.
39318
+ *
39319
+ * @param {Object} [state] { open, twoColumn }
39320
+ */
39321
+ Palette.prototype._toggleState = function(state) {
39322
+
39323
+ state = state || {};
39324
+
39325
+ var parent = this._getParentContainer(),
39326
+ container = this._container;
39327
+
39328
+ var eventBus = this._eventBus;
39329
+
39330
+ var twoColumn;
39331
+
39332
+ var cls = classes$1(container),
39333
+ parentCls = classes$1(parent);
39334
+
39335
+ if ('twoColumn' in state) {
39336
+ twoColumn = state.twoColumn;
39337
+ } else {
39338
+ twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
39339
+ }
39340
+
39341
+ // always update two column
39342
+ cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
39343
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
39344
+
39345
+ if ('open' in state) {
39346
+ cls.toggle(PALETTE_OPEN_CLS, state.open);
39347
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
39348
+ }
39349
+
39350
+ eventBus.fire('palette.changed', {
39351
+ twoColumn: twoColumn,
39352
+ open: this.isOpen()
39353
+ });
39354
+ };
39355
+
39356
+ Palette.prototype._update = function() {
39357
+
39358
+ var entriesContainer = query('.djs-palette-entries', this._container),
39359
+ entries = this._entries = this.getEntries();
39360
+
39361
+ clear$1(entriesContainer);
39362
+
39363
+ forEach$1(entries, function(entry, id) {
39364
+
39365
+ var grouping = entry.group || 'default';
39366
+
39367
+ var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
39368
+ if (!container) {
39369
+ container = domify$1('<div class="group"></div>');
39370
+ attr$1(container, 'data-group', grouping);
39371
+
39372
+ entriesContainer.appendChild(container);
39373
+ }
39374
+
39375
+ var html = entry.html || (
39376
+ entry.separator ?
39377
+ '<hr class="separator" />' :
39378
+ '<div class="entry" draggable="true"></div>');
39379
+
39380
+
39381
+ var control = domify$1(html);
39382
+ container.appendChild(control);
39383
+
39384
+ if (!entry.separator) {
39385
+ attr$1(control, 'data-action', id);
39386
+
39387
+ if (entry.title) {
39388
+ attr$1(control, 'title', entry.title);
39389
+ }
39390
+
39391
+ if (entry.className) {
39392
+ addClasses(control, entry.className);
39393
+ }
39394
+
39395
+ if (entry.imageUrl) {
39396
+ var image = domify$1('<img>');
39397
+ attr$1(image, 'src', entry.imageUrl);
39398
+
39399
+ control.appendChild(image);
39400
+ }
39401
+ }
39402
+ });
39403
+
39404
+ // open after update
39405
+ this.open();
39406
+ };
39407
+
39408
+
39409
+ /**
39410
+ * Trigger an action available on the palette
39411
+ *
39412
+ * @param {string} action
39413
+ * @param {Event} event
39414
+ */
39415
+ Palette.prototype.trigger = function(action, event, autoActivate) {
39416
+ var entry,
39417
+ originalEvent,
39418
+ button = event.delegateTarget || event.target;
39419
+
39420
+ if (!button) {
39421
+ return event.preventDefault();
39422
+ }
39423
+
39424
+ entry = attr$1(button, 'data-action');
39425
+ originalEvent = event.originalEvent || event;
39426
+
39427
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
39428
+ };
39429
+
39430
+ Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
39431
+ var entries = this._entries,
39432
+ entry,
39433
+ handler;
39434
+
39435
+ entry = entries[entryId];
39436
+
39437
+ // when user clicks on the palette and not on an action
39438
+ if (!entry) {
39439
+ return;
39440
+ }
39441
+
39442
+ handler = entry.action;
39443
+
39444
+ // simple action (via callback function)
39445
+ if (isFunction(handler)) {
39446
+ if (action === 'click') {
39447
+ return handler(event, autoActivate);
39448
+ }
39449
+ } else {
39450
+ if (handler[action]) {
39451
+ return handler[action](event, autoActivate);
39452
+ }
39453
+ }
39454
+
39455
+ // silence other actions
39456
+ event.preventDefault();
39457
+ };
39458
+
39459
+ Palette.prototype._layoutChanged = function() {
39460
+ this._toggleState({});
39461
+ };
39462
+
39463
+ /**
39464
+ * Do we need to collapse to two columns?
39465
+ *
39466
+ * @param {number} availableHeight
39467
+ * @param {Object} entries
39468
+ *
39469
+ * @return {boolean}
39470
+ */
39471
+ Palette.prototype._needsCollapse = function(availableHeight, entries) {
39472
+
39473
+ // top margin + bottom toggle + bottom margin
39474
+ // implementors must override this method if they
39475
+ // change the palette styles
39476
+ var margin = 20 + 10 + 20;
39477
+
39478
+ var entriesHeight = Object.keys(entries).length * 46;
39479
+
39480
+ return availableHeight < entriesHeight + margin;
39481
+ };
39482
+
39483
+ /**
39484
+ * Close the palette
39485
+ */
39486
+ Palette.prototype.close = function() {
39487
+
39488
+ this._toggleState({
39489
+ open: false,
39490
+ twoColumn: false
39491
+ });
39492
+ };
39493
+
39494
+
39495
+ /**
39496
+ * Open the palette
39497
+ */
39498
+ Palette.prototype.open = function() {
39499
+ this._toggleState({ open: true });
39500
+ };
39501
+
39502
+
39503
+ Palette.prototype.toggle = function(open) {
39504
+ if (this.isOpen()) {
39505
+ this.close();
39506
+ } else {
39507
+ this.open();
39508
+ }
39509
+ };
39510
+
39511
+ Palette.prototype.isActiveTool = function(tool) {
39512
+ return tool && this._activeTool === tool;
39513
+ };
39514
+
39515
+ Palette.prototype.updateToolHighlight = function(name) {
39516
+ var entriesContainer,
39517
+ toolsContainer;
39518
+
39519
+ if (!this._toolsContainer) {
39520
+ entriesContainer = query('.djs-palette-entries', this._container);
39521
+
39522
+ this._toolsContainer = query('[data-group=tools]', entriesContainer);
39523
+ }
39524
+
39525
+ toolsContainer = this._toolsContainer;
39526
+
39527
+ forEach$1(toolsContainer.children, function(tool) {
39528
+ var actionName = tool.getAttribute('data-action');
39529
+
39530
+ if (!actionName) {
39531
+ return;
39532
+ }
39533
+
39534
+ var toolClasses = classes$1(tool);
39535
+
39536
+ actionName = actionName.replace('-tool', '');
39537
+
39538
+ if (toolClasses.contains('entry') && actionName === name) {
39539
+ toolClasses.add('highlighted-entry');
39540
+ } else {
39541
+ toolClasses.remove('highlighted-entry');
39542
+ }
39543
+ });
39544
+ };
39545
+
39546
+
39547
+ /**
39548
+ * Return true if the palette is opened.
39549
+ *
39550
+ * @example
39551
+ *
39552
+ * palette.open();
39553
+ *
39554
+ * if (palette.isOpen()) {
39555
+ * // yes, we are open
39556
+ * }
39557
+ *
39558
+ * @return {boolean} true if palette is opened
39559
+ */
39560
+ Palette.prototype.isOpen = function() {
39561
+ return classes$1(this._container).has(PALETTE_OPEN_CLS);
39562
+ };
39563
+
39564
+ /**
39565
+ * Get container the palette lives in.
39566
+ *
39567
+ * @return {Element}
39568
+ */
39569
+ Palette.prototype._getParentContainer = function() {
39570
+ return this._canvas.getContainer();
39571
+ };
39572
+
39573
+
39574
+ /* markup definition */
39575
+
39576
+ Palette.HTML_MARKUP =
39577
+ '<div class="djs-palette">' +
39578
+ '<div class="djs-palette-entries"></div>' +
39579
+ '<div class="djs-palette-toggle"></div>' +
39580
+ '</div>';
39581
+
39582
+
39583
+ // helpers //////////////////////
39584
+
39585
+ function addClasses(element, classNames) {
39586
+
39587
+ var classes = classes$1(element);
39588
+
39589
+ var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
39590
+ actualClassNames.forEach(function(cls) {
39591
+ classes.add(cls);
39592
+ });
39593
+ }
39594
+
39595
+ function addPaletteEntries(entries, provider) {
39596
+
39597
+ var entriesOrUpdater = provider.getPaletteEntries();
39598
+
39599
+ if (isFunction(entriesOrUpdater)) {
39600
+ return entriesOrUpdater(entries);
39601
+ }
39602
+
39603
+ forEach$1(entriesOrUpdater, function(entry, id) {
39604
+ entries[id] = entry;
39605
+ });
39606
+
39607
+ return entries;
39608
+ }
39609
+
39610
+ var PaletteModule$1 = {
39611
+ __init__: [ 'palette' ],
39612
+ palette: [ 'type', Palette ]
39613
+ };
39614
+
39615
+ var EVENT_GROUP = {
39616
+ id: 'events',
39617
+ name: 'Events'
39618
+ };
39619
+
39620
+ var TASK_GROUP = {
39621
+ id: 'tasks',
39622
+ name: 'Tasks'
39623
+ };
39624
+
39625
+ var DATA_GROUP = {
39626
+ id: 'data',
39627
+ name: 'Data'
39628
+ };
39629
+
39630
+ var PARTICIPANT_GROUP = {
39631
+ id: 'participants',
39632
+ name: 'Participants'
39633
+ };
39634
+
39635
+ var SUBPROCESS_GROUP = {
39636
+ id: 'subprocess',
39637
+ name: 'Sub Processes'
39638
+ };
39639
+
39640
+ var GATEWAY_GROUP = {
39641
+ id: 'gateways',
39642
+ name: 'Gateways'
39643
+ };
39644
+
39645
+ var NONE_EVENTS = [
39646
+ {
39647
+ label: 'Start Event',
39648
+ actionName: 'none-start-event',
39649
+ className: 'bpmn-icon-start-event-none',
39650
+ target: {
39651
+ type: 'bpmn:StartEvent'
39652
+ }
39653
+ },
39654
+ {
39655
+ label: 'Intermediate Throw Event',
39656
+ actionName: 'none-intermediate-throwing',
39657
+ className: 'bpmn-icon-intermediate-event-none',
39658
+ target: {
39659
+ type: 'bpmn:IntermediateThrowEvent'
39660
+ }
39661
+ },
39662
+ {
39663
+ label: 'Boundary Event',
39664
+ actionName: 'none-boundary-event',
39665
+ className: 'bpmn-icon-intermediate-event-none',
39666
+ target: {
39667
+ type: 'bpmn:BoundaryEvent'
39668
+ }
39669
+ },
39670
+ {
39671
+ label: 'End Event',
39672
+ actionName: 'none-end-event',
39673
+ className: 'bpmn-icon-end-event-none',
39674
+ target: {
39675
+ type: 'bpmn:EndEvent'
39676
+ }
39677
+ }
39678
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39679
+
39680
+ var TYPED_START_EVENTS = [
39681
+ {
39682
+ label: 'Message Start Event',
39683
+ actionName: 'message-start',
39684
+ className: 'bpmn-icon-start-event-message',
39685
+ target: {
39686
+ type: 'bpmn:StartEvent',
39687
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39688
+ }
39689
+ },
39690
+ {
39691
+ label: 'Timer Start Event',
39692
+ actionName: 'timer-start',
39693
+ className: 'bpmn-icon-start-event-timer',
39694
+ target: {
39695
+ type: 'bpmn:StartEvent',
39696
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39697
+ }
39698
+ },
39699
+ {
39700
+ label: 'Conditional Start Event',
39701
+ actionName: 'conditional-start',
39702
+ className: 'bpmn-icon-start-event-condition',
39703
+ target: {
39704
+ type: 'bpmn:StartEvent',
39705
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39706
+ }
39707
+ },
39708
+ {
39709
+ label: 'Signal Start Event',
39710
+ actionName: 'signal-start',
39711
+ className: 'bpmn-icon-start-event-signal',
39712
+ target: {
39713
+ type: 'bpmn:StartEvent',
39714
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39715
+ }
39716
+ }
39717
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39718
+
39719
+ var TYPED_INTERMEDIATE_EVENT = [
39720
+ {
39721
+ label: 'Message Intermediate Catch Event',
39722
+ actionName: 'message-intermediate-catch',
39723
+ className: 'bpmn-icon-intermediate-event-catch-message',
39724
+ target: {
39725
+ type: 'bpmn:IntermediateCatchEvent',
39726
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39727
+ }
39728
+ },
39729
+ {
39730
+ label: 'Message Intermediate Throw Event',
39731
+ actionName: 'message-intermediate-throw',
39732
+ className: 'bpmn-icon-intermediate-event-throw-message',
39733
+ target: {
39734
+ type: 'bpmn:IntermediateThrowEvent',
39735
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39736
+ }
39737
+ },
39738
+ {
39739
+ label: 'Timer Intermediate Catch Event',
39740
+ actionName: 'timer-intermediate-catch',
39741
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39742
+ target: {
39743
+ type: 'bpmn:IntermediateCatchEvent',
39744
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39745
+ }
39746
+ },
39747
+ {
39748
+ label: 'Escalation Intermediate Throw Event',
39749
+ actionName: 'escalation-intermediate-throw',
39750
+ className: 'bpmn-icon-intermediate-event-throw-escalation',
39751
+ target: {
39752
+ type: 'bpmn:IntermediateThrowEvent',
39753
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39754
+ }
39755
+ },
39756
+ {
39757
+ label: 'Conditional Intermediate Catch Event',
39758
+ actionName: 'conditional-intermediate-catch',
39759
+ className: 'bpmn-icon-intermediate-event-catch-condition',
39760
+ target: {
39761
+ type: 'bpmn:IntermediateCatchEvent',
39762
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39763
+ }
39764
+ },
39765
+ {
39766
+ label: 'Link Intermediate Catch Event',
39767
+ actionName: 'link-intermediate-catch',
39768
+ className: 'bpmn-icon-intermediate-event-catch-link',
39769
+ target: {
39770
+ type: 'bpmn:IntermediateCatchEvent',
39771
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
39772
+ eventDefinitionAttrs: {
39773
+ name: ''
39774
+ }
39775
+ }
39776
+ },
39777
+ {
39778
+ label: 'Link Intermediate Throw Event',
39779
+ actionName: 'link-intermediate-throw',
39780
+ className: 'bpmn-icon-intermediate-event-throw-link',
39781
+ target: {
39782
+ type: 'bpmn:IntermediateThrowEvent',
39783
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
39784
+ eventDefinitionAttrs: {
39785
+ name: ''
39786
+ }
39787
+ }
39788
+ },
39789
+ {
39790
+ label: 'Compensation Intermediate Throw Event',
39791
+ actionName: 'compensation-intermediate-throw',
39792
+ className: 'bpmn-icon-intermediate-event-throw-compensation',
39793
+ target: {
39794
+ type: 'bpmn:IntermediateThrowEvent',
39795
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39796
+ }
39797
+ },
39798
+ {
39799
+ label: 'Signal Intermediate Catch Event',
39800
+ actionName: 'signal-intermediate-catch',
39801
+ className: 'bpmn-icon-intermediate-event-catch-signal',
39802
+ target: {
39803
+ type: 'bpmn:IntermediateCatchEvent',
39804
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39805
+ }
39806
+ },
39807
+ {
39808
+ label: 'Signal Intermediate Throw Event',
39809
+ actionName: 'signal-intermediate-throw',
39810
+ className: 'bpmn-icon-intermediate-event-throw-signal',
39811
+ target: {
39812
+ type: 'bpmn:IntermediateThrowEvent',
39813
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39814
+ }
39815
+ }
39816
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39817
+
39818
+ var TYPED_BOUNDARY_EVENT = [
39819
+ {
39820
+ label: 'Message Boundary Event',
39821
+ actionName: 'message-boundary',
39822
+ className: 'bpmn-icon-intermediate-event-catch-message',
39823
+ target: {
39824
+ type: 'bpmn:BoundaryEvent',
39825
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39826
+ }
39827
+ },
39828
+ {
39829
+ label: 'Timer Boundary Event',
39830
+ actionName: 'timer-boundary',
39831
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39832
+ target: {
39833
+ type: 'bpmn:BoundaryEvent',
39834
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39835
+ }
39836
+ },
39837
+ {
39838
+ label: 'Escalation Boundary Event',
39839
+ actionName: 'escalation-boundary',
39840
+ className: 'bpmn-icon-intermediate-event-catch-escalation',
39841
+ target: {
39842
+ type: 'bpmn:BoundaryEvent',
39843
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39844
+ }
39845
+ },
39846
+ {
39847
+ label: 'Conditional Boundary Event',
39848
+ actionName: 'conditional-boundary',
39849
+ className: 'bpmn-icon-intermediate-event-catch-condition',
39850
+ target: {
39851
+ type: 'bpmn:BoundaryEvent',
39852
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39853
+ }
39854
+ },
39855
+ {
39856
+ label: 'Error Boundary Event',
39857
+ actionName: 'error-boundary',
39858
+ className: 'bpmn-icon-intermediate-event-catch-error',
39859
+ target: {
39860
+ type: 'bpmn:BoundaryEvent',
39861
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
39862
+ }
39863
+ },
39864
+ {
39865
+ label: 'Cancel Boundary Event',
39866
+ actionName: 'cancel-boundary',
39867
+ className: 'bpmn-icon-intermediate-event-catch-cancel',
39868
+ target: {
39869
+ type: 'bpmn:BoundaryEvent',
39870
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
39871
+ }
39872
+ },
39873
+ {
39874
+ label: 'Signal Boundary Event',
39875
+ actionName: 'signal-boundary',
39876
+ className: 'bpmn-icon-intermediate-event-catch-signal',
39877
+ target: {
39878
+ type: 'bpmn:BoundaryEvent',
39879
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39880
+ }
39881
+ },
39882
+ {
39883
+ label: 'Compensation Boundary Event',
39884
+ actionName: 'compensation-boundary',
39885
+ className: 'bpmn-icon-intermediate-event-catch-compensation',
39886
+ target: {
39887
+ type: 'bpmn:BoundaryEvent',
39888
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39889
+ }
39890
+ },
39891
+ {
39892
+ label: 'Message Boundary Event (non-interrupting)',
39893
+ actionName: 'non-interrupting-message-boundary',
39894
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
39895
+ target: {
39896
+ type: 'bpmn:BoundaryEvent',
39897
+ eventDefinitionType: 'bpmn:MessageEventDefinition',
39898
+ cancelActivity: false
39899
+ }
39900
+ },
39901
+ {
39902
+ label: 'Timer Boundary Event (non-interrupting)',
39903
+ actionName: 'non-interrupting-timer-boundary',
39904
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
39905
+ target: {
39906
+ type: 'bpmn:BoundaryEvent',
39907
+ eventDefinitionType: 'bpmn:TimerEventDefinition',
39908
+ cancelActivity: false
39909
+ }
39910
+ },
39911
+ {
39912
+ label: 'Escalation Boundary Event (non-interrupting)',
39913
+ actionName: 'non-interrupting-escalation-boundary',
39914
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
39915
+ target: {
39916
+ type: 'bpmn:BoundaryEvent',
39917
+ eventDefinitionType: 'bpmn:EscalationEventDefinition',
39918
+ cancelActivity: false
39919
+ }
39920
+ },
39921
+ {
39922
+ label: 'Conditional Boundary Event (non-interrupting)',
39923
+ actionName: 'non-interrupting-conditional-boundary',
39924
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
39925
+ target: {
39926
+ type: 'bpmn:BoundaryEvent',
39927
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition',
39928
+ cancelActivity: false
39929
+ }
39930
+ },
39931
+ {
39932
+ label: 'Signal Boundary Event (non-interrupting)',
39933
+ actionName: 'non-interrupting-signal-boundary',
39934
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
39935
+ target: {
39936
+ type: 'bpmn:BoundaryEvent',
39937
+ eventDefinitionType: 'bpmn:SignalEventDefinition',
39938
+ cancelActivity: false
39939
+ }
39940
+ }
39941
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39942
+
39943
+ var TYPED_END_EVENT = [
39944
+ {
39945
+ label: 'Message End Event',
39946
+ actionName: 'message-end',
39947
+ className: 'bpmn-icon-end-event-message',
39948
+ target: {
39949
+ type: 'bpmn:EndEvent',
39950
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39951
+ }
39952
+ },
39953
+ {
39954
+ label: 'Escalation End Event',
39955
+ actionName: 'escalation-end',
39956
+ className: 'bpmn-icon-end-event-escalation',
39957
+ target: {
39958
+ type: 'bpmn:EndEvent',
39959
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39960
+ }
39961
+ },
39962
+ {
39963
+ label: 'Error End Event',
39964
+ actionName: 'error-end',
39965
+ className: 'bpmn-icon-end-event-error',
39966
+ target: {
39967
+ type: 'bpmn:EndEvent',
39968
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
39969
+ }
39970
+ },
39971
+ {
39972
+ label: 'Cancel End Event',
39973
+ actionName: 'cancel-end',
39974
+ className: 'bpmn-icon-end-event-cancel',
39975
+ target: {
39976
+ type: 'bpmn:EndEvent',
39977
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
39978
+ }
39979
+ },
39980
+ {
39981
+ label: 'Compensation End Event',
39982
+ actionName: 'compensation-end',
39983
+ className: 'bpmn-icon-end-event-compensation',
39984
+ target: {
39985
+ type: 'bpmn:EndEvent',
39986
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39987
+ }
39988
+ },
39989
+ {
39990
+ label: 'Signal End Event',
39991
+ actionName: 'signal-end',
39992
+ className: 'bpmn-icon-end-event-signal',
39993
+ target: {
39994
+ type: 'bpmn:EndEvent',
39995
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39996
+ }
39997
+ },
39998
+ {
39999
+ label: 'Terminate End Event',
40000
+ actionName: 'terminate-end',
40001
+ className: 'bpmn-icon-end-event-terminate',
40002
+ target: {
40003
+ type: 'bpmn:EndEvent',
40004
+ eventDefinitionType: 'bpmn:TerminateEventDefinition'
40005
+ }
40006
+ }
40007
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40008
+
40009
+ var GATEWAY = [
40010
+ {
40011
+ label: 'Exclusive Gateway',
40012
+ actionName: 'exclusive-gateway',
40013
+ className: 'bpmn-icon-gateway-xor',
40014
+ target: {
40015
+ type: 'bpmn:ExclusiveGateway'
40016
+ }
40017
+ },
40018
+ {
40019
+ label: 'Parallel Gateway',
40020
+ actionName: 'parallel-gateway',
40021
+ className: 'bpmn-icon-gateway-parallel',
40022
+ target: {
40023
+ type: 'bpmn:ParallelGateway'
40024
+ }
40025
+ },
40026
+ {
40027
+ label: 'Inclusive Gateway',
40028
+ search: 'or',
40029
+ actionName: 'inclusive-gateway',
40030
+ className: 'bpmn-icon-gateway-or',
40031
+ target: {
40032
+ type: 'bpmn:InclusiveGateway'
40033
+ }
40034
+ },
40035
+ {
40036
+ label: 'Complex Gateway',
40037
+ actionName: 'complex-gateway',
40038
+ className: 'bpmn-icon-gateway-complex',
40039
+ target: {
40040
+ type: 'bpmn:ComplexGateway'
40041
+ }
40042
+ },
40043
+ {
40044
+ label: 'Event based Gateway',
40045
+ actionName: 'event-based-gateway',
40046
+ className: 'bpmn-icon-gateway-eventbased',
40047
+ target: {
40048
+ type: 'bpmn:EventBasedGateway',
40049
+ instantiate: false,
40050
+ eventGatewayType: 'Exclusive'
40051
+ }
40052
+ }
40053
+ ].map(option => ({ ...option, group: GATEWAY_GROUP }));
40054
+
40055
+ var SUBPROCESS = [
40056
+ {
40057
+ label: 'Transaction',
40058
+ actionName: 'transaction',
40059
+ className: 'bpmn-icon-transaction',
40060
+ target: {
40061
+ type: 'bpmn:Transaction',
40062
+ isExpanded: true
40063
+ }
40064
+ },
40065
+ {
40066
+ label: 'Event Sub Process',
40067
+ search: 'subprocess',
40068
+ actionName: 'event-subprocess',
40069
+ className: 'bpmn-icon-event-subprocess-expanded',
40070
+ target: {
40071
+ type: 'bpmn:SubProcess',
40072
+ triggeredByEvent: true,
40073
+ isExpanded: true
40074
+ }
40075
+ },
40076
+ {
40077
+ label: 'Sub Process (collapsed)',
40078
+ search: 'subprocess',
40079
+ actionName: 'collapsed-subprocess',
40080
+ className: 'bpmn-icon-subprocess-collapsed',
40081
+ target: {
40082
+ type: 'bpmn:SubProcess',
40083
+ isExpanded: false
40084
+ }
40085
+ },
40086
+ {
40087
+ label: 'Sub Process (expanded)',
40088
+ search: 'subprocess',
40089
+ actionName: 'expanded-subprocess',
40090
+ className: 'bpmn-icon-subprocess-collapsed',
40091
+ target: {
40092
+ type: 'bpmn:SubProcess',
40093
+ isExpanded: true
40094
+ }
40095
+ }
40096
+ ].map(option => ({ ...option, group: SUBPROCESS_GROUP }));
40097
+
40098
+ var TASK = [
40099
+ {
40100
+ label: 'Task',
40101
+ actionName: 'task',
40102
+ className: 'bpmn-icon-task',
40103
+ target: {
40104
+ type: 'bpmn:Task'
40105
+ }
40106
+ },
40107
+ {
40108
+ label: 'Send Task',
40109
+ actionName: 'send-task',
40110
+ className: 'bpmn-icon-send',
40111
+ target: {
40112
+ type: 'bpmn:SendTask'
40113
+ }
40114
+ },
40115
+ {
40116
+ label: 'Receive Task',
40117
+ actionName: 'receive-task',
40118
+ className: 'bpmn-icon-receive',
40119
+ target: {
40120
+ type: 'bpmn:ReceiveTask'
40121
+ }
40122
+ },
40123
+ {
40124
+ label: 'User Task',
40125
+ actionName: 'user-task',
40126
+ className: 'bpmn-icon-user',
40127
+ target: {
40128
+ type: 'bpmn:UserTask'
40129
+ }
40130
+ },
40131
+ {
40132
+ label: 'Manual Task',
40133
+ actionName: 'manual-task',
40134
+ className: 'bpmn-icon-manual',
40135
+ target: {
40136
+ type: 'bpmn:ManualTask'
40137
+ }
40138
+ },
40139
+ {
40140
+ label: 'Business Rule Task',
40141
+ actionName: 'rule-task',
40142
+ className: 'bpmn-icon-business-rule',
40143
+ target: {
40144
+ type: 'bpmn:BusinessRuleTask'
40145
+ }
40146
+ },
40147
+ {
40148
+ label: 'Service Task',
40149
+ actionName: 'service-task',
40150
+ className: 'bpmn-icon-service',
40151
+ target: {
40152
+ type: 'bpmn:ServiceTask'
40153
+ }
40154
+ },
40155
+ {
40156
+ label: 'Script Task',
40157
+ actionName: 'script-task',
40158
+ className: 'bpmn-icon-script',
40159
+ target: {
40160
+ type: 'bpmn:ScriptTask'
40161
+ }
40162
+ },
40163
+ {
40164
+ label: 'Call Activity',
40165
+ actionName: 'call-activity',
40166
+ className: 'bpmn-icon-call-activity',
40167
+ target: {
40168
+ type: 'bpmn:CallActivity'
40169
+ }
40170
+ }
40171
+ ].map(option => ({ ...option, group: TASK_GROUP }));
40172
+
40173
+ var DATA_OBJECTS = [
40174
+ {
40175
+ label: 'Data Store Reference',
40176
+ actionName: 'data-store-reference',
40177
+ className: 'bpmn-icon-data-store',
40178
+ target: {
40179
+ type: 'bpmn:DataStoreReference'
40180
+ }
40181
+ },
40182
+ {
40183
+ label: 'Data Object Reference',
40184
+ actionName: 'data-object-reference',
40185
+ className: 'bpmn-icon-data-object',
40186
+ target: {
40187
+ type: 'bpmn:DataObjectReference'
40188
+ }
40189
+ }
40190
+ ].map(option => ({ ...option, group: DATA_GROUP }));
40191
+
40192
+ var PARTICIPANT = [
40193
+ {
40194
+ label: 'Expanded Pool',
40195
+ search: 'Participant',
40196
+ actionName: 'expanded-pool',
40197
+ className: 'bpmn-icon-participant',
40198
+ target: {
40199
+ type: 'bpmn:Participant',
40200
+ isExpanded: true
40201
+ }
40202
+ },
40203
+ {
40204
+ label: 'Empty Pool',
40205
+ search: 'Collapsed Participant',
40206
+ actionName: 'collapsed-pool',
40207
+ className: 'bpmn-icon-lane',
40208
+ target: {
40209
+ type: 'bpmn:Participant',
40210
+ isExpanded: false
40211
+ }
40212
+ }
40213
+ ].map(option => ({ ...option, group: PARTICIPANT_GROUP }));
40214
+
40215
+ var CREATE_OPTIONS = [
40216
+ ...GATEWAY,
40217
+ ...TASK,
40218
+ ...SUBPROCESS,
40219
+ ...NONE_EVENTS,
40220
+ ...TYPED_START_EVENTS,
40221
+ ...TYPED_INTERMEDIATE_EVENT,
40222
+ ...TYPED_END_EVENT,
40223
+ ...TYPED_BOUNDARY_EVENT,
40224
+ ...DATA_OBJECTS,
40225
+ ...PARTICIPANT
40226
+ ];
40227
+
40228
+ /**
40229
+ * This module is a create menu provider for the popup menu.
40230
+ */
40231
+ function CreateMenuProvider(
40232
+ elementFactory, popupMenu, create,
40233
+ autoPlace, mouse, translate
40234
+ ) {
40235
+ this._elementFactory = elementFactory;
40236
+ this._popupMenu = popupMenu;
40237
+ this._create = create;
40238
+ this._autoPlace = autoPlace;
40239
+ this._mouse = mouse;
40240
+ this._translate = translate;
40241
+
40242
+ this.register();
40243
+ }
40244
+
40245
+ CreateMenuProvider.$inject = [
40246
+ 'elementFactory',
40247
+ 'popupMenu',
40248
+ 'create',
40249
+ 'autoPlace',
40250
+ 'mouse',
40251
+ 'translate'
40252
+ ];
40253
+
40254
+ /**
40255
+ * Register create menu provider in the popup menu
40256
+ */
40257
+ CreateMenuProvider.prototype.register = function() {
40258
+ this._popupMenu.registerProvider('bpmn-create', this);
40259
+ };
40260
+
40261
+ /**
40262
+ * Get all entries
40263
+ *
40264
+ * @param {djs.model.Base} element
40265
+ *
40266
+ * @return {Array<Object>} a list of menu entry items
40267
+ */
40268
+ CreateMenuProvider.prototype.getPopupMenuEntries = function() {
40269
+
40270
+ const entries = {};
40271
+
40272
+ // map options to menu entries
40273
+ CREATE_OPTIONS.forEach(option => {
40274
+ const {
40275
+ actionName,
40276
+ className,
40277
+ label,
40278
+ target,
40279
+ description,
40280
+ group,
40281
+ search
40282
+ } = option;
40283
+
40284
+ const targetAction = this._createEntryAction(target);
40285
+
40286
+ entries[`create-${actionName}`] = {
40287
+ label: label && this._translate(label),
40288
+ className,
40289
+ description,
40290
+ group: group && {
40291
+ ...group,
40292
+ name: this._translate(group.name)
40293
+ },
40294
+ search,
40295
+ action: {
40296
+ click: targetAction,
40297
+ dragstart: targetAction
40298
+ }
40299
+ };
40300
+ });
40301
+
40302
+ return entries;
40303
+ };
40304
+
40305
+ /**
40306
+ * Create an action for a given target
40307
+ *
40308
+ * @param {Object} target
40309
+ * @returns {Object}
40310
+ */
40311
+ CreateMenuProvider.prototype._createEntryAction = function(target) {
40312
+
40313
+ const create = this._create;
40314
+ const mouse = this._mouse;
40315
+ const popupMenu = this._popupMenu;
40316
+ const elementFactory = this._elementFactory;
40317
+
40318
+ let newElement;
40319
+
40320
+ return (event) => {
40321
+ popupMenu.close();
40322
+
40323
+ // create the new element
40324
+ if (target.type === 'bpmn:Participant') {
40325
+ newElement = elementFactory.createParticipantShape(target);
40326
+ } else {
40327
+ newElement = elementFactory.create('shape', target);
40328
+ }
40329
+
40330
+ // use last mouse event if triggered via keyboard
40331
+ if (event instanceof KeyboardEvent) {
40332
+ event = mouse.getLastMoveEvent();
40333
+ }
40334
+
40335
+ return create.start(event, newElement);
40336
+ };
40337
+ };
40338
+
40339
+ /**
40340
+ * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
40341
+ * and then replace respective icons with the optimized data URIs in `./dist`.
40342
+ */
40343
+ 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';
40344
+ 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';
40345
+
40346
+ /**
40347
+ * A palette provider for the create elements menu.
40348
+ */
40349
+ function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
40350
+
40351
+ this._translate = translate;
40352
+ this._popupMenu = popupMenu;
40353
+ this._canvas = canvas;
40354
+ this._mouse = mouse;
40355
+
40356
+ palette.registerProvider(800,this);
40357
+ }
40358
+
40359
+ CreatePaletteProvider.$inject = [
40360
+ 'palette',
40361
+ 'translate',
40362
+ 'popupMenu',
40363
+ 'canvas',
40364
+ 'mouse'
40365
+ ];
40366
+
40367
+
40368
+ CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
40369
+ const actions = {},
40370
+ translate = this._translate,
40371
+ popupMenu = this._popupMenu,
40372
+ canvas = this._canvas,
40373
+ mouse = this._mouse;
40374
+
40375
+ const getPosition = (event) => {
40376
+ const X_OFFSET = 35;
40377
+ const Y_OFFSET = 10;
40378
+
40379
+ if (event instanceof KeyboardEvent) {
40380
+ event = mouse.getLastMoveEvent();
40381
+ return { x: event.x, y: event.y };
40382
+ }
40383
+
40384
+ const target = event && event.target || query('.djs-palette [data-action="create"]');
40385
+ const targetPosition = target.getBoundingClientRect();
40386
+
40387
+ return target && {
40388
+ x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
40389
+ y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
40390
+ };
40391
+ };
40392
+
40393
+ assign$1(actions, {
40394
+ 'create': {
40395
+ group: 'create',
40396
+ imageUrl: createIcon,
40397
+ title: translate('Create element'),
40398
+ action: {
40399
+ click: function(event) {
40400
+ const position = getPosition(event);
40401
+
40402
+ const element = canvas.getRootElement();
40403
+
40404
+ popupMenu.open(element, 'bpmn-create', position, {
40405
+ title: translate('Create element'),
40406
+ width: 300,
40407
+ search: true
40408
+ });
40409
+ }
40410
+ }
40411
+ },
40412
+ });
40413
+
40414
+ return actions;
40415
+ };
40416
+
40417
+ /**
40418
+ * Registers and executes BPMN specific editor actions.
40419
+ *
40420
+ * @param {Injector} injector
40421
+ */
40422
+ function CreateAppendEditorActions(injector) {
40423
+ this._injector = injector;
40424
+
40425
+ this.registerActions();
40426
+ }
40427
+
40428
+ CreateAppendEditorActions.$inject = [
40429
+ 'injector'
40430
+ ];
40431
+
40432
+ /**
40433
+ * Register actions.
40434
+ *
40435
+ * @param {Injector} injector
40436
+ */
40437
+ CreateAppendEditorActions.prototype.registerActions = function() {
40438
+ var editorActions = this._injector.get('editorActions', false);
40439
+ var selection = this._injector.get('selection', false);
40440
+ var contextPad = this._injector.get('contextPad', false);
40441
+ var palette = this._injector.get('palette', false);
40442
+
40443
+ const actions = {};
40444
+
40445
+ // append
40446
+ if (selection && contextPad) {
40447
+ assign$1(actions, {
40448
+ 'appendElement': function(event) {
40449
+ contextPad.triggerEntry('append', 'click', event);
40450
+ } }
40451
+ );
40452
+ }
40453
+
40454
+ // create
40455
+ if (palette) {
40456
+ assign$1(actions, {
40457
+ 'createElement': function(event) {
40458
+ palette.triggerEntry('create', 'click', event);
40459
+ } }
40460
+ );
40461
+ }
40462
+
40463
+ editorActions && editorActions.register(actions);
40464
+
38645
40465
  };
38646
40466
 
38647
40467
  /**
38648
- * @param {djs.model.Base[]} elements
38649
- * @return {boolean}
40468
+ * BPMN 2.0 specific keyboard bindings.
40469
+ *
40470
+ * @param {Injector} injector
38650
40471
  */
38651
- ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
40472
+ function CreateAppendKeyboardBindings(injector) {
38652
40473
 
38653
- var baseAllowed = this._rules.allowed('elements.delete', {
38654
- elements: elements
38655
- });
40474
+ this._injector = injector;
40475
+ this._keyboard = this._injector.get('keyboard', false);
40476
+ this._editorActions = this._injector.get('editorActions', false);
40477
+ this._selection = this._injector.get('selection', false);
38656
40478
 
38657
- if (isArray$3(baseAllowed)) {
38658
- return every(baseAllowed, function(element) {
38659
- return includes$7(baseAllowed, element);
38660
- });
40479
+ if (this._keyboard) {
40480
+ this._injector.invoke(KeyboardBindings, this);
38661
40481
  }
40482
+ }
38662
40483
 
38663
- return baseAllowed;
38664
- };
40484
+ e$3(CreateAppendKeyboardBindings, KeyboardBindings);
38665
40485
 
38666
- ContextPadProvider.prototype.getContextPadEntries = function(element) {
38667
- var contextPad = this._contextPad,
38668
- modeling = this._modeling,
40486
+ CreateAppendKeyboardBindings.$inject = [
40487
+ 'injector'
40488
+ ];
38669
40489
 
38670
- elementFactory = this._elementFactory,
38671
- connect = this._connect,
38672
- create = this._create,
38673
- popupMenu = this._popupMenu,
38674
- rules = this._rules,
38675
- autoPlace = this._autoPlace,
38676
- translate = this._translate;
38677
40490
 
38678
- var actions = {};
40491
+ /**
40492
+ * Register available keyboard bindings.
40493
+ *
40494
+ * @param {Keyboard} keyboard
40495
+ * @param {EditorActions} editorActions
40496
+ */
40497
+ CreateAppendKeyboardBindings.prototype.registerBindings = function() {
38679
40498
 
38680
- if (element.type === 'label') {
38681
- return actions;
38682
- }
40499
+ var keyboard = this._keyboard;
40500
+ var editorActions = this._editorActions;
40501
+ var selection = this._selection;
38683
40502
 
38684
- var businessObject = element.businessObject;
40503
+ // inherit default bindings
40504
+ KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
38685
40505
 
38686
- function startConnect(event, element) {
38687
- connect.start(event, element);
38688
- }
40506
+ /**
40507
+ * Add keyboard binding if respective editor action
40508
+ * is registered.
40509
+ *
40510
+ * @param {string} action name
40511
+ * @param {Function} fn that implements the key binding
40512
+ */
40513
+ function addListener(action, fn) {
38689
40514
 
38690
- function removeElement(e, element) {
38691
- modeling.removeElements([ element ]);
40515
+ if (editorActions && editorActions.isRegistered(action)) {
40516
+ keyboard && keyboard.addListener(fn);
40517
+ }
38692
40518
  }
38693
40519
 
38694
- function getReplaceMenuPosition(element) {
40520
+ // activate append/create element
40521
+ // A
40522
+ addListener('appendElement', function(context) {
38695
40523
 
38696
- var Y_OFFSET = 5;
40524
+ var event = context.keyEvent;
38697
40525
 
38698
- var pad = contextPad.getPad(element).html;
40526
+ if (keyboard && keyboard.hasModifier(event)) {
40527
+ return;
40528
+ }
38699
40529
 
38700
- var padRect = pad.getBoundingClientRect();
40530
+ if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
38701
40531
 
38702
- var pos = {
38703
- x: padRect.left,
38704
- y: padRect.bottom + Y_OFFSET
38705
- };
40532
+ if (selection && selection.get().length == 1) {
40533
+ editorActions && editorActions.trigger('appendElement', event);
40534
+ } else {
40535
+ editorActions && editorActions.trigger('createElement', event);
40536
+ }
38706
40537
 
38707
- return pos;
38708
- }
40538
+ return true;
40539
+ }
40540
+ });
38709
40541
 
40542
+ // N
40543
+ addListener('createElement', function(context) {
38710
40544
 
38711
- /**
38712
- * Create an append action
38713
- *
38714
- * @param {string} type
38715
- * @param {string} className
38716
- * @param {string} [title]
38717
- * @param {Object} [options]
38718
- *
38719
- * @return {Object} descriptor
38720
- */
38721
- function appendAction(type, className, title, options) {
40545
+ var event = context.keyEvent;
38722
40546
 
38723
- if (typeof title !== 'string') {
38724
- options = title;
38725
- title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
40547
+ if (keyboard && keyboard.hasModifier(event)) {
40548
+ return;
38726
40549
  }
38727
40550
 
38728
- function appendStart(event, element) {
40551
+ if (keyboard && keyboard.isKey([ 'n', 'N' ], event)) {
40552
+ editorActions && editorActions.trigger('createElement', event);
38729
40553
 
38730
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
38731
- create.start(event, shape, {
38732
- source: element
38733
- });
40554
+ return true;
38734
40555
  }
40556
+ });
38735
40557
 
40558
+ };
38736
40559
 
38737
- var append = autoPlace ? function(event, element) {
38738
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
40560
+ /**
40561
+ * This module is an append menu provider for the popup menu.
40562
+ */
40563
+ function AppendMenuProvider(
40564
+ elementFactory,
40565
+ popupMenu,
40566
+ create,
40567
+ autoPlace,
40568
+ rules,
40569
+ mouse
40570
+ ) {
40571
+ this._elementFactory = elementFactory;
40572
+ this._popupMenu = popupMenu;
40573
+ this._create = create;
40574
+ this._autoPlace = autoPlace;
40575
+ this._rules = rules;
40576
+ this._create = create;
40577
+ this._mouse = mouse;
38739
40578
 
38740
- autoPlace.append(element, shape);
38741
- } : appendStart;
40579
+ this.register();
40580
+ }
40581
+
40582
+ AppendMenuProvider.$inject = [
40583
+ 'elementFactory',
40584
+ 'popupMenu',
40585
+ 'create',
40586
+ 'autoPlace',
40587
+ 'rules',
40588
+ 'mouse'
40589
+ ];
38742
40590
 
40591
+ /**
40592
+ * Register append menu provider in the popup menu
40593
+ */
40594
+ AppendMenuProvider.prototype.register = function() {
40595
+ this._popupMenu.registerProvider('bpmn-append', this);
40596
+ };
38743
40597
 
38744
- return {
38745
- group: 'model',
38746
- className: className,
38747
- title: title,
38748
- action: {
38749
- dragstart: appendStart,
38750
- click: append
38751
- }
38752
- };
40598
+ /**
40599
+ * Get all entries from createOptions for the given element.
40600
+ *
40601
+ * @param {djs.model.Base} element
40602
+ *
40603
+ * @return {Array<Object>} a list of menu entry items
40604
+ */
40605
+ AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40606
+ const rules = this._rules;
40607
+ const entries = {};
40608
+
40609
+ if (!rules.allowed('shape.append', { element: element })) {
40610
+ return [];
38753
40611
  }
38754
40612
 
38755
- function splitLaneHandler(count) {
40613
+ // filter out elements with no incoming connections
40614
+ const appendOptions = this._filterEntries(CREATE_OPTIONS);
38756
40615
 
38757
- return function(event, element) {
40616
+ // map options to menu entries
40617
+ appendOptions.forEach(option => {
40618
+ const {
40619
+ actionName,
40620
+ className,
40621
+ label,
40622
+ target,
40623
+ description,
40624
+ group,
40625
+ search
40626
+ } = option;
40627
+
40628
+ entries[`append-${actionName}`] = {
40629
+ label,
40630
+ className,
40631
+ description,
40632
+ group,
40633
+ search,
40634
+ action: this._createEntryAction(element, target)
40635
+ };
40636
+ });
38758
40637
 
38759
- // actual split
38760
- modeling.splitLane(element, count);
40638
+ return entries;
40639
+ };
38761
40640
 
38762
- // refresh context pad after split to
38763
- // get rid of split icons
38764
- contextPad.open(element, true);
38765
- };
38766
- }
40641
+ /**
40642
+ * Filter out entries from the options.
40643
+ *
40644
+ * @param {Array<Object>} entries
40645
+ *
40646
+ * @return {Array<Object>} filtered entries
40647
+ */
40648
+ AppendMenuProvider.prototype._filterEntries = function(entries) {
40649
+ return entries.filter(option => {
38767
40650
 
40651
+ const target = option.target;
40652
+ const {
40653
+ type,
40654
+ eventDefinitionType
40655
+ } = target;
40656
+
40657
+ if ([
40658
+ 'bpmn:StartEvent',
40659
+ 'bpmn:Participant'
40660
+ ].includes(type)) {
40661
+ return false;
40662
+ }
38768
40663
 
38769
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
40664
+ if (type === 'bpmn:BoundaryEvent' && isUndefined$2(eventDefinitionType)) {
40665
+ return false;
40666
+ }
38770
40667
 
38771
- var childLanes = getChildLanes(element);
40668
+ return true;
40669
+ });
40670
+ };
38772
40671
 
38773
- assign$1(actions, {
38774
- 'lane-insert-above': {
38775
- group: 'lane-insert-above',
38776
- className: 'bpmn-icon-lane-insert-above',
38777
- title: translate('Add Lane above'),
38778
- action: {
38779
- click: function(event, element) {
38780
- modeling.addLane(element, 'top');
38781
- }
38782
- }
38783
- }
38784
- });
40672
+ /**
40673
+ * Create an action for a given target.
40674
+ *
40675
+ * @param {djs.model.Base} element
40676
+ * @param {Object} target
40677
+ *
40678
+ * @return {Object}
40679
+ */
40680
+ AppendMenuProvider.prototype._createEntryAction = function(element, target) {
40681
+ const elementFactory = this._elementFactory;
40682
+ const autoPlace = this._autoPlace;
40683
+ const create = this._create;
40684
+ const mouse = this._mouse;
38785
40685
 
38786
- if (childLanes.length < 2) {
38787
40686
 
38788
- if (element.height >= 120) {
38789
- assign$1(actions, {
38790
- 'lane-divide-two': {
38791
- group: 'lane-divide',
38792
- className: 'bpmn-icon-lane-divide-two',
38793
- title: translate('Divide into two Lanes'),
38794
- action: {
38795
- click: splitLaneHandler(2)
38796
- }
38797
- }
38798
- });
38799
- }
40687
+ const autoPlaceElement = () => {
40688
+ const newElement = elementFactory.create('shape', target);
40689
+ autoPlace.append(element, newElement);
40690
+ };
38800
40691
 
38801
- if (element.height >= 180) {
38802
- assign$1(actions, {
38803
- 'lane-divide-three': {
38804
- group: 'lane-divide',
38805
- className: 'bpmn-icon-lane-divide-three',
38806
- title: translate('Divide into three Lanes'),
38807
- action: {
38808
- click: splitLaneHandler(3)
38809
- }
38810
- }
38811
- });
38812
- }
40692
+ const manualPlaceElement = (event) => {
40693
+ const newElement = elementFactory.create('shape', target);
40694
+
40695
+ if (event instanceof KeyboardEvent) {
40696
+ event = mouse.getLastMoveEvent();
38813
40697
  }
38814
40698
 
38815
- assign$1(actions, {
38816
- 'lane-insert-below': {
38817
- group: 'lane-insert-below',
38818
- className: 'bpmn-icon-lane-insert-below',
38819
- title: translate('Add Lane below'),
38820
- action: {
38821
- click: function(event, element) {
38822
- modeling.addLane(element, 'bottom');
38823
- }
38824
- }
38825
- }
38826
- });
40699
+ return create.start(event, newElement);
40700
+ };
40701
+
40702
+ return {
40703
+ click: this._canAutoPlaceElement(target) ? autoPlaceElement : manualPlaceElement,
40704
+ dragstart: manualPlaceElement
40705
+ };
40706
+ };
40707
+
40708
+ /**
40709
+ * Check if the element should be auto placed.
40710
+ *
40711
+ * @param {Object} target
40712
+ *
40713
+ * @return {Boolean}
40714
+ */
40715
+ AppendMenuProvider.prototype._canAutoPlaceElement = (target) => {
40716
+ const { type } = target;
38827
40717
 
40718
+ if (type === 'bpmn:BoundaryEvent') {
40719
+ return false;
38828
40720
  }
38829
40721
 
38830
- if (is$1(businessObject, 'bpmn:FlowNode')) {
40722
+ if (type === 'bpmn:SubProcess' && target.triggeredByEvent) {
40723
+ return false;
40724
+ }
38831
40725
 
38832
- if (is$1(businessObject, 'bpmn:EventBasedGateway')) {
40726
+ if (type === 'bpmn:IntermediateCatchEvent' && target.eventDefinitionType === 'bpmn:LinkEventDefinition') {
40727
+ return false;
40728
+ }
38833
40729
 
38834
- assign$1(actions, {
38835
- 'append.receive-task': appendAction(
38836
- 'bpmn:ReceiveTask',
38837
- 'bpmn-icon-receive-task',
38838
- translate('Append ReceiveTask')
38839
- ),
38840
- 'append.message-intermediate-event': appendAction(
38841
- 'bpmn:IntermediateCatchEvent',
38842
- 'bpmn-icon-intermediate-event-catch-message',
38843
- translate('Append MessageIntermediateCatchEvent'),
38844
- { eventDefinitionType: 'bpmn:MessageEventDefinition' }
38845
- ),
38846
- 'append.timer-intermediate-event': appendAction(
38847
- 'bpmn:IntermediateCatchEvent',
38848
- 'bpmn-icon-intermediate-event-catch-timer',
38849
- translate('Append TimerIntermediateCatchEvent'),
38850
- { eventDefinitionType: 'bpmn:TimerEventDefinition' }
38851
- ),
38852
- 'append.condition-intermediate-event': appendAction(
38853
- 'bpmn:IntermediateCatchEvent',
38854
- 'bpmn-icon-intermediate-event-catch-condition',
38855
- translate('Append ConditionIntermediateCatchEvent'),
38856
- { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
38857
- ),
38858
- 'append.signal-intermediate-event': appendAction(
38859
- 'bpmn:IntermediateCatchEvent',
38860
- 'bpmn-icon-intermediate-event-catch-signal',
38861
- translate('Append SignalIntermediateCatchEvent'),
38862
- { eventDefinitionType: 'bpmn:SignalEventDefinition' }
38863
- )
38864
- });
38865
- } else
40730
+ return true;
40731
+ };
38866
40732
 
38867
- if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
40733
+ var LOW_PRIORITY$h = 900;
38868
40734
 
38869
- assign$1(actions, {
38870
- 'append.compensation-activity':
38871
- appendAction(
38872
- 'bpmn:Task',
38873
- 'bpmn-icon-task',
38874
- translate('Append compensation activity'),
38875
- {
38876
- isForCompensation: true
38877
- }
38878
- )
38879
- });
38880
- } else
40735
+ /**
40736
+ * A provider for align elements context pad button
40737
+ */
40738
+ function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
40739
+ contextPad.registerProvider(LOW_PRIORITY$h, this);
38881
40740
 
38882
- if (!is$1(businessObject, 'bpmn:EndEvent') &&
38883
- !businessObject.isForCompensation &&
38884
- !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
38885
- !isEventSubProcess(businessObject)) {
40741
+ this._contextPad = contextPad;
40742
+ this._popupMenu = popupMenu;
40743
+ this._translate = translate;
40744
+ this._canvas = canvas;
40745
+ }
38886
40746
 
38887
- assign$1(actions, {
38888
- 'append.end-event': appendAction(
38889
- 'bpmn:EndEvent',
38890
- 'bpmn-icon-end-event-none',
38891
- translate('Append EndEvent')
38892
- ),
38893
- 'append.gateway': appendAction(
38894
- 'bpmn:ExclusiveGateway',
38895
- 'bpmn-icon-gateway-none',
38896
- translate('Append Gateway')
38897
- ),
38898
- 'append.append-task': appendAction(
38899
- 'bpmn:Task',
38900
- 'bpmn-icon-task',
38901
- translate('Append Task')
38902
- ),
38903
- 'append.intermediate-event': appendAction(
38904
- 'bpmn:IntermediateThrowEvent',
38905
- 'bpmn-icon-intermediate-event-none',
38906
- translate('Append Intermediate/Boundary Event')
38907
- )
38908
- });
38909
- }
38910
- }
40747
+ AppendContextPadProvider.$inject = [
40748
+ 'contextPad',
40749
+ 'popupMenu',
40750
+ 'translate',
40751
+ 'canvas'
40752
+ ];
38911
40753
 
38912
- if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
40754
+ AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
40755
+ const popupMenu = this._popupMenu;
40756
+ const translate = this._translate;
40757
+ const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
40758
+
40759
+ if (!popupMenu.isEmpty(element, 'bpmn-append')) {
38913
40760
 
38914
40761
  // Replace menu entry
38915
- assign$1(actions, {
38916
- 'replace': {
38917
- group: 'edit',
38918
- className: 'bpmn-icon-screw-wrench',
38919
- title: translate('Change type'),
40762
+ return {
40763
+ 'append': {
40764
+ group: 'model',
40765
+ imageUrl: appendIcon,
40766
+ title: translate('Append element'),
38920
40767
  action: {
38921
40768
  click: function(event, element) {
38922
40769
 
38923
- var position = assign$1(getReplaceMenuPosition(element), {
40770
+ var position = assign$1(getAppendMenuPosition(element), {
38924
40771
  cursor: { x: event.x, y: event.y }
38925
40772
  });
38926
40773
 
38927
- popupMenu.open(element, 'bpmn-replace', position, {
38928
- title: translate('Change element'),
40774
+ popupMenu.open(element, 'bpmn-append', position, {
40775
+ title: translate('Append element'),
38929
40776
  width: 300,
38930
40777
  search: true
38931
40778
  });
38932
40779
  }
38933
40780
  }
38934
40781
  }
38935
- });
40782
+ };
38936
40783
  }
40784
+ };
38937
40785
 
38938
- if (is$1(businessObject, 'bpmn:SequenceFlow')) {
38939
- assign$1(actions, {
38940
- 'append.text-annotation': appendAction(
38941
- 'bpmn:TextAnnotation',
38942
- 'bpmn-icon-text-annotation'
38943
- )
38944
- });
38945
- }
40786
+ AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
40787
+ const contextPad = this._contextPad;
38946
40788
 
38947
- if (
38948
- isAny(businessObject, [
38949
- 'bpmn:FlowNode',
38950
- 'bpmn:InteractionNode',
38951
- 'bpmn:DataObjectReference',
38952
- 'bpmn:DataStoreReference',
38953
- ])
38954
- ) {
38955
- assign$1(actions, {
38956
- 'append.text-annotation': appendAction(
38957
- 'bpmn:TextAnnotation',
38958
- 'bpmn-icon-text-annotation'
38959
- ),
40789
+ const X_OFFSET = 5;
38960
40790
 
38961
- 'connect': {
38962
- group: 'connect',
38963
- className: 'bpmn-icon-connection-multi',
38964
- title: translate(
38965
- 'Connect using ' +
38966
- (businessObject.isForCompensation
38967
- ? ''
38968
- : 'Sequence/MessageFlow or ') +
38969
- 'Association'
38970
- ),
38971
- action: {
38972
- click: startConnect,
38973
- dragstart: startConnect,
38974
- },
38975
- },
38976
- });
38977
- }
40791
+ const pad = contextPad.getPad(element).html;
38978
40792
 
38979
- if (is$1(businessObject, 'bpmn:TextAnnotation')) {
38980
- assign$1(actions, {
38981
- 'connect': {
38982
- group: 'connect',
38983
- className: 'bpmn-icon-connection-multi',
38984
- title: translate('Connect using Association'),
38985
- action: {
38986
- click: startConnect,
38987
- dragstart: startConnect,
38988
- },
38989
- },
38990
- });
38991
- }
40793
+ const padRect = pad.getBoundingClientRect();
38992
40794
 
38993
- if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
38994
- assign$1(actions, {
38995
- 'connect': {
38996
- group: 'connect',
38997
- className: 'bpmn-icon-connection-multi',
38998
- title: translate('Connect using DataInputAssociation'),
38999
- action: {
39000
- click: startConnect,
39001
- dragstart: startConnect
39002
- }
39003
- }
39004
- });
39005
- }
40795
+ const pos = {
40796
+ x: padRect.right + X_OFFSET,
40797
+ y: padRect.top
40798
+ };
39006
40799
 
39007
- if (is$1(businessObject, 'bpmn:Group')) {
39008
- assign$1(actions, {
39009
- 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39010
- });
39011
- }
40800
+ return pos;
40801
+ };
39012
40802
 
39013
- // delete element entry, only show if allowed by rules
39014
- var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
40803
+ /**
40804
+ * Append anything modeling rules
40805
+ */
40806
+ function AppendRules(eventBus) {
40807
+ RuleProvider.call(this, eventBus);
40808
+ }
39015
40809
 
39016
- if (isArray$3(deleteAllowed)) {
40810
+ e$3(AppendRules, RuleProvider);
39017
40811
 
39018
- // was the element returned as a deletion candidate?
39019
- deleteAllowed = deleteAllowed[0] === element;
39020
- }
40812
+ AppendRules.$inject = [
40813
+ 'eventBus'
40814
+ ];
39021
40815
 
39022
- if (deleteAllowed) {
39023
- assign$1(actions, {
39024
- 'delete': {
39025
- group: 'edit',
39026
- className: 'bpmn-icon-trash',
39027
- title: translate('Remove'),
39028
- action: {
39029
- click: removeElement
39030
- }
39031
- }
39032
- });
39033
- }
40816
+ AppendRules.prototype.init = function() {
40817
+ this.addRule('shape.append', function(context) {
39034
40818
 
39035
- return actions;
39036
- };
40819
+ var source = context.element;
39037
40820
 
40821
+ const businessObject = getBusinessObject(source);
39038
40822
 
39039
- // helpers /////////
40823
+ if (isLabel$6(source)) {
40824
+ return false;
40825
+ }
39040
40826
 
39041
- function isEventType(eventBo, type, definition) {
40827
+ if (isAny(source, [
40828
+ 'bpmn:EndEvent',
40829
+ 'bpmn:Group',
40830
+ 'bpmn:TextAnnotation',
40831
+ 'bpmn:Lane',
40832
+ 'bpmn:Participant',
40833
+ 'bpmn:DataStoreReference',
40834
+ 'bpmn:DataObjectReference'
40835
+ ])) {
40836
+ return false;
40837
+ }
39042
40838
 
39043
- var isType = eventBo.$instanceOf(type);
39044
- var isDefinition = false;
40839
+ if (isConnection$b(source)) {
40840
+ return false;
40841
+ }
39045
40842
 
39046
- var definitions = eventBo.eventDefinitions || [];
39047
- forEach$1(definitions, function(def) {
39048
- if (def.$type === definition) {
39049
- isDefinition = true;
40843
+ if (is$1(source, 'bpmn:IntermediateThrowEvent') && hasEventDefinition$1(source, 'bpmn:LinkEventDefinition')) {
40844
+ return false;
40845
+ }
40846
+
40847
+ if (is$1(source, 'bpmn:SubProcess') && businessObject.triggeredByEvent) {
40848
+ return false;
39050
40849
  }
39051
40850
  });
39052
40851
 
39053
- return isType && isDefinition;
40852
+ };
40853
+
40854
+
40855
+ // helpers //////////////
40856
+ function hasEventDefinition$1(element, eventDefinition) {
40857
+ var bo = getBusinessObject(element);
40858
+
40859
+ return !!find(bo.eventDefinitions || [], function(definition) {
40860
+ return is$1(definition, eventDefinition);
40861
+ });
39054
40862
  }
39055
40863
 
39056
- function includes$7(array, item) {
39057
- return array.indexOf(item) !== -1;
40864
+ function isConnection$b(element) {
40865
+ return element.waypoints;
39058
40866
  }
39059
40867
 
39060
- var ContextPadModule = {
40868
+ var CreateAppendAnythingModule = {
39061
40869
  __depends__: [
39062
- DirectEditingModule,
39063
- ContextPadModule$1,
39064
- SelectionModule,
39065
- ConnectModule,
39066
- CreateModule,
39067
- PopupMenuModule
40870
+ PaletteModule$1,
40871
+ PopupMenuModule$1,
40872
+ AutoPlaceModule$1,
40873
+ ContextPadModule$1
39068
40874
  ],
39069
- __init__: [ 'contextPadProvider' ],
39070
- contextPadProvider: [ 'type', ContextPadProvider ]
40875
+ __init__: [
40876
+ 'createMenuProvider',
40877
+ 'createPaletteProvider',
40878
+ 'createAppendEditorActions',
40879
+ 'createAppendKeyboardBindings',
40880
+ 'appendMenuProvider',
40881
+ 'appendContextPadProvider',
40882
+ 'appendRules'
40883
+ ],
40884
+ createMenuProvider: [ 'type', CreateMenuProvider ],
40885
+ createPaletteProvider: [ 'type', CreatePaletteProvider ],
40886
+ createAppendEditorActions: [ 'type', CreateAppendEditorActions ],
40887
+ createAppendKeyboardBindings: [ 'type', CreateAppendKeyboardBindings ],
40888
+ appendMenuProvider: [ 'type', AppendMenuProvider ],
40889
+ appendContextPadProvider: [ 'type', AppendContextPadProvider ],
40890
+ appendRules: [ 'type', AppendRules ]
39071
40891
  };
39072
40892
 
39073
40893
  var AXIS_DIMENSIONS = {
@@ -46520,7 +48340,7 @@
46520
48340
  }
46521
48341
 
46522
48342
  return some(types, function(type) {
46523
- return hasEventDefinition$2(element, type);
48343
+ return hasEventDefinition$3(element, type);
46524
48344
  });
46525
48345
  }
46526
48346
 
@@ -52478,6 +54298,16 @@
52478
54298
  di.isMarkerVisible = true;
52479
54299
  }
52480
54300
 
54301
+ if (isDefined(attrs.triggeredByEvent)) {
54302
+ businessObject.triggeredByEvent = attrs.triggeredByEvent;
54303
+ delete attrs.triggeredByEvent;
54304
+ }
54305
+
54306
+ if (isDefined(attrs.cancelActivity)) {
54307
+ businessObject.cancelActivity = attrs.cancelActivity;
54308
+ delete attrs.cancelActivity;
54309
+ }
54310
+
52481
54311
  var eventDefinitions,
52482
54312
  newEventDefinition;
52483
54313
 
@@ -52667,22 +54497,22 @@
52667
54497
  y: 0
52668
54498
  };
52669
54499
 
52670
- if (alignment.left) {
54500
+ if (isDefined(alignment.left)) {
52671
54501
  delta.x = alignment.left - element.x;
52672
54502
 
52673
- } else if (alignment.right) {
54503
+ } else if (isDefined(alignment.right)) {
52674
54504
  delta.x = (alignment.right - element.width) - element.x;
52675
54505
 
52676
- } else if (alignment.center) {
54506
+ } else if (isDefined(alignment.center)) {
52677
54507
  delta.x = (alignment.center - Math.round(element.width / 2)) - element.x;
52678
54508
 
52679
- } else if (alignment.top) {
54509
+ } else if (isDefined(alignment.top)) {
52680
54510
  delta.y = alignment.top - element.y;
52681
54511
 
52682
- } else if (alignment.bottom) {
54512
+ } else if (isDefined(alignment.bottom)) {
52683
54513
  delta.y = (alignment.bottom - element.height) - element.y;
52684
54514
 
52685
- } else if (alignment.middle) {
54515
+ } else if (isDefined(alignment.middle)) {
52686
54516
  delta.y = (alignment.middle - Math.round(element.height / 2)) - element.y;
52687
54517
  }
52688
54518
 
@@ -58096,464 +59926,6 @@
58096
59926
  movePreview: [ 'type', MovePreview ]
58097
59927
  };
58098
59928
 
58099
- var TOGGLE_SELECTOR = '.djs-palette-toggle',
58100
- ENTRY_SELECTOR = '.entry',
58101
- ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
58102
-
58103
- var PALETTE_PREFIX = 'djs-palette-',
58104
- PALETTE_SHOWN_CLS = 'shown',
58105
- PALETTE_OPEN_CLS = 'open',
58106
- PALETTE_TWO_COLUMN_CLS = 'two-column';
58107
-
58108
- var DEFAULT_PRIORITY = 1000;
58109
-
58110
-
58111
- /**
58112
- * A palette containing modeling elements.
58113
- */
58114
- function Palette(eventBus, canvas) {
58115
-
58116
- this._eventBus = eventBus;
58117
- this._canvas = canvas;
58118
-
58119
- var self = this;
58120
-
58121
- eventBus.on('tool-manager.update', function(event) {
58122
- var tool = event.tool;
58123
-
58124
- self.updateToolHighlight(tool);
58125
- });
58126
-
58127
- eventBus.on('i18n.changed', function() {
58128
- self._update();
58129
- });
58130
-
58131
- eventBus.on('diagram.init', function() {
58132
-
58133
- self._diagramInitialized = true;
58134
-
58135
- self._rebuild();
58136
- });
58137
- }
58138
-
58139
- Palette.$inject = [ 'eventBus', 'canvas' ];
58140
-
58141
-
58142
- /**
58143
- * Register a provider with the palette
58144
- *
58145
- * @param {number} [priority=1000]
58146
- * @param {PaletteProvider} provider
58147
- *
58148
- * @example
58149
- * const paletteProvider = {
58150
- * getPaletteEntries: function() {
58151
- * return function(entries) {
58152
- * return {
58153
- * ...entries,
58154
- * 'entry-1': {
58155
- * label: 'My Entry',
58156
- * action: function() { alert("I have been clicked!"); }
58157
- * }
58158
- * };
58159
- * }
58160
- * }
58161
- * };
58162
- *
58163
- * palette.registerProvider(800, paletteProvider);
58164
- */
58165
- Palette.prototype.registerProvider = function(priority, provider) {
58166
- if (!provider) {
58167
- provider = priority;
58168
- priority = DEFAULT_PRIORITY;
58169
- }
58170
-
58171
- this._eventBus.on('palette.getProviders', priority, function(event) {
58172
- event.providers.push(provider);
58173
- });
58174
-
58175
- this._rebuild();
58176
- };
58177
-
58178
-
58179
- /**
58180
- * Returns the palette entries
58181
- *
58182
- * @return {Object<string, PaletteEntryDescriptor>} map of entries
58183
- */
58184
- Palette.prototype.getEntries = function() {
58185
- var providers = this._getProviders();
58186
-
58187
- return providers.reduce(addPaletteEntries, {});
58188
- };
58189
-
58190
- Palette.prototype._rebuild = function() {
58191
-
58192
- if (!this._diagramInitialized) {
58193
- return;
58194
- }
58195
-
58196
- var providers = this._getProviders();
58197
-
58198
- if (!providers.length) {
58199
- return;
58200
- }
58201
-
58202
- if (!this._container) {
58203
- this._init();
58204
- }
58205
-
58206
- this._update();
58207
- };
58208
-
58209
- /**
58210
- * Initialize
58211
- */
58212
- Palette.prototype._init = function() {
58213
-
58214
- var self = this;
58215
-
58216
- var eventBus = this._eventBus;
58217
-
58218
- var parentContainer = this._getParentContainer();
58219
-
58220
- var container = this._container = domify$1(Palette.HTML_MARKUP);
58221
-
58222
- parentContainer.appendChild(container);
58223
- classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
58224
-
58225
- delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
58226
-
58227
- var target = event.delegateTarget;
58228
-
58229
- if (matches(target, TOGGLE_SELECTOR)) {
58230
- return self.toggle();
58231
- }
58232
-
58233
- self.trigger('click', event);
58234
- });
58235
-
58236
- // prevent drag propagation
58237
- event.bind(container, 'mousedown', function(event) {
58238
- event.stopPropagation();
58239
- });
58240
-
58241
- // prevent drag propagation
58242
- delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
58243
- self.trigger('dragstart', event);
58244
- });
58245
-
58246
- eventBus.on('canvas.resized', this._layoutChanged, this);
58247
-
58248
- eventBus.fire('palette.create', {
58249
- container: container
58250
- });
58251
- };
58252
-
58253
- Palette.prototype._getProviders = function(id) {
58254
-
58255
- var event = this._eventBus.createEvent({
58256
- type: 'palette.getProviders',
58257
- providers: []
58258
- });
58259
-
58260
- this._eventBus.fire(event);
58261
-
58262
- return event.providers;
58263
- };
58264
-
58265
- /**
58266
- * Update palette state.
58267
- *
58268
- * @param {Object} [state] { open, twoColumn }
58269
- */
58270
- Palette.prototype._toggleState = function(state) {
58271
-
58272
- state = state || {};
58273
-
58274
- var parent = this._getParentContainer(),
58275
- container = this._container;
58276
-
58277
- var eventBus = this._eventBus;
58278
-
58279
- var twoColumn;
58280
-
58281
- var cls = classes$1(container),
58282
- parentCls = classes$1(parent);
58283
-
58284
- if ('twoColumn' in state) {
58285
- twoColumn = state.twoColumn;
58286
- } else {
58287
- twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
58288
- }
58289
-
58290
- // always update two column
58291
- cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
58292
- parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
58293
-
58294
- if ('open' in state) {
58295
- cls.toggle(PALETTE_OPEN_CLS, state.open);
58296
- parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
58297
- }
58298
-
58299
- eventBus.fire('palette.changed', {
58300
- twoColumn: twoColumn,
58301
- open: this.isOpen()
58302
- });
58303
- };
58304
-
58305
- Palette.prototype._update = function() {
58306
-
58307
- var entriesContainer = query('.djs-palette-entries', this._container),
58308
- entries = this._entries = this.getEntries();
58309
-
58310
- clear$1(entriesContainer);
58311
-
58312
- forEach$1(entries, function(entry, id) {
58313
-
58314
- var grouping = entry.group || 'default';
58315
-
58316
- var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
58317
- if (!container) {
58318
- container = domify$1('<div class="group"></div>');
58319
- attr$1(container, 'data-group', grouping);
58320
-
58321
- entriesContainer.appendChild(container);
58322
- }
58323
-
58324
- var html = entry.html || (
58325
- entry.separator ?
58326
- '<hr class="separator" />' :
58327
- '<div class="entry" draggable="true"></div>');
58328
-
58329
-
58330
- var control = domify$1(html);
58331
- container.appendChild(control);
58332
-
58333
- if (!entry.separator) {
58334
- attr$1(control, 'data-action', id);
58335
-
58336
- if (entry.title) {
58337
- attr$1(control, 'title', entry.title);
58338
- }
58339
-
58340
- if (entry.className) {
58341
- addClasses(control, entry.className);
58342
- }
58343
-
58344
- if (entry.imageUrl) {
58345
- var image = domify$1('<img>');
58346
- attr$1(image, 'src', entry.imageUrl);
58347
-
58348
- control.appendChild(image);
58349
- }
58350
- }
58351
- });
58352
-
58353
- // open after update
58354
- this.open();
58355
- };
58356
-
58357
-
58358
- /**
58359
- * Trigger an action available on the palette
58360
- *
58361
- * @param {string} action
58362
- * @param {Event} event
58363
- */
58364
- Palette.prototype.trigger = function(action, event, autoActivate) {
58365
- var entries = this._entries,
58366
- entry,
58367
- handler,
58368
- originalEvent,
58369
- button = event.delegateTarget || event.target;
58370
-
58371
- if (!button) {
58372
- return event.preventDefault();
58373
- }
58374
-
58375
- entry = entries[attr$1(button, 'data-action')];
58376
-
58377
- // when user clicks on the palette and not on an action
58378
- if (!entry) {
58379
- return;
58380
- }
58381
-
58382
- handler = entry.action;
58383
-
58384
- originalEvent = event.originalEvent || event;
58385
-
58386
- // simple action (via callback function)
58387
- if (isFunction(handler)) {
58388
- if (action === 'click') {
58389
- handler(originalEvent, autoActivate);
58390
- }
58391
- } else {
58392
- if (handler[action]) {
58393
- handler[action](originalEvent, autoActivate);
58394
- }
58395
- }
58396
-
58397
- // silence other actions
58398
- event.preventDefault();
58399
- };
58400
-
58401
- Palette.prototype._layoutChanged = function() {
58402
- this._toggleState({});
58403
- };
58404
-
58405
- /**
58406
- * Do we need to collapse to two columns?
58407
- *
58408
- * @param {number} availableHeight
58409
- * @param {Object} entries
58410
- *
58411
- * @return {boolean}
58412
- */
58413
- Palette.prototype._needsCollapse = function(availableHeight, entries) {
58414
-
58415
- // top margin + bottom toggle + bottom margin
58416
- // implementors must override this method if they
58417
- // change the palette styles
58418
- var margin = 20 + 10 + 20;
58419
-
58420
- var entriesHeight = Object.keys(entries).length * 46;
58421
-
58422
- return availableHeight < entriesHeight + margin;
58423
- };
58424
-
58425
- /**
58426
- * Close the palette
58427
- */
58428
- Palette.prototype.close = function() {
58429
-
58430
- this._toggleState({
58431
- open: false,
58432
- twoColumn: false
58433
- });
58434
- };
58435
-
58436
-
58437
- /**
58438
- * Open the palette
58439
- */
58440
- Palette.prototype.open = function() {
58441
- this._toggleState({ open: true });
58442
- };
58443
-
58444
-
58445
- Palette.prototype.toggle = function(open) {
58446
- if (this.isOpen()) {
58447
- this.close();
58448
- } else {
58449
- this.open();
58450
- }
58451
- };
58452
-
58453
- Palette.prototype.isActiveTool = function(tool) {
58454
- return tool && this._activeTool === tool;
58455
- };
58456
-
58457
- Palette.prototype.updateToolHighlight = function(name) {
58458
- var entriesContainer,
58459
- toolsContainer;
58460
-
58461
- if (!this._toolsContainer) {
58462
- entriesContainer = query('.djs-palette-entries', this._container);
58463
-
58464
- this._toolsContainer = query('[data-group=tools]', entriesContainer);
58465
- }
58466
-
58467
- toolsContainer = this._toolsContainer;
58468
-
58469
- forEach$1(toolsContainer.children, function(tool) {
58470
- var actionName = tool.getAttribute('data-action');
58471
-
58472
- if (!actionName) {
58473
- return;
58474
- }
58475
-
58476
- var toolClasses = classes$1(tool);
58477
-
58478
- actionName = actionName.replace('-tool', '');
58479
-
58480
- if (toolClasses.contains('entry') && actionName === name) {
58481
- toolClasses.add('highlighted-entry');
58482
- } else {
58483
- toolClasses.remove('highlighted-entry');
58484
- }
58485
- });
58486
- };
58487
-
58488
-
58489
- /**
58490
- * Return true if the palette is opened.
58491
- *
58492
- * @example
58493
- *
58494
- * palette.open();
58495
- *
58496
- * if (palette.isOpen()) {
58497
- * // yes, we are open
58498
- * }
58499
- *
58500
- * @return {boolean} true if palette is opened
58501
- */
58502
- Palette.prototype.isOpen = function() {
58503
- return classes$1(this._container).has(PALETTE_OPEN_CLS);
58504
- };
58505
-
58506
- /**
58507
- * Get container the palette lives in.
58508
- *
58509
- * @return {Element}
58510
- */
58511
- Palette.prototype._getParentContainer = function() {
58512
- return this._canvas.getContainer();
58513
- };
58514
-
58515
-
58516
- /* markup definition */
58517
-
58518
- Palette.HTML_MARKUP =
58519
- '<div class="djs-palette">' +
58520
- '<div class="djs-palette-entries"></div>' +
58521
- '<div class="djs-palette-toggle"></div>' +
58522
- '</div>';
58523
-
58524
-
58525
- // helpers //////////////////////
58526
-
58527
- function addClasses(element, classNames) {
58528
-
58529
- var classes = classes$1(element);
58530
-
58531
- var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
58532
- actualClassNames.forEach(function(cls) {
58533
- classes.add(cls);
58534
- });
58535
- }
58536
-
58537
- function addPaletteEntries(entries, provider) {
58538
-
58539
- var entriesOrUpdater = provider.getPaletteEntries();
58540
-
58541
- if (isFunction(entriesOrUpdater)) {
58542
- return entriesOrUpdater(entries);
58543
- }
58544
-
58545
- forEach$1(entriesOrUpdater, function(entry, id) {
58546
- entries[id] = entry;
58547
- });
58548
-
58549
- return entries;
58550
- }
58551
-
58552
- var PaletteModule$1 = {
58553
- __init__: [ 'palette' ],
58554
- palette: [ 'type', Palette ]
58555
- };
58556
-
58557
59929
  var LASSO_TOOL_CURSOR = 'crosshair';
58558
59930
 
58559
59931
 
@@ -61334,6 +62706,7 @@
61334
62706
  ContextPadModule,
61335
62707
  CopyPasteModule,
61336
62708
  CreateModule,
62709
+ CreateAppendAnythingModule,
61337
62710
  DistributeElementsModule,
61338
62711
  EditorActionsModule,
61339
62712
  GridSnappingModule,