camunda-bpmn-js 2.4.0 → 2.5.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.
@@ -4785,6 +4785,28 @@
4785
4785
 
4786
4786
  var intersectPaths = /*@__PURE__*/getDefaultExportFromCjs(intersect);
4787
4787
 
4788
+ /**
4789
+ * Checks whether a value is an instance of Connection.
4790
+ *
4791
+ * @param {any} value
4792
+ *
4793
+ * @return {boolean}
4794
+ */
4795
+ function isConnection$2(value) {
4796
+ return isObject$1(value) && has$2(value, 'waypoints');
4797
+ }
4798
+
4799
+ /**
4800
+ * Checks whether a value is an instance of Label.
4801
+ *
4802
+ * @param {any} value
4803
+ *
4804
+ * @return {boolean}
4805
+ */
4806
+ function isLabel$2(value) {
4807
+ return isObject$1(value) && has$2(value, 'labelTarget');
4808
+ }
4809
+
4788
4810
  /**
4789
4811
  * @typedef {import('../core/Types').ElementLike} Element
4790
4812
  * @typedef {import('../core/Types').ConnectionLike} Connection
@@ -4939,7 +4961,7 @@
4939
4961
  * @return {Point}
4940
4962
  */
4941
4963
  function getMid(element) {
4942
- if (isConnection$h(element)) {
4964
+ if (isConnection$2(element)) {
4943
4965
  return getConnectionMid(element);
4944
4966
  }
4945
4967
 
@@ -5079,10 +5101,6 @@
5079
5101
  return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
5080
5102
  }
5081
5103
 
5082
- function isConnection$h(element) {
5083
- return !!element.waypoints;
5084
- }
5085
-
5086
5104
  /**
5087
5105
  * @typedef {import('./Types').ConnectionLike} ConnectionLike
5088
5106
  * @typedef {import('./Types').RootLike} RootLike
@@ -7386,6 +7404,7 @@
7386
7404
  *
7387
7405
  * @return {Root}
7388
7406
  */
7407
+
7389
7408
  /**
7390
7409
  * Creates a connection.
7391
7410
  *
@@ -7409,6 +7428,7 @@
7409
7428
  *
7410
7429
  * @return {Connection}
7411
7430
  */
7431
+
7412
7432
  /**
7413
7433
  * Creates a shape.
7414
7434
  *
@@ -7432,6 +7452,7 @@
7432
7452
  *
7433
7453
  * @return {Shape}
7434
7454
  */
7455
+
7435
7456
  /**
7436
7457
  * Creates a label.
7437
7458
  *
@@ -7451,6 +7472,7 @@
7451
7472
  *
7452
7473
  * @param {'label'} type
7453
7474
  * @param {Object} [attrs]
7475
+ *
7454
7476
  * @return {Label}
7455
7477
  */
7456
7478
  function create(type, attrs) {
@@ -7465,6 +7487,7 @@
7465
7487
  * Checks whether an object is a model instance.
7466
7488
  *
7467
7489
  * @param {any} obj
7490
+ *
7468
7491
  * @return {boolean}
7469
7492
  */
7470
7493
  function isModelElement(obj) {
@@ -18166,7 +18189,7 @@
18166
18189
  * @return {boolean}
18167
18190
  */
18168
18191
  function hasExternalLabel(element) {
18169
- return isLabel$7(element.label);
18192
+ return isLabel$2(element.label);
18170
18193
  }
18171
18194
 
18172
18195
  /**
@@ -18290,19 +18313,10 @@
18290
18313
  }
18291
18314
 
18292
18315
  /**
18293
- * @param {Element} element
18316
+ * @param {ModdleElement} semantic
18294
18317
  *
18295
- * @return {boolean}
18296
- */
18297
- function isLabel$7(element) {
18298
- return element && !!element.labelTarget;
18299
- }
18300
-
18301
-
18302
- /**
18303
- * @typedef { import('../model').DiagramElement } DiagramElement
18318
+ * @returns {string}
18304
18319
  */
18305
-
18306
18320
  function getLabelAttr(semantic) {
18307
18321
  if (
18308
18322
  is$6(semantic, 'bpmn:FlowElement') ||
@@ -18325,6 +18339,11 @@
18325
18339
  }
18326
18340
  }
18327
18341
 
18342
+ /**
18343
+ * @param {ModdleElement} semantic
18344
+ *
18345
+ * @returns {string}
18346
+ */
18328
18347
  function getCategoryValue(semantic) {
18329
18348
  var categoryValueRef = semantic['categoryValueRef'];
18330
18349
 
@@ -18337,9 +18356,9 @@
18337
18356
  }
18338
18357
 
18339
18358
  /**
18340
- * @param {DiagramElement} element
18359
+ * @param {Element} element
18341
18360
  *
18342
- * @return {string} label
18361
+ * @return {string}
18343
18362
  */
18344
18363
  function getLabel(element) {
18345
18364
  var semantic = element.businessObject,
@@ -18358,10 +18377,10 @@
18358
18377
 
18359
18378
 
18360
18379
  /**
18361
- * @param {DiagramElement} element
18380
+ * @param {Element} element
18362
18381
  * @param {string} text
18363
18382
  *
18364
- * @return {DiagramElement} element
18383
+ * @return {Element}
18365
18384
  */
18366
18385
  function setLabel(element, text) {
18367
18386
  var semantic = element.businessObject,
@@ -18583,7 +18602,7 @@
18583
18602
  */
18584
18603
 
18585
18604
  /**
18586
- * @typedef { import('../model').DiagramElement } DiagramElement
18605
+ * @typedef { import('../model/Types').Element } Element
18587
18606
  */
18588
18607
 
18589
18608
  /**
@@ -18949,8 +18968,8 @@
18949
18968
  }
18950
18969
 
18951
18970
  function as(type) {
18952
- return function(parentGfx, element) {
18953
- return renderer(type)(parentGfx, element);
18971
+ return function(parentGfx, element, options) {
18972
+ return renderer(type)(parentGfx, element, options);
18954
18973
  };
18955
18974
  }
18956
18975
 
@@ -19089,7 +19108,7 @@
19089
19108
 
19090
19109
  return drawCircle(parentGfx, element.width, element.height, attrs);
19091
19110
  },
19092
- 'bpmn:StartEvent': function(parentGfx, element) {
19111
+ 'bpmn:StartEvent': function(parentGfx, element, options) {
19093
19112
  var attrs = {
19094
19113
  fill: getFillColor(element, defaultFillColor),
19095
19114
  stroke: getStrokeColor$1(element, defaultStrokeColor)
@@ -19107,7 +19126,9 @@
19107
19126
 
19108
19127
  var circle = renderer('bpmn:Event')(parentGfx, element, attrs);
19109
19128
 
19110
- renderEventContent(element, parentGfx);
19129
+ if (!options || options.renderIcon !== false) {
19130
+ renderEventContent(element, parentGfx);
19131
+ }
19111
19132
 
19112
19133
  return circle;
19113
19134
  },
@@ -19360,14 +19381,16 @@
19360
19381
  stroke: getStrokeColor$1(event, defaultStrokeColor)
19361
19382
  });
19362
19383
  },
19363
- 'bpmn:EndEvent': function(parentGfx, element) {
19384
+ 'bpmn:EndEvent': function(parentGfx, element, options) {
19364
19385
  var circle = renderer('bpmn:Event')(parentGfx, element, {
19365
19386
  strokeWidth: 4,
19366
19387
  fill: getFillColor(element, defaultFillColor),
19367
19388
  stroke: getStrokeColor$1(element, defaultStrokeColor)
19368
19389
  });
19369
19390
 
19370
- renderEventContent(element, parentGfx);
19391
+ if (!options || options.renderIcon !== false) {
19392
+ renderEventContent(element, parentGfx);
19393
+ }
19371
19394
 
19372
19395
  return circle;
19373
19396
  },
@@ -19380,7 +19403,7 @@
19380
19403
 
19381
19404
  return circle;
19382
19405
  },
19383
- 'bpmn:IntermediateEvent': function(parentGfx, element) {
19406
+ 'bpmn:IntermediateEvent': function(parentGfx, element, options) {
19384
19407
  var outer = renderer('bpmn:Event')(parentGfx, element, {
19385
19408
  strokeWidth: 1.5,
19386
19409
  fill: getFillColor(element, defaultFillColor),
@@ -19394,7 +19417,9 @@
19394
19417
  stroke: getStrokeColor$1(element, defaultStrokeColor)
19395
19418
  });
19396
19419
 
19397
- renderEventContent(element, parentGfx);
19420
+ if (!options || options.renderIcon !== false) {
19421
+ renderEventContent(element, parentGfx);
19422
+ }
19398
19423
 
19399
19424
  return outer;
19400
19425
  },
@@ -20112,7 +20137,7 @@
20112
20137
 
20113
20138
  return elementStore;
20114
20139
  },
20115
- 'bpmn:BoundaryEvent': function(parentGfx, element) {
20140
+ 'bpmn:BoundaryEvent': function(parentGfx, element, options) {
20116
20141
 
20117
20142
  var semantic = getBusinessObject$2(element),
20118
20143
  cancel = semantic.cancelActivity;
@@ -20143,7 +20168,9 @@
20143
20168
 
20144
20169
  /* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
20145
20170
 
20146
- renderEventContent(element, parentGfx);
20171
+ if (!options || options.renderIcon !== false) {
20172
+ renderEventContent(element, parentGfx);
20173
+ }
20147
20174
 
20148
20175
  return outer;
20149
20176
  },
@@ -20424,7 +20451,7 @@
20424
20451
 
20425
20452
 
20426
20453
  /**
20427
- * @param {DiagramElement} element
20454
+ * @param {Element} element
20428
20455
  *
20429
20456
  * @return {boolean}
20430
20457
  */
@@ -20436,7 +20463,7 @@
20436
20463
  * Draw shape into parentGfx.
20437
20464
  *
20438
20465
  * @param {SVGElement} parentGfx
20439
- * @param {DiagramElement} element
20466
+ * @param {Element} element
20440
20467
  *
20441
20468
  * @return {SVGElement} mainGfx
20442
20469
  */
@@ -20452,7 +20479,7 @@
20452
20479
  * Draw connection into parentGfx.
20453
20480
  *
20454
20481
  * @param {SVGElement} parentGfx
20455
- * @param {DiagramElement} element
20482
+ * @param {Element} element
20456
20483
  *
20457
20484
  * @return {SVGElement} mainGfx
20458
20485
  */
@@ -20467,7 +20494,7 @@
20467
20494
  /**
20468
20495
  * Get shape path.
20469
20496
  *
20470
- * @param {DiagramElement} element
20497
+ * @param {Element} element
20471
20498
  *
20472
20499
  * @return {string} path
20473
20500
  */
@@ -24007,7 +24034,7 @@
24007
24034
  * @param {boolean} [unwrap] whether the event should be unwrapped
24008
24035
  * @param {any} [that]
24009
24036
  */
24010
- CommandInterceptor$1.prototype.canExecute = createHook('canExecute');
24037
+ CommandInterceptor$1.prototype.canExecute = createHook$1('canExecute');
24011
24038
 
24012
24039
  /**
24013
24040
  * Add a <preExecute> phase of command interceptor.
@@ -24018,7 +24045,7 @@
24018
24045
  * @param {boolean} [unwrap] whether the event should be unwrapped
24019
24046
  * @param {any} [that]
24020
24047
  */
24021
- CommandInterceptor$1.prototype.preExecute = createHook('preExecute');
24048
+ CommandInterceptor$1.prototype.preExecute = createHook$1('preExecute');
24022
24049
 
24023
24050
  /**
24024
24051
  * Add a <preExecuted> phase of command interceptor.
@@ -24029,7 +24056,7 @@
24029
24056
  * @param {boolean} [unwrap] whether the event should be unwrapped
24030
24057
  * @param {any} [that]
24031
24058
  */
24032
- CommandInterceptor$1.prototype.preExecuted = createHook('preExecuted');
24059
+ CommandInterceptor$1.prototype.preExecuted = createHook$1('preExecuted');
24033
24060
 
24034
24061
  /**
24035
24062
  * Add a <execute> phase of command interceptor.
@@ -24040,7 +24067,7 @@
24040
24067
  * @param {boolean} [unwrap] whether the event should be unwrapped
24041
24068
  * @param {any} [that]
24042
24069
  */
24043
- CommandInterceptor$1.prototype.execute = createHook('execute');
24070
+ CommandInterceptor$1.prototype.execute = createHook$1('execute');
24044
24071
 
24045
24072
  /**
24046
24073
  * Add a <executed> phase of command interceptor.
@@ -24051,7 +24078,7 @@
24051
24078
  * @param {boolean} [unwrap] whether the event should be unwrapped
24052
24079
  * @param {any} [that]
24053
24080
  */
24054
- CommandInterceptor$1.prototype.executed = createHook('executed');
24081
+ CommandInterceptor$1.prototype.executed = createHook$1('executed');
24055
24082
 
24056
24083
  /**
24057
24084
  * Add a <postExecute> phase of command interceptor.
@@ -24062,7 +24089,7 @@
24062
24089
  * @param {boolean} [unwrap] whether the event should be unwrapped
24063
24090
  * @param {any} [that]
24064
24091
  */
24065
- CommandInterceptor$1.prototype.postExecute = createHook('postExecute');
24092
+ CommandInterceptor$1.prototype.postExecute = createHook$1('postExecute');
24066
24093
 
24067
24094
  /**
24068
24095
  * Add a <postExecuted> phase of command interceptor.
@@ -24073,7 +24100,7 @@
24073
24100
  * @param {boolean} [unwrap] whether the event should be unwrapped
24074
24101
  * @param {any} [that]
24075
24102
  */
24076
- CommandInterceptor$1.prototype.postExecuted = createHook('postExecuted');
24103
+ CommandInterceptor$1.prototype.postExecuted = createHook$1('postExecuted');
24077
24104
 
24078
24105
  /**
24079
24106
  * Add a <revert> phase of command interceptor.
@@ -24084,7 +24111,7 @@
24084
24111
  * @param {boolean} [unwrap] whether the event should be unwrapped
24085
24112
  * @param {any} [that]
24086
24113
  */
24087
- CommandInterceptor$1.prototype.revert = createHook('revert');
24114
+ CommandInterceptor$1.prototype.revert = createHook$1('revert');
24088
24115
 
24089
24116
  /**
24090
24117
  * Add a <reverted> phase of command interceptor.
@@ -24095,7 +24122,7 @@
24095
24122
  * @param {boolean} [unwrap] whether the event should be unwrapped
24096
24123
  * @param {any} [that]
24097
24124
  */
24098
- CommandInterceptor$1.prototype.reverted = createHook('reverted');
24125
+ CommandInterceptor$1.prototype.reverted = createHook$1('reverted');
24099
24126
 
24100
24127
  /*
24101
24128
  * Add prototype methods for each phase of command execution (e.g. execute,
@@ -24110,7 +24137,7 @@
24110
24137
  * unwrap?: boolean
24111
24138
  * ) => any }
24112
24139
  */
24113
- function createHook(hook) {
24140
+ function createHook$1(hook) {
24114
24141
 
24115
24142
  /**
24116
24143
  * @this {CommandInterceptor}
@@ -30977,7 +31004,7 @@
30977
31004
  let element = closest(event.delegateTarget || event.target, '.entry', true);
30978
31005
  let entryId = attr$1(element, DATA_REF);
30979
31006
 
30980
- entry = this._getEntry(entryId);
31007
+ entry = { id: entryId, ...this._getEntry(entryId) };
30981
31008
  }
30982
31009
 
30983
31010
  const handler = entry.action;
@@ -31950,7 +31977,7 @@
31950
31977
  y: sourceTrbl.top - 50 - element.height / 2
31951
31978
  };
31952
31979
 
31953
- if (isConnection$g(source)) {
31980
+ if (isConnection$2(source)) {
31954
31981
  position = getMid(source);
31955
31982
  position.x += 100;
31956
31983
  position.y -= 50;
@@ -31995,10 +32022,6 @@
31995
32022
  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
31996
32023
  }
31997
32024
 
31998
- function isConnection$g(element) {
31999
- return !!element.waypoints;
32000
- }
32001
-
32002
32025
  /**
32003
32026
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
32004
32027
  */
@@ -32436,7 +32459,7 @@
32436
32459
 
32437
32460
  forEach$2(elements, function(element) {
32438
32461
 
32439
- if (is$6(element, 'bpmn:Lane') || isLabel$7(element)) {
32462
+ if (is$6(element, 'bpmn:Lane') || isLabel$2(element)) {
32440
32463
  canResize = false;
32441
32464
  return;
32442
32465
  }
@@ -35450,7 +35473,7 @@
35450
35473
  hoverMid = hover && getSnapPoint(hover, event);
35451
35474
 
35452
35475
  // only snap on connections, elements can have multiple connect endpoints
35453
- if (!isConnection$f(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
35476
+ if (!isConnection$2(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
35454
35477
  return;
35455
35478
  }
35456
35479
 
@@ -35502,13 +35525,6 @@
35502
35525
 
35503
35526
  BendpointSnapping.$inject = [ 'eventBus' ];
35504
35527
 
35505
-
35506
- // helpers //////////////////////
35507
-
35508
- function isConnection$f(element) {
35509
- return element && !!element.waypoints;
35510
- }
35511
-
35512
35528
  /**
35513
35529
  * @type { import('didi').ModuleDeclaration }
35514
35530
  */
@@ -37035,11 +37051,11 @@
37035
37051
  elements = filter(elements, function(element) {
37036
37052
  var labelTarget = element.labelTarget;
37037
37053
 
37038
- return !element.parent && !(isLabel$6(element) && elements.indexOf(labelTarget) !== -1);
37054
+ return !element.parent && !(isLabel$2(element) && elements.indexOf(labelTarget) !== -1);
37039
37055
  });
37040
37056
 
37041
37057
  var shape = find$2(elements, function(element) {
37042
- return !isConnection$e(element);
37058
+ return !isConnection$2(element);
37043
37059
  });
37044
37060
 
37045
37061
  var attach = false,
@@ -37194,7 +37210,7 @@
37194
37210
 
37195
37211
  // update shape
37196
37212
  shape = find$2(elements, function(element) {
37197
- return !isConnection$e(element);
37213
+ return !isConnection$2(element);
37198
37214
  });
37199
37215
  }
37200
37216
 
@@ -37235,7 +37251,7 @@
37235
37251
  }
37236
37252
 
37237
37253
  var shape = find$2(elements, function(element) {
37238
- return !isConnection$e(element);
37254
+ return !isConnection$2(element);
37239
37255
  });
37240
37256
 
37241
37257
  if (!shape) {
@@ -37269,7 +37285,7 @@
37269
37285
 
37270
37286
  // center elements around cursor
37271
37287
  forEach$2(elements, function(element) {
37272
- if (isConnection$e(element)) {
37288
+ if (isConnection$2(element)) {
37273
37289
  element.waypoints = map$2(element.waypoints, function(waypoint) {
37274
37290
  return {
37275
37291
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -37331,16 +37347,8 @@
37331
37347
  }
37332
37348
  }
37333
37349
 
37334
- function isConnection$e(element) {
37335
- return !!element.waypoints;
37336
- }
37337
-
37338
37350
  function isSingleShape(elements) {
37339
- return elements && elements.length === 1 && !isConnection$e(elements[0]);
37340
- }
37341
-
37342
- function isLabel$6(element) {
37343
- return !!element.labelTarget;
37351
+ return elements && elements.length === 1 && !isConnection$2(elements[ 0 ]);
37344
37352
  }
37345
37353
 
37346
37354
  /**
@@ -37673,7 +37681,7 @@
37673
37681
  }
37674
37682
 
37675
37683
  // connections (priority = 3)
37676
- if (isConnection$d(element)) {
37684
+ if (isConnection$2(element)) {
37677
37685
  descriptor.priority = 3;
37678
37686
 
37679
37687
  descriptor.source = element.source.id;
@@ -37683,7 +37691,7 @@
37683
37691
  }
37684
37692
 
37685
37693
  // labels (priority = 4)
37686
- if (isLabel$5(element)) {
37694
+ if (isLabel$2(element)) {
37687
37695
  descriptor.priority = 4;
37688
37696
 
37689
37697
  descriptor.labelTarget = element.labelTarget.id;
@@ -37816,7 +37824,7 @@
37816
37824
 
37817
37825
  // center elements around cursor
37818
37826
  forEach$2(elements, function(element) {
37819
- if (isConnection$d(element)) {
37827
+ if (isConnection$2(element)) {
37820
37828
  element.waypoints = map$2(element.waypoints, function(waypoint) {
37821
37829
  return {
37822
37830
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -37869,7 +37877,7 @@
37869
37877
 
37870
37878
  var element;
37871
37879
 
37872
- if (isConnection$d(attrs)) {
37880
+ if (isConnection$2(attrs)) {
37873
37881
  attrs.source = cache[ descriptor.source ];
37874
37882
  attrs.target = cache[ descriptor.target ];
37875
37883
 
@@ -37880,7 +37888,7 @@
37880
37888
  return;
37881
37889
  }
37882
37890
 
37883
- if (isLabel$5(attrs)) {
37891
+ if (isLabel$2(attrs)) {
37884
37892
  attrs.labelTarget = cache[ attrs.labelTarget ];
37885
37893
 
37886
37894
  element = cache[ descriptor.id ] = self.createLabel(attrs);
@@ -37935,7 +37943,7 @@
37935
37943
  source,
37936
37944
  target;
37937
37945
 
37938
- if (isConnection$d(element)) {
37946
+ if (isConnection$2(element)) {
37939
37947
  source = find$2(elements, matchPattern({ id: element.source.id }));
37940
37948
  target = find$2(elements, matchPattern({ id: element.target.id }));
37941
37949
 
@@ -37944,7 +37952,7 @@
37944
37952
  }
37945
37953
  }
37946
37954
 
37947
- if (isLabel$5(element)) {
37955
+ if (isLabel$2(element)) {
37948
37956
  labelTarget = find$2(elements, matchPattern({ id: element.labelTarget.id }));
37949
37957
 
37950
37958
  if (!labelTarget) {
@@ -38037,7 +38045,7 @@
38037
38045
  eachElement$2(parents, function(element, _index, depth) {
38038
38046
 
38039
38047
  // do NOT add external labels directly
38040
- if (isLabel$5(element)) {
38048
+ if (isLabel$2(element)) {
38041
38049
  return;
38042
38050
  }
38043
38051
 
@@ -38135,14 +38143,6 @@
38135
38143
  return !!element.host;
38136
38144
  }
38137
38145
 
38138
- function isConnection$d(element) {
38139
- return !!element.waypoints;
38140
- }
38141
-
38142
- function isLabel$5(element) {
38143
- return !!element.labelTarget;
38144
- }
38145
-
38146
38146
  function copyWaypoints$1(element) {
38147
38147
  return map$2(element.waypoints, function(waypoint) {
38148
38148
 
@@ -38226,7 +38226,7 @@
38226
38226
 
38227
38227
  // do not copy business object + di for labels;
38228
38228
  // will be pulled from the referenced label target
38229
- if (isLabel$7(element)) {
38229
+ if (isLabel$2(element)) {
38230
38230
  return descriptor;
38231
38231
  }
38232
38232
 
@@ -38294,7 +38294,7 @@
38294
38294
  di = descriptor.di;
38295
38295
 
38296
38296
  // wire existing di + businessObject for external label
38297
- if (isLabel$7(descriptor)) {
38297
+ if (isLabel$2(descriptor)) {
38298
38298
  descriptor.businessObject = getBusinessObject$2(cache[ descriptor.labelTarget ]);
38299
38299
  descriptor.di = getDi$1(cache[ descriptor.labelTarget ]);
38300
38300
 
@@ -44375,7 +44375,7 @@
44375
44375
  ResizeHandles.prototype.addResizer = function(element) {
44376
44376
  var self = this;
44377
44377
 
44378
- if (isConnection$c(element) || !this._resize.canResize({ shape: element })) {
44378
+ if (isConnection$2(element) || !this._resize.canResize({ shape: element })) {
44379
44379
  return;
44380
44380
  }
44381
44381
 
@@ -44427,10 +44427,6 @@
44427
44427
  return offset;
44428
44428
  }
44429
44429
 
44430
- function isConnection$c(element) {
44431
- return !!element.waypoints;
44432
- }
44433
-
44434
44430
  /**
44435
44431
  * @type { import('didi').ModuleDeclaration }
44436
44432
  */
@@ -44790,7 +44786,7 @@
44790
44786
  // external label not yet created
44791
44787
  if (isLabelExternal(target)
44792
44788
  && !hasExternalLabel(target)
44793
- && !isLabel$7(target)) {
44789
+ && !isLabel$2(target)) {
44794
44790
 
44795
44791
  var externalLabelMid = getExternalLabelMid(element);
44796
44792
 
@@ -45467,7 +45463,7 @@
45467
45463
  }
45468
45464
 
45469
45465
  function shouldReplace$1(shape, host) {
45470
- return !isLabel$7(shape) &&
45466
+ return !isLabel$2(shape) &&
45471
45467
  isAny$1(shape, [ 'bpmn:IntermediateThrowEvent', 'bpmn:IntermediateCatchEvent' ]) && !!host;
45472
45468
  }
45473
45469
 
@@ -45644,8 +45640,8 @@
45644
45640
  // ignore connections, groups and labels
45645
45641
  var children = rootElement.children.filter(function(element) {
45646
45642
  return !is$6(element, 'bpmn:Group') &&
45647
- !isLabel$7(element) &&
45648
- !isConnection$b(element);
45643
+ !isLabel$2(element) &&
45644
+ !isConnection$2(element);
45649
45645
  });
45650
45646
 
45651
45647
  // ensure for available children to calculate bounds
@@ -45816,10 +45812,6 @@
45816
45812
  };
45817
45813
  }
45818
45814
 
45819
- function isConnection$b(element) {
45820
- return !!element.waypoints;
45821
- }
45822
-
45823
45815
  function findParticipant(elements) {
45824
45816
  return find$2(elements, function(element) {
45825
45817
  return is$6(element, 'bpmn:Participant');
@@ -46424,7 +46416,7 @@
46424
46416
  }
46425
46417
 
46426
46418
  function shouldReplace(shape, host) {
46427
- return !isLabel$7(shape) && is$6(shape, 'bpmn:BoundaryEvent') && !host;
46419
+ return !isLabel$2(shape) && is$6(shape, 'bpmn:BoundaryEvent') && !host;
46428
46420
  }
46429
46421
 
46430
46422
  function includes$6(array, item) {
@@ -48131,7 +48123,7 @@
48131
48123
 
48132
48124
  var element = context.shape || context.connection;
48133
48125
 
48134
- if (isLabel$7(element) || !isLabelExternal(element)) {
48126
+ if (isLabel$2(element) || !isLabelExternal(element)) {
48135
48127
  return;
48136
48128
  }
48137
48129
 
@@ -50670,7 +50662,7 @@
50670
50662
  shape = context.shape,
50671
50663
  shapeBo = shape.businessObject;
50672
50664
 
50673
- if (isLabel$7(shape)) {
50665
+ if (isLabel$2(shape)) {
50674
50666
  return;
50675
50667
  }
50676
50668
 
@@ -51119,12 +51111,12 @@
51119
51111
  position = context.position,
51120
51112
  target = context.target;
51121
51113
 
51122
- if (isConnection$a(target) && !canInsert(elements, target)) {
51114
+ if (isConnection$2(target) && !canInsert(elements, target)) {
51123
51115
  return false;
51124
51116
  }
51125
51117
 
51126
51118
  return every(elements, function(element) {
51127
- if (isConnection$a(element)) {
51119
+ if (isConnection$2(element)) {
51128
51120
  return canConnect(element.source, element.target, element);
51129
51121
  }
51130
51122
 
@@ -51233,7 +51225,7 @@
51233
51225
  * @return {boolean}
51234
51226
  */
51235
51227
  function nonExistingOrLabel(element) {
51236
- return !element || isLabel$7(element);
51228
+ return !element || isLabel$2(element);
51237
51229
  }
51238
51230
 
51239
51231
  function isSame$1(a, b) {
@@ -51467,15 +51459,6 @@
51467
51459
  );
51468
51460
  }
51469
51461
 
51470
- /**
51471
- * @param {Element} element
51472
- *
51473
- * @return {boolean}
51474
- */
51475
- function isConnection$a(element) {
51476
- return element.waypoints;
51477
- }
51478
-
51479
51462
  /**
51480
51463
  * @param {Element} element
51481
51464
  *
@@ -51566,7 +51549,7 @@
51566
51549
  function canDrop(element, target) {
51567
51550
 
51568
51551
  // can move labels and groups everywhere
51569
- if (isLabel$7(element) || isGroup(element)) {
51552
+ if (isLabel$2(element) || isGroup(element)) {
51570
51553
  return true;
51571
51554
  }
51572
51555
 
@@ -51656,7 +51639,7 @@
51656
51639
  * @return {boolean}
51657
51640
  */
51658
51641
  function isBoundaryEvent(element) {
51659
- return !isLabel$7(element) && is$6(element, 'bpmn:BoundaryEvent');
51642
+ return !isLabel$2(element) && is$6(element, 'bpmn:BoundaryEvent');
51660
51643
  }
51661
51644
 
51662
51645
  /**
@@ -51765,7 +51748,7 @@
51765
51748
  var element = elements[0];
51766
51749
 
51767
51750
  // do not attach labels
51768
- if (isLabel$7(element)) {
51751
+ if (isLabel$2(element)) {
51769
51752
  return false;
51770
51753
  }
51771
51754
 
@@ -51937,7 +51920,7 @@
51937
51920
  return false;
51938
51921
  }
51939
51922
 
51940
- if (isLabel$7(shape) || isGroup(shape)) {
51923
+ if (isLabel$2(shape) || isGroup(shape)) {
51941
51924
  return true;
51942
51925
  }
51943
51926
 
@@ -52118,7 +52101,7 @@
52118
52101
  // return true if shape can be inserted into connection parent
52119
52102
  return (
52120
52103
  isAny$1(connection, [ 'bpmn:SequenceFlow', 'bpmn:MessageFlow' ]) &&
52121
- !isLabel$7(connection) &&
52104
+ !isLabel$2(connection) &&
52122
52105
  is$6(shape, 'bpmn:FlowNode') &&
52123
52106
  !is$6(shape, 'bpmn:BoundaryEvent') &&
52124
52107
  canDrop(shape, connection.parent));
@@ -52141,7 +52124,7 @@
52141
52124
  * @return {boolean}
52142
52125
  */
52143
52126
  function canCopy(elements, element) {
52144
- if (isLabel$7(element)) {
52127
+ if (isLabel$2(element)) {
52145
52128
  return true;
52146
52129
  }
52147
52130
 
@@ -53049,12 +53032,12 @@
53049
53032
  }
53050
53033
 
53051
53034
  forEach$2(elements, function(element) {
53052
- if (!element.parent || isLabel$4(element)) {
53035
+ if (!element.parent || isLabel$2(element)) {
53053
53036
  return;
53054
53037
  }
53055
53038
 
53056
53039
  // handle connections separately
53057
- if (isConnection$9(element)) {
53040
+ if (isConnection$2(element)) {
53058
53041
  connections.push(element);
53059
53042
 
53060
53043
  return;
@@ -53225,15 +53208,15 @@
53225
53208
 
53226
53209
  // find children that are not moving or resizing
53227
53210
  var nonMovingResizingChildren = filter(children, function(child) {
53228
- return !isConnection$9(child) &&
53229
- !isLabel$4(child) &&
53211
+ return !isConnection$2(child) &&
53212
+ !isLabel$2(child) &&
53230
53213
  !includes$3(movingShapes, child) &&
53231
53214
  !includes$3(resizingShapes, child);
53232
53215
  });
53233
53216
 
53234
53217
  // find children that are moving
53235
53218
  var movingChildren = filter(children, function(child) {
53236
- return !isConnection$9(child) && !isLabel$4(child) && includes$3(movingShapes, child);
53219
+ return !isConnection$2(child) && !isLabel$2(child) && includes$3(movingShapes, child);
53237
53220
  });
53238
53221
 
53239
53222
  var minOrMax,
@@ -53367,14 +53350,6 @@
53367
53350
  return !!element.host;
53368
53351
  }
53369
53352
 
53370
- function isConnection$9(element) {
53371
- return !!element.waypoints;
53372
- }
53373
-
53374
- function isLabel$4(element) {
53375
- return !!element.labelTarget;
53376
- }
53377
-
53378
53353
  var MARKER_DRAGGING$1 = 'djs-dragging',
53379
53354
  MARKER_RESIZING = 'djs-resizing';
53380
53355
 
@@ -53533,7 +53508,7 @@
53533
53508
  });
53534
53509
  });
53535
53510
 
53536
- return isConnection$8(element)
53511
+ return isConnection$2(element)
53537
53512
  && (sourceIsMoving || sourceIsResizing)
53538
53513
  && (targetIsMoving || targetIsResizing);
53539
53514
  });
@@ -53663,16 +53638,6 @@
53663
53638
  'previewSupport'
53664
53639
  ];
53665
53640
 
53666
-
53667
- // helpers //////////////////////
53668
-
53669
- /**
53670
- * Checks if an element is a connection.
53671
- */
53672
- function isConnection$8(element) {
53673
- return element.waypoints;
53674
- }
53675
-
53676
53641
  /**
53677
53642
  * @type { import('didi').ModuleDeclaration }
53678
53643
  */
@@ -55712,7 +55677,7 @@
55712
55677
  BpmnUpdater.prototype.updateParent = function(element, oldParent) {
55713
55678
 
55714
55679
  // do not update BPMN 2.0 label parent
55715
- if (isLabel$7(element)) {
55680
+ if (isLabel$2(element)) {
55716
55681
  return;
55717
55682
  }
55718
55683
 
@@ -55777,7 +55742,7 @@
55777
55742
  });
55778
55743
  }
55779
55744
 
55780
- var target = isLabel$7(shape) ? this._getLabel(di) : di;
55745
+ var target = isLabel$2(shape) ? this._getLabel(di) : di;
55781
55746
 
55782
55747
  var bounds = target.bounds;
55783
55748
 
@@ -56838,7 +56803,7 @@
56838
56803
 
56839
56804
  // center elements around position
56840
56805
  forEach$2(elements, function(element) {
56841
- if (isConnection$7(element)) {
56806
+ if (isConnection$2(element)) {
56842
56807
  element.waypoints = map$2(element.waypoints, function(waypoint) {
56843
56808
  return {
56844
56809
  x: round$3(waypoint.x - bbox.x - bbox.width / 2 + position.x),
@@ -56858,7 +56823,7 @@
56858
56823
  var cache = {};
56859
56824
 
56860
56825
  forEach$2(elements, function(element) {
56861
- if (isConnection$7(element)) {
56826
+ if (isConnection$2(element)) {
56862
56827
  cache[ element.id ] = isNumber$1(parentIndex) ?
56863
56828
  modeling.createConnection(
56864
56829
  cache[ element.source.id ],
@@ -56885,6 +56850,10 @@
56885
56850
  createShapeHints.autoResize = false;
56886
56851
  }
56887
56852
 
56853
+ if (isLabel$2(element)) {
56854
+ createShapeHints = omit(createShapeHints, [ 'attach' ]);
56855
+ }
56856
+
56888
56857
  cache[ element.id ] = isNumber$1(parentIndex) ?
56889
56858
  modeling.createShape(
56890
56859
  element,
@@ -56902,13 +56871,7 @@
56902
56871
  });
56903
56872
 
56904
56873
  context.elements = values(cache);
56905
- };
56906
-
56907
- // helpers //////////
56908
-
56909
- function isConnection$7(element) {
56910
- return !!element.waypoints;
56911
- }
56874
+ };
56912
56875
 
56913
56876
  /**
56914
56877
  * @typedef {import('../../../model/Types').Element} Element
@@ -57231,7 +57194,7 @@
57231
57194
 
57232
57195
  // remove child shapes and connections
57233
57196
  saveClear(shape.children, function(child) {
57234
- if (isConnection$6(child)) {
57197
+ if (isConnection$2(child)) {
57235
57198
  modeling.removeConnection(child, { nested: true });
57236
57199
  } else {
57237
57200
  modeling.removeShape(child, { nested: true });
@@ -57279,10 +57242,6 @@
57279
57242
  return shape;
57280
57243
  };
57281
57244
 
57282
- function isConnection$6(element) {
57283
- return element.waypoints;
57284
- }
57285
-
57286
57245
  /**
57287
57246
  * @typedef {import('../Modeling').default} Modeling
57288
57247
  */
@@ -60413,13 +60372,13 @@
60413
60372
  }
60414
60373
 
60415
60374
  forEach$2(elements, function(element) {
60416
- var assignedDi = isConnection$5(element) ? pick(di, [ 'border-color' ]) : di,
60375
+ var assignedDi = isConnection$2(element) ? pick(di, [ 'border-color' ]) : di,
60417
60376
  elementDi = getDi$1(element);
60418
60377
 
60419
60378
  // TODO @barmac: remove once we drop bpmn.io properties
60420
60379
  ensureLegacySupport(assignedDi);
60421
60380
 
60422
- if (isLabel$7(element)) {
60381
+ if (isLabel$2(element)) {
60423
60382
 
60424
60383
  // set label colors as bpmndi:BPMNLabel#color
60425
60384
  self._commandStack.execute('element.updateModdleProperties', {
@@ -60479,10 +60438,6 @@
60479
60438
  return /^#[0-9a-fA-F]{6}$/.test(context.fillStyle) ? context.fillStyle : null;
60480
60439
  }
60481
60440
 
60482
- function isConnection$5(element) {
60483
- return !!element.waypoints;
60484
- }
60485
-
60486
60441
  /**
60487
60442
  * Add legacy properties if required.
60488
60443
  *
@@ -60545,7 +60500,7 @@
60545
60500
  businessObject = element.businessObject,
60546
60501
  newLabel = ctx.newLabel;
60547
60502
 
60548
- if (!isLabel$7(element)
60503
+ if (!isLabel$2(element)
60549
60504
  && isLabelExternal(element)
60550
60505
  && !hasExternalLabel(element)
60551
60506
  && !isEmptyText(newLabel)) {
@@ -60585,11 +60540,11 @@
60585
60540
  hints = ctx.hints || {};
60586
60541
 
60587
60542
  // ignore internal labels for elements except text annotations
60588
- if (!isLabel$7(label) && !is$6(label, 'bpmn:TextAnnotation')) {
60543
+ if (!isLabel$2(label) && !is$6(label, 'bpmn:TextAnnotation')) {
60589
60544
  return;
60590
60545
  }
60591
60546
 
60592
- if (isLabel$7(label) && isEmptyText(newLabel)) {
60547
+ if (isLabel$2(label) && isEmptyText(newLabel)) {
60593
60548
 
60594
60549
  if (hints.removeShape !== false) {
60595
60550
  modeling.removeShape(label, { unsetLabel: false });
@@ -62698,7 +62653,7 @@
62698
62653
 
62699
62654
  var filteredElements = filter(elements, function(element) {
62700
62655
 
62701
- if (!isConnection$4(element)) {
62656
+ if (!isConnection$2(element)) {
62702
62657
  return true;
62703
62658
  } else {
62704
62659
 
@@ -62716,13 +62671,6 @@
62716
62671
  return size(groupBy(elements, function(e) { return e.parent && e.parent.id; })) !== 1;
62717
62672
  }
62718
62673
 
62719
- /**
62720
- * Checks if an element is a connection.
62721
- */
62722
- function isConnection$4(element) {
62723
- return element.waypoints;
62724
- }
62725
-
62726
62674
  /**
62727
62675
  * @type { import('didi').ModuleDeclaration }
62728
62676
  */
@@ -64779,7 +64727,7 @@
64779
64727
  });
64780
64728
 
64781
64729
  // snap labels to mid only
64782
- if (isLabel$3(shape)) {
64730
+ if (isLabel$2(shape)) {
64783
64731
  return snapContext;
64784
64732
  }
64785
64733
 
@@ -64802,9 +64750,9 @@
64802
64750
  forEach$2(snapTargets, function(snapTarget) {
64803
64751
 
64804
64752
  // handle labels
64805
- if (isLabel$3(snapTarget)) {
64753
+ if (isLabel$2(snapTarget)) {
64806
64754
 
64807
- if (isLabel$3(shape)) {
64755
+ if (isLabel$2(shape)) {
64808
64756
  snapPoints.add('mid', mid$2(snapTarget));
64809
64757
  }
64810
64758
 
@@ -64812,7 +64760,7 @@
64812
64760
  }
64813
64761
 
64814
64762
  // handle connections
64815
- if (isConnection$3(snapTarget)) {
64763
+ if (isConnection$2(snapTarget)) {
64816
64764
 
64817
64765
  // ignore single segment connections
64818
64766
  if (snapTarget.waypoints.length < 3) {
@@ -64853,16 +64801,8 @@
64853
64801
 
64854
64802
  // helpers //////////
64855
64803
 
64856
- function isConnection$3(element) {
64857
- return !!element.waypoints;
64858
- }
64859
-
64860
64804
  function isHidden$1(element) {
64861
64805
  return !!element.hidden;
64862
- }
64863
-
64864
- function isLabel$3(element) {
64865
- return !!element.labelTarget;
64866
64806
  }
64867
64807
 
64868
64808
  /**
@@ -65271,18 +65211,10 @@
65271
65211
  return element.host === host;
65272
65212
  }
65273
65213
 
65274
- function isConnection$2(element) {
65275
- return !!element.waypoints;
65276
- }
65277
-
65278
65214
  function isHidden(element) {
65279
65215
  return !!element.hidden;
65280
65216
  }
65281
65217
 
65282
- function isLabel$2(element) {
65283
- return !!element.labelTarget;
65284
- }
65285
-
65286
65218
  function isHorizontal(direction) {
65287
65219
  return direction === 'n' || direction === 's';
65288
65220
  }
@@ -101273,7 +101205,7 @@
101273
101205
  eventBus.fire('propertiesPanel.layoutChanged', {
101274
101206
  layout: newLayout
101275
101207
  });
101276
- }, [eventBus, layoutConfig]);
101208
+ }, [eventBus]);
101277
101209
 
101278
101210
  // React to external layout changes
101279
101211
  y(() => {
@@ -101603,17 +101535,17 @@
101603
101535
  function getLinkEventDefinition(element) {
101604
101536
  return getEventDefinition$1(element, 'bpmn:LinkEventDefinition');
101605
101537
  }
101606
- function getSignalEventDefinition(element) {
101538
+ function getSignalEventDefinition$1(element) {
101607
101539
  return getEventDefinition$1(element, 'bpmn:SignalEventDefinition');
101608
101540
  }
101609
101541
  function isLinkSupported(element) {
101610
101542
  return isAny$1(element, ['bpmn:IntermediateThrowEvent', 'bpmn:IntermediateCatchEvent']) && !!getLinkEventDefinition(element);
101611
101543
  }
101612
- function isSignalSupported(element) {
101613
- return is$6(element, 'bpmn:Event') && !!getSignalEventDefinition(element);
101544
+ function isSignalSupported$1(element) {
101545
+ return is$6(element, 'bpmn:Event') && !!getSignalEventDefinition$1(element);
101614
101546
  }
101615
- function getSignal(element) {
101616
- const signalEventDefinition = getSignalEventDefinition(element);
101547
+ function getSignal$1(element) {
101548
+ const signalEventDefinition = getSignalEventDefinition$1(element);
101617
101549
  return signalEventDefinition && signalEventDefinition.get('signalRef');
101618
101550
  }
101619
101551
  function getEscalationEventDefinition(element) {
@@ -103166,24 +103098,24 @@
103166
103098
  return is$6(element, 'bpmn:Participant') && element.businessObject.get('processRef');
103167
103099
  }
103168
103100
 
103169
- const EMPTY_OPTION$3 = '';
103170
- const CREATE_NEW_OPTION$2 = 'create-new';
103171
-
103172
103101
  /**
103173
103102
  * @typedef { import('@bpmn-io/properties-panel').EntryDefinition } Entry
103174
103103
  */
103175
103104
 
103105
+ const EMPTY_OPTION$3 = '';
103106
+ const CREATE_NEW_OPTION$2 = 'create-new';
103107
+
103176
103108
  /**
103177
- * @returns {Array<Entry>} entries
103109
+ * @returns {Entry[]}
103178
103110
  */
103179
- function SignalProps(props) {
103111
+ function SignalProps$1(props) {
103180
103112
  const {
103181
103113
  element
103182
103114
  } = props;
103183
- if (!isSignalSupported(element)) {
103115
+ if (!isSignalSupported$1(element)) {
103184
103116
  return [];
103185
103117
  }
103186
- const signal = getSignal(element);
103118
+ const signal = getSignal$1(element);
103187
103119
  let entries = [{
103188
103120
  id: 'signalRef',
103189
103121
  component: SignalRef,
@@ -103192,7 +103124,7 @@
103192
103124
  if (signal) {
103193
103125
  entries = [...entries, {
103194
103126
  id: 'signalName',
103195
- component: SignalName,
103127
+ component: SignalName$1,
103196
103128
  isEdited: isEdited$1
103197
103129
  }];
103198
103130
  }
@@ -103205,9 +103137,9 @@
103205
103137
  const bpmnFactory = useService('bpmnFactory');
103206
103138
  const commandStack = useService('commandStack');
103207
103139
  const translate = useService('translate');
103208
- const signalEventDefinition = getSignalEventDefinition(element);
103140
+ const signalEventDefinition = getSignalEventDefinition$1(element);
103209
103141
  const getValue = () => {
103210
- const signal = getSignal(element);
103142
+ const signal = getSignal$1(element);
103211
103143
  if (signal) {
103212
103144
  return signal.get('id');
103213
103145
  }
@@ -103281,14 +103213,14 @@
103281
103213
  getOptions
103282
103214
  });
103283
103215
  }
103284
- function SignalName(props) {
103216
+ function SignalName$1(props) {
103285
103217
  const {
103286
103218
  element
103287
103219
  } = props;
103288
103220
  const commandStack = useService('commandStack');
103289
103221
  const translate = useService('translate');
103290
103222
  const debounce = useService('debounceInput');
103291
- const signal = getSignal(element);
103223
+ const signal = getSignal$1(element);
103292
103224
  const getValue = () => {
103293
103225
  return signal.get('name');
103294
103226
  };
@@ -103666,7 +103598,7 @@
103666
103598
  id: 'signal',
103667
103599
  label: translate('Signal'),
103668
103600
  component: Group,
103669
- entries: [...SignalProps({
103601
+ entries: [...SignalProps$1({
103670
103602
  element
103671
103603
  })]
103672
103604
  };
@@ -105357,7 +105289,7 @@
105357
105289
  component: VariableName,
105358
105290
  isEdited: isEdited$1
105359
105291
  });
105360
- if (!is$6(element, 'bpmn:StartEvent')) {
105292
+ if (!is$6(element, 'bpmn:StartEvent') || isInEventSubProcess$1(element)) {
105361
105293
  entries.push({
105362
105294
  id: 'conditionVariableEvents',
105363
105295
  component: VariableEvents,
@@ -105490,6 +105422,11 @@
105490
105422
  function createFormalExpression(parent, attributes, bpmnFactory) {
105491
105423
  return createElement('bpmn:FormalExpression', attributes, is$6(parent, 'bpmn:SequenceFlow') ? getBusinessObject$2(parent) : getConditionalEventDefinition(parent), bpmnFactory);
105492
105424
  }
105425
+ function isInEventSubProcess$1(element) {
105426
+ const bo = getBusinessObject$2(element),
105427
+ parent = bo.$parent;
105428
+ return is$6(parent, 'bpmn:SubProcess') && parent.triggeredByEvent;
105429
+ }
105493
105430
 
105494
105431
  /**
105495
105432
  * Cf. https://docs.camunda.org/manual/latest/user-guide/process-engine/scripting/
@@ -109566,14 +109503,14 @@
109566
109503
  }
109567
109504
  };
109568
109505
  function addInMapping() {
109569
- const businessObject = getSignalEventDefinition(element) || getBusinessObject$2(element);
109506
+ const businessObject = getSignalEventDefinition$1(element) || getBusinessObject$2(element);
109570
109507
  const mapping = createElement('camunda:In', {
109571
109508
  variables: 'all'
109572
109509
  }, null, bpmnFactory);
109573
109510
  addExtensionElements(element, businessObject, mapping, bpmnFactory, commandStack);
109574
109511
  }
109575
109512
  function removeInMapping() {
109576
- const businessObject = getSignalEventDefinition(element) || getBusinessObject$2(element);
109513
+ const businessObject = getSignalEventDefinition$1(element) || getBusinessObject$2(element);
109577
109514
  const mappings = findRelevantInMappings(element);
109578
109515
  removeExtensionElements$1(element, businessObject, mappings, commandStack);
109579
109516
  }
@@ -109615,7 +109552,7 @@
109615
109552
  // helper //////////////////////////
109616
109553
 
109617
109554
  function areInMappingsSupported$1(element) {
109618
- const signalEventDefinition = getSignalEventDefinition(element);
109555
+ const signalEventDefinition = getSignalEventDefinition$1(element);
109619
109556
  if (signalEventDefinition) {
109620
109557
  return isAny$1(element, ['bpmn:IntermediateThrowEvent', 'bpmn:EndEvent']);
109621
109558
  }
@@ -109623,7 +109560,7 @@
109623
109560
  }
109624
109561
  function getInMappings$1(element) {
109625
109562
  const businessObject = getBusinessObject$2(element);
109626
- const signalEventDefinition = getSignalEventDefinition(businessObject);
109563
+ const signalEventDefinition = getSignalEventDefinition$1(businessObject);
109627
109564
  return getExtensionElementsList$1(signalEventDefinition || businessObject, 'camunda:In');
109628
109565
  }
109629
109566
  function findRelevantInMappings(element) {
@@ -109914,7 +109851,7 @@
109914
109851
  }) {
109915
109852
  return function (event) {
109916
109853
  event.stopPropagation();
109917
- const businessObject = getSignalEventDefinition(element) || getBusinessObject$2(element);
109854
+ const businessObject = getSignalEventDefinition$1(element) || getBusinessObject$2(element);
109918
109855
  removeExtensionElements$1(element, businessObject, mapping, commandStack);
109919
109856
  };
109920
109857
  }
@@ -109925,7 +109862,7 @@
109925
109862
  }) {
109926
109863
  return function (event) {
109927
109864
  event.stopPropagation();
109928
- const businessObject = getSignalEventDefinition(element) || getBusinessObject$2(element);
109865
+ const businessObject = getSignalEventDefinition$1(element) || getBusinessObject$2(element);
109929
109866
  const newMapping = createElement('camunda:In', {
109930
109867
  source: '' // source is the default type
109931
109868
  }, null, bpmnFactory);
@@ -109937,7 +109874,7 @@
109937
109874
 
109938
109875
  function getInMappings(element) {
109939
109876
  const businessObject = getBusinessObject$2(element);
109940
- const signalEventDefinition = getSignalEventDefinition(businessObject);
109877
+ const signalEventDefinition = getSignalEventDefinition$1(businessObject);
109941
109878
  const mappings = getExtensionElementsList$1(signalEventDefinition || businessObject, 'camunda:In');
109942
109879
 
109943
109880
  // only retrieve relevant mappings here, others are handled in other groups
@@ -109948,7 +109885,7 @@
109948
109885
  });
109949
109886
  }
109950
109887
  function areInMappingsSupported(element) {
109951
- const signalEventDefinition = getSignalEventDefinition(element);
109888
+ const signalEventDefinition = getSignalEventDefinition$1(element);
109952
109889
  if (signalEventDefinition) {
109953
109890
  return isAny$1(element, ['bpmn:IntermediateThrowEvent', 'bpmn:EndEvent']);
109954
109891
  }
@@ -114542,7 +114479,11 @@
114542
114479
  ElementTemplatesLoader.$inject = ['config.elementTemplates', 'eventBus', 'elementTemplates', 'moddle'];
114543
114480
 
114544
114481
  function unlinkTemplate$1(element, injector) {
114545
- const modeling = injector.get('modeling');
114482
+ const modeling = injector.get('modeling'),
114483
+ eventBus = injector.get('eventBus');
114484
+ eventBus.fire('elementTemplates.unlink', {
114485
+ element
114486
+ });
114546
114487
  modeling.updateProperties(element, {
114547
114488
  'camunda:modelerTemplate': null,
114548
114489
  'camunda:modelerTemplateVersion': null
@@ -114550,7 +114491,11 @@
114550
114491
  }
114551
114492
  function removeTemplate(element, injector) {
114552
114493
  const replace = injector.get('replace'),
114553
- selection = injector.get('selection');
114494
+ selection = injector.get('selection'),
114495
+ eventBus = injector.get('eventBus');
114496
+ eventBus.fire('elementTemplates.remove', {
114497
+ element
114498
+ });
114554
114499
  const businessObject = getBusinessObject$2(element);
114555
114500
  const type = businessObject.$type,
114556
114501
  eventDefinitionType = getEventDefinitionType(businessObject);
@@ -114563,7 +114508,12 @@
114563
114508
  selection.select(newElement);
114564
114509
  }
114565
114510
  function updateTemplate$1(element, newTemplate, injector) {
114566
- const elementTemplates = injector.get('elementTemplates');
114511
+ const elementTemplates = injector.get('elementTemplates'),
114512
+ eventBus = injector.get('eventBus');
114513
+ eventBus.fire('elementTemplates.update', {
114514
+ element,
114515
+ newTemplate
114516
+ });
114567
114517
  return elementTemplates.applyTemplate(element, newTemplate);
114568
114518
  }
114569
114519
  function getVersionOrDateFromTemplate(template) {
@@ -114637,7 +114587,11 @@
114637
114587
  }
114638
114588
 
114639
114589
  function unlinkTemplate(element, injector) {
114640
- const modeling = injector.get('modeling');
114590
+ const modeling = injector.get('modeling'),
114591
+ eventBus = injector.get('eventBus');
114592
+ eventBus.fire('elementTemplates.unlink', {
114593
+ element
114594
+ });
114641
114595
 
114642
114596
  // remove template attributes
114643
114597
  modeling.updateProperties(element, {
@@ -115518,7 +115472,7 @@
115518
115472
  }
115519
115473
 
115520
115474
  /**
115521
- * Remove referenced element when template is unlinked.
115475
+ * Unlink referenced element when template is unlinked.
115522
115476
  */
115523
115477
  _handlePropertiesUpdate(context) {
115524
115478
  const {
@@ -115534,11 +115488,9 @@
115534
115488
  const bo = getBusinessObject$2(element);
115535
115489
  const message = findMessage(bo);
115536
115490
  if (message && getTemplateId$1(message)) {
115537
- const messageEventDefinition = bo.eventDefinitions[0];
115538
- this._modeling.updateModdleProperties(element, messageEventDefinition, {
115539
- 'messageRef': undefined
115491
+ this._modeling.updateModdleProperties(element, message, {
115492
+ [TEMPLATE_ID_ATTR$1]: null
115540
115493
  });
115541
- this._removeRootElement(message);
115542
115494
  }
115543
115495
  }
115544
115496
 
@@ -116311,7 +116263,7 @@
116311
116263
  }
116312
116264
 
116313
116265
  // get extension elements of either signal event definition or call activity
116314
- const extensionElements = this._getOrCreateExtensionElements(getSignalEventDefinition(element) || element);
116266
+ const extensionElements = this._getOrCreateExtensionElements(getSignalEventDefinition$1(element) || element);
116315
116267
  const oldInsAndOuts = findExtensions(extensionElements, ['camunda:In', 'camunda:Out']);
116316
116268
  newProperties.forEach(newProperty => {
116317
116269
  const oldProperty = findOldProperty(oldTemplate, newProperty),
@@ -121511,9 +121463,11 @@
121511
121463
  /**
121512
121464
  * Flatten array, one level deep.
121513
121465
  *
121514
- * @param {Array<?>} arr
121466
+ * @template T
121515
121467
  *
121516
- * @return {Array<?>}
121468
+ * @param {T[][]} arr
121469
+ *
121470
+ * @return {T[]}
121517
121471
  */
121518
121472
 
121519
121473
  const nativeToString = Object.prototype.toString;
@@ -121535,6 +121489,11 @@
121535
121489
  return nativeToString.call(obj) === '[object Number]';
121536
121490
  }
121537
121491
 
121492
+ /**
121493
+ * @param {any} obj
121494
+ *
121495
+ * @return {boolean}
121496
+ */
121538
121497
  function isFunction(obj) {
121539
121498
  const tag = nativeToString.call(obj);
121540
121499
 
@@ -121559,22 +121518,74 @@
121559
121518
  return nativeHasOwnProperty.call(target, key);
121560
121519
  }
121561
121520
 
121521
+ /**
121522
+ * @template T
121523
+ * @typedef { (
121524
+ * ((e: T) => boolean) |
121525
+ * ((e: T, idx: number) => boolean) |
121526
+ * ((e: T, key: string) => boolean) |
121527
+ * string |
121528
+ * number
121529
+ * ) } Matcher
121530
+ */
121531
+
121532
+ /**
121533
+ * @template T
121534
+ * @template U
121535
+ *
121536
+ * @typedef { (
121537
+ * ((e: T) => U) | string | number
121538
+ * ) } Extractor
121539
+ */
121540
+
121541
+
121542
+ /**
121543
+ * @template T
121544
+ * @typedef { (val: T, key: any) => boolean } MatchFn
121545
+ */
121546
+
121547
+ /**
121548
+ * @template T
121549
+ * @typedef { T[] } ArrayCollection
121550
+ */
121551
+
121552
+ /**
121553
+ * @template T
121554
+ * @typedef { { [key: string]: T } } StringKeyValueCollection
121555
+ */
121556
+
121557
+ /**
121558
+ * @template T
121559
+ * @typedef { { [key: number]: T } } NumberKeyValueCollection
121560
+ */
121561
+
121562
+ /**
121563
+ * @template T
121564
+ * @typedef { StringKeyValueCollection<T> | NumberKeyValueCollection<T> } KeyValueCollection
121565
+ */
121566
+
121567
+ /**
121568
+ * @template T
121569
+ * @typedef { KeyValueCollection<T> | ArrayCollection<T> } Collection
121570
+ */
121571
+
121562
121572
  /**
121563
121573
  * Find element in collection.
121564
121574
  *
121565
- * @param {Array|Object} collection
121566
- * @param {Function|Object} matcher
121575
+ * @template T
121576
+ * @param {Collection<T>} collection
121577
+ * @param {Matcher<T>} matcher
121567
121578
  *
121568
121579
  * @return {Object}
121569
121580
  */
121570
121581
  function find(collection, matcher) {
121571
121582
 
121572
- matcher = toMatcher(matcher);
121583
+ const matchFn = toMatcher(matcher);
121573
121584
 
121574
121585
  let match;
121575
121586
 
121576
121587
  forEach(collection, function(val, key) {
121577
- if (matcher(val, key)) {
121588
+ if (matchFn(val, key)) {
121578
121589
  match = val;
121579
121590
 
121580
121591
  return false;
@@ -121590,10 +121601,11 @@
121590
121601
  * Iterate over collection; returning something
121591
121602
  * (non-undefined) will stop iteration.
121592
121603
  *
121593
- * @param {Array|Object} collection
121594
- * @param {Function} iterator
121604
+ * @template T
121605
+ * @param {Collection<T>} collection
121606
+ * @param { ((item: T, idx: number) => (boolean|void)) | ((item: T, key: string) => (boolean|void)) } iterator
121595
121607
  *
121596
- * @return {Object} return result that stopped the iteration
121608
+ * @return {T} return result that stopped the iteration
121597
121609
  */
121598
121610
  function forEach(collection, iterator) {
121599
121611
 
@@ -121636,6 +121648,12 @@
121636
121648
  }
121637
121649
 
121638
121650
 
121651
+ /**
121652
+ * @template T
121653
+ * @param {Matcher<T>} matcher
121654
+ *
121655
+ * @return {MatchFn<T>}
121656
+ */
121639
121657
  function toMatcher(matcher) {
121640
121658
  return isFunction(matcher) ? matcher : (e) => {
121641
121659
  return e === matcher;
@@ -122467,8 +122485,12 @@
122467
122485
  * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
122468
122486
  * and then replace respective icons with the optimized data URIs in `./dist`.
122469
122487
  */
122470
- 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';
122471
- 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';
122488
+ const appendIcon = `<svg width="22" height="22" viewBox="0 0 5.82 5.82" xmlns="http://www.w3.org/2000/svg">
122489
+ <path d="M1.3 3.4c.3 0 .5-.2.5-.5s-.2-.4-.5-.4c-.2 0-.4.1-.4.4 0 .3.2.5.4.5zM3 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5zM4.6 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5z"/>
122490
+ </svg>`;
122491
+ const createIcon = `<svg width="46" height="46" viewBox="-2 -2 9.82 9.82" xmlns="http://www.w3.org/2000/svg">
122492
+ <path d="M1.3 3.4c.3 0 .5-.2.5-.5s-.2-.4-.5-.4c-.2 0-.4.1-.4.4 0 .3.2.5.4.5zM3 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5zM4.6 3.4c.2 0 .4-.2.4-.5s-.2-.4-.4-.4c-.3 0-.5.1-.5.4 0 .3.2.5.5.5z"/>
122493
+ </svg>`;
122472
122494
 
122473
122495
  /**
122474
122496
  * A provider for append context pad button
@@ -122514,7 +122536,7 @@
122514
122536
  return {
122515
122537
  'append': {
122516
122538
  group: 'model',
122517
- imageUrl: appendIcon,
122539
+ html: `<div class="entry">${appendIcon}</div>`,
122518
122540
  title: translate('Append element'),
122519
122541
  action: {
122520
122542
  click: function(event, element) {
@@ -122560,10 +122582,15 @@
122560
122582
 
122561
122583
  function e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}));}
122562
122584
 
122585
+ /**
122586
+ * @typedef { import('../model/Types').Element } Element
122587
+ * @typedef { import('../model/Types').ModdleElement } ModdleElement
122588
+ */
122589
+
122563
122590
  /**
122564
122591
  * Is an element of the given BPMN type?
122565
122592
  *
122566
- * @param {djs.model.Base|ModdleElement} element
122593
+ * @param {Element|ModdleElement} element
122567
122594
  * @param {string} type
122568
122595
  *
122569
122596
  * @return {boolean}
@@ -122578,8 +122605,8 @@
122578
122605
  /**
122579
122606
  * Return true if element has any of the given types.
122580
122607
  *
122581
- * @param {djs.model.Base} element
122582
- * @param {Array<string>} types
122608
+ * @param {Element|ModdleElement} element
122609
+ * @param {string[]} types
122583
122610
  *
122584
122611
  * @return {boolean}
122585
122612
  */
@@ -122592,7 +122619,7 @@
122592
122619
  /**
122593
122620
  * Return the business object for a given element.
122594
122621
  *
122595
- * @param {djs.model.Base|ModdleElement} element
122622
+ * @param {Element|ModdleElement} element
122596
122623
  *
122597
122624
  * @return {ModdleElement}
122598
122625
  */
@@ -122603,7 +122630,7 @@
122603
122630
  /**
122604
122631
  * Return the di object for a given element.
122605
122632
  *
122606
- * @param {djs.model.Base} element
122633
+ * @param {Element} element
122607
122634
  *
122608
122635
  * @return {ModdleElement}
122609
122636
  */
@@ -122611,14 +122638,25 @@
122611
122638
  return element && element.di;
122612
122639
  }
122613
122640
 
122614
- function isLabel(element) {
122615
- return element && !!element.labelTarget;
122641
+ /**
122642
+ * Checks whether a value is an instance of Label.
122643
+ *
122644
+ * @param {any} value
122645
+ *
122646
+ * @return {boolean}
122647
+ */
122648
+ function isLabel(value) {
122649
+ return isObject(value) && has(value, 'labelTarget');
122616
122650
  }
122617
122651
 
122618
122652
  /**
122653
+ * @typedef {import('../core/Types').ElementLike} ElementLike
122619
122654
  * @typedef {import('../core/EventBus').default} EventBus
122620
- * @typedef {import(./CommandInterceptor).HandlerFunction} HandlerFunction
122621
- * @typedef {import(./CommandInterceptor).ComposeHandlerFunction} ComposeHandlerFunction
122655
+ * @typedef {import('./CommandStack').CommandContext} CommandContext
122656
+ *
122657
+ * @typedef {string|string[]} Events
122658
+ * @typedef { (context: CommandContext) => ElementLike[] | void } HandlerFunction
122659
+ * @typedef { (context: CommandContext) => void } ComposeHandlerFunction
122622
122660
  */
122623
122661
 
122624
122662
  var DEFAULT_PRIORITY = 1000;
@@ -122630,10 +122668,9 @@
122630
122668
  * @class
122631
122669
  * @constructor
122632
122670
  *
122633
- * @param {EventBus} eventBus
122634
- *
122635
122671
  * @example
122636
122672
  *
122673
+ * ```javascript
122637
122674
  * import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
122638
122675
  *
122639
122676
  * class CommandLogger extends CommandInterceptor {
@@ -122644,6 +122681,9 @@
122644
122681
  * console.log('commandStack.shape-create.preExecute', event);
122645
122682
  * });
122646
122683
  * }
122684
+ * ```
122685
+ *
122686
+ * @param {EventBus} eventBus
122647
122687
  */
122648
122688
  function CommandInterceptor(eventBus) {
122649
122689
 
@@ -122661,16 +122701,17 @@
122661
122701
  };
122662
122702
  }
122663
122703
 
122704
+
122664
122705
  /**
122665
- * Intercept a command during one of the phases.
122666
- *
122667
- * @param {string|string[]} [events] One or more commands to intercept.
122668
- * @param {string} [hook] Phase during which to intercept command.
122669
- * @param {number} [priority] Priority with which command will be intercepted.
122670
- * @param {ComposeHandlerFunction|HandlerFunction} handlerFn Callback.
122671
- * @param {boolean} [unwrap] Whether the event should be unwrapped.
122672
- * @param {*} [that] `this` value the callback will be called with.
122673
- */
122706
+ * Intercept a command during one of the phases.
122707
+ *
122708
+ * @param {Events} [events] command(s) to intercept
122709
+ * @param {string} [hook] phase to intercept
122710
+ * @param {number} [priority]
122711
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122712
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122713
+ * @param {any} [that]
122714
+ */
122674
122715
  CommandInterceptor.prototype.on = function(events, hook, priority, handlerFn, unwrap, that) {
122675
122716
 
122676
122717
  if (isFunction(hook) || isNumber(hook)) {
@@ -122712,35 +122753,130 @@
122712
122753
  });
122713
122754
  };
122714
122755
 
122756
+ /**
122757
+ * Add a <canExecute> phase of command interceptor.
122758
+ *
122759
+ * @param {Events} [events] command(s) to intercept
122760
+ * @param {number} [priority]
122761
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122762
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122763
+ * @param {any} [that]
122764
+ */
122765
+ CommandInterceptor.prototype.canExecute = createHook('canExecute');
122715
122766
 
122716
- var hooks = [
122717
- 'canExecute',
122718
- 'preExecute',
122719
- 'preExecuted',
122720
- 'execute',
122721
- 'executed',
122722
- 'postExecute',
122723
- 'postExecuted',
122724
- 'revert',
122725
- 'reverted'
122726
- ];
122767
+ /**
122768
+ * Add a <preExecute> phase of command interceptor.
122769
+ *
122770
+ * @param {Events} [events] command(s) to intercept
122771
+ * @param {number} [priority]
122772
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122773
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122774
+ * @param {any} [that]
122775
+ */
122776
+ CommandInterceptor.prototype.preExecute = createHook('preExecute');
122777
+
122778
+ /**
122779
+ * Add a <preExecuted> phase of command interceptor.
122780
+ *
122781
+ * @param {Events} [events] command(s) to intercept
122782
+ * @param {number} [priority]
122783
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122784
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122785
+ * @param {any} [that]
122786
+ */
122787
+ CommandInterceptor.prototype.preExecuted = createHook('preExecuted');
122788
+
122789
+ /**
122790
+ * Add a <execute> phase of command interceptor.
122791
+ *
122792
+ * @param {Events} [events] command(s) to intercept
122793
+ * @param {number} [priority]
122794
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122795
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122796
+ * @param {any} [that]
122797
+ */
122798
+ CommandInterceptor.prototype.execute = createHook('execute');
122799
+
122800
+ /**
122801
+ * Add a <executed> phase of command interceptor.
122802
+ *
122803
+ * @param {Events} [events] command(s) to intercept
122804
+ * @param {number} [priority]
122805
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122806
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122807
+ * @param {any} [that]
122808
+ */
122809
+ CommandInterceptor.prototype.executed = createHook('executed');
122810
+
122811
+ /**
122812
+ * Add a <postExecute> phase of command interceptor.
122813
+ *
122814
+ * @param {Events} [events] command(s) to intercept
122815
+ * @param {number} [priority]
122816
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122817
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122818
+ * @param {any} [that]
122819
+ */
122820
+ CommandInterceptor.prototype.postExecute = createHook('postExecute');
122821
+
122822
+ /**
122823
+ * Add a <postExecuted> phase of command interceptor.
122824
+ *
122825
+ * @param {Events} [events] command(s) to intercept
122826
+ * @param {number} [priority]
122827
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122828
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122829
+ * @param {any} [that]
122830
+ */
122831
+ CommandInterceptor.prototype.postExecuted = createHook('postExecuted');
122832
+
122833
+ /**
122834
+ * Add a <revert> phase of command interceptor.
122835
+ *
122836
+ * @param {Events} [events] command(s) to intercept
122837
+ * @param {number} [priority]
122838
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122839
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122840
+ * @param {any} [that]
122841
+ */
122842
+ CommandInterceptor.prototype.revert = createHook('revert');
122843
+
122844
+ /**
122845
+ * Add a <reverted> phase of command interceptor.
122846
+ *
122847
+ * @param {Events} [events] command(s) to intercept
122848
+ * @param {number} [priority]
122849
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122850
+ * @param {boolean} [unwrap] whether the event should be unwrapped
122851
+ * @param {any} [that]
122852
+ */
122853
+ CommandInterceptor.prototype.reverted = createHook('reverted');
122727
122854
 
122728
122855
  /*
122729
122856
  * Add prototype methods for each phase of command execution (e.g. execute,
122730
122857
  * revert).
122858
+ *
122859
+ * @param {string} hook
122860
+ *
122861
+ * @return { (
122862
+ * events?: Events,
122863
+ * priority?: number,
122864
+ * handlerFn: ComposeHandlerFunction|HandlerFunction,
122865
+ * unwrap?: boolean
122866
+ * ) => any }
122731
122867
  */
122732
- forEach(hooks, function(hook) {
122868
+ function createHook(hook) {
122733
122869
 
122734
122870
  /**
122735
- * Add prototype method for a specific phase of command execution.
122871
+ * @this {CommandInterceptor}
122736
122872
  *
122737
- * @param {string|string[]} [events] One or more commands to intercept.
122738
- * @param {number} [priority] Priority with which command will be intercepted.
122739
- * @param {ComposeHandlerFunction|HandlerFunction} handlerFn Callback.
122740
- * @param {boolean} [unwrap] Whether the event should be unwrapped.
122741
- * @param {*} [that] `this` value the callback will be called with.
122873
+ * @param {Events} [events]
122874
+ * @param {number} [priority]
122875
+ * @param {ComposeHandlerFunction|HandlerFunction} handlerFn
122876
+ * @param {boolean} [unwrap]
122877
+ * @param {any} [that]
122742
122878
  */
122743
- CommandInterceptor.prototype[hook] = function(events, priority, handlerFn, unwrap, that) {
122879
+ const hookFn = function(events, priority, handlerFn, unwrap, that) {
122744
122880
 
122745
122881
  if (isFunction(events) || isNumber(events)) {
122746
122882
  that = unwrap;
@@ -122752,7 +122888,9 @@
122752
122888
 
122753
122889
  this.on(events, hook, priority, handlerFn, unwrap, that);
122754
122890
  };
122755
- });
122891
+
122892
+ return hookFn;
122893
+ }
122756
122894
 
122757
122895
  /**
122758
122896
  * @typedef {import('../../core/EventBus').default} EventBus
@@ -122764,6 +122902,8 @@
122764
122902
  * Extensions should implement the init method to actually add their custom
122765
122903
  * modeling checks. Checks may be added via the #addRule(action, fn) method.
122766
122904
  *
122905
+ * @class
122906
+ *
122767
122907
  * @param {EventBus} eventBus
122768
122908
  */
122769
122909
  function RuleProvider(eventBus) {
@@ -122781,15 +122921,16 @@
122781
122921
  * Adds a modeling rule for the given action, implemented through
122782
122922
  * a callback function.
122783
122923
  *
122784
- * The function will receive the modeling specific action context
122924
+ * The callback receives a modeling specific action context
122785
122925
  * to perform its check. It must return `false` to disallow the
122786
- * action from happening or `true` to allow the action.
122787
- *
122788
- * A rule provider may pass over the evaluation to lower priority
122789
- * rules by returning return nothing (or <code>undefined</code>).
122926
+ * action from happening or `true` to allow the action. Usually returing
122927
+ * `null` denotes that a particular interaction shall be ignored.
122928
+ * By returning nothing or `undefined` you pass evaluation to lower
122929
+ * priority rules.
122790
122930
  *
122791
122931
  * @example
122792
122932
  *
122933
+ * ```javascript
122793
122934
  * ResizableRules.prototype.init = function() {
122794
122935
  *
122795
122936
  * \/**
@@ -122816,10 +122957,11 @@
122816
122957
  * }
122817
122958
  * });
122818
122959
  * };
122960
+ * ```
122819
122961
  *
122820
- * @param {string|Array<string>} actions the identifier for the modeling action to check
122962
+ * @param {string|string[]} actions the identifier for the modeling action to check
122821
122963
  * @param {number} [priority] the priority at which this rule is being applied
122822
- * @param {Function} fn the callback function that performs the actual check
122964
+ * @param {(any) => any} fn the callback function that performs the actual check
122823
122965
  */
122824
122966
  RuleProvider.prototype.addRule = function(actions, priority, fn) {
122825
122967
 
@@ -123112,7 +123254,7 @@
123112
123254
  return {
123113
123255
  'create': {
123114
123256
  group: 'create',
123115
- imageUrl: createIcon,
123257
+ html: `<div class="entry"> ${createIcon}</div>`,
123116
123258
  title: translate('Create element'),
123117
123259
  action: {
123118
123260
  click: function(event) {
@@ -123215,6 +123357,7 @@
123215
123357
 
123216
123358
  /**
123217
123359
  * @param {KeyboardEvent} event
123360
+ * @return {boolean}
123218
123361
  */
123219
123362
  function isCmd(event) {
123220
123363
 
@@ -123230,8 +123373,9 @@
123230
123373
  /**
123231
123374
  * Checks if key pressed is one of provided keys.
123232
123375
  *
123233
- * @param {string|Array<string>} keys
123376
+ * @param {string|string[]} keys
123234
123377
  * @param {KeyboardEvent} event
123378
+ * @return {boolean}
123235
123379
  */
123236
123380
  function isKey(keys, event) {
123237
123381
  keys = isArray(keys) ? keys : [ keys ];
@@ -123246,18 +123390,30 @@
123246
123390
  return event.shiftKey;
123247
123391
  }
123248
123392
 
123393
+ /**
123394
+ * @param {KeyboardEvent} event
123395
+ */
123249
123396
  function isCopy(event) {
123250
123397
  return isCmd(event) && isKey(KEYS_COPY, event);
123251
123398
  }
123252
123399
 
123400
+ /**
123401
+ * @param {KeyboardEvent} event
123402
+ */
123253
123403
  function isPaste(event) {
123254
123404
  return isCmd(event) && isKey(KEYS_PASTE, event);
123255
123405
  }
123256
123406
 
123407
+ /**
123408
+ * @param {KeyboardEvent} event
123409
+ */
123257
123410
  function isUndo(event) {
123258
123411
  return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
123259
123412
  }
123260
123413
 
123414
+ /**
123415
+ * @param {KeyboardEvent} event
123416
+ */
123261
123417
  function isRedo(event) {
123262
123418
  return isCmd(event) && (
123263
123419
  isKey(KEYS_REDO, event) || (
@@ -123533,6 +123689,17 @@
123533
123689
  ],
123534
123690
  };
123535
123691
 
123692
+ /**
123693
+ * @typedef {import('../model/Types').Element} Element
123694
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
123695
+ */
123696
+
123697
+ /**
123698
+ * @param {Element} element
123699
+ * @param {ModdleElement} [di]
123700
+ *
123701
+ * @return {boolean}
123702
+ */
123536
123703
  function isExpanded(element, di) {
123537
123704
 
123538
123705
  if (is(element, 'bpmn:CallActivity')) {
@@ -123556,14 +123723,21 @@
123556
123723
  return true;
123557
123724
  }
123558
123725
 
123726
+ /**
123727
+ * @typedef {import('../../../model/Types').Element} Element
123728
+ * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').PopupMenuTarget} PopupMenuTarget
123729
+ *
123730
+ * @typedef {(entry: PopupMenuTarget) => boolean} DifferentTypeValidator
123731
+ */
123732
+
123559
123733
  /**
123560
123734
  * Returns true, if an element is from a different type
123561
123735
  * than a target definition. Takes into account the type,
123562
123736
  * event definition type and triggeredByEvent property.
123563
123737
  *
123564
- * @param {djs.model.Base} element
123738
+ * @param {Element} element
123565
123739
  *
123566
- * @return {boolean}
123740
+ * @return {DifferentTypeValidator}
123567
123741
  */
123568
123742
  function isDifferentType(element) {
123569
123743
 
@@ -123594,6 +123768,28 @@
123594
123768
  };
123595
123769
  }
123596
123770
 
123771
+ /**
123772
+ * @typedef { () => string } LabelGetter
123773
+ *
123774
+ * @typedef { {
123775
+ * label: string | LabelGetter;
123776
+ * actionName: string;
123777
+ * className: string;
123778
+ * target?: {
123779
+ * type: string;
123780
+ * isExpanded?: boolean;
123781
+ * isInterrupting?: boolean;
123782
+ * triggeredByEvent?: boolean;
123783
+ * cancelActivity?: boolean;
123784
+ * eventDefinitionType?: string;
123785
+ * eventDefinitionAttrs?: Record<string, any>
123786
+ * };
123787
+ * } } ReplaceOption
123788
+ */
123789
+
123790
+ /**
123791
+ * @type {ReplaceOption[]}
123792
+ */
123597
123793
  var START_EVENT = [
123598
123794
  {
123599
123795
  label: 'Start Event',
@@ -123657,6 +123853,9 @@
123657
123853
  }
123658
123854
  ];
123659
123855
 
123856
+ /**
123857
+ * @type {ReplaceOption[]}
123858
+ */
123660
123859
  var START_EVENT_SUB_PROCESS = [
123661
123860
  {
123662
123861
  label: 'Start Event',
@@ -123684,6 +123883,9 @@
123684
123883
  }
123685
123884
  ];
123686
123885
 
123886
+ /**
123887
+ * @type {ReplaceOption[]}
123888
+ */
123687
123889
  var INTERMEDIATE_EVENT = [
123688
123890
  {
123689
123891
  label: 'Start Event',
@@ -123807,6 +124009,9 @@
123807
124009
  }
123808
124010
  ];
123809
124011
 
124012
+ /**
124013
+ * @type {ReplaceOption[]}
124014
+ */
123810
124015
  var END_EVENT = [
123811
124016
  {
123812
124017
  label: 'Start Event',
@@ -123897,6 +124102,9 @@
123897
124102
  }
123898
124103
  ];
123899
124104
 
124105
+ /**
124106
+ * @type {ReplaceOption[]}
124107
+ */
123900
124108
  var GATEWAY = [
123901
124109
  {
123902
124110
  label: 'Exclusive Gateway',
@@ -123966,6 +124174,9 @@
123966
124174
  // }
123967
124175
  ];
123968
124176
 
124177
+ /**
124178
+ * @type {ReplaceOption[]}
124179
+ */
123969
124180
  var SUBPROCESS_EXPANDED = [
123970
124181
  {
123971
124182
  label: 'Transaction',
@@ -123997,6 +124208,9 @@
123997
124208
  }
123998
124209
  ];
123999
124210
 
124211
+ /**
124212
+ * @type {ReplaceOption[]}
124213
+ */
124000
124214
  var TRANSACTION = [
124001
124215
  {
124002
124216
  label: 'Transaction',
@@ -124028,8 +124242,14 @@
124028
124242
  }
124029
124243
  ];
124030
124244
 
124245
+ /**
124246
+ * @type {ReplaceOption[]}
124247
+ */
124031
124248
  var EVENT_SUB_PROCESS = TRANSACTION;
124032
124249
 
124250
+ /**
124251
+ * @type {ReplaceOption[]}
124252
+ */
124033
124253
  var TASK = [
124034
124254
  {
124035
124255
  label: 'Task',
@@ -124123,6 +124343,9 @@
124123
124343
  }
124124
124344
  ];
124125
124345
 
124346
+ /**
124347
+ * @type {ReplaceOption[]}
124348
+ */
124126
124349
  var DATA_OBJECT_REFERENCE = [
124127
124350
  {
124128
124351
  label: 'Data Store Reference',
@@ -124134,6 +124357,9 @@
124134
124357
  }
124135
124358
  ];
124136
124359
 
124360
+ /**
124361
+ * @type {ReplaceOption[]}
124362
+ */
124137
124363
  var DATA_STORE_REFERENCE = [
124138
124364
  {
124139
124365
  label: 'Data Object Reference',
@@ -124145,6 +124371,9 @@
124145
124371
  }
124146
124372
  ];
124147
124373
 
124374
+ /**
124375
+ * @type {ReplaceOption[]}
124376
+ */
124148
124377
  var BOUNDARY_EVENT = [
124149
124378
  {
124150
124379
  label: 'Message Boundary Event',
@@ -124270,6 +124499,9 @@
124270
124499
  }
124271
124500
  ];
124272
124501
 
124502
+ /**
124503
+ * @type {ReplaceOption[]}
124504
+ */
124273
124505
  var EVENT_SUB_PROCESS_START_EVENT = [
124274
124506
  {
124275
124507
  label: 'Message Start Event',
@@ -124386,6 +124618,9 @@
124386
124618
  }
124387
124619
  ];
124388
124620
 
124621
+ /**
124622
+ * @type {ReplaceOption[]}
124623
+ */
124389
124624
  var SEQUENCE_FLOW = [
124390
124625
  {
124391
124626
  label: 'Sequence Flow',
@@ -124404,6 +124639,9 @@
124404
124639
  }
124405
124640
  ];
124406
124641
 
124642
+ /**
124643
+ * @type {ReplaceOption[]}
124644
+ */
124407
124645
  var PARTICIPANT = [
124408
124646
  {
124409
124647
  label: 'Expanded Pool',