bpmn-js 8.7.3 → 8.8.3

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v8.7.3
2
+ * bpmn-js - bpmn-modeler v8.8.3
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: 2021-08-27
11
+ * Date: 2021-12-03
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2337,13 +2337,14 @@
2337
2337
  eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
2338
2338
  var type = evt.type,
2339
2339
  element = context.element,
2340
- visuals = context.gfx;
2340
+ visuals = context.gfx,
2341
+ attrs = context.attrs;
2341
2342
 
2342
2343
  if (self.canRender(element)) {
2343
2344
  if (type === 'render.shape') {
2344
- return self.drawShape(visuals, element);
2345
+ return self.drawShape(visuals, element, attrs);
2345
2346
  } else {
2346
- return self.drawConnection(visuals, element);
2347
+ return self.drawConnection(visuals, element, attrs);
2347
2348
  }
2348
2349
  }
2349
2350
  });
@@ -2803,7 +2804,7 @@
2803
2804
  return true;
2804
2805
  };
2805
2806
 
2806
- DefaultRenderer.prototype.drawShape = function drawShape(visuals, element) {
2807
+ DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
2807
2808
  var rect = create$1('rect');
2808
2809
 
2809
2810
  attr(rect, {
@@ -2814,9 +2815,9 @@
2814
2815
  });
2815
2816
 
2816
2817
  if (isFrameElement$1(element)) {
2817
- attr(rect, this.FRAME_STYLE);
2818
+ attr(rect, assign({}, this.FRAME_STYLE, attrs || {}));
2818
2819
  } else {
2819
- attr(rect, this.SHAPE_STYLE);
2820
+ attr(rect, assign({}, this.SHAPE_STYLE, attrs || {}));
2820
2821
  }
2821
2822
 
2822
2823
  append(visuals, rect);
@@ -2824,9 +2825,9 @@
2824
2825
  return rect;
2825
2826
  };
2826
2827
 
2827
- DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection) {
2828
+ DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
2828
2829
 
2829
- var line = createLine(connection.waypoints, this.CONNECTION_STYLE);
2830
+ var line = createLine(connection.waypoints, assign({}, this.CONNECTION_STYLE, attrs || {}));
2830
2831
  append(visuals, line);
2831
2832
 
2832
2833
  return line;
@@ -4310,6 +4311,14 @@
4310
4311
  return isNumber(number) ? number + 'px' : number;
4311
4312
  }
4312
4313
 
4314
+ function findRoot(element) {
4315
+ while (element.parent) {
4316
+ element = element.parent;
4317
+ }
4318
+
4319
+ return element;
4320
+ }
4321
+
4313
4322
  /**
4314
4323
  * Creates a HTML container element for a SVG element with
4315
4324
  * the given configuration
@@ -4355,6 +4364,11 @@
4355
4364
  }
4356
4365
 
4357
4366
  var BASE_LAYER = 'base';
4367
+ var HIDDEN_MARKER = 'djs-element-hidden';
4368
+
4369
+ // render plane contents behind utility layers
4370
+ var PLANE_LAYER_INDEX = 0;
4371
+ var UTILITY_LAYER_INDEX = 1;
4358
4372
 
4359
4373
 
4360
4374
  var REQUIRED_MODEL_ATTRS = {
@@ -4391,23 +4405,23 @@
4391
4405
  'elementRegistry'
4392
4406
  ];
4393
4407
 
4408
+ /**
4409
+ * Creates a <svg> element that is wrapped into a <div>.
4410
+ * This way we are always able to correctly figure out the size of the svg element
4411
+ * by querying the parent node.
4412
+
4413
+ * (It is not possible to get the size of a svg element cross browser @ 2014-04-01)
4394
4414
 
4415
+ * <div class="djs-container" style="width: {desired-width}, height: {desired-height}">
4416
+ * <svg width="100%" height="100%">
4417
+ * ...
4418
+ * </svg>
4419
+ * </div>
4420
+ */
4395
4421
  Canvas.prototype._init = function(config) {
4396
4422
 
4397
4423
  var eventBus = this._eventBus;
4398
4424
 
4399
- // Creates a <svg> element that is wrapped into a <div>.
4400
- // This way we are always able to correctly figure out the size of the svg element
4401
- // by querying the parent node.
4402
- //
4403
- // (It is not possible to get the size of a svg element cross browser @ 2014-04-01)
4404
- //
4405
- // <div class="djs-container" style="width: {desired-width}, height: {desired-height}">
4406
- // <svg width="100%" height="100%">
4407
- // ...
4408
- // </svg>
4409
- // </div>
4410
-
4411
4425
  // html container
4412
4426
  var container = this._container = createContainer(config);
4413
4427
 
@@ -4419,6 +4433,7 @@
4419
4433
  var viewport = this._viewport = createGroup(svg, 'viewport');
4420
4434
 
4421
4435
  this._layers = {};
4436
+ this._planes = {};
4422
4437
 
4423
4438
  // debounce canvas.viewbox.changed events
4424
4439
  // for smoother diagram interaction
@@ -4453,7 +4468,8 @@
4453
4468
  'connection.added',
4454
4469
  'shape.removed',
4455
4470
  'connection.removed',
4456
- 'elements.changed'
4471
+ 'elements.changed',
4472
+ 'plane.set'
4457
4473
  ], function() {
4458
4474
  delete this._cachedViewbox;
4459
4475
  }, this);
