bpmn-js 11.1.1 → 11.3.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 +6 -3
  11. package/dist/bpmn-modeler.development.js +2580 -1183
  12. package/dist/bpmn-modeler.production.min.js +51 -49
  13. package/dist/bpmn-navigated-viewer.development.js +317 -218
  14. package/dist/bpmn-navigated-viewer.production.min.js +6 -6
  15. package/dist/bpmn-viewer.development.js +317 -218
  16. package/dist/bpmn-viewer.production.min.js +6 -6
  17. package/lib/BaseModeler.js +6 -2
  18. package/lib/BaseViewer.js +16 -4
  19. package/lib/Modeler.js +8 -2
  20. package/lib/Viewer.js +6 -2
  21. package/lib/draw/BpmnRenderer.js +185 -196
  22. package/lib/features/context-pad/ContextPadProvider.js +0 -1
  23. package/lib/features/create-append-anything/AppendContextPadProvider.js +77 -0
  24. package/lib/features/create-append-anything/AppendMenuProvider.js +177 -0
  25. package/lib/features/create-append-anything/AppendRules.js +83 -0
  26. package/lib/features/create-append-anything/CreateAppendEditorActions.js +51 -0
  27. package/lib/features/create-append-anything/CreateAppendKeyboardBindings.js +97 -0
  28. package/lib/features/create-append-anything/CreateMenuProvider.js +114 -0
  29. package/lib/features/create-append-anything/CreatePaletteProvider.js +76 -0
  30. package/lib/features/create-append-anything/index.js +37 -0
  31. package/lib/features/create-append-anything/util/OptionsUtil.js +617 -0
  32. package/lib/features/editor-actions/BpmnEditorActions.js +0 -1
  33. package/lib/features/modeling/ElementFactory.js +11 -0
  34. package/lib/features/popup-menu/ReplaceMenuProvider.js +7 -2
  35. package/lib/features/popup-menu/index.js +6 -3
  36. package/lib/features/replace/ReplaceOptions.js +16 -16
  37. package/lib/icons/Icons.js +11 -0
  38. package/lib/icons/dist/append.svg +1 -0
  39. package/lib/icons/dist/connect-context-pad.svg +1 -0
  40. package/lib/icons/dist/connect-palette.svg +1 -0
  41. package/lib/icons/dist/create.svg +1 -0
  42. package/lib/icons/resources/append.svg +3 -0
  43. package/lib/icons/resources/create.svg +3 -0
  44. package/package.json +19 -6
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v11.1.1
2
+ * bpmn-js - bpmn-modeler v11.3.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: 2023-01-06
11
+ * Date: 2023-02-07
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2574,34 +2574,128 @@
2574
2574
  */
2575
2575
  BaseRenderer.prototype.getConnectionPath = function() {};
2576
2576
 
2577
+ /**
2578
+ * @param { [ string, ...any[] ][] } elements
2579
+ *
2580
+ * @return { string }
2581
+ */
2577
2582
  function componentsToPath(elements) {
2578
- return elements.join(',').replace(/,?([A-z]),?/g, '$1');
2583
+ return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
2584
+ }
2585
+
2586
+ function move(point) {
2587
+ return [ 'M', point.x, point.y ];
2579
2588
  }
2580
2589
 
2581
- function toSVGPoints(points) {
2582
- var result = '';
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));
2583
2623
 
2584
- for (var i = 0, p; (p = points[i]); i++) {
2585
- 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));
2586
2635
  }
2587
2636
 
2588
- return result;
2637
+ return path;
2589
2638
  }
2590
2639
 
2591
- function createLine(points, attrs) {
2640
+ function getPointAtLength(start, end, length) {
2592
2641
 
2593
- var line = create$1('polyline');
2594
- attr(line, { points: toSVGPoints(points) });
2642
+ const deltaX = end.x - start.x;
2643
+ const deltaY = end.y - start.y;
2595
2644
 
2596
- if (attrs) {
2597
- 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;
2598
2671
  }
2599
2672
 
2600
- 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);
2601
2684
  }
2602
2685
 
2686
+ /**
2687
+ * @param { SVGElement } gfx
2688
+ * @param { { x: number, y: number }[]} points
2689
+ *
2690
+ * @return {SVGElement}
2691
+ */
2603
2692
  function updateLine(gfx, points) {
2604
- 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
+ });
2605
2699
 
2606
2700
  return gfx;
2607
2701
  }
@@ -3262,65 +3356,42 @@
3262
3356
  /**
3263
3357
  * Check whether two points are horizontally or vertically aligned.
3264
3358
  *
3265
- * @param {Array<Point>|Point}
3266
- * @param {Point}
3359
+ * @param {Point[]|Point} a
3360
+ * @param {Point} [b]
3267
3361
  *
3268
- * @return {string|boolean}
3362
+ * @return {'h'|'v'|false} axis or false
3269
3363
  */
3270
3364
  function pointsAligned(a, b) {
3271
- var points;
3365
+ var points = Array.from(arguments).flat();
3272
3366
 
3273
- if (isArray$3(a)) {
3274
- points = a;
3275
- } else {
3276
- points = [ a, b ];
3277
- }
3278
-
3279
- if (pointsAlignedHorizontally(points)) {
3280
- return 'h';
3281
- }
3367
+ const axisMap = {
3368
+ 'x': 'v',
3369
+ 'y': 'h'
3370
+ };
3282
3371
 
3283
- if (pointsAlignedVertically(points)) {
3284
- return 'v';
3372
+ for (const [ axis, orientation ] of Object.entries(axisMap)) {
3373
+ if (pointsAlignedOnAxis(axis, points)) {
3374
+ return orientation;
3375
+ }
3285
3376
  }
3286
3377
 
3287
3378
  return false;
3288
3379
  }
3289
3380
 
3290
- function pointsAlignedHorizontally(a, b) {
3291
- var points;
3292
-
3293
- if (isArray$3(a)) {
3294
- points = a;
3295
- } else {
3296
- points = [ a, b ];
3297
- }
3298
-
3299
- var firstPoint = points.slice().shift();
3300
-
3301
- return every(points, function(point) {
3302
- return Math.abs(firstPoint.y - point.y) <= ALIGNED_THRESHOLD;
3303
- });
3304
- }
3305
-
3306
- function pointsAlignedVertically(a, b) {
3307
- var points;
3308
-
3309
- if (isArray$3(a)) {
3310
- points = a;
3311
- } else {
3312
- points = [ a, b ];
3313
- }
3314
-
3315
- 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];
3316
3389
 
3317
3390
  return every(points, function(point) {
3318
- return Math.abs(firstPoint.x - point.x) <= ALIGNED_THRESHOLD;
3391
+ return Math.abs(referencePoint[axis] - point[axis]) <= ALIGNED_THRESHOLD;
3319
3392
  });
3320
3393
  }
3321
3394
 
3322
-
3323
-
3324
3395
  /**
3325
3396
  * Returns true if the point p is inside the rectangle rect
3326
3397
  *
@@ -4423,7 +4494,7 @@
4423
4494
  * @return {Point}
4424
4495
  */
