bpmn-js 17.9.1 → 17.10.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 (38) hide show
  1. package/dist/bpmn-modeler.development.js +460 -161
  2. package/dist/bpmn-modeler.production.min.js +35 -35
  3. package/dist/bpmn-navigated-viewer.development.js +43 -21
  4. package/dist/bpmn-navigated-viewer.production.min.js +2 -2
  5. package/dist/bpmn-viewer.development.js +43 -21
  6. package/dist/bpmn-viewer.production.min.js +2 -2
  7. package/lib/draw/BpmnRenderer.d.ts +8 -6
  8. package/lib/draw/BpmnRenderer.js +19 -17
  9. package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +1 -1
  10. package/lib/features/align-elements/AlignElementsContextPadProvider.js +1 -1
  11. package/lib/features/append-preview/AppendPreview.d.ts +2 -2
  12. package/lib/features/append-preview/AppendPreview.js +2 -2
  13. package/lib/features/auto-place/BpmnAutoPlace.d.ts +3 -1
  14. package/lib/features/auto-place/BpmnAutoPlace.js +5 -3
  15. package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +9 -4
  16. package/lib/features/auto-place/BpmnAutoPlaceUtil.js +14 -13
  17. package/lib/features/context-pad/ContextPadProvider.d.ts +3 -14
  18. package/lib/features/context-pad/ContextPadProvider.js +3 -1
  19. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +3 -1
  20. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js +6 -3
  21. package/lib/features/label-editing/LabelEditingPreview.js +2 -1
  22. package/lib/features/modeling/BpmnLayouter.d.ts +13 -9
  23. package/lib/features/modeling/BpmnLayouter.js +10 -3
  24. package/lib/features/modeling/ElementFactory.js +9 -2
  25. package/lib/features/modeling/Modeling.d.ts +1 -1
  26. package/lib/features/modeling/Modeling.js +1 -1
  27. package/lib/features/modeling/behavior/ResizeBehavior.js +25 -19
  28. package/lib/features/modeling/behavior/SetCompensationActivityAfterPasteBehavior.d.ts +16 -0
  29. package/lib/features/modeling/behavior/SetCompensationActivityAfterPasteBehavior.js +67 -0
  30. package/lib/features/modeling/behavior/index.js +5 -2
  31. package/lib/features/modeling/util/ModelingUtil.d.ts +3 -1
  32. package/lib/features/modeling/util/ModelingUtil.js +38 -4
  33. package/lib/features/outline/OutlineProvider.d.ts +5 -0
  34. package/lib/features/outline/OutlineProvider.js +10 -0
  35. package/lib/features/outline/OutlineUtil.d.ts +5 -0
  36. package/lib/features/outline/OutlineUtil.js +4 -0
  37. package/lib/features/replace/BpmnReplace.js +13 -4
  38. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v17.9.1
2
+ * bpmn-js - bpmn-modeler v17.10.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: 2024-07-04
11
+ * Date: 2024-09-09
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -94,9 +94,9 @@
94
94
  *
95
95
  * @param {Seed} seed
96
96
  */
