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.
@@ -2651,15 +2651,14 @@
2651
2651
  *
2652
2652
  * @param {Seed} seed
2653
2653
  */
2654
-
2655
2654
  function Ids(seed) {
2656
2655
  if (!(this instanceof Ids)) {
2657
2656
  return new Ids(seed);
2658
2657
  }
2659
-
2660
2658
  seed = seed || [128, 36, 1];
2661
2659
  this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
2662
2660
  }
2661
+
2663
2662
  /**
2664
2663
  * Generate a next id.
2665
2664
  *
@@ -2667,10 +2666,10 @@
2667
2666
  *
2668
2667
  * @return {String} id
2669
2668
  */
2670
-
2671
2669
  Ids.prototype.next = function (element) {
2672
2670
  return this._seed(element || true);
2673
2671
  };
2672
+
2674
2673
  /**
2675
2674
  * Generate a next id with a given prefix.
2676
2675
  *
@@ -2678,61 +2677,54 @@
2678
2677
  *
2679
2678
  * @return {String} id
2680
2679
  */
2681
-
2682
-
2683
2680
  Ids.prototype.nextPrefixed = function (prefix, element) {
2684
2681
  var id;
2685
-
2686
2682
  do {
2687
2683
  id = prefix + this.next(true);
2688
- } while (this.assigned(id)); // claim {prefix}{random}
2689
-
2684
+ } while (this.assigned(id));
2690
2685
 
2691
- this.claim(id, element); // return
2686
+ // claim {prefix}{random}
2687
+ this.claim(id, element);
2692
2688
 
2689
+ // return
2693
2690
  return id;
2694
2691
  };
2692
+
2695
2693
  /**
2696
2694
  * Manually claim an existing id.
2697
2695
  *
2698
2696
  * @param {String} id
2699
2697
  * @param {String} [element] element the id is claimed by
2700
2698
  */
2701
-
2702
-
2703
2699
  Ids.prototype.claim = function (id, element) {
2704
2700
  this._seed.set(id, element || true);
2705
2701
  };
2702
+
2706
2703
  /**
2707
2704
  * Returns true if the given id has already been assigned.
2708
2705
  *
2709
2706
  * @param {String} id
2710
2707
  * @return {Boolean}
2711
2708
  */
2712
-
2713
-
2714
2709
  Ids.prototype.assigned = function (id) {
2715
2710
  return this._seed.get(id) || false;
2716
2711
  };
2712
+
2717
2713
  /**
2718
2714
  * Unclaim an id.
2719
2715
  *
2720
2716
  * @param {String} id the id to unclaim
2721
2717
  */
2722
-
2723
-
2724
2718
  Ids.prototype.unclaim = function (id) {
2725
2719
  delete this._seed.hats[id];
2726
2720
  };
2721
+
2727
2722
  /**
2728
2723
  * Clear all claimed ids.
2729
2724
  */
2730
-
2731
-
2732
2725
  Ids.prototype.clear = function () {
2733
2726
  var hats = this._seed.hats,
2734
- id;
2735
-
2727
+ id;
2736
2728
  for (id in hats) {
2737
2729
  this.unclaim(id);
2738
2730
  }
@@ -21207,62 +21199,6 @@
21207
21199
  * @typedef {import('../model/Types').ModdleElement} ModdleElement
21208
21200
  */
21209
21201
 
21210
- // TODO(nikku): remove with future bpmn-js version
21211
-
21212
- /**
21213
- * Wraps APIs to check:
21214
- *
21215
- * 1) If a callback is passed -> Warn users about callback deprecation.
21216
- * 2) If Promise class is implemented in current environment.
21217
- *
21218
- * @private
21219
- *
21220
- * @param {Function} api
21221
- *
21222
- * @return {Function}
21223
- */
21224
- function wrapForCompatibility(api) {
21225
-
21226
- return function() {
21227
-
21228
- if (!window.Promise) {
21229
- throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
21230
- }
21231
-
21232
- var argLen = arguments.length;
21233
- if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
21234
-
21235
- var callback = arguments[argLen - 1];
21236
-
21237
- console.warn(new Error(
21238
- 'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
21239
- 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
21240
- ));
21241
-
21242
- var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
21243
-
21244
- api.apply(this, argsWithoutCallback).then(function(result) {
21245
-
21246
- var firstKey = Object.keys(result)[0];
21247
-
21248
- // The APIs we are wrapping all resolve a single item depending on the API.
21249
- // For instance, importXML resolves { warnings } and saveXML returns { xml }.
21250
- // That's why we can call the callback with the first item of result.
21251
- return callback(null, result[firstKey]);
21252
-
21253
- // Passing a second paramter instead of catch because we don't want to
21254
- // catch errors thrown by callback().
21255
- }, function(err) {
21256
-
21257
- return callback(err, err.warnings);
21258
- });
21259
- } else {
21260
-
21261
- return api.apply(this, arguments);
21262
- }
21263
- };
21264
- }
21265
-
21266
21202
 
