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
@@ -5148,8 +5148,8 @@
5148
5148
  * @typedef { number | Partial<Padding> } PaddingConfig
5149
5149
  *
5150
5150
  * @typedef { {
5151
- * horizontal: 'center' | 'left';
5152
- * vertical: 'top' | 'center';
5151
+ * horizontal: 'center' | 'left' | 'right';
5152
+ * vertical: 'top' | 'middle';
5153
5153
  * } } Alignment
5154
5154
  *
5155
5155
  * @typedef { 'center-middle' | 'center-top' } AlignmentConfig
@@ -5413,7 +5413,7 @@
5413
5413
  /**
5414
5414
  * Creates a new label utility
5415
5415
  *
5416
- * @param {TextConfig} config
5416
+ * @param {TextConfig} [config]
5417
5417
  */
5418
5418
  function Text(config) {
5419
5419
 
@@ -7399,6 +7399,7 @@
7399
7399
  /**
7400
7400
  * @typedef {import('../../model/Types').Element} Element
7401
7401
  *
7402
+ * @typedef {import('./OutlineProvider').default} OutlineProvider
7402
7403
  * @typedef {import('../../core/EventBus').default} EventBus
7403
7404
  * @typedef {import('../../draw/Styles').default} Styles
7404
7405
  */
@@ -7557,7 +7558,7 @@
7557
7558
  * Returns the outline for an element.
7558
7559
  *
7559
7560
  * @param {Element} element
7560
- **/
7561
+ */
7561
7562
  Outline.prototype.getOutline = function(element) {
7562
7563
  var outline;
7563
7564
  var providers = this._getProviders();
@@ -8138,7 +8139,7 @@
8138
8139
  }, config && config.defaults);
8139
8140
 
8140
8141
  /**
8141
- * @type {Map<string, Overlay>}
8142
+ * @type {Record<string, Overlay>}
8142
8143
  */
8143
8144
  this._overlays = {};
8144
8145
 
@@ -9963,16 +9964,19 @@
9963
9964
  * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9964
9965
  * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9965
9966
  * @typedef { import('./index.js').InjectorContext } InjectorContext
9967
+ *
9968
+ * @typedef { import('./index.js').TypedDeclaration<any, any> } TypedDeclaration
9966
9969
  */
9967
9970
 
9968
9971
  /**
9969
9972
  * Create a new injector with the given modules.
9970
9973
  *
9971
9974
  * @param {ModuleDefinition[]} modules
9972
- * @param {InjectorContext} [parent]
9975
+ * @param {InjectorContext} [_parent]
9973
9976
  */
9974
- function Injector(modules, parent) {
9975
- parent = parent || {
9977
+ function Injector(modules, _parent) {
9978
+
9979
+ const parent = _parent || /** @type InjectorContext */ ({
9976
9980
  get: function(name, strict) {
9977
9981
  currentlyResolving.push(name);
9978
9982
 
@@ -9982,7 +9986,7 @@
9982
9986
  throw error(`No provider for "${ name }"!`);
9983
9987
  }
9984
9988
  }
9985
- };
9989
+ });
9986
9990
 
9987
9991
  const currentlyResolving = [];
9988
9992
  const providers = this._providers = Object.create(parent._providers || null);
@@ -10005,12 +10009,13 @@
10005
10009
  * @return {any}
10006
10010
  */
10007
10011
  function get(name, strict) {
10008
- if (!providers[name] && name.indexOf('.') !== -1) {
10012
+ if (!providers[name] && name.includes('.')) {
10013
+
10009
10014
  const parts = name.split('.');
10010
- let pivot = get(parts.shift());
10015
+ let pivot = get(/** @type { string } */ (parts.shift()));
10011
10016
 
10012
10017
  while (parts.length) {
10013
- pivot = pivot[parts.shift()];
10018
+ pivot = pivot[/** @type { string } */ (parts.shift())];
10014
10019
  }
10015
10020
 
10016
10021
  return pivot;
@@ -10050,6 +10055,9 @@
10050
10055
  }
10051
10056
  }
10052
10057
 
10058
+ /**
10059
+ * @type {string[]}
10060
+ */
10053
10061
  const inject = fn.$inject || parseAnnotations(fn);
10054
10062
  const dependencies = inject.map(dep => {
10055
10063
  if (hasOwnProp(locals, dep)) {
@@ -10061,7 +10069,7 @@
10061
10069
 
10062
10070
  return {
10063
10071
  fn: fn,
10064
- dependencies: dependencies
10072
+ dependencies
10065
10073
  };
10066
10074
  }
10067
10075
 
@@ -10081,7 +10089,7 @@
10081
10089
  } = fnDef(type);
10082
10090
 
10083
10091
  // instantiate var args constructor
10084
- const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
10092
+ const Constructor = Function.prototype.bind.call(fn, null, ...dependencies);
10085
10093
 
10086
10094
  return new Constructor();
10087
10095
  }
@@ -10261,13 +10269,17 @@
10261
10269
  return;
10262
10270
  }
10263
10271
 
10264
- if (moduleDefinition[key][2] === 'private') {
10265
- providers[key] = moduleDefinition[key];
10272
+ const typeDeclaration = /** @type { TypedDeclaration } */ (
10273
+ moduleDefinition[key]
10274
+ );
10275
+
10276
+ if (typeDeclaration[2] === 'private') {
10277
+ providers[key] = typeDeclaration;
10266
10278
  return;
10267
10279
  }
10268
10280
 
10269
- const type = moduleDefinition[key][0];
10270
- const value = moduleDefinition[key][1];
10281
+ const type = typeDeclaration[0];
10282
+ const value = typeDeclaration[1];
10271
10283
 
10272
10284
  providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
10273
10285
  });
