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
 
@@ -6793,7 +6793,7 @@
6793
6793
  *
6794
6794
  * @return {boolean}
6795
6795
  */
6796
- function isButton(event, button) {
6796
+ function isButton$1(event, button) {
6797
6797
  return (getOriginal(event) || event).button === button;
6798
6798
  }
6799
6799
 
@@ -6805,7 +6805,7 @@
6805
6805
  function isPrimaryButton(event) {
6806
6806
 
6807
6807
  // button === 0 -> left áka primary mouse button
6808
- return isButton(event, 0);
6808
+ return isButton$1(event, 0);
6809
6809
  }
6810
6810
 
6811
6811
  /**
@@ -6816,7 +6816,7 @@
6816
6816
  function isAuxiliaryButton(event) {
6817
6817
 
6818
6818
  // button === 1 -> auxiliary áka wheel button
6819
- return isButton(event, 1);
6819
+ return isButton$1(event, 1);
6820
6820
  }
6821
6821
 
6822
6822
  /**
@@ -7424,6 +7424,7 @@
7424
7424
  /**
7425
7425
  * @typedef {import('../../model/Types').Element} Element
7426
7426
  *
7427
+ * @typedef {import('./OutlineProvider').default} OutlineProvider
7427
7428
  * @typedef {import('../../core/EventBus').default} EventBus
7428
7429
  * @typedef {import('../../draw/Styles').default} Styles
7429
7430
  */
@@ -7582,7 +7583,7 @@
7582
7583
  * Returns the outline for an element.
7583
7584
  *
7584
7585
  * @param {Element} element
7585
- **/
7586
+ */
7586
7587
  Outline.prototype.getOutline = function(element) {
7587
7588
  var outline;
7588
7589
  var providers = this._getProviders();
@@ -8163,7 +8164,7 @@
8163
8164
  }, config && config.defaults);
8164
8165
 
8165
8166
  /**
8166
- * @type {Map<string, Overlay>}
8167
+ * @type {Record<string, Overlay>}
8167
8168
  */
8168
8169
  this._overlays = {};
8169
8170
 
@@ -9988,16 +9989,19 @@
9988
9989
  * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9989
9990
  * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9990
9991
  * @typedef { import('./index.js').InjectorContext } InjectorContext
9992
+ *
9993
+ * @typedef { import('./index.js').TypedDeclaration<any, any> } TypedDeclaration
9991
9994
  */
9992
9995
 
9993
9996
  /**
9994
9997
  * Create a new injector with the given modules.
9995
9998
  *
9996
9999
  * @param {ModuleDefinition[]} modules
9997
- * @param {InjectorContext} [parent]
10000
+ * @param {InjectorContext} [_parent]
9998
10001
  */
9999
- function Injector(modules, parent) {
10000
- parent = parent || {
10002
+ function Injector(modules, _parent) {
10003
+
10004
+ const parent = _parent || /** @type InjectorContext */ ({
10001
10005
  get: function(name, strict) {
10002
10006
  currentlyResolving.push(name);
10003
10007
 
@@ -10007,7 +10011,7 @@
10007
10011
  throw error(`No provider for "${ name }"!`);
10008
10012
  }
10009
10013
  }
10010
- };
10014
+ });
10011
10015
 
10012
10016
  const currentlyResolving = [];
10013
10017
  const providers = this._providers = Object.create(parent._providers || null);
@@ -10030,12 +10034,13 @@
10030
10034
  * @return {any}
10031
10035
  */
10032
10036
  function get(name, strict) {
10033
- if (!providers[name] && name.indexOf('.') !== -1) {
10037
+ if (!providers[name] && name.includes('.')) {
10038
+
10034
10039
  const parts = name.split('.');
10035
- let pivot = get(parts.shift());
10040
+ let pivot = get(/** @type { string } */ (parts.shift()));
10036
10041
 
10037
10042
  while (parts.length) {
10038
- pivot = pivot[parts.shift()];
10043
+ pivot = pivot[/** @type { string } */ (parts.shift())];
10039
10044
  }
10040
10045
 
10041
10046
  return pivot;
@@ -10075,6 +10080,9 @@
10075
10080
  }
10076
10081
  }
10077
10082
 
10083
+ /**
10084
+ * @type {string[]}
10085
+ */
10078
10086
  const inject = fn.$inject || parseAnnotations(fn);
10079
10087
  const dependencies = inject.map(dep => {
10080
10088
  if (hasOwnProp(locals, dep)) {
@@ -10086,7 +10094,7 @@
10086
10094
 
10087
10095
  return {
10088
10096
  fn: fn,
10089
- dependencies: dependencies
10097
+ dependencies
10090
10098
  };
10091
10099
  }
10092
10100
 
@@ -10106,7 +10114,7 @@
10106
10114
  } = fnDef(type);
10107
10115
 
10108
10116
  // instantiate var args constructor
10109
- const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
10117
+ const Constructor = Function.prototype.bind.call(fn, null, ...dependencies);
10110
10118
 
10111
10119
  return new Constructor();
10112
10120
  }
@@ -10286,13 +10294,17 @@
10286
10294
  return;
10287
10295
  }
10288
10296
 
10289
- if (moduleDefinition[key][2] === 'private') {
10290
- providers[key] = moduleDefinition[key];
10297
+ const typeDeclaration = /** @type { TypedDeclaration } */ (
10298
+ moduleDefinition[key]
10299
+ );
10300
+
10301
+ if (typeDeclaration[2] === 'private') {
10302
+ providers[key] = typeDeclaration;
10291
10303
  return;
10292
10304
  }
10293
10305
 
10294
- const type = moduleDefinition[key][0];
10295
- const value = moduleDefinition[key][1];
10306
+ const type = typeDeclaration[0];
10307
+ const value = typeDeclaration[1];
10296
10308
 
10297
10309
  providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
10298
10310
  });
