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
  }
@@ -21218,62 +21210,6 @@
21218
21210
  * @typedef {import('../model/Types').ModdleElement} ModdleElement
21219
21211
  */
21220
21212
 
21221
- // TODO(nikku): remove with future bpmn-js version
21222
-
21223
- /**
21224
- * Wraps APIs to check:
21225
- *
21226
- * 1) If a callback is passed -> Warn users about callback deprecation.
21227
- * 2) If Promise class is implemented in current environment.
21228
- *
21229
- * @private
21230
- *
21231
- * @param {Function} api
21232
- *
21233
- * @return {Function}
21234
- */
21235
- function wrapForCompatibility(api) {
21236
-
21237
- return function() {
21238
-
21239
- if (!window.Promise) {
21240
- throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
21241
- }
21242
-
21243
- var argLen = arguments.length;
21244
- if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
21245
-
21246
- var callback = arguments[argLen - 1];
21247
-
21248
- console.warn(new Error(
21249
- 'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
21250
- 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
21251
- ));
21252
-
21253
- var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
21254
-
21255
- api.apply(this, argsWithoutCallback).then(function(result) {
21256
-
21257
- var firstKey = Object.keys(result)[0];
21258
-
21259
- // The APIs we are wrapping all resolve a single item depending on the API.
21260
- // For instance, importXML resolves { warnings } and saveXML returns { xml }.
21261
- // That's why we can call the callback with the first item of result.
21262
- return callback(null, result[firstKey]);
21263
-
21264
- // Passing a second paramter instead of catch because we don't want to
21265
- // catch errors thrown by callback().
21266
- }, function(err) {
21267
-
21268
- return callback(err, err.warnings);
21269
- });
21270
- } else {
21271
-
21272
- return api.apply(this, arguments);
21273
- }
21274
- };
21275
- }
21276
-
21277
21213
 
21278
21214
  // TODO(nikku): remove with future bpmn-js version
21279
21215
 
@@ -22215,28 +22151,7 @@
22215
22151
  const self = this;
22216
22152
 
22217
22153
  function ParseCompleteEvent(data) {
22218
-
22219
- const event = self.get('eventBus').createEvent(data);
22220
-
22221
- // TODO(nikku): remove with future bpmn-js version
22222
- Object.defineProperty(event, 'context', {
22223
- enumerable: true,
22224
- get: function() {
22225
-
22226
- console.warn(new Error(
22227
- 'import.parse.complete <context> is deprecated ' +
22228
- 'and will be removed in future library versions'
22229
- ));
22230
-
22231
- return {
22232
- warnings: data.warnings,
22233
- references: data.references,
22234
- elementsById: data.elementsById
22235
- };
22236
- }
22237
- });
22238
-
22239
- return event;
22154
+ return self.get('eventBus').createEvent(data);
22240
22155
  }
22241
22156
 
22242
22157
  let aggregatedWarnings = [];
@@ -22314,8 +22229,6 @@
22314
22229
  }
22315
22230
  };
22316
22231
 
22317
- BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
22318
-
22319
22232
 
22320
22233
  /**
22321
22234
  * Import parsed definitions and render a BPMN 2.0 diagram.
@@ -22346,8 +22259,6 @@
22346
22259
  return { warnings: result.warnings };
22347
22260
  };
22348
22261
 
22349
- BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
22350
-
22351
22262
 
22352
22263
  /**
22353
22264
  * Open diagram of previously imported XML.
@@ -22409,8 +22320,6 @@
22409
22320
  return { warnings };
22410
22321
  };
22411
22322
 
22412
- BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
22413
-
22414
22323
  /**
22415
22324
  * Export the currently displayed BPMN 2.0 diagram as
22416
22325
  * a BPMN 2.0 XML document.
@@ -22485,8 +22394,6 @@
22485
22394
  return result;
22486
22395
  };
22487
22396
 
22488
- BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
22489
-
22490
22397
 
22491
22398
  /**
22492
22399
  * Export the currently displayed BPMN 2.0 diagram as
@@ -22554,40 +22461,6 @@
22554
22461
  return { svg };
22555
22462
  };
22556
22463
 
22557
- BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
22558
-
22559
- /**
22560
- * Get a named diagram service.
22561
- *
22562
- * @example
22563
- *
22564
- * const elementRegistry = viewer.get('elementRegistry');
22565
- * const startEventShape = elementRegistry.get('StartEvent_1');
22566
- *
22567
- * @param {string} name
22568
- *
22569
- * @return {Object} diagram service instance
22570
- *
22571
- * @method BaseViewer#get
22572
- */
22573
-
22574
- /**
22575
- * Invoke a function in the context of this viewer.
22576
- *
22577
- * @example
22578
- *
22579
- * viewer.invoke(function(elementRegistry) {
22580
- * const startEventShape = elementRegistry.get('StartEvent_1');
22581
- * });
22582
- *
22583
- * @param {Function} fn to be invoked
22584
- *
22585
- * @return {Object} the functions return value
22586
- *
22587
- * @method BaseViewer#invoke
22588
- */
22589
-
22590
-
22591
22464
  BaseViewer.prototype._setDefinitions = function(definitions) {
22592
22465
  this._definitions = definitions;
22593
22466
  };