camunda-bpmn-js 4.3.2 → 4.4.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.
Files changed (36) hide show
  1. package/README.md +5 -0
  2. package/dist/assets/diagram-js.css +15 -19
  3. package/dist/base-modeler.development.js +336 -175
  4. package/dist/base-modeler.production.min.js +34 -36
  5. package/dist/base-navigated-viewer.development.js +177 -60
  6. package/dist/base-navigated-viewer.production.min.js +1 -1
  7. package/dist/base-viewer.development.js +160 -52
  8. package/dist/base-viewer.production.min.js +1 -1
  9. package/dist/camunda-cloud-modeler.development.js +366 -202
  10. package/dist/camunda-cloud-modeler.production.min.js +34 -36
  11. package/dist/camunda-cloud-navigated-viewer.development.js +177 -60
  12. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  13. package/dist/camunda-cloud-viewer.development.js +160 -52
  14. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  15. package/dist/camunda-platform-modeler.development.js +349 -188
  16. package/dist/camunda-platform-modeler.production.min.js +34 -36
  17. package/dist/camunda-platform-navigated-viewer.development.js +177 -60
  18. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-platform-viewer.development.js +160 -52
  20. package/dist/camunda-platform-viewer.production.min.js +1 -1
  21. package/lib/base/Modeler.d.ts +15 -15
  22. package/lib/base/NavigatedViewer.d.ts +2 -2
  23. package/lib/base/Viewer.d.ts +2 -2
  24. package/lib/camunda-cloud/ElementTemplatesValidator.d.ts +1 -1
  25. package/lib/camunda-cloud/Modeler.d.ts +3 -3
  26. package/lib/camunda-cloud/Modeler.js +84 -84
  27. package/lib/camunda-cloud/NavigatedViewer.d.ts +3 -3
  28. package/lib/camunda-cloud/Viewer.d.ts +3 -3
  29. package/lib/camunda-cloud/util/commonModules.d.ts +9 -9
  30. package/lib/camunda-platform/Modeler.d.ts +3 -3
  31. package/lib/camunda-platform/Modeler.js +68 -68
  32. package/lib/camunda-platform/NavigatedViewer.d.ts +5 -5
  33. package/lib/camunda-platform/Viewer.d.ts +5 -5
  34. package/lib/camunda-platform/util/commonModules.d.ts +9 -9
  35. package/lib/util/ExtensionElementsUtil.d.ts +24 -24
  36. package/package.json +140 -140
@@ -5137,8 +5137,8 @@
5137
5137
  * @typedef { number | Partial<Padding> } PaddingConfig
5138
5138
  *
5139
5139
  * @typedef { {
5140
- * horizontal: 'center' | 'left';
5141
- * vertical: 'top' | 'center';
5140
+ * horizontal: 'center' | 'left' | 'right';
5141
+ * vertical: 'top' | 'middle';
5142
5142
  * } } Alignment
5143
5143
  *
5144
5144
  * @typedef { 'center-middle' | 'center-top' } AlignmentConfig
@@ -5402,7 +5402,7 @@
5402
5402
  /**
5403
5403
  * Creates a new label utility
5404
5404
  *
5405
- * @param {TextConfig} config
5405
+ * @param {TextConfig} [config]
5406
5406
  */
5407
5407
  function Text(config) {
5408
5408
 
@@ -7388,6 +7388,7 @@
7388
7388
  /**
7389
7389
  * @typedef {import('../../model/Types').Element} Element
7390
7390
  *
7391
+ * @typedef {import('./OutlineProvider').default} OutlineProvider
7391
7392
  * @typedef {import('../../core/EventBus').default} EventBus
7392
7393
  * @typedef {import('../../draw/Styles').default} Styles
7393
7394
  */
@@ -7546,7 +7547,7 @@
7546
7547
  * Returns the outline for an element.
7547
7548
  *
7548
7549
  * @param {Element} element
7549
- **/
7550
+ */
7550
7551
  Outline.prototype.getOutline = function(element) {
7551
7552
  var outline;
7552
7553
  var providers = this._getProviders();
@@ -8127,7 +8128,7 @@
8127
8128
  }, config && config.defaults);
8128
8129
 
8129
8130
  /**
8130
- * @type {Map<string, Overlay>}
8131
+ * @type {Record<string, Overlay>}
8131
8132
  */
8132
8133
  this._overlays = {};
8133
8134
 
@@ -9952,16 +9953,19 @@
9952
9953
  * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9953
