bpmn-js 18.30.1 → 18.31.1

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-navigated-viewer v18.30.1
2
+ * bpmn-js - bpmn-navigated-viewer v18.31.1
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: 2026-09-24
11
+ * Date: 2026-10-21
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -967,7 +967,7 @@
967
967
  bounds = label.bounds;
968
968
 
969
969
  size = {
970
- width: Math.max(DEFAULT_LABEL_SIZE$1.width, bounds.width),
970
+ width: bounds.width,
971
971
  height: bounds.height
972
972
  };
973
973
 
@@ -6697,7 +6697,18 @@
6697
6697
 
6698
6698
  text = getLabel(element);
6699
6699
 
6700
- if (text) {
6700
+ if (text && di.label && di.label.bounds && bounds.width > 0) {
6701
+
6702
+ // keep the persisted width, it may have been set by the user
6703
+ var dimensions = this._textRenderer.getDimensions(text, {
6704
+ box: bounds,
6705
+ style: this._textRenderer.getExternalStyle()
6706
+ });
6707
+
6708
+ bounds = assign$1({}, bounds, {
6709
+ height: Math.ceil(dimensions.height)
6710
+ });
6711
+ } else if (text) {
6701
6712
 
6702
6713
  // get corrected bounds from actual layouted text
6703
6714
  bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
@@ -13911,7 +13922,7 @@
13911
13922
  function prependTo(newNode, parentNode, siblingNode) {
13912
13923
  var node = siblingNode || parentNode.firstChild;
13913
13924
 
13914
- // do not prepend node to itself to prevent IE from crashing
13925
+ // do not prepend node to itself
13915
13926
  // https://github.com/bpmn-io/bpmn-js/issues/746
13916
13927
  if (newNode === node) {
13917
13928
  return;
@@ -24482,6 +24493,13 @@
24482
24493
  /**
24483
24494
  * Checks if key pressed is one of provided keys.
24484
24495
  *
24496
+ * Keys are matched against the logical key (`KeyboardEvent#key`) first,
24497
+ * respecting Latin keyboard layouts such as QWERTZ or AZERTY.
24498
+ *
24499
+ * If a non-Latin layout (e.g. Cyrillic, Arabic) is active, letter keys
24500
+ * are matched by their physical location (`KeyboardEvent#code`), assuming
24501
+ * a US (QWERTY) layout. This applies to shortcuts with and without modifiers.
24502
+ *
24485
24503
  * @param {string|string[]} keys
24486
24504
  * @param {KeyboardEvent} event
24487
24505
  * @return {boolean}
@@ -24489,7 +24507,51 @@
24489
24507
  function isKey(keys, event) {
24490
24508
  keys = isArray$1(keys) ? keys : [ keys ];
24491
24509
 
24492
- return keys.indexOf(event.key) !== -1 || keys.indexOf(event.code) !== -1;
24510
+ return (
24511
+ keys.indexOf(event.key) !== -1 ||
24512
+ keys.indexOf(event.code) !== -1 ||
24513
+ keys.indexOf(getPhysicalLetter(event)) !== -1
24514
+ );
24515
+ }
24516
+
24517
+ // letters of a specific, non-Latin script; excludes letters shared with Latin
24518
+ // orthographies, e.g. U+02BC (ʼ) or U+02BB (ʻ)
24519
+ var NON_LATIN_LETTER = /^(?!\p{Script_Extensions=Latin}|\p{Script=Common})\p{Letter}$/u;
24520
+
24521
+ var NON_LETTER = /^\P{Letter}$/u;
24522
+
24523
+ /**
24524
+ * Returns the (US layout) letter of the physical key pressed,
24525
+ * if the logical key is a non-Latin letter.
24526
+ *
24527
+ * With <Shift>, some non-Latin layouts (e.g. Arabic) produce symbols on letter
24528
+ * keys. As a symbol does not reveal the layout, we additionally require the
24529
+ * legacy `KeyboardEvent#keyCode` to agree: the operating system maps it to the
24530
+ * US letter on non-Latin layouts only, but not on Latin ones (e.g. Dvorak).
24531
+ *
24532
+ * @param {KeyboardEvent} event
24533
+ *
24534
+ * @return {string|null}
24535
+ */
24536
+ function getPhysicalLetter(event) {
24537
+ var key = event.key,
24538
+ match = /^Key([A-Z])$/.exec(event.code || '');
24539
+
24540
+ if (!match || typeof key !== 'string') {
24541
+ return null;
24542
+ }
24543
+
24544
+ var letter = match[1];
24545
+
24546
+ if (NON_LATIN_LETTER.test(key)) {
24547
+ return event.shiftKey ? letter : letter.toLowerCase();
24548
+ }
24549
+
24550
+ if (event.shiftKey && NON_LETTER.test(key) && event.keyCode === letter.charCodeAt(0)) {
24551
+ return letter;
24552
+ }
24553
+
24554
+ return null;
24493
24555
  }
24494
24556
 
24495
24557
  /**
@@ -24887,7 +24949,7 @@
24887
24949
 
24888
24950
  // quirk: it has to be triggered by `=` as well to work on international keyboard layout
24889
24951
  // cf: https://github.com/bpmn-io/bpmn-js/issues/1362#issuecomment-722989754
24890
- if (isKey([ '+', 'Add', '=' ], event) && isCmd(event)) {
24952
+ if (isKey([ '+', '=' ], event) && isCmd(event)) {
24891
24953
  editorActions.trigger('stepZoom', { value: 1 });
24892
24954
 
24893
24955
  return true;
@@ -24900,7 +24962,7 @@
24900
24962
 
24901
24963
  var event = context.keyEvent;
24902
24964
 
24903
- if (isKey([ '-', 'Subtract' ], event) && isCmd(event)) {
24965
+ if (isKey('-', event) && isCmd(event)) {
24904
24966
  editorActions.trigger('stepZoom', { value: -1 });
24905
24967
 
24906
24968
  return true;
@@ -24926,7 +24988,7 @@
24926
24988
 
24927
24989
  var event = context.keyEvent;
24928
24990
 
24929
- if (isKey([ 'Backspace', 'Delete', 'Del' ], event)) {
24991
+ if (isKey([ 'Backspace', 'Delete' ], event)) {
24930
24992
  editorActions.trigger('removeSelection');
24931
24993
 
24932
24994
  return true;
@@ -24986,10 +25048,10 @@
24986
25048
  }
24987
25049
 
24988
25050
  if (keyboard.isKey([
24989
- 'ArrowLeft', 'Left',
24990
- 'ArrowUp', 'Up',
24991
- 'ArrowDown', 'Down',
24992
- 'ArrowRight', 'Right'
25051
+ 'ArrowLeft',
25052
+ 'ArrowUp',
25053
+ 'ArrowDown',
25054
+ 'ArrowRight'
24993
25055
  ], event)) {
24994
25056
 
24995
25057
  var speed = (
@@ -25002,19 +25064,15 @@
25002
25064
 
25003
25065
  switch (event.key) {
25004
25066
  case 'ArrowLeft':
25005
- case 'Left':
25006
25067
  direction = 'left';
25007
25068
  break;
25008
25069
  case 'ArrowUp':
25009
- case 'Up':
25010
25070
  direction = 'up';
25011
25071
  break;
25012
25072
  case 'ArrowRight':
25013
- case 'Right':
25014
25073
  direction = 'right';
25015
25074
  break;
25016
25075
  case 'ArrowDown':
25017
- case 'Down':
25018
25076
  direction = 'down';
25019
25077
  break;
25020
25078
  }
@@ -25183,6 +25241,12 @@
25183
25241
  }
25184
25242
  });
25185
25243
 
25244
+ eventBus.on('diagram.destroy', function() {
25245
+ if (context) {
25246
+ handleEnd();
25247
+ }
25248
+ });
25249
+
25186
25250
 
25187
25251
  function handleMove(event) {
25188
25252