bpmn-js 18.1.0 → 18.1.2

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-viewer v18.1.0
2
+ * bpmn-js - bpmn-viewer v18.1.2
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-11-20
11
+ * Date: 2024-12-20
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -10315,6 +10315,7 @@
10315
10315
  * deferUpdate?: boolean;
10316
10316
  * width?: number;
10317
10317
  * height?: number;
10318
+ * autoFocus?: boolean;
10318
10319
  * } } CanvasConfig
10319
10320
  * @typedef { {
10320
10321
  * group: SVGElement;
@@ -10501,18 +10502,20 @@
10501
10502
 
10502
10503
  attr(svg, 'tabindex', 0);
10503
10504
 
10504
- eventBus.on('element.hover', () => {
10505
+ config.autoFocus && eventBus.on('element.hover', () => {
10505
10506
  this.restoreFocus();
10506
10507
  });
10507
10508
 
10509
+ eventBus.on('element.mousedown', 500, (event) => {
10510
+ this.focus();
10511
+ });
10512
+
10508
10513
  svg.addEventListener('focusin', () => {
10509
- this._focused = true;
10510
- eventBus.fire('canvas.focus.changed', { focused: true });
10514
+ this._setFocused(true);
10511
10515
  });
10512
10516
 
10513
10517
  svg.addEventListener('focusout', () => {
10514
- this._focused = false;
10515
- eventBus.fire('canvas.focus.changed', { focused: false });
10518
+ this._setFocused(false);
10516
10519
  });
10517
10520
 
10518
10521
  append(container, svg);
@@ -10582,6 +10585,17 @@
10582
10585
  delete this._viewport;
10583
10586
  };
10584
10587
 
10588
+ Canvas.prototype._setFocused = function(focused) {
10589
+
10590
+ if (focused == this._focused) {
10591
+ return;
10592
+ }
10593
+
10594
+ this._focused = focused;
10595
+
10596
+ this._eventBus.fire('canvas.focus.changed', { focused });
10597
+ };
10598
+
10585
10599
  Canvas.prototype._clear = function() {
10586
10600
 
10587
10601
  const allElements = this._elementRegistry.getAll();
@@ -10606,10 +10620,12 @@
10606
10620
  };
10607
10621
 
10608
10622
  /**
10609
- * Sets focus on the canvas SVG element.
10610
- */
10623
+ * Sets focus on the canvas SVG element.
10624
+ */
10611
10625
  Canvas.prototype.focus = function() {
10612
10626
  this._svg.focus({ preventScroll: true });
10627
+
10628
+ this._setFocused(true);
10613
10629
  };
10614
10630
 
10615
10631
  /**