9954
  * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9954
9955
  * @typedef { import('./index.js').InjectorContext } InjectorContext
9956
+ *
9957
+ * @typedef { import('./index.js').TypedDeclaration<any, any> } TypedDeclaration
9955
9958
  */
9956
9959
 
9957
9960
  /**
9958
9961
  * Create a new injector with the given modules.
9959
9962
  *
9960
9963
  * @param {ModuleDefinition[]} modules
9961
- * @param {InjectorContext} [parent]
9964
+ * @param {InjectorContext} [_parent]
9962
9965
  */
9963
- function Injector(modules, parent) {
9964
- parent = parent || {
9966
+ function Injector(modules, _parent) {
9967
+
9968
+ const parent = _parent || /** @type InjectorContext */ ({
9965
9969
  get: function(name, strict) {
9966
9970
  currentlyResolving.push(name);
9967
9971
 
@@ -9971,7 +9975,7 @@
9971
9975
  throw error(`No provider for "${ name }"!`);
9972
9976
  }
9973
9977
  }
9974
- };
9978
+ });
9975
9979
 
9976
9980
  const currentlyResolving = [];
9977
9981
  const providers = this._providers = Object.create(parent._providers || null);
@@ -9994,12 +9998,13 @@
9994
9998
  * @return {any}
9995
9999
  */
9996
10000
  function get(name, strict) {
9997
- if (!providers[name] && name.indexOf('.') !== -1) {
10001
+ if (!providers[name] && name.includes('.')) {
10002
+
9998
10003
  const parts = name.split('.');
9999
- let pivot = get(parts.shift());
10004
+ let pivot = get(/** @type { string } */ (parts.shift()));
10000
10005
 
10001
10006
  while (parts.length) {
10002
- pivot = pivot[parts.shift()];
10007
+ pivot = pivot[/** @type { string } */ (parts.shift())];
10003
10008
  }
10004
10009
 
10005
10010
  return pivot;
@@ -10039,6 +10044,9 @@
10039
10044
  }
10040
10045
  }
10041
10046
 
10047
+ /**
10048
+ * @type {string[]}
10049
+ */
10042
10050
  const inject = fn.$inject || parseAnnotations(fn);
10043
10051
  const dependencies = inject.map(dep => {
10044
10052
  if (hasOwnProp(locals, dep)) {
@@ -10050,7 +10058,7 @@
10050
10058
 
10051
10059
  return {
10052
10060
  fn: fn,
10053
- dependencies: dependencies
10061
+ dependencies
10054
10062
  };
10055
10063
  }
10056
10064
 
@@ -10070,7 +10078,7 @@
10070
10078
  } = fnDef(type);
10071
10079
 
10072
10080
  // instantiate var args constructor
10073
- const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
10081
+ const Constructor = Function.prototype.bind.call(fn, null, ...dependencies);
10074
10082
 
10075
10083
  return new Constructor();
10076
10084
  }
@@ -10250,13 +10258,17 @@
10250
10258
  return;
10251
10259
  }
10252
10260
 
10253
- if (moduleDefinition[key][2] === 'private') {
10254
- providers[key] = moduleDefinition[key];
10261
+ const typeDeclaration = /** @type { TypedDeclaration } */ (
10262
+ moduleDefinition[key]
10263
+ );
10264
+
10265
+ if (typeDeclaration[2] === 'private') {
10266
+ providers[key] = typeDeclaration;
10255
10267
  return;
10256
10268
  }
10257
10269
 
10258
- const type = moduleDefinition[key][0];
10259
- const value = moduleDefinition[key][1];
10270
+ const type = typeDeclaration[0];
10271
+ const value = typeDeclaration[1];
10260
10272
 
10261
10273
  providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
10262
10274
  });
@@ -10644,6 +10656,7 @@
10644
10656
  * @typedef {import('../util/Types').Point} Point
10645
10657
  * @typedef {import('../util/Types').Rect} Rect
10646
10658
  * @typedef {import('../util/Types').RectTRBL} RectTRBL
10659
+ * @typedef {import('../util/Types').ScrollDelta} ScrollDelta
10647
10660
  */
10648
10661
 
