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-viewer v18.31.0
2
+ * bpmn-js - bpmn-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);
@@ -9681,6 +9692,8 @@
9681
9692
  // - can't reliably auto-annotate constructor; we'll match the
9682
9693
  // first constructor(...) pattern found which may be the one
9683
9694
  // of a nested class, too.
9695
+ //
9696
+ // - can't parse default values containing "," or ")"
9684
9697
 
9685
9698
  const CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
9686
9699
  const FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
@@ -9708,7 +9721,11 @@
9708
9721
 
9709
9722
  return args && args.split(',').map(arg => {
9710
9723
  const argMatch = arg.match(FN_ARG);
9711
- return (argMatch && argMatch[1] || arg).trim();
9724
+ const [ argName, defaultValue ] = arg.replace(FN_ARG, '').split('=');
9725
+ const name = (argMatch && argMatch[1] || argName).trim();
9726
+
9727
+ // arguments with default values are optional, i.e. `a.b = 1` => `a.b?`
9728
+ return defaultValue !== undefined && !name.endsWith('?') ? name + '?' : name;
9712
9729
  }) || [];
9713
9730
  }
9714
9731
 
@@ -9730,13 +9747,13 @@
9730
9747
 
9731
9748
  const parent = _parent || /** @type InjectorContext */ ({
9732
9749
  get: function(name, strict) {
9733
- currentlyResolving.push(name);
9734
-
9735
9750
  if (strict === false) {
9736
- return null;
9737
- } else {
9738
- throw error(`No provider for "${ name }"!`);
9751
+ return undefined;
9739
9752
  }
9753
+
9754
+ currentlyResolving.push(name);
9755
+
9756
+ throw error(`No provider for "${ name }"!`);
9740
9757
  }
9741
9758
  });
9742
9759
 
@@ -9756,18 +9773,34 @@
9756
9773
  * Return a named service.
9757
9774
  *
9758
9775
  * @param {string} name
9759
- * @param {boolean} [strict=true] if false, resolve missing services to null
9776
+ * @param {boolean} [strict=true] if false, resolve missing services to undefined
9760
9777
  *
9761
9778
  * @return {any}
9762
9779
  */
9763
9780
  function get(name, strict) {
9781
+ const optionalIdx = name.lastIndexOf('?');
9782
+
9783
+ // optional chaining, i.e. `a.b?.c`
9784
+ if (optionalIdx !== -1) {
9785
+ const pivot = get(name.slice(0, optionalIdx), false);
9786
+ const path = name.slice(optionalIdx + 2);
9787
+
9788
+ if (path && pivot == null) {
9789
+ return undefined;
9790
+ }
9791
+
9792
+ return path ? path.split('.').reduce((pivot, key) => pivot[key], pivot) : pivot;
9793
+ }
9794
+
9764
9795
  if (!providers[name] && name.includes('.')) {
9765
9796
 
9766
9797
  const parts = name.split('.');
9767
- let pivot = get(/** @type { string } */ (parts.shift()));
9798
+ let pivot = get(/** @type { string } */ (parts.shift()), strict);
9768
9799
 
9769
9800
  while (parts.length) {
9770
- pivot = pivot[/** @type { string } */ (parts.shift())];
9801
+ const key = /** @type { string } */ (parts.shift());
9802
+
9803
+ pivot = strict === false ? pivot?.[key] : pivot[key];
9771
9804
  }
9772
9805
 
9773
9806
  return pivot;
@@ -9812,11 +9845,9 @@
9812
9845
  */
9813
9846
  const inject = fn.$inject || parseAnnotations(fn);
9814
9847
  const dependencies = inject.map(dep => {
9815
- if (hasOwnProp(locals, dep)) {
9816
- return locals[dep];
9817
- } else {
9818
- return get(dep);
9819
- }
9848
+ const local = dep.replace(/\?$/, '');
9849
+
9850
+ return hasOwnProp(locals, local) ? locals[local] : get(dep);
9820
9851
  });
9821
9852
 
9822
9853
  return {
@@ -14067,7 +14098,7 @@
14067
14098
  * @template T
14068
14099
  *
14069
14100
  * @param {string} name The name of the service to get.
14070
- * @param {true} strict If false, resolve missing services to null.
14101
+ * @param {true} strict If true, throw if the service is missing.
14071
14102
  *
14072
14103
  * @return {T}
14073
14104
  */
@@ -14079,9 +14110,9 @@
14079
14110
  * @template T
14080
14111
  *
14081
14112
  * @param {string} name The name of the service to get.
14082
- * @param {boolean} strict If false, resolve missing services to null.
14113
+ * @param {boolean} strict If false, resolve missing services to undefined.
14083
14114
  *
14084
- * @return {T|null}
14115
+ * @return {T|undefined}
14085
14116
  */
14086
14117
  /**
14087
14118
  * Resolves a diagram service.