4425
4496
  function getMid(element) {
4426
- if (isConnection$f(element)) {
4497
+ if (isConnection$g(element)) {
4427
4498
  return getConnectionMid(element);
4428
4499
  }
4429
4500
 
@@ -4563,7 +4634,7 @@
4563
4634
  return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
4564
4635
  }
4565
4636
 
4566
- function isConnection$f(element) {
4637
+ function isConnection$g(element) {
4567
4638
  return !!element.waypoints;
4568
4639
  }
4569
4640
 
@@ -16222,6 +16293,11 @@
16222
16293
  * @see http://bpmn.io/license for more information.
16223
16294
  */
16224
16295
 
16296
+
16297
+ /**
16298
+ * @typedef { import('didi').ModuleDeclaration } Module
16299
+ */
16300
+
16225
16301
  /**
16226
16302
  * A base viewer for BPMN 2.0 diagrams.
16227
16303
  *
@@ -16233,8 +16309,8 @@
16233
16309
  * @param {string|number} [options.width] the width of the viewer
16234
16310
  * @param {string|number} [options.height] the height of the viewer
16235
16311
  * @param {Object} [options.moddleExtensions] extension packages to provide
16236
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
16237
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
16312
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
16313
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
16238
16314
  */
16239
16315
  function BaseViewer(options) {
16240
16316
 
@@ -16663,7 +16739,14 @@
16663
16739
  this._definitions = definitions;
16664
16740
  };
16665
16741
 
16666
- BaseViewer.prototype.getModules = function() {
16742
+ /**
16743
+ * Return modules to instantiate with.
16744
+ *
16745
+ * @param {any} options the instance got created with
16746
+ *
16747
+ * @return {Module[]}
16748
+ */
16749
+ BaseViewer.prototype.getModules = function(options) {
16667
16750
  return this._modules;
16668
16751
  };
16669
16752
 
@@ -16769,7 +16852,7 @@
16769
16852
 
16770
16853
  BaseViewer.prototype._init = function(container, moddle, options) {
16771
16854
 
16772
- const baseModules = options.modules || this.getModules(),
16855
+ const baseModules = options.modules || this.getModules(options),
16773
16856
  additionalModules = options.additionalModules || [],
16774
16857
  staticModules = [
16775
16858
  {
@@ -16924,6 +17007,10 @@
16924
17007
 
16925
17008
  /* </project-logo> */
16926
17009
 
17010
+ /**
17011
+ * @typedef { import('didi').ModuleDeclaration } Module
17012
+ */
17013
+
16927
17014
  /**
16928
17015
  * A base modeler for BPMN 2.0 diagrams.
16929
17016
  *
@@ -16934,8 +17021,8 @@
16934
17021
  * @param {string|number} [options.width] the width of the viewer
16935
17022
  * @param {string|number} [options.height] the height of the viewer
16936
17023
  * @param {Object} [options.moddleExtensions] extension packages to provide
16937
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
16938
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
17024
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
17025
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
16939
17026
  */
16940
17027
  function BaseModeler(options) {
16941
17028
  BaseViewer.call(this, options);
@@ -17023,7 +17110,7 @@
17023
17110
  return element && !!getBusinessObject(element).triggeredByEvent;
17024
17111
  }
17025
17112
 
17026
- function hasEventDefinition$2(element, eventType) {
17113
+ function hasEventDefinition$3(element, eventType) {
17027
17114
  var bo = getBusinessObject(element),
17028
17115
  hasEventDefinition = false;
17029
17116
 
@@ -17039,15 +17126,15 @@
17039
17126
  }
17040
17127
 
17041
17128
  function hasErrorEventDefinition(element) {
17042
- return hasEventDefinition$2(element, 'bpmn:ErrorEventDefinition');
17129
+ return hasEventDefinition$3(element, 'bpmn:ErrorEventDefinition');
17043
17130
  }
17044
17131
 
17045
17132
  function hasEscalationEventDefinition(element) {
17046
- return hasEventDefinition$2(element, 'bpmn:EscalationEventDefinition');
17133
+ return hasEventDefinition$3(element, 'bpmn:EscalationEventDefinition');
17047
17134
  }
17048
17135
 
17049
17136
  function hasCompensateEventDefinition(element) {
17050
- return hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
17137
+ return hasEventDefinition$3(element, 'bpmn:CompensateEventDefinition');
17051
17138
  }
17052
17139
 
17053
17140
  function getLabelAttr(semantic) {
@@ -17282,33 +17369,33 @@
17282
17369
 
17283
17370
  var markers = {};
17284
17371
 
17285
- var computeStyle = styles.computeStyle;
17286
-
17287
- function addMarker(id, options) {
17288
- var attrs = assign$1({
17289
- fill: black,
17290
- strokeWidth: 1,
17372
+ function shapeStyle(attrs) {
17373
+ return styles.computeStyle(attrs, {
17291
17374
  strokeLinecap: 'round',
17292
- strokeDasharray: 'none'
17293
- }, options.attrs);
17294
-
17295
- var ref = options.ref || { x: 0, y: 0 };
17296
-
17297
- var scale = options.scale || 1;
17298
-
17299
- // fix for safari / chrome / firefox bug not correctly
17300
- // resetting stroke dash array
17301
- if (attrs.strokeDasharray === 'none') {
17302
- attrs.strokeDasharray = [ 10000, 1 ];
17303
- }
17304
-
17305
- var marker = create$1('marker');
17375
+ strokeLinejoin: 'round',
17376
+ stroke: black,
17377
+ strokeWidth: 2,
17378
+ fill: 'white'
17379
+ });
17380
+ }
17306
17381
 
17307
- attr(options.element, attrs);
17382
+ function lineStyle(attrs) {
17383
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
17384
+ strokeLinecap: 'round',
17385
+ strokeLinejoin: 'round',
17386
+ stroke: black,
17387
+ strokeWidth: 2
17388
+ });
17389
+ }
17308
17390
 
17309
- append(marker, options.element);
17391
+ function addMarker(id, options) {
17392
+ var {
17393
+ ref = { x: 0, y: 0 },
17394
+ scale = 1,
17395
+ element
17396
+ } = options;
17310
17397
 
17311
- attr(marker, {
17398
+ var marker = create$1('marker', {
17312
17399
  id: id,
17313
17400
  viewBox: '0 0 20 20',
17314
17401
  refX: ref.x,
@@ -17318,6 +17405,8 @@
17318
17405
  orient: 'auto'
17319
17406
  });
17320
17407
 
17408
+ append(marker, element);
17409
+
17321
17410
  var defs = query('defs', canvas._svg);
17322
17411
 
17323
17412
  if (!defs) {
@@ -17350,105 +17439,116 @@
17350
17439
  function createMarker(id, type, fill, stroke) {
17351
17440
 
17352
17441
  if (type === 'sequenceflow-end') {
17353
- var sequenceflowEnd = create$1('path');
17354
- attr(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
17442
+ var sequenceflowEnd = create$1('path', {
17443
+ d: 'M 1 5 L 11 10 L 1 15 Z',
17444
+ ...shapeStyle({
17445
+ fill: stroke,
17446
+ stroke: stroke,
17447
+ strokeWidth: 1
17448
+ })
17449
+ });
17355
17450
 
17356
17451
  addMarker(id, {
17357
17452
  element: sequenceflowEnd,
17358
17453
  ref: { x: 11, y: 10 },
17359
- scale: 0.5,
17360
- attrs: {
17361
- fill: stroke,
17362
- stroke: stroke
17363
- }
17454
+ scale: 0.5
17364
17455
  });
17365
17456
  }
17366
17457
 
17367
17458
  if (type === 'messageflow-start') {
17368
- var messageflowStart = create$1('circle');
17369
- attr(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
17459
+ var messageflowStart = create$1('circle', {
17460
+ cx: 6,
17461
+ cy: 6,
17462
+ r: 3.5,
17463
+ ...shapeStyle({
17464
+ fill: fill,
17465
+ stroke: stroke,
17466
+ strokeWidth: 1
17467
+ })
17468
+ });
17370
17469
 
17371
17470
  addMarker(id, {
17372
17471
  element: messageflowStart,
17373
- attrs: {
17374
- fill: fill,
17375
- stroke: stroke
17376
- },
17377
17472
  ref: { x: 6, y: 6 }
17378
17473
  });
17379
17474
  }
17380
17475
 
17381
17476
  if (type === 'messageflow-end') {
17382
- var messageflowEnd = create$1('path');
17383
- attr(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
17477
+ var messageflowEnd = create$1('path', {
17478
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
17479
+ ...shapeStyle({
17480
+ fill: fill,
17481
+ stroke: stroke,
17482
+ strokeWidth: 1
17483
+ })
17484
+ });
17384
17485
 
17385
17486
  addMarker(id, {
17386
17487
  element: messageflowEnd,
17387
- attrs: {
17388
- fill: fill,
17389
- stroke: stroke,
17390
- strokeLinecap: 'butt'
17391
- },
17392
17488
  ref: { x: 8.5, y: 5 }
17393
17489
  });
17394
17490
  }
17395
17491
 
17396
17492
  if (type === 'association-start') {
17397
- var associationStart = create$1('path');
17398
- attr(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
17399
-
17400
- addMarker(id, {
17401
- element: associationStart,
17402
- attrs: {
17493
+ var associationStart = create$1('path', {
17494
+ d: 'M 11 5 L 1 10 L 11 15',
17495
+ ...lineStyle({
17403
17496
  fill: 'none',
17404
17497
  stroke: stroke,
17405
17498
  strokeWidth: 1.5
17406
- },
17499
+ })
17500
+ });
17501
+
17502
+ addMarker(id, {
17503
+ element: associationStart,
17407
17504
  ref: { x: 1, y: 10 },
17408
17505
  scale: 0.5
17409
17506
  });
17410
17507
  }
17411
17508
 
17412
17509
  if (type === 'association-end') {
17413
- var associationEnd = create$1('path');
17414
- attr(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
17415
-
17416
- addMarker(id, {
17417
- element: associationEnd,
17418
- attrs: {
17510
+ var associationEnd = create$1('path', {
17511
+ d: 'M 1 5 L 11 10 L 1 15',
17512
+ ...lineStyle({
17419
17513
  fill: 'none',
17420
17514
  stroke: stroke,
17421
17515
  strokeWidth: 1.5
17422
- },
17423
- ref: { x: 12, y: 10 },
17516
+ })
17517
+ });
17518
+
17519
+ addMarker(id, {
17520
+ element: associationEnd,
17521
+ ref: { x: 11, y: 10 },
17424
17522
  scale: 0.5
17425
17523
  });
17426
17524
  }
17427
17525
 
17428
17526
  if (type === 'conditional-flow-marker') {
17429
- var conditionalflowMarker = create$1('path');
17430
- attr(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
17431
-
17432
- addMarker(id, {
17433
- element: conditionalflowMarker,
17434
- attrs: {
17527
+ var conditionalFlowMarker = create$1('path', {
17528
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
17529
+ ...shapeStyle({
17435
17530
  fill: fill,
17436
17531
  stroke: stroke
17437
- },
17532
+ })
17533
+ });
17534
+
17535
+ addMarker(id, {
17536
+ element: conditionalFlowMarker,
17438
17537
  ref: { x: -1, y: 10 },
17439
17538
  scale: 0.5
17440
17539
  });
17441
17540
  }
17442
17541
 
17443
17542
  if (type === 'conditional-default-flow-marker') {
17444
- var conditionaldefaultflowMarker = create$1('path');
17445
- attr(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
17543
+ var defaultFlowMarker = create$1('path', {
17544
+ d: 'M 6 4 L 10 16',
17545
+ ...shapeStyle({
17546
+ stroke: stroke
17547
+ })
17548
+ });
17446
17549
 
17447
17550
  addMarker(id, {
17448
- element: conditionaldefaultflowMarker,
17449
- attrs: {
17450
- stroke: stroke
17451
- },
17551
+ element: defaultFlowMarker,
17452
17552
  ref: { x: 0, y: 10 },
17453
17553
  scale: 0.5
17454
17554
  });
@@ -17464,11 +17564,7 @@
17464
17564
 
17465
17565
  offset = offset || 0;
17466
17566
 
17467
- attrs = computeStyle(attrs, {
17468
- stroke: black,
17469
- strokeWidth: 2,
17470
- fill: 'white'
17471
- });
17567
+ attrs = shapeStyle(attrs);
17472
17568
 
17473
17569
  if (attrs.fill === 'none') {
17474
17570
  delete attrs.fillOpacity;
@@ -17477,13 +17573,12 @@
17477
17573
  var cx = width / 2,
17478
17574
  cy = height / 2;
17479
17575
 
17480
- var circle = create$1('circle');
17481
- attr(circle, {
17576
+ var circle = create$1('circle', {
17482
17577
  cx: cx,
17483
17578
  cy: cy,
17484
- r: Math.round((width + height) / 4 - offset)
17579
+ r: Math.round((width + height) / 4 - offset),
17580
+ ...attrs
17485
17581
  });
17486
- attr(circle, attrs);
17487
17582
 
17488
17583
  append(parentGfx, circle);
17489
17584
 
@@ -17499,22 +17594,17 @@
17499
17594
 
17500
17595
  offset = offset || 0;
17501
17596
 
17502
- attrs = computeStyle(attrs, {
17503
- stroke: black,
17504
- strokeWidth: 2,
17505
- fill: 'white'
17506
- });
17597
+ attrs = shapeStyle(attrs);
17507
17598
 
17508
- var rect = create$1('rect');
17509
- attr(rect, {
17599
+ var rect = create$1('rect', {
17510
17600
  x: offset,
17511
17601
  y: offset,
17512
17602
  width: width - offset * 2,
17513
17603
  height: height - offset * 2,
17514
17604
  rx: r,
17515
- ry: r
17605
+ ry: r,
17606
+ ...attrs
17516
17607
  });
17517
- attr(rect, attrs);
17518
17608
 
17519
17609
  append(parentGfx, rect);
17520
17610
 
@@ -17526,53 +17616,66 @@
17526
17616
  var x_2 = width / 2;
17527
17617
  var y_2 = height / 2;
17528
17618
 
17529
- var points = [ { x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 } ];
17619
+ var points = [
17620
+ { x: x_2, y: 0 },
17621
+ { x: width, y: y_2 },
17622
+ { x: x_2, y: height },
17623
+ { x: 0, y: y_2 }
17624
+ ];
17530
17625
 
17531
17626
  var pointsString = points.map(function(point) {
17532
17627
  return point.x + ',' + point.y;
17533
17628
  }).join(' ');
17534
17629
 
17535
- attrs = computeStyle(attrs, {
17536
- stroke: black,
17537
- strokeWidth: 2,
17538
- fill: 'white'
17539
- });
17630
+ attrs = shapeStyle(attrs);
17540
17631
 
17541
- var polygon = create$1('polygon');
17542
- attr(polygon, {
17632
+ var polygon = create$1('polygon', {
17633
+ ...attrs,
17543
17634
  points: pointsString
17544
17635
  });
17545
- attr(polygon, attrs);
17546
17636
 
17547
17637
  append(parentGfx, polygon);
17548
17638
 
17549
17639
  return polygon;
17550
17640
  }
17551
17641
 
17552
- function drawLine(parentGfx, waypoints, attrs) {
17553
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17554
- stroke: black,
17555
- strokeWidth: 2,
17556
- fill: 'none'
17557
- });
17642
+ /**
17643
+ * @param {SVGElement} parentGfx
17644
+ * @param {Point[]} waypoints
17645
+ * @param {any} attrs
17646
+ * @param {number} [radius]
17647
+ *
17648
+ * @return {SVGElement}
17649
+ */
17650
+ function drawLine(parentGfx, waypoints, attrs, radius) {
17651
+ attrs = lineStyle(attrs);
17558
17652
 
17559
- var line = createLine(waypoints, attrs);
17653
+ var line = createLine(waypoints, attrs, radius);
17560
17654
 
17561
17655
  append(parentGfx, line);
17562
17656
 
17563
17657
  return line;
17564
17658
  }
17565
17659
 
17660
+ /**
17661
+ * @param {SVGElement} parentGfx
17662
+ * @param {Point[]} waypoints
17663
+ * @param {any} attrs
17664
+ *
17665
+ * @return {SVGElement}
17666
+ */
17667
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
17668
+ return drawLine(parentGfx, waypoints, attrs, 5);
17669
+ }
17670
+
17566
17671
  function drawPath(parentGfx, d, attrs) {
17567
17672
 
17568
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17569
- strokeWidth: 2,
17570
- stroke: black
17571
- });
17673
+ attrs = lineStyle(attrs);
17572
17674
 
17573
- var path = create$1('path');
17574
- attr(path, { d: d });
17575
- attr(path, attrs);
17675
+ var path = create$1('path', {
17676
+ ...attrs,
17677
+ d
17678
+ });
17576
17679
 
17577
17680
  append(parentGfx, path);
17578
17681
 
@@ -17673,7 +17776,7 @@
17673
17776
  return renderLabel(parentGfx, semantic.name, {
17674
17777
  box: element,
17675
17778
  align: align,
17676
- padding: 5,
17779
+ padding: 7,
17677
17780
  style: {
17678
17781
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17679
17782
  }
@@ -17719,16 +17822,6 @@
17719
17822
  transform(textBox, 0, -top, 270);
17720
17823
  }
17721
17824
 
17722
- function createPathFromConnection(connection) {
17723
- var waypoints = connection.waypoints;
17724
-
17725
- var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
17726
- for (var i = 1; i < waypoints.length; i++) {
17727
- pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
17728
- }
17729
- return pathData;
17730
- }
17731
-
17732
17825
  var handlers = this.handlers = {
17733
17826
  'bpmn:Event': function(parentGfx, element, attrs) {
17734
17827
 
@@ -17749,7 +17842,6 @@
17749
17842
  if (!semantic.isInterrupting) {
17750
17843
  attrs = {
17751
17844
  strokeDasharray: '6',
17752
- strokeLinecap: 'round',
17753
17845
  fill: getFillColor(element, defaultFillColor),
17754
17846
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17755
17847
  };
@@ -17804,7 +17896,6 @@
17804
17896
 
17805
17897
  drawPath(parentGfx, pathData, {
17806
17898
  strokeWidth: 2,
17807
- strokeLinecap: 'square',
17808
17899
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17809
17900
  });
17810
17901
 
@@ -17826,7 +17917,6 @@
17826
17917
 
17827
17918
  drawPath(parentGfx, linePathData, {
17828
17919
  strokeWidth: 1,
17829
- strokeLinecap: 'square',
17830
17920
  transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
17831
17921
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17832
17922
  });
@@ -18034,14 +18124,14 @@
18034
18124
  },
18035
18125
  'bpmn:IntermediateEvent': function(parentGfx, element) {
18036
18126
  var outer = renderer('bpmn:Event')(parentGfx, element, {
18037
- strokeWidth: 1,
18127
+ strokeWidth: 1.5,
18038
18128
  fill: getFillColor(element, defaultFillColor),
18039
18129
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18040
18130
  });
18041
18131
 
18042
18132
  /* inner */
18043
18133
  drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
18044
- strokeWidth: 1,
18134
+ strokeWidth: 1.5,
18045
18135
  fill: getFillColor(element, 'none'),
18046
18136
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18047
18137
  });
@@ -18294,10 +18384,11 @@
18294
18384
  return task;
18295
18385
  },
18296
18386
  'bpmn:SubProcess': function(parentGfx, element, attrs) {
18297
- attrs = assign$1({
18387
+ attrs = {
18298
18388
  fill: getFillColor(element, defaultFillColor),
18299
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18300
- }, attrs);
18389
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18390
+ ...attrs
18391
+ };
18301
18392
 
18302
18393
  var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
18303
18394
 
@@ -18305,7 +18396,8 @@
18305
18396
 
18306
18397
  if (isEventSubProcess(element)) {
18307
18398
  attr(rect, {
18308
- strokeDasharray: '1,2'
18399
+ strokeDasharray: '0, 5.5',
18400
+ strokeWidth: 2.5
18309
18401
  });
18310
18402
  }
18311
18403
 
@@ -18323,13 +18415,14 @@
18323
18415
  return renderer('bpmn:SubProcess')(parentGfx, element);
18324
18416
  },
18325
18417
  'bpmn:Transaction': function(parentGfx, element) {
18326
- var outer = renderer('bpmn:SubProcess')(parentGfx, element);
18418
+ var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
18327
18419
 
18328
18420
  var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
18329
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18421
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18422
+ strokeWidth: 1.5
18330
18423
  });
18331
18424
 
18332
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
18425
+ /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
18333
18426
 
18334
18427
  return outer;
18335
18428
  },
@@ -18340,10 +18433,13 @@
18340
18433
  },
18341
18434
  'bpmn:Participant': function(parentGfx, element) {
18342
18435
 
18436
+ var strokeWidth = 1.5;
18437
+
18343
18438
  var attrs = {
18344
18439
  fillOpacity: DEFAULT_FILL_OPACITY,
18345
18440
  fill: getFillColor(element, defaultFillColor),
18346
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18441
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18442
+ strokeWidth
18347
18443
  };
18348
18444
 
18349
18445
  var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
@@ -18355,13 +18451,14 @@
18355
18451
  { x: 30, y: 0 },
18356
18452
  { x: 30, y: element.height }
18357
18453
  ], {
18358
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18454
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18455
+ strokeWidth
18359
18456
  });
18360
18457
  var text = getSemantic(element).name;
18361
18458
  renderLaneLabel(parentGfx, text, element);
18362
18459
  } else {
18363
18460
 
18364
- // Collapsed pool draw text inline
18461
+ // collapsed pool draw text inline
18365
18462
  var text2 = getSemantic(element).name;
18366
18463
  renderLabel(parentGfx, text2, {
18367
18464
  box: element, align: 'center-middle',
@@ -18380,11 +18477,13 @@
18380
18477
  return lane;
18381
18478
  },
18382
18479
  'bpmn:Lane': function(parentGfx, element, attrs) {
18383
- var rect = drawRect(parentGfx, element.width, element.height, 0, assign$1({
18480
+ var rect = drawRect(parentGfx, element.width, element.height, 0, {
18384
18481
  fill: getFillColor(element, defaultFillColor),
18385
18482
  fillOpacity: HIGH_FILL_OPACITY,
18386
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18387
- }, attrs));
18483
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18484
+ strokeWidth: 1.5,
18485
+ ...attrs
18486
+ });
18388
18487
 
18389
18488
  var semantic = getSemantic(element);
18390
18489
 
@@ -18503,13 +18602,11 @@
18503
18602
  }
18504
18603
  });
18505
18604
 
18506
- var attrs = {
18605
+ /* event path */ drawPath(parentGfx, pathData, {
18507
18606
  strokeWidth: 2,
18508
18607
  fill: getFillColor(element, 'none'),
18509
18608
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18510
- };
18511
-
18512
- /* event path */ drawPath(parentGfx, pathData, attrs);
18609
+ });
18513
18610
  }
18514
18611
 
18515
18612
  if (type === 'Parallel') {
@@ -18525,16 +18622,14 @@
18525
18622
  }
18526
18623
  });
18527
18624
 
18528
- var parallelPath = drawPath(parentGfx, pathData);
18529
- attr(parallelPath, {
18625
+ drawPath(parentGfx, pathData, {
18530
18626
  strokeWidth: 1,
18531
18627
  fill: 'none'
18532
18628
  });
18533
18629
  } else if (type === 'Exclusive') {
18534
18630
 
18535
18631
  if (!instantiate) {
18536
- var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
18537
- attr(innerCircle, {
18632
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
18538
18633
  strokeWidth: 1,
18539
18634
  fill: 'none',
18540
18635
  stroke: getStrokeColor$1(element, defaultStrokeColor)
@@ -18548,27 +18643,20 @@
18548
18643
  return diamond;
18549
18644
  },
18550
18645
  'bpmn:Gateway': function(parentGfx, element) {
18551
- var attrs = {
18646
+ return drawDiamond(parentGfx, element.width, element.height, {
18552
18647
  fill: getFillColor(element, defaultFillColor),
18553
18648
  fillOpacity: DEFAULT_FILL_OPACITY,
18554
18649
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18555
- };
18556
-
18557
- return drawDiamond(parentGfx, element.width, element.height, attrs);
18650
+ });
18558
18651
  },
18559
18652
  'bpmn:SequenceFlow': function(parentGfx, element) {
18560
- var pathData = createPathFromConnection(element);
18561
-
18562
18653
  var fill = getFillColor(element, defaultFillColor),
18563
18654
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18564
18655
 
18565
- var attrs = {
18566
- strokeLinejoin: 'round',
18656
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18567
18657
  markerEnd: marker('sequenceflow-end', fill, stroke),
18568
18658
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18569
- };
18570
-
18571
- var path = drawPath(parentGfx, pathData, attrs);
18659
+ });
18572
18660
 
18573
18661
  var sequenceFlow = getSemantic(element);
18574
18662
 
@@ -18602,12 +18690,11 @@
18602
18690
  var fill = getFillColor(element, defaultFillColor),
18603
18691
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18604
18692
 
18605
- attrs = assign$1({
18606
- strokeDasharray: '0.5, 5',
18607
- strokeLinecap: 'round',
18608
- strokeLinejoin: 'round',
18609
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18610
- }, attrs || {});
18693
+ attrs = {
18694
+ strokeDasharray: '0, 5',
18695
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18696
+ ...attrs
18697
+ };
18611
18698
 
18612
18699
  if (semantic.associationDirection === 'One' ||
18613
18700
  semantic.associationDirection === 'Both') {
@@ -18618,7 +18705,7 @@
18618
18705
  attrs.markerStart = marker('association-start', fill, stroke);
18619
18706
  }
18620
18707
 
18621
- return drawLine(parentGfx, element.waypoints, attrs);
18708
+ return drawConnectionSegments(parentGfx, element.waypoints, attrs);
18622
18709
  },
18623
18710
  'bpmn:DataInputAssociation': function(parentGfx, element) {
18624
18711
  var fill = getFillColor(element, defaultFillColor),
@@ -18644,19 +18731,13 @@
18644
18731
  var fill = getFillColor(element, defaultFillColor),
18645
18732
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18646
18733
 
18647
- var pathData = createPathFromConnection(element);
18648
-
18649
- var attrs = {
18734
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18650
18735
  markerEnd: marker('messageflow-end', fill, stroke),
18651
18736
  markerStart: marker('messageflow-start', fill, stroke),
18652
- strokeDasharray: '10, 12',
18653
- strokeLinecap: 'round',
18654
- strokeLinejoin: 'round',
18655
- strokeWidth: '1.5px',
18737
+ strokeDasharray: '10, 11',
18738
+ strokeWidth: 1.5,
18656
18739
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18657
- };
18658
-
18659
- var path = drawPath(parentGfx, pathData, attrs);
18740
+ });
18660
18741
 
18661
18742
  if (semantic.messageRef) {
18662
18743
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
@@ -18779,25 +18860,26 @@
18779
18860
  cancel = semantic.cancelActivity;
18780
18861
 
18781
18862
  var attrs = {
18782
- strokeWidth: 1,
18863
+ strokeWidth: 1.5,
18783
18864
  fill: getFillColor(element, defaultFillColor),
18784
18865
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18785
18866
  };
18786
18867
 
18787
18868
  if (!cancel) {
18788
18869
  attrs.strokeDasharray = '6';
18789
- attrs.strokeLinecap = 'round';
18790
18870
  }
18791
18871
 
18792
18872
  // apply fillOpacity
18793
- var outerAttrs = assign$1({}, attrs, {
18873
+ var outerAttrs = {
18874
+ ...attrs,
18794
18875
  fillOpacity: 1
18795
- });
18876
+ };
18796
18877
 
18797
18878
  // apply no-fill
18798
- var innerAttrs = assign$1({}, attrs, {
18879
+ var innerAttrs = {
18880
+ ...attrs,
18799
18881
  fill: 'none'
18800
- });
18882
+ };
18801
18883
 
18802
18884
  var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
18803
18885
 
@@ -18808,27 +18890,22 @@
18808
18890
  return outer;
18809
18891
  },
18810
18892
  'bpmn:Group': function(parentGfx, element) {
18811
-
18812
- var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
18893
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
18813
18894
  stroke: getStrokeColor$1(element, defaultStrokeColor),
18814
- strokeWidth: 1,
18815
- strokeDasharray: '8,3,1,3',
18895
+ strokeWidth: 1.5,
18896
+ strokeDasharray: '10,6,0,6',
18816
18897
  fill: 'none',
18817
18898
  pointerEvents: 'none'
18818
18899
  });
18819
-
18820
- return group;
18821
18900
  },
18822
18901
  'label': function(parentGfx, element) {
18823
18902
  return renderExternalLabel(parentGfx, element);
18824
18903
  },
18825
18904
  'bpmn:TextAnnotation': function(parentGfx, element) {
18826
- var style = {
18905
+ var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
18827
18906
  'fill': 'none',
18828
18907
  'stroke': 'none'
18829
- };
18830
-
18831
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
18908
+ });
18832
18909
 
18833
18910
  var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
18834
18911
  xScaleFactor: 1,
@@ -18849,7 +18926,7 @@
18849
18926
  renderLabel(parentGfx, text, {
18850
18927
  box: element,
18851
18928
  align: 'left-top',
18852
- padding: 5,
18929
+ padding: 7,
18853
18930
  style: {
18854
18931
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
18855
18932
  }
@@ -18967,10 +19044,9 @@
18967
19044
  });
18968
19045
 
18969
19046
  drawMarker('loop', parentGfx, markerPath, {
18970
- strokeWidth: 1,
19047
+ strokeWidth: 1.5,
18971
19048
  fill: getFillColor(element, defaultFillColor),
18972
19049
  stroke: getStrokeColor$1(element, defaultStrokeColor),
18973
- strokeLinecap: 'round',
18974
19050
  strokeMiterlimit: 0.5
18975
19051
  });
18976
19052
  },
@@ -21191,7 +21267,7 @@
21191
21267
  attr(outline, assign$1({
21192
21268
  x: 10,
21193
21269
  y: 10,
21194
- rx: 3,
21270
+ rx: 4,
21195
21271
  width: 100,
21196
21272
  height: 100
21197
21273
  }, OUTLINE_STYLE));
@@ -23365,6 +23441,10 @@
23365
23441
  subprocessCompatibility: [ 'type', SubprocessCompatibility ]
23366
23442
  };
23367
23443
 
23444
+ /**
23445
+ * @typedef { import('didi').ModuleDeclaration } Module
23446
+ */
23447
+
23368
23448
  /**
23369
23449
  * A viewer for BPMN 2.0 diagrams.
23370
23450
  *
@@ -23409,8 +23489,8 @@
23409
23489
  * @param {string|number} [options.width] the width of the viewer
23410
23490
  * @param {string|number} [options.height] the height of the viewer
23411
23491
  * @param {Object} [options.moddleExtensions] extension packages to provide
23412
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
23413
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
23492
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
23493
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
23414
23494
  */
23415
23495
  function Viewer(options) {
23416
23496
  BaseViewer.call(this, options);
@@ -28159,7 +28239,7 @@
28159
28239
  * @param {boolean} selected
28160
28240
  * @param {function} onMouseEnter
28161
28241
  * @param {function} onMouseLeave
28162
- * @param {function} onClick
28242
+ * @param {function} onAction
28163
28243
  */
28164
28244
  function PopupMenuItem(props) {
28165
28245
  const {
@@ -28167,7 +28247,7 @@
28167
28247
  selected,
28168
28248
  onMouseEnter,
28169
28249
  onMouseLeave,
28170
- onClick
28250
+ onAction
28171
28251
  } = props;
28172
28252
 
28173
28253
  return m$1`
@@ -28175,16 +28255,18 @@
28175
28255
  class=${ clsx('entry', { selected }) }
28176
28256
  data-id=${ entry.id }
28177
28257
  title=${ entry.title || entry.label }
28178
- onClick=${ onClick }
28258
+ onClick=${ onAction }
28179
28259
  onMouseEnter=${ onMouseEnter }
28180
28260
  onMouseLeave=${ onMouseLeave }
28261
+ onDragStart=${ (event) => onAction(event, entry, 'dragstart') }
28262
+ draggable=${ true }
28181
28263
  >
28182
28264
  <div class="djs-popup-entry-content">
28183
28265
  <span
28184
28266
  class=${ clsx('djs-popup-entry-name', entry.className) }
28185
28267
  >
28186
28268
  ${ entry.imageUrl ? m$1`
28187
- <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28269
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />
28188
28270
  ` : null }
28189
28271
 
28190
28272
  ${ entry.label ? m$1`
@@ -28227,7 +28309,7 @@
28227
28309
  * @param {Array} entries
28228
28310
  * @param {Object} selectedEntry
28229
28311
  * @param {function} setSelectedEntry
28230
- * @param {function} onClick
28312
+ * @param {function} onAction
28231
28313
  * @param {Object} resultsRef
28232
28314
  */
28233
28315
 
@@ -28235,8 +28317,8 @@
28235
28317
  const {
28236
28318
  selectedEntry,
28237
28319
  setSelectedEntry,
28238
- onClick,
28239
- entries
28320
+ entries,
28321
+ ...restProps
28240
28322
  } = props;
28241
28323
 
28242
28324
  const resultsRef = _();
@@ -28273,7 +28355,7 @@
28273
28355
  selected=${ entry === selectedEntry }
28274
28356
  onMouseEnter=${ () => setSelectedEntry(entry) }
28275
28357
  onMouseLeave=${ () => setSelectedEntry(null) }
28276
- onClick=${ onClick }
28358
+ ...${ restProps }
28277
28359
  />
28278
28360
  `) }
28279
28361
  </ul>
@@ -28364,41 +28446,21 @@
28364
28446
 
28365
28447
  const [ value, setValue ] = p('');
28366
28448
 
28367
- const [ entries, setEntries ] = p(originalEntries);
28368
- const [ selectedEntry, setSelectedEntry ] = p(entries[0]);
28369
-
28370
- h(() => {
28371
- onOpened();
28372
-
28373
- return () => {
28374
- onClosed();
28375
- };
28376
- }, []);
28377
-
28378
- const updateEntries = T((newEntries) => {
28379
-
28380
- // select first entry if non is selected
28381
- if (!selectedEntry || !newEntries.includes(selectedEntry)) {
28382
- setSelectedEntry(newEntries[0]);
28383
- }
28384
-
28385
- setEntries(newEntries);
28386
- }, [ selectedEntry, setEntries, setSelectedEntry ]);
28449
+ const filterEntries = T((originalEntries, value) => {
28387
28450
 
28388
- // filter entries on value change
28389
- h(() => {
28390
28451
  if (!searchable) {
28391
- return;
28452
+ return originalEntries;
28392
28453
  }
28393
28454
 
28394
28455
  const filter = entry => {
28395
28456
  if (!value) {
28396
- return true;
28457
+ return (entry.rank || 0) >= 0;
28397
28458
  }
28398
28459
 
28399
28460
  const search = [
28400
28461
  entry.description || '',
28401
- entry.label || ''
28462
+ entry.label || '',
28463
+ entry.search || ''
28402
28464
  ]
28403
28465
  .join('---')
28404
28466
  .toLowerCase();
@@ -28409,10 +28471,26 @@
28409
28471
  .every(term => search.includes(term));
28410
28472
  };
28411
28473
 
28412
- const entries = originalEntries.filter(filter);
28474
+ return originalEntries.filter(filter);
28475
+ }, [ searchable ]);
28476
+
28477
+ const [ entries, setEntries ] = p(filterEntries(originalEntries, value));
28478
+ const [ selectedEntry, setSelectedEntry ] = p(entries[0]);
28479
+
28480
+ const updateEntries = T((newEntries) => {
28481
+
28482
+ // select first entry if non is selected
28483
+ if (!selectedEntry || !newEntries.includes(selectedEntry)) {
28484
+ setSelectedEntry(newEntries[0]);
28485
+ }
28413
28486
 
28414
- updateEntries(entries);
28415
- }, [ value, originalEntries, searchable ]);
28487
+ setEntries(newEntries);
28488
+ }, [ selectedEntry, setEntries, setSelectedEntry ]);
28489
+
28490
+ // filter entries on value change
28491
+ h(() => {
28492
+ updateEntries(filterEntries(originalEntries, value));
28493
+ }, [ value, originalEntries ]);
28416
28494
 
28417
28495
  // register global <Escape> handler
28418
28496
  h(() => {
@@ -28458,10 +28536,6 @@
28458
28536
  return onSelect(event, selectedEntry);
28459
28537
  }
28460
28538
 
28461
- if (event.key === 'Escape') {
28462
- return onClose();
28463
- }
28464
-
28465
28539
  // ARROW_UP or SHIFT + TAB navigation
28466
28540
  if (event.key === 'ArrowUp' || (event.key === 'Tab' && event.shiftKey)) {
28467
28541
  keyboardSelect(-1);
@@ -28483,6 +28557,14 @@
28483
28557
  }
28484
28558
  }, [ setValue ]);
28485
28559
 
28560
+ h(() => {
28561
+ onOpened();
28562
+
28563
+ return () => {
28564
+ onClosed();
28565
+ };
28566
+ }, []);
28567
+
28486
28568
  const displayHeader = F(() => title || headerEntries.length > 0, [ title, headerEntries ]);
28487
28569
 
28488
28570
  return m$1`
@@ -28508,7 +28590,7 @@
28508
28590
  onMouseLeave=${ () => setSelectedEntry(null) }
28509
28591
  >
28510
28592
  ${ entry.imageUrl ? m$1`
28511
- <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28593
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />
28512
28594
  ` : null }
28513
28595
 
28514
28596
  ${ entry.label ? m$1`
@@ -28537,7 +28619,7 @@
28537
28619
  entries=${ entries }
28538
28620
  selectedEntry=${ selectedEntry }
28539
28621
  setSelectedEntry=${ setSelectedEntry }
28540
- onClick=${ onSelect }
28622
+ onAction=${ onSelect }
28541
28623
  />
28542
28624
  </div>
28543
28625
  ${ entries.length === 0 && m$1`
@@ -28702,17 +28784,13 @@
28702
28784
  options
28703
28785
  } = this._current;
28704
28786
 
28705
- const entriesArray = [
28706
- ...Object.entries(entries).map(
28707
- ([ key, value ]) => ({ id: key, ...value })
28708
- )
28709
- ];
28787
+ const entriesArray = Object.entries(entries).map(
28788
+ ([ key, value ]) => ({ id: key, ...value })
28789
+ );
28710
28790
 
28711
- const headerEntriesArray = [
28712
- ...Object.entries(headerEntries).map(
28713
- ([ key, value ]) => ({ id: key, ...value })
28714
- )
28715
- ];
28791
+ const headerEntriesArray = Object.entries(headerEntries).map(
28792
+ ([ key, value ]) => ({ id: key, ...value })
28793
+ );
28716
28794
 
28717
28795
  const position = _position && (
28718
28796
  (container) => this._ensureVisible(container, _position)
@@ -28721,7 +28799,7 @@
28721
28799
  const scale = this._updateScale(this._current.container);
28722
28800
 
28723
28801
  const onClose = result => this.close(result);
28724
- const onSelect = (event, entry) => this.trigger(event, entry);
28802
+ const onSelect = (event, entry, action) => this.trigger(event, entry, action);
28725
28803
 
28726
28804
  P(
28727
28805
  m$1`
@@ -29118,10 +29196,11 @@
29118
29196
  *
29119
29197
  * @param {Object} event
29120
29198
  * @param {Object} entry
29199
+ * @param {string} [action='click'] the action to trigger
29121
29200
  *
29122
29201
  * @return the result of the action callback, if any
29123
29202
  */
29124
- PopupMenu.prototype.trigger = function(event, entry) {
29203
+ PopupMenu.prototype.trigger = function(event, entry, action = 'click') {
29125
29204
 
29126
29205
  // silence other actions
29127
29206
  event.preventDefault();
@@ -29133,8 +29212,16 @@
29133
29212
  entry = this._getEntry(entryId);
29134
29213
  }
29135
29214
 
29136
- if (entry.action) {
29137
- return entry.action.call(null, event, entry);
29215
+ const handler = entry.action;
29216
+
29217
+ if (isFunction(handler)) {
29218
+ if (action === 'click') {
29219
+ return handler(event, entry);
29220
+ }
29221
+ } else {
29222
+ if (handler[action]) {
29223
+ return handler[action](event, entry);
29224
+ }
29138
29225
  }
29139
29226
  };
29140
29227
 
@@ -29969,7 +30056,7 @@
29969
30056
  y: sourceTrbl.top - 50 - element.height / 2
29970
30057
  };
29971
30058
 
29972
- if (isConnection$e(source)) {
30059
+ if (isConnection$f(source)) {
29973
30060
  position = getMid(source);
29974
30061
  position.x += 100;
29975
30062
  position.y -= 50;
@@ -30008,7 +30095,7 @@
30008
30095
  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
30009
30096
  }
30010
30097
 
30011
- function isConnection$e(element) {
30098
+ function isConnection$f(element) {
30012
30099
  return !!element.waypoints;
30013
30100
  }
30014
30101
 
@@ -31434,7 +31521,7 @@
31434
31521
  * Returns the length of a vector
31435
31522
  *
31436
31523
  * @param {Vector}
31437
- * @return {Float}
31524
+ * @return {number}
31438
31525
  */
31439
31526
  function vectorLength(v) {
31440
31527
  return Math.sqrt(Math.pow(v.x, 2) + Math.pow(v.y, 2));
@@ -31445,7 +31532,7 @@
31445
31532
  * Calculates the angle between a line a the yAxis
31446
31533
  *
31447
31534
  * @param {Array}
31448
- * @return {Float}
31535
+ * @return {number}
31449
31536
  */
31450
31537
  function getAngle(line) {
31451
31538
 
@@ -31459,7 +31546,7 @@
31459
31546
  * Rotates a vector by a given angle
31460
31547
  *
31461
31548
  * @param {Vector}
31462
- * @param {Float} Angle in radians
31549
+ * @param {number} Angle in radians
31463
31550
  * @return {Vector}
31464
31551
  */
31465
31552
  function rotateVector(vector, angle) {
@@ -31477,7 +31564,7 @@
31477
31564
  * @param {Vector}
31478
31565
  * @param {Vector}
31479
31566
  * @param {Vector}
31480
- * @return {Float}
31567
+ * @return {number}
31481
31568
  */
31482
31569
  function solveLambaSystem(a, b, c) {
31483
31570
 
@@ -31499,7 +31586,7 @@
31499
31586
  * Position of perpendicular foot
31500
31587
  *
31501
31588
  * @param {Point}
31502
- * @param [ {Point}, {Point} ] line defined through two points
31589
+ * @param {[ Point, Point ]} line defined through two points
31503
31590
  * @return {Point} the perpendicular foot position
31504
31591
  */
31505
31592
  function perpendicularFoot(point, line) {
@@ -31519,9 +31606,10 @@
31519
31606
  /**
31520
31607
  * Calculates the distance between a point and a line
31521
31608
  *
31522
- * @param {Point}
31523
- * @param [ {Point}, {Point} ] line defined through two points
31524
- * @return {Float} distance
31609
+ * @param { Point }
31610
+ * @param { [ Point, Point ] } line defined through two points
31611
+ *
31612
+ * @return { number } distance
31525
31613
  */
31526
31614
  function getDistancePointLine(point, line) {
31527
31615
 
@@ -31542,7 +31630,8 @@
31542
31630
  *
31543
31631
  * @param {Point}
31544
31632
  * @param {Point}
31545
- * @return {Float} distance
31633
+ *
31634
+ * @return {number} distance
31546
31635
  */
31547
31636
  function getDistancePointPoint(point1, point2) {
31548
31637
 
@@ -33248,7 +33337,7 @@
33248
33337
  hoverMid = hover && getSnapPoint(hover, event);
33249
33338
 
33250
33339
  // only snap on connections, elements can have multiple connect endpoints
33251
- if (!isConnection$d(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33340
+ if (!isConnection$e(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33252
33341
  return;
33253
33342
  }
33254
33343
 
@@ -33303,7 +33392,7 @@
33303
33392
 
33304
33393
  // helpers //////////////////////
33305
33394
 
33306
- function isConnection$d(element) {
33395
+ function isConnection$e(element) {
33307
33396
  return element && !!element.waypoints;
33308
33397
  }
33309
33398
 
@@ -33772,18 +33861,12 @@
33772
33861
  * @returns {SVGElement}
33773
33862
  */
33774
33863
  ConnectionPreview.prototype.createNoopConnection = function(start, end) {
33775
- var connection = create$1('polyline');
33776
-
33777
- attr(connection, {
33864
+ return createLine([ start, end ], {
33778
33865
  'stroke': '#333',
33779
33866
  'strokeDasharray': [ 1 ],
33780
33867
  'strokeWidth': 2,
33781
33868
  'pointer-events': 'none'
33782
33869
  });
33783
-
33784
- attr(connection, { 'points': [ start.x, start.y, end.x, end.y ] });
33785
-
33786
- return connection;
33787
33870
  };
33788
33871
 
33789
33872
  // helpers //////////
@@ -34490,6 +34573,7 @@
34490
34573
  'path',
34491
34574
  'polygon',
34492
34575
  'polyline',
34576
+ 'path',
34493
34577
  'rect'
34494
34578
  ];
34495
34579
 
@@ -34764,7 +34848,7 @@
34764
34848
  });
34765
34849
 
34766
34850
  var shape = find(elements, function(element) {
34767
- return !isConnection$c(element);
34851
+ return !isConnection$d(element);
34768
34852
  });
34769
34853
 
34770
34854
  var attach = false,
@@ -34919,7 +35003,7 @@
34919
35003
 
34920
35004
  // update shape
34921
35005
  shape = find(elements, function(element) {
34922
- return !isConnection$c(element);
35006
+ return !isConnection$d(element);
34923
35007
  });
34924
35008
  }
34925
35009
 
@@ -34960,7 +35044,7 @@
34960
35044
  }
34961
35045
 
34962
35046
  var shape = find(elements, function(element) {
34963
- return !isConnection$c(element);
35047
+ return !isConnection$d(element);
34964
35048
  });
34965
35049
 
34966
35050
  if (!shape) {
@@ -34994,7 +35078,7 @@
34994
35078
 
34995
35079
  // center elements around cursor
34996
35080
  forEach$1(elements, function(element) {
34997
- if (isConnection$c(element)) {
35081
+ if (isConnection$d(element)) {
34998
35082
  element.waypoints = map$1(element.waypoints, function(waypoint) {
34999
35083
  return {
35000
35084
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35056,12 +35140,12 @@
35056
35140
  }
35057
35141
  }
35058
35142
 
35059
- function isConnection$c(element) {
35143
+ function isConnection$d(element) {
35060
35144
  return !!element.waypoints;
35061
35145
  }
35062
35146
 
35063
35147
  function isSingleShape(elements) {
35064
- return elements && elements.length === 1 && !isConnection$c(elements[0]);
35148
+ return elements && elements.length === 1 && !isConnection$d(elements[0]);
35065
35149
  }
35066
35150
 
35067
35151
  function isLabel$5(element) {
@@ -35378,7 +35462,7 @@
35378
35462
  }
35379
35463
 
35380
35464
  // connections (priority = 3)
35381
- if (isConnection$b(element)) {
35465
+ if (isConnection$c(element)) {
35382
35466
  descriptor.priority = 3;
35383
35467
 
35384
35468
  descriptor.source = element.source.id;
@@ -35521,7 +35605,7 @@
35521
35605
 
35522
35606
  // center elements around cursor
35523
35607
  forEach$1(elements, function(element) {
35524
- if (isConnection$b(element)) {
35608
+ if (isConnection$c(element)) {
35525
35609
  element.waypoints = map$1(element.waypoints, function(waypoint) {
35526
35610
  return {
35527
35611
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35574,7 +35658,7 @@
35574
35658
 
35575
35659
  var element;
35576
35660
 
35577
- if (isConnection$b(attrs)) {
35661
+ if (isConnection$c(attrs)) {
35578
35662
  attrs.source = cache[ descriptor.source ];
35579
35663
  attrs.target = cache[ descriptor.target ];
35580
35664
 
@@ -35640,7 +35724,7 @@
35640
35724
  source,
35641
35725
  target;
35642
35726
 
35643
- if (isConnection$b(element)) {
35727
+ if (isConnection$c(element)) {
35644
35728
  source = find(elements, matchPattern({ id: element.source.id }));
35645
35729
  target = find(elements, matchPattern({ id: element.target.id }));
35646
35730
 
@@ -35837,7 +35921,7 @@
35837
35921
  return !!element.host;
35838
35922
  }
35839
35923
 
35840
- function isConnection$b(element) {
35924
+ function isConnection$c(element) {
35841
35925
  return !!element.waypoints;
35842
35926
  }
35843
35927
 
@@ -36540,7 +36624,7 @@
36540
36624
 
36541
36625
  // copying event definitions, unless we replace
36542
36626
  if (propertyName === 'eventDefinitions') {
36543
- return hasEventDefinition$1(element, target.eventDefinitionType);
36627
+ return hasEventDefinition$2(element, target.eventDefinitionType);
36544
36628
  }
36545
36629
 
36546
36630
  // retain loop characteristics if the target element
@@ -36577,7 +36661,7 @@
36577
36661
  // only initialize with new eventDefinition
36578
36662
  // if we did not set an event definition yet,
36579
36663
  // i.e. because we copied it
36580
- if (!hasEventDefinition$1(newBusinessObject, target.eventDefinitionType)) {
36664
+ if (!hasEventDefinition$2(newBusinessObject, target.eventDefinitionType)) {
36581
36665
  newElement.eventDefinitionType = target.eventDefinitionType;
36582
36666
  newElement.eventDefinitionAttrs = target.eventDefinitionAttrs;
36583
36667
  }
@@ -36707,7 +36791,7 @@
36707
36791
  return is$1(bo, 'bpmn:SubProcess');
36708
36792
  }
36709
36793
 
36710
- function hasEventDefinition$1(element, type) {
36794
+ function hasEventDefinition$2(element, type) {
36711
36795
 
36712
36796
  var bo = getBusinessObject(element);
36713
36797
 
@@ -37075,7 +37159,7 @@
37075
37159
  }
37076
37160
  ];
37077
37161
 
37078
- var GATEWAY = [
37162
+ var GATEWAY$1 = [
37079
37163
  {
37080
37164
  label: 'Exclusive Gateway',
37081
37165
  actionName: 'replace-with-exclusive-gateway',
@@ -37208,7 +37292,7 @@
37208
37292
 
37209
37293
  var EVENT_SUB_PROCESS = TRANSACTION;
37210
37294
 
37211
- var TASK = [
37295
+ var TASK$1 = [
37212
37296
  {
37213
37297
  label: 'Task',
37214
37298
  actionName: 'replace-with-task',
@@ -37217,6 +37301,22 @@
37217
37301
  type: 'bpmn:Task'
37218
37302
  }
37219
37303
  },
37304
+ {
37305
+ label: 'User Task',
37306
+ actionName: 'replace-with-user-task',
37307
+ className: 'bpmn-icon-user',
37308
+ target: {
37309
+ type: 'bpmn:UserTask'
37310
+ }
37311
+ },
37312
+ {
37313
+ label: 'Service Task',
37314
+ actionName: 'replace-with-service-task',
37315
+ className: 'bpmn-icon-service',
37316
+ target: {
37317
+ type: 'bpmn:ServiceTask'
37318
+ }
37319
+ },
37220
37320
  {
37221
37321
  label: 'Send Task',
37222
37322
  actionName: 'replace-with-send-task',
@@ -37233,14 +37333,6 @@
37233
37333
  type: 'bpmn:ReceiveTask'
37234
37334
  }
37235
37335
  },
37236
- {
37237
- label: 'User Task',
37238
- actionName: 'replace-with-user-task',
37239
- className: 'bpmn-icon-user',
37240
- target: {
37241
- type: 'bpmn:UserTask'
37242
- }
37243
- },
37244
37336
  {
37245
37337
  label: 'Manual Task',
37246
37338
  actionName: 'replace-with-manual-task',
@@ -37257,14 +37349,6 @@
37257
37349
  type: 'bpmn:BusinessRuleTask'
37258
37350
  }
37259
37351
  },
37260
- {
37261
- label: 'Service Task',
37262
- actionName: 'replace-with-service-task',
37263
- className: 'bpmn-icon-service',
37264
- target: {
37265
- type: 'bpmn:ServiceTask'
37266
- }
37267
- },
37268
37352
  {
37269
37353
  label: 'Script Task',
37270
37354
  actionName: 'replace-with-script-task',
@@ -37582,7 +37666,7 @@
37582
37666
  }
37583
37667
  ];
37584
37668
 
37585
- var PARTICIPANT = [
37669
+ var PARTICIPANT$1 = [
37586
37670
  {
37587
37671
  label: 'Expanded Pool',
37588
37672
  actionName: 'replace-with-expanded-pool',
@@ -37691,7 +37775,7 @@
37691
37775
  // expanded/collapsed pools
37692
37776
  if (is$1(businessObject, 'bpmn:Participant')) {
37693
37777
 
37694
- entries = filter(PARTICIPANT, function(entry) {
37778
+ entries = filter(PARTICIPANT$1, function(entry) {
37695
37779
  return isExpanded(element) !== entry.target.isExpanded;
37696
37780
  });
37697
37781
 
@@ -37774,7 +37858,7 @@
37774
37858
  // gateways
37775
37859
  if (is$1(businessObject, 'bpmn:Gateway')) {
37776
37860
 
37777
- entries = filter(GATEWAY, differentType);
37861
+ entries = filter(GATEWAY$1, differentType);
37778
37862
 
37779
37863
  return this._createEntries(element, entries);
37780
37864
  }
@@ -37806,7 +37890,7 @@
37806
37890
  // collapsed ad hoc sub processes
37807
37891
  if (is$1(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
37808
37892
 
37809
- entries = filter(TASK, function(entry) {
37893
+ entries = filter(TASK$1, function(entry) {
37810
37894
 
37811
37895
  var target = entry.target;
37812
37896
 
@@ -37827,7 +37911,7 @@
37827
37911
 
37828
37912
  // flow nodes
37829
37913
  if (is$1(businessObject, 'bpmn:FlowNode')) {
37830
- entries = filter(TASK, differentType);
37914
+ entries = filter(TASK$1, differentType);
37831
37915
 
37832
37916
  // collapsed SubProcess can not be replaced with itself
37833
37917
  if (is$1(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
@@ -38097,6 +38181,12 @@
38097
38181
  var self = this;
38098
38182
  var translate = this._translate;
38099
38183
 
38184
+ var dataObject = element.businessObject.dataObjectRef;
38185
+
38186
+ if (!dataObject) {
38187
+ return [];
38188
+ }
38189
+
38100
38190
  function toggleIsCollection(event, entry) {
38101
38191
  self._modeling.updateModdleProperties(
38102
38192
  element,
@@ -38104,8 +38194,7 @@
38104
38194
  { isCollection: !entry.active });
38105
38195
  }
38106
38196
 
38107
- var dataObject = element.businessObject.dataObjectRef,
38108
- isCollection = dataObject.isCollection;
38197
+ var isCollection = dataObject.isCollection;
38109
38198
 
38110
38199
  var dataObjectEntries = [
38111
38200
  {
@@ -38201,9 +38290,12 @@
38201
38290
  var PopupMenuModule = {
38202
38291
  __depends__: [
38203
38292
  PopupMenuModule$1,
38204
- ReplaceModule
38293
+ ReplaceModule,
38294
+ AutoPlaceModule
38295
+ ],
38296
+ __init__: [
38297
+ 'replaceMenuProvider'
38205
38298
  ],
38206
- __init__: [ 'replaceMenuProvider' ],
38207
38299
  replaceMenuProvider: [ 'type', ReplaceMenuProvider ]
38208
38300
  };
38209
38301
 
@@ -38646,433 +38738,2181 @@
38646
38738
  });
38647
38739
  }
38648
38740
 
38649
- return actions;
38741
+ return actions;
38742
+ };
38743
+
38744
+ /**
38745
+ * @param {djs.model.Base[]} elements
38746
+ * @return {boolean}
38747
+ */
38748
+ ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
38749
+
38750
+ var baseAllowed = this._rules.allowed('elements.delete', {
38751
+ elements: elements
38752
+ });
38753
+
38754
+ if (isArray$3(baseAllowed)) {
38755
+ return every(baseAllowed, function(element) {
38756
+ return includes$7(baseAllowed, element);
38757
+ });
38758
+ }
38759
+
38760
+ return baseAllowed;
38761
+ };
38762
+
38763
+ ContextPadProvider.prototype.getContextPadEntries = function(element) {
38764
+ var contextPad = this._contextPad,
38765
+ modeling = this._modeling,
38766
+
38767
+ elementFactory = this._elementFactory,
38768
+ connect = this._connect,
38769
+ create = this._create,
38770
+ popupMenu = this._popupMenu,
38771
+ rules = this._rules,
38772
+ autoPlace = this._autoPlace,
38773
+ translate = this._translate;
38774
+
38775
+ var actions = {};
38776
+
38777
+ if (element.type === 'label') {
38778
+ return actions;
38779
+ }
38780
+
38781
+ var businessObject = element.businessObject;
38782
+
38783
+ function startConnect(event, element) {
38784
+ connect.start(event, element);
38785
+ }
38786
+
38787
+ function removeElement(e, element) {
38788
+ modeling.removeElements([ element ]);
38789
+ }
38790
+
38791
+ function getReplaceMenuPosition(element) {
38792
+
38793
+ var Y_OFFSET = 5;
38794
+
38795
+ var pad = contextPad.getPad(element).html;
38796
+
38797
+ var padRect = pad.getBoundingClientRect();
38798
+
38799
+ var pos = {
38800
+ x: padRect.left,
38801
+ y: padRect.bottom + Y_OFFSET
38802
+ };
38803
+
38804
+ return pos;
38805
+ }
38806
+
38807
+ /**
38808
+ * Create an append action
38809
+ *
38810
+ * @param {string} type
38811
+ * @param {string} className
38812
+ * @param {string} [title]
38813
+ * @param {Object} [options]
38814
+ *
38815
+ * @return {Object} descriptor
38816
+ */
38817
+ function appendAction(type, className, title, options) {
38818
+
38819
+ if (typeof title !== 'string') {
38820
+ options = title;
38821
+ title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
38822
+ }
38823
+
38824
+ function appendStart(event, element) {
38825
+
38826
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
38827
+ create.start(event, shape, {
38828
+ source: element
38829
+ });
38830
+ }
38831
+
38832
+
38833
+ var append = autoPlace ? function(event, element) {
38834
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
38835
+
38836
+ autoPlace.append(element, shape);
38837
+ } : appendStart;
38838
+
38839
+
38840
+ return {
38841
+ group: 'model',
38842
+ className: className,
38843
+ title: title,
38844
+ action: {
38845
+ dragstart: appendStart,
38846
+ click: append
38847
+ }
38848
+ };
38849
+ }
38850
+
38851
+ function splitLaneHandler(count) {
38852
+
38853
+ return function(event, element) {
38854
+
38855
+ // actual split
38856
+ modeling.splitLane(element, count);
38857
+
38858
+ // refresh context pad after split to
38859
+ // get rid of split icons
38860
+ contextPad.open(element, true);
38861
+ };
38862
+ }
38863
+
38864
+
38865
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
38866
+
38867
+ var childLanes = getChildLanes(element);
38868
+
38869
+ assign$1(actions, {
38870
+ 'lane-insert-above': {
38871
+ group: 'lane-insert-above',
38872
+ className: 'bpmn-icon-lane-insert-above',
38873
+ title: translate('Add Lane above'),
38874
+ action: {
38875
+ click: function(event, element) {
38876
+ modeling.addLane(element, 'top');
38877
+ }
38878
+ }
38879
+ }
38880
+ });
38881
+
38882
+ if (childLanes.length < 2) {
38883
+
38884
+ if (element.height >= 120) {
38885
+ assign$1(actions, {
38886
+ 'lane-divide-two': {
38887
+ group: 'lane-divide',
38888
+ className: 'bpmn-icon-lane-divide-two',
38889
+ title: translate('Divide into two Lanes'),
38890
+ action: {
38891
+ click: splitLaneHandler(2)
38892
+ }
38893
+ }
38894
+ });
38895
+ }
38896
+
38897
+ if (element.height >= 180) {
38898
+ assign$1(actions, {
38899
+ 'lane-divide-three': {
38900
+ group: 'lane-divide',
38901
+ className: 'bpmn-icon-lane-divide-three',
38902
+ title: translate('Divide into three Lanes'),
38903
+ action: {
38904
+ click: splitLaneHandler(3)
38905
+ }
38906
+ }
38907
+ });
38908
+ }
38909
+ }
38910
+
38911
+ assign$1(actions, {
38912
+ 'lane-insert-below': {
38913
+ group: 'lane-insert-below',
38914
+ className: 'bpmn-icon-lane-insert-below',
38915
+ title: translate('Add Lane below'),
38916
+ action: {
38917
+ click: function(event, element) {
38918
+ modeling.addLane(element, 'bottom');
38919
+ }
38920
+ }
38921
+ }
38922
+ });
38923
+
38924
+ }
38925
+
38926
+ if (is$1(businessObject, 'bpmn:FlowNode')) {
38927
+
38928
+ if (is$1(businessObject, 'bpmn:EventBasedGateway')) {
38929
+
38930
+ assign$1(actions, {
38931
+ 'append.receive-task': appendAction(
38932
+ 'bpmn:ReceiveTask',
38933
+ 'bpmn-icon-receive-task',
38934
+ translate('Append ReceiveTask')
38935
+ ),
38936
+ 'append.message-intermediate-event': appendAction(
38937
+ 'bpmn:IntermediateCatchEvent',
38938
+ 'bpmn-icon-intermediate-event-catch-message',
38939
+ translate('Append MessageIntermediateCatchEvent'),
38940
+ { eventDefinitionType: 'bpmn:MessageEventDefinition' }
38941
+ ),
38942
+ 'append.timer-intermediate-event': appendAction(
38943
+ 'bpmn:IntermediateCatchEvent',
38944
+ 'bpmn-icon-intermediate-event-catch-timer',
38945
+ translate('Append TimerIntermediateCatchEvent'),
38946
+ { eventDefinitionType: 'bpmn:TimerEventDefinition' }
38947
+ ),
38948
+ 'append.condition-intermediate-event': appendAction(
38949
+ 'bpmn:IntermediateCatchEvent',
38950
+ 'bpmn-icon-intermediate-event-catch-condition',
38951
+ translate('Append ConditionIntermediateCatchEvent'),
38952
+ { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
38953
+ ),
38954
+ 'append.signal-intermediate-event': appendAction(
38955
+ 'bpmn:IntermediateCatchEvent',
38956
+ 'bpmn-icon-intermediate-event-catch-signal',
38957
+ translate('Append SignalIntermediateCatchEvent'),
38958
+ { eventDefinitionType: 'bpmn:SignalEventDefinition' }
38959
+ )
38960
+ });
38961
+ } else
38962
+
38963
+ if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
38964
+
38965
+ assign$1(actions, {
38966
+ 'append.compensation-activity':
38967
+ appendAction(
38968
+ 'bpmn:Task',
38969
+ 'bpmn-icon-task',
38970
+ translate('Append compensation activity'),
38971
+ {
38972
+ isForCompensation: true
38973
+ }
38974
+ )
38975
+ });
38976
+ } else
38977
+
38978
+ if (!is$1(businessObject, 'bpmn:EndEvent') &&
38979
+ !businessObject.isForCompensation &&
38980
+ !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
38981
+ !isEventSubProcess(businessObject)) {
38982
+
38983
+ assign$1(actions, {
38984
+ 'append.end-event': appendAction(
38985
+ 'bpmn:EndEvent',
38986
+ 'bpmn-icon-end-event-none',
38987
+ translate('Append EndEvent')
38988
+ ),
38989
+ 'append.gateway': appendAction(
38990
+ 'bpmn:ExclusiveGateway',
38991
+ 'bpmn-icon-gateway-none',
38992
+ translate('Append Gateway')
38993
+ ),
38994
+ 'append.append-task': appendAction(
38995
+ 'bpmn:Task',
38996
+ 'bpmn-icon-task',
38997
+ translate('Append Task')
38998
+ ),
38999
+ 'append.intermediate-event': appendAction(
39000
+ 'bpmn:IntermediateThrowEvent',
39001
+ 'bpmn-icon-intermediate-event-none',
39002
+ translate('Append Intermediate/Boundary Event')
39003
+ )
39004
+ });
39005
+ }
39006
+ }
39007
+
39008
+ if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
39009
+
39010
+ // Replace menu entry
39011
+ assign$1(actions, {
39012
+ 'replace': {
39013
+ group: 'edit',
39014
+ className: 'bpmn-icon-screw-wrench',
39015
+ title: translate('Change type'),
39016
+ action: {
39017
+ click: function(event, element) {
39018
+
39019
+ var position = assign$1(getReplaceMenuPosition(element), {
39020
+ cursor: { x: event.x, y: event.y }
39021
+ });
39022
+
39023
+ popupMenu.open(element, 'bpmn-replace', position, {
39024
+ title: translate('Change element'),
39025
+ width: 300,
39026
+ search: true
39027
+ });
39028
+ }
39029
+ }
39030
+ }
39031
+ });
39032
+ }
39033
+
39034
+ if (is$1(businessObject, 'bpmn:SequenceFlow')) {
39035
+ assign$1(actions, {
39036
+ 'append.text-annotation': appendAction(
39037
+ 'bpmn:TextAnnotation',
39038
+ 'bpmn-icon-text-annotation'
39039
+ )
39040
+ });
39041
+ }
39042
+
39043
+ if (
39044
+ isAny(businessObject, [
39045
+ 'bpmn:FlowNode',
39046
+ 'bpmn:InteractionNode',
39047
+ 'bpmn:DataObjectReference',
39048
+ 'bpmn:DataStoreReference',
39049
+ ])
39050
+ ) {
39051
+ assign$1(actions, {
39052
+ 'append.text-annotation': appendAction(
39053
+ 'bpmn:TextAnnotation',
39054
+ 'bpmn-icon-text-annotation'
39055
+ ),
39056
+
39057
+ 'connect': {
39058
+ group: 'connect',
39059
+ className: 'bpmn-icon-connection-multi',
39060
+ title: translate(
39061
+ 'Connect using ' +
39062
+ (businessObject.isForCompensation
39063
+ ? ''
39064
+ : 'Sequence/MessageFlow or ') +
39065
+ 'Association'
39066
+ ),
39067
+ action: {
39068
+ click: startConnect,
39069
+ dragstart: startConnect,
39070
+ },
39071
+ },
39072
+ });
39073
+ }
39074
+
39075
+ if (is$1(businessObject, 'bpmn:TextAnnotation')) {
39076
+ assign$1(actions, {
39077
+ 'connect': {
39078
+ group: 'connect',
39079
+ className: 'bpmn-icon-connection-multi',
39080
+ title: translate('Connect using Association'),
39081
+ action: {
39082
+ click: startConnect,
39083
+ dragstart: startConnect,
39084
+ },
39085
+ },
39086
+ });
39087
+ }
39088
+
39089
+ if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
39090
+ assign$1(actions, {
39091
+ 'connect': {
39092
+ group: 'connect',
39093
+ className: 'bpmn-icon-connection-multi',
39094
+ title: translate('Connect using DataInputAssociation'),
39095
+ action: {
39096
+ click: startConnect,
39097
+ dragstart: startConnect
39098
+ }
39099
+ }
39100
+ });
39101
+ }
39102
+
39103
+ if (is$1(businessObject, 'bpmn:Group')) {
39104
+ assign$1(actions, {
39105
+ 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39106
+ });
39107
+ }
39108
+
39109
+ // delete element entry, only show if allowed by rules
39110
+ var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
39111
+
39112
+ if (isArray$3(deleteAllowed)) {
39113
+
39114
+ // was the element returned as a deletion candidate?
39115
+ deleteAllowed = deleteAllowed[0] === element;
39116
+ }
39117
+
39118
+ if (deleteAllowed) {
39119
+ assign$1(actions, {
39120
+ 'delete': {
39121
+ group: 'edit',
39122
+ className: 'bpmn-icon-trash',
39123
+ title: translate('Remove'),
39124
+ action: {
39125
+ click: removeElement
39126
+ }
39127
+ }
39128
+ });
39129
+ }
39130
+
39131
+ return actions;
39132
+ };
39133
+
39134
+
39135
+ // helpers /////////
39136
+
39137
+ function isEventType(eventBo, type, definition) {
39138
+
39139
+ var isType = eventBo.$instanceOf(type);
39140
+ var isDefinition = false;
39141
+
39142
+ var definitions = eventBo.eventDefinitions || [];
39143
+ forEach$1(definitions, function(def) {
39144
+ if (def.$type === definition) {
39145
+ isDefinition = true;
39146
+ }
39147
+ });
39148
+
39149
+ return isType && isDefinition;
39150
+ }
39151
+
39152
+ function includes$7(array, item) {
39153
+ return array.indexOf(item) !== -1;
39154
+ }
39155
+
39156
+ var ContextPadModule = {
39157
+ __depends__: [
39158
+ DirectEditingModule,
39159
+ ContextPadModule$1,
39160
+ SelectionModule,
39161
+ ConnectModule,
39162
+ CreateModule,
39163
+ PopupMenuModule
39164
+ ],
39165
+ __init__: [ 'contextPadProvider' ],
39166
+ contextPadProvider: [ 'type', ContextPadProvider ]
39167
+ };
39168
+
39169
+ var TOGGLE_SELECTOR = '.djs-palette-toggle',
39170
+ ENTRY_SELECTOR = '.entry',
39171
+ ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
39172
+
39173
+ var PALETTE_PREFIX = 'djs-palette-',
39174
+ PALETTE_SHOWN_CLS = 'shown',
39175
+ PALETTE_OPEN_CLS = 'open',
39176
+ PALETTE_TWO_COLUMN_CLS = 'two-column';
39177
+
39178
+ var DEFAULT_PRIORITY = 1000;
39179
+
39180
+
39181
+ /**
39182
+ * A palette containing modeling elements.
39183
+ */
39184
+ function Palette(eventBus, canvas) {
39185
+
39186
+ this._eventBus = eventBus;
39187
+ this._canvas = canvas;
39188
+
39189
+ var self = this;
39190
+
39191
+ eventBus.on('tool-manager.update', function(event) {
39192
+ var tool = event.tool;
39193
+
39194
+ self.updateToolHighlight(tool);
39195
+ });
39196
+
39197
+ eventBus.on('i18n.changed', function() {
39198
+ self._update();
39199
+ });
39200
+
39201
+ eventBus.on('diagram.init', function() {
39202
+
39203
+ self._diagramInitialized = true;
39204
+
39205
+ self._rebuild();
39206
+ });
39207
+ }
39208
+
39209
+ Palette.$inject = [ 'eventBus', 'canvas' ];
39210
+
39211
+
39212
+ /**
39213
+ * Register a provider with the palette
39214
+ *
39215
+ * @param {number} [priority=1000]
39216
+ * @param {PaletteProvider} provider
39217
+ *
39218
+ * @example
39219
+ * const paletteProvider = {
39220
+ * getPaletteEntries: function() {
39221
+ * return function(entries) {
39222
+ * return {
39223
+ * ...entries,
39224
+ * 'entry-1': {
39225
+ * label: 'My Entry',
39226
+ * action: function() { alert("I have been clicked!"); }
39227
+ * }
39228
+ * };
39229
+ * }
39230
+ * }
39231
+ * };
39232
+ *
39233
+ * palette.registerProvider(800, paletteProvider);
39234
+ */
39235
+ Palette.prototype.registerProvider = function(priority, provider) {
39236
+ if (!provider) {
39237
+ provider = priority;
39238
+ priority = DEFAULT_PRIORITY;
39239
+ }
39240
+
39241
+ this._eventBus.on('palette.getProviders', priority, function(event) {
39242
+ event.providers.push(provider);
39243
+ });
39244
+
39245
+ this._rebuild();
39246
+ };
39247
+
39248
+
39249
+ /**
39250
+ * Returns the palette entries
39251
+ *
39252
+ * @return {Object<string, PaletteEntryDescriptor>} map of entries
39253
+ */
39254
+ Palette.prototype.getEntries = function() {
39255
+ var providers = this._getProviders();
39256
+
39257
+ return providers.reduce(addPaletteEntries, {});
39258
+ };
39259
+
39260
+ Palette.prototype._rebuild = function() {
39261
+
39262
+ if (!this._diagramInitialized) {
39263
+ return;
39264
+ }
39265
+
39266
+ var providers = this._getProviders();
39267
+
39268
+ if (!providers.length) {
39269
+ return;
39270
+ }
39271
+
39272
+ if (!this._container) {
39273
+ this._init();
39274
+ }
39275
+
39276
+ this._update();
39277
+ };
39278
+
39279
+ /**
39280
+ * Initialize
39281
+ */
39282
+ Palette.prototype._init = function() {
39283
+
39284
+ var self = this;
39285
+
39286
+ var eventBus = this._eventBus;
39287
+
39288
+ var parentContainer = this._getParentContainer();
39289
+
39290
+ var container = this._container = domify$1(Palette.HTML_MARKUP);
39291
+
39292
+ parentContainer.appendChild(container);
39293
+ classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
39294
+
39295
+ delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
39296
+
39297
+ var target = event.delegateTarget;
39298
+
39299
+ if (matches(target, TOGGLE_SELECTOR)) {
39300
+ return self.toggle();
39301
+ }
39302
+
39303
+ self.trigger('click', event);
39304
+ });
39305
+
39306
+ // prevent drag propagation
39307
+ event.bind(container, 'mousedown', function(event) {
39308
+ event.stopPropagation();
39309
+ });
39310
+
39311
+ // prevent drag propagation
39312
+ delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
39313
+ self.trigger('dragstart', event);
39314
+ });
39315
+
39316
+ eventBus.on('canvas.resized', this._layoutChanged, this);
39317
+
39318
+ eventBus.fire('palette.create', {
39319
+ container: container
39320
+ });
39321
+ };
39322
+
39323
+ Palette.prototype._getProviders = function(id) {
39324
+
39325
+ var event = this._eventBus.createEvent({
39326
+ type: 'palette.getProviders',
39327
+ providers: []
39328
+ });
39329
+
39330
+ this._eventBus.fire(event);
39331
+
39332
+ return event.providers;
39333
+ };
39334
+
39335
+ /**
39336
+ * Update palette state.
39337
+ *
39338
+ * @param {Object} [state] { open, twoColumn }
39339
+ */
39340
+ Palette.prototype._toggleState = function(state) {
39341
+
39342
+ state = state || {};
39343
+
39344
+ var parent = this._getParentContainer(),
39345
+ container = this._container;
39346
+
39347
+ var eventBus = this._eventBus;
39348
+
39349
+ var twoColumn;
39350
+
39351
+ var cls = classes$1(container),
39352
+ parentCls = classes$1(parent);
39353
+
39354
+ if ('twoColumn' in state) {
39355
+ twoColumn = state.twoColumn;
39356
+ } else {
39357
+ twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
39358
+ }
39359
+
39360
+ // always update two column
39361
+ cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
39362
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
39363
+
39364
+ if ('open' in state) {
39365
+ cls.toggle(PALETTE_OPEN_CLS, state.open);
39366
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
39367
+ }
39368
+
39369
+ eventBus.fire('palette.changed', {
39370
+ twoColumn: twoColumn,
39371
+ open: this.isOpen()
39372
+ });
39373
+ };
39374
+
39375
+ Palette.prototype._update = function() {
39376
+
39377
+ var entriesContainer = query('.djs-palette-entries', this._container),
39378
+ entries = this._entries = this.getEntries();
39379
+
39380
+ clear$1(entriesContainer);
39381
+
39382
+ forEach$1(entries, function(entry, id) {
39383
+
39384
+ var grouping = entry.group || 'default';
39385
+
39386
+ var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
39387
+ if (!container) {
39388
+ container = domify$1('<div class="group"></div>');
39389
+ attr$1(container, 'data-group', grouping);
39390
+
39391
+ entriesContainer.appendChild(container);
39392
+ }
39393
+
39394
+ var html = entry.html || (
39395
+ entry.separator ?
39396
+ '<hr class="separator" />' :
39397
+ '<div class="entry" draggable="true"></div>');
39398
+
39399
+
39400
+ var control = domify$1(html);
39401
+ container.appendChild(control);
39402
+
39403
+ if (!entry.separator) {
39404
+ attr$1(control, 'data-action', id);
39405
+
39406
+ if (entry.title) {
39407
+ attr$1(control, 'title', entry.title);
39408
+ }
39409
+
39410
+ if (entry.className) {
39411
+ addClasses(control, entry.className);
39412
+ }
39413
+
39414
+ if (entry.imageUrl) {
39415
+ var image = domify$1('<img>');
39416
+ attr$1(image, 'src', entry.imageUrl);
39417
+
39418
+ control.appendChild(image);
39419
+ }
39420
+ }
39421
+ });
39422
+
39423
+ // open after update
39424
+ this.open();
39425
+ };
39426
+
39427
+
39428
+ /**
39429
+ * Trigger an action available on the palette
39430
+ *
39431
+ * @param {string} action
39432
+ * @param {Event} event
39433
+ */
39434
+ Palette.prototype.trigger = function(action, event, autoActivate) {
39435
+ var entry,
39436
+ originalEvent,
39437
+ button = event.delegateTarget || event.target;
39438
+
39439
+ if (!button) {
39440
+ return event.preventDefault();
39441
+ }
39442
+
39443
+ entry = attr$1(button, 'data-action');
39444
+ originalEvent = event.originalEvent || event;
39445
+
39446
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
39447
+ };
39448
+
39449
+ Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
39450
+ var entries = this._entries,
39451
+ entry,
39452
+ handler;
39453
+
39454
+ entry = entries[entryId];
39455
+
39456
+ // when user clicks on the palette and not on an action
39457
+ if (!entry) {
39458
+ return;
39459
+ }
39460
+
39461
+ handler = entry.action;
39462
+
39463
+ // simple action (via callback function)
39464
+ if (isFunction(handler)) {
39465
+ if (action === 'click') {
39466
+ return handler(event, autoActivate);
39467
+ }
39468
+ } else {
39469
+ if (handler[action]) {
39470
+ return handler[action](event, autoActivate);
39471
+ }
39472
+ }
39473
+
39474
+ // silence other actions
39475
+ event.preventDefault();
39476
+ };
39477
+
39478
+ Palette.prototype._layoutChanged = function() {
39479
+ this._toggleState({});
39480
+ };
39481
+
39482
+ /**
39483
+ * Do we need to collapse to two columns?
39484
+ *
39485
+ * @param {number} availableHeight
39486
+ * @param {Object} entries
39487
+ *
39488
+ * @return {boolean}
39489
+ */
39490
+ Palette.prototype._needsCollapse = function(availableHeight, entries) {
39491
+
39492
+ // top margin + bottom toggle + bottom margin
39493
+ // implementors must override this method if they
39494
+ // change the palette styles
39495
+ var margin = 20 + 10 + 20;
39496
+
39497
+ var entriesHeight = Object.keys(entries).length * 46;
39498
+
39499
+ return availableHeight < entriesHeight + margin;
39500
+ };
39501
+
39502
+ /**
39503
+ * Close the palette
39504
+ */
39505
+ Palette.prototype.close = function() {
39506
+
39507
+ this._toggleState({
39508
+ open: false,
39509
+ twoColumn: false
39510
+ });
39511
+ };
39512
+
39513
+
39514
+ /**
39515
+ * Open the palette
39516
+ */
39517
+ Palette.prototype.open = function() {
39518
+ this._toggleState({ open: true });
39519
+ };
39520
+
39521
+
39522
+ Palette.prototype.toggle = function(open) {
39523
+ if (this.isOpen()) {
39524
+ this.close();
39525
+ } else {
39526
+ this.open();
39527
+ }
39528
+ };
39529
+
39530
+ Palette.prototype.isActiveTool = function(tool) {
39531
+ return tool && this._activeTool === tool;
39532
+ };
39533
+
39534
+ Palette.prototype.updateToolHighlight = function(name) {
39535
+ var entriesContainer,
39536
+ toolsContainer;
39537
+
39538
+ if (!this._toolsContainer) {
39539
+ entriesContainer = query('.djs-palette-entries', this._container);
39540
+
39541
+ this._toolsContainer = query('[data-group=tools]', entriesContainer);
39542
+ }
39543
+
39544
+ toolsContainer = this._toolsContainer;
39545
+
39546
+ forEach$1(toolsContainer.children, function(tool) {
39547
+ var actionName = tool.getAttribute('data-action');
39548
+
39549
+ if (!actionName) {
39550
+ return;
39551
+ }
39552
+
39553
+ var toolClasses = classes$1(tool);
39554
+
39555
+ actionName = actionName.replace('-tool', '');
39556
+
39557
+ if (toolClasses.contains('entry') && actionName === name) {
39558
+ toolClasses.add('highlighted-entry');
39559
+ } else {
39560
+ toolClasses.remove('highlighted-entry');
39561
+ }
39562
+ });
39563
+ };
39564
+
39565
+
39566
+ /**
39567
+ * Return true if the palette is opened.
39568
+ *
39569
+ * @example
39570
+ *
39571
+ * palette.open();
39572
+ *
39573
+ * if (palette.isOpen()) {
39574
+ * // yes, we are open
39575
+ * }
39576
+ *
39577
+ * @return {boolean} true if palette is opened
39578
+ */
39579
+ Palette.prototype.isOpen = function() {
39580
+ return classes$1(this._container).has(PALETTE_OPEN_CLS);
39581
+ };
39582
+
39583
+ /**
39584
+ * Get container the palette lives in.
39585
+ *
39586
+ * @return {Element}
39587
+ */
39588
+ Palette.prototype._getParentContainer = function() {
39589
+ return this._canvas.getContainer();
39590
+ };
39591
+
39592
+
39593
+ /* markup definition */
39594
+
39595
+ Palette.HTML_MARKUP =
39596
+ '<div class="djs-palette">' +
39597
+ '<div class="djs-palette-entries"></div>' +
39598
+ '<div class="djs-palette-toggle"></div>' +
39599
+ '</div>';
39600
+
39601
+
39602
+ // helpers //////////////////////
39603
+
39604
+ function addClasses(element, classNames) {
39605
+
39606
+ var classes = classes$1(element);
39607
+
39608
+ var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
39609
+ actualClassNames.forEach(function(cls) {
39610
+ classes.add(cls);
39611
+ });
39612
+ }
39613
+
39614
+ function addPaletteEntries(entries, provider) {
39615
+
39616
+ var entriesOrUpdater = provider.getPaletteEntries();
39617
+
39618
+ if (isFunction(entriesOrUpdater)) {
39619
+ return entriesOrUpdater(entries);
39620
+ }
39621
+
39622
+ forEach$1(entriesOrUpdater, function(entry, id) {
39623
+ entries[id] = entry;
39624
+ });
39625
+
39626
+ return entries;
39627
+ }
39628
+
39629
+ var PaletteModule$1 = {
39630
+ __init__: [ 'palette' ],
39631
+ palette: [ 'type', Palette ]
39632
+ };
39633
+
39634
+ var EVENT_GROUP = {
39635
+ id: 'events',
39636
+ name: 'Events'
39637
+ };
39638
+
39639
+ var TASK_GROUP = {
39640
+ id: 'tasks',
39641
+ name: 'Tasks'
39642
+ };
39643
+
39644
+ var DATA_GROUP = {
39645
+ id: 'data',
39646
+ name: 'Data'
39647
+ };
39648
+
39649
+ var PARTICIPANT_GROUP = {
39650
+ id: 'participants',
39651
+ name: 'Participants'
39652
+ };
39653
+
39654
+ var SUBPROCESS_GROUP = {
39655
+ id: 'subprocess',
39656
+ name: 'Sub Processes'
39657
+ };
39658
+
39659
+ var GATEWAY_GROUP = {
39660
+ id: 'gateways',
39661
+ name: 'Gateways'
39662
+ };
39663
+
39664
+ var NONE_EVENTS = [
39665
+ {
39666
+ label: 'Start Event',
39667
+ actionName: 'none-start-event',
39668
+ className: 'bpmn-icon-start-event-none',
39669
+ target: {
39670
+ type: 'bpmn:StartEvent'
39671
+ }
39672
+ },
39673
+ {
39674
+ label: 'Intermediate Throw Event',
39675
+ actionName: 'none-intermediate-throwing',
39676
+ className: 'bpmn-icon-intermediate-event-none',
39677
+ target: {
39678
+ type: 'bpmn:IntermediateThrowEvent'
39679
+ }
39680
+ },
39681
+ {
39682
+ label: 'Boundary Event',
39683
+ actionName: 'none-boundary-event',
39684
+ className: 'bpmn-icon-intermediate-event-none',
39685
+ target: {
39686
+ type: 'bpmn:BoundaryEvent'
39687
+ }
39688
+ },
39689
+ {
39690
+ label: 'End Event',
39691
+ actionName: 'none-end-event',
39692
+ className: 'bpmn-icon-end-event-none',
39693
+ target: {
39694
+ type: 'bpmn:EndEvent'
39695
+ }
39696
+ }
39697
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39698
+
39699
+ var TYPED_START_EVENTS = [
39700
+ {
39701
+ label: 'Message Start Event',
39702
+ actionName: 'message-start',
39703
+ className: 'bpmn-icon-start-event-message',
39704
+ target: {
39705
+ type: 'bpmn:StartEvent',
39706
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39707
+ }
39708
+ },
39709
+ {
39710
+ label: 'Timer Start Event',
39711
+ actionName: 'timer-start',
39712
+ className: 'bpmn-icon-start-event-timer',
39713
+ target: {
39714
+ type: 'bpmn:StartEvent',
39715
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39716
+ }
39717
+ },
39718
+ {
39719
+ label: 'Conditional Start Event',
39720
+ actionName: 'conditional-start',
39721
+ className: 'bpmn-icon-start-event-condition',
39722
+ target: {
39723
+ type: 'bpmn:StartEvent',
39724
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39725
+ }
39726
+ },
39727
+ {
39728
+ label: 'Signal Start Event',
39729
+ actionName: 'signal-start',
39730
+ className: 'bpmn-icon-start-event-signal',
39731
+ target: {
39732
+ type: 'bpmn:StartEvent',
39733
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39734
+ }
39735
+ }
39736
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39737
+
39738
+ var TYPED_INTERMEDIATE_EVENT = [
39739
+ {
39740
+ label: 'Message Intermediate Catch Event',
39741
+ actionName: 'message-intermediate-catch',
39742
+ className: 'bpmn-icon-intermediate-event-catch-message',
39743
+ target: {
39744
+ type: 'bpmn:IntermediateCatchEvent',
39745
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39746
+ }
39747
+ },
39748
+ {
39749
+ label: 'Message Intermediate Throw Event',
39750
+ actionName: 'message-intermediate-throw',
39751
+ className: 'bpmn-icon-intermediate-event-throw-message',
39752
+ target: {
39753
+ type: 'bpmn:IntermediateThrowEvent',
39754
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39755
+ }
39756
+ },
39757
+ {
39758
+ label: 'Timer Intermediate Catch Event',
39759
+ actionName: 'timer-intermediate-catch',
39760
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39761
+ target: {
39762
+ type: 'bpmn:IntermediateCatchEvent',
39763
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39764
+ }
39765
+ },
39766
+ {
39767
+ label: 'Escalation Intermediate Throw Event',
39768
+ actionName: 'escalation-intermediate-throw',
39769
+ className: 'bpmn-icon-intermediate-event-throw-escalation',
39770
+ target: {
39771
+ type: 'bpmn:IntermediateThrowEvent',
39772
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39773
+ }
39774
+ },
39775
+ {
39776
+ label: 'Conditional Intermediate Catch Event',
39777
+ actionName: 'conditional-intermediate-catch',
39778
+ className: 'bpmn-icon-intermediate-event-catch-condition',
39779
+ target: {
39780
+ type: 'bpmn:IntermediateCatchEvent',
39781
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39782
+ }
39783
+ },
39784
+ {
39785
+ label: 'Link Intermediate Catch Event',
39786
+ actionName: 'link-intermediate-catch',
39787
+ className: 'bpmn-icon-intermediate-event-catch-link',
39788
+ target: {
39789
+ type: 'bpmn:IntermediateCatchEvent',
39790
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
39791
+ eventDefinitionAttrs: {
39792
+ name: ''
39793
+ }
39794
+ }
39795
+ },
39796
+ {
39797
+ label: 'Link Intermediate Throw Event',
39798
+ actionName: 'link-intermediate-throw',
39799
+ className: 'bpmn-icon-intermediate-event-throw-link',
39800
+ target: {
39801
+ type: 'bpmn:IntermediateThrowEvent',
39802
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
39803
+ eventDefinitionAttrs: {
39804
+ name: ''
39805
+ }
39806
+ }
39807
+ },
39808
+ {
39809
+ label: 'Compensation Intermediate Throw Event',
39810
+ actionName: 'compensation-intermediate-throw',
39811
+ className: 'bpmn-icon-intermediate-event-throw-compensation',
39812
+ target: {
39813
+ type: 'bpmn:IntermediateThrowEvent',
39814
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39815
+ }
39816
+ },
39817
+ {
39818
+ label: 'Signal Intermediate Catch Event',
39819
+ actionName: 'signal-intermediate-catch',
39820
+ className: 'bpmn-icon-intermediate-event-catch-signal',
39821
+ target: {
39822
+ type: 'bpmn:IntermediateCatchEvent',
39823
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39824
+ }
39825
+ },
39826
+ {
39827
+ label: 'Signal Intermediate Throw Event',
39828
+ actionName: 'signal-intermediate-throw',
39829
+ className: 'bpmn-icon-intermediate-event-throw-signal',
39830
+ target: {
39831
+ type: 'bpmn:IntermediateThrowEvent',
39832
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39833
+ }
39834
+ }
39835
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39836
+
39837
+ var TYPED_BOUNDARY_EVENT = [
39838
+ {
39839
+ label: 'Message Boundary Event',
39840
+ actionName: 'message-boundary',
39841
+ className: 'bpmn-icon-intermediate-event-catch-message',
39842
+ target: {
39843
+ type: 'bpmn:BoundaryEvent',
39844
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39845
+ }
39846
+ },
39847
+ {
39848
+ label: 'Timer Boundary Event',
39849
+ actionName: 'timer-boundary',
39850
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39851
+ target: {
39852
+ type: 'bpmn:BoundaryEvent',
39853
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39854
+ }
39855
+ },
39856
+ {
39857
+ label: 'Escalation Boundary Event',
39858
+ actionName: 'escalation-boundary',
39859
+ className: 'bpmn-icon-intermediate-event-catch-escalation',
39860
+ target: {
39861
+ type: 'bpmn:BoundaryEvent',
39862
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39863
+ }
39864
+ },
39865
+ {
39866
+ label: 'Conditional Boundary Event',
39867
+ actionName: 'conditional-boundary',
39868
+ className: 'bpmn-icon-intermediate-event-catch-condition',
39869
+ target: {
39870
+ type: 'bpmn:BoundaryEvent',
39871
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39872
+ }
39873
+ },
39874
+ {
39875
+ label: 'Error Boundary Event',
39876
+ actionName: 'error-boundary',
39877
+ className: 'bpmn-icon-intermediate-event-catch-error',
39878
+ target: {
39879
+ type: 'bpmn:BoundaryEvent',
39880
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
39881
+ }
39882
+ },
39883
+ {
39884
+ label: 'Cancel Boundary Event',
39885
+ actionName: 'cancel-boundary',
39886
+ className: 'bpmn-icon-intermediate-event-catch-cancel',
39887
+ target: {
39888
+ type: 'bpmn:BoundaryEvent',
39889
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
39890
+ }
39891
+ },
39892
+ {
39893
+ label: 'Signal Boundary Event',
39894
+ actionName: 'signal-boundary',
39895
+ className: 'bpmn-icon-intermediate-event-catch-signal',
39896
+ target: {
39897
+ type: 'bpmn:BoundaryEvent',
39898
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39899
+ }
39900
+ },
39901
+ {
39902
+ label: 'Compensation Boundary Event',
39903
+ actionName: 'compensation-boundary',
39904
+ className: 'bpmn-icon-intermediate-event-catch-compensation',
39905
+ target: {
39906
+ type: 'bpmn:BoundaryEvent',
39907
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39908
+ }
39909
+ },
39910
+ {
39911
+ label: 'Message Boundary Event (non-interrupting)',
39912
+ actionName: 'non-interrupting-message-boundary',
39913
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
39914
+ target: {
39915
+ type: 'bpmn:BoundaryEvent',
39916
+ eventDefinitionType: 'bpmn:MessageEventDefinition',
39917
+ cancelActivity: false
39918
+ }
39919
+ },
39920
+ {
39921
+ label: 'Timer Boundary Event (non-interrupting)',
39922
+ actionName: 'non-interrupting-timer-boundary',
39923
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
39924
+ target: {
39925
+ type: 'bpmn:BoundaryEvent',
39926
+ eventDefinitionType: 'bpmn:TimerEventDefinition',
39927
+ cancelActivity: false
39928
+ }
39929
+ },
39930
+ {
39931
+ label: 'Escalation Boundary Event (non-interrupting)',
39932
+ actionName: 'non-interrupting-escalation-boundary',
39933
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
39934
+ target: {
39935
+ type: 'bpmn:BoundaryEvent',
39936
+ eventDefinitionType: 'bpmn:EscalationEventDefinition',
39937
+ cancelActivity: false
39938
+ }
39939
+ },
39940
+ {
39941
+ label: 'Conditional Boundary Event (non-interrupting)',
39942
+ actionName: 'non-interrupting-conditional-boundary',
39943
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
39944
+ target: {
39945
+ type: 'bpmn:BoundaryEvent',
39946
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition',
39947
+ cancelActivity: false
39948
+ }
39949
+ },
39950
+ {
39951
+ label: 'Signal Boundary Event (non-interrupting)',
39952
+ actionName: 'non-interrupting-signal-boundary',
39953
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
39954
+ target: {
39955
+ type: 'bpmn:BoundaryEvent',
39956
+ eventDefinitionType: 'bpmn:SignalEventDefinition',
39957
+ cancelActivity: false
39958
+ }
39959
+ }
39960
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39961
+
39962
+ var TYPED_END_EVENT = [
39963
+ {
39964
+ label: 'Message End Event',
39965
+ actionName: 'message-end',
39966
+ className: 'bpmn-icon-end-event-message',
39967
+ target: {
39968
+ type: 'bpmn:EndEvent',
39969
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39970
+ }
39971
+ },
39972
+ {
39973
+ label: 'Escalation End Event',
39974
+ actionName: 'escalation-end',
39975
+ className: 'bpmn-icon-end-event-escalation',
39976
+ target: {
39977
+ type: 'bpmn:EndEvent',
39978
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39979
+ }
39980
+ },
39981
+ {
39982
+ label: 'Error End Event',
39983
+ actionName: 'error-end',
39984
+ className: 'bpmn-icon-end-event-error',
39985
+ target: {
39986
+ type: 'bpmn:EndEvent',
39987
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
39988
+ }
39989
+ },
39990
+ {
39991
+ label: 'Cancel End Event',
39992
+ actionName: 'cancel-end',
39993
+ className: 'bpmn-icon-end-event-cancel',
39994
+ target: {
39995
+ type: 'bpmn:EndEvent',
39996
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
39997
+ }
39998
+ },
39999
+ {
40000
+ label: 'Compensation End Event',
40001
+ actionName: 'compensation-end',
40002
+ className: 'bpmn-icon-end-event-compensation',
40003
+ target: {
40004
+ type: 'bpmn:EndEvent',
40005
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40006
+ }
40007
+ },
40008
+ {
40009
+ label: 'Signal End Event',
40010
+ actionName: 'signal-end',
40011
+ className: 'bpmn-icon-end-event-signal',
40012
+ target: {
40013
+ type: 'bpmn:EndEvent',
40014
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40015
+ }
40016
+ },
40017
+ {
40018
+ label: 'Terminate End Event',
40019
+ actionName: 'terminate-end',
40020
+ className: 'bpmn-icon-end-event-terminate',
40021
+ target: {
40022
+ type: 'bpmn:EndEvent',
40023
+ eventDefinitionType: 'bpmn:TerminateEventDefinition'
40024
+ }
40025
+ }
40026
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40027
+
40028
+ var GATEWAY = [
40029
+ {
40030
+ label: 'Exclusive Gateway',
40031
+ actionName: 'exclusive-gateway',
40032
+ className: 'bpmn-icon-gateway-xor',
40033
+ target: {
40034
+ type: 'bpmn:ExclusiveGateway'
40035
+ }
40036
+ },
40037
+ {
40038
+ label: 'Parallel Gateway',
40039
+ actionName: 'parallel-gateway',
40040
+ className: 'bpmn-icon-gateway-parallel',
40041
+ target: {
40042
+ type: 'bpmn:ParallelGateway'
40043
+ }
40044
+ },
40045
+ {
40046
+ label: 'Inclusive Gateway',
40047
+ search: 'or',
40048
+ actionName: 'inclusive-gateway',
40049
+ className: 'bpmn-icon-gateway-or',
40050
+ target: {
40051
+ type: 'bpmn:InclusiveGateway'
40052
+ },
40053
+ rank: -1
40054
+ },
40055
+ {
40056
+ label: 'Complex Gateway',
40057
+ actionName: 'complex-gateway',
40058
+ className: 'bpmn-icon-gateway-complex',
40059
+ target: {
40060
+ type: 'bpmn:ComplexGateway'
40061
+ },
40062
+ rank: -1
40063
+ },
40064
+ {
40065
+ label: 'Event based Gateway',
40066
+ actionName: 'event-based-gateway',
40067
+ className: 'bpmn-icon-gateway-eventbased',
40068
+ target: {
40069
+ type: 'bpmn:EventBasedGateway',
40070
+ instantiate: false,
40071
+ eventGatewayType: 'Exclusive'
40072
+ }
40073
+ }
40074
+ ].map(option => ({ ...option, group: GATEWAY_GROUP }));
40075
+
40076
+ var SUBPROCESS = [
40077
+ {
40078
+ label: 'Transaction',
40079
+ actionName: 'transaction',
40080
+ className: 'bpmn-icon-transaction',
40081
+ target: {
40082
+ type: 'bpmn:Transaction',
40083
+ isExpanded: true
40084
+ }
40085
+ },
40086
+ {
40087
+ label: 'Event Sub Process',
40088
+ search: 'subprocess',
40089
+ actionName: 'event-subprocess',
40090
+ className: 'bpmn-icon-event-subprocess-expanded',
40091
+ target: {
40092
+ type: 'bpmn:SubProcess',
40093
+ triggeredByEvent: true,
40094
+ isExpanded: true
40095
+ }
40096
+ },
40097
+ {
40098
+ label: 'Sub Process (collapsed)',
40099
+ search: 'subprocess',
40100
+ actionName: 'collapsed-subprocess',
40101
+ className: 'bpmn-icon-subprocess-collapsed',
40102
+ target: {
40103
+ type: 'bpmn:SubProcess',
40104
+ isExpanded: false
40105
+ }
40106
+ },
40107
+ {
40108
+ label: 'Sub Process (expanded)',
40109
+ search: 'subprocess',
40110
+ actionName: 'expanded-subprocess',
40111
+ className: 'bpmn-icon-subprocess-collapsed',
40112
+ target: {
40113
+ type: 'bpmn:SubProcess',
40114
+ isExpanded: true
40115
+ }
40116
+ }
40117
+ ].map(option => ({ ...option, group: SUBPROCESS_GROUP }));
40118
+
40119
+ var TASK = [
40120
+ {
40121
+ label: 'Task',
40122
+ actionName: 'task',
40123
+ className: 'bpmn-icon-task',
40124
+ target: {
40125
+ type: 'bpmn:Task'
40126
+ }
40127
+ },
40128
+ {
40129
+ label: 'User Task',
40130
+ actionName: 'user-task',
40131
+ className: 'bpmn-icon-user',
40132
+ target: {
40133
+ type: 'bpmn:UserTask'
40134
+ }
40135
+ },
40136
+ {
40137
+ label: 'Service Task',
40138
+ actionName: 'service-task',
40139
+ className: 'bpmn-icon-service',
40140
+ target: {
40141
+ type: 'bpmn:ServiceTask'
40142
+ }
40143
+ },
40144
+ {
40145
+ label: 'Send Task',
40146
+ actionName: 'send-task',
40147
+ className: 'bpmn-icon-send',
40148
+ target: {
40149
+ type: 'bpmn:SendTask'
40150
+ },
40151
+ rank: -1
40152
+ },
40153
+ {
40154
+ label: 'Receive Task',
40155
+ actionName: 'receive-task',
40156
+ className: 'bpmn-icon-receive',
40157
+ target: {
40158
+ type: 'bpmn:ReceiveTask'
40159
+ },
40160
+ rank: -1
40161
+ },
40162
+ {
40163
+ label: 'Manual Task',
40164
+ actionName: 'manual-task',
40165
+ className: 'bpmn-icon-manual',
40166
+ target: {
40167
+ type: 'bpmn:ManualTask'
40168
+ },
40169
+ rank: -1
40170
+ },
40171
+ {
40172
+ label: 'Business Rule Task',
40173
+ actionName: 'rule-task',
40174
+ className: 'bpmn-icon-business-rule',
40175
+ target: {
40176
+ type: 'bpmn:BusinessRuleTask'
40177
+ }
40178
+ },
40179
+ {
40180
+ label: 'Script Task',
40181
+ actionName: 'script-task',
40182
+ className: 'bpmn-icon-script',
40183
+ target: {
40184
+ type: 'bpmn:ScriptTask'
40185
+ }
40186
+ },
40187
+ {
40188
+ label: 'Call Activity',
40189
+ actionName: 'call-activity',
40190
+ className: 'bpmn-icon-call-activity',
40191
+ target: {
40192
+ type: 'bpmn:CallActivity'
40193
+ }
40194
+ }
40195
+ ].map(option => ({ ...option, group: TASK_GROUP }));
40196
+
40197
+ var DATA_OBJECTS = [
40198
+ {
40199
+ label: 'Data Store Reference',
40200
+ actionName: 'data-store-reference',
40201
+ className: 'bpmn-icon-data-store',
40202
+ target: {
40203
+ type: 'bpmn:DataStoreReference'
40204
+ }
40205
+ },
40206
+ {
40207
+ label: 'Data Object Reference',
40208
+ actionName: 'data-object-reference',
40209
+ className: 'bpmn-icon-data-object',
40210
+ target: {
40211
+ type: 'bpmn:DataObjectReference'
40212
+ }
40213
+ }
40214
+ ].map(option => ({ ...option, group: DATA_GROUP }));
40215
+
40216
+ var PARTICIPANT = [
40217
+ {
40218
+ label: 'Expanded Pool',
40219
+ search: 'Participant',
40220
+ actionName: 'expanded-pool',
40221
+ className: 'bpmn-icon-participant',
40222
+ target: {
40223
+ type: 'bpmn:Participant',
40224
+ isExpanded: true
40225
+ }
40226
+ },
40227
+ {
40228
+ label: 'Empty Pool',
40229
+ search: 'Collapsed Participant',
40230
+ actionName: 'collapsed-pool',
40231
+ className: 'bpmn-icon-lane',
40232
+ target: {
40233
+ type: 'bpmn:Participant',
40234
+ isExpanded: false
40235
+ }
40236
+ }
40237
+ ].map(option => ({ ...option, group: PARTICIPANT_GROUP }));
40238
+
40239
+ var CREATE_OPTIONS = [
40240
+ ...GATEWAY,
40241
+ ...TASK,
40242
+ ...SUBPROCESS,
40243
+ ...NONE_EVENTS,
40244
+ ...TYPED_START_EVENTS,
40245
+ ...TYPED_INTERMEDIATE_EVENT,
40246
+ ...TYPED_END_EVENT,
40247
+ ...TYPED_BOUNDARY_EVENT,
40248
+ ...DATA_OBJECTS,
40249
+ ...PARTICIPANT
40250
+ ];
40251
+
40252
+ /**
40253
+ * This module is a create menu provider for the popup menu.
40254
+ */
40255
+ function CreateMenuProvider(
40256
+ elementFactory, popupMenu, create,
40257
+ autoPlace, mouse, translate
40258
+ ) {
40259
+ this._elementFactory = elementFactory;
40260
+ this._popupMenu = popupMenu;
40261
+ this._create = create;
40262
+ this._autoPlace = autoPlace;
40263
+ this._mouse = mouse;
40264
+ this._translate = translate;
40265
+
40266
+ this.register();
40267
+ }
40268
+
40269
+ CreateMenuProvider.$inject = [
40270
+ 'elementFactory',
40271
+ 'popupMenu',
40272
+ 'create',
40273
+ 'autoPlace',
40274
+ 'mouse',
40275
+ 'translate'
40276
+ ];
40277
+
40278
+ /**
40279
+ * Register create menu provider in the popup menu
40280
+ */
40281
+ CreateMenuProvider.prototype.register = function() {
40282
+ this._popupMenu.registerProvider('bpmn-create', this);
40283
+ };
40284
+
40285
+ /**
40286
+ * Get all entries
40287
+ *
40288
+ * @param {djs.model.Base} element
40289
+ *
40290
+ * @return {Array<Object>} a list of menu entry items
40291
+ */
40292
+ CreateMenuProvider.prototype.getPopupMenuEntries = function() {
40293
+
40294
+ const entries = {};
40295
+
40296
+ // map options to menu entries
40297
+ CREATE_OPTIONS.forEach(option => {
40298
+ const {
40299
+ actionName,
40300
+ className,
40301
+ label,
40302
+ target,
40303
+ description,
40304
+ group,
40305
+ search,
40306
+ rank
40307
+ } = option;
40308
+
40309
+ const targetAction = this._createEntryAction(target);
40310
+
40311
+ entries[`create-${actionName}`] = {
40312
+ label: label && this._translate(label),
40313
+ className,
40314
+ description,
40315
+ group: group && {
40316
+ ...group,
40317
+ name: this._translate(group.name)
40318
+ },
40319
+ search,
40320
+ rank,
40321
+ action: {
40322
+ click: targetAction,
40323
+ dragstart: targetAction
40324
+ }
40325
+ };
40326
+ });
40327
+
40328
+ return entries;
40329
+ };
40330
+
40331
+ /**
40332
+ * Create an action for a given target
40333
+ *
40334
+ * @param {Object} target
40335
+ * @returns {Object}
40336
+ */
40337
+ CreateMenuProvider.prototype._createEntryAction = function(target) {
40338
+
40339
+ const create = this._create;
40340
+ const mouse = this._mouse;
40341
+ const popupMenu = this._popupMenu;
40342
+ const elementFactory = this._elementFactory;
40343
+
40344
+ let newElement;
40345
+
40346
+ return (event) => {
40347
+ popupMenu.close();
40348
+
40349
+ // create the new element
40350
+ if (target.type === 'bpmn:Participant') {
40351
+ newElement = elementFactory.createParticipantShape(target);
40352
+ } else {
40353
+ newElement = elementFactory.create('shape', target);
40354
+ }
40355
+
40356
+ // use last mouse event if triggered via keyboard
40357
+ if (event instanceof KeyboardEvent) {
40358
+ event = mouse.getLastMoveEvent();
40359
+ }
40360
+
40361
+ return create.start(event, newElement);
40362
+ };
40363
+ };
40364
+
40365
+ /**
40366
+ * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
40367
+ * and then replace respective icons with the optimized data URIs in `./dist`.
40368
+ */
40369
+ 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';
40370
+ 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';
40371
+
40372
+ /**
40373
+ * A palette provider for the create elements menu.
40374
+ */
40375
+ function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
40376
+ this._translate = translate;
40377
+ this._popupMenu = popupMenu;
40378
+ this._canvas = canvas;
40379
+ this._mouse = mouse;
40380
+
40381
+ palette.registerProvider(this);
40382
+ }
40383
+
40384
+ CreatePaletteProvider.$inject = [
40385
+ 'palette',
40386
+ 'translate',
40387
+ 'popupMenu',
40388
+ 'canvas',
40389
+ 'mouse'
40390
+ ];
40391
+
40392
+
40393
+ CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
40394
+ const actions = {},
40395
+ translate = this._translate,
40396
+ popupMenu = this._popupMenu,
40397
+ canvas = this._canvas,
40398
+ mouse = this._mouse;
40399
+
40400
+ const getPosition = (event) => {
40401
+ const X_OFFSET = 35;
40402
+ const Y_OFFSET = 10;
40403
+
40404
+ if (event instanceof KeyboardEvent) {
40405
+ event = mouse.getLastMoveEvent();
40406
+ return { x: event.x, y: event.y };
40407
+ }
40408
+
40409
+ const target = event && event.target || query('.djs-palette [data-action="create"]');
40410
+ const targetPosition = target.getBoundingClientRect();
40411
+
40412
+ return target && {
40413
+ x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
40414
+ y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
40415
+ };
40416
+ };
40417
+
40418
+ assign$1(actions, {
40419
+ 'create': {
40420
+ group: 'create',
40421
+ imageUrl: createIcon,
40422
+ title: translate('Create element'),
40423
+ action: {
40424
+ click: function(event) {
40425
+ const position = getPosition(event);
40426
+
40427
+ const element = canvas.getRootElement();
40428
+
40429
+ popupMenu.open(element, 'bpmn-create', position, {
40430
+ title: translate('Create element'),
40431
+ width: 300,
40432
+ search: true
40433
+ });
40434
+ }
40435
+ }
40436
+ },
40437
+ });
40438
+
40439
+ return actions;
40440
+ };
40441
+
40442
+ /**
40443
+ * Registers and executes BPMN specific editor actions.
40444
+ *
40445
+ * @param {Injector} injector
40446
+ */
40447
+ function CreateAppendEditorActions(injector) {
40448
+ this._injector = injector;
40449
+
40450
+ this.registerActions();
40451
+ }
40452
+
40453
+ CreateAppendEditorActions.$inject = [
40454
+ 'injector'
40455
+ ];
40456
+
40457
+ /**
40458
+ * Register actions.
40459
+ *
40460
+ * @param {Injector} injector
40461
+ */
40462
+ CreateAppendEditorActions.prototype.registerActions = function() {
40463
+ var editorActions = this._injector.get('editorActions', false);
40464
+ var selection = this._injector.get('selection', false);
40465
+ var contextPad = this._injector.get('contextPad', false);
40466
+ var palette = this._injector.get('palette', false);
40467
+
40468
+ const actions = {};
40469
+
40470
+ // append
40471
+ if (selection && contextPad) {
40472
+ assign$1(actions, {
40473
+ 'appendElement': function(event) {
40474
+ contextPad.triggerEntry('append', 'click', event);
40475
+ } }
40476
+ );
40477
+ }
40478
+
40479
+ // create
40480
+ if (palette) {
40481
+ assign$1(actions, {
40482
+ 'createElement': function(event) {
40483
+ palette.triggerEntry('create', 'click', event);
40484
+ } }
40485
+ );
40486
+ }
40487
+
40488
+ editorActions && editorActions.register(actions);
40489
+
38650
40490
  };
38651
40491
 
38652
40492
  /**
38653
- * @param {djs.model.Base[]} elements
38654
- * @return {boolean}
40493
+ * BPMN 2.0 specific keyboard bindings.
40494
+ *
40495
+ * @param {Injector} injector
38655
40496
  */
38656
- ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
40497
+ function CreateAppendKeyboardBindings(injector) {
38657
40498
 
38658
- var baseAllowed = this._rules.allowed('elements.delete', {
38659
- elements: elements
38660
- });
40499
+ this._injector = injector;
40500
+ this._keyboard = this._injector.get('keyboard', false);
40501
+ this._editorActions = this._injector.get('editorActions', false);
40502
+ this._selection = this._injector.get('selection', false);
38661
40503
 
38662
- if (isArray$3(baseAllowed)) {
38663
- return every(baseAllowed, function(element) {
38664
- return includes$7(baseAllowed, element);
38665
- });
40504
+ if (this._keyboard) {
40505
+ this._injector.invoke(KeyboardBindings, this);
38666
40506
  }
40507
+ }
38667
40508
 
38668
- return baseAllowed;
38669
- };
40509
+ e$3(CreateAppendKeyboardBindings, KeyboardBindings);
38670
40510
 
38671
- ContextPadProvider.prototype.getContextPadEntries = function(element) {
38672
- var contextPad = this._contextPad,
38673
- modeling = this._modeling,
40511
+ CreateAppendKeyboardBindings.$inject = [
40512
+ 'injector'
40513
+ ];
38674
40514
 
38675
- elementFactory = this._elementFactory,
38676
- connect = this._connect,
38677
- create = this._create,
38678
- popupMenu = this._popupMenu,
38679
- rules = this._rules,
38680
- autoPlace = this._autoPlace,
38681
- translate = this._translate;
38682
40515
 
38683
- var actions = {};
40516
+ /**
40517
+ * Register available keyboard bindings.
40518
+ *
40519
+ * @param {Keyboard} keyboard
40520
+ * @param {EditorActions} editorActions
40521
+ */
40522
+ CreateAppendKeyboardBindings.prototype.registerBindings = function() {
38684
40523
 
38685
- if (element.type === 'label') {
38686
- return actions;
38687
- }
40524
+ var keyboard = this._keyboard;
40525
+ var editorActions = this._editorActions;
40526
+ var selection = this._selection;
38688
40527
 
38689
- var businessObject = element.businessObject;
40528
+ // inherit default bindings
40529
+ KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
38690
40530
 
38691
- function startConnect(event, element) {
38692
- connect.start(event, element);
38693
- }
40531
+ /**
40532
+ * Add keyboard binding if respective editor action
40533
+ * is registered.
40534
+ *
40535
+ * @param {string} action name
40536
+ * @param {Function} fn that implements the key binding
40537
+ */
40538
+ function addListener(action, fn) {
38694
40539
 
38695
- function removeElement(e, element) {
38696
- modeling.removeElements([ element ]);
40540
+ if (editorActions && editorActions.isRegistered(action)) {
40541
+ keyboard && keyboard.addListener(fn);
40542
+ }
38697
40543
  }
38698
40544
 
38699
- function getReplaceMenuPosition(element) {
40545
+ // activate append/create element
40546
+ // A
40547
+ addListener('appendElement', function(context) {
38700
40548
 
38701
- var Y_OFFSET = 5;
40549
+ var event = context.keyEvent;
38702
40550
 
38703
- var pad = contextPad.getPad(element).html;
40551
+ if (keyboard && keyboard.hasModifier(event)) {
40552
+ return;
40553
+ }
38704
40554
 
38705
- var padRect = pad.getBoundingClientRect();
40555
+ if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
38706
40556
 
38707
- var pos = {
38708
- x: padRect.left,
38709
- y: padRect.bottom + Y_OFFSET
38710
- };
40557
+ if (selection && selection.get().length == 1) {
40558
+ editorActions && editorActions.trigger('appendElement', event);
40559
+ } else {
40560
+ editorActions && editorActions.trigger('createElement', event);
40561
+ }
38711
40562
 
38712
- return pos;
38713
- }
40563
+ return true;
40564
+ }
40565
+ });
38714
40566
 
40567
+ // N
40568
+ addListener('createElement', function(context) {
38715
40569
 
38716
- /**
38717
- * Create an append action
38718
- *
38719
- * @param {string} type
38720
- * @param {string} className
38721
- * @param {string} [title]
38722
- * @param {Object} [options]
38723
- *
38724
- * @return {Object} descriptor
38725
- */
38726
- function appendAction(type, className, title, options) {
40570
+ var event = context.keyEvent;
38727
40571
 
38728
- if (typeof title !== 'string') {
38729
- options = title;
38730
- title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
40572
+ if (keyboard && keyboard.hasModifier(event)) {
40573
+ return;
38731
40574
  }
38732
40575
 
38733
- function appendStart(event, element) {
40576
+ if (keyboard && keyboard.isKey([ 'n', 'N' ], event)) {
40577
+ editorActions && editorActions.trigger('createElement', event);
38734
40578
 
38735
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
38736
- create.start(event, shape, {
38737
- source: element
38738
- });
40579
+ return true;
38739
40580
  }
40581
+ });
38740
40582
 
40583
+ };
38741
40584
 
38742
- var append = autoPlace ? function(event, element) {
38743
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
40585
+ /**
40586
+ * This module is an append menu provider for the popup menu.
40587
+ */
40588
+ function AppendMenuProvider(
40589
+ elementFactory,
40590
+ popupMenu,
40591
+ create,
40592
+ autoPlace,
40593
+ rules,
40594
+ mouse
40595
+ ) {
40596
+ this._elementFactory = elementFactory;
40597
+ this._popupMenu = popupMenu;
40598
+ this._create = create;
40599
+ this._autoPlace = autoPlace;
40600
+ this._rules = rules;
40601
+ this._create = create;
40602
+ this._mouse = mouse;
38744
40603
 
38745
- autoPlace.append(element, shape);
38746
- } : appendStart;
40604
+ this.register();
40605
+ }
40606
+
40607
+ AppendMenuProvider.$inject = [
40608
+ 'elementFactory',
40609
+ 'popupMenu',
40610
+ 'create',
40611
+ 'autoPlace',
40612
+ 'rules',
40613
+ 'mouse'
40614
+ ];
38747
40615
 
40616
+ /**
40617
+ * Register append menu provider in the popup menu
40618
+ */
40619
+ AppendMenuProvider.prototype.register = function() {
40620
+ this._popupMenu.registerProvider('bpmn-append', this);
40621
+ };
38748
40622
 
38749
- return {
38750
- group: 'model',
38751
- className: className,
38752
- title: title,
38753
- action: {
38754
- dragstart: appendStart,
38755
- click: append
38756
- }
38757
- };
40623
+ /**
40624
+ * Get all entries from createOptions for the given element.
40625
+ *
40626
+ * @param {djs.model.Base} element
40627
+ *
40628
+ * @return {Array<Object>} a list of menu entry items
40629
+ */
40630
+ AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40631
+ const rules = this._rules;
40632
+ const entries = {};
40633
+
40634
+ if (!rules.allowed('shape.append', { element: element })) {
40635
+ return [];
38758
40636
  }
38759
40637
 
38760
- function splitLaneHandler(count) {
40638
+ // filter out elements with no incoming connections
40639
+ const appendOptions = this._filterEntries(CREATE_OPTIONS);
38761
40640
 
38762
- return function(event, element) {
40641
+ // map options to menu entries
40642
+ appendOptions.forEach(option => {
40643
+ const {
40644
+ actionName,
40645
+ className,
40646
+ label,
40647
+ target,
40648
+ description,
40649
+ group,
40650
+ search,
40651
+ rank
40652
+ } = option;
40653
+
40654
+ entries[`append-${actionName}`] = {
40655
+ label,
40656
+ className,
40657
+ description,
40658
+ group,
40659
+ search,
40660
+ rank,
40661
+ action: this._createEntryAction(element, target)
40662
+ };
40663
+ });
38763
40664
 
38764
- // actual split
38765
- modeling.splitLane(element, count);
40665
+ return entries;
40666
+ };
38766
40667
 
38767
- // refresh context pad after split to
38768
- // get rid of split icons
38769
- contextPad.open(element, true);
38770
- };
38771
- }
40668
+ /**
40669
+ * Filter out entries from the options.
40670
+ *
40671
+ * @param {Array<Object>} entries
40672
+ *
40673
+ * @return {Array<Object>} filtered entries
40674
+ */
40675
+ AppendMenuProvider.prototype._filterEntries = function(entries) {
40676
+ return entries.filter(option => {
38772
40677
 
40678
+ const target = option.target;
40679
+ const {
40680
+ type,
40681
+ eventDefinitionType
40682
+ } = target;
40683
+
40684
+ if ([
40685
+ 'bpmn:StartEvent',
40686
+ 'bpmn:Participant'
40687
+ ].includes(type)) {
40688
+ return false;
40689
+ }
38773
40690
 
38774
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
40691
+ if (type === 'bpmn:BoundaryEvent' && isUndefined$2(eventDefinitionType)) {
40692
+ return false;
40693
+ }
38775
40694
 
38776
- var childLanes = getChildLanes(element);
40695
+ return true;
40696
+ });
40697
+ };
38777
40698
 
38778
- assign$1(actions, {
38779
- 'lane-insert-above': {
38780
- group: 'lane-insert-above',
38781
- className: 'bpmn-icon-lane-insert-above',
38782
- title: translate('Add Lane above'),
38783
- action: {
38784
- click: function(event, element) {
38785
- modeling.addLane(element, 'top');
38786
- }
38787
- }
38788
- }
38789
- });
40699
+ /**
40700
+ * Create an action for a given target.
40701
+ *
40702
+ * @param {djs.model.Base} element
40703
+ * @param {Object} target
40704
+ *
40705
+ * @return {Object}
40706
+ */
40707
+ AppendMenuProvider.prototype._createEntryAction = function(element, target) {
40708
+ const elementFactory = this._elementFactory;
40709
+ const autoPlace = this._autoPlace;
40710
+ const create = this._create;
40711
+ const mouse = this._mouse;
38790
40712
 
38791
- if (childLanes.length < 2) {
38792
40713
 
38793
- if (element.height >= 120) {
38794
- assign$1(actions, {
38795
- 'lane-divide-two': {
38796
- group: 'lane-divide',
38797
- className: 'bpmn-icon-lane-divide-two',
38798
- title: translate('Divide into two Lanes'),
38799
- action: {
38800
- click: splitLaneHandler(2)
38801
- }
38802
- }
38803
- });
38804
- }
40714
+ const autoPlaceElement = () => {
40715
+ const newElement = elementFactory.create('shape', target);
40716
+ autoPlace.append(element, newElement);
40717
+ };
38805
40718
 
38806
- if (element.height >= 180) {
38807
- assign$1(actions, {
38808
- 'lane-divide-three': {
38809
- group: 'lane-divide',
38810
- className: 'bpmn-icon-lane-divide-three',
38811
- title: translate('Divide into three Lanes'),
38812
- action: {
38813
- click: splitLaneHandler(3)
38814
- }
38815
- }
38816
- });
38817
- }
40719
+ const manualPlaceElement = (event) => {
40720
+ const newElement = elementFactory.create('shape', target);
40721
+
40722
+ if (event instanceof KeyboardEvent) {
40723
+ event = mouse.getLastMoveEvent();
38818
40724
  }
38819
40725
 
38820
- assign$1(actions, {
38821
- 'lane-insert-below': {
38822
- group: 'lane-insert-below',
38823
- className: 'bpmn-icon-lane-insert-below',
38824
- title: translate('Add Lane below'),
38825
- action: {
38826
- click: function(event, element) {
38827
- modeling.addLane(element, 'bottom');
38828
- }
38829
- }
38830
- }
38831
- });
40726
+ return create.start(event, newElement);
40727
+ };
40728
+
40729
+ return {
40730
+ click: this._canAutoPlaceElement(target) ? autoPlaceElement : manualPlaceElement,
40731
+ dragstart: manualPlaceElement
40732
+ };
40733
+ };
40734
+
40735
+ /**
40736
+ * Check if the element should be auto placed.
40737
+ *
40738
+ * @param {Object} target
40739
+ *
40740
+ * @return {Boolean}
40741
+ */
40742
+ AppendMenuProvider.prototype._canAutoPlaceElement = (target) => {
40743
+ const { type } = target;
38832
40744
 
40745
+ if (type === 'bpmn:BoundaryEvent') {
40746
+ return false;
38833
40747
  }
38834
40748
 
38835
- if (is$1(businessObject, 'bpmn:FlowNode')) {
40749
+ if (type === 'bpmn:SubProcess' && target.triggeredByEvent) {
40750
+ return false;
40751
+ }
38836
40752
 
38837
- if (is$1(businessObject, 'bpmn:EventBasedGateway')) {
40753
+ if (type === 'bpmn:IntermediateCatchEvent' && target.eventDefinitionType === 'bpmn:LinkEventDefinition') {
40754
+ return false;
40755
+ }
38838
40756
 
38839
- assign$1(actions, {
38840
- 'append.receive-task': appendAction(
38841
- 'bpmn:ReceiveTask',
38842
- 'bpmn-icon-receive-task',
38843
- translate('Append ReceiveTask')
38844
- ),
38845
- 'append.message-intermediate-event': appendAction(
38846
- 'bpmn:IntermediateCatchEvent',
38847
- 'bpmn-icon-intermediate-event-catch-message',
38848
- translate('Append MessageIntermediateCatchEvent'),
38849
- { eventDefinitionType: 'bpmn:MessageEventDefinition' }
38850
- ),
38851
- 'append.timer-intermediate-event': appendAction(
38852
- 'bpmn:IntermediateCatchEvent',
38853
- 'bpmn-icon-intermediate-event-catch-timer',
38854
- translate('Append TimerIntermediateCatchEvent'),
38855
- { eventDefinitionType: 'bpmn:TimerEventDefinition' }
38856
- ),
38857
- 'append.condition-intermediate-event': appendAction(
38858
- 'bpmn:IntermediateCatchEvent',
38859
- 'bpmn-icon-intermediate-event-catch-condition',
38860
- translate('Append ConditionIntermediateCatchEvent'),
38861
- { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
38862
- ),
38863
- 'append.signal-intermediate-event': appendAction(
38864
- 'bpmn:IntermediateCatchEvent',
38865
- 'bpmn-icon-intermediate-event-catch-signal',
38866
- translate('Append SignalIntermediateCatchEvent'),
38867
- { eventDefinitionType: 'bpmn:SignalEventDefinition' }
38868
- )
38869
- });
38870
- } else
40757
+ return true;
40758
+ };
38871
40759
 
38872
- if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
40760
+ /**
40761
+ * A provider for align elements context pad button
40762
+ */
40763
+ function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
40764
+ this._contextPad = contextPad;
40765
+ this._popupMenu = popupMenu;
40766
+ this._translate = translate;
40767
+ this._canvas = canvas;
38873
40768
 
38874
- assign$1(actions, {
38875
- 'append.compensation-activity':
38876
- appendAction(
38877
- 'bpmn:Task',
38878
- 'bpmn-icon-task',
38879
- translate('Append compensation activity'),
38880
- {
38881
- isForCompensation: true
38882
- }
38883
- )
38884
- });
38885
- } else
40769
+ contextPad.registerProvider(this);
40770
+ }
38886
40771
 
38887
- if (!is$1(businessObject, 'bpmn:EndEvent') &&
38888
- !businessObject.isForCompensation &&
38889
- !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
38890
- !isEventSubProcess(businessObject)) {
40772
+ AppendContextPadProvider.$inject = [
40773
+ 'contextPad',
40774
+ 'popupMenu',
40775
+ 'translate',
40776
+ 'canvas'
40777
+ ];
38891
40778
 
38892
- assign$1(actions, {
38893
- 'append.end-event': appendAction(
38894
- 'bpmn:EndEvent',
38895
- 'bpmn-icon-end-event-none',
38896
- translate('Append EndEvent')
38897
- ),
38898
- 'append.gateway': appendAction(
38899
- 'bpmn:ExclusiveGateway',
38900
- 'bpmn-icon-gateway-none',
38901
- translate('Append Gateway')
38902
- ),
38903
- 'append.append-task': appendAction(
38904
- 'bpmn:Task',
38905
- 'bpmn-icon-task',
38906
- translate('Append Task')
38907
- ),
38908
- 'append.intermediate-event': appendAction(
38909
- 'bpmn:IntermediateThrowEvent',
38910
- 'bpmn-icon-intermediate-event-none',
38911
- translate('Append Intermediate/Boundary Event')
38912
- )
38913
- });
38914
- }
38915
- }
40779
+ AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
40780
+ const popupMenu = this._popupMenu;
40781
+ const translate = this._translate;
40782
+ const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
38916
40783
 
38917
- if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
40784
+ if (!popupMenu.isEmpty(element, 'bpmn-append')) {
38918
40785
 
38919
40786
  // Replace menu entry
38920
- assign$1(actions, {
38921
- 'replace': {
38922
- group: 'edit',
38923
- className: 'bpmn-icon-screw-wrench',
38924
- title: translate('Change type'),
40787
+ return {
40788
+ 'append': {
40789
+ group: 'model',
40790
+ imageUrl: appendIcon,
40791
+ title: translate('Append element'),
38925
40792
  action: {
38926
40793
  click: function(event, element) {
38927
40794
 
38928
- var position = assign$1(getReplaceMenuPosition(element), {
40795
+ var position = assign$1(getAppendMenuPosition(element), {
38929
40796
  cursor: { x: event.x, y: event.y }
38930
40797
  });
38931
40798
 
38932
- popupMenu.open(element, 'bpmn-replace', position, {
38933
- title: translate('Change element'),
40799
+ popupMenu.open(element, 'bpmn-append', position, {
40800
+ title: translate('Append element'),
38934
40801
  width: 300,
38935
40802
  search: true
38936
40803
  });
38937
40804
  }
38938
40805
  }
38939
40806
  }
38940
- });
40807
+ };
38941
40808
  }
40809
+ };
38942
40810
 
38943
- if (is$1(businessObject, 'bpmn:SequenceFlow')) {
38944
- assign$1(actions, {
38945
- 'append.text-annotation': appendAction(
38946
- 'bpmn:TextAnnotation',
38947
- 'bpmn-icon-text-annotation'
38948
- )
38949
- });
38950
- }
40811
+ AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
40812
+ const contextPad = this._contextPad;
38951
40813
 
38952
- if (
38953
- isAny(businessObject, [
38954
- 'bpmn:FlowNode',
38955
- 'bpmn:InteractionNode',
38956
- 'bpmn:DataObjectReference',
38957
- 'bpmn:DataStoreReference',
38958
- ])
38959
- ) {
38960
- assign$1(actions, {
38961
- 'append.text-annotation': appendAction(
38962
- 'bpmn:TextAnnotation',
38963
- 'bpmn-icon-text-annotation'
38964
- ),
40814
+ const X_OFFSET = 5;
38965
40815
 
38966
- 'connect': {
38967
- group: 'connect',
38968
- className: 'bpmn-icon-connection-multi',
38969
- title: translate(
38970
- 'Connect using ' +
38971
- (businessObject.isForCompensation
38972
- ? ''
38973
- : 'Sequence/MessageFlow or ') +
38974
- 'Association'
38975
- ),
38976
- action: {
38977
- click: startConnect,
38978
- dragstart: startConnect,
38979
- },
38980
- },
38981
- });
38982
- }
40816
+ const pad = contextPad.getPad(element).html;
38983
40817
 
38984
- if (is$1(businessObject, 'bpmn:TextAnnotation')) {
38985
- assign$1(actions, {
38986
- 'connect': {
38987
- group: 'connect',
38988
- className: 'bpmn-icon-connection-multi',
38989
- title: translate('Connect using Association'),
38990
- action: {
38991
- click: startConnect,
38992
- dragstart: startConnect,
38993
- },
38994
- },
38995
- });
38996
- }
40818
+ const padRect = pad.getBoundingClientRect();
38997
40819
 
38998
- if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
38999
- assign$1(actions, {
39000
- 'connect': {
39001
- group: 'connect',
39002
- className: 'bpmn-icon-connection-multi',
39003
- title: translate('Connect using DataInputAssociation'),
39004
- action: {
39005
- click: startConnect,
39006
- dragstart: startConnect
39007
- }
39008
- }
39009
- });
39010
- }
40820
+ const pos = {
40821
+ x: padRect.right + X_OFFSET,
40822
+ y: padRect.top
40823
+ };
39011
40824
 
39012
- if (is$1(businessObject, 'bpmn:Group')) {
39013
- assign$1(actions, {
39014
- 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39015
- });
39016
- }
40825
+ return pos;
40826
+ };
39017
40827
 
39018
- // delete element entry, only show if allowed by rules
39019
- var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
40828
+ /**
40829
+ * Append anything modeling rules
40830
+ */
40831
+ function AppendRules(eventBus) {
40832
+ RuleProvider.call(this, eventBus);
40833
+ }
39020
40834
 
39021
- if (isArray$3(deleteAllowed)) {
40835
+ e$3(AppendRules, RuleProvider);
39022
40836
 
39023
- // was the element returned as a deletion candidate?
39024
- deleteAllowed = deleteAllowed[0] === element;
39025
- }
40837
+ AppendRules.$inject = [
40838
+ 'eventBus'
40839
+ ];
39026
40840
 
39027
- if (deleteAllowed) {
39028
- assign$1(actions, {
39029
- 'delete': {
39030
- group: 'edit',
39031
- className: 'bpmn-icon-trash',
39032
- title: translate('Remove'),
39033
- action: {
39034
- click: removeElement
39035
- }
39036
- }
39037
- });
39038
- }
40841
+ AppendRules.prototype.init = function() {
40842
+ this.addRule('shape.append', function(context) {
39039
40843
 
39040
- return actions;
39041
- };
40844
+ var source = context.element;
39042
40845
 
40846
+ const businessObject = getBusinessObject(source);
39043
40847
 
39044
- // helpers /////////
40848
+ if (isLabel$6(source)) {
40849
+ return false;
40850
+ }
39045
40851
 
39046
- function isEventType(eventBo, type, definition) {
40852
+ if (isAny(source, [
40853
+ 'bpmn:EndEvent',
40854
+ 'bpmn:Group',
40855
+ 'bpmn:TextAnnotation',
40856
+ 'bpmn:Lane',
40857
+ 'bpmn:Participant',
40858
+ 'bpmn:DataStoreReference',
40859
+ 'bpmn:DataObjectReference'
40860
+ ])) {
40861
+ return false;
40862
+ }
39047
40863
 
39048
- var isType = eventBo.$instanceOf(type);
39049
- var isDefinition = false;
40864
+ if (isConnection$b(source)) {
40865
+ return false;
40866
+ }
39050
40867
 
39051
- var definitions = eventBo.eventDefinitions || [];
39052
- forEach$1(definitions, function(def) {
39053
- if (def.$type === definition) {
39054
- isDefinition = true;
40868
+ if (is$1(source, 'bpmn:IntermediateThrowEvent') && hasEventDefinition$1(source, 'bpmn:LinkEventDefinition')) {
40869
+ return false;
40870
+ }
40871
+
40872
+ if (is$1(source, 'bpmn:SubProcess') && businessObject.triggeredByEvent) {
40873
+ return false;
39055
40874
  }
39056
40875
  });
39057
40876
 
39058
- return isType && isDefinition;
40877
+ };
40878
+
40879
+
40880
+ // helpers //////////////
40881
+ function hasEventDefinition$1(element, eventDefinition) {
40882
+ var bo = getBusinessObject(element);
40883
+
40884
+ return !!find(bo.eventDefinitions || [], function(definition) {
40885
+ return is$1(definition, eventDefinition);
40886
+ });
39059
40887
  }
39060
40888
 
39061
- function includes$7(array, item) {
39062
- return array.indexOf(item) !== -1;
40889
+ function isConnection$b(element) {
40890
+ return element.waypoints;
39063
40891
  }
39064
40892
 
39065
- var ContextPadModule = {
40893
+ var CreateAppendAnythingModule = {
39066
40894
  __depends__: [
39067
- DirectEditingModule,
39068
- ContextPadModule$1,
39069
- SelectionModule,
39070
- ConnectModule,
39071
- CreateModule,
39072
- PopupMenuModule
40895
+ PaletteModule$1,
40896
+ PopupMenuModule$1,
40897
+ AutoPlaceModule$1,
40898
+ ContextPadModule$1
39073
40899
  ],
39074
- __init__: [ 'contextPadProvider' ],
39075
- contextPadProvider: [ 'type', ContextPadProvider ]
40900
+ __init__: [
40901
+ 'createMenuProvider',
40902
+ 'createPaletteProvider',
40903
+ 'createAppendEditorActions',
40904
+ 'createAppendKeyboardBindings',
40905
+ 'appendMenuProvider',
40906
+ 'appendContextPadProvider',
40907
+ 'appendRules'
40908
+ ],
40909
+ createMenuProvider: [ 'type', CreateMenuProvider ],
40910
+ createPaletteProvider: [ 'type', CreatePaletteProvider ],
40911
+ createAppendEditorActions: [ 'type', CreateAppendEditorActions ],
40912
+ createAppendKeyboardBindings: [ 'type', CreateAppendKeyboardBindings ],
40913
+ appendMenuProvider: [ 'type', AppendMenuProvider ],
40914
+ appendContextPadProvider: [ 'type', AppendContextPadProvider ],
40915
+ appendRules: [ 'type', AppendRules ]
39076
40916
  };
39077
40917
 
39078
40918
  var AXIS_DIMENSIONS = {
@@ -46525,7 +48365,7 @@
46525
48365
  }
46526
48366
 
46527
48367
  return some(types, function(type) {
46528
- return hasEventDefinition$2(element, type);
48368
+ return hasEventDefinition$3(element, type);
46529
48369
  });
46530
48370
  }
46531
48371
 
@@ -52483,6 +54323,16 @@
52483
54323
  di.isMarkerVisible = true;
52484
54324
  }
52485
54325
 
54326
+ if (isDefined(attrs.triggeredByEvent)) {
54327
+ businessObject.triggeredByEvent = attrs.triggeredByEvent;
54328
+ delete attrs.triggeredByEvent;
54329
+ }
54330
+
54331
+ if (isDefined(attrs.cancelActivity)) {
54332
+ businessObject.cancelActivity = attrs.cancelActivity;
54333
+ delete attrs.cancelActivity;
54334
+ }
54335
+
52486
54336
  var eventDefinitions,
52487
54337
  newEventDefinition;
52488
54338
 
@@ -52672,22 +54522,22 @@
52672
54522
  y: 0
52673
54523
  };
52674
54524
 
52675
- if (alignment.left) {
54525
+ if (isDefined(alignment.left)) {
52676
54526
  delta.x = alignment.left - element.x;
52677
54527
 
52678
- } else if (alignment.right) {
54528
+ } else if (isDefined(alignment.right)) {
52679
54529
  delta.x = (alignment.right - element.width) - element.x;
52680
54530
 
52681
- } else if (alignment.center) {
54531
+ } else if (isDefined(alignment.center)) {
52682
54532
  delta.x = (alignment.center - Math.round(element.width / 2)) - element.x;
52683
54533
 
52684
- } else if (alignment.top) {
54534
+ } else if (isDefined(alignment.top)) {
52685
54535
  delta.y = alignment.top - element.y;
52686
54536
 
52687
- } else if (alignment.bottom) {
54537
+ } else if (isDefined(alignment.bottom)) {
52688
54538
  delta.y = (alignment.bottom - element.height) - element.y;
52689
54539
 
52690
- } else if (alignment.middle) {
54540
+ } else if (isDefined(alignment.middle)) {
52691
54541
  delta.y = (alignment.middle - Math.round(element.height / 2)) - element.y;
52692
54542
  }
52693
54543
 
@@ -58101,464 +59951,6 @@
58101
59951
  movePreview: [ 'type', MovePreview ]
58102
59952
  };
58103
59953
 
58104
- var TOGGLE_SELECTOR = '.djs-palette-toggle',
58105
- ENTRY_SELECTOR = '.entry',
58106
- ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
58107
-
58108
- var PALETTE_PREFIX = 'djs-palette-',
58109
- PALETTE_SHOWN_CLS = 'shown',
58110
- PALETTE_OPEN_CLS = 'open',
58111
- PALETTE_TWO_COLUMN_CLS = 'two-column';
58112
-
58113
- var DEFAULT_PRIORITY = 1000;
58114
-
58115
-
58116
- /**
58117
- * A palette containing modeling elements.
58118
- */
58119
- function Palette(eventBus, canvas) {
58120
-
58121
- this._eventBus = eventBus;
58122
- this._canvas = canvas;
58123
-
58124
- var self = this;
58125
-
58126
- eventBus.on('tool-manager.update', function(event) {
58127
- var tool = event.tool;
58128
-
58129
- self.updateToolHighlight(tool);
58130
- });
58131
-
58132
- eventBus.on('i18n.changed', function() {
58133
- self._update();
58134
- });
58135
-
58136
- eventBus.on('diagram.init', function() {
58137
-
58138
- self._diagramInitialized = true;
58139
-
58140
- self._rebuild();
58141
- });
58142
- }
58143
-
58144
- Palette.$inject = [ 'eventBus', 'canvas' ];
58145
-
58146
-
58147
- /**
58148
- * Register a provider with the palette
58149
- *
58150
- * @param {number} [priority=1000]
58151
- * @param {PaletteProvider} provider
58152
- *
58153
- * @example
58154
- * const paletteProvider = {
58155
- * getPaletteEntries: function() {
58156
- * return function(entries) {
58157
- * return {
58158
- * ...entries,
58159
- * 'entry-1': {
58160
- * label: 'My Entry',
58161
- * action: function() { alert("I have been clicked!"); }
58162
- * }
58163
- * };
58164
- * }
58165
- * }
58166
- * };
58167
- *
58168
- * palette.registerProvider(800, paletteProvider);
58169
- */
58170
- Palette.prototype.registerProvider = function(priority, provider) {
58171
- if (!provider) {
58172
- provider = priority;
58173
- priority = DEFAULT_PRIORITY;
58174
- }
58175
-
58176
- this._eventBus.on('palette.getProviders', priority, function(event) {
58177
- event.providers.push(provider);
58178
- });
58179
-
58180
- this._rebuild();
58181
- };
58182
-
58183
-
58184
- /**
58185
- * Returns the palette entries
58186
- *
58187
- * @return {Object<string, PaletteEntryDescriptor>} map of entries
58188
- */
58189
- Palette.prototype.getEntries = function() {
58190
- var providers = this._getProviders();
58191
-
58192
- return providers.reduce(addPaletteEntries, {});
58193
- };
58194
-
58195
- Palette.prototype._rebuild = function() {
58196
-
58197
- if (!this._diagramInitialized) {
58198
- return;
58199
- }
58200
-
58201
- var providers = this._getProviders();
58202
-
58203
- if (!providers.length) {
58204
- return;
58205
- }
58206
-
58207
- if (!this._container) {
58208
- this._init();
58209
- }
58210
-
58211
- this._update();
58212
- };
58213
-
58214
- /**
58215
- * Initialize
58216
- */
58217
- Palette.prototype._init = function() {
58218
-
58219
- var self = this;
58220
-
58221
- var eventBus = this._eventBus;
58222
-
58223
- var parentContainer = this._getParentContainer();
58224
-
58225
- var container = this._container = domify$1(Palette.HTML_MARKUP);
58226
-
58227
- parentContainer.appendChild(container);
58228
- classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
58229
-
58230
- delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
58231
-
58232
- var target = event.delegateTarget;
58233
-
58234
- if (matches(target, TOGGLE_SELECTOR)) {
58235
- return self.toggle();
58236
- }
58237
-
58238
- self.trigger('click', event);
58239
- });
58240
-
58241
- // prevent drag propagation
58242
- event.bind(container, 'mousedown', function(event) {
58243
- event.stopPropagation();
58244
- });
58245
-
58246
- // prevent drag propagation
58247
- delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
58248
- self.trigger('dragstart', event);
58249
- });
58250
-
58251
- eventBus.on('canvas.resized', this._layoutChanged, this);
58252
-
58253
- eventBus.fire('palette.create', {
58254
- container: container
58255
- });
58256
- };
58257
-
58258
- Palette.prototype._getProviders = function(id) {
58259
-
58260
- var event = this._eventBus.createEvent({
58261
- type: 'palette.getProviders',
58262
- providers: []
58263
- });
58264
-
58265
- this._eventBus.fire(event);
58266
-
58267
- return event.providers;
58268
- };
58269
-
58270
- /**
58271
- * Update palette state.
58272
- *
58273
- * @param {Object} [state] { open, twoColumn }
58274
- */
58275
- Palette.prototype._toggleState = function(state) {
58276
-
58277
- state = state || {};
58278
-
58279
- var parent = this._getParentContainer(),
58280
- container = this._container;
58281
-
58282
- var eventBus = this._eventBus;
58283
-
58284
- var twoColumn;
58285
-
58286
- var cls = classes$1(container),
58287
- parentCls = classes$1(parent);
58288
-
58289
- if ('twoColumn' in state) {
58290
- twoColumn = state.twoColumn;
58291
- } else {
58292
- twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
58293
- }
58294
-
58295
- // always update two column
58296
- cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
58297
- parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
58298
-
58299
- if ('open' in state) {
58300
- cls.toggle(PALETTE_OPEN_CLS, state.open);
58301
- parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
58302
- }
58303
-
58304
- eventBus.fire('palette.changed', {
58305
- twoColumn: twoColumn,
58306
- open: this.isOpen()
58307
- });
58308
- };
58309
-
58310
- Palette.prototype._update = function() {
58311
-
58312
- var entriesContainer = query('.djs-palette-entries', this._container),
58313
- entries = this._entries = this.getEntries();
58314
-
58315
- clear$1(entriesContainer);
58316
-
58317
- forEach$1(entries, function(entry, id) {
58318
-
58319
- var grouping = entry.group || 'default';
58320
-
58321
- var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
58322
- if (!container) {
58323
- container = domify$1('<div class="group"></div>');
58324
- attr$1(container, 'data-group', grouping);
58325
-
58326
- entriesContainer.appendChild(container);
58327
- }
58328
-
58329
- var html = entry.html || (
58330
- entry.separator ?
58331
- '<hr class="separator" />' :
58332
- '<div class="entry" draggable="true"></div>');
58333
-
58334
-
58335
- var control = domify$1(html);
58336
- container.appendChild(control);
58337
-
58338
- if (!entry.separator) {
58339
- attr$1(control, 'data-action', id);
58340
-
58341
- if (entry.title) {
58342
- attr$1(control, 'title', entry.title);
58343
- }
58344
-
58345
- if (entry.className) {
58346
- addClasses(control, entry.className);
58347
- }
58348
-
58349
- if (entry.imageUrl) {
58350
- var image = domify$1('<img>');
58351
- attr$1(image, 'src', entry.imageUrl);
58352
-
58353
- control.appendChild(image);
58354
- }
58355
- }
58356
- });
58357
-
58358
- // open after update
58359
- this.open();
58360
- };
58361
-
58362
-
58363
- /**
58364
- * Trigger an action available on the palette
58365
- *
58366
- * @param {string} action
58367
- * @param {Event} event
58368
- */
58369
- Palette.prototype.trigger = function(action, event, autoActivate) {
58370
- var entries = this._entries,
58371
- entry,
58372
- handler,
58373
- originalEvent,
58374
- button = event.delegateTarget || event.target;
58375
-
58376
- if (!button) {
58377
- return event.preventDefault();
58378
- }
58379
-
58380
- entry = entries[attr$1(button, 'data-action')];
58381
-
58382
- // when user clicks on the palette and not on an action
58383
- if (!entry) {
58384
- return;
58385
- }
58386
-
58387
- handler = entry.action;
58388
-
58389
- originalEvent = event.originalEvent || event;
58390
-
58391
- // simple action (via callback function)
58392
- if (isFunction(handler)) {
58393
- if (action === 'click') {
58394
- handler(originalEvent, autoActivate);
58395
- }
58396
- } else {
58397
- if (handler[action]) {
58398
- handler[action](originalEvent, autoActivate);
58399
- }
58400
- }
58401
-
58402
- // silence other actions
58403
- event.preventDefault();
58404
- };
58405
-
58406
- Palette.prototype._layoutChanged = function() {
58407
- this._toggleState({});
58408
- };
58409
-
58410
- /**
58411
- * Do we need to collapse to two columns?
58412
- *
58413
- * @param {number} availableHeight
58414
- * @param {Object} entries
58415
- *
58416
- * @return {boolean}
58417
- */
58418
- Palette.prototype._needsCollapse = function(availableHeight, entries) {
58419
-
58420
- // top margin + bottom toggle + bottom margin
58421
- // implementors must override this method if they
58422
- // change the palette styles
58423
- var margin = 20 + 10 + 20;
58424
-
58425
- var entriesHeight = Object.keys(entries).length * 46;
58426
-
58427
- return availableHeight < entriesHeight + margin;
58428
- };
58429
-
58430
- /**
58431
- * Close the palette
58432
- */
58433
- Palette.prototype.close = function() {
58434
-
58435
- this._toggleState({
58436
- open: false,
58437
- twoColumn: false
58438
- });
58439
- };
58440
-
58441
-
58442
- /**
58443
- * Open the palette
58444
- */
58445
- Palette.prototype.open = function() {
58446
- this._toggleState({ open: true });
58447
- };
58448
-
58449
-
58450
- Palette.prototype.toggle = function(open) {
58451
- if (this.isOpen()) {
58452
- this.close();
58453
- } else {
58454
- this.open();
58455
- }
58456
- };
58457
-
58458
- Palette.prototype.isActiveTool = function(tool) {
58459
- return tool && this._activeTool === tool;
58460
- };
58461
-
58462
- Palette.prototype.updateToolHighlight = function(name) {
58463
- var entriesContainer,
58464
- toolsContainer;
58465
-
58466
- if (!this._toolsContainer) {
58467
- entriesContainer = query('.djs-palette-entries', this._container);
58468
-
58469
- this._toolsContainer = query('[data-group=tools]', entriesContainer);
58470
- }
58471
-
58472
- toolsContainer = this._toolsContainer;
58473
-
58474
- forEach$1(toolsContainer.children, function(tool) {
58475
- var actionName = tool.getAttribute('data-action');
58476
-
58477
- if (!actionName) {
58478
- return;
58479
- }
58480
-
58481
- var toolClasses = classes$1(tool);
58482
-
58483
- actionName = actionName.replace('-tool', '');
58484
-
58485
- if (toolClasses.contains('entry') && actionName === name) {
58486
- toolClasses.add('highlighted-entry');
58487
- } else {
58488
- toolClasses.remove('highlighted-entry');
58489
- }
58490
- });
58491
- };
58492
-
58493
-
58494
- /**
58495
- * Return true if the palette is opened.
58496
- *
58497
- * @example
58498
- *
58499
- * palette.open();
58500
- *
58501
- * if (palette.isOpen()) {
58502
- * // yes, we are open
58503
- * }
58504
- *
58505
- * @return {boolean} true if palette is opened
58506
- */
58507
- Palette.prototype.isOpen = function() {
58508
- return classes$1(this._container).has(PALETTE_OPEN_CLS);
58509
- };
58510
-
58511
- /**
58512
- * Get container the palette lives in.
58513
- *
58514
- * @return {Element}
58515
- */
58516
- Palette.prototype._getParentContainer = function() {
58517
- return this._canvas.getContainer();
58518
- };
58519
-
58520
-
58521
- /* markup definition */
58522
-
58523
- Palette.HTML_MARKUP =
58524
- '<div class="djs-palette">' +
58525
- '<div class="djs-palette-entries"></div>' +
58526
- '<div class="djs-palette-toggle"></div>' +
58527
- '</div>';
58528
-
58529
-
58530
- // helpers //////////////////////
58531
-
58532
- function addClasses(element, classNames) {
58533
-
58534
- var classes = classes$1(element);
58535
-
58536
- var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
58537
- actualClassNames.forEach(function(cls) {
58538
- classes.add(cls);
58539
- });
58540
- }
58541
-
58542
- function addPaletteEntries(entries, provider) {
58543
-
58544
- var entriesOrUpdater = provider.getPaletteEntries();
58545
-
58546
- if (isFunction(entriesOrUpdater)) {
58547
- return entriesOrUpdater(entries);
58548
- }
58549
-
58550
- forEach$1(entriesOrUpdater, function(entry, id) {
58551
- entries[id] = entry;
58552
- });
58553
-
58554
- return entries;
58555
- }
58556
-
58557
- var PaletteModule$1 = {
58558
- __init__: [ 'palette' ],
58559
- palette: [ 'type', Palette ]
58560
- };
58561
-
58562
59954
  var LASSO_TOOL_CURSOR = 'crosshair';
58563
59955
 
58564
59956
 
@@ -61209,6 +62601,10 @@
61209
62601
  '</bpmn:definitions>';
61210
62602
 
61211
62603
 
62604
+ /**
62605
+ * @typedef { import('didi').ModuleDeclaration } Module
62606
+ */
62607
+
61212
62608
  /**
61213
62609
  * A modeler for BPMN 2.0 diagrams.
61214
62610
  *
@@ -61278,8 +62674,8 @@
61278
62674
  * @param {string|number} [options.width] the width of the viewer
61279
62675
  * @param {string|number} [options.height] the height of the viewer
61280
62676
  * @param {Object} [options.moddleExtensions] extension packages to provide
61281
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
61282
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
62677
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
62678
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
61283
62679
  */
61284
62680
  function Modeler(options) {
61285
62681
  BaseModeler.call(this, options);
@@ -61339,6 +62735,7 @@
61339
62735
  ContextPadModule,
61340
62736
  CopyPasteModule,
61341
62737
  CreateModule,
62738
+ CreateAppendAnythingModule,
61342
62739
  DistributeElementsModule,
61343
62740
  EditorActionsModule,
61344
62741
  GridSnappingModule,