bpmn-js 18.31.1 → 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.1
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-21
11
+ * Date: 2026-11-16
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -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 {
@@ -9692,6 +9692,8 @@
9692
9692
  // - can't reliably auto-annotate constructor; we'll match the
9693
9693
  // first constructor(...) pattern found which may be the one
9694
9694
  // of a nested class, too.
9695
+ //
9696
+ // - can't parse default values containing "," or ")"
9695
9697
 
9696
9698
  const CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
9697
9699
  const FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
@@ -9719,7 +9721,11 @@
9719
9721
 
9720
9722
  return args && args.split(',').map(arg => {
9721
9723
  const argMatch = arg.match(FN_ARG);
9722
- 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;
9723
9729
  }) || [];
9724
9730
  }
9725
9731
 
@@ -9741,13 +9747,13 @@
9741
9747
 
9742
9748
  const parent = _parent || /** @type InjectorContext */ ({
9743
9749
  get: function(name, strict) {
9744
- currentlyResolving.push(name);
9745
-
9746
9750
  if (strict === false) {
9747
- return null;
9748
- } else {
9749
- throw error(`No provider for "${ name }"!`);
9751
+ return undefined;
9750
9752
  }
9753
+
9754
+ currentlyResolving.push(name);
9755
+
9756
+ throw error(`No provider for "${ name }"!`);
9751
9757
  }
9752
9758
  });
9753
9759
 
@@ -9767,18 +9773,34 @@
9767
9773
  * Return a named service.
9768
9774
  *
9769
9775
  * @param {string} name
9770
- * @param {boolean} [strict=true] if false, resolve missing services to null
9776
+ * @param {boolean} [strict=true] if false, resolve missing services to undefined
9771
9777
  *
9772
9778
  * @return {any}
9773
9779
  */
9774
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
+
9775
9795
  if (!providers[name] && name.includes('.')) {
9776
9796
 
9777
9797
  const parts = name.split('.');
9778
- let pivot = get(/** @type { string } */ (parts.shift()));
9798
+ let pivot = get(/** @type { string } */ (parts.shift()), strict);
9779
9799
 
9780
9800
  while (parts.length) {
9781
- pivot = pivot[/** @type { string } */ (parts.shift())];
9801
+ const key = /** @type { string } */ (parts.shift());
9802
+
9803
+ pivot = strict === false ? pivot?.[key] : pivot[key];
9782
9804
  }
9783
9805
 
9784
9806
  return pivot;
@@ -9823,11 +9845,9 @@
9823
9845
  */
9824
9846
  const inject = fn.$inject || parseAnnotations(fn);
9825
9847
  const dependencies = inject.map(dep => {
9826
- if (hasOwnProp(locals, dep)) {
9827
- return locals[dep];
9828
- } else {
9829
- return get(dep);
9830
- }
9848
+ const local = dep.replace(/\?$/, '');
9849
+
9850
+ return hasOwnProp(locals, local) ? locals[local] : get(dep);
9831
9851
  });
9832
9852
 
9833
9853
  return {
@@ -14078,7 +14098,7 @@
14078
14098
  * @template T
14079
14099
  *
14080
14100
  * @param {string} name The name of the service to get.
14081
- * @param {true} strict If false, resolve missing services to null.
14101
+ * @param {true} strict If true, throw if the service is missing.
14082
14102
  *
14083
14103
  * @return {T}
14084
14104
  */
@@ -14090,9 +14110,9 @@
14090
14110
  * @template T
14091
14111
  *
14092
14112
  * @param {string} name The name of the service to get.
14093
- * @param {boolean} strict If false, resolve missing services to null.
14113
+ * @param {boolean} strict If false, resolve missing services to undefined.
14094
14114
  *
14095
- * @return {T|null}
14115
+ * @return {T|undefined}
14096
14116
  */
14097
14117
  /**
14098
14118
  * Resolves a diagram service.