@@ -10655,6 +10667,7 @@
10655
10667
  * @typedef {import('../util/Types').Point} Point
10656
10668
  * @typedef {import('../util/Types').Rect} Rect
10657
10669
  * @typedef {import('../util/Types').RectTRBL} RectTRBL
10670
+ * @typedef {import('../util/Types').ScrollDelta} ScrollDelta
10658
10671
  */
10659
10672
 
10660
10673
  function round(number, resolution) {
@@ -11355,7 +11368,7 @@
11355
11368
  Canvas.prototype.setRootElement = function(rootElement) {
11356
11369
 
11357
11370
  if (rootElement === this._rootElement) {
11358
- return;
11371
+ return rootElement;
11359
11372
  }
11360
11373
 
11361
11374
  let plane;
@@ -11790,7 +11803,7 @@
11790
11803
  /**
11791
11804
  * Gets or sets the scroll of the canvas.
11792
11805
  *
11793
- * @param {Point} [delta] The scroll to be set.
11806
+ * @param {ScrollDelta} [delta] The scroll to be set.
11794
11807
  *
11795
11808
  * @return {Point}
11796
11809
  */
@@ -13161,6 +13174,8 @@
13161
13174
  * var sum = eventBus.fire('sum', 1, 2);
13162
13175
  * console.log(sum); // 3
13163
13176
  * ```
13177
+ *
13178
+ * @template [EventMap=null]
13164
13179
  */
13165
13180
  function EventBus() {
13166
13181
 
@@ -13174,8 +13189,9 @@
13174
13189
  this.on('diagram.destroy', 1, this._destroy, this);
13175
13190
  }
13176
13191
 
13177
-
13178
13192
  /**
13193
+ * @overlord
13194
+ *
13179
13195
  * Register an event listener for events with the given name.
13180
13196
  *
13181
13197
  * The callback will be invoked with `event, ...additionalArguments`
@@ -13194,6 +13210,25 @@
13194
13210
  * @param {EventBusEventCallback<T>} callback
13195
13211
  * @param {any} [that] callback context
13196
13212
  */
13213
+ /**
13214
+ * Register an event listener for events with the given name.
13215
+ *
13216
+ * The callback will be invoked with `event, ...additionalArguments`
13217
+ * that have been passed to {@link EventBus#fire}.
13218
+ *
13219
+ * Returning false from a listener will prevent the events default action
13220
+ * (if any is specified). To stop an event from being processed further in
13221
+ * other listeners execute {@link Event#stopPropagation}.
13222
+ *
13223
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
13224
+ *
13225
+ * @template {keyof EventMap} EventName
13226
+ *
13227
+ * @param {EventName} events to subscribe to
13228
+ * @param {number} [priority=1000] listen priority
13229
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13230
+ * @param {any} [that] callback context
13231
+ */
13197
13232
  EventBus.prototype.on = function(events, priority, callback, that) {
13198
13233
 
13199
13234
  events = isArray$2(events) ? events : [ events ];
@@ -13231,6 +13266,8 @@
13231
13266
  };
13232
13267
 
13233
13268
  /**
13269
+ * @overlord
13270
+ *
13234
13271
  * Register an event listener that is called only once.
13235
13272
  *
13236
13273
  * @template T
@@ -13240,6 +13277,16 @@
13240
13277
  * @param {EventBusEventCallback<T>} callback
13241
13278
  * @param {any} [that] callback context
13242
13279
  */
13280
+ /**
13281
+ * Register an event listener that is called only once.
13282
+ *
13283
+ * @template {keyof EventMap} EventName
13284
+ *
13285
+ * @param {EventName} events to subscribe to
13286
+ * @param {number} [priority=1000] listen priority
13287
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13288
+ * @param {any} [that] callback context
13289
+ */
13243
13290
  EventBus.prototype.once = function(events, priority, callback, that) {
13244
13291
  var self = this;
13245
13292
 
@@ -13965,6 +14012,16 @@
13965
14012
  * } & Record<string, any> } DiagramOptions
13966
14013
  */
13967
14014
 
14015
+ /**
14016
+ * @template T
14017
+ * @typedef {import('didi').FactoryFunction<T>} FactoryFunction
14018
+ */
14019
+
14020
+ /**
14021
+ * @template T
14022
+ * @typedef {import('didi').ArrayFunc<T>} ArrayFunc
14023
+ */
14024
+
13968
14025
  /**
13969
14026
  * Bootstrap an injector from a list of modules, instantiating a number of default components
13970
14027
  *
@@ -13983,9 +14040,10 @@
13983
14040
  /**
13984
14041
  * Creates an injector from passed options.
13985
14042
  *
14043
+ * @template ServiceMap
13986
14044
  * @param {DiagramOptions} [options]
13987
14045
  *
13988
- * @return {Injector}
14046
+ * @return {Injector<ServiceMap>}
13989
14047
  */
13990
14048
  function createInjector(options) {
13991
14049
 
@@ -14012,6 +14070,7 @@
14012
14070
  *
14013
14071
  * @class
14014
14072
  * @constructor
14073
+ * @template [ServiceMap=null]
14015
14074
  *
14016
14075
  * @example Creating a plug-in that logs whenever a shape is added to the canvas.
14017
14076
  *
@@ -14050,44 +14109,17 @@
14050
14109
  * ```
14051
14110
  *
14052
14111
  * @param {DiagramOptions} [options]
14053
- * @param {Injector} [injector] An (optional) injector to bootstrap the diagram with.
14112
+ * @param {Injector<ServiceMap>} [injector] An (optional) injector to bootstrap the diagram with.
14054
14113
  */
14055
14114
  function Diagram(options, injector) {
14056
14115
 
14057
- this._injector = injector = injector || createInjector(options);
14058
-
14059
- // API
14060
-
14061
- /**
14062
- * Resolves a diagram service.
14063
- *
14064
- * @template T
14065
- *
14066
- * @param {string} name The name of the service to get.
14067
- * @param {boolean} [strict=true] If false, resolve missing services to null.
14068
- *
14069
- * @return {T|null}
14070
- */
14071
- this.get = injector.get;
14072
-
14073
14116
  /**
14074
- * Executes a function with its dependencies injected.
14075
- *
14076
- * @template T
14077
- *
14078
- * @param {Function} func function to be invoked
14079
- * @param {InjectionContext} [context] context of the invocation
14080
- * @param {LocalsMap} [locals] locals provided
14081
- *
14082
- * @return {T|null}
14117
+ * @type {Injector<ServiceMap>}
14083
14118
  */
14084
- this.invoke = injector.invoke;
14119
+ this._injector = injector || createInjector(options);
14085
14120
 
14086
14121
  // init
14087
14122
 
14088
- // indicate via event
14089
-
14090
-
14091
14123
  /**
14092
14124
  * An event indicating that all plug-ins are loaded.
14093
14125
  *
@@ -14110,6 +14142,82 @@
14110
14142
  this.get('eventBus').fire('diagram.init');
14111
14143
  }
14112
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
+ *
14154
+ * @return {T}
14155
+ */
14156
+ /**
14157
+ * @overlord
14158
+ *
14159
+ * Resolves a diagram service.
14160
+ *
14161
+ * @template T
14162
+ *
14163
+ * @param {string} name The name of the service to get.
14164
+ * @param {true} strict If false, resolve missing services to null.
14165
+ *
14166
+ * @return {T}
14167
+ */
14168
+ /**
14169
+ * @overlord
14170
+ *
14171
+ * Resolves a diagram service.
14172
+ *
14173
+ * @template T
14174
+ *
14175
+ * @param {string} name The name of the service to get.
14176
+ * @param {boolean} strict If false, resolve missing services to null.
14177
+ *
14178
+ * @return {T|null}
14179
+ */
14180
+ /**
14181
+ * Resolves a diagram service.
14182
+ *
14183
+ * @template {keyof ServiceMap} Name
14184
+ *
14185
+ * @param {Name} name The name of the service to get.
14186
+ *
14187
+ * @return {ServiceMap[Name]}
14188
+ */
14189
+ Diagram.prototype.get = function(name, strict) {
14190
+ return this._injector.get(name, strict);
14191
+ };
14192
+
14193
+ /**
14194
+ * @overlord
14195
+ *
14196
+ * Invoke the given function, injecting dependencies. Return the result.
14197
+ *
14198
+ * @template T
14199
+ *
14200
+ * @param {FactoryFunction<T>} func
14201
+ * @param {InjectionContext} [context]
14202
+ * @param {LocalsMap} [locals]
14203
+ *
14204
+ * @return {T}
14205
+ */
14206
+ /**
14207
+ * Invoke the given function, injecting dependencies provided in
14208
+ * array notation. Return the result.
14209
+ *
14210
+ * @template T
14211
+ *
14212
+ * @param {ArrayFunc<T>} func function to be invoked
14213
+ * @param {InjectionContext} [context] context of the invocation
14214
+ * @param {LocalsMap} [locals] locals provided
14215
+ *
14216
+ * @return {T}
14217
+ */
14218
+ Diagram.prototype.invoke = function(func, context, locals) {
14219
+ return this._injector.invoke(func, context, locals);
14220
+ };
14113
14221
 
14114
14222
  /**
14115
14223
  * Destroys the diagram