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-navigated-viewer v18.31.1
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-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 {
@@ -9717,6 +9717,8 @@
9717
9717
  // - can't reliably auto-annotate constructor; we'll match the
9718
9718
  // first constructor(...) pattern found which may be the one
9719
9719
  // of a nested class, too.
9720
+ //
9721
+ // - can't parse default values containing "," or ")"
9720
9722
 
9721
9723
  const CONSTRUCTOR_ARGS = /constructor\s*[^(]*\(\s*([^)]*)\)/m;
9722
9724
  const FN_ARGS = /^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m;
@@ -9744,7 +9746,11 @@
9744
9746
 
9745
9747
  return args && args.split(',').map(arg => {
9746
9748
  const argMatch = arg.match(FN_ARG);
9747
- 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;
9748
9754
  }) || [];
9749
9755
  }
9750
9756
 
@@ -9766,13 +9772,13 @@
9766
9772
 
9767
9773
  const parent = _parent || /** @type InjectorContext */ ({
9768
9774
  get: function(name, strict) {
9769
- currentlyResolving.push(name);
9770
-
9771
9775
  if (strict === false) {
9772
- return null;
9773
- } else {
9774
- throw error(`No provider for "${ name }"!`);
9776
+ return undefined;
9775
9777
  }
9778
+
9779
+ currentlyResolving.push(name);
9780
+
9781
+ throw error(`No provider for "${ name }"!`);
9776
9782
  }
9777
9783
  });
9778
9784
 
@@ -9792,18 +9798,34 @@
9792
9798
  * Return a named service.
9793
9799
  *
9794
9800
  * @param {string} name
9795
- * @param {boolean} [strict=true] if false, resolve missing services to null
9801
+ * @param {boolean} [strict=true] if false, resolve missing services to undefined
9796
9802
  *
9797
9803
  * @return {any}
9798
9804
  */
9799
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
+
9800
9820
  if (!providers[name] && name.includes('.')) {
9801
9821
 
9802
9822
  const parts = name.split('.');
9803
- let pivot = get(/** @type { string } */ (parts.shift()));
9823
+ let pivot = get(/** @type { string } */ (parts.shift()), strict);
9804
9824
 
9805
9825
  while (parts.length) {
9806
- pivot = pivot[/** @type { string } */ (parts.shift())];
9826
+ const key = /** @type { string } */ (parts.shift());
9827
+
9828
+ pivot = strict === false ? pivot?.[key] : pivot[key];
9807
9829
  }
9808
9830
 
9809
9831
  return pivot;
@@ -9848,11 +9870,9 @@
9848
9870
  */
9849
9871
  const inject = fn.$inject || parseAnnotations(fn);
9850
9872
  const dependencies = inject.map(dep => {
9851
- if (hasOwnProp(locals, dep)) {
9852
- return locals[dep];
9853
- } else {
9854
- return get(dep);
9855
- }
9873
+ const local = dep.replace(/\?$/, '');
9874
+
9875
+ return hasOwnProp(locals, local) ? locals[local] : get(dep);
9856
9876
  });
9857
9877
 
9858
9878
  return {
@@ -14103,7 +14123,7 @@
14103
14123
  * @template T
14104
14124
  *
14105
14125
  * @param {string} name The name of the service to get.
14106
- * @param {true} strict If false, resolve missing services to null.
14126
+ * @param {true} strict If true, throw if the service is missing.
14107
14127
  *
14108
14128
  * @return {T}
14109
14129
  */
@@ -14115,9 +14135,9 @@
14115
14135
  * @template T
14116
14136
  *
14117
14137
  * @param {string} name The name of the service to get.
14118
- * @param {boolean} strict If false, resolve missing services to null.
14138
+ * @param {boolean} strict If false, resolve missing services to undefined.
14119
14139
  *
14120
- * @return {T|null}
14140
+ * @return {T|undefined}
14121
14141
  */
14122
14142
  /**
14123
14143
  * Resolves a diagram service.