@@ -10680,6 +10692,7 @@
10680
10692
  * @typedef {import('../util/Types').Point} Point
10681
10693
  * @typedef {import('../util/Types').Rect} Rect
10682
10694
  * @typedef {import('../util/Types').RectTRBL} RectTRBL
10695
+ * @typedef {import('../util/Types').ScrollDelta} ScrollDelta
10683
10696
  */
10684
10697
 
10685
10698
  function round(number, resolution) {
@@ -11380,7 +11393,7 @@
11380
11393
  Canvas.prototype.setRootElement = function(rootElement) {
11381
11394
 
11382
11395
  if (rootElement === this._rootElement) {
11383
- return;
11396
+ return rootElement;
11384
11397
  }
11385
11398
 
11386
11399
  let plane;
@@ -11815,7 +11828,7 @@
11815
11828
  /**
11816
11829
  * Gets or sets the scroll of the canvas.
11817
11830
  *
11818
- * @param {Point} [delta] The scroll to be set.
11831
+ * @param {ScrollDelta} [delta] The scroll to be set.
11819
11832
  *
11820
11833
  * @return {Point}
11821
11834
  */
@@ -13186,6 +13199,8 @@
13186
13199
  * var sum = eventBus.fire('sum', 1, 2);
13187
13200
  * console.log(sum); // 3
13188
13201
  * ```
13202
+ *
13203
+ * @template [EventMap=null]
13189
13204
  */
13190
13205
  function EventBus() {
13191
13206
 
@@ -13199,8 +13214,9 @@
13199
13214
  this.on('diagram.destroy', 1, this._destroy, this);
13200
13215
  }
13201
13216
 
13202
-
13203
13217
  /**
13218
+ * @overlord
13219
+ *
13204
13220
  * Register an event listener for events with the given name.
13205
13221
  *
13206
13222
  * The callback will be invoked with `event, ...additionalArguments`
@@ -13219,6 +13235,25 @@
13219
13235
  * @param {EventBusEventCallback<T>} callback
13220
13236
  * @param {any} [that] callback context
13221
13237
  */
13238
+ /**
13239
+ * Register an event listener for events with the given name.
13240
+ *
13241
+ * The callback will be invoked with `event, ...additionalArguments`
13242
+ * that have been passed to {@link EventBus#fire}.
13243
+ *
13244
+ * Returning false from a listener will prevent the events default action
13245
+ * (if any is specified). To stop an event from being processed further in
13246
+ * other listeners execute {@link Event#stopPropagation}.
13247
+ *
13248
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
13249
+ *
13250
+ * @template {keyof EventMap} EventName
13251
+ *
13252
+ * @param {EventName} events to subscribe to
13253
+ * @param {number} [priority=1000] listen priority
13254
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13255
+ * @param {any} [that] callback context
13256
+ */
13222
13257
  EventBus.prototype.on = function(events, priority, callback, that) {
13223
13258
 
13224
13259
  events = isArray$2(events) ? events : [ events ];
@@ -13256,6 +13291,8 @@
13256
13291
  };
13257
13292
 
13258
13293
  /**
13294
+ * @overlord
13295
+ *
13259
13296
  * Register an event listener that is called only once.
13260
13297
  *
13261
13298
  * @template T
@@ -13265,6 +13302,16 @@
13265
13302
  * @param {EventBusEventCallback<T>} callback
13266
13303
  * @param {any} [that] callback context
13267
13304
  */
13305
+ /**
13306
+ * Register an event listener that is called only once.
13307
+ *
13308
+ * @template {keyof EventMap} EventName
13309
+ *
13310
+ * @param {EventName} events to subscribe to
13311
+ * @param {number} [priority=1000] listen priority
13312
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13313
+ * @param {any} [that] callback context
13314
+ */
13268
13315
  EventBus.prototype.once = function(events, priority, callback, that) {
13269
13316
  var self = this;
13270
13317
 
@@ -13990,6 +14037,16 @@
13990
14037
  * } & Record<string, any> } DiagramOptions
13991
14038
  */
13992
14039
 
14040
+ /**
14041
+ * @template T
14042
+ * @typedef {import('didi').FactoryFunction<T>} FactoryFunction
14043
+ */
14044
+
14045
+ /**
14046
+ * @template T
14047
+ * @typedef {import('didi').ArrayFunc<T>} ArrayFunc
14048
+ */
14049
+
13993
14050
  /**
13994
14051
  * Bootstrap an injector from a list of modules, instantiating a number of default components
13995
14052
  *
@@ -14008,9 +14065,10 @@
14008
14065
  /**
14009
14066
  * Creates an injector from passed options.
14010
14067
  *
14068
+ * @template ServiceMap
14011
14069
  * @param {DiagramOptions} [options]
14012
14070
  *
14013
- * @return {Injector}
14071
+ * @return {Injector<ServiceMap>}
14014
14072
  */
14015
14073
  function createInjector(options) {
14016
14074
 
@@ -14037,6 +14095,7 @@
14037
14095
  *
14038
14096
  * @class
14039
14097
  * @constructor
14098
+ * @template [ServiceMap=null]
14040
14099
  *
14041
14100
  * @example Creating a plug-in that logs whenever a shape is added to the canvas.
14042
14101
  *
@@ -14075,44 +14134,17 @@
14075
14134
  * ```
14076
14135
  *
14077
14136
  * @param {DiagramOptions} [options]
14078
- * @param {Injector} [injector] An (optional) injector to bootstrap the diagram with.
14137
+ * @param {Injector<ServiceMap>} [injector] An (optional) injector to bootstrap the diagram with.
14079
14138
  */
14080
14139
  function Diagram(options, injector) {
14081
14140
 
14082
- this._injector = injector = injector || createInjector(options);
14083
-
14084
- // API
14085
-
14086
14141
  /**
14087
- * Resolves a diagram service.
14088
- *
14089
- * @template T
14090
- *
14091
- * @param {string} name The name of the service to get.
14092
- * @param {boolean} [strict=true] If false, resolve missing services to null.
14093
- *
14094
- * @return {T|null}
14095
- */
14096
- this.get = injector.get;
14097
-
14098
- /**
14099
- * Executes a function with its dependencies injected.
14100
- *
14101
- * @template T
14102
- *
14103
- * @param {Function} func function to be invoked
14104
- * @param {InjectionContext} [context] context of the invocation
14105
- * @param {LocalsMap} [locals] locals provided
14106
- *
14107
- * @return {T|null}
14142
+ * @type {Injector<ServiceMap>}
14108
14143
  */
14109
- this.invoke = injector.invoke;
14144
+ this._injector = injector || createInjector(options);
14110
14145
 
14111
14146
  // init
14112
14147
 
14113
- // indicate via event
14114
-
14115
-
14116
14148
  /**
14117
14149
  * An event indicating that all plug-ins are loaded.
14118
14150
  *
@@ -14135,6 +14167,82 @@
14135
14167
  this.get('eventBus').fire('diagram.init');
14136
14168
  }
14137
14169
 
14170
+ /**
14171
+ * @overlord
14172
+ *
14173
+ * Resolves a diagram service.
14174
+ *
14175
+ * @template T
14176
+ *
14177
+ * @param {string} name The name of the service to get.
14178
+ *
14179
+ * @return {T}
14180
+ */
14181
+ /**
14182
+ * @overlord
14183
+ *
14184
+ * Resolves a diagram service.
14185
+ *
14186
+ * @template T
14187
+ *
14188
+ * @param {string} name The name of the service to get.
14189
+ * @param {true} strict If false, resolve missing services to null.
14190
+ *
14191
+ * @return {T}
14192
+ */
14193
+ /**
14194
+ * @overlord
14195
+ *
14196
+ * Resolves a diagram service.
14197
+ *
14198
+ * @template T
14199
+ *
14200
+ * @param {string} name The name of the service to get.
14201
+ * @param {boolean} strict If false, resolve missing services to null.
14202
+ *
14203
+ * @return {T|null}
14204
+ */
14205
+ /**
14206
+ * Resolves a diagram service.
14207
+ *
14208
+ * @template {keyof ServiceMap} Name
14209
+ *
14210
+ * @param {Name} name The name of the service to get.
14211
+ *
14212
+ * @return {ServiceMap[Name]}
14213
+ */
14214
+ Diagram.prototype.get = function(name, strict) {
14215
+ return this._injector.get(name, strict);
14216
+ };
14217
+
14218
+ /**
14219
+ * @overlord
14220
+ *
14221
+ * Invoke the given function, injecting dependencies. Return the result.
14222
+ *
14223
+ * @template T
14224
+ *
14225
+ * @param {FactoryFunction<T>} func
14226
+ * @param {InjectionContext} [context]
14227
+ * @param {LocalsMap} [locals]
14228
+ *
14229
+ * @return {T}
14230
+ */
14231
+ /**
14232
+ * Invoke the given function, injecting dependencies provided in
14233
+ * array notation. Return the result.
14234
+ *
14235
+ * @template T
14236
+ *
14237
+ * @param {ArrayFunc<T>} func function to be invoked
14238
+ * @param {InjectionContext} [context] context of the invocation
14239
+ * @param {LocalsMap} [locals] locals provided
14240
+ *
14241
+ * @return {T}
14242
+ */
14243
+ Diagram.prototype.invoke = function(func, context, locals) {
14244
+ return this._injector.invoke(func, context, locals);
14245
+ };
14138
14246
 
14139
14247
  /**
14140
14248
  * Destroys the diagram
@@ -23559,7 +23667,11 @@
23559
23667
  return true;
23560
23668
  }
23561
23669
 
23562
- return isInput(event.target) && this._isModifiedKeyIgnored(event);
23670
+ return (
23671
+ isInput(event.target) || (
23672
+ isButton(event.target) && isKey([ ' ', 'Enter' ], event)
23673
+ )
23674
+ ) && this._isModifiedKeyIgnored(event);
23563
23675
  };
23564
23676
 
23565
23677
  Keyboard.prototype._isModifiedKeyIgnored = function(event) {
@@ -23670,6 +23782,10 @@
23670
23782
  return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
23671
23783
  }
23672
23784
 
23785
+ function isButton(target) {
23786
+ return target && matches(target, 'button, input[type=submit], input[type=button], a[href], [aria-role=button]');
23787
+ }
23788
+
23673
23789
  var LOW_PRIORITY = 500;
23674
23790
 
23675
23791
 
@@ -24000,7 +24116,7 @@
24000
24116
  }
24001
24117
 
24002
24118
  /**
24003
- * @typedef {import('../core/EventBus').EventBus} EventBus
24119
+ * @typedef {import('../core/EventBus').default} EventBus
24004
24120
  */
24005
24121
 
24006
24122
  var TRAP_PRIORITY = 5000;
@@ -24215,6 +24331,7 @@
24215
24331
  * @typedef {import('../../core/EventBus').default} EventBus
24216
24332
  *
24217
24333
  * @typedef {import('../../util/Types').Point} Point
24334
+ * @typedef {import('../../util/Types').ScrollDelta} ScrollDelta
24218
24335
  */
24219
24336
 
24220
24337
  var sign = Math.sign || function(n) {
@@ -24269,7 +24386,7 @@
24269
24386
  ];
24270
24387
 
24271
24388
  /**
24272
- * @param {Point} delta
24389
+ * @param {ScrollDelta} delta
24273
24390
  */
24274
24391
  ZoomScroll.prototype.scroll = function scroll(delta) {
24275
24392
  this._canvas.scroll(delta);
@@ -24369,7 +24486,7 @@
24369
24486
  * Zoom with fixed step size.
24370
24487
  *
24371
24488
  * @param {number} delta Zoom delta (1 for zooming in, -1 for zooming out).
24372
- * @param {Point} position
24489
+ * @param {Point} [position]
24373
24490
  */
24374
24491
  ZoomScroll.prototype.stepZoom = function stepZoom(delta, position) {
24375
24492
 
@@ -24383,7 +24500,7 @@
24383
24500
  * Zoom in/out given a step size.
24384
24501
  *
24385
24502
  * @param {number} delta
24386
- * @param {Point} position
24503
+ * @param {Point} [position]
24387
24504
  * @param {number} stepSize
24388
24505
  */
24389
24506
  ZoomScroll.prototype._zoom = function(delta, position, stepSize) {