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
 
@@ -6782,7 +6782,7 @@
6782
6782
  *
6783
6783
  * @return {boolean}
6784
6784
  */
6785
- function isButton(event, button) {
6785
+ function isButton$1(event, button) {
6786
6786
  return (getOriginal(event) || event).button === button;
6787
6787
  }
6788
6788
 
@@ -6794,7 +6794,7 @@
6794
6794
  function isPrimaryButton(event) {
6795
6795
 
6796
6796
  // button === 0 -> left áka primary mouse button
6797
- return isButton(event, 0);
6797
+ return isButton$1(event, 0);
6798
6798
  }
6799
6799
 
6800
6800
  /**
@@ -6805,7 +6805,7 @@
6805
6805
  function isAuxiliaryButton(event) {
6806
6806
 
6807
6807
  // button === 1 -> auxiliary áka wheel button
6808
- return isButton(event, 1);
6808
+ return isButton$1(event, 1);
6809
6809
  }
6810
6810
 
6811
6811
  /**
@@ -7413,6 +7413,7 @@
7413
7413
  /**
7414
7414
  * @typedef {import('../../model/Types').Element} Element
7415
7415
  *
7416
+ * @typedef {import('./OutlineProvider').default} OutlineProvider
7416
7417
  * @typedef {import('../../core/EventBus').default} EventBus
7417
7418
  * @typedef {import('../../draw/Styles').default} Styles
7418
7419
  */
@@ -7571,7 +7572,7 @@
7571
7572
  * Returns the outline for an element.
7572
7573
  *
7573
7574
  * @param {Element} element
7574
- **/
7575
+ */
7575
7576
  Outline.prototype.getOutline = function(element) {
7576
7577
  var outline;
7577
7578
  var providers = this._getProviders();
@@ -8152,7 +8153,7 @@
8152
8153
  }, config && config.defaults);
8153
8154
 
8154
8155
  /**
8155
- * @type {Map<string, Overlay>}
8156
+ * @type {Record<string, Overlay>}
8156
8157
  */
8157
8158
  this._overlays = {};
8158
8159
 
@@ -9977,16 +9978,19 @@
9977
9978
  * @typedef { import('./index.js').ModuleDeclaration } ModuleDeclaration
9978
9979
  * @typedef { import('./index.js').ModuleDefinition } ModuleDefinition
9979
9980
  * @typedef { import('./index.js').InjectorContext } InjectorContext
9981
+ *
9982
+ * @typedef { import('./index.js').TypedDeclaration<any, any> } TypedDeclaration
9980
9983
  */
9981
9984
 
9982
9985
  /**
9983
9986
  * Create a new injector with the given modules.
9984
9987
  *
9985
9988
  * @param {ModuleDefinition[]} modules
9986
- * @param {InjectorContext} [parent]
9989
+ * @param {InjectorContext} [_parent]
9987
9990
  */
9988
- function Injector(modules, parent) {
9989
- parent = parent || {
9991
+ function Injector(modules, _parent) {
9992
+
9993
+ const parent = _parent || /** @type InjectorContext */ ({
9990
9994
  get: function(name, strict) {
9991
9995
  currentlyResolving.push(name);
9992
9996
 
@@ -9996,7 +10000,7 @@
9996
10000
  throw error(`No provider for "${ name }"!`);
9997
10001
  }
9998
10002
  }
9999
- };
10003
+ });
10000
10004
 
10001
10005
  const currentlyResolving = [];
10002
10006
  const providers = this._providers = Object.create(parent._providers || null);
@@ -10019,12 +10023,13 @@
10019
10023
  * @return {any}
10020
10024
  */
10021
10025
  function get(name, strict) {
10022
- if (!providers[name] && name.indexOf('.') !== -1) {
10026
+ if (!providers[name] && name.includes('.')) {
10027
+
10023
10028
  const parts = name.split('.');
10024
- let pivot = get(parts.shift());
10029
+ let pivot = get(/** @type { string } */ (parts.shift()));
10025
10030
 
10026
10031
  while (parts.length) {
10027
- pivot = pivot[parts.shift()];
10032
+ pivot = pivot[/** @type { string } */ (parts.shift())];
10028
10033
  }
10029
10034
 
10030
10035
  return pivot;
@@ -10064,6 +10069,9 @@
10064
10069
  }
10065
10070
  }
10066
10071
 
10072
+ /**
10073
+ * @type {string[]}
10074
+ */
10067
10075
  const inject = fn.$inject || parseAnnotations(fn);
10068
10076
  const dependencies = inject.map(dep => {
10069
10077
  if (hasOwnProp(locals, dep)) {
@@ -10075,7 +10083,7 @@
10075
10083
 
10076
10084
  return {
10077
10085
  fn: fn,
10078
- dependencies: dependencies
10086
+ dependencies
10079
10087
  };
10080
10088
  }
10081
10089
 
@@ -10095,7 +10103,7 @@
10095
10103
  } = fnDef(type);
10096
10104
 
10097
10105
  // instantiate var args constructor
10098
- const Constructor = Function.prototype.bind.apply(fn, [ null ].concat(dependencies));
10106
+ const Constructor = Function.prototype.bind.call(fn, null, ...dependencies);
10099
10107
 
10100
10108
  return new Constructor();
10101
10109
  }
@@ -10275,13 +10283,17 @@
10275
10283
  return;
10276
10284
  }
10277
10285
 
10278
- if (moduleDefinition[key][2] === 'private') {
10279
- providers[key] = moduleDefinition[key];
10286
+ const typeDeclaration = /** @type { TypedDeclaration } */ (
10287
+ moduleDefinition[key]
10288
+ );
10289
+
10290
+ if (typeDeclaration[2] === 'private') {
10291
+ providers[key] = typeDeclaration;
10280
10292
  return;
10281
10293
  }
10282
10294
 
10283
- const type = moduleDefinition[key][0];
10284
- const value = moduleDefinition[key][1];
10295
+ const type = typeDeclaration[0];
10296
+ const value = typeDeclaration[1];
10285
10297
 
10286
10298
  providers[key] = [ factoryMap[type], arrayUnwrap(type, value), type ];
10287
10299
  });
