camunda-bpmn-js 3.2.0 → 3.3.1

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.
@@ -2662,15 +2662,14 @@
2662
2662
  *
2663
2663
  * @param {Seed} seed
2664
2664
  */
2665
-
2666
2665
  function Ids(seed) {
2667
2666
  if (!(this instanceof Ids)) {
2668
2667
  return new Ids(seed);
2669
2668
  }
2670
-
2671
2669
  seed = seed || [128, 36, 1];
2672
2670
  this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
2673
2671
  }
2672
+
2674
2673
  /**
2675
2674
  * Generate a next id.
2676
2675
  *
@@ -2678,10 +2677,10 @@
2678
2677
  *
2679
2678
  * @return {String} id
2680
2679
  */
2681
-
2682
2680
  Ids.prototype.next = function (element) {
2683
2681
  return this._seed(element || true);
2684
2682
  };
2683
+
2685
2684
  /**
2686
2685
  * Generate a next id with a given prefix.
2687
2686
  *
@@ -2689,61 +2688,54 @@
2689
2688
  *
2690
2689
  * @return {String} id
2691
2690
  */
2692
-
2693
-
2694
2691
  Ids.prototype.nextPrefixed = function (prefix, element) {
2695
2692
  var id;
2696
-
2697
2693
  do {
2698
2694
  id = prefix + this.next(true);
2699
- } while (this.assigned(id)); // claim {prefix}{random}
2700
-
2695
+ } while (this.assigned(id));
2701
2696
 
2702
- this.claim(id, element); // return
2697
+ // claim {prefix}{random}
2698
+ this.claim(id, element);
2703
2699
 
2700
+ // return
2704
2701
  return id;
2705
2702
  };
2703
+
2706
2704
  /**
2707
2705
  * Manually claim an existing id.
2708
2706
  *
2709
2707
  * @param {String} id
2710
2708
  * @param {String} [element] element the id is claimed by
2711
2709
  */
2712
-
2713
-
2714
2710
  Ids.prototype.claim = function (id, element) {
2715
2711
  this._seed.set(id, element || true);
2716
2712
  };
2713
+
2717
2714
  /**
2718
2715
  * Returns true if the given id has already been assigned.
2719
2716
  *
2720
2717
  * @param {String} id
2721
2718
  * @return {Boolean}
2722
2719
  */
2723
-
2724
-
2725
2720
  Ids.prototype.assigned = function (id) {
2726
2721
  return this._seed.get(id) || false;
2727
2722
  };
2723
+
2728
2724
  /**
2729
2725
  * Unclaim an id.
2730
2726
  *
2731
2727
  * @param {String} id the id to unclaim
2732
2728
  */
2733
-
2734
-
2735
2729
  Ids.prototype.unclaim = function (id) {
2736
2730
  delete this._seed.hats[id];
2737
2731
  };
2732
+
2738
2733
  /**
2739
2734
  * Clear all claimed ids.
2740
2735
  */
2741
-
2742
-
2743
2736
  Ids.prototype.clear = function () {
2744
2737
  var hats = this._seed.hats,
2745
- id;
2746
-
2738
+ id;
2747
2739
  for (id in hats) {
2748
2740
  this.unclaim(id);
2749
2741
  }
@@ -21197,62 +21189,6 @@
21197
21189
  * @typedef {import('../model/Types').ModdleElement} ModdleElement
21198
21190
  */
21199
21191
 
21200
- // TODO(nikku): remove with future bpmn-js version
21201
-
21202
- /**
21203
- * Wraps APIs to check:
21204
- *
21205
- * 1) If a callback is passed -> Warn users about callback deprecation.
21206
- * 2) If Promise class is implemented in current environment.
21207
- *
21208
- * @private
21209
- *
21210
- * @param {Function} api
21211
- *
21212
- * @return {Function}
21213
- */
21214
- function wrapForCompatibility(api) {
21215
-
21216
- return function() {
21217
-
21218
- if (!window.Promise) {
21219
- throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
21220
- }
21221
-
21222
- var argLen = arguments.length;
21223
- if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
21224
-
21225
- var callback = arguments[argLen - 1];
21226
-
21227
- console.warn(new Error(
21228
- 'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
21229
- 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
21230
- ));
21231
-
21232
- var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
21233
-
21234
- api.apply(this, argsWithoutCallback).then(function(result) {
21235
-
21236
- var firstKey = Object.keys(result)[0];
21237
-
21238
- // The APIs we are wrapping all resolve a single item depending on the API.
21239
- // For instance, importXML resolves { warnings } and saveXML returns { xml }.
21240
- // That's why we can call the callback with the first item of result.
21241
- return callback(null, result[firstKey]);
21242
-
21243
- // Passing a second paramter instead of catch because we don't want to
21244
- // catch errors thrown by callback().
21245
- }, function(err) {
21246
-
21247
- return callback(err, err.warnings);
21248
- });
21249
- } else {
21250
-
21251
- return api.apply(this, arguments);
21252
- }
21253
- };
21254
- }
21255
-
21256
21192
 