97
- function Ids(seed) {
98
- if (!(this instanceof Ids)) {
99
- return new Ids(seed);
97
+ function Ids$1(seed) {
98
+ if (!(this instanceof Ids$1)) {
99
+ return new Ids$1(seed);
100
100
  }
101
101
  seed = seed || [128, 36, 1];
102
102
  this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
@@ -109,7 +109,7 @@
109
109
  *
110
110
  * @return {String} id
111
111
  */
112
- Ids.prototype.next = function (element) {
112
+ Ids$1.prototype.next = function (element) {
113
113
  return this._seed(element || true);
114
114
  };
115
115
 
@@ -120,7 +120,7 @@
120
120
  *
121
121
  * @return {String} id
122
122
  */
123
- Ids.prototype.nextPrefixed = function (prefix, element) {
123
+ Ids$1.prototype.nextPrefixed = function (prefix, element) {
124
124
  var id;
125
125
  do {
126
126
  id = prefix + this.next(true);
@@ -139,7 +139,7 @@
139
139
  * @param {String} id
140
140
  * @param {String} [element] element the id is claimed by
141
141
  */
142
- Ids.prototype.claim = function (id, element) {
142
+ Ids$1.prototype.claim = function (id, element) {
143
143
  this._seed.set(id, element || true);
144
144
  };
145
145
 
@@ -149,7 +149,7 @@
149
149
  * @param {String} id
150
150
  * @return {Boolean}
151
151
  */
152
- Ids.prototype.assigned = function (id) {
152
+ Ids$1.prototype.assigned = function (id) {
153
153
  return this._seed.get(id) || false;
154
154
  };
155
155
 
@@ -158,14 +158,14 @@
158
158
  *
159
159
  * @param {String} id the id to unclaim
160
160
  */
161
- Ids.prototype.unclaim = function (id) {
161
+ Ids$1.prototype.unclaim = function (id) {
162
162
  delete this._seed.hats[id];
163
163
  };
164
164
 
165
165
  /**
166
166
  * Clear all claimed ids.
167
167
  */
168
- Ids.prototype.clear = function () {
168
+ Ids$1.prototype.clear = function () {
169
169
  var hats = this._seed.hats,
170
170
  id;
171
171
  for (id in hats) {
@@ -5432,6 +5432,8 @@
5432
5432
  element = this._elementRegistry.get(element);
5433
5433
  }
5434
5434
 
5435
+ element.markers = element.markers || new Set();
5436
+
5435
5437
  // we need to access all
5436
5438
  container = this._elementRegistry._elements[element.id];
5437
5439
 
@@ -5444,8 +5446,10 @@
5444
5446
 
5445
5447
  // invoke either addClass or removeClass based on mode
5446
5448
  if (add) {
5449
+ element.markers.add(marker);
5447
5450
  classes(gfx).add(marker);
5448
5451
  } else {
5452
+ element.markers.delete(marker);
5449
5453
  classes(gfx).remove(marker);
5450
5454
  }
5451
5455
  }
@@ -5513,9 +5517,11 @@
5513
5517
  element = this._elementRegistry.get(element);
5514
5518
  }
5515
5519
 
5516
- const gfx = this.getGraphics(element);
5520
+ if (!element.markers) {
5521
+ return false;
5522
+ }
5517
5523
 
5518
- return classes(gfx).has(marker);
5524
+ return element.markers.has(marker);
5519
5525
  };
5520
5526
 
5521
5527
  /**
@@ -17873,7 +17879,7 @@
17873
17879
 
17874
17880
  // attach ids to moddle to be able to track and validated ids in the BPMN 2.0
17875
17881
  // XML document tree
17876
- moddle.ids = new Ids([ 32, 36, 1 ]);
17882
+ moddle.ids = new Ids$1([ 32, 36, 1 ]);
17877
17883
 
17878
17884
  return moddle;
17879
17885
  };
@@ -18491,7 +18497,7 @@
18491
18497
  return has$1(overrides, 'height') ? overrides.height : bounds.height;
18492
18498
  }
18493
18499
 
18494
- var markerIds = new Ids();
18500
+ var markerIds = new Ids$1();
18495
18501
 
18496
18502
  var ELEMENT_LABEL_DISTANCE$1 = 10,
18497
18503
  INNER_OUTER_DIST = 3,
@@ -18519,6 +18525,8 @@
18519
18525
 
18520
18526
  /**
18521
18527
  * @typedef { import('../model/Types').Element } Element
18528
+ * @typedef { import('../model/Types').Shape } Shape
18529
+ * @typedef { import('../model/Types').Connection } Connection
18522
18530
  */
18523
18531
 
18524
18532
  /**
@@ -20692,57 +20700,57 @@
20692
20700
  * Draw shape into parentGfx.
20693
20701
  *
20694
20702
  * @param {SVGElement} parentGfx
20695
- * @param {Element} element
20703
+ * @param {Shape} shape
20696
20704
  * @param {Attrs} [attrs]
20697
20705
  *
20698
20706
  * @return {SVGElement} mainGfx
20699
20707
  */
20700
- BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
20701
- var { type } = element;
20708
+ BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
20709
+ var { type } = shape;
20702
20710
 
20703
20711
  var handler = this._renderer(type);
20704
20712
 
20705
- return handler(parentGfx, element, attrs);
20713
+ return handler(parentGfx, shape, attrs);
20706
20714
  };
20707
20715
 
20708
20716
  /**
20709
20717
  * Draw connection into parentGfx.
20710
20718
  *
20711
20719
  * @param {SVGElement} parentGfx
20712
- * @param {Element} element
20720
+ * @param {Connection} connection
20713
20721
  * @param {Attrs} [attrs]
20714
20722
  *
20715
20723
  * @return {SVGElement} mainGfx
20716
20724
  */
20717
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
20718
- var { type } = element;
20725
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
20726
+ var { type } = connection;
20719
20727
 
20720
20728
  var handler = this._renderer(type);
20721
20729
 
20722
- return handler(parentGfx, element, attrs);
20730
+ return handler(parentGfx, connection, attrs);
20723
20731
  };
20724
20732
 
20725
20733
  /**
20726
20734
  * Get shape path.
20727
20735
  *
20728
- * @param {Element} element
20736
+ * @param {Shape} shape
20729
20737
  *
20730
20738
  * @return {string} path
20731
20739
  */
20732
- BpmnRenderer.prototype.getShapePath = function(element) {
20733
- if (is$1(element, 'bpmn:Event')) {
20734
- return getCirclePath(element);
20740
+ BpmnRenderer.prototype.getShapePath = function(shape) {
20741
+ if (is$1(shape, 'bpmn:Event')) {
20742
+ return getCirclePath(shape);
20735
20743
  }
20736
20744
 
20737
- if (is$1(element, 'bpmn:Activity')) {
20738
- return getRoundRectPath(element, TASK_BORDER_RADIUS);
20745
+ if (is$1(shape, 'bpmn:Activity')) {
20746
+ return getRoundRectPath(shape, TASK_BORDER_RADIUS);
20739
20747
  }
20740
20748
 
20741
- if (is$1(element, 'bpmn:Gateway')) {
20742
- return getDiamondPath(element);
20749
+ if (is$1(shape, 'bpmn:Gateway')) {
20750
+ return getDiamondPath(shape);
20743
20751
  }
20744
20752
 
20745
- return getRectPath(element);
20753
+ return getRectPath(shape);
20746
20754
  };
20747
20755
 
20748
20756
  /**
@@ -24359,6 +24367,10 @@
24359
24367
  const DATA_OBJECT_REFERENCE_OUTLINE_PATH = 'M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z';
24360
24368
  const DATA_STORE_REFERENCE_OUTLINE_PATH = 'M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z';
24361
24369
 
24370
+ /**
24371
+ * @typedef { import('diagram-js/lib/util/Types').Dimensions} Dimensions
24372
+ */
24373
+
24362
24374
  /**
24363
24375
  * @type {Dimensions}
24364
24376
  */
@@ -24385,6 +24397,16 @@
24385
24397
  });
24386
24398
  }
24387
24399
 
24400
+ /**
24401
+ * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').default } BaseOutlineProvider
24402
+ *
24403
+ * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').Outline } Outline
24404
+ *
24405
+ * @typedef { import('diagram-js/lib/draw/Styles').default } Styles
24406
+ *
24407
+ * @typedef { import('diagram-js/lib/model/Types').Element } Element
24408
+ */
24409
+
24388
24410
  const DEFAULT_OFFSET = 5;
24389
24411
 
24390
24412
  /**
@@ -26946,6 +26968,133 @@
26946
26968
  alignElements: [ 'type', AlignElements$1 ]
26947
26969
  };
26948
26970
 
26971
+ const Ids = new IdGenerator();
26972
+
26973
+
26974
+ /**
26975
+ * @typedef { {
26976
+ * promise: Promise<unknown>,
26977
+ * executionId: number
26978
+ * } } ScheduledTask
26979
+ */
26980
+
26981
+ /**
26982
+ * A utility that allows you to schedule async tasks.
26983
+ *
26984
+ * @class
26985
+ * @constructor
26986
+ *
26987
+ * @param { import('../core/EventBus').default } eventBus
26988
+ */
26989
+ function Scheduler(eventBus) {
26990
+
26991
+ /**
26992
+ * @type { Record<string, ScheduledTask> }
26993
+ */
26994
+ this._scheduled = {};
26995
+
26996
+ eventBus.on('diagram.destroy', () => {
26997
+ Object.keys(this._scheduled).forEach(id => {
26998
+ this.cancel(id);
26999
+ });
27000
+ });
27001
+ }
27002
+
27003
+ Scheduler.$inject = [ 'eventBus' ];
27004
+
27005
+ /**
27006
+ * Schedule execution of a task in the next tick.
27007
+ *
27008
+ * Call with an id to ensure only the latest call will be executed.
27009
+ *
27010
+ * @template T
27011
+
27012
+ * @param {(...args: any[]) => T} taskFn function to be executed
27013
+ * @param {string} [id] identifying the task to ensure uniqueness
27014
+ *
27015
+ * @return Promise<T> result of the executed task
27016
+ */
27017
+ Scheduler.prototype.schedule = function(taskFn, id = Ids.next()) {
27018
+
27019
+ this.cancel(id);
27020
+
27021
+ const newScheduled = this._schedule(taskFn, id);
27022
+
27023
+ this._scheduled[id] = newScheduled;
27024
+
27025
+ return newScheduled.promise;
27026
+ };
27027
+
27028
+ Scheduler.prototype._schedule = function(taskFn, id) {
27029
+
27030
+ const {
27031
+ promise,
27032
+ resolve,
27033
+ reject
27034
+ } = defer();
27035
+
27036
+ const executionId = requestAnimationFrame(() => {
27037
+ try {
27038
+ resolve(taskFn());
27039
+ } catch (error) {
27040
+ reject(error);
27041
+ }
27042
+ });
27043
+
27044
+ return {
27045
+ executionId,
27046
+ promise
27047
+ };
27048
+ };
27049
+
27050
+ /**
27051
+ * Cancel a previously scheduled task.
27052
+ *
27053
+ * @param {string} id
27054
+ */
27055
+ Scheduler.prototype.cancel = function(id) {
27056
+
27057
+ const scheduled = this._scheduled[id];
27058
+
27059
+ if (scheduled) {
27060
+ this._cancel(scheduled);
27061
+
27062
+ this._scheduled[id] = null;
27063
+ }
27064
+ };
27065
+
27066
+ Scheduler.prototype._cancel = function(scheduled) {
27067
+ cancelAnimationFrame(scheduled.executionId);
27068
+ };
27069
+
27070
+ /**
27071
+ * @return { {
27072
+ * promise: Promise,
27073
+ * resolve: Function,
27074
+ * reject: Function
27075
+ * } }
27076
+ */
27077
+ function defer() {
27078
+
27079
+ let resolve;
27080
+ let reject;
27081
+
27082
+ const promise = new Promise((_resolve, _reject) => {
27083
+ resolve = _resolve;
27084
+ reject = _reject;
27085
+ });
27086
+
27087
+ return {
27088
+ promise,
27089
+ resolve,
27090
+ reject
27091
+ };
27092
+ }
27093
+
27094
+ var SchedulerModule = {
27095
+ scheduler: [ 'type', Scheduler ]
27096
+ };
27097
+
26949
27098
  var MARKER_HIDDEN$1 = 'djs-element-hidden';
26950
27099
 
26951
27100
  /**
@@ -26957,6 +27106,7 @@
26957
27106
  * @typedef {import('../../core/Canvas').default} Canvas
26958
27107
  * @typedef {import('../../core/ElementRegistry').default} ElementRegistry
26959
27108
  * @typedef {import('../../core/EventBus').default} EventBus
27109
+ * @typedef {import('../../scheduler/Scheduler').default} Scheduler
26960
27110
  *
26961
27111
  * @typedef {import('./ContextPadProvider').default} ContextPadProvider
26962
27112
  * @typedef {import('./ContextPadProvider').ContextPadEntries} ContextPadEntries
@@ -26982,12 +27132,14 @@
26982
27132
  * @param {Canvas} canvas
26983
27133
  * @param {ElementRegistry} elementRegistry
26984
27134
  * @param {EventBus} eventBus
27135
+ * @param {Scheduler} scheduler
26985
27136
  */
26986
- function ContextPad(canvas, elementRegistry, eventBus) {
27137
+ function ContextPad(canvas, elementRegistry, eventBus, scheduler) {
26987
27138
 
26988
27139
  this._canvas = canvas;
26989
27140
  this._elementRegistry = elementRegistry;
26990
27141
  this._eventBus = eventBus;
27142
+ this._scheduler = scheduler;
26991
27143
 
26992
27144
  this._current = null;
26993
27145
 
@@ -26997,7 +27149,8 @@
26997
27149
  ContextPad.$inject = [
26998
27150
  'canvas',
26999
27151
  'elementRegistry',
27000
- 'eventBus'
27152
+ 'eventBus',
27153
+ 'scheduler'
27001
27154
  ];
27002
27155
 
27003
27156
 
@@ -27032,12 +27185,12 @@
27032
27185
  return;
27033
27186
  }
27034
27187
 
27035
- var { target } = current;
27188
+ var target = current.target;
27036
27189
 
27037
27190
  var targets = isArray$3(target) ? target : [ target ];
27038
27191
 
27039
27192
  var targetsChanged = targets.filter(function(element) {
27040
- return includes$7(elements, element);
27193
+ return elements.includes(element);
27041
27194
  });
27042
27195
 
27043
27196
  if (targetsChanged.length) {
@@ -27058,11 +27211,25 @@
27058
27211
  }
27059
27212
  });
27060
27213
 
27061
- this._eventBus.on('canvas.viewbox.changed', () => {
27062
- this._updatePosition();
27214
+ this._eventBus.on('canvas.viewbox.changed', function() {
27215
+ self._updatePosition();
27063
27216
  });
27064
27217
 
27065
27218
  this._eventBus.on('element.marker.update', function(event) {
27219
+ if (!self.isOpen()) {
27220
+ return;
27221
+ }
27222
+
27223
+ var element = event.element;
27224
+
27225
+ var current = self._current;
27226
+
27227
+ var targets = isArray$3(current.target) ? current.target : [ current.target ];
27228
+
27229
+ if (!targets.includes(element)) {
27230
+ return;
27231
+ }
27232
+
27066
27233
  self._updateVisibility();
27067
27234
  });
27068
27235
 
@@ -27070,7 +27237,7 @@
27070
27237
  };
27071
27238
 
27072
27239
  ContextPad.prototype._createContainer = function() {
27073
- const container = domify$1('<div class="djs-context-pad-parent"></div>');
27240
+ var container = domify$1('<div class="djs-context-pad-parent"></div>');
27074
27241
 
27075
27242
  this._canvas.getContainer().appendChild(container);
27076
27243
 
@@ -27154,6 +27321,7 @@
27154
27321
  * @param {boolean} [autoActivate=false]
27155
27322
  */
27156
27323
  ContextPad.prototype.trigger = function(action, event, autoActivate) {
27324
+ var self = this;
27157
27325
 
27158
27326
  var entry,
27159
27327
  originalEvent,
@@ -27167,8 +27335,8 @@
27167
27335
  originalEvent = event.originalEvent || event;
27168
27336
 
27169
27337
  if (action === 'mouseover') {
27170
- this._timeout = setTimeout(() => {
27171
- this._mouseout = this.triggerEntry(entry, 'hover', originalEvent, autoActivate);
27338
+ this._timeout = setTimeout(function() {
27339
+ self._mouseout = self.triggerEntry(entry, 'hover', originalEvent, autoActivate);
27172
27340
  }, HOVER_DELAY);
27173
27341
 
27174
27342
  return;
@@ -27429,7 +27597,7 @@
27429
27597
  return (
27430
27598
  target.length === currentTarget.length &&
27431
27599
  every(target, function(element) {
27432
- return includes$7(currentTarget, element);
27600
+ return currentTarget.includes(element);
27433
27601
  })
27434
27602
  );
27435
27603
  } else {
@@ -27489,12 +27657,12 @@
27489
27657
  */
27490
27658
  ContextPad.prototype._getPosition = function(target) {
27491
27659
  if (!isArray$3(target) && isConnection(target)) {
27492
- const viewbox = this._canvas.viewbox();
27660
+ var viewbox = this._canvas.viewbox();
27493
27661
 
27494
- const lastWaypoint = getLastWaypoint(target);
27662
+ var lastWaypoint = getLastWaypoint(target);
27495
27663
 
27496
- const x = lastWaypoint.x * viewbox.scale - viewbox.x * viewbox.scale,
27497
- y = lastWaypoint.y * viewbox.scale - viewbox.y * viewbox.scale;
27664
+ var x = lastWaypoint.x * viewbox.scale - viewbox.x * viewbox.scale,
27665
+ y = lastWaypoint.y * viewbox.scale - viewbox.y * viewbox.scale;
27498
27666
 
27499
27667
  return {
27500
27668
  left: x + CONTEXT_PAD_MARGIN * this._canvas.zoom(),
@@ -27518,29 +27686,34 @@
27518
27686
  * Update context pad position.
27519
27687
  */
27520
27688
  ContextPad.prototype._updatePosition = function() {
27521
- if (!this.isOpen()) {
27522
- return;
27523
- }
27524
27689
 
27525
- var html = this._current.html;
27690
+ const updateFn = () => {
27691
+ if (!this.isOpen()) {
27692
+ return;
27693
+ }
27526
27694
 
27527
- var position = this._getPosition(this._current.target);
27695
+ var html = this._current.html;
27528
27696
 
27529
- if ('x' in position && 'y' in position) {
27530
- html.style.left = position.x + 'px';
27531
- html.style.top = position.y + 'px';
27532
- } else {
27533
- [
27534
- 'top',
27535
- 'right',
27536
- 'bottom',
27537
- 'left'
27538
- ].forEach(function(key) {
27539
- if (key in position) {
27540
- html.style[ key ] = position[ key ] + 'px';
27541
- }
27542
- });
27543
- }
27697
+ var position = this._getPosition(this._current.target);
27698
+
27699
+ if ('x' in position && 'y' in position) {
27700
+ html.style.left = position.x + 'px';
27701
+ html.style.top = position.y + 'px';
27702
+ } else {
27703
+ [
27704
+ 'top',
27705
+ 'right',
27706
+ 'bottom',
27707
+ 'left'
27708
+ ].forEach(function(key) {
27709
+ if (key in position) {
27710
+ html.style[ key ] = position[ key ] + 'px';
27711
+ }
27712
+ });
27713
+ }
27714
+ };
27715
+
27716
+ this._scheduler.schedule(updateFn, 'ContextPad#_updatePosition');
27544
27717
  };
27545
27718
 
27546
27719
  /**
@@ -27548,25 +27721,30 @@
27548
27721
  * using the `djs-element-hidden` or `djs-label-hidden` markers.
27549
27722
  */
27550
27723
  ContextPad.prototype._updateVisibility = function() {
27551
- if (!this.isOpen()) {
27552
- return;
27553
- }
27554
27724
 
27555
- var self = this;
27725
+ const updateFn = () => {
27726
+ if (!this.isOpen()) {
27727
+ return;
27728
+ }
27556
27729
 
27557
- var target = this._current.target;
27730
+ var self = this;
27558
27731
 
27559
- var targets = isArray$3(target) ? target : [ target ];
27732
+ var target = this._current.target;
27560
27733
 
27561
- var isHidden = targets.some(function(target) {
27562
- return self._canvas.hasMarker(target, MARKER_HIDDEN$1);
27563
- });
27734
+ var targets = isArray$3(target) ? target : [ target ];
27564
27735
 
27565
- if (isHidden) {
27566
- self.hide();
27567
- } else {
27568
- self.show();
27569
- }
27736
+ var isHidden = targets.some(function(target) {
27737
+ return self._canvas.hasMarker(target, MARKER_HIDDEN$1);
27738
+ });
27739
+
27740
+ if (isHidden) {
27741
+ self.hide();
27742
+ } else {
27743
+ self.show();
27744
+ }
27745
+ };
27746
+
27747
+ this._scheduler.schedule(updateFn, 'ContextPad#_updateVisibility');
27570
27748
  };
27571
27749
 
27572
27750
  /**
@@ -27577,13 +27755,15 @@
27577
27755
  * @returns {Rect & RectTRBL}
27578
27756
  */
27579
27757
  ContextPad.prototype._getTargetBounds = function(target) {
27758
+ var self = this;
27759
+
27580
27760
  var elements = isArray$3(target) ? target : [ target ];
27581
27761
 
27582
- var elementsGfx = elements.map((element) => {
27583
- return this._canvas.getGraphics(element);
27762
+ var elementsGfx = elements.map(function(element) {
27763
+ return self._canvas.getGraphics(element);
27584
27764
  });
27585
27765
 
27586
- return elementsGfx.reduce((bounds, elementGfx) => {
27766
+ return elementsGfx.reduce(function(bounds, elementGfx) {
27587
27767
  const elementBounds = elementGfx.getBoundingClientRect();
27588
27768
 
27589
27769
  bounds.top = Math.min(bounds.top, elementBounds.top);
@@ -27618,16 +27798,6 @@
27618
27798
  });
27619
27799
  }
27620
27800
 
27621
- /**
27622
- * @param {any[]} array
27623
- * @param {any} item
27624
- *
27625
- * @return {boolean}
27626
- */
27627
- function includes$7(array, item) {
27628
- return array.indexOf(item) !== -1;
27629
- }
27630
-
27631
27801
  function getLastWaypoint(connection) {
27632
27802
  return connection.waypoints[connection.waypoints.length - 1];
27633
27803
  }
@@ -27654,6 +27824,7 @@
27654
27824
  var ContextPadModule$1 = {
27655
27825
  __depends__: [
27656
27826
  InteractionEventsModule$1,
27827
+ SchedulerModule,
27657
27828
  OverlaysModule
27658
27829
  ],
27659
27830
  contextPad: [ 'type', ContextPad ]
@@ -28898,7 +29069,7 @@
28898
29069
  *
28899
29070
  * @typedef {import('../../model/Types').Element} Element
28900
29071
  * @typedef {import('diagram-js/lib/features/context-pad/ContextPad').ContextPadEntries} ContextPadEntries
28901
- * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default} ContextPadProvider
29072
+ * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default<Element>} ContextPadProvider
28902
29073
  */
28903
29074
 
28904
29075
  var LOW_PRIORITY$l = 900;
@@ -29673,6 +29844,7 @@
29673
29844
  };
29674
29845
 
29675
29846
  /**
29847
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
29676
29848
  * @typedef {import('../../../model/Types').Element} Element
29677
29849
  */
29678
29850
 
@@ -29703,26 +29875,56 @@
29703
29875
  * Determines if the local modeling direction is vertical or horizontal.
29704
29876
  *
29705
29877
  * @param {Element} element
29878
+ * @param {ElementRegistry} [elementRegistry] - provide to consider parent diagram direction
29706
29879
  *
29707
29880
  * @return {boolean} false for vertical pools, lanes and their children. true otherwise
29708
29881
  */
29709
- function isDirectionHorizontal(element) {
29882
+ function isDirectionHorizontal(element, elementRegistry) {
29883
+
29884
+ var parent = getParent(element, 'bpmn:Process');
29885
+ if (parent) {
29886
+ return true;
29887
+ }
29710
29888
 
29711
29889
  var types = [ 'bpmn:Participant', 'bpmn:Lane' ];
29712
29890
 
29713
- var parent = getParent(element, types);
29891
+ parent = getParent(element, types);
29714
29892
  if (parent) {
29715
29893
  return isHorizontal$3(parent);
29716
29894
  } else if (isAny(element, types)) {
29717
29895
  return isHorizontal$3(element);
29718
29896
  }
29719
29897
 
29720
- return true;
29898
+ var process;
29899
+ for (process = getBusinessObject(element); process; process = process.$parent) {
29900
+ if (is$1(process, 'bpmn:Process')) {
29901
+ break;
29902
+ }
29903
+ }
29904
+
29905
+ if (!elementRegistry) {
29906
+ return true;
29907
+ }
29908
+
29909
+ // The direction may be specified in another diagram. We ignore that there
29910
+ // could be multiple diagrams with contradicting properties based on the
29911
+ // assumption that such BPMN files are unusual.
29912
+ var pool = elementRegistry.find(function(shape) {
29913
+ var businessObject = getBusinessObject(shape);
29914
+ return businessObject && businessObject.get('processRef') === process;
29915
+ });
29916
+
29917
+ if (!pool) {
29918
+ return true;
29919
+ }
29920
+
29921
+ return isHorizontal$3(pool);
29721
29922
  }
29722
29923
 
29723
29924
  /**
29724
29925
  * @typedef {import('../../model/Types').Shape} Shape
29725
29926
  *
29927
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
29726
29928
  * @typedef {import('diagram-js/lib/util/Types').Point} Point
29727
29929
  * @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL
29728
29930
  */
@@ -29733,21 +29935,24 @@
29733
29935
  *
29734
29936
  * @param {Shape} source
29735
29937
  * @param {Shape} element
29938
+ * @param {ElementRegistry} elementRegistry
29736
29939
  *
29737
29940
  * @return {Point}
29738
29941
  */
29739
- function getNewShapePosition(source, element) {
29942
+ function getNewShapePosition(source, element, elementRegistry) {
29943
+
29944
+ var placeHorizontally = isDirectionHorizontal(source, elementRegistry);
29740
29945
 
29741
29946
  if (is$1(element, 'bpmn:TextAnnotation')) {
29742
- return getTextAnnotationPosition(source, element);
29947
+ return getTextAnnotationPosition(source, element, placeHorizontally);
29743
29948
  }
29744
29949
 
29745
29950
  if (isAny(element, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
29746
- return getDataElementPosition(source, element);
29951
+ return getDataElementPosition(source, element, placeHorizontally);
29747
29952
  }
29748
29953
 
29749
29954
  if (is$1(element, 'bpmn:FlowNode')) {
29750
- return getFlowNodePosition(source, element);
29955
+ return getFlowNodePosition(source, element, placeHorizontally);
29751
29956
  }
29752
29957
  }
29753
29958
 
@@ -29757,16 +29962,15 @@
29757
29962
  *
29758
29963
  * @param {Shape} source
29759
29964
  * @param {Shape} element
29965
+ * @param {boolean} placeHorizontally Whether to place the new element horizontally
29760
29966
  *
29761
29967
  * @return {Point}
29762
29968
  */
29763
- function getFlowNodePosition(source, element) {
29969
+ function getFlowNodePosition(source, element, placeHorizontally) {
29764
29970
 
29765
29971
  var sourceTrbl = asTRBL(source);
29766
29972
  var sourceMid = getMid(source);
29767
29973
 
29768
- var placeHorizontally = isDirectionHorizontal(source);
29769
-
29770
29974
  var placement = placeHorizontally ? {
29771
29975
  directionHint: 'e',
29772
29976
  minDistance: 80,
@@ -29848,15 +30052,14 @@
29848
30052
  *
29849
30053
  * @param {Shape} source
29850
30054
  * @param {Shape} element
30055
+ * @param {boolean} placeHorizontally Whether to place the new element horizontally
29851
30056
  *
29852
30057
  * @return {Point}
29853
30058
  */
29854
- function getTextAnnotationPosition(source, element) {
30059
+ function getTextAnnotationPosition(source, element, placeHorizontally) {
29855
30060
 
29856
30061
  var sourceTrbl = asTRBL(source);
29857
30062
 
29858
- var placeHorizontally = isDirectionHorizontal(source);
29859
-
29860
30063
  var position = placeHorizontally ? {
29861
30064
  x: sourceTrbl.right + element.width / 2,
29862
30065
  y: sourceTrbl.top - 50 - element.height / 2
@@ -29896,15 +30099,14 @@
29896
30099
  *
29897
30100
  * @param {Shape} source
29898
30101
  * @param {Shape} element
30102
+ * @param {boolean} placeHorizontally Whether to place the new element horizontally
29899
30103
  *
29900
30104
  * @return {Point}
29901
30105
  */
29902
- function getDataElementPosition(source, element) {
30106
+ function getDataElementPosition(source, element, placeHorizontally) {
29903
30107
 
29904
30108
  var sourceTrbl = asTRBL(source);
29905
30109
 
29906
- var placeHorizontally = isDirectionHorizontal(source);
29907
-
29908
30110
  var position = placeHorizontally ? {
29909
30111
  x: sourceTrbl.right - 10 + element.width / 2,
29910
30112
  y: sourceTrbl.bottom + 40 + element.width / 2
@@ -29928,23 +30130,25 @@
29928
30130
 
29929
30131
  /**
29930
30132
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
30133
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
29931
30134
  */
29932
30135
 
29933
30136
  /**
29934
30137
  * BPMN auto-place behavior.
29935
30138
  *
29936
30139
  * @param {EventBus} eventBus
30140
+ * @param {ElementRegistry} elementRegistry
29937
30141
  */
29938
- function AutoPlace(eventBus) {
30142
+ function AutoPlace(eventBus, elementRegistry) {
29939
30143
  eventBus.on('autoPlace', function(context) {
29940
30144
  var shape = context.shape,
29941
30145
  source = context.source;
29942
30146
 
29943
- return getNewShapePosition(source, shape);
30147
+ return getNewShapePosition(source, shape, elementRegistry);
29944
30148
  });
29945
30149
  }
29946
30150
 
29947
- AutoPlace.$inject = [ 'eventBus' ];
30151
+ AutoPlace.$inject = [ 'eventBus', 'elementRegistry' ];
29948
30152
 
29949
30153
  var AutoPlaceModule = {
29950
30154
  __depends__: [ AutoPlaceModule$1 ],
@@ -34937,7 +35141,7 @@
34937
35141
  const source = context.source,
34938
35142
  target = context.target;
34939
35143
 
34940
- if (isCompensationBoundaryEvent(source) && isForCompensation$1(target)) {
35144
+ if (isCompensationBoundaryEvent$1(source) && isForCompensation$2(target)) {
34941
35145
  removeIsForCompensationProperty(target);
34942
35146
  }
34943
35147
  }
@@ -34950,7 +35154,7 @@
34950
35154
  source = context.source,
34951
35155
  target = context.target;
34952
35156
 
34953
- if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(target)) {
35157
+ if (isCompensationBoundaryEvent$1(source) && isForCompensationAllowed(target)) {
34954
35158
  addIsForCompensationProperty(target);
34955
35159
  removeExistingAssociations(source, [ connection ]);
34956
35160
  }
@@ -34966,12 +35170,12 @@
34966
35170
  const source = oldSource;
34967
35171
 
34968
35172
  // oldTarget perspective
34969
- if (isForCompensation$1(oldTarget)) {
35173
+ if (isForCompensation$2(oldTarget)) {
34970
35174
  removeIsForCompensationProperty(oldTarget);
34971
35175
  }
34972
35176
 
34973
35177
  // newTarget perspective
34974
- if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(newTarget)) {
35178
+ if (isCompensationBoundaryEvent$1(source) && isForCompensationAllowed(newTarget)) {
34975
35179
  addIsForCompensationProperty(newTarget);
34976
35180
  }
34977
35181
  }
@@ -34980,7 +35184,7 @@
34980
35184
  function handlePropertiesUpdate(context) {
34981
35185
  const { element } = context;
34982
35186
 
34983
- if (isForCompensation$1(element)) {
35187
+ if (isForCompensation$2(element)) {
34984
35188
  removeDisallowedConnections(element);
34985
35189
  removeAttachments(element);
34986
35190
  } else if (isForCompensationAllowed(element)) {
@@ -34999,12 +35203,12 @@
34999
35203
  } = context;
35000
35204
 
35001
35205
  // from compensate boundary event
35002
- if (isCompensationBoundaryEvent(context.oldShape) &&
35206
+ if (isCompensationBoundaryEvent$1(context.oldShape) &&
35003
35207
  newData.eventDefinitionType !== 'bpmn:CompensateEventDefinition' ||
35004
35208
  newData.type !== 'bpmn:BoundaryEvent'
35005
35209
  ) {
35006
35210
  const targetConnection = oldShape.outgoing.find(
35007
- ({ target }) => isForCompensation$1(target)
35211
+ ({ target }) => isForCompensation$2(target)
35008
35212
  );
35009
35213
 
35010
35214
  if (targetConnection && targetConnection.target) {
@@ -35014,7 +35218,7 @@
35014
35218
 
35015
35219
  // to compensate boundary event
35016
35220
  else if (
35017
- !isCompensationBoundaryEvent(context.oldShape) &&
35221
+ !isCompensationBoundaryEvent$1(context.oldShape) &&
35018
35222
  newData.eventDefinitionType === 'bpmn:CompensateEventDefinition' &&
35019
35223
  newData.type === 'bpmn:BoundaryEvent'
35020
35224
  ) {
@@ -35064,7 +35268,7 @@
35064
35268
  function removeExistingAssociations(boundaryEvent, ignoredAssociations) {
35065
35269
  const associations = boundaryEvent.outgoing.filter(connection => is$1(connection, 'bpmn:Association'));
35066
35270
  const associationsToRemove = associations.filter(association => {
35067
- return isForCompensation$1(association.target) && !ignoredAssociations.includes(association);
35271
+ return isForCompensation$2(association.target) && !ignoredAssociations.includes(association);
35068
35272
  });
35069
35273
 
35070
35274
  // remove existing associations
@@ -35083,7 +35287,7 @@
35083
35287
 
35084
35288
  function removeIncomingCompensationAssociations(element) {
35085
35289
  const compensationAssociations = element.incoming.filter(
35086
- connection => isCompensationBoundaryEvent(connection.source)
35290
+ connection => isCompensationBoundaryEvent$1(connection.source)
35087
35291
  );
35088
35292
 
35089
35293
  modeling.removeElements(compensationAssociations);
@@ -35108,12 +35312,12 @@
35108
35312
 
35109
35313
  // helpers //////////
35110
35314
 
35111
- function isForCompensation$1(element) {
35315
+ function isForCompensation$2(element) {
35112
35316
  const bo = getBusinessObject(element);
35113
35317
  return bo && bo.get('isForCompensation');
35114
35318
  }
35115
35319
 
35116
- function isCompensationBoundaryEvent(element) {
35320
+ function isCompensationBoundaryEvent$1(element) {
35117
35321
  return element && is$1(element, 'bpmn:BoundaryEvent') &&
35118
35322
  hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
35119
35323
  }
@@ -39456,10 +39660,25 @@
39456
39660
 
39457
39661
  var otherTrbl = asTRBL(other);
39458
39662
 
39459
- if (/n/.test(resizeDirection)) {
39460
- if (isHorizontalLane && otherTrbl.top < (laneTrbl.top - 10)) {
39663
+ // lane flags
39664
+ if (isHorizontalLane) {
39665
+ if (otherTrbl.top < (laneTrbl.top - 10)) {
39666
+ isFirst = false;
39667
+ }
39668
+ if (otherTrbl.bottom > (laneTrbl.bottom + 10)) {
39669
+ isLast = false;
39670
+ }
39671
+ }
39672
+ else {
39673
+ if (otherTrbl.left < (laneTrbl.left - 10)) {
39461
39674
  isFirst = false;
39462
39675
  }
39676
+ if (otherTrbl.right > (laneTrbl.right + 10)) {
39677
+ isLast = false;
39678
+ }
39679
+ }
39680
+
39681
+ if (/n/.test(resizeDirection)) {
39463
39682
 
39464
39683
  // max top size (based on next element)
39465
39684
  if (balanced && abs$2(laneTrbl.top - otherTrbl.bottom) < 10) {
@@ -39474,10 +39693,6 @@
39474
39693
 
39475
39694
  if (/e/.test(resizeDirection)) {
39476
39695
 
39477
- if (!isHorizontalLane && otherTrbl.right > (laneTrbl.right + 10)) {
39478
- isLast = false;
39479
- }
39480
-
39481
39696
  // max right size (based on previous element)
39482
39697
  if (balanced && abs$2(laneTrbl.right - otherTrbl.left) < 10) {
39483
39698
  addMin(maxTrbl, 'right', otherTrbl.right - minDimensions.width);
@@ -39491,10 +39706,6 @@
39491
39706
 
39492
39707
  if (/s/.test(resizeDirection)) {
39493
39708
 
39494
- if (isHorizontalLane && otherTrbl.bottom > (laneTrbl.bottom + 10)) {
39495
- isLast = false;
39496
- }
39497
-
39498
39709
  // max bottom size (based on previous element)
39499
39710
  if (balanced && abs$2(laneTrbl.bottom - otherTrbl.top) < 10) {
39500
39711
  addMin(maxTrbl, 'bottom', otherTrbl.bottom - minDimensions.height);
@@ -39508,10 +39719,6 @@
39508
39719
 
39509
39720
  if (/w/.test(resizeDirection)) {
39510
39721
 
39511
- if (!isHorizontalLane && otherTrbl.left < (laneTrbl.left - 10)) {
39512
- isFirst = false;
39513
- }
39514
-
39515
39722
  // max left size (based on next element)
39516
39723
  if (balanced && abs$2(laneTrbl.left - otherTrbl.right) < 10) {
39517
39724
  addMax(maxTrbl, 'left', otherTrbl.left + minDimensions.width);
@@ -39535,23 +39742,26 @@
39535
39742
 
39536
39743
  var flowElementTrbl = asTRBL(flowElement);
39537
39744
 
39538
- if (isFirst && /n/.test(resizeDirection)) {
39745
+ // vertical lane will resize from top with respect to flow element irrespective of first or last lane
39746
+ if (/n/.test(resizeDirection) && (!isHorizontalLane || isFirst)) {
39539
39747
  addMin(minTrbl, 'top', flowElementTrbl.top - padding.top);
39540
39748
  }
39541
39749
 
39542
- if (isLast && /e/.test(resizeDirection)) {
39750
+ // horizonal lane will resize from right with respect to flow element irrespective of first or last lane
39751
+ if (/e/.test(resizeDirection) && (isHorizontalLane || isLast)) {
39543
39752
  addMax(minTrbl, 'right', flowElementTrbl.right + padding.right);
39544
39753
  }
39545
39754
 
39546
- if (isLast && /s/.test(resizeDirection)) {
39755
+ // vertical lane will resize from bottom with respect to flow element irrespective of first or last lane
39756
+ if (/s/.test(resizeDirection) && (!isHorizontalLane || isLast)) {
39547
39757
  addMax(minTrbl, 'bottom', flowElementTrbl.bottom + padding.bottom);
39548
39758
  }
39549
39759
 
39550
- if (isFirst && /w/.test(resizeDirection)) {
39760
+ // horizonal lane will resize from left with respect to flow element irrespective of first or last lane
39761
+ if (/w/.test(resizeDirection) && (isHorizontalLane || isFirst)) {
39551
39762
  addMin(minTrbl, 'left', flowElementTrbl.left - padding.left);
39552
39763
  }
39553
39764
  });
39554
-
39555
39765
  return {
39556
39766
  min: minTrbl,
39557
39767
  max: maxTrbl
@@ -41125,6 +41335,66 @@
41125
41335
  };
41126
41336
  }
41127
41337
 
41338
+ /**
41339
+ * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
41340
+ * @typedef {import('../../rules/BpmnRules').default} BpmnRules
41341
+ * @typedef {import('../Modeling').default} Modeling
41342
+ */
41343
+
41344
+
41345
+ /**
41346
+ * A behavior that sets the property of Compensation Activity after paste operation
41347
+ *
41348
+ * @param {EventBus} eventBus
41349
+ * @param {Modeling} modeling
41350
+ */
41351
+ function SetCompensationActivityAfterPasteBehavior(eventBus, modeling) {
41352
+
41353
+ CommandInterceptor.call(this, eventBus);
41354
+
41355
+ this.postExecuted('elements.create', function(event) {
41356
+ const context = event.context,
41357
+ elements = context.elements;
41358
+
41359
+ // check if compensation activity is connected to compensation boundary event
41360
+ for (const element of elements) {
41361
+ if (isForCompensation$1(element) && !isConnectedToCompensationBoundaryEvent(element)) {
41362
+ modeling.updateProperties(element, { isForCompensation: undefined });
41363
+ }
41364
+ }
41365
+ });
41366
+ }
41367
+
41368
+ e$2(SetCompensationActivityAfterPasteBehavior, CommandInterceptor);
41369
+
41370
+ SetCompensationActivityAfterPasteBehavior.$inject = [
41371
+ 'eventBus',
41372
+ 'modeling'
41373
+ ];
41374
+
41375
+
41376
+ // helpers //////////////////////
41377
+
41378
+ function isForCompensation$1(element) {
41379
+ const bo = getBusinessObject(element);
41380
+ return bo && bo.isForCompensation;
41381
+ }
41382
+
41383
+ function isCompensationBoundaryEvent(element) {
41384
+ return element && is$1(element, 'bpmn:BoundaryEvent') &&
41385
+ hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
41386
+ }
41387
+
41388
+ function isConnectedToCompensationBoundaryEvent(element) {
41389
+ const compensationAssociations = element.incoming.filter(
41390
+ connection => isCompensationBoundaryEvent(connection.source)
41391
+ );
41392
+ if (compensationAssociations.length > 0) {
41393
+ return true;
41394
+ }
41395
+ return false;
41396
+ }
41397
+
41128
41398
  /**
41129
41399
  * @type { import('didi').ModuleDeclaration }
41130
41400
  */
@@ -41169,7 +41439,8 @@
41169
41439
  'toggleElementCollapseBehaviour',
41170
41440
  'unclaimIdBehavior',
41171
41441
  'updateFlowNodeRefsBehavior',
41172
- 'unsetDefaultFlowBehavior'
41442
+ 'unsetDefaultFlowBehavior',
41443
+ 'setCompensationActivityAfterPasteBehavior'
41173
41444
  ],
41174
41445
  adaptiveLabelPositioningBehavior: [ 'type', AdaptiveLabelPositioningBehavior ],
41175
41446
  appendBehavior: [ 'type', AppendBehavior ],
@@ -41210,7 +41481,8 @@
41210
41481
  toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
41211
41482
  unclaimIdBehavior: [ 'type', UnclaimIdBehavior ],
41212
41483
  unsetDefaultFlowBehavior: [ 'type', DeleteSequenceFlowBehavior ],
41213
- updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ]
41484
+ updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ],
41485
+ setCompensationActivityAfterPasteBehavior: [ 'type', SetCompensationActivityAfterPasteBehavior ]
41214
41486
  };
41215
41487
 
41216
41488
  /**
@@ -44748,9 +45020,16 @@
44748
45020
  hints.moveChildren = false;
44749
45021
  }
44750
45022
 
44751
- // apply same width and default height
44752
- newElement.width = element.width;
44753
- newElement.height = elementFactory.getDefaultSize(newElement).height;
45023
+ // apply same directionality
45024
+ var isHorizontalPool = isHorizontal$3(element);
45025
+ if (!getDi(element).isHorizontal) {
45026
+ getDi(newElement).isHorizontal = isHorizontalPool;
45027
+ }
45028
+
45029
+ // keep the existing size of the pool's direction to
45030
+ // prevent dangling message flows
45031
+ newElement.width = isHorizontalPool ? element.width : elementFactory.getDefaultSize(newElement).width;
45032
+ newElement.height = isHorizontalPool ? elementFactory.getDefaultSize(newElement).height : element.height;
44754
45033
  }
44755
45034
 
44756
45035
  if (!rules.allowed('shape.resize', { shape: newBusinessObject })) {
@@ -48436,10 +48715,17 @@
48436
48715
  }
48437
48716
 
48438
48717
  if (is$1(bo, 'bpmn:Participant')) {
48718
+ var isHorizontalPool = di.isHorizontal === undefined || di.isHorizontal === true;
48439
48719
  if (isExpanded(bo, di)) {
48440
- return { width: 600, height: 250 };
48720
+ if (isHorizontalPool) {
48721
+ return { width: 600, height: 250 };
48722
+ }
48723
+ return { width: 250, height: 600 };
48441
48724
  } else {
48442
- return { width: 400, height: 60 };
48725
+ if (isHorizontalPool) {
48726
+ return { width: 400, height: 60 };
48727
+ }
48728
+ return { width: 60, height: 400 };
48443
48729
  }
48444
48730
  }
48445
48731
 
@@ -52764,7 +53050,7 @@
52764
53050
  /**
52765
53051
  * @param {Element} source
52766
53052
  * @param {Element} target
52767
- * @param {Partial<Connection>} attrs
53053
+ * @param {Partial<Connection>} [attrs]
52768
53054
  * @param {ModelingHints} [hints]
52769
53055
  *
52770
53056
  * @return {T}
@@ -53739,6 +54025,8 @@
53739
54025
  }
53740
54026
 
53741
54027
  /**
54028
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
54029
+ *
53742
54030
  * @typedef {import('diagram-js/lib/util/Types').Point} Point
53743
54031
  *
53744
54032
  * @typedef {import('../../model/Types').Connection} Connection
@@ -53821,7 +54109,9 @@
53821
54109
  left: 'l'
53822
54110
  };
53823
54111
 
53824
- function BpmnLayouter() {}
54112
+ function BpmnLayouter(elementRegistry) {
54113
+ this._elementRegistry = elementRegistry;
54114
+ }
53825
54115
 
53826
54116
  e$2(BpmnLayouter, BaseLayouter);
53827
54117
 
@@ -53842,7 +54132,8 @@
53842
54132
  target = hints.target || connection.target,
53843
54133
  waypoints = hints.waypoints || connection.waypoints,
53844
54134
  connectionStart = hints.connectionStart,
53845
- connectionEnd = hints.connectionEnd;
54135
+ connectionEnd = hints.connectionEnd,
54136
+ elementRegistry = this._elementRegistry;
53846
54137
 
53847
54138
  var manhattanOptions,
53848
54139
  updatedWaypoints;
@@ -53863,7 +54154,7 @@
53863
54154
  }
53864
54155
  }
53865
54156
 
53866
- var layout = isDirectionHorizontal(source) ? PREFERRED_LAYOUTS_HORIZONTAL : PREFERRED_LAYOUTS_VERTICAL;
54157
+ var layout = isDirectionHorizontal(source, elementRegistry) ? PREFERRED_LAYOUTS_HORIZONTAL : PREFERRED_LAYOUTS_VERTICAL;
53867
54158
 
53868
54159
  if (is$1(connection, 'bpmn:MessageFlow')) {
53869
54160
  manhattanOptions = getMessageFlowManhattanOptions(source, target, layout);
@@ -54194,6 +54485,8 @@
54194
54485
  }
54195
54486
  }
54196
54487
 
54488
+ BpmnLayouter.$inject = [ 'elementRegistry' ];
54489
+
54197
54490
  /**
54198
54491
  * @typedef {import('../core/ElementRegistry').default} ElementRegistry
54199
54492
  * @typedef {import('../core/GraphicsFactory').default} GraphicsFactory
@@ -54321,7 +54614,7 @@
54321
54614
  * @typedef {import('diagram-js/lib/layout/ConnectionDocking').default} ConnectionDocking
54322
54615
  * @typedef {import('../modeling/ElementFactory').default} ElementFactory
54323
54616
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
54324
- * @typedef {import('diagram-js/lib/layout/ManhattanLayout').default} ManhattanLayout
54617
+ * @typedef {import('../modeling/BpmnLayouter').default} BpmnLayouter
54325
54618
  * @typedef {import('diagram-js/lib/features/rules/Rules').default} Rules
54326
54619
  *
54327
54620
  * @typedef {import('../../model/Types').Shape} Shape
@@ -54334,7 +54627,7 @@
54334
54627
  * @param {ConnectionDocking} connectionDocking
54335
54628
  * @param {ElementFactory} elementFactory
54336
54629
  * @param {EventBus} eventBus
54337
- * @param {ManhattanLayout} layouter
54630
+ * @param {BpmnLayouter} layouter
54338
54631
  * @param {Rules} rules
54339
54632
  */
54340
54633
  function AppendPreview(complexPreview, connectionDocking, elementFactory, eventBus, layouter, rules) {
@@ -56726,6 +57019,7 @@
56726
57019
  * @typedef {import('diagram-js/lib/features/context-pad/ContextPad').default} ContextPad
56727
57020
  * @typedef {import('../modeling/Modeling').default} Modeling
56728
57021
  * @typedef {import('../modeling/ElementFactory').default} ElementFactory
57022
+ * @typedef {import('../append-preview/AppendPreview').default} AppendPreview
56729
57023
  * @typedef {import('diagram-js/lib/features/connect/Connect').default} Connect
56730
57024
  * @typedef {import('diagram-js/lib/features/create/Create').default} Create
56731
57025
  * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').default} PopupMenu
@@ -56760,6 +57054,7 @@
56760
57054
  * @param {Canvas} canvas
56761
57055
  * @param {Rules} rules
56762
57056
  * @param {Translate} translate
57057
+ * @param {AppendPreview} appendPreview
56763
57058
  */
56764
57059
  function ContextPadProvider(
56765
57060
  config, injector, eventBus,
@@ -58772,6 +59067,7 @@
58772
59067
 
58773
59068
  /**
58774
59069
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
59070
+ * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
58775
59071
  * @typedef {import('diagram-js/lib/features/grid-snapping/GridSnapping').default} GridSnapping
58776
59072
  *
58777
59073
  * @typedef {import('diagram-js/lib/util/Types').Axis} Axis
@@ -58782,14 +59078,15 @@
58782
59078
  /**
58783
59079
  * @param {EventBus} eventBus
58784
59080
  * @param {GridSnapping} gridSnapping
59081
+ * @param {ElementRegistry} elementRegistry
58785
59082
  */
58786
- function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping) {
59083
+ function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping, elementRegistry) {
58787
59084
  eventBus.on('autoPlace', HIGH_PRIORITY$5, function(context) {
58788
59085
  var source = context.source,
58789
59086
  sourceMid = getMid(source),
58790
59087
  shape = context.shape;
58791
59088
 
58792
- var position = getNewShapePosition(source, shape);
59089
+ var position = getNewShapePosition(source, shape, elementRegistry);
58793
59090
 
58794
59091
  [ 'x', 'y' ].forEach(function(axis) {
58795
59092
  var options = {};
@@ -58826,7 +59123,8 @@
58826
59123
 
58827
59124
  GridSnappingAutoPlaceBehavior.$inject = [
58828
59125
  'eventBus',
58829
- 'gridSnapping'
59126
+ 'gridSnapping',
59127
+ 'elementRegistry'
58830
59128
  ];
58831
59129
 
58832
59130
  // helpers //////////
@@ -60683,7 +60981,8 @@
60683
60981
  } else if (is$1(element, 'bpmn:Task') ||
60684
60982
  is$1(element, 'bpmn:CallActivity') ||
60685
60983
  is$1(element, 'bpmn:SubProcess') ||
60686
- is$1(element, 'bpmn:Participant')) {
60984
+ is$1(element, 'bpmn:Participant') ||
60985
+ is$1(element, 'bpmn:Lane')) {
60687
60986
  canvas.addMarker(element, MARKER_LABEL_HIDDEN);
60688
60987
  }
60689
60988
  });