@@ -10669,6 +10681,7 @@
10669
10681
  * @typedef {import('../util/Types').Point} Point
10670
10682
  * @typedef {import('../util/Types').Rect} Rect
10671
10683
  * @typedef {import('../util/Types').RectTRBL} RectTRBL
10684
+ * @typedef {import('../util/Types').ScrollDelta} ScrollDelta
10672
10685
  */
10673
10686
 
10674
10687
  function round(number, resolution) {
@@ -11369,7 +11382,7 @@
11369
11382
  Canvas.prototype.setRootElement = function(rootElement) {
11370
11383
 
11371
11384
  if (rootElement === this._rootElement) {
11372
- return;
11385
+ return rootElement;
11373
11386
  }
11374
11387
 
11375
11388
  let plane;
@@ -11804,7 +11817,7 @@
11804
11817
  /**
11805
11818
  * Gets or sets the scroll of the canvas.
11806
11819
  *
11807
- * @param {Point} [delta] The scroll to be set.
11820
+ * @param {ScrollDelta} [delta] The scroll to be set.
11808
11821
  *
11809
11822
  * @return {Point}
11810
11823
  */
@@ -13175,6 +13188,8 @@
13175
13188
  * var sum = eventBus.fire('sum', 1, 2);
13176
13189
  * console.log(sum); // 3
13177
13190
  * ```
13191
+ *
13192
+ * @template [EventMap=null]
13178
13193
  */
13179
13194
  function EventBus() {
13180
13195
 
@@ -13188,8 +13203,9 @@
13188
13203
  this.on('diagram.destroy', 1, this._destroy, this);
13189
13204
  }
13190
13205
 
13191
-
13192
13206
  /**
13207
+ * @overlord
13208
+ *
13193
13209
  * Register an event listener for events with the given name.
13194
13210
  *
13195
13211
  * The callback will be invoked with `event, ...additionalArguments`
@@ -13208,6 +13224,25 @@
13208
13224
  * @param {EventBusEventCallback<T>} callback
13209
13225
  * @param {any} [that] callback context
13210
13226
  */
13227
+ /**
13228
+ * Register an event listener for events with the given name.
13229
+ *
13230
+ * The callback will be invoked with `event, ...additionalArguments`
13231
+ * that have been passed to {@link EventBus#fire}.
13232
+ *
13233
+ * Returning false from a listener will prevent the events default action
13234
+ * (if any is specified). To stop an event from being processed further in
13235
+ * other listeners execute {@link Event#stopPropagation}.
13236
+ *
13237
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
13238
+ *
13239
+ * @template {keyof EventMap} EventName
13240
+ *
13241
+ * @param {EventName} events to subscribe to
13242
+ * @param {number} [priority=1000] listen priority
13243
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13244
+ * @param {any} [that] callback context
13245
+ */
13211
13246
  EventBus.prototype.on = function(events, priority, callback, that) {
13212
13247
 
13213
13248
  events = isArray$2(events) ? events : [ events ];
@@ -13245,6 +13280,8 @@
13245
13280
  };
13246
13281
 
13247
13282
  /**
13283
+ * @overlord
13284
+ *
13248
13285
  * Register an event listener that is called only once.
13249
13286
  *
13250
13287
  * @template T
@@ -13254,6 +13291,16 @@
13254
13291
  * @param {EventBusEventCallback<T>} callback
13255
13292
  * @param {any} [that] callback context
13256
13293
  */
13294
+ /**
13295
+ * Register an event listener that is called only once.
13296
+ *
13297
+ * @template {keyof EventMap} EventName
13298
+ *
13299
+ * @param {EventName} events to subscribe to
13300
+ * @param {number} [priority=1000] listen priority
13301
+ * @param {EventBusEventCallback<EventMap[EventName]>} callback
13302
+ * @param {any} [that] callback context
13303
+ */
13257
13304
  EventBus.prototype.once = function(events, priority, callback, that) {
13258
13305
  var self = this;
13259
13306
 
@@ -13979,6 +14026,16 @@
13979
14026
  * } & Record<string, any> } DiagramOptions
13980
14027
  */
13981
14028
 
14029
+ /**
14030
+ * @template T
14031
+ * @typedef {import('didi').FactoryFunction<T>} FactoryFunction
14032
+ */
14033
+
14034
+ /**
14035
+ * @template T
14036
+ * @typedef {import('didi').ArrayFunc<T>} ArrayFunc
14037
+ */
14038
+
13982
14039
  /**
13983
14040
  * Bootstrap an injector from a list of modules, instantiating a number of default components
13984
14041
  *
@@ -13997,9 +14054,10 @@
13997
14054
  /**
13998
14055
  * Creates an injector from passed options.
13999
14056
  *
14057
+ * @template ServiceMap
14000
14058
  * @param {DiagramOptions} [options]
14001
14059
  *
14002
- * @return {Injector}
14060
+ * @return {Injector<ServiceMap>}
14003
14061
  */
14004
14062
  function createInjector(options) {
14005
14063
 
@@ -14026,6 +14084,7 @@
14026
14084
  *
14027
14085
  * @class
14028
14086
  * @constructor
14087
+ * @template [ServiceMap=null]
14029
14088
  *
14030
14089
  * @example Creating a plug-in that logs whenever a shape is added to the canvas.
14031
14090
  *
@@ -14064,44 +14123,17 @@
14064
14123
  * ```
14065
14124
  *
14066
14125
  * @param {DiagramOptions} [options]
14067
- * @param {Injector} [injector] An (optional) injector to bootstrap the diagram with.
14126
+ * @param {Injector<ServiceMap>} [injector] An (optional) injector to bootstrap the diagram with.
14068
14127
  */
14069
14128
  function Diagram(options, injector) {
14070
14129
 
14071
- this._injector = injector = injector || createInjector(options);
14072
-
14073
- // API
14074
-
14075
14130
  /**
14076
- * Resolves a diagram service.
14077
- *
14078
- * @template T
14079
- *
14080
- * @param {string} name The name of the service to get.
14081
- * @param {boolean} [strict=true] If false, resolve missing services to null.
14082
- *
14083
- * @return {T|null}
14084
- */
14085
- this.get = injector.get;
14086
-
14087
- /**
14088
- * Executes a function with its dependencies injected.
14089
- *
14090
- * @template T
14091
- *
14092
- * @param {Function} func function to be invoked
14093
- * @param {InjectionContext} [context] context of the invocation
14094
- * @param {LocalsMap} [locals] locals provided
14095
- *
14096
- * @return {T|null}
14131
+ * @type {Injector<ServiceMap>}
14097
14132
  */
14098
- this.invoke = injector.invoke;
14133
+ this._injector = injector || createInjector(options);
14099
14134
 
14100
14135
  // init
14101
14136
 
14102
- // indicate via event
14103
-
14104
-
14105
14137
  /**
14106
14138
  * An event indicating that all plug-ins are loaded.
14107
14139
  *
@@ -14124,6 +14156,82 @@
14124
14156
  this.get('eventBus').fire('diagram.init');
14125
14157
  }
14126
14158
 
14159
+ /**
14160
+ * @overlord
14161
+ *
14162
+ * Resolves a diagram service.
14163
+ *
14164
+ * @template T
14165
+ *
14166
+ * @param {string} name The name of the service to get.
14167
+ *
14168
+ * @return {T}
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
+ * @param {true} strict If false, resolve missing services to null.
14179
+ *
14180
+ * @return {T}
14181
+ */
14182
+ /**
14183
+ * @overlord
14184
+ *
14185
+ * Resolves a diagram service.
14186
+ *
14187
+ * @template T
14188
+ *
14189
+ * @param {string} name The name of the service to get.
14190
+ * @param {boolean} strict If false, resolve missing services to null.
14191
+ *
14192
+ * @return {T|null}
14193
+ */
14194
+ /**
14195
+ * Resolves a diagram service.
14196
+ *
14197
+ * @template {keyof ServiceMap} Name
14198
+ *
14199
+ * @param {Name} name The name of the service to get.
14200
+ *
14201
+ * @return {ServiceMap[Name]}
14202
+ */
14203
+ Diagram.prototype.get = function(name, strict) {
14204
+ return this._injector.get(name, strict);
14205
+ };
14206
+
14207
+ /**
14208
+ * @overlord
14209
+ *
14210
+ * Invoke the given function, injecting dependencies. Return the result.
14211
+ *
14212
+ * @template T
14213
+ *
14214
+ * @param {FactoryFunction<T>} func
14215
+ * @param {InjectionContext} [context]
14216
+ * @param {LocalsMap} [locals]
14217
+ *
14218
+ * @return {T}
14219
+ */
14220
+ /**
14221
+ * Invoke the given function, injecting dependencies provided in
14222
+ * array notation. Return the result.
14223
+ *
14224
+ * @template T
14225
+ *
14226
+ * @param {ArrayFunc<T>} func function to be invoked
14227
+ * @param {InjectionContext} [context] context of the invocation
14228
+ * @param {LocalsMap} [locals] locals provided
14229
+ *
14230
+ * @return {T}
14231
+ */
14232
+ Diagram.prototype.invoke = function(func, context, locals) {
14233
+ return this._injector.invoke(func, context, locals);
14234
+ };
14127
14235
 
14128
14236
  /**
14129
14237
  * Destroys the diagram
@@ -23548,7 +23656,11 @@
23548
23656
  return true;
23549
23657
  }
23550
23658
 
23551
- return isInput(event.target) && this._isModifiedKeyIgnored(event);
23659
+ return (
23660
+ isInput(event.target) || (
23661
+ isButton(event.target) && isKey([ ' ', 'Enter' ], event)
23662
+ )
23663
+ ) && this._isModifiedKeyIgnored(event);
23552
23664
  };
23553
23665
 
23554
23666
  Keyboard.prototype._isModifiedKeyIgnored = function(event) {
@@ -23659,6 +23771,10 @@
23659
23771
  return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
23660
23772
  }
23661
23773
 
23774
+ function isButton(target) {
23775
+ return target && matches(target, 'button, input[type=submit], input[type=button], a[href], [aria-role=button]');
23776
+ }
23777
+
23662
23778
  var LOW_PRIORITY = 500;
23663
23779
 
23664
23780
 
@@ -23989,7 +24105,7 @@
23989
24105
  }
23990
24106
 
23991
24107
  /**
23992
- * @typedef {import('../core/EventBus').EventBus} EventBus
24108
+ * @typedef {import('../core/EventBus').default} EventBus
23993
24109
  */
23994
24110
 
23995
24111
  var TRAP_PRIORITY = 5000;
@@ -24204,6 +24320,7 @@
24204
24320
  * @typedef {import('../../core/EventBus').default} EventBus
24205
24321
  *
24206
24322
  * @typedef {import('../../util/Types').Point} Point
24323
+ * @typedef {import('../../util/Types').ScrollDelta} ScrollDelta
24207
24324
  */
24208
24325
 
24209
24326
  var sign = Math.sign || function(n) {
@@ -24258,7 +24375,7 @@
24258
24375
  ];
24259
24376
 
24260
24377
  /**
24261
- * @param {Point} delta
24378
+ * @param {ScrollDelta} delta
24262
24379
  */
24263
24380
  ZoomScroll.prototype.scroll = function scroll(delta) {
24264
24381
  this._canvas.scroll(delta);
@@ -24358,7 +24475,7 @@
24358
24475
  * Zoom with fixed step size.
24359
24476
  *
24360
24477
  * @param {number} delta Zoom delta (1 for zooming in, -1 for zooming out).
24361
- * @param {Point} position
24478
+ * @param {Point} [position]
24362
24479
  */
24363
24480
  ZoomScroll.prototype.stepZoom = function stepZoom(delta, position) {
24364
24481
 
@@ -24372,7 +24489,7 @@
24372
24489
  * Zoom in/out given a step size.
24373
24490
  *
24374
24491
  * @param {number} delta
24375
- * @param {Point} position
24492
+ * @param {Point} [position]
24376
24493
  * @param {number} stepSize
24377
24494
  */
24378
24495
  ZoomScroll.prototype._zoom = function(delta, position, stepSize) {