21267
21203
  // TODO(nikku): remove with future bpmn-js version
21268
21204
 
@@ -22204,28 +22140,7 @@
22204
22140
  const self = this;
22205
22141
 
22206
22142
  function ParseCompleteEvent(data) {
22207
-
22208
- const event = self.get('eventBus').createEvent(data);
22209
-
22210
- // TODO(nikku): remove with future bpmn-js version
22211
- Object.defineProperty(event, 'context', {
22212
- enumerable: true,
22213
- get: function() {
22214
-
22215
- console.warn(new Error(
22216
- 'import.parse.complete <context> is deprecated ' +
22217
- 'and will be removed in future library versions'
22218
- ));
22219
-
22220
- return {
22221
- warnings: data.warnings,
22222
- references: data.references,
22223
- elementsById: data.elementsById
22224
- };
22225
- }
22226
- });
22227
-
22228
- return event;
22143
+ return self.get('eventBus').createEvent(data);
22229
22144
  }
22230
22145
 
22231
22146
  let aggregatedWarnings = [];
@@ -22303,8 +22218,6 @@
22303
22218
  }
22304
22219
  };
22305
22220
 
22306
- BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
22307
-
22308
22221
 
22309
22222
  /**
22310
22223
  * Import parsed definitions and render a BPMN 2.0 diagram.
@@ -22335,8 +22248,6 @@
22335
22248
  return { warnings: result.warnings };
22336
22249
  };
22337
22250
 
22338
- BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
22339
-
22340
22251
 
22341
22252
  /**
22342
22253
  * Open diagram of previously imported XML.
@@ -22398,8 +22309,6 @@
22398
22309
  return { warnings };
22399
22310
  };
22400
22311
 
22401
- BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
22402
-
22403
22312
  /**
22404
22313
  * Export the currently displayed BPMN 2.0 diagram as
22405
22314
  * a BPMN 2.0 XML document.
@@ -22474,8 +22383,6 @@
22474
22383
  return result;
22475
22384
  };
22476
22385
 
22477
- BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
22478
-
22479
22386
 
22480
22387
  /**
22481
22388
  * Export the currently displayed BPMN 2.0 diagram as
@@ -22543,40 +22450,6 @@
22543
22450
  return { svg };
22544
22451
  };
22545
22452
 
22546
- BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
22547
-
22548
- /**
22549
- * Get a named diagram service.
22550
- *
22551
- * @example
22552
- *
22553
- * const elementRegistry = viewer.get('elementRegistry');
22554
- * const startEventShape = elementRegistry.get('StartEvent_1');
22555
- *
22556
- * @param {string} name
22557
- *
22558
- * @return {Object} diagram service instance
22559
- *
22560
- * @method BaseViewer#get
22561
- */
22562
-
22563
- /**
22564
- * Invoke a function in the context of this viewer.
22565
- *
22566
- * @example
22567
- *
22568
- * viewer.invoke(function(elementRegistry) {
22569
- * const startEventShape = elementRegistry.get('StartEvent_1');
22570
- * });
22571
- *
22572
- * @param {Function} fn to be invoked
22573
- *
22574
- * @return {Object} the functions return value
22575
- *
22576
- * @method BaseViewer#invoke
22577
- */
22578
-
22579
-
22580
22453
  BaseViewer.prototype._setDefinitions = function(definitions) {
22581
22454
  this._definitions = definitions;
22582
22455
  };