@@ -4477,7 +4493,8 @@
4477
4493
  delete this._svg;
4478
4494
  delete this._container;
4479
4495
  delete this._layers;
4480
- delete this._rootElement;
4496
+ delete this._planes;
4497
+ delete this._activePlane;
4481
4498
  delete this._viewport;
4482
4499
  };
4483
4500
 
@@ -4492,12 +4509,16 @@
4492
4509
  var type = getType(element);
4493
4510
 
4494
4511
  if (type === 'root') {
4495
- self.setRootElement(null, true);
4512
+ self.setRootElementForPlane(null, self.findPlane(element), true);
4496
4513
  } else {
4497
4514
  self._removeElement(element, type);
4498
4515
  }
4499
4516
  });
4500
4517
 
4518
+ // remove all planes
4519
+ this._activePlane = null;
4520
+ this._planes = {};
4521
+
4501
4522
  // force recomputation of view box
4502
4523
  delete this._cachedViewbox;
4503
4524
  };
@@ -4509,7 +4530,7 @@
4509
4530
  * @returns {SVGElement}
4510
4531
  */
4511
4532
  Canvas.prototype.getDefaultLayer = function() {
4512
- return this.getLayer(BASE_LAYER, 0);
4533
+ return this.getLayer(BASE_LAYER, PLANE_LAYER_INDEX);
4513
4534
  };
4514
4535
 
4515
4536
  /**
@@ -4558,8 +4579,8 @@
4558
4579
  */
