camunda-bpmn-js 3.11.0 → 3.12.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.
Files changed (34) hide show
  1. package/dist/assets/properties-panel.css +0 -4
  2. package/dist/base-modeler.development.js +1490 -1047
  3. package/dist/base-modeler.production.min.js +33 -33
  4. package/dist/base-navigated-viewer.development.js +176 -105
  5. package/dist/base-navigated-viewer.production.min.js +1 -1
  6. package/dist/base-viewer.development.js +176 -105
  7. package/dist/base-viewer.production.min.js +1 -1
  8. package/dist/camunda-cloud-modeler.development.js +4399 -3941
  9. package/dist/camunda-cloud-modeler.production.min.js +34 -34
  10. package/dist/camunda-cloud-navigated-viewer.development.js +176 -105
  11. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  12. package/dist/camunda-cloud-viewer.development.js +176 -105
  13. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  14. package/dist/camunda-platform-modeler.development.js +1862 -1406
  15. package/dist/camunda-platform-modeler.production.min.js +36 -36
  16. package/dist/camunda-platform-navigated-viewer.development.js +176 -105
  17. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  18. package/dist/camunda-platform-viewer.development.js +176 -105
  19. package/dist/camunda-platform-viewer.production.min.js +1 -1
  20. package/lib/base/Modeler.d.ts +15 -15
  21. package/lib/base/NavigatedViewer.d.ts +2 -2
  22. package/lib/base/Viewer.d.ts +2 -2
  23. package/lib/camunda-cloud/ElementTemplatesValidator.d.ts +1 -1
  24. package/lib/camunda-cloud/Modeler.d.ts +3 -3
  25. package/lib/camunda-cloud/Modeler.js +84 -84
  26. package/lib/camunda-cloud/NavigatedViewer.d.ts +3 -3
  27. package/lib/camunda-cloud/Viewer.d.ts +3 -3
  28. package/lib/camunda-cloud/util/commonModules.d.ts +9 -9
  29. package/lib/camunda-platform/Modeler.d.ts +3 -3
  30. package/lib/camunda-platform/NavigatedViewer.d.ts +5 -5
  31. package/lib/camunda-platform/Viewer.d.ts +5 -5
  32. package/lib/camunda-platform/util/commonModules.d.ts +9 -9
  33. package/lib/util/ExtensionElementsUtil.d.ts +24 -24
  34. package/package.json +19 -19
@@ -27,6 +27,10 @@
27
27
  return obj !== undefined;
28
28
  }
29
29
 
30
+ function isNil(obj) {
31
+ return obj == null;
32
+ }
33
+
30
34
  function isArray$2(obj) {
31
35
  return nativeToString$1.call(obj) === '[object Array]';
32
36
  }
@@ -475,6 +479,58 @@
475
479
  return Object.assign(target, ...others);
476
480
  }
477
481
 
482
+ /**
483
+ * Sets a nested property of a given object to the specified value.
484
+ *
485
+ * This mutates the object and returns it.
486
+ *
487
+ * @template T
488
+ *
489
+ * @param {T} target The target of the set operation.
490
+ * @param {(string|number)[]} path The path to the nested value.
491
+ * @param {any} value The value to set.
492
+ *
493
+ * @return {T}
494
+ */
495
+ function set$2(target, path, value) {
496
+
497
+ let currentTarget = target;
498
+
499
+ forEach$1(path, function(key, idx) {
500
+
501
+ if (typeof key !== 'number' && typeof key !== 'string') {
502
+ throw new Error('illegal key type: ' + typeof key + '. Key should be of type number or string.');
503
+ }
504
+
505
+ if (key === 'constructor') {
506
+ throw new Error('illegal key: constructor');
507
+ }
508
+
509
+ if (key === '__proto__') {
510
+ throw new Error('illegal key: __proto__');
511
+ }
512
+
513
+ let nextKey = path[idx + 1];
514
+ let nextTarget = currentTarget[key];
515
+
516
+ if (isDefined(nextKey) && isNil(nextTarget)) {
517
+ nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
518
+ }
519
+
520
+ if (isUndefined$2(nextKey)) {
521
+ if (isUndefined$2(value)) {
522
+ delete currentTarget[key];
523
+ } else {
524
+ currentTarget[key] = value;
525
+ }
526
+ } else {
527
+ currentTarget = nextTarget;
528
+ }
529
+ });
530
+
531
+ return target;
532
+ }
533
+
478
534
  /**
479
535
  * Pick properties from the given target.
480
536
  *
@@ -12344,36 +12400,17 @@
12344
12400
  }
12345
12401
  };
12346
12402
 
12347
- function getDefaultExportFromCjs (x) {
12348
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
12349
- }
12350
-
12351
- var objectRefs = {exports: {}};
12352
-
12353
- var collection = {};
12354
-
12355
- /**
12356
- * An empty collection stub. Use {@link RefsCollection.extend} to extend a
12357
- * collection with ref semantics.
12358
- *
12359
- * @class RefsCollection
12360
- */
12361
-
12362
12403
  /**
12363
12404
  * Extends a collection with {@link Refs} aware methods
12364
12405
  *
12365
- * @memberof RefsCollection
12366
- * @static
12367
- *
12368
- * @param {Array<Object>} collection
12369
- * @param {Refs} refs instance
12370
- * @param {Object} property represented by the collection
12371
- * @param {Object} target object the collection is attached to
12406
+ * @param {Array<Object>} collection
12407
+ * @param {Refs} refs instance
12408
+ * @param {Object} property represented by the collection
12409
+ * @param {Object} target object the collection is attached to
12372
12410
  *
12373
12411
  * @return {RefsCollection<Object>} the extended array
12374
12412
  */