10649
10662
  function round(number, resolution) {
@@ -11344,7 +11357,7 @@
11344
11357
  Canvas.prototype.setRootElement = function(rootElement) {
11345
11358
 
11346
11359
  if (rootElement === this._rootElement) {
11347
- return;
11360
+ return rootElement;
11348
11361
  }
11349
11362
 
11350
11363
  let plane;
@@ -11779,7 +11792,7 @@
11779
11792
  /**
11780
11793
  * Gets or sets the scroll of the canvas.
11781
11794
  *
11782
- * @param {Point} [delta] The scroll to be set.
11795
+ * @param {ScrollDelta} [delta] The scroll to be set.
11783
11796
  *
11784
11797
  * @return {Point}
11785
11798
  */
@@ -13150,6 +13163,8 @@
13150
13163
  * var sum = eventBus.fire('sum', 1, 2);
13151
13164
  * console.log(sum); // 3
13152
13165
  * ```
13166
+ *
13167
+ * @template [EventMap=null]
13153
13168
  */
13154
13169
  function EventBus() {
13155
13170
 
@@ -13163,8 +13178,9 @@
13163
13178
  this.on('diagram.destroy', 1, this._destroy, this);
13164
13179
  }
13165
13180
 
13166
-
13167
13181
  /**
13182
+ * @overlord
13183
+ *
13168
13184
  * Register an event listener for events with the given name.
13169
13185
  *
13170
13186
  * The callback will be invoked with `event, ...additionalArguments`
@@ -13183,6 +13199,25 @@
13183
13199
  * @param {EventBusEventCallback<T>} callback
13184
13200
  * @param {any} [that] callback context
13185
13201
  */
13202
+ /**
13203
+ * Register an event listener for events with the given name.
13204
+ *
13205
+ * The callback will be invoked with `event, ...additionalArguments`
13206
+ * that have been passed to {@link EventBus#fire}.
13207
+ *
13208
+ * Returning false from a listener will prevent the events default action
13209
+ * (if any is specified). To stop an event from being processed further in
13210
+ * other listeners execute {@link Event#stopPropagation}.
13211
+ *
13212
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
13213
+ *
13214
+ * @template {keyof EventMap} EventName
13215
+ *
13216
+ * @param {EventName} events to subscribe to
13217
+ * @param {number} [priority=1000] listen priority
13218
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13219
+ * @param {any} [that] callback context
13220
+ */
13186
13221
  EventBus.prototype.on = function(events, priority, callback, that) {
13187
13222
 
13188
13223
  events = isArray$2(events) ? events : [ events ];
@@ -13220,6 +13255,8 @@
13220
13255
  };
13221
13256
 
13222
13257
  /**
13258
+ * @overlord
13259
+ *
13223
13260
  * Register an event listener that is called only once.
13224
13261
  *
13225
13262
  * @template T
@@ -13229,6 +13266,16 @@
13229
13266
  * @param {EventBusEventCallback<T>} callback
13230
13267
  * @param {any} [that] callback context
13231
13268
  */
13269
+ /**
13270
+ * Register an event listener that is called only once.
13271
+ *
13272
+ * @template {keyof EventMap} EventName
13273
+ *
13274
+ * @param {EventName} events to subscribe to
13275
+ * @param {number} [priority=1000] listen priority
13276
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13277
+ * @param {any} [that] callback context
13278
+ */
13232
13279
  EventBus.prototype.once = function(events, priority, callback, that) {
13233
13280
  var self = this;
13234
13281
 
@@ -13954,6 +14001,16 @@
13954
14001
  * } & Record<string, any> } DiagramOptions
13955
14002
  */
13956
14003
 
14004
+ /**
14005
+ * @template T
14006
+ * @typedef {import('didi').FactoryFunction<T>} FactoryFunction
14007
+ */
14008
+
14009
+ /**
14010
+ * @template T
14011
+ * @typedef {import('didi').ArrayFunc<T>} ArrayFunc
14012
+ */
14013
+
13957
14014
  /**
13958
14015
  * Bootstrap an injector from a list of modules, instantiating a number of default components
13959
14016
  *
@@ -13972,9 +14029,10 @@
13972
14029
  /**
13973
14030
  * Creates an injector from passed options.
13974
14031
  *
14032
+ * @template ServiceMap
13975
14033
  * @param {DiagramOptions} [options]
13976
14034
  *
13977
- * @return {Injector}
14035
+ * @return {Injector<ServiceMap>}
13978
14036
  */
13979
14037
  function createInjector(options) {
13980
14038
 
@@ -14001,6 +14059,7 @@
14001
14059
  *
14002
14060
  * @class
14003
14061
  * @constructor
14062
+ * @template [ServiceMap=null]
14004
14063
  *
14005
14064
  * @example Creating a plug-in that logs whenever a shape is added to the canvas.
14006
14065
  *
@@ -14039,44 +14098,17 @@
14039
14098
  * ```
14040
14099
  *
14041
14100
  * @param {DiagramOptions} [options]
14042
- * @param {Injector} [injector] An (optional) injector to bootstrap the diagram with.
14101
+ * @param {Injector<ServiceMap>} [injector] An (optional) injector to bootstrap the diagram with.
14043
14102
  */
14044
14103
  function Diagram(options, injector) {
14045
14104
 
14046
- this._injector = injector = injector || createInjector(options);
14047
-
14048
- // API
14049
-
14050
- /**
14051
- * Resolves a diagram service.
14052
- *
14053
- * @template T
14054
- *
14055
- * @param {string} name The name of the service to get.
14056
- * @param {boolean} [strict=true] If false, resolve missing services to null.
14057
- *
14058
- * @return {T|null}
14059
- */
14060
- this.get = injector.get;
14061
-
14062
14105
  /**
14063
- * Executes a function with its dependencies injected.
14064
- *
14065
- * @template T
14066
- *
14067
- * @param {Function} func function to be invoked
14068
- * @param {InjectionContext} [context] context of the invocation
14069
- * @param {LocalsMap} [locals] locals provided
14070
- *
14071
- * @return {T|null}
14106
+ * @type {Injector<ServiceMap>}
14072
14107
  */
14073
- this.invoke = injector.invoke;
14108
+ this._injector = injector || createInjector(options);
14074
14109
 
14075
14110
  // init
14076
14111
 
14077
- // indicate via event
14078
-
14079
-
14080
14112
  /**
14081
14113
  * An event indicating that all plug-ins are loaded.
14082
14114
  *
@@ -14099,6 +14131,82 @@
14099
14131
  this.get('eventBus').fire('diagram.init');
14100
14132
  }
14101
14133
 
14134
+ /**
14135
+ * @overlord
14136
+ *
14137
+ * Resolves a diagram service.
14138
+ *
14139
+ * @template T
14140
+ *
14141
+ * @param {string} name The name of the service to get.
14142
+ *
14143
+ * @return {T}
14144
+ */
14145
+ /**
14146
+ * @overlord
14147
+ *
14148
+ * Resolves a diagram service.
14149
+ *
14150
+ * @template T
14151
+ *
14152
+ * @param {string} name The name of the service to get.
14153
+ * @param {true} strict If false, resolve missing services to null.
14154
+ *
14155
+ * @return {T}
14156
+ */
14157
+ /**
14158
+ * @overlord
14159
+ *
14160
+ * Resolves a diagram service.
14161
+ *
14162
+ * @template T
14163
+ *
14164
+ * @param {string} name The name of the service to get.
14165
+ * @param {boolean} strict If false, resolve missing services to null.
14166
+ *
14167
+ * @return {T|null}
14168
+ */
14169
+ /**
14170
+ * Resolves a diagram service.
14171
+ *
14172
+ * @template {keyof ServiceMap} Name
14173
+ *
14174
+ * @param {Name} name The name of the service to get.
14175
+ *
14176
+ * @return {ServiceMap[Name]}
14177
+ */
14178
+ Diagram.prototype.get = function(name, strict) {
14179
+ return this._injector.get(name, strict);
14180
+ };
14181
+
14182
+ /**
14183
+ * @overlord
14184
+ *
14185
+ * Invoke the given function, injecting dependencies. Return the result.
14186
+ *
14187
+ * @template T
14188
+ *
14189
+ * @param {FactoryFunction<T>} func
14190
+ * @param {InjectionContext} [context]
14191
+ * @param {LocalsMap} [locals]
14192
+ *
14193
+ * @return {T}
14194
+ */
14195
+ /**
14196
+ * Invoke the given function, injecting dependencies provided in
14197
+ * array notation. Return the result.
14198
+ *
14199
+ * @template T
14200
+ *
14201
+ * @param {ArrayFunc<T>} func function to be invoked
14202
+ * @param {InjectionContext} [context] context of the invocation
14203
+ * @param {LocalsMap} [locals] locals provided
14204
+ *
14205
+ * @return {T}
14206
+ */
14207
+ Diagram.prototype.invoke = function(func, context, locals) {
14208
+ return this._injector.invoke(func, context, locals);
14209
+ };
14102
14210
 
14103
14211
  /**
14104
14212
  * Destroys the diagram