4559
4580
  Canvas.prototype._createLayer = function(name, index) {
4560
4581
 
4561
- if (!index) {
4562
- index = 0;
4582
+ if (typeof index === 'undefined') {
4583
+ index = UTILITY_LAYER_INDEX;
4563
4584
  }
4564
4585
 
4565
4586
  var childIndex = reduce(this._layers, function(childIndex, layer) {
@@ -4577,6 +4598,140 @@
4577
4598
 
4578
4599
  };
4579
4600
 
4601
+ /**
4602
+ * Returns a plane that is used to draw elements on it.
4603
+ *
4604
+ * @param {string} name
4605
+ *
4606
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4607
+ */
4608
+ Canvas.prototype.getPlane = function(name) {
4609
+ if (!name) {
4610
+ throw new Error('must specify a name');
4611
+ }
4612
+
4613
+ return this._planes[name];
4614
+ };
4615
+
4616
+ /**
4617
+ * Creates a plane that is used to draw elements on it. If no
4618
+ * root element is provided, an implicit root will be used.
4619
+ *
4620
+ * @param {string} name
4621
+ * @param {Object|djs.model.Root} [rootElement] optional root element
4622
+ *
4623
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4624
+ */
4625
+ Canvas.prototype.createPlane = function(name, rootElement) {
4626
+ if (!name) {
4627
+ throw new Error('must specify a name');
4628
+ }
4629
+
4630
+ if (this._planes[name]) {
4631
+ throw new Error('plane ' + name + ' already exists');
4632
+ }
4633
+
4634
+ if (!rootElement) {
4635
+ rootElement = {
4636
+ id: '__implicitroot' + name,
4637
+ children: [],
4638
+ isImplicit: true
4639
+ };
4640
+ }
4641
+
4642
+ var svgLayer = this.getLayer(name, PLANE_LAYER_INDEX);
4643
+ classes(svgLayer).add(HIDDEN_MARKER);
4644
+
4645
+ var plane = this._planes[name] = {
4646
+ layer: svgLayer,
4647
+ name: name,
4648
+ rootElement: null
4649
+ };
4650
+
4651
+ this.setRootElementForPlane(rootElement, plane);
4652
+
4653
+ return plane;
4654
+ };
4655
+
4656
+ /**
4657
+ * Sets the active plane and hides the previously active plane.
4658
+ *
4659
+ * @param {string|Object} plane
4660
+ *
4661
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4662
+ */
4663
+ Canvas.prototype.setActivePlane = function(plane) {
4664
+ if (!plane) {
4665
+ throw new Error('must specify a plane');
4666
+ }
4667
+
4668
+ if (typeof plane === 'string') {
4669
+ plane = this.getPlane(plane);
4670
+ }
4671
+
4672
+ // hide previous Plane
4673
+ if (this._activePlane) {
4674
+ classes(this._activePlane.layer).add(HIDDEN_MARKER);
4675
+ }
4676
+
4677
+ this._activePlane = plane;
4678
+
4679
+ // show current Plane
4680
+ classes(plane.layer).remove(HIDDEN_MARKER);
4681
+
4682
+ if (plane.rootElement) {
4683
+ this._elementRegistry.updateGraphics(plane.rootElement, this._svg, true);
4684
+ }
4685
+
4686
+ this._eventBus.fire('plane.set', { plane: plane });
4687
+
4688
+ return plane;
4689
+ };
4690
+
4691
+ /**
4692
+ * Returns the currently active layer
4693
+ *
4694
+ * @returns {SVGElement}
4695
+ */
4696
+
4697
+ Canvas.prototype.getActiveLayer = function() {
4698
+ return this.getActivePlane().layer;
4699
+ };
4700
+
4701
+ /**
4702
+ * Returns the currently active plane.
4703
+ *
4704
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4705
+ */
4706
+ Canvas.prototype.getActivePlane = function() {
4707
+ var plane = this._activePlane;
4708
+ if (!plane) {
4709
+ plane = this.createPlane(BASE_LAYER);
4710
+ this.setActivePlane(BASE_LAYER);
4711
+ }
4712
+
4713
+ return plane;
4714
+ };
4715
+
4716
+ /**
4717
+ * Returns the plane which contains the given element.
4718
+ *
4719
+ * @param {string|djs.model.Base} element
4720
+ *
4721
+ * @return {Object} plane descriptor with { layer, rootElement, name }
4722
+ */
4723
+ Canvas.prototype.findPlane = function(element) {
4724
+ if (typeof element === 'string') {
4725
+ element = this._elementRegistry.get(element);
4726
+ }
4727
+
4728
+ var root = findRoot(element);
4729
+
4730
+ return find(this._planes, function(plane) {
4731
+ return plane.rootElement === root;
4732
+ });
4733
+ };
4734
+
4580
4735
  /**
4581
4736
  * Returns the html element that encloses the
4582
4737
  * drawing canvas.
@@ -4698,11 +4853,9 @@
4698
4853
  };
4699
4854
 
4700
4855
  Canvas.prototype.getRootElement = function() {
4701
- if (!this._rootElement) {
4702
- this.setRootElement({ id: '__implicitroot', children: [] });
4703
- }
4856
+ var plane = this.getActivePlane();
4704
4857
 
4705
- return this._rootElement;
4858
+ return plane.rootElement;
4706
4859
  };
4707
4860
 
4708
4861
 
@@ -4719,12 +4872,41 @@
4719
4872
  * @return {Object|djs.model.Root} new root element
4720
4873
  */
4721
4874
  Canvas.prototype.setRootElement = function(element, override) {
4875
+ var activePlane = this._activePlane;
4876
+
4877
+ if (activePlane) {
4878
+ return this.setRootElementForPlane(element, activePlane, override);
4879
+ } else {
4880
+ var basePlane = this.createPlane(BASE_LAYER, element);
4881
+
4882
+ this.setActivePlane(basePlane);
4883
+
4884
+ return basePlane.rootElement;
4885
+ }
4886
+ };
4887
+
4888
+
4889
+ /**
4890
+ * Sets a given element as the new root element for the canvas
4891
+ * and returns the new root element.
4892
+ *
4893
+ * @param {Object|djs.model.Root} element
4894
+ * @param {Object|djs.model.Root} plane
4895
+ * @param {boolean} [override] whether to override the current root element, if any
4896
+ *
4897
+ * @return {Object|djs.model.Root} new root element
4898
+ */
4899
+ Canvas.prototype.setRootElementForPlane = function(element, plane, override) {
4900
+
4901
+ if (typeof plane === 'string') {
4902
+ plane = this.getPlane(plane);
4903
+ }
4722
4904
 
4723
4905
  if (element) {
4724
4906
  this._ensureValid('root', element);
4725
4907
  }
4726
4908
 
4727
- var currentRoot = this._rootElement,
4909
+ var currentRoot = plane.rootElement,
4728
4910
  elementRegistry = this._elementRegistry,
4729
4911
  eventBus = this._eventBus;
4730
4912
 
@@ -4741,23 +4923,26 @@
4741
4923
  }
4742
4924
 
4743
4925
  if (element) {
4744
- var gfx = this.getDefaultLayer();
4926
+ var gfx = plane.layer;
4745
4927
 
4746
4928
  // resemble element add event sequence
4747
4929
  eventBus.fire('root.add', { element: element });
4748
4930
 
4749
- elementRegistry.add(element, gfx, this._svg);
4931
+ elementRegistry.add(element, gfx);
4750
4932
 
4751
4933
  eventBus.fire('root.added', { element: element, gfx: gfx });
4934
+
4935
+ // associate SVG with root element when active
4936
+ if (plane === this._activePlane) {
4937
+ this._elementRegistry.updateGraphics(element, this._svg, true);
4938
+ }
4752
4939
  }
4753
4940
 
4754
- this._rootElement = element;
4941
+ plane.rootElement = element;
4755
4942
 
4756
4943
  return element;
4757
4944
  };
4758
4945
 
4759
-
4760
-
4761
4946
  // add functionality //////////////////////
4762
4947
 
4763
4948
  Canvas.prototype._ensureValid = function(type, element) {
@@ -5063,9 +5248,10 @@
5063
5248
  if (!box) {
5064
5249
 
5065
5250
  // compute the inner box based on the
5066
- // diagrams default layer. This allows us to exclude
5251
+ // diagrams active plane. This allows us to exclude
5067
5252
  // external components, such as overlays
5068
- innerBox = this.getDefaultLayer().getBBox();
5253
+
5254
+ innerBox = (this._activePlane && this._activePlane.layer.getBBox()) || {};
5069
5255
 
5070
5256
  transform = transform$1(viewport);
5071
5257
  matrix = transform ? transform.matrix : createMatrix();
@@ -5081,10 +5267,10 @@
5081
5267
  height: outerBox.height / scale,
5082
5268
  scale: scale,
5083
5269
  inner: {
5084
- width: innerBox.width,
5085
- height: innerBox.height,
5086
- x: innerBox.x,
5087
- y: innerBox.y
5270
+ width: innerBox.width || 0,
5271
+ height: innerBox.height || 0,
5272
+ x: innerBox.x || 0,
5273
+ y: innerBox.y || 0
5088
5274
  },
5089
5275
  outer: outerBox
5090
5276
  };
@@ -5143,6 +5329,13 @@
5143
5329
  */
5144
5330
  Canvas.prototype.scrollToElement = function(element, padding) {
5145
5331
  var defaultPadding = 100;
5332
+
5333
+ // switch to correct Plane
5334
+ var targetPlane = this.findPlane(element);
5335
+ if (targetPlane !== this._activePlane) {
5336
+ this.setActivePlane(targetPlane);
5337
+ }
5338
+
5146
5339
  if (!padding) {
5147
5340
  padding = {};
5148
5341
  }
@@ -5163,7 +5356,7 @@
5163
5356
  zoom = this.zoom(),
5164
5357
  dx, dy;
5165
5358
 
5166
- // Shrink viewboxBounds with padding
5359
+ // shrink viewboxBounds with padding
5167
5360
  viewboxBounds.y += padding.top / zoom;
5168
5361
  viewboxBounds.x += padding.left / zoom;
5169
5362
  viewboxBounds.width -= (padding.right + padding.left) / zoom;
@@ -5485,6 +5678,29 @@
5485
5678
  this.add(element, gfx, secondaryGfx);
5486
5679
  };
5487
5680
 
5681
+ /**
5682
+ * Update the graphics of an element
5683
+ *
5684
+ * @param {djs.model.Base} element
5685
+ * @param {SVGElement} gfx
5686
+ * @param {boolean} [secondary=false] whether to update the secondary connected element
5687
+ */
5688
+ ElementRegistry.prototype.updateGraphics = function(filter, gfx, secondary) {
5689
+ var id = filter.id || filter;
5690
+
5691
+ var container = this._elements[id];
5692
+
5693
+ if (secondary) {
5694
+ container.secondaryGfx = gfx;
5695
+ } else {
5696
+ container.gfx = gfx;
5697
+ }
5698
+
5699
+ attr(gfx, ELEMENT_ID, id);
5700
+
5701
+ return gfx;
5702
+ };
5703
+
5488
5704
  /**
5489
5705
  * Return the model element for a given id or graphics.
5490
5706
  *
@@ -6592,12 +6808,11 @@
6592
6808
  if (returnValue === false) {
6593
6809
  event.preventDefault();
6594
6810
  }
6595
- } catch (e) {
6596
- if (!this.handleError(e)) {
6597
- console.error('unhandled error in event listener');
6598
- console.error(e.stack);
6811
+ } catch (error) {
6812
+ if (!this.handleError(error)) {
6813
+ console.error('unhandled error in event listener', error);
6599
6814
 
6600
- throw e;
6815
+ throw error;
6601
6816
  }
6602
6817
  }
6603
6818
 
@@ -19294,8 +19509,8 @@
19294
19509
 
19295
19510
  // helpers //////////////////////
19296
19511
 
19297
- // copied from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
19298
- var tokenRegex = /\{([^}]+)\}/g,
19512
+ // copied and adjusted from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
19513
+ var tokenRegex = /\{([^{}]+)\}/g,
19299
19514
  objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g; // matches .xxxxx or ["xxxxx"] to run over object properties
19300
19515
 
19301
19516
  function replacer(all, key, obj) {
@@ -20519,9 +20734,10 @@
20519
20734
  *
20520
20735
  * @param {EventBus} eventBus the event bus
20521
20736
  */
20522
- function Selection(eventBus) {
20737
+ function Selection(eventBus, canvas) {
20523
20738
 
20524
20739
  this._eventBus = eventBus;
20740
+ this._canvas = canvas;
20525
20741
 
20526
20742
  this._selectedElements = [];
20527
20743
 
@@ -20532,12 +20748,12 @@
20532
20748
  self.deselect(element);
20533
20749
  });
20534
20750
 
20535
- eventBus.on([ 'diagram.clear' ], function(e) {
20751
+ eventBus.on([ 'diagram.clear', 'plane.set' ], function(e) {
20536
20752
  self.select(null);
20537
20753
  });
20538
20754
  }
20539
20755
 
20540
- Selection.$inject = [ 'eventBus' ];
20756
+ Selection.$inject = [ 'eventBus', 'canvas' ];
20541
20757
 
20542
20758
 
20543
20759
  Selection.prototype.deselect = function(element) {
@@ -20583,6 +20799,14 @@
20583
20799
  elements = elements ? [ elements ] : [];
20584
20800
  }
20585
20801
 
20802
+ var canvas = this._canvas;
20803
+
20804
+ elements = elements.filter(function(element) {
20805
+ var plane = canvas.findPlane(element);
20806
+
20807
+ return plane === canvas.getActivePlane();
20808
+ });
20809
+
20586
20810
  // selection may be cleared by passing an empty array or null
20587
20811
  // to the method
20588
20812
  if (add) {
@@ -21251,6 +21475,13 @@
21251
21475
  classes$1(htmlContainer).add('djs-overlay-' + overlay.type);
21252
21476
  }
21253
21477
 
21478
+ var plane = this._canvas.findPlane(element);
21479
+ var activePlane = this._canvas.getActivePlane();
21480
+ overlay.plane = plane;
21481
+ if (plane !== activePlane) {
21482
+ setVisible$1(htmlContainer, false);
21483
+ }
21484
+
21254
21485
  overlay.htmlContainer = htmlContainer;
21255
21486
 
21256
21487
  overlayContainer.overlays.push(overlay);
@@ -21265,22 +21496,26 @@
21265
21496
 
21266
21497
  Overlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {
21267
21498
  var show = overlay.show,
21499
+ plane = overlay.plane,
21268
21500
  minZoom = show && show.minZoom,
21269
21501
  maxZoom = show && show.maxZoom,
21270
21502
  htmlContainer = overlay.htmlContainer,
21503
+ activePlane = this._canvas.getActivePlane(),
21271
21504
  visible = true;
21272
21505
 
21273
- if (show) {
21506
+ if (plane !== activePlane) {
21507
+ visible = false;
21508
+ } else if (show) {
21274
21509
  if (
21275
21510
  (isDefined(minZoom) && minZoom > viewbox.scale) ||
21276
21511
  (isDefined(maxZoom) && maxZoom < viewbox.scale)
21277
21512
  ) {
21278
21513
  visible = false;
21279
21514
  }
21280
-
21281
- setVisible$1(htmlContainer, visible);
21282
21515
  }
21283
21516
 
21517
+ setVisible$1(htmlContainer, visible);
21518
+
21284
21519
  this._updateOverlayScale(overlay, viewbox);
21285
21520
  };
21286
21521
 
@@ -21404,6 +21639,12 @@
21404
21639
  });
21405
21640
 
21406
21641
 
21642
+ eventBus.on('plane.set', function(e) {
21643
+ forEach(self._overlays, function(el) {
21644
+ setVisible$1(el.htmlContainer, el.plane === e.plane);
21645
+ });
21646
+ });
21647
+
21407
21648
  // clear overlays with diagram
21408
21649
 
21409
21650
  eventBus.on('diagram.clear', this.clear, this);
@@ -21553,8 +21794,9 @@
21553
21794
  var KEYDOWN_EVENT = 'keyboard.keydown',
21554
21795
  KEYUP_EVENT = 'keyboard.keyup';
21555
21796
 
21556
- var DEFAULT_PRIORITY$4 = 1000;
21797
+ var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
21557
21798
 
21799
+ var DEFAULT_PRIORITY$4 = 1000;
21558
21800
 
21559
21801
  /**
21560
21802
  * A keyboard abstraction that may be activated and
@@ -21625,10 +21867,9 @@
21625
21867
  };
21626
21868
 
21627
21869
  Keyboard.prototype._keyHandler = function(event, type) {
21628
- var target = event.target,
21629
- eventBusResult;
21870
+ var eventBusResult;
21630
21871
 
21631
- if (isInput(target)) {
21872
+ if (this._isEventIgnored(event)) {
21632
21873
  return;
21633
21874
  }
21634
21875
 
@@ -21643,6 +21884,29 @@
21643
21884
  }
21644
21885
  };
21645
21886
 
21887
+ Keyboard.prototype._isEventIgnored = function(event) {
21888
+ return isInput(event.target) && this._isModifiedKeyIgnored(event);
21889
+ };
21890
+
21891
+ Keyboard.prototype._isModifiedKeyIgnored = function(event) {
21892
+ if (!isCmd(event)) {
21893
+ return true;
21894
+ }
21895
+
21896
+ var allowedModifiers = this._getAllowedModifiers(event.target);
21897
+ return !allowedModifiers.includes(event.key);
21898
+ };
21899
+
21900
+ Keyboard.prototype._getAllowedModifiers = function(element) {
21901
+ var modifierContainer = closest(element, '[' + HANDLE_MODIFIER_ATTRIBUTE + ']', true);
21902
+
21903
+ if (!modifierContainer || (this._node && !this._node.contains(modifierContainer))) {
21904
+ return [];
21905
+ }
21906
+
21907
+ return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
21908
+ };
21909
+
21646
21910
  Keyboard.prototype.bind = function(node) {
21647
21911
 
21648
21912
  // make sure that the keyboard is only bound once to the DOM
@@ -25639,7 +25903,7 @@
25639
25903
  /**
25640
25904
  * Executes the alignment of a selection of elements
25641
25905
  *
25642
- * @param {Array} elements [description]
25906
+ * @param {Array} elements
25643
25907
  * @param {string} type left|right|center|top|bottom|middle
25644
25908
  */
25645
25909
  AlignElements$1.prototype.trigger = function(elements, type) {
@@ -30130,7 +30394,7 @@
30130
30394
 
30131
30395
  classes(gfx).add(MARKER_CONNECTION_PREVIEW);
30132
30396
 
30133
- append(this._canvas.getDefaultLayer(), gfx);
30397
+ append(this._canvas.getActiveLayer(), gfx);
30134
30398
 
30135
30399
  return gfx;
30136
30400
  };
@@ -31847,13 +32111,13 @@
31847
32111
  dragGroup = context.dragGroup = createDragGroup(elements);
31848
32112
  }
31849
32113
 
31850
- var defaultLayer;
32114
+ var activeLayer;
31851
32115
 
31852
32116
  if (hover) {
31853
32117
  if (!dragGroup.parentNode) {
31854
- defaultLayer = canvas.getDefaultLayer();
32118
+ activeLayer = canvas.getActiveLayer();
31855
32119
 
31856
- append(defaultLayer, dragGroup);
32120
+ append(activeLayer, dragGroup);
31857
32121
  }
31858
32122
 
31859
32123
  translate$2(dragGroup, event.x, event.y);
@@ -33529,11 +33793,16 @@
33529
33793
 
33530
33794
  var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName);
33531
33795
 
33532
- // do NOT copy Ids and references
33533
- if (propertyDescriptor.isId || propertyDescriptor.isReference) {
33796
+ // do NOT copy references
33797
+ if (propertyDescriptor.isReference) {
33534
33798
  return;
33535
33799
  }
33536
33800
 
33801
+ // copy id
33802
+ if (propertyDescriptor.isId) {
33803
+ return this._copyId(property, parent);
33804
+ }
33805
+
33537
33806
  // copy arrays
33538
33807
  if (isArray$2(property)) {
33539
33808
  return reduce(property, function(childProperties, childProperty) {
@@ -33572,6 +33841,18 @@
33572
33841
  return property;
33573
33842
  };
33574
33843
 
33844
+ ModdleCopy.prototype._copyId = function(id, element) {
33845
+
33846
+ // disallow if already taken
33847
+ if (this._moddle.ids.assigned(id)) {
33848
+ return;
33849
+ } else {
33850
+
33851
+ this._moddle.ids.claim(id, element);
33852
+ return id;
33853
+ }
33854
+ };
33855
+
33575
33856
  // helpers //////////
33576
33857
 
33577
33858
  function getPropertyNames(descriptor, keepDefaultProperties) {
@@ -36321,8 +36602,8 @@
36321
36602
  /**
36322
36603
  * Distributes the elements with a given orientation
36323
36604
  *
36324
- * @param {Array} elements [description]
36325
- * @param {string} orientation [description]
36605
+ * @param {Array} elements
36606
+ * @param {string} orientation
36326
36607
  */
36327
36608
  DistributeElements$1.prototype.trigger = function(elements, orientation) {
36328
36609
  var modeling = this._modeling;
@@ -36456,11 +36737,11 @@
36456
36737
  /**
36457
36738
  * Returns the min and max values for an element
36458
36739
  *
36459
- * @param {[type]} element [description]
36460
- * @param {[type]} axis [description]
36461
- * @param {[type]} dimension [description]
36740
+ * @param {Bounds} element
36741
+ * @param {string} axis
36742
+ * @param {string} dimension
36462
36743
  *
36463
- * @return {[type]} [description]
36744
+ * @return {{ min: number, max: number }}
36464
36745
  */
36465
36746
  DistributeElements$1.prototype._findRange = function(element) {
36466
36747
  var axis = element[this._axis],
@@ -38562,7 +38843,7 @@
38562
38843
  frame = context.frame;
38563
38844
 
38564
38845
  if (!frame) {
38565
- frame = context.frame = previewSupport.addFrame(shape, canvas.getDefaultLayer());
38846
+ frame = context.frame = previewSupport.addFrame(shape, canvas.getActiveLayer());
38566
38847
 
38567
38848
  canvas.addMarker(shape, MARKER_RESIZING$1);
38568
38849
  }
@@ -41020,12 +41301,12 @@
41020
41301
  dockingPoint = intersection.bendpoint ? waypoints[intersection.index] : mid;
41021
41302
 
41022
41303
  // if last waypointBefore is inside shape's bounds, ignore docking point
41023
- if (!isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {
41304
+ if (waypointsBefore.length === 1 || !isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {
41024
41305
  waypointsBefore.push(copy(dockingPoint));
41025
41306
  }
41026
41307
 
41027
41308
  // if first waypointAfter is inside shape's bounds, ignore docking point
41028
- if (!isPointInsideBBox(shape, waypointsAfter[0])) {
41309
+ if (waypointsAfter.length === 1 || !isPointInsideBBox(shape, waypointsAfter[0])) {
41029
41310
  waypointsAfter.unshift(copy(dockingPoint));
41030
41311
  }
41031
41312
  }
@@ -43173,6 +43454,49 @@
43173
43454
  'selection'
43174
43455
  ];
43175
43456
 
43457
+ var HIGH_PRIORITY$8 = 1500;
43458
+
43459
+ var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
43460
+
43461
+ var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 };
43462
+
43463
+ var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
43464
+
43465
+ var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
43466
+
43467
+ /**
43468
+ * Set minimum bounds/resize constraints on resize.
43469
+ *
43470
+ * @param {EventBus} eventBus
43471
+ */
43472
+ function ResizeBehavior(eventBus) {
43473
+ eventBus.on('resize.start', HIGH_PRIORITY$8, function(event) {
43474
+ var context = event.context,
43475
+ shape = context.shape,
43476
+ direction = context.direction,
43477
+ balanced = context.balanced;
43478
+
43479
+ if (is$1(shape, 'bpmn:Lane') || is$1(shape, 'bpmn:Participant')) {
43480
+ context.resizeConstraints = getParticipantResizeConstraints(shape, direction, balanced);
43481
+ }
43482
+
43483
+ if (is$1(shape, 'bpmn:Participant')) {
43484
+ context.minDimensions = PARTICIPANT_MIN_DIMENSIONS;
43485
+ }
43486
+
43487
+ if (is$1(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
43488
+ context.minDimensions = SUB_PROCESS_MIN_DIMENSIONS;
43489
+ }
43490
+
43491
+ if (is$1(shape, 'bpmn:TextAnnotation')) {
43492
+ context.minDimensions = TEXT_ANNOTATION_MIN_DIMENSIONS;
43493
+ }
43494
+ });
43495
+ }
43496
+
43497
+ ResizeBehavior.$inject = [ 'eventBus' ];
43498
+
43499
+
43176
43500
  var abs$2 = Math.abs,
43177
43501
  min = Math.min,
43178
43502
  max$2 = Math.max;
@@ -43200,7 +43524,6 @@
43200
43524
  LANE_TOP_PADDING = 20,
43201
43525
  LANE_BOTTOM_PADDING = 20;
43202
43526
 
43203
-
43204
43527
  function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
43205
43528
  var lanesRoot = getLanesRoot(laneShape);
43206
43529
 
@@ -43293,49 +43616,6 @@
43293
43616
  };
43294
43617
  }
43295
43618
 
43296
- var HIGH_PRIORITY$8 = 1500;
43297
-
43298
- var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
43299
-
43300
- var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 };
43301
-
43302
- var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
43303
-
43304
- var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
43305
-
43306
-
43307
- /**
43308
- * Set minimum bounds/resize constraints on resize.
43309
- *
43310
- * @param {EventBus} eventBus
43311
- */
43312
- function ResizeBehavior(eventBus) {
43313
- eventBus.on('resize.start', HIGH_PRIORITY$8, function(event) {
43314
- var context = event.context,
43315
- shape = context.shape,
43316
- direction = context.direction,
43317
- balanced = context.balanced;
43318
-
43319
- if (is$1(shape, 'bpmn:Lane') || is$1(shape, 'bpmn:Participant')) {
43320
- context.resizeConstraints = getParticipantResizeConstraints(shape, direction, balanced);
43321
- }
43322
-
43323
- if (is$1(shape, 'bpmn:Participant')) {
43324
- context.minDimensions = PARTICIPANT_MIN_DIMENSIONS;
43325
- }
43326
-
43327
- if (is$1(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
43328
- context.minDimensions = SUB_PROCESS_MIN_DIMENSIONS;
43329
- }
43330
-
43331
- if (is$1(shape, 'bpmn:TextAnnotation')) {
43332
- context.minDimensions = TEXT_ANNOTATION_MIN_DIMENSIONS;
43333
- }
43334
- });
43335
- }
43336
-
43337
- ResizeBehavior.$inject = [ 'eventBus' ];
43338
-
43339
43619
  var SLIGHTLY_HIGHER_PRIORITY = 1001;
43340
43620
 
43341
43621
 
@@ -47512,7 +47792,7 @@
47512
47792
  var dragGroup = create$1('g');
47513
47793
  attr(dragGroup, styles.cls('djs-drag-group', [ 'no-events' ]));
47514
47794
 
47515
- append(canvas.getDefaultLayer(), dragGroup);
47795
+ append(canvas.getActiveLayer(), dragGroup);
47516
47796
 
47517
47797
  // shapes
47518
47798
  addPreviewGfx(movingShapes, dragGroup);
@@ -47574,7 +47854,7 @@
47574
47854
  var frameGroup = create$1('g');
47575
47855
  attr(frameGroup, styles.cls('djs-frame-group', [ 'no-events' ]));
47576
47856
 
47577
- append(canvas.getDefaultLayer(), frameGroup);
47857
+ append(canvas.getActiveLayer(), frameGroup);
47578
47858
 
47579
47859
  var frames = [];
47580
47860
 
@@ -53951,9 +54231,9 @@
53951
54231
 
53952
54232
  attr(dragGroup, styles.cls('djs-drag-group', [ 'no-events' ]));
53953
54233
 
53954
- var defaultLayer = canvas.getDefaultLayer();
54234
+ var activeLayer = canvas.getActiveLayer();
53955
54235
 
53956
- append(defaultLayer, dragGroup);
54236
+ append(activeLayer, dragGroup);
53957
54237
 
53958
54238
  context.dragGroup = dragGroup;
53959
54239
  }
@@ -54576,7 +54856,7 @@
54576
54856
  var visuals = {
54577
54857
 
54578
54858
  create: function(context) {
54579
- var container = canvas.getDefaultLayer(),
54859
+ var container = canvas.getActiveLayer(),
54580
54860
  frame;
54581
54861
 
54582
54862
  frame = context.frame = create$1('rect');