21257
21193
  // TODO(nikku): remove with future bpmn-js version
21258
21194
 
@@ -22194,28 +22130,7 @@
22194
22130
  const self = this;
22195
22131
 
22196
22132
  function ParseCompleteEvent(data) {
22197
-
22198
- const event = self.get('eventBus').createEvent(data);
22199
-
22200
- // TODO(nikku): remove with future bpmn-js version
22201
- Object.defineProperty(event, 'context', {
22202
- enumerable: true,
22203
- get: function() {
22204
-
22205
- console.warn(new Error(
22206
- 'import.parse.complete <context> is deprecated ' +
22207
- 'and will be removed in future library versions'
22208
- ));
22209
-
22210
- return {
22211
- warnings: data.warnings,
22212
- references: data.references,
22213
- elementsById: data.elementsById
22214
- };
22215
- }
22216
- });
22217
-
22218
- return event;
22133
+ return self.get('eventBus').createEvent(data);
22219
22134
  }
22220
22135
 
22221
22136
  let aggregatedWarnings = [];
@@ -22293,8 +22208,6 @@
22293
22208
  }
22294
22209
  };
22295
22210
 
22296
- BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
22297
-
22298
22211
 
22299
22212
  /**
22300
22213
  * Import parsed definitions and render a BPMN 2.0 diagram.
@@ -22325,8 +22238,6 @@
22325
22238
  return { warnings: result.warnings };
22326
22239
  };
22327
22240
 
22328
- BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
22329
-
22330
22241
 
22331
22242
  /**
22332
22243
  * Open diagram of previously imported XML.
@@ -22388,8 +22299,6 @@
22388
22299
  return { warnings };
22389
22300
  };
22390
22301
 
22391
- BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
22392
-
22393
22302
  /**
22394
22303
  * Export the currently displayed BPMN 2.0 diagram as
22395
22304
  * a BPMN 2.0 XML document.
@@ -22464,8 +22373,6 @@
22464
22373
  return result;
22465
22374
  };
22466
22375
 
22467
- BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
22468
-
22469
22376
 
22470
22377
  /**
22471
22378
  * Export the currently displayed BPMN 2.0 diagram as
@@ -22533,40 +22440,6 @@
22533
22440
  return { svg };
22534
22441
  };
22535
22442
 
22536
- BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
22537
-
22538
- /**
22539
- * Get a named diagram service.
22540
- *
22541
- * @example
22542
- *
22543
- * const elementRegistry = viewer.get('elementRegistry');
22544
- * const startEventShape = elementRegistry.get('StartEvent_1');
22545
- *
22546
- * @param {string} name
22547
- *
22548
- * @return {Object} diagram service instance
22549
- *
22550
- * @method BaseViewer#get
22551
- */
22552
-
22553
- /**
22554
- * Invoke a function in the context of this viewer.
22555
- *
22556
- * @example
22557
- *
22558
- * viewer.invoke(function(elementRegistry) {
22559
- * const startEventShape = elementRegistry.get('StartEvent_1');
22560
- * });
22561
- *
22562
- * @param {Function} fn to be invoked
22563
- *
22564
- * @return {Object} the functions return value
22565
- *
22566
- * @method BaseViewer#invoke
22567
- */
22568
-
22569
-
22570
22443
  BaseViewer.prototype._setDefinitions = function(definitions) {
22571
22444
  this._definitions = definitions;
22572
22445
  };