bpmn-js 18.31.0 → 18.32.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-navigated-viewer v18.31.0
2
+ * bpmn-js - bpmn-navigated-viewer v18.32.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: 2026-10-01
11
+ * Date: 2026-11-16
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
 
@@ -3493,7 +3493,7 @@
3493
3493
 
3494
3494
  if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3495
3495
  if (semantic.get('parallelMultiple')) {
3496
- return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3496
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs);
3497
3497
  }
3498
3498
  else {
3499
3499
  return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
@@ -3505,11 +3505,11 @@
3505
3505
  }
3506
3506
 
3507
3507
  if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3508
- return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3508
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs);
3509
3509
  }
3510
3510
 
3511
3511
  if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3512
- return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3512
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs);
3513
3513
  }
3514
3514
 
3515
3515
  if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
@@ -3537,7 +3537,7 @@
3537
3537
  }
3538
3538
 
3539
3539
  if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3540
- return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3540
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs);
3541
3541
  }
3542
3542
 
3543
3543
  return null;
@@ -5327,7 +5327,7 @@
5327
5327
 
5328
5328
  // strip trailing whitespace so measurement matches the browser's
5329
5329
  // native rendering used by direct editing
5330
- var measurable = emptyLine ? 'dummy' : text.replace(/\s+$/, '');
5330
+ var measurable = emptyLine ? 'dummy' : text.trimEnd();
5331
5331
  var metrics = ctx.measureText(measurable);
5332
5332
 
5333
5333
  return {
@@ -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);
@@ -9706,6 +9717,8 @@
9706
9717
  // - can't reliably auto-annotate constructor; we'll match the
9707
9718
  // first constructor(...) pattern found which may be the one
9708
9719
  // of a nested class, too.
9720
+ //
9721
+ // - can't parse default values containing "," or ")"
9709
9722
 
9710
9723
  const CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
9711
9724
  const FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
@@ -9733,7 +9746,11 @@
9733
9746
 
9734
9747
  return args && args.split(',').map(arg => {
9735
9748
  const argMatch = arg.match(FN_ARG);
9736
- return (argMatch && argMatch[1] || arg).trim();
9749
+ const [ argName, defaultValue ] = arg.replace(FN_ARG, '').split('=');
9750
+ const name = (argMatch && argMatch[1] || argName).trim();
9751
+
9752
+ // arguments with default values are optional, i.e. `a.b = 1` => `a.b?`
9753
+ return defaultValue !== undefined && !name.endsWith('?') ? name + '?' : name;
9737
9754
  }) || [];
9738
9755
  }
9739
9756
 
@@ -9755,13 +9772,13 @@
9755
9772
 
9756
9773
  const parent = _parent || /** @type InjectorContext */ ({
9757
9774
  get: function(name, strict) {
9758
- currentlyResolving.push(name);
9759
-
9760
9775
  if (strict === false) {
9761
- return null;
9762
- } else {
9763
- throw error(`No provider for "${ name }"!`);
9776
+ return undefined;
9764
9777
  }
9778
+
9779
+ currentlyResolving.push(name);
9780
+
9781
+ throw error(`No provider for "${ name }"!`);
9765
9782
  }
9766
9783
  });
9767
9784
 
@@ -9781,18 +9798,34 @@
9781
9798
  * Return a named service.
9782
9799
  *
9783
9800
  * @param {string} name
9784
- * @param {boolean} [strict=true] if false, resolve missing services to null
9801
+ * @param {boolean} [strict=true] if false, resolve missing services to undefined
9785
9802
  *
9786
9803
  * @return {any}
9787
9804
  */
9788
9805
  function get(name, strict) {
9806
+ const optionalIdx = name.lastIndexOf('?');
9807
+
9808
+ // optional chaining, i.e. `a.b?.c`
9809
+ if (optionalIdx !== -1) {
9810
+ const pivot = get(name.slice(0, optionalIdx), false);
9811
+ const path = name.slice(optionalIdx + 2);
9812
+
9813
+ if (path && pivot == null) {
9814
+ return undefined;
9815
+ }
9816
+
9817
+ return path ? path.split('.').reduce((pivot, key) => pivot[key], pivot) : pivot;
9818
+ }
9819
+
9789
9820
  if (!providers[name] && name.includes('.')) {
9790
9821
 
9791
9822
  const parts = name.split('.');
9792
- let pivot = get(/** @type { string } */ (parts.shift()));
9823
+ let pivot = get(/** @type { string } */ (parts.shift()), strict);
9793
9824
 
9794
9825
  while (parts.length) {
9795
- pivot = pivot[/** @type { string } */ (parts.shift())];
9826
+ const key = /** @type { string } */ (parts.shift());
9827
+
9828
+ pivot = strict === false ? pivot?.[key] : pivot[key];
9796
9829
  }
9797
9830
 
9798
9831
  return pivot;
@@ -9837,11 +9870,9 @@
9837
9870
  */
9838
9871
  const inject = fn.$inject || parseAnnotations(fn);
9839
9872
  const dependencies = inject.map(dep => {
9840
- if (hasOwnProp(locals, dep)) {
9841
- return locals[dep];
9842
- } else {
9843
- return get(dep);
9844
- }
9873
+ const local = dep.replace(/\?$/, '');
9874
+
9875
+ return hasOwnProp(locals, local) ? locals[local] : get(dep);
9845
9876
  });
9846
9877
 
9847
9878
  return {
@@ -14092,7 +14123,7 @@
14092
14123
  * @template T
14093
14124
  *
14094
14125
  * @param {string} name The name of the service to get.
14095
- * @param {true} strict If false, resolve missing services to null.
14126
+ * @param {true} strict If true, throw if the service is missing.
14096
14127
  *
14097
14128
  * @return {T}
14098
14129
  */
@@ -14104,9 +14135,9 @@
14104
14135
  * @template T
14105
14136
  *
14106
14137
  * @param {string} name The name of the service to get.
14107
- * @param {boolean} strict If false, resolve missing services to null.
14138
+ * @param {boolean} strict If false, resolve missing services to undefined.
14108
14139
  *
14109
- * @return {T|null}
14140
+ * @return {T|undefined}
14110
14141
  */
14111
14142
  /**
14112
14143
  * Resolves a diagram service.