bpmn-js 13.2.1 → 14.0.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-navigated-viewer v13.2.1
2
+ * bpmn-js - bpmn-navigated-viewer v14.0.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2023-07-03
11
+ * Date: 2023-08-30
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2587,8 +2587,9 @@
2587
2587
  transform$1(gfx, rotate);
2588
2588
  }
2589
2589
 
2590
- function createCommonjsModule(fn, module) {
2591
- return module = { exports: {} }, fn(module, module.exports), module.exports;
2590
+ function createCommonjsModule(fn) {
2591
+ var module = { exports: {} };
2592
+ return fn(module, module.exports), module.exports;
2592
2593
  }
2593
2594
 
2594
2595
  var hat_1 = createCommonjsModule(function (module) {
@@ -2656,22 +2657,25 @@
2656
2657
  };
2657
2658
  });
2658
2659
 
2660
+ /**
2661
+ * @typedef { [ number, number ] | [ number, number, number ] } Seed
2662
+ */
2663
+
2659
2664
  /**
2660
2665
  * Create a new id generator / cache instance.
2661
2666
  *
2662
2667
  * You may optionally provide a seed that is used internally.
2663
2668
  *
2664
- * @param {Seed} seed
2669
+ * @param {Seed} [seed]
2665
2670
  */
2666
-
2667
2671
  function Ids(seed) {
2668
2672
  if (!(this instanceof Ids)) {
2669
2673
  return new Ids(seed);
2670
2674
  }
2671
-
2672
2675
  seed = seed || [128, 36, 1];
2673
2676
  this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
2674
2677
  }
2678
+
2675
2679
  /**
2676
2680
  * Generate a next id.
2677
2681
  *
@@ -2679,10 +2683,10 @@
2679
2683
  *
2680
2684
  * @return {String} id
2681
2685
  */
2682
-
2683
2686
  Ids.prototype.next = function (element) {
2684
2687
  return this._seed(element || true);
2685
2688
  };
2689
+
2686
2690
  /**
2687
2691
  * Generate a next id with a given prefix.
2688
2692
  *
@@ -2690,61 +2694,54 @@
2690
2694
  *
2691
2695
  * @return {String} id
2692
2696
  */
2693
-
2694
-
2695
2697
  Ids.prototype.nextPrefixed = function (prefix, element) {
2696
2698
  var id;
2697
-
2698
2699
  do {
2699
2700
  id = prefix + this.next(true);
2700
- } while (this.assigned(id)); // claim {prefix}{random}
2701
-
2701
+ } while (this.assigned(id));
2702
2702
 
2703
- this.claim(id, element); // return
2703
+ // claim {prefix}{random}
2704
+ this.claim(id, element);
2704
2705
 
2706
+ // return
2705
2707
  return id;
2706
2708
  };
2709
+
2707
2710
  /**
2708
2711
  * Manually claim an existing id.
2709
2712
  *
2710
2713
  * @param {String} id
2711
2714
  * @param {String} [element] element the id is claimed by
2712
2715
  */
2713
-
2714
-
2715
2716
  Ids.prototype.claim = function (id, element) {
2716
2717
  this._seed.set(id, element || true);
2717
2718
  };
2719
+
2718
2720
  /**
2719
2721
  * Returns true if the given id has already been assigned.
2720
2722
  *
2721
2723
  * @param {String} id
2722
2724
  * @return {Boolean}
2723
2725
  */
2724
-
2725
-
2726
2726
  Ids.prototype.assigned = function (id) {
2727
2727
  return this._seed.get(id) || false;
2728
2728
  };
2729
+
2729
2730
  /**
2730
2731
  * Unclaim an id.
2731
2732
  *
2732
2733
  * @param {String} id the id to unclaim
2733
2734
  */
2734
-
2735
-
2736
2735
  Ids.prototype.unclaim = function (id) {
2737
2736
  delete this._seed.hats[id];
2738
2737
  };
2738
+
2739
2739
  /**
2740
2740
  * Clear all claimed ids.
2741
2741
  */