12375
12413
  function extend(collection, refs, property, target) {
12376
-
12377
12414
  var inverseProperty = property.inverse;
12378
12415
 
12379
12416
  /**
@@ -12384,7 +12421,7 @@
12384
12421
  * @param {Object} element the element to remove
12385
12422
  */
12386
12423
  Object.defineProperty(collection, 'remove', {
12387
- value: function(element) {
12424
+ value: function (element) {
12388
12425
  var idx = this.indexOf(element);
12389
12426
  if (idx !== -1) {
12390
12427
  this.splice(idx, 1);
@@ -12392,7 +12429,6 @@
12392
12429
  // unset inverse
12393
12430
  refs.unset(element, inverseProperty, target);
12394
12431
  }
12395
-
12396
12432
  return element;
12397
12433
  }
12398
12434
  });
@@ -12405,7 +12441,7 @@
12405
12441
  * @param {Object} element the element to check for
12406
12442
  */
12407
12443
  Object.defineProperty(collection, 'contains', {
12408
- value: function(element) {
12444
+ value: function (element) {
12409
12445
  return this.indexOf(element) !== -1;
12410
12446
  }
12411
12447
  });
@@ -12420,12 +12456,9 @@
12420
12456
  * (possibly moving other elements around)
12421
12457
  */
12422
12458
  Object.defineProperty(collection, 'add', {
12423
- value: function(element, idx) {
12424
-
12459
+ value: function (element, idx) {
12425
12460
  var currentIdx = this.indexOf(element);
12426
-
12427
12461
  if (typeof idx === 'undefined') {
12428
-
12429
12462
  if (currentIdx !== -1) {
12430
12463
  // element already in collection (!)
12431
12464
  return;
@@ -12437,14 +12470,12 @@
12437
12470
 
12438
12471
  // handle already in collection
12439
12472
  if (currentIdx !== -1) {
12440
-
12441
12473
  // remove element from currentIdx
12442
12474
  this.splice(currentIdx, 1);
12443
12475
  }
12444
12476
 
12445
12477
  // add element at idx
12446
12478
  this.splice(idx, 0, element);
12447
-
12448
12479
  if (currentIdx === -1) {
12449
12480
  // set inverse, unless element was
12450
12481
  // in collection already
@@ -12458,69 +12489,53 @@
12458
12489
  Object.defineProperty(collection, '__refs_collection', {
12459
12490
  value: true
12460
12491
  });
12461
-
12462
12492
  return collection;
12463
12493
  }
12464
12494
 
12465
-
12495
+ /**
12496
+ * Checks if a given collection is extended
12497
+ *
12498
+ * @param {Array<Object>} collection
12499
+ *
12500
+ * @return {boolean}
12501
+ */
12466
12502
  function isExtended(collection) {
12467
12503
  return collection.__refs_collection === true;
12468
12504
  }
12469
12505
 
12470
- collection.extend = extend;
12471
-
12472
- collection.isExtended = isExtended;
12473
-
12474
- var Collection = collection;
12475
-
12476
12506
  function hasOwnProperty$1(e, property) {
12477
12507
  return Object.prototype.hasOwnProperty.call(e, property.name || property);
12478
12508
  }
12479
-
12480
12509
  function defineCollectionProperty(ref, property, target) {
12481
-
12482
- var collection = Collection.extend(target[property.name] || [], ref, property, target);
12483
-
12510
+ var collection = extend(target[property.name] || [], ref, property, target);
12484
12511
  Object.defineProperty(target, property.name, {
12485
12512
  enumerable: property.enumerable,
12486
12513
  value: collection
12487
12514
  });
12488
-
12489
12515
  if (collection.length) {
12490
-
12491
- collection.forEach(function(o) {
12516
+ collection.forEach(function (o) {
12492
12517
  ref.set(o, property.inverse, target);
12493
12518
  });
12494
12519
  }
12495
12520
  }
12496
-
12497
-
12498
12521
  function defineProperty$1(ref, property, target) {
12499
-
12500
12522
  var inverseProperty = property.inverse;
12501
-
12502
12523
  var _value = target[property.name];
12503
-
12504
12524
  Object.defineProperty(target, property.name, {
12505
12525
  configurable: property.configurable,
12506
12526
  enumerable: property.enumerable,
12507
-
12508
- get: function() {
12527
+ get: function () {
12509
12528
  return _value;
12510
12529
  },
12511
-
12512
- set: function(value) {
12513
-
12530
+ set: function (value) {
12514
12531
  // return if we already performed all changes
12515
12532
  if (value === _value) {
12516
12533
  return;
12517
12534
  }
12518
-
12519
12535
  var old = _value;
12520
12536
 
12521
12537
  // temporary set null
12522
12538
  _value = null;
12523
-
12524
12539
  if (old) {
12525
12540
  ref.unset(old, inverseProperty, target);
12526
12541
  }
@@ -12532,7 +12547,6 @@
12532
12547
  ref.set(_value, inverseProperty, target);
12533
12548
  }
12534
12549
  });
12535
-
12536
12550
  }
12537
12551
 
12538
12552
  /**
@@ -12578,16 +12592,14 @@
12578
12592
  *
12579
12593
  * wheels[0].car // undefined
12580
12594
  */
12581
- function Refs$1(a, b) {
12582
-
12583
- if (!(this instanceof Refs$1)) {
12584
- return new Refs$1(a, b);
12595
+ function Refs(a, b) {
12596
+ if (!(this instanceof Refs)) {
12597
+ return new Refs(a, b);
12585
12598
  }
12586
12599
 
12587
12600
  // link
12588
12601
  a.inverse = b;
12589
12602
  b.inverse = a;
12590
-
12591
12603
  this.props = {};
12592
12604
  this.props[a.name] = a;
12593
12605
  this.props[b.name] = b;
@@ -12602,43 +12614,34 @@
12602
12614
  * @param {Object} target
12603
12615
  * @param {String} property
12604
12616
  */
12605
- Refs$1.prototype.bind = function(target, property) {
12617
+ Refs.prototype.bind = function (target, property) {
12606
12618
  if (typeof property === 'string') {
12607
12619
  if (!this.props[property]) {
12608
12620
  throw new Error('no property <' + property + '> in ref');
12609
12621
  }
12610
12622
  property = this.props[property];
12611
12623
  }
12612
-
12613
12624
  if (property.collection) {
12614
12625
  defineCollectionProperty(this, property, target);
12615
12626
  } else {
12616
12627
  defineProperty$1(this, property, target);
12617
12628
  }
12618
12629
  };
12619
-
12620
- Refs$1.prototype.ensureRefsCollection = function(target, property) {
12621
-
12630
+ Refs.prototype.ensureRefsCollection = function (target, property) {
12622
12631
  var collection = target[property.name];
12623
-
12624
- if (!Collection.isExtended(collection)) {
12632
+ if (!isExtended(collection)) {
12625
12633
  defineCollectionProperty(this, property, target);
12626
12634
  }
12627
-
12628
12635
  return collection;
12629
12636
  };
12630
-
12631
- Refs$1.prototype.ensureBound = function(target, property) {
12637
+ Refs.prototype.ensureBound = function (target, property) {
12632
12638
  if (!hasOwnProperty$1(target, property)) {
12633
12639
  this.bind(target, property);
12634
12640
  }
12635
12641
  };
12636
-
12637
- Refs$1.prototype.unset = function(target, property, value) {
12638
-
12642
+ Refs.prototype.unset = function (target, property, value) {
12639
12643
  if (target) {
12640
12644
  this.ensureBound(target, property);
12641
-
12642
12645
  if (property.collection) {
12643
12646
  this.ensureRefsCollection(target, property).remove(value);
12644
12647
  } else {
@@ -12646,12 +12649,9 @@
12646
12649
  }
12647
12650
  }
12648
12651
  };
12649
-
12650
- Refs$1.prototype.set = function(target, property, value) {
12651
-
12652
+ Refs.prototype.set = function (target, property, value) {
12652
12653
  if (target) {
12653
12654
  this.ensureBound(target, property);
12654
-
12655
12655
  if (property.collection) {
12656
12656
  this.ensureRefsCollection(target, property).add(value);
12657
12657
  } else {
@@ -12660,15 +12660,6 @@
12660
12660
  }
12661
12661
  };
12662
12662
 
12663
- var refs = Refs$1;
12664
-
12665
- objectRefs.exports = refs;
12666
-
12667
- objectRefs.exports.Collection = collection;
12668
-
12669
- var objectRefsExports = objectRefs.exports;
12670
- var Refs = /*@__PURE__*/getDefaultExportFromCjs(objectRefsExports);
12671
-
12672
12663
  var parentRefs = new Refs({ name: 'children', enumerable: true, collection: true }, { name: 'parent' }),
12673
12664
  labelRefs = new Refs({ name: 'labels', enumerable: true, collection: true }, { name: 'labelTarget' }),
12674
12665
  attacherRefs = new Refs({ name: 'attachers', collection: true }, { name: 'host' }),
@@ -14485,6 +14476,17 @@
14485
14476
  this.idProperty = p;
14486
14477
  };
14487
14478
 
14479
+ DescriptorBuilder.prototype.assertNotTrait = function(typeDescriptor) {
14480
+
14481
+ const _extends = typeDescriptor.extends || [];
14482
+
14483
+ if (_extends.length) {
14484
+ throw new Error(
14485
+ `cannot create <${ typeDescriptor.name }> extending <${ typeDescriptor.extends }>`
14486
+ );
14487
+ }
14488
+ };
14489
+
14488
14490
  DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
14489
14491
  var propertyName = p.name,
14490
14492
  definedProperty = this.propertiesByName[propertyName];
@@ -14503,6 +14505,10 @@
14503
14505
 
14504
14506
  DescriptorBuilder.prototype.addTrait = function(t, inherited) {
14505
14507
 
14508
+ if (inherited) {
14509
+ this.assertNotTrait(t);
14510
+ }
14511
+
14506
14512
  var typesByName = this.allTypesByName,
14507
14513
  types = this.allTypes;
14508
14514
 
@@ -14636,7 +14642,9 @@
14636
14642
  });
14637
14643
 
14638
14644
  forEach$1(type.extends, bind$2(function(extendsName) {
14639
- var extended = this.typeMap[extendsName];
14645
+ var extendsNameNs = parseName(extendsName, ns.prefix);
14646
+
14647
+ var extended = this.typeMap[extendsNameNs.name];
14640
14648
 
14641
14649
  extended.traits = extended.traits || [];
14642
14650
  extended.traits.push(name);
@@ -14665,24 +14673,33 @@
14665
14673
 
14666
14674
  var self = this;
14667
14675
 
14676
+ /**
14677
+ * Traverse the selected super type or trait
14678
+ *
14679
+ * @param {String} cls
14680
+ * @param {Boolean} [trait=false]
14681
+ */
14682
+ function traverse(cls, trait) {
14683
+ var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14684
+ self.mapTypes(parentNs, iterator, trait);
14685
+ }
14686
+
14668
14687
  /**
14669
14688
  * Traverse the selected trait.
14670
14689
  *
14671
14690
  * @param {String} cls
14672
14691
  */
14673
14692
  function traverseTrait(cls) {
14674
- return traverseSuper(cls, true);
14693
+ return traverse(cls, true);
14675
14694
  }
14676
14695
 
14677
14696
  /**
14678
- * Traverse the selected super type or trait
14697
+ * Traverse the selected super type
14679
14698
  *
14680
14699
  * @param {String} cls
14681
- * @param {Boolean} [trait=false]
14682
14700
  */
14683
- function traverseSuper(cls, trait) {
14684
- var parentNs = parseName(cls, isBuiltIn(cls) ? '' : nsName.prefix);
14685
- self.mapTypes(parentNs, iterator, trait);
14701
+ function traverseSuper(cls) {
14702
+ return traverse(cls, false);
14686
14703
  }
14687
14704
 
14688
14705
  if (!type) {
@@ -14765,7 +14782,7 @@
14765
14782
  throw new TypeError('property name must be a non-empty string');
14766
14783
  }
14767
14784
 
14768
- var property = this.model.getPropertyDescriptor(target, name);
14785
+ var property = this.getProperty(target, name);
14769
14786
 
14770
14787
  var propertyName = property && property.name;
14771
14788
 
@@ -14776,7 +14793,7 @@
14776
14793
  if (property) {
14777
14794
  delete target[propertyName];
14778
14795
  } else {
14779
- delete target.$attrs[name];
14796
+ delete target.$attrs[stripGlobal(name)];
14780
14797
  }
14781
14798
  } else {
14782
14799
 
@@ -14789,7 +14806,7 @@
14789
14806
  defineProperty(target, property, value);
14790
14807
  }
14791
14808
  } else {
14792
- target.$attrs[name] = value;
14809
+ target.$attrs[stripGlobal(name)] = value;
14793
14810
  }
14794
14811
  }
14795
14812
  };
@@ -14804,10 +14821,10 @@
14804
14821
  */
14805
14822
  Properties.prototype.get = function(target, name) {
14806
14823
 
14807
- var property = this.model.getPropertyDescriptor(target, name);
14824
+ var property = this.getProperty(target, name);
14808
14825
 
14809
14826
  if (!property) {
14810
- return target.$attrs[name];
14827
+ return target.$attrs[stripGlobal(name)];
14811
14828
  }
14812
14829
 
14813
14830
  var propertyName = property.name;
@@ -14861,6 +14878,44 @@
14861
14878
  this.define(target, '$model', { value: model });
14862
14879
  };
14863
14880
 
14881
+ /**
14882
+ * Return property with the given name on the element.
14883
+ *
14884
+ * @param {any} target
14885
+ * @param {string} name
14886
+ *
14887
+ * @return {object | null} property
14888
+ */
14889
+ Properties.prototype.getProperty = function(target, name) {
14890
+
14891
+ var model = this.model;
14892
+
14893
+ var property = model.getPropertyDescriptor(target, name);
14894
+
14895
+ if (property) {
14896
+ return property;
14897
+ }
14898
+
14899
+ if (name.includes(':')) {
14900
+ return null;
14901
+ }
14902
+
14903
+ const strict = model.config.strict;
14904
+
14905
+ if (typeof strict !== 'undefined') {
14906
+ const error = new TypeError(`unknown property <${ name }> on <${ target.$type }>`);
14907
+
14908
+ if (strict) {
14909
+ throw error;
14910
+ } else {
14911
+
14912
+ // eslint-disable-next-line no-undef
14913
+ typeof console !== 'undefined' && console.warn(error);
14914
+ }
14915
+ }
14916
+
14917
+ return null;
14918
+ };
14864
14919
 
14865
14920
  function isUndefined(val) {
14866
14921
  return typeof val === 'undefined';
@@ -14875,6 +14930,10 @@
14875
14930
  });
14876
14931
  }
14877
14932
 
14933
+ function stripGlobal(name) {
14934
+ return name.replace(/^:/, '');
14935
+ }
14936
+
14878
14937
  // Moddle implementation /////////////////////////////////////////////////
14879
14938
 
14880
14939
  /**
@@ -14897,8 +14956,10 @@
14897
14956
  * var moddle = new Moddle([pkg]);
14898
14957
  *
14899
14958
  * @param {Array<Package>} packages the packages to contain
14959
+ *
14960
+ * @param { { strict?: boolean } } [config] moddle configuration
14900
14961
  */
14901
- function Moddle(packages) {
14962
+ function Moddle(packages, config = {}) {
14902
14963
 
14903
14964
  this.properties = new Properties(this);
14904
14965
 
@@ -14906,6 +14967,8 @@
14906
14967
  this.registry = new Registry(packages, this.properties);
14907
14968
 
14908
14969
  this.typeCache = {};
14970
+
14971
+ this.config = config;
14909
14972
  }
14910
14973
 
14911
14974
 
@@ -14999,6 +15062,12 @@
14999
15062
  $type: name,
15000
15063
  $instanceOf: function(type) {
15001
15064
  return type === this.$type;
15065
+ },
15066
+ get: function(key) {
15067
+ return this[key];
15068
+ },
15069
+ set: function(key, value) {
15070
+ set$2(this, [ key ], value);
15002
15071
  }
15003
15072
  };
15004
15073
 
@@ -15014,6 +15083,8 @@
15014
15083
 
15015
15084
  this.properties.defineDescriptor(element, descriptor);
15016
15085
  this.properties.defineModel(element, this);
15086
+ this.properties.define(element, 'get', { enumerable: false, writable: true });
15087
+ this.properties.define(element, 'set', { enumerable: false, writable: true });
15017
15088
  this.properties.define(element, '$parent', { enumerable: false, writable: true });
15018
15089
  this.properties.define(element, '$instanceOf', { enumerable: false, writable: true });
15019
15090