2742
-
2743
-
2744
2742
  Ids.prototype.clear = function () {
2745
2743
  var hats = this._seed.hats,
2746
- id;
2747
-
2744
+ id;
2748
2745
  for (id in hats) {
2749
2746
  this.unclaim(id);
2750
2747
  }
@@ -10313,9 +10310,9 @@
10313
10310
 
10314
10311
  const viewport = this._viewport = createGroup(svg, 'viewport');
10315
10312
 
10316
- // debounce canvas.viewbox.changed events
10317
- // for smoother diagram interaction
10318
- if (config.deferUpdate !== false) {
10313
+ // debounce canvas.viewbox.changed events when deferUpdate is set
10314
+ // to help with potential performance issues
10315
+ if (config.deferUpdate) {
10319
10316
  this._viewboxChanged = debounce(bind$2(this._viewboxChanged, this), 300);
10320
10317
  }
10321
10318
 
@@ -11339,6 +11336,11 @@
11339
11336
  this.setRootElement(rootElement);
11340
11337
  }
11341
11338
 
11339
+ // element is rootElement, do not change viewport
11340
+ if (rootElement === element) {
11341
+ return;
11342
+ }
11343
+
11342
11344
  if (!padding) {
11343
11345
  padding = {};
11344
11346
  }
@@ -18384,7 +18386,6 @@
18384
18386
  {
18385
18387
  name: "target",
18386
18388
  type: "LinkEventDefinition",
18387
- isAttr: true,
18388
18389
  isReference: true
18389
18390
  },
18390
18391
  {
@@ -21215,62 +21216,6 @@
21215
21216
  * @typedef {import('../model/Types').ModdleElement} ModdleElement
21216
21217
  */
21217
21218
 
21218
- // TODO(nikku): remove with future bpmn-js version
21219
-
21220
- /**
21221
- * Wraps APIs to check:
21222
- *
21223
- * 1) If a callback is passed -> Warn users about callback deprecation.
21224
- * 2) If Promise class is implemented in current environment.
21225
- *
21226
- * @private
21227
- *
21228
- * @param {Function} api
21229
- *
21230
- * @return {Function}
21231
- */
21232
- function wrapForCompatibility(api) {
21233
-
21234
- return function() {
21235
-
21236
- if (!window.Promise) {
21237
- throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
21238
- }
21239
-
21240
- var argLen = arguments.length;
21241
- if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
21242
-
21243
- var callback = arguments[argLen - 1];
21244
-
21245
- console.warn(new Error(
21246
- 'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
21247
- 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
21248
- ));
21249
-
21250
- var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
21251
-
21252
- api.apply(this, argsWithoutCallback).then(function(result) {
21253
-
21254
- var firstKey = Object.keys(result)[0];
21255
-
21256
- // The APIs we are wrapping all resolve a single item depending on the API.
21257
- // For instance, importXML resolves { warnings } and saveXML returns { xml }.
21258
- // That's why we can call the callback with the first item of result.
21259
- return callback(null, result[firstKey]);
21260
-
21261
- // Passing a second paramter instead of catch because we don't want to
21262
- // catch errors thrown by callback().
21263
- }, function(err) {
21264
-
21265
- return callback(err, err.warnings);
21266
- });
21267
- } else {
21268
-
21269
- return api.apply(this, arguments);
21270
- }
21271
- };
21272
- }
21273
-
21274
21219
 
21275
21220
  // TODO(nikku): remove with future bpmn-js version
21276
21221
 
@@ -22212,28 +22157,7 @@
22212
22157
  const self = this;
22213
22158
 
22214
22159
  function ParseCompleteEvent(data) {
22215
-
22216
- const event = self.get('eventBus').createEvent(data);
22217
-
22218
- // TODO(nikku): remove with future bpmn-js version
22219
- Object.defineProperty(event, 'context', {
22220
- enumerable: true,
22221
- get: function() {
22222
-
22223
- console.warn(new Error(
22224
- 'import.parse.complete <context> is deprecated ' +
22225
- 'and will be removed in future library versions'
22226
- ));
22227
-
22228
- return {
22229
- warnings: data.warnings,
22230
- references: data.references,
22231
- elementsById: data.elementsById
22232
- };
22233
- }
22234
- });
22235
-
22236
- return event;
22160
+ return self.get('eventBus').createEvent(data);
22237
22161
  }
22238
22162
 
22239
22163
  let aggregatedWarnings = [];
@@ -22311,8 +22235,6 @@
22311
22235
  }
22312
22236
  };
22313
22237
 
22314
- BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
22315
-
22316
22238
 
22317
22239
  /**
22318
22240
  * Import parsed definitions and render a BPMN 2.0 diagram.
@@ -22343,8 +22265,6 @@
22343
22265
  return { warnings: result.warnings };
22344
22266
  };
22345
22267
 
22346
- BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
22347
-
22348
22268
 
22349
22269
  /**
22350
22270
  * Open diagram of previously imported XML.
@@ -22406,8 +22326,6 @@
22406
22326
  return { warnings };
22407
22327
  };
22408
22328
 
22409
- BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
22410
-
22411
22329
  /**
22412
22330
  * Export the currently displayed BPMN 2.0 diagram as
22413
22331
  * a BPMN 2.0 XML document.
@@ -22482,8 +22400,6 @@
22482
22400
  return result;
22483
22401
  };
22484
22402
 
22485
- BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
22486
-
22487
22403
 
22488
22404
  /**
22489
22405
  * Export the currently displayed BPMN 2.0 diagram as
@@ -22551,40 +22467,6 @@
22551
22467
  return { svg };
22552
22468
  };
22553
22469
 
22554
- BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
22555
-
22556
- /**
22557
- * Get a named diagram service.
22558
- *
22559
- * @example
22560
- *
22561
- * const elementRegistry = viewer.get('elementRegistry');
22562
- * const startEventShape = elementRegistry.get('StartEvent_1');
22563
- *
22564
- * @param {string} name
22565
- *
22566
- * @return {Object} diagram service instance
22567
- *
22568
- * @method BaseViewer#get
22569
- */
22570
-
22571
- /**
22572
- * Invoke a function in the context of this viewer.
22573
- *
22574
- * @example
22575
- *
22576
- * viewer.invoke(function(elementRegistry) {
22577
- * const startEventShape = elementRegistry.get('StartEvent_1');
22578
- * });
22579
- *
22580
- * @param {Function} fn to be invoked
22581
- *
22582
- * @return {Object} the functions return value
22583
- *
22584
- * @method BaseViewer#invoke
22585
- */
22586
-
22587
-
22588
22470
  BaseViewer.prototype._setDefinitions = function(definitions) {
22589
22471
  this._definitions = definitions;
22590
22472
  };