camunda-bpmn-js 4.20.2 → 5.1.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.
@@ -246,7 +246,7 @@
246
246
  * @return {Boolean}
247
247
  */
248
248
  function has$1(target, key) {
249
- return nativeHasOwnProperty$1.call(target, key);
249
+ return !isNil(target) && nativeHasOwnProperty$1.call(target, key);
250
250
  }
251
251
 
252
252
  /**
@@ -335,7 +335,7 @@
335
335
  * @param {Collection<T>} collection
336
336
  * @param {Matcher<T>} matcher
337
337
  *
338
- * @return {number}
338
+ * @return {number | string | undefined}
339
339
  */
340
340
  function findIndex$1(collection, matcher) {
341
341
 
@@ -5077,6 +5077,11 @@
5077
5077
  */
5078
5078
  this._rootElement = null;
5079
5079
 
5080
+ /**
5081
+ * @type {boolean}
5082
+ */
5083
+ this._focused = false;
5084
+
5080
5085
  this._init(config || {});
5081
5086
  }
5082
5087
 
@@ -5103,14 +5108,33 @@
5103
5108
  * @param {CanvasConfig} config
5104
5109
  */
5105
5110
  Canvas.prototype._init = function(config) {
5106
-
5107
5111
  const eventBus = this._eventBus;
5108
5112
 
5109
5113
  // html container
5110
5114
  const container = this._container = createContainer(config);
5111
5115
 
5112
5116
  const svg = this._svg = create$1('svg');
5113
- attr(svg, { width: '100%', height: '100%' });
5117
+
5118
+ attr(svg, {
5119
+ width: '100%',
5120
+ height: '100%'
5121
+ });
5122
+
5123
+ attr$1(svg, 'tabindex', 0);
5124
+
5125
+ eventBus.on('element.hover', () => {
5126
+ this.restoreFocus();
5127
+ });
5128
+
5129
+ svg.addEventListener('focusin', () => {
5130
+ this._focused = true;
5131
+ eventBus.fire('canvas.focus.changed', { focused: true });
5132
+ });
5133
+
5134
+ svg.addEventListener('focusout', () => {
5135
+ this._focused = false;
5136
+ eventBus.fire('canvas.focus.changed', { focused: false });
5137
+ });
5114
5138
 
5115
5139
  append(container, svg);
5116
5140
 
@@ -5202,6 +5226,31 @@
5202
5226
  delete this._cachedViewbox;
5203
5227
  };
5204
5228
 
5229
+ /**
5230
+ * Sets focus on the canvas SVG element.
5231
+ */
5232
+ Canvas.prototype.focus = function() {
5233
+ this._svg.focus({ preventScroll: true });
5234
+ };
5235
+
5236
+ /**
5237
+ * Sets focus on the canvas SVG element if `document.body` is currently focused.
5238
+ */
5239
+ Canvas.prototype.restoreFocus = function() {
5240
+ if (document.activeElement === document.body) {
5241
+ this.focus();
5242
+ }
5243
+ };
5244
+
5245
+ /**
5246
+ * Returns true if the canvas is focused.
5247
+ *
5248
+ * @return {boolean}
5249
+ */
5250
+ Canvas.prototype.isFocused = function() {
5251
+ return this._focused;
5252
+ };
5253
+
5205
5254
  /**
5206
5255
  * Returns the default layer on which
5207
5256
  * all elements are drawn.
@@ -8725,13 +8774,15 @@
8725
8774
  if (parts.length === 1) {
8726
8775
  localName = name;
8727
8776
  prefix = defaultPrefix;
8728
- } else
8777
+ }
8729
8778
 
8730
8779
  // prefix + local name
8731
- if (parts.length === 2) {
8780
+ else if (parts.length === 2) {
8732
8781
  localName = parts[1];
8733
8782
  prefix = parts[0];
8734
- } else {
8783
+ }
8784
+
8785
+ else {
8735
8786
  throw new Error('expected <prefix:localName> or <localName>, got ' + name);
8736
8787
  }
8737
8788
 
@@ -9633,7 +9684,7 @@
9633
9684
  * sub-set of reserved names (&amp;) as well as
9634
9685
  * hex (&#xaaf;) and decimal (&#1231;) encoded characters.
9635
9686
  *
9636
- * @param {string} str
9687
+ * @param {string} s
9637
9688
  *
9638
9689
  * @return {string} decoded string
9639
9690
  */
@@ -9645,10 +9696,6 @@
9645
9696
  return s;
9646
9697
  }
9647
9698
 
9648
- var XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
9649
- var XSI_PREFIX = 'xsi';
9650
- var XSI_TYPE$1 = 'xsi:type';
9651
-
9652
9699
  var NON_WHITESPACE_OUTSIDE_ROOT_NODE = 'non-whitespace outside of root node';
9653
9700
 
9654
9701
  function error$2(msg) {
@@ -9693,7 +9740,7 @@
9693
9740
  }
9694
9741
 
9695
9742
  function noopGetContext() {
9696
- return { 'line': 0, 'column': 0 };
9743
+ return { line: 0, column: 0 };
9697
9744
  }
9698
9745
 
9699
9746
  function throwFunc(err) {
@@ -9859,9 +9906,6 @@
9859
9906
  _nsUriToPrefix[k] = nsMap[k];
9860
9907
  }
9861
9908
 
9862
- // FORCE default mapping for schema instance
9863
- _nsUriToPrefix[XSI_URI] = XSI_PREFIX;
9864
-
9865
9909
  isNamespace = true;
9866
9910
  nsUriToPrefix = _nsUriToPrefix;
9867
9911
 
@@ -10185,23 +10229,6 @@
10185
10229
 
10186
10230
  // end: normalize ns attribute name
10187
10231
 
10188
- // normalize xsi:type ns attribute value
10189
- if (name === XSI_TYPE$1) {
10190
- w = value.indexOf(':');
10191
-
10192
- if (w !== -1) {
10193
- nsName = value.substring(0, w);
10194
-
10195
- // handle default prefixes, i.e. xs:String gracefully
10196
- nsName = nsMatrix[nsName] || nsName;
10197
- value = nsName + value.substring(w);
10198
- } else {
10199
- value = defaultAlias + ':' + value;
10200
- }
10201
- }
10202
-
10203
- // end: normalize xsi:type ns attribute value
10204
-
10205
10232
  attrs[name] = value;
10206
10233
  }
10207
10234
 
@@ -10230,23 +10257,6 @@
10230
10257
  : nsName + name.substr(w);
10231
10258
 
10232
10259
  // end: normalize ns attribute name
10233
-
10234
- // normalize xsi:type ns attribute value
10235
- if (name === XSI_TYPE$1) {
10236
- w = value.indexOf(':');
10237
-
10238
- if (w !== -1) {
10239
- nsName = value.substring(0, w);
10240
-
10241
- // handle default prefixes, i.e. xs:String gracefully
10242
- nsName = nsMatrix[nsName] || nsName;
10243
- value = nsName + value.substring(w);
10244
- } else {
10245
- value = defaultAlias + ':' + value;
10246
- }
10247
- }
10248
-
10249
- // end: normalize xsi:type ns attribute value
10250
10260
  }
10251
10261
 
10252
10262
  attrs[name] = value;
@@ -10387,11 +10397,11 @@
10387
10397
  }
10388
10398
  }
10389
10399
 
10390
- w = xml.charCodeAt(i+1);
10400
+ w = xml.charCodeAt(i + 1);
10391
10401
 
10392
10402
  // parse comments + CDATA
10393
10403
  if (w === 33) { // "!"
10394
- q = xml.charCodeAt(i+2);
10404
+ q = xml.charCodeAt(i + 2);
10395
10405
 
10396
10406
  // CDATA section
10397
10407
  if (q === 91 && xml.substr(i + 3, 6) === 'CDATA[') { // 91 == "["
@@ -10675,18 +10685,16 @@
10675
10685
  'xml': 'http://www.w3.org/XML/1998/namespace'
10676
10686
  };
10677
10687
 
10678
- var XSI_TYPE = 'xsi:type';
10688
+ var SERIALIZE_PROPERTY = 'property';
10679
10689
 
10680
- function serializeFormat(element) {
10690
+ function getSerialization(element) {
10681
10691
  return element.xml && element.xml.serialize;
10682
10692
  }
10683
10693
 
10684
- function serializeAsType(element) {
10685
- return serializeFormat(element) === XSI_TYPE;
10686
- }
10694
+ function getSerializationType(element) {
10695
+ const type = getSerialization(element);
10687
10696
 
10688
- function serializeAsProperty(element) {
10689
- return serializeFormat(element) === 'property';
10697
+ return type !== SERIALIZE_PROPERTY && (type || null);
10690
10698
  }
10691
10699
 
10692
10700
  function capitalize(str) {
@@ -10702,12 +10710,20 @@
10702
10710
  return aliasNs.prefix + ':' + capitalize(aliasNs.localName);
10703
10711
  }
10704
10712
 
10713
+ /**
10714
+ * Un-prefix a potentially prefixed type name.
10715
+ *
10716
+ * @param {NsName} nameNs
10717
+ * @param {Object} [pkg]
10718
+ *
10719
+ * @return {string}
10720
+ */
10705
10721
  function prefixedToName(nameNs, pkg) {
10706
10722
 
10707
10723
  var name = nameNs.name,
10708
10724
  localName = nameNs.localName;
10709
10725
 
10710
- var typePrefix = pkg.xml && pkg.xml.typePrefix;
10726
+ var typePrefix = pkg && pkg.xml && pkg.xml.typePrefix;
10711
10727
 
10712
10728
  if (typePrefix && localName.indexOf(typePrefix) === 0) {
10713
10729
  return nameNs.prefix + ':' + localName.slice(typePrefix.length);
@@ -10716,12 +10732,19 @@
10716
10732
  }
10717
10733
  }
10718
10734
 
10719
- function normalizeXsiTypeName(name, model) {
10735
+ function normalizeTypeName(name, nsMap, model) {
10720
10736
 
10721
- var nameNs = parseName$1(name);
10722
- var pkg = model.getPackage(nameNs.prefix);
10737
+ // normalize against actual NS
10738
+ const nameNs = parseName$1(name, nsMap.xmlns);
10739
+
10740
+ const normalizedName = `${ nsMap[nameNs.prefix] || nameNs.prefix }:${ nameNs.localName }`;
10741
+
10742
+ const normalizedNameNs = parseName$1(normalizedName);
10743
+
10744
+ // determine actual type name, based on package-defined prefix
10745
+ var pkg = model.getPackage(normalizedNameNs.prefix);
10723
10746
 
10724
- return prefixedToName(nameNs, pkg);
10747
+ return prefixedToName(normalizedNameNs, pkg);
10725
10748
  }
10726
10749
 
10727
10750
  function error$1(message) {
@@ -11010,8 +11033,9 @@
11010
11033
  } else {
11011
11034
  if (prop) {
11012
11035
  value = coerceType(prop.type, value);
11013
- } else
11014
- if (name !== 'xmlns') {
11036
+ } else if (name === 'xmlns') {
11037
+ name = ':' + name;
11038
+ } else {
11015
11039
  propNameNs = parseName$1(name, descriptor.ns.prefix);
11016
11040
 
11017
11041
  // check whether attribute is defined in a well-known namespace
@@ -11044,26 +11068,27 @@
11044
11068
  descriptor = getModdleDescriptor(type);
11045
11069
 
11046
11070
  var propertyName = nameNs.name,
11047
- property = descriptor.propertiesByName[propertyName],
11048
- elementTypeName,
11049
- elementType;
11071
+ property = descriptor.propertiesByName[propertyName];
11050
11072
 
11051
11073
  // search for properties by name first
11052
11074
 
11053
11075
  if (property && !property.isAttr) {
11054
11076
 
11055
- if (serializeAsType(property)) {
11056
- elementTypeName = node.attributes[XSI_TYPE];
11077
+ const serializationType = getSerializationType(property);
11078
+
11079
+ if (serializationType) {
11080
+ const elementTypeName = node.attributes[serializationType];
11057
11081
 
11058
- // xsi type is optional, if it does not exists the
11082
+ // type is optional, if it does not exists the
11059
11083
  // default type is assumed
11060
11084
  if (elementTypeName) {
11061
11085
 
11086
+ // convert the prefix used to the mapped form, but also
11062
11087
  // take possible type prefixes from XML
11063
- // into account, i.e.: xsi:type="t{ActualType}"
11064
- elementTypeName = normalizeXsiTypeName(elementTypeName, model);
11088
+ // into account, i.e.: xsi:type="t{ActualType}",
11089
+ const normalizedTypeName = normalizeTypeName(elementTypeName, node.ns, model);
11065
11090
 
11066
- elementType = model.getType(elementTypeName);
11091
+ const elementType = model.getType(normalizedTypeName);
11067
11092
 
11068
11093
  return assign$1({}, property, {
11069
11094
  effectiveType: getModdleDescriptor(elementType).name
@@ -11078,8 +11103,8 @@
11078
11103
  var pkg = model.getPackage(nameNs.prefix);
11079
11104
 
11080
11105
  if (pkg) {
11081
- elementTypeName = aliasToName(nameNs, pkg);
11082
- elementType = model.getType(elementTypeName);
11106
+ const elementTypeName = aliasToName(nameNs, pkg);
11107
+ const elementType = model.getType(elementTypeName);
11083
11108
 
11084
11109
  // search for collection members later
11085
11110
  property = find$1(descriptor.properties, function(p) {
@@ -11501,9 +11526,12 @@
11501
11526
  uriMap[p.uri] = p.prefix;
11502
11527
 
11503
11528
  return uriMap;
11504
- }, {
11505
- 'http://www.w3.org/XML/1998/namespace': 'xml' // add default xml ns
11506
- });
11529
+ }, Object.entries(DEFAULT_NS_MAP).reduce(function(map, [ prefix, url ]) {
11530
+ map[url] = prefix;
11531
+
11532
+ return map;
11533
+ }, model.config && model.config.nsMap || {}));
11534
+
11507
11535
  parser
11508
11536
  .ns(uriMap)
11509
11537
  .on('openTag', function(obj, decodeStr, selfClosing, getContext) {
@@ -11604,75 +11632,82 @@
11604
11632
 
11605
11633
  function Namespaces(parent) {
11606
11634
 
11607
- var prefixMap = {};
11608
- var uriMap = {};
11609
- var used = {};
11635
+ this.prefixMap = {};
11636
+ this.uriMap = {};
11637
+ this.used = {};
11610
11638
 
11611
- var wellknown = [];
11612
- var custom = [];
11639
+ this.wellknown = [];
11640
+ this.custom = [];
11641
+ this.parent = parent;
11613
11642
 
11614
- // API
11643
+ this.defaultPrefixMap = parent && parent.defaultPrefixMap || {};
11644
+ }
11615
11645
 
11616
- this.byUri = function(uri) {
11617
- return uriMap[uri] || (
11618
- parent && parent.byUri(uri)
11619
- );
11620
- };
11646
+ Namespaces.prototype.mapDefaultPrefixes = function(defaultPrefixMap) {
11647
+ this.defaultPrefixMap = defaultPrefixMap;
11648
+ };
11621
11649
 
11622
- this.add = function(ns, isWellknown) {
11650
+ Namespaces.prototype.defaultUriByPrefix = function(prefix) {
11651
+ return this.defaultPrefixMap[prefix];
11652
+ };
11623
11653
 
11624
- uriMap[ns.uri] = ns;
11654
+ Namespaces.prototype.byUri = function(uri) {
11655
+ return this.uriMap[uri] || (
11656
+ this.parent && this.parent.byUri(uri)
11657
+ );
11658
+ };
11625
11659
 
11626
- if (isWellknown) {
11627
- wellknown.push(ns);
11628
- } else {
11629
- custom.push(ns);
11630
- }
11660
+ Namespaces.prototype.add = function(ns, isWellknown) {
11631
11661
 
11632
- this.mapPrefix(ns.prefix, ns.uri);
11633
- };
11662
+ this.uriMap[ns.uri] = ns;
11634
11663
 
11635
- this.uriByPrefix = function(prefix) {
11636
- return prefixMap[prefix || 'xmlns'];
11637
- };
11664
+ if (isWellknown) {
11665
+ this.wellknown.push(ns);
11666
+ } else {
11667
+ this.custom.push(ns);
11668
+ }
11638
11669
 
11639
- this.mapPrefix = function(prefix, uri) {
11640
- prefixMap[prefix || 'xmlns'] = uri;
11641
- };
11670
+ this.mapPrefix(ns.prefix, ns.uri);
11671
+ };
11642
11672
 
11643
- this.getNSKey = function(ns) {
11644
- return (ns.prefix !== undefined) ? (ns.uri + '|' + ns.prefix) : ns.uri;
11645
- };
11673
+ Namespaces.prototype.uriByPrefix = function(prefix) {
11674
+ return this.prefixMap[prefix || 'xmlns'] || (
11675
+ this.parent && this.parent.uriByPrefix(prefix)
11676
+ );
11677
+ };
11646
11678
 
11647
- this.logUsed = function(ns) {
11679
+ Namespaces.prototype.mapPrefix = function(prefix, uri) {
11680
+ this.prefixMap[prefix || 'xmlns'] = uri;
11681
+ };
11648
11682
 
11649
- var uri = ns.uri;
11650
- var nsKey = this.getNSKey(ns);
11683
+ Namespaces.prototype.getNSKey = function(ns) {
11684
+ return (ns.prefix !== undefined) ? (ns.uri + '|' + ns.prefix) : ns.uri;
11685
+ };
11651
11686
 
11652
- used[nsKey] = this.byUri(uri);
11687
+ Namespaces.prototype.logUsed = function(ns) {
11653
11688
 
11654
- // Inform parent recursively about the usage of this NS
11655
- if (parent) {
11656
- parent.logUsed(ns);
11657
- }
11658
- };
11689
+ var uri = ns.uri;
11690
+ var nsKey = this.getNSKey(ns);
11659
11691
 
11660
- this.getUsed = function(ns) {
11692
+ this.used[nsKey] = this.byUri(uri);
11661
11693
 
11662
- function isUsed(ns) {
11663
- var nsKey = self.getNSKey(ns);
11694
+ // Inform parent recursively about the usage of this NS
11695
+ if (this.parent) {
11696
+ this.parent.logUsed(ns);
11697
+ }
11698
+ };
11664
11699
 
11665
- return used[nsKey];
11666
- }
11700
+ Namespaces.prototype.getUsed = function(ns) {
11667
11701
 
11668
- var self = this;
11702
+ var allNs = [].concat(this.wellknown, this.custom);
11669
11703
 
11670
- var allNs = [].concat(wellknown, custom);
11704
+ return allNs.filter(ns => {
11705
+ var nsKey = this.getNSKey(ns);
11671
11706
 
11672
- return allNs.filter(isUsed);
11673
- };
11707
+ return this.used[nsKey];
11708
+ });
11709
+ };
11674
11710
 
11675
- }
11676
11711
 
11677
11712
  function lower(string) {
11678
11713
  return string.charAt(0).toLowerCase() + string.slice(1);
@@ -11887,7 +11922,7 @@
11887
11922
  var isGeneric = elementDescriptor.isGeneric;
11888
11923
 
11889
11924
  if (isGeneric) {
11890
- otherAttrs = this.parseGeneric(element);
11925
+ otherAttrs = this.parseGenericNsAttributes(element);
11891
11926
  } else {
11892
11927
  otherAttrs = this.parseNsAttributes(element);
11893
11928
  }
@@ -11901,7 +11936,9 @@
11901
11936
  // compute tag name
11902
11937
  this.tagName = this.addTagName(this.ns);
11903
11938
 
11904
- if (!isGeneric) {
11939
+ if (isGeneric) {
11940
+ this.parseGenericContainments(element);
11941
+ } else {
11905
11942
  properties = getSerializableProperties(element);
11906
11943
 
11907
11944
  this.parseAttributes(filterAttributes(properties));
@@ -11964,35 +12001,29 @@
11964
12001
  }
11965
12002
  };
11966
12003
 
11967
- ElementSerializer.prototype.parseGeneric = function(element) {
12004
+ ElementSerializer.prototype.parseGenericNsAttributes = function(element) {
11968
12005
 
11969
- var self = this,
11970
- body = this.body;
11971
-
11972
- var attributes = [];
11973
-
11974
- forEach$1(element, function(val, key) {
12006
+ return Object.entries(element).filter(
12007
+ ([ key, value ]) => !key.startsWith('$') && this.parseNsAttribute(element, key, value)
12008
+ ).map(
12009
+ ([ key, value ]) => ({ name: key, value: value })
12010
+ );
12011
+ };
11975
12012
 
11976
- var nonNsAttr;
12013
+ ElementSerializer.prototype.parseGenericContainments = function(element) {
12014
+ var body = element.$body;
11977
12015
 
11978
- if (key === '$body') {
11979
- body.push(new BodySerializer().build({ type: 'String' }, val));
11980
- } else
11981
- if (key === '$children') {
11982
- forEach$1(val, function(child) {
11983
- body.push(new ElementSerializer(self).build(child));
11984
- });
11985
- } else
11986
- if (key.indexOf('$') !== 0) {
11987
- nonNsAttr = self.parseNsAttribute(element, key, val);
12016
+ if (body) {
12017
+ this.body.push(new BodySerializer().build({ type: 'String' }, body));
12018
+ }
11988
12019
 
11989
- if (nonNsAttr) {
11990
- attributes.push({ name: key, value: val });
11991
- }
11992
- }
11993
- });
12020
+ var children = element.$children;
11994
12021
 
11995
- return attributes;
12022
+ if (children) {
12023
+ forEach$1(children, child => {
12024
+ this.body.push(new ElementSerializer(this).build(child));
12025
+ });
12026
+ }
11996
12027
  };
11997
12028
 
11998
12029
  ElementSerializer.prototype.parseNsAttribute = function(element, name, value) {
@@ -12039,7 +12070,7 @@
12039
12070
  * @param {Object} element
12040
12071
  * @return {Array<Object>}
12041
12072
  */
12042
- ElementSerializer.prototype.parseNsAttributes = function(element, attrs) {
12073
+ ElementSerializer.prototype.parseNsAttributes = function(element) {
12043
12074
  var self = this;
12044
12075
 
12045
12076
  var genericAttrs = element.$attrs;
@@ -12067,21 +12098,16 @@
12067
12098
 
12068
12099
  forEach$1(attributes, function(attr) {
12069
12100
 
12070
- // do not serialize xsi:type attribute
12071
- // it is set manually based on the actual implementation type
12072
- if (attr.name === XSI_TYPE) {
12073
- return;
12074
- }
12075
-
12076
12101
  try {
12077
12102
  self.addAttribute(self.nsAttributeName(attr.name), attr.value);
12078
12103
  } catch (e) {
12079
- /* global console */
12080
12104
 
12081
- console.warn(
12082
- 'missing namespace information for ',
12083
- attr.name, '=', attr.value, 'on', element,
12084
- e);
12105
+ // eslint-disable-next-line no-undef
12106
+ typeof console !== 'undefined' && console.warn(
12107
+ `missing namespace information for <${
12108
+ attr.name
12109
+ }=${ attr.value }> on`, element, e
12110
+ );
12085
12111
  }
12086
12112
  });
12087
12113
  };
@@ -12103,13 +12129,11 @@
12103
12129
 
12104
12130
  if (p.isBody) {
12105
12131
  body.push(new BodySerializer().build(p, value[0]));
12106
- } else
12107
- if (isSimple(p.type)) {
12132
+ } else if (isSimple(p.type)) {
12108
12133
  forEach$1(value, function(v) {
12109
12134
  body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
12110
12135
  });
12111
- } else
12112
- if (isReference) {
12136
+ } else if (isReference) {
12113
12137
  forEach$1(value, function(v) {
12114
12138
  body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
12115
12139
  });
@@ -12117,17 +12141,17 @@
12117
12141
 
12118
12142
  // allow serialization via type
12119
12143
  // rather than element name
12120
- var asType = serializeAsType(p),
12121
- asProperty = serializeAsProperty(p);
12144
+ var serialization = getSerialization(p);
12122
12145
 
12123
12146
  forEach$1(value, function(v) {
12124
12147
  var serializer;
12125
12148
 
12126
- if (asType) {
12127
- serializer = new TypeSerializer(self, p);
12128
- } else
12129
- if (asProperty) {
12130
- serializer = new ElementSerializer(self, p);
12149
+ if (serialization) {
12150
+ if (serialization === SERIALIZE_PROPERTY) {
12151
+ serializer = new ElementSerializer(self, p);
12152
+ } else {
12153
+ serializer = new TypeSerializer(self, p, serialization);
12154
+ }
12131
12155
  } else {
12132
12156
  serializer = new ElementSerializer(self);
12133
12157
  }
@@ -12175,9 +12199,7 @@
12175
12199
  };
12176
12200
 
12177
12201
  ElementSerializer.prototype.logNamespaceUsed = function(ns, local) {
12178
- var element = this.element,
12179
- model = element.$model,
12180
- namespaces = this.getNamespaces(local);
12202
+ var namespaces = this.getNamespaces(local);
12181
12203
 
12182
12204
  // ns may be
12183
12205
  //
@@ -12195,7 +12217,7 @@
12195
12217
  return { localName: ns.localName };
12196
12218
  }
12197
12219
 
12198
- wellknownUri = DEFAULT_NS_MAP[prefix] || model && (model.getPackage(prefix) || {}).uri;
12220
+ wellknownUri = namespaces.defaultUriByPrefix(prefix);
12199
12221
 
12200
12222
  uri = uri || wellknownUri || namespaces.uriByPrefix(prefix);
12201
12223
 
@@ -12205,6 +12227,11 @@
12205
12227
 
12206
12228
  ns = namespaces.byUri(uri);
12207
12229
 
12230
+ // register new default prefix <xmlns> in local scope
12231
+ if (!ns && !prefix) {
12232
+ ns = this.logNamespace({ uri }, wellknownUri === uri, true);
12233
+ }
12234
+
12208
12235
  if (!ns) {
12209
12236
  newPrefix = prefix;
12210
12237
  idx = 1;
@@ -12236,8 +12263,7 @@
12236
12263
 
12237
12264
  if (!p.isMany) {
12238
12265
  value = value.id;
12239
- }
12240
- else {
12266
+ } else {
12241
12267
  var values = [];
12242
12268
  forEach$1(value, function(v) {
12243
12269
  values.push(v.id);
@@ -12341,20 +12367,25 @@
12341
12367
  /**
12342
12368
  * A serializer for types that handles serialization of data types
12343
12369
  */
12344
- function TypeSerializer(parent, propertyDescriptor) {
12370
+ function TypeSerializer(parent, propertyDescriptor, serialization) {
12345
12371
  ElementSerializer.call(this, parent, propertyDescriptor);
12372
+
12373
+ this.serialization = serialization;
12346
12374
  }
12347
12375
 
12348
12376
  inherits(TypeSerializer, ElementSerializer);
12349
12377
 
12350
12378
  TypeSerializer.prototype.parseNsAttributes = function(element) {
12351
12379
 
12352
- // extracted attributes
12353
- var attributes = ElementSerializer.prototype.parseNsAttributes.call(this, element);
12380
+ // extracted attributes with serialization attribute
12381
+ // <type=typeName> stripped; it may be later
12382
+ var attributes = ElementSerializer.prototype.parseNsAttributes.call(this, element).filter(
12383
+ attr => attr.name !== this.serialization
12384
+ );
12354
12385
 
12355
12386
  var descriptor = element.$descriptor;
12356
12387
 
12357
- // only serialize xsi:type if necessary
12388
+ // only serialize <type=typeName> if necessary
12358
12389
  if (descriptor.name === this.propertyDescriptor.type) {
12359
12390
  return attributes;
12360
12391
  }
@@ -12369,7 +12400,7 @@
12369
12400
  typePrefix = (pkg.xml && pkg.xml.typePrefix) || '';
12370
12401
 
12371
12402
  this.addAttribute(
12372
- this.nsAttributeName(XSI_TYPE),
12403
+ this.nsAttributeName(this.serialization),
12373
12404
  (typeNs.prefix ? typeNs.prefix + ':' : '') + typePrefix + descriptor.ns.localName
12374
12405
  );
12375
12406
 
@@ -12442,7 +12473,13 @@
12442
12473
  formatingWriter.append(XML_PREAMBLE);
12443
12474
  }
12444
12475
 
12445
- new ElementSerializer().build(tree).serializeTo(formatingWriter);
12476
+ var serializer = new ElementSerializer();
12477
+
12478
+ var model = tree.$model;
12479
+
12480
+ serializer.getNamespaces().mapDefaultPrefixes(getDefaultPrefixMappings(model));
12481
+
12482
+ serializer.build(tree).serializeTo(formatingWriter);
12446
12483
 
12447
12484
  if (!writer) {
12448
12485
  return internalWriter.value;
@@ -12454,6 +12491,39 @@
12454
12491
  };
12455
12492
  }
12456
12493
 
12494
+
12495
+ // helpers ///////////
12496
+
12497
+ /**
12498
+ * @param {Moddle} model
12499
+ *
12500
+ * @return { Record<string, string> } map from prefix to URI
12501
+ */
12502
+ function getDefaultPrefixMappings(model) {
12503
+
12504
+ const nsMap = model.config && model.config.nsMap || {};
12505
+
12506
+ const prefixMap = {};
12507
+
12508
+ // { prefix -> uri }
12509
+ for (const prefix in DEFAULT_NS_MAP) {
12510
+ prefixMap[prefix] = DEFAULT_NS_MAP[prefix];
12511
+ }
12512
+
12513
+ // { uri -> prefix }
12514
+ for (const uri in nsMap) {
12515
+ const prefix = nsMap[uri];
12516
+
12517
+ prefixMap[prefix] = uri;
12518
+ }
12519
+
12520
+ for (const pkg of model.getPackages()) {
12521
+ prefixMap[pkg.prefix] = pkg.uri;
12522
+ }
12523
+
12524
+ return prefixMap;
12525
+ }
12526
+
12457
12527
  /**
12458
12528
  * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
12459
12529
  *
@@ -16180,7 +16250,7 @@
16180
16250
  associations: associations
16181
16251
  };
16182
16252
 
16183
- var packages = {
16253
+ const packages = {
16184
16254
  bpmn: BpmnPackage,
16185
16255
  bpmndi: BpmnDiPackage,
16186
16256
  dc: DcPackage,
@@ -16189,8 +16259,8 @@
16189
16259
  color: BpmnInColorPackage
16190
16260
  };
16191
16261
 
16192
- function simple(additionalPackages, options) {
16193
- var pks = assign$1({}, packages, additionalPackages);
16262
+ function SimpleBpmnModdle(additionalPackages, options) {
16263
+ const pks = assign$1({}, packages, additionalPackages);
16194
16264
 
16195
16265
  return new BpmnModdle(pks, options);
16196
16266
  }
@@ -17745,7 +17815,7 @@
17745
17815
  BaseViewer.prototype._createModdle = function(options) {
17746
17816
  const moddleOptions = assign$1({}, this._moddleExtensions, options.moddleExtensions);
17747
17817
 
17748
- return new simple(moddleOptions);
17818
+ return new SimpleBpmnModdle(moddleOptions);
17749
17819
  };
17750
17820
 
17751
17821
  BaseViewer.prototype._modules = [];
@@ -18277,7 +18347,11 @@
18277
18347
  if (attr) {
18278
18348
 
18279
18349
  if (attr === 'categoryValueRef') {
18280
- semantic['categoryValueRef'].value = text;
18350
+ if (!semantic[attr]) {
18351
+ return element;
18352
+ }
18353
+
18354
+ semantic[attr].value = text;
18281
18355
  } else {
18282
18356
  semantic[attr] = text;
18283
18357
  }
@@ -20905,6 +20979,8 @@
20905
20979
 
20906
20980
  return bbox;
20907
20981
  } catch (e) {
20982
+ console.log(e);
20983
+
20908
20984
  return { width: 0, height: 0 };
20909
20985
  }
20910
20986
  }
@@ -24188,409 +24264,6 @@
24188
24264
  subprocessCompatibility: [ 'type', SubprocessCompatibility ]
24189
24265
  };
24190
24266
 
24191
- var LOW_PRIORITY$p = 500;
24192
-
24193
- var DEFAULT_PRIORITY$5 = 1000;
24194
-
24195
- /**
24196
- * @typedef {import('../../model/Types').Element} Element
24197
- *
24198
- * @typedef {import('./OutlineProvider').default} OutlineProvider
24199
- * @typedef {import('../../core/EventBus').default} EventBus
24200
- * @typedef {import('../../draw/Styles').default} Styles
24201
- */
24202
-
24203
- /**
24204
- * @class
24205
- *
24206
- * A plugin that adds an outline to shapes and connections that may be activated and styled
24207
- * via CSS classes.
24208
- *
24209
- * @param {EventBus} eventBus
24210
- * @param {Styles} styles
24211
- */
24212
- function Outline(eventBus, styles) {
24213
-
24214
- this._eventBus = eventBus;
24215
-
24216
- this.offset = 5;
24217
-
24218
- var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
24219
-
24220
- var self = this;
24221
-
24222
- /**
24223
- * @param {SVGElement} gfx
24224
- *
24225
- * @return {SVGElement} outline
24226
- */
24227
- function createOutline(gfx) {
24228
- var outline = create$1('rect');
24229
-
24230
- attr(outline, assign$1({
24231
- x: 0,
24232
- y: 0,
24233
- rx: 4,
24234
- width: 100,
24235
- height: 100
24236
- }, OUTLINE_STYLE));
24237
-
24238
- return outline;
24239
- }
24240
-
24241
- // A low priortity is necessary, because outlines of labels have to be updated
24242
- // after the label bounds have been updated in the renderer.
24243
- eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$p, function(event) {
24244
- var element = event.element,
24245
- gfx = event.gfx;
24246
-
24247
- var outline = query('.djs-outline', gfx);
24248
-
24249
- if (!outline) {
24250
- outline = self.getOutline(element) || createOutline();
24251
- append(gfx, outline);
24252
- }
24253
-
24254
- self.updateShapeOutline(outline, element);
24255
- });
24256
-
24257
- eventBus.on([ 'connection.added', 'connection.changed' ], function(event) {
24258
- var element = event.element,
24259
- gfx = event.gfx;
24260
-
24261
- var outline = query('.djs-outline', gfx);
24262
-
24263
- if (!outline) {
24264
- outline = createOutline();
24265
- append(gfx, outline);
24266
- }
24267
-
24268
- self.updateConnectionOutline(outline, element);
24269
- });
24270
- }
24271
-
24272
-
24273
- /**
24274
- * Updates the outline of a shape respecting the dimension of the
24275
- * element and an outline offset.
24276
- *
24277
- * @param {SVGElement} outline
24278
- * @param {Element} element
24279
- */
24280
- Outline.prototype.updateShapeOutline = function(outline, element) {
24281
-
24282
- var updated = false;
24283
- var providers = this._getProviders();
24284
-
24285
- if (providers.length) {
24286
- forEach$1(providers, function(provider) {
24287
- updated = updated || provider.updateOutline(element, outline);
24288
- });
24289
- }
24290
-
24291
- if (!updated) {
24292
- attr(outline, {
24293
- x: -this.offset,
24294
- y: -this.offset,
24295
- width: element.width + this.offset * 2,
24296
- height: element.height + this.offset * 2
24297
- });
24298
- }
24299
- };
24300
-
24301
- /**
24302
- * Updates the outline of a connection respecting the bounding box of
24303
- * the connection and an outline offset.
24304
- * Register an outline provider with the given priority.
24305
- *
24306
- * @param {SVGElement} outline
24307
- * @param {Element} connection
24308
- */
24309
- Outline.prototype.updateConnectionOutline = function(outline, connection) {
24310
- var bbox = getBBox(connection);
24311
-
24312
- attr(outline, {
24313
- x: bbox.x - this.offset,
24314
- y: bbox.y - this.offset,
24315
- width: bbox.width + this.offset * 2,
24316
- height: bbox.height + this.offset * 2
24317
- });
24318
- };
24319
-
24320
- /**
24321
- * Register an outline provider with the given priority.
24322
- *
24323
- * @param {number} priority
24324
- * @param {OutlineProvider} provider
24325
- */
24326
- Outline.prototype.registerProvider = function(priority, provider) {
24327
- if (!provider) {
24328
- provider = priority;
24329
- priority = DEFAULT_PRIORITY$5;
24330
- }
24331
-
24332
- this._eventBus.on('outline.getProviders', priority, function(event) {
24333
- event.providers.push(provider);
24334
- });
24335
- };
24336
-
24337
- /**
24338
- * Returns the registered outline providers.
24339
- *
24340
- * @returns {OutlineProvider[]}
24341
- */
24342
- Outline.prototype._getProviders = function() {
24343
- var event = this._eventBus.createEvent({
24344
- type: 'outline.getProviders',
24345
- providers: []
24346
- });
24347
-
24348
- this._eventBus.fire(event);
24349
-
24350
- return event.providers;
24351
- };
24352
-
24353
- /**
24354
- * Returns the outline for an element.
24355
- *
24356
- * @param {Element} element
24357
- */
24358
- Outline.prototype.getOutline = function(element) {
24359
- var outline;
24360
- var providers = this._getProviders();
24361
-
24362
- forEach$1(providers, function(provider) {
24363
-
24364
- if (!isFunction(provider.getOutline)) {
24365
- return;
24366
- }
24367
-
24368
- outline = outline || provider.getOutline(element);
24369
- });
24370
-
24371
- return outline;
24372
- };
24373
-
24374
- Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
24375
-
24376
- /**
24377
- * @type { import('didi').ModuleDeclaration }
24378
- */
24379
- var OutlineModule$1 = {
24380
- __init__: [ 'outline' ],
24381
- outline: [ 'type', Outline ]
24382
- };
24383
-
24384
- const DATA_OBJECT_REFERENCE_OUTLINE_PATH = 'M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z';
24385
- const DATA_STORE_REFERENCE_OUTLINE_PATH = 'M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z';
24386
-
24387
- /**
24388
- * @typedef { import('diagram-js/lib/util/Types').Dimensions} Dimensions
24389
- */
24390
-
24391
- /**
24392
- * @type {Dimensions}
24393
- */
24394
- const DATA_OBJECT_REFERENCE_STANDARD_SIZE = { width: 36, height: 50 };
24395
-
24396
- /**
24397
- * @type {Dimensions}
24398
- */
24399
- const DATA_STORE_REFERENCE_STANDARD_SIZE = { width: 50, height: 50 };
24400
-
24401
- /**
24402
- * Create a path element with given attributes.
24403
- * @param {string} path
24404
- * @param {Object} attrs
24405
- * @param {Object} OUTLINE_STYLE
24406
- * @return {SVGElement}
24407
- */
24408
- function createPath(path, attrs, OUTLINE_STYLE) {
24409
- return create$1('path', {
24410
- d: path,
24411
- strokeWidth: 2,
24412
- transform: `translate(${attrs.x}, ${attrs.y})`,
24413
- ...OUTLINE_STYLE
24414
- });
24415
- }
24416
-
24417
- /**
24418
- * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').default } BaseOutlineProvider
24419
- *
24420
- * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').Outline } Outline
24421
- *
24422
- * @typedef { import('diagram-js/lib/draw/Styles').default } Styles
24423
- *
24424
- * @typedef { import('diagram-js/lib/model/Types').Element } Element
24425
- */
24426
-
24427
- const DEFAULT_OFFSET = 5;
24428
-
24429
- /**
24430
- * BPMN-specific outline provider.
24431
- *
24432
- * @implements {BaseOutlineProvider}
24433
- *
24434
- * @param {Outline} outline
24435
- * @param {Styles} styles
24436
- */
24437
- function OutlineProvider(outline, styles) {
24438
-
24439
- this._styles = styles;
24440
- outline.registerProvider(this);
24441
- }
24442
-
24443
- OutlineProvider.$inject = [
24444
- 'outline',
24445
- 'styles'
24446
- ];
24447
-
24448
- /**
24449
- * Returns outline for a given element.
24450
- *
24451
- * @param {Element} element
24452
- *
24453
- * @return {Outline}
24454
- */
24455
- OutlineProvider.prototype.getOutline = function(element) {
24456
-
24457
- const OUTLINE_STYLE = this._styles.cls('djs-outline', [ 'no-fill' ]);
24458
-
24459
- var outline;
24460
-
24461
- if (isLabel(element)) {
24462
- return;
24463
- }
24464
-
24465
- if (is$1(element, 'bpmn:Gateway')) {
24466
- outline = create$1('rect');
24467
-
24468
- assign$1(outline.style, {
24469
- 'transform-box': 'fill-box',
24470
- 'transform': 'rotate(45deg)',
24471
- 'transform-origin': 'center'
24472
- });
24473
-
24474
- attr(outline, assign$1({
24475
- x: 2,
24476
- y: 2,
24477
- rx: 4,
24478
- width: element.width - 4,
24479
- height: element.height - 4,
24480
- }, OUTLINE_STYLE));
24481
-
24482
- } else if (isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess', 'bpmn:Group', 'bpmn:CallActivity' ])) {
24483
- outline = create$1('rect');
24484
-
24485
- attr(outline, assign$1({
24486
- x: -DEFAULT_OFFSET,
24487
- y: -DEFAULT_OFFSET,
24488
- rx: 14,
24489
- width: element.width + DEFAULT_OFFSET * 2,
24490
- height: element.height + DEFAULT_OFFSET * 2
24491
- }, OUTLINE_STYLE));
24492
-
24493
- } else if (is$1(element, 'bpmn:EndEvent')) {
24494
-
24495
- outline = create$1('circle');
24496
-
24497
- // Extra 1px offset needed due to increased stroke-width of end event
24498
- // which makes it bigger than other events.
24499
-
24500
- attr(outline, assign$1({
24501
- cx: element.width / 2,
24502
- cy: element.height / 2,
24503
- r: element.width / 2 + DEFAULT_OFFSET + 1
24504
- }, OUTLINE_STYLE));
24505
-
24506
- } else if (is$1(element, 'bpmn:Event')) {
24507
- outline = create$1('circle');
24508
-
24509
- attr(outline, assign$1({
24510
- cx: element.width / 2,
24511
- cy: element.height / 2,
24512
- r: element.width / 2 + DEFAULT_OFFSET
24513
- }, OUTLINE_STYLE));
24514
-
24515
- } else if (is$1(element, 'bpmn:DataObjectReference') && isStandardSize(element, 'bpmn:DataObjectReference')) {
24516
-
24517
- outline = createPath(
24518
- DATA_OBJECT_REFERENCE_OUTLINE_PATH,
24519
- { x: -6, y: -6 },
24520
- OUTLINE_STYLE
24521
- );
24522
-
24523
- } else if (is$1(element, 'bpmn:DataStoreReference') && isStandardSize(element, 'bpmn:DataStoreReference')) {
24524
-
24525
- outline = createPath(
24526
- DATA_STORE_REFERENCE_OUTLINE_PATH,
24527
- { x: -6, y: -6 },
24528
- OUTLINE_STYLE
24529
- );
24530
- }
24531
-
24532
- return outline;
24533
- };
24534
-
24535
- /**
24536
- * Updates the outline for a given element.
24537
- * Returns true if the update for the given element was handled by this provider.
24538
- *
24539
- * @param {Element} element
24540
- * @param {Outline} outline
24541
- * @returns {boolean}
24542
- */
24543
- OutlineProvider.prototype.updateOutline = function(element, outline) {
24544
-
24545
- if (isLabel(element)) {
24546
- return;
24547
- }
24548
-
24549
- if (isAny(element, [ 'bpmn:SubProcess', 'bpmn:Group' ])) {
24550
-
24551
- attr(outline, {
24552
- width: element.width + DEFAULT_OFFSET * 2,
24553
- height: element.height + DEFAULT_OFFSET * 2
24554
- });
24555
-
24556
- return true;
24557
-
24558
- } else if (isAny(element, [
24559
- 'bpmn:Event',
24560
- 'bpmn:Gateway',
24561
- 'bpmn:DataStoreReference',
24562
- 'bpmn:DataObjectReference'
24563
- ])) {
24564
- return true;
24565
- }
24566
-
24567
- return false;
24568
- };
24569
-
24570
-
24571
- // helpers //////////
24572
-
24573
- function isStandardSize(element, type) {
24574
- var standardSize;
24575
-
24576
- if (type === 'bpmn:DataObjectReference') {
24577
- standardSize = DATA_OBJECT_REFERENCE_STANDARD_SIZE;
24578
- } else if (type === 'bpmn:DataStoreReference') {
24579
- standardSize = DATA_STORE_REFERENCE_STANDARD_SIZE;
24580
- }
24581
-
24582
- return element.width === standardSize.width
24583
- && element.height === standardSize.height;
24584
- }
24585
-
24586
- var OutlineModule = {
24587
- __depends__: [
24588
- OutlineModule$1
24589
- ],
24590
- __init__: [ 'outlineProvider' ],
24591
- outlineProvider: [ 'type', OutlineProvider ]
24592
- };
24593
-
24594
24267
  /**
24595
24268
  * @typedef {import('../util/Types').Point} Point
24596
24269
  */
@@ -24651,7 +24324,7 @@
24651
24324
  *
24652
24325
  * @return {boolean}
24653
24326
  */
24654
- function isButton$1(event, button) {
24327
+ function isButton(event, button) {
24655
24328
  return (getOriginal$1(event) || event).button === button;
24656
24329
  }
24657
24330
 
@@ -24663,7 +24336,7 @@
24663
24336
  function isPrimaryButton(event) {
24664
24337
 
24665
24338
  // button === 0 -> left áka primary mouse button
24666
- return isButton$1(event, 0);
24339
+ return isButton(event, 0);
24667
24340
  }
24668
24341
 
24669
24342
  /**
@@ -24674,7 +24347,7 @@
24674
24347
  function isAuxiliaryButton(event) {
24675
24348
 
24676
24349
  // button === 1 -> auxiliary áka wheel button
24677
- return isButton$1(event, 1);
24350
+ return isButton(event, 1);
24678
24351
  }
24679
24352
 
24680
24353
  /**
@@ -24724,7 +24397,7 @@
24724
24397
  return isPrimaryButton(event) || isAuxiliaryButton(event);
24725
24398
  }
24726
24399
 
24727
- var LOW_PRIORITY$o = 500;
24400
+ var LOW_PRIORITY$p = 500;
24728
24401
 
24729
24402
 
24730
24403
  /**
@@ -24921,7 +24594,7 @@
24921
24594
  eventBus.on([
24922
24595
  'shape.changed',
24923
24596
  'connection.changed'
24924
- ], LOW_PRIORITY$o, function(event) {
24597
+ ], LOW_PRIORITY$p, function(event) {
24925
24598
 
24926
24599
  var element = event.element,
24927
24600
  gfx = event.gfx;
@@ -24929,7 +24602,7 @@
24929
24602
  eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
24930
24603
  });
24931
24604
 
24932
- eventBus.on('interactionEvents.createHit', LOW_PRIORITY$o, function(event) {
24605
+ eventBus.on('interactionEvents.createHit', LOW_PRIORITY$p, function(event) {
24933
24606
  var element = event.element,
24934
24607
  gfx = event.gfx;
24935
24608
 
@@ -25332,15 +25005,11 @@
25332
25005
  /**
25333
25006
  * @typedef {import('../../core/Canvas').default} Canvas
25334
25007
  * @typedef {import('../../core/EventBus').default} EventBus
25335
- * @typedef {import('./Selection').default} Selection
25336
25008
  */
25337
25009
 
25338
25010
  var MARKER_HOVER = 'hover',
25339
25011
  MARKER_SELECTED = 'selected';
25340
25012
 
25341
- var SELECTION_OUTLINE_PADDING = 6;
25342
-
25343
-
25344
25013
  /**
25345
25014
  * A plugin that adds a visible selection UI to shapes and connections
25346
25015
  * by appending the <code>hover</code> and <code>selected</code> classes to them.
@@ -25351,15 +25020,10 @@
25351
25020
  *
25352
25021
  * @param {Canvas} canvas
25353
25022
  * @param {EventBus} eventBus
25354
- * @param {Selection} selection
25355
25023
  */
25356
- function SelectionVisuals(canvas, eventBus, selection) {
25024
+ function SelectionVisuals(canvas, eventBus) {
25357
25025
  this._canvas = canvas;
25358
25026
 
25359
- var self = this;
25360
-
25361
- this._multiSelectionBox = null;
25362
-
25363
25027
  function addMarker(e, cls) {
25364
25028
  canvas.addMarker(e, cls);
25365
25029
  }
@@ -25400,63 +25064,14 @@
25400
25064
  select(e);
25401
25065
  }
25402
25066
  });
25403
-
25404
- self._updateSelectionOutline(newSelection);
25405
- });
25406
-
25407
-
25408
- eventBus.on('element.changed', function(event) {
25409
- if (selection.isSelected(event.element)) {
25410
- self._updateSelectionOutline(selection.get());
25411
- }
25412
25067
  });
25413
25068
  }
25414
25069
 
25415
25070
  SelectionVisuals.$inject = [
25416
25071
  'canvas',
25417
- 'eventBus',
25418
- 'selection'
25072
+ 'eventBus'
25419
25073
  ];
25420
25074
 
25421
- SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
25422
- var layer = this._canvas.getLayer('selectionOutline');
25423
-
25424
- clear(layer);
25425
-
25426
- var enabled = selection.length > 1;
25427
-
25428
- var container = this._canvas.getContainer();
25429
-
25430
- classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
25431
-
25432
- if (!enabled) {
25433
- return;
25434
- }
25435
-
25436
- var bBox = addSelectionOutlinePadding(getBBox(selection));
25437
-
25438
- var rect = create$1('rect');
25439
-
25440
- attr(rect, assign$1({
25441
- rx: 3
25442
- }, bBox));
25443
-
25444
- classes(rect).add('djs-selection-outline');
25445
-
25446
- append(layer, rect);
25447
- };
25448
-
25449
- // helpers //////////
25450
-
25451
- function addSelectionOutlinePadding(bBox) {
25452
- return {
25453
- x: bBox.x - SELECTION_OUTLINE_PADDING,
25454
- y: bBox.y - SELECTION_OUTLINE_PADDING,
25455
- width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
25456
- height: bBox.height + SELECTION_OUTLINE_PADDING * 2
25457
- };
25458
- }
25459
-
25460
25075
  /**
25461
25076
  * @typedef {import('../../core/Canvas').default} Canvas
25462
25077
  * @typedef {import('../../core/ElementRegistry').default} ElementRegistry
@@ -25583,7 +25198,6 @@
25583
25198
  __init__: [ 'selectionVisuals', 'selectionBehavior' ],
25584
25199
  __depends__: [
25585
25200
  InteractionEventsModule$1,
25586
- OutlineModule$1
25587
25201
  ],
25588
25202
  selection: [ 'type', Selection ],
25589
25203
  selectionVisuals: [ 'type', SelectionVisuals ],
@@ -25649,7 +25263,6 @@
25649
25263
  Viewer.prototype._modules = [
25650
25264
  CoreModule,
25651
25265
  DrilldownModdule,
25652
- OutlineModule,
25653
25266
  OverlaysModule,
25654
25267
  SelectionModule,
25655
25268
  TranslateModule
@@ -25747,9 +25360,10 @@
25747
25360
  var KEYDOWN_EVENT = 'keyboard.keydown',
25748
25361
  KEYUP_EVENT = 'keyboard.keyup';
25749
25362
 
25750
- var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
25363
+ var DEFAULT_PRIORITY$5 = 1000;
25364
+
25365
+ var compatMessage = 'Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661';
25751
25366
 
25752
- var DEFAULT_PRIORITY$4 = 1000;
25753
25367
 
25754
25368
  /**
25755
25369
  * A keyboard abstraction that may be activated and
@@ -25769,8 +25383,8 @@
25769
25383
  *
25770
25384
  * All events contain one field which is node.
25771
25385
  *
25772
- * A default binding for the keyboard may be specified via the
25773
- * `keyboard.bindTo` configuration option.
25386
+ * Specify the initial keyboard binding state via the
25387
+ * `keyboard.bind=true|false` configuration option.
25774
25388
  *
25775
25389
  * @param {Object} config
25776
25390
  * @param {EventTarget} [config.bindTo]
@@ -25779,7 +25393,8 @@
25779
25393
  function Keyboard(config, eventBus) {
25780
25394
  var self = this;
25781
25395
 
25782
- this._config = config || {};
25396
+ this._config = config = config || {};
25397
+
25783
25398
  this._eventBus = eventBus;
25784
25399
 
25785
25400
  this._keydownHandler = this._keydownHandler.bind(this);
@@ -25792,19 +25407,22 @@
25792
25407
  self.unbind();
25793
25408
  });
25794
25409
 
25795
- eventBus.on('diagram.init', function() {
25796
- self._fire('init');
25797
- });
25410
+ if (config.bindTo) {
25411
+ console.error('unsupported configuration <keyboard.bindTo>', new Error(compatMessage));
25412
+ }
25413
+
25414
+ var bind = config && config.bind !== false;
25415
+
25416
+ eventBus.on('canvas.init', function(event) {
25417
+ self._target = event.svg;
25798
25418
 
25799
- eventBus.on('attach', function() {
25800
- if (config && config.bindTo) {
25801
- self.bind(config.bindTo);
25419
+ if (bind) {
25420
+ self.bind();
25802
25421
  }
25803
- });
25804
25422
 
25805
- eventBus.on('detach', function() {
25806
- self.unbind();
25423
+ self._fire('init');
25807
25424
  });
25425
+
25808
25426
  }
25809
25427
 
25810
25428
  Keyboard.$inject = [
@@ -25839,34 +25457,7 @@
25839
25457
  };
25840
25458
 
25841
25459
  Keyboard.prototype._isEventIgnored = function(event) {
25842
- if (event.defaultPrevented) {
25843
- return true;
25844
- }
25845
-
25846
- return (
25847
- isInput$1(event.target) || (
25848
- isButton(event.target) && isKey([ ' ', 'Enter' ], event)
25849
- )
25850
- ) && this._isModifiedKeyIgnored(event);
25851
- };
25852
-
25853
- Keyboard.prototype._isModifiedKeyIgnored = function(event) {
25854
- if (!isCmd(event)) {
25855
- return true;
25856
- }
25857
-
25858
- var allowedModifiers = this._getAllowedModifiers(event.target);
25859
- return allowedModifiers.indexOf(event.key) === -1;
25860
- };
25861
-
25862
- Keyboard.prototype._getAllowedModifiers = function(element) {
25863
- var modifierContainer = closest(element, '[' + HANDLE_MODIFIER_ATTRIBUTE + ']', true);
25864
-
25865
- if (!modifierContainer || (this._node && !this._node.contains(modifierContainer))) {
25866
- return [];
25867
- }
25868
-
25869
- return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
25460
+ return false;
25870
25461
  };
25871
25462
 
25872
25463
  /**
@@ -25876,10 +25467,14 @@
25876
25467
  */
25877
25468
  Keyboard.prototype.bind = function(node) {
25878
25469
 
25470
+ if (node) {
25471
+ console.error('unsupported argument <node>', new Error(compatMessage));
25472
+ }
25473
+
25879
25474
  // make sure that the keyboard is only bound once to the DOM
25880
25475
  this.unbind();
25881
25476
 
25882
- this._node = node;
25477
+ node = this._node = this._target;
25883
25478
 
25884
25479
  // bind key events
25885
25480
  event.bind(node, 'keydown', this._keydownHandler);
@@ -25929,7 +25524,7 @@
25929
25524
  if (isFunction(priority)) {
25930
25525
  type = listener;
25931
25526
  listener = priority;
25932
- priority = DEFAULT_PRIORITY$4;
25527
+ priority = DEFAULT_PRIORITY$5;
25933
25528
  }
25934
25529
 
25935
25530
  this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
@@ -25950,19 +25545,7 @@
25950
25545
  Keyboard.prototype.isShift = isShift;
25951
25546
  Keyboard.prototype.isKey = isKey;
25952
25547
 
25953
-
25954
-
25955
- // helpers ///////
25956
-
25957
- function isInput$1(target) {
25958
- return target && (matches$1(target, 'input, textarea') || target.contentEditable === 'true');
25959
- }
25960
-
25961
- function isButton(target) {
25962
- return target && matches$1(target, 'button, input[type=submit], input[type=button], a[href], [aria-role=button]');
25963
- }
25964
-
25965
- var LOW_PRIORITY$n = 500;
25548
+ var LOW_PRIORITY$o = 500;
25966
25549
 
25967
25550
 
25968
25551
  /**
@@ -25978,7 +25561,7 @@
25978
25561
 
25979
25562
  var self = this;
25980
25563
 
25981
- eventBus.on('editorActions.init', LOW_PRIORITY$n, function(event) {
25564
+ eventBus.on('editorActions.init', LOW_PRIORITY$o, function(event) {
25982
25565
 
25983
25566
  var editorActions = event.editorActions;
25984
25567
 
@@ -27044,23 +26627,26 @@
27044
26627
 
27045
26628
  Scheduler.prototype._schedule = function(taskFn, id) {
27046
26629
 
27047
- const {
27048
- promise,
27049
- resolve,
27050
- reject
27051
- } = defer();
26630
+ const deferred = defer();
26631
+
26632
+ const executionId = setTimeout(() => {
27052
26633
 
27053
- const executionId = requestAnimationFrame(() => {
27054
26634
  try {
27055
- resolve(taskFn());
26635
+ this._scheduled[id] = null;
26636
+
26637
+ try {
26638
+ deferred.resolve(taskFn());
26639
+ } catch (error) {
26640
+ deferred.reject(error);
26641
+ }
27056
26642
  } catch (error) {
27057
- reject(error);
26643
+ console.error('Scheduler#_schedule execution failed', error);
27058
26644
  }
27059
26645
  });
27060
26646
 
27061
26647
  return {
27062
26648
  executionId,
27063
- promise
26649
+ promise: deferred.promise
27064
26650
  };
27065
26651
  };
27066
26652
 
@@ -27081,7 +26667,7 @@
27081
26667
  };
27082
26668
 
27083
26669
  Scheduler.prototype._cancel = function(scheduled) {
27084
- cancelAnimationFrame(scheduled.executionId);
26670
+ clearTimeout(scheduled.executionId);
27085
26671
  };
27086
26672
 
27087
26673
  /**
@@ -27093,19 +26679,14 @@
27093
26679
  */
27094
26680
  function defer() {
27095
26681
 
27096
- let resolve;
27097
- let reject;
26682
+ const deferred = {};
27098
26683
 
27099
- const promise = new Promise((_resolve, _reject) => {
27100
- resolve = _resolve;
27101
- reject = _reject;
26684
+ deferred.promise = new Promise((resolve, reject) => {
26685
+ deferred.resolve = resolve;
26686
+ deferred.reject = reject;
27102
26687
  });
27103
26688
 
27104
- return {
27105
- promise,
27106
- resolve,
27107
- reject
27108
- };
26689
+ return deferred;
27109
26690
  }
27110
26691
 
27111
26692
  var SchedulerModule = {
@@ -27138,7 +26719,7 @@
27138
26719
 
27139
26720
  var entrySelector = '.entry';
27140
26721
 
27141
- var DEFAULT_PRIORITY$3 = 1000;
26722
+ var DEFAULT_PRIORITY$4 = 1000;
27142
26723
  var CONTEXT_PAD_MARGIN = 8;
27143
26724
  var HOVER_DELAY = 300;
27144
26725
 
@@ -27280,7 +26861,7 @@
27280
26861
  ContextPad.prototype.registerProvider = function(priority, provider) {
27281
26862
  if (!provider) {
27282
26863
  provider = priority;
27283
- priority = DEFAULT_PRIORITY$3;
26864
+ priority = DEFAULT_PRIORITY$4;
27284
26865
  }
27285
26866
 
27286
26867
  this._eventBus.on('contextPad.getProviders', priority, function(event) {
@@ -28133,6 +27714,8 @@
28133
27714
  * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry
28134
27715
  * @typedef {import('./PopupMenuProvider').PopupMenuEmptyPlaceholderProvider | import('./PopupMenuProvider').PopupMenuEmptyPlaceholder} PopupMenuEmptyPlaceholder
28135
27716
  *
27717
+ * @typedef {import('../search/search').default} search
27718
+ *
28136
27719
  * @typedef {import('../../util/Types').Point} Point
28137
27720
  */
28138
27721
 
@@ -28151,6 +27734,7 @@
28151
27734
  * @param {boolean} [props.search]
28152
27735
  * @param {PopupMenuEmptyPlaceholder} [props.emptyPlaceholder]
28153
27736
  * @param {number} [props.width]
27737
+ * @param {search} props.searchFn
28154
27738
  */
28155
27739
  function PopupMenuComponent(props) {
28156
27740
  const {
@@ -28164,6 +27748,7 @@
28164
27748
  scale,
28165
27749
  search,
28166
27750
  emptyPlaceholder,
27751
+ searchFn,
28167
27752
  entries: originalEntries,
28168
27753
  onOpened,
28169
27754
  onClosed
@@ -28185,29 +27770,19 @@
28185
27770
  return originalEntries;
28186
27771
  }
28187
27772
 
28188
- const filter = entry => {
28189
- if (!value) {
28190
- return (entry.rank || 0) >= 0;
28191
- }
28192
-
28193
- if (entry.searchable === false) {
28194
- return false;
28195
- }
28196
-
28197
- const searchableFields = [
28198
- entry.description || '',
28199
- entry.label || '',
28200
- entry.search || ''
28201
- ].map(string => string.toLowerCase());
27773
+ if (!value) {
27774
+ return originalEntries.filter(({ rank = 0 }) => rank >= 0);
27775
+ }
28202
27776
 
28203
- // every word of `value` should be included in one of the searchable fields
28204
- return value
28205
- .toLowerCase()
28206
- .split(/\s/g)
28207
- .every(word => searchableFields.some(field => field.includes(word)));
28208
- };
27777
+ const searchableEntries = originalEntries.filter(({ searchable }) => searchable !== false);
28209
27778
 
28210
- return originalEntries.filter(filter);
27779
+ return searchFn(searchableEntries, value, {
27780
+ keys: [
27781
+ 'label',
27782
+ 'description',
27783
+ 'search'
27784
+ ]
27785
+ }).map(({ item }) => item);
28211
27786
  }, [ searchable ]);
28212
27787
 
28213
27788
  const [ entries, setEntries ] = p$2(filterEntries(originalEntries, value));
@@ -28426,6 +28001,7 @@
28426
28001
  /**
28427
28002
  * @typedef {import('../../core/Canvas').default} Canvas
28428
28003
  * @typedef {import('../../core/EventBus').default} EventBus
28004
+ * @typedef {import('../search/search').default} search
28429
28005
  *
28430
28006
  * @typedef {import('../../util/Types').Point} Point
28431
28007
  *
@@ -28455,7 +28031,7 @@
28455
28031
  'commandStack.changed'
28456
28032
  ];
28457
28033
 
28458
- var DEFAULT_PRIORITY$2 = 1000;
28034
+ var DEFAULT_PRIORITY$3 = 1000;
28459
28035
 
28460
28036
  /**
28461
28037
  * A popup menu to show a number of actions on the canvas.
@@ -28463,10 +28039,12 @@
28463
28039
  * @param {PopupMenuConfig} config
28464
28040
  * @param {EventBus} eventBus
28465
28041
  * @param {Canvas} canvas
28042
+ * @param {search} search
28466
28043
  */
28467
- function PopupMenu(config, eventBus, canvas) {
28044
+ function PopupMenu(config, eventBus, canvas, search) {
28468
28045
  this._eventBus = eventBus;
28469
28046
  this._canvas = canvas;
28047
+ this._search = search;
28470
28048
 
28471
28049
  this._current = null;
28472
28050
 
@@ -28498,7 +28076,8 @@
28498
28076
  PopupMenu.$inject = [
28499
28077
  'config.popupMenu',
28500
28078
  'eventBus',
28501
- 'canvas'
28079
+ 'canvas',
28080
+ 'search'
28502
28081
  ];
28503
28082
 
28504
28083
  PopupMenu.prototype._render = function() {
@@ -28542,6 +28121,7 @@
28542
28121
  scale=${ scale }
28543
28122
  onOpened=${ this._onOpened.bind(this) }
28544
28123
  onClosed=${ this._onClosed.bind(this) }
28124
+ searchFn=${ this._search }
28545
28125
  ...${{ ...options }}
28546
28126
  />
28547
28127
  `,
@@ -28666,6 +28246,8 @@
28666
28246
 
28667
28247
  this.reset();
28668
28248
 
28249
+ this._canvas.restoreFocus();
28250
+
28669
28251
  this._current = null;
28670
28252
  };
28671
28253
 
@@ -28842,7 +28424,7 @@
28842
28424
  PopupMenu.prototype.registerProvider = function(id, priority, provider) {
28843
28425
  if (!provider) {
28844
28426
  provider = priority;
28845
- priority = DEFAULT_PRIORITY$2;
28427
+ priority = DEFAULT_PRIORITY$3;
28846
28428
  }
28847
28429
 
28848
28430
  this._eventBus.on('popupMenu.getProviders.' + id, priority, function(event) {
@@ -28952,7 +28534,6 @@
28952
28534
 
28953
28535
 
28954
28536
  PopupMenu.prototype._getEmptyPlaceholder = function(providers) {
28955
-
28956
28537
  const provider = providers.find(
28957
28538
  provider => isFunction(provider.getEmptyPlaceholder)
28958
28539
  );
@@ -29028,10 +28609,289 @@
29028
28609
  return entry;
29029
28610
  };
29030
28611
 
28612
+ /**
28613
+ * @typedef { {
28614
+ * index: number;
28615
+ * match: boolean;
28616
+ * value: string;
28617
+ * } } Token
28618
+ *
28619
+ * @typedef {Token[]} Tokens
28620
+ */
28621
+
28622
+ /**
28623
+ * @template R
28624
+ *
28625
+ * @typedef { {
28626
+ * item: R,
28627
+ * tokens: Record<string, Tokens>
28628
+ * } } SearchResult
28629
+ */
28630
+
28631
+ /**
28632
+ * Search items by query.
28633
+ *
28634
+ * @template T
28635
+ *
28636
+ * @param {T[]} items
28637
+ * @param {string} pattern
28638
+ * @param { {
28639
+ * keys: string[];
28640
+ * } } options
28641
+ *
28642
+ * @returns {SearchResult<T>[]}
28643
+ */
28644
+ function search(items, pattern, options) {
28645
+
28646
+ const {
28647
+ keys
28648
+ } = options;
28649
+
28650
+ const words = pattern.trim().toLowerCase().split(/\s+/);
28651
+
28652
+ return items.flatMap((item) => {
28653
+ const tokens = matchItem(item, words, keys);
28654
+
28655
+ if (!tokens) {
28656
+ return [];
28657
+ }
28658
+
28659
+ return {
28660
+ item,
28661
+ tokens
28662
+ };
28663
+ }).sort(createResultSorter(keys));
28664
+ }
28665
+
28666
+ /**
28667
+ * Match an item and return tokens in case of a match.
28668
+ *
28669
+ * @param {Object} item
28670
+ * @param {string[]} words
28671
+ * @param {string[]} keys
28672
+ *
28673
+ * @returns {Record<string, Tokens>}
28674
+ */
28675
+ function matchItem(item, words, keys) {
28676
+
28677
+ const {
28678
+ matchedWords,
28679
+ tokens
28680
+ } = keys.reduce((result, key) => {
28681
+ const string = item[ key ];
28682
+
28683
+ const {
28684
+ tokens,
28685
+ matchedWords
28686
+ } = matchString(string, words);
28687
+
28688
+ return {
28689
+ tokens: {
28690
+ ...result.tokens,
28691
+ [ key ]: tokens,
28692
+ },
28693
+ matchedWords: {
28694
+ ...result.matchedWords,
28695
+ ...matchedWords
28696
+ }
28697
+ };
28698
+ }, {
28699
+ matchedWords: {},
28700
+ tokens: {}
28701
+ });
28702
+
28703
+ // only return result if every word got matched
28704
+ if (Object.keys(matchedWords).length !== words.length) {
28705
+ return null;
28706
+ }
28707
+
28708
+ return tokens;
28709
+ }
28710
+
28711
+ /**
28712
+ * Get index of result in list of results.
28713
+ *
28714
+ * @param {string[]} keys
28715
+ *
28716
+ * @returns { (resultA: SearchResult, resultB: SearchResult) => number}
28717
+ */
28718
+ function createResultSorter(keys) {
28719
+
28720
+ /**
28721
+ * @param {SearchResult} resultA
28722
+ * @param {SearchResult} resultB
28723
+ */
28724
+ return (resultA, resultB) => {
28725
+
28726
+ for (const key of keys) {
28727
+
28728
+ const tokenComparison = compareTokens(
28729
+ resultA.tokens[key],
28730
+ resultB.tokens[key]
28731
+ );
28732
+
28733
+ if (tokenComparison !== 0) {
28734
+ return tokenComparison;
28735
+ }
28736
+
28737
+ const stringComparison = compareStrings(
28738
+ resultA.item[ key ],
28739
+ resultB.item[ key ]
28740
+ );
28741
+
28742
+ if (stringComparison !== 0) {
28743
+ return stringComparison;
28744
+ }
28745
+
28746
+ // fall back to next key
28747
+ continue;
28748
+ }
28749
+
28750
+ // eventually call equality
28751
+ return 0;
28752
+ };
28753
+
28754
+ }
28755
+
28756
+ /**
28757
+ * Compares two token arrays.
28758
+ *
28759
+ * @param {Token[]} [tokensA]
28760
+ * @param {Token[]} [tokensB]
28761
+ *
28762
+ * @returns {number}
28763
+ */
28764
+ function compareTokens(tokensA, tokensB) {
28765
+ return scoreTokens(tokensB) - scoreTokens(tokensA);
28766
+ }
28767
+
28768
+ /**
28769
+ * @param { Token[] } tokens
28770
+ * @returns { number }
28771
+ */
28772
+ function scoreTokens(tokens) {
28773
+ return tokens.reduce((sum, token) => sum + scoreToken(token), 0);
28774
+ }
28775
+
28776
+ /**
28777
+ * Score a token.
28778
+ *
28779
+ * @param { Token } token
28780
+ *
28781
+ * @returns { number }
28782
+ */
28783
+ function scoreToken(token) {
28784
+ if (!token.match) {
28785
+ return 0;
28786
+ }
28787
+
28788
+ return token.start
28789
+ ? 1.37
28790
+ : token.wordStart
28791
+ ? 1.13
28792
+ : 1;
28793
+ }
28794
+
28795
+ /**
28796
+ * Compares two strings.
28797
+ *
28798
+ * @param {string} [a = '']
28799
+ * @param {string} [b = '']
28800
+ *
28801
+ * @returns {number}
28802
+ */
28803
+ function compareStrings(a = '', b = '') {
28804
+ return a.localeCompare(b);
28805
+ }
28806
+
28807
+ /**
28808
+ * Match a given string against a set of words,
28809
+ * and return the result.
28810
+ *
28811
+ * @param {string} string
28812
+ * @param {string[]} words
28813
+ *
28814
+ * @return { {
28815
+ * tokens: Token[],
28816
+ * matchedWords: Record<string, boolean>
28817
+ * } }
28818
+ */
28819
+ function matchString(string, words) {
28820
+
28821
+ if (!string) {
28822
+ return {
28823
+ tokens: [],
28824
+ matchedWords: {}
28825
+ };
28826
+ }
28827
+
28828
+ const tokens = [];
28829
+ const matchedWords = {};
28830
+
28831
+ const regexpString = words.map(escapeRegexp).flatMap(str => [ '(?<wordStart>\\b' + str + ')', str ]).join('|');
28832
+
28833
+ const regexp = new RegExp(regexpString, 'ig');
28834
+
28835
+ let match;
28836
+ let lastIndex = 0;
28837
+
28838
+ while ((match = regexp.exec(string))) {
28839
+
28840
+ const [ value ] = match;
28841
+
28842
+ if (match.index > lastIndex) {
28843
+
28844
+ // add previous token (NO match)
28845
+ tokens.push({
28846
+ value: string.slice(lastIndex, match.index),
28847
+ index: lastIndex
28848
+ });
28849
+ }
28850
+
28851
+ // add current token (match)
28852
+ tokens.push({
28853
+ value,
28854
+ index: match.index,
28855
+ match: true,
28856
+ wordStart: !!match.groups.wordStart,
28857
+ start: match.index === 0
28858
+ });
28859
+
28860
+ matchedWords[value.toLowerCase()] = true;
28861
+
28862
+ lastIndex = match.index + value.length;
28863
+ }
28864
+
28865
+ // add after token (NO match)
28866
+ if (lastIndex < string.length) {
28867
+ tokens.push({
28868
+ value: string.slice(lastIndex),
28869
+ index: lastIndex
28870
+ });
28871
+ }
28872
+
28873
+ return {
28874
+ tokens,
28875
+ matchedWords
28876
+ };
28877
+ }
28878
+
28879
+ function escapeRegexp(string) {
28880
+ return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
28881
+ }
28882
+
28883
+ /**
28884
+ * @type { import('didi').ModuleDeclaration }
28885
+ */
28886
+ var SearchModule$1 = {
28887
+ search: [ 'value', search ]
28888
+ };
28889
+
29031
28890
  /**
29032
28891
  * @type { import('didi').ModuleDeclaration }
29033
28892
  */
29034
28893
  var PopupMenuModule$1 = {
28894
+ __depends__: [ SearchModule$1 ],
29035
28895
  __init__: [ 'popupMenu' ],
29036
28896
  popupMenu: [ 'type', PopupMenu ]
29037
28897
  };
@@ -29089,7 +28949,7 @@
29089
28949
  * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default<Element>} ContextPadProvider
29090
28950
  */
29091
28951
 
29092
- var LOW_PRIORITY$m = 900;
28952
+ var LOW_PRIORITY$n = 900;
29093
28953
 
29094
28954
  /**
29095
28955
  * A provider for the `Align elements` context pad entry.
@@ -29103,7 +28963,7 @@
29103
28963
  */
29104
28964
  function AlignElementsContextPadProvider(contextPad, popupMenu, translate, canvas) {
29105
28965
 
29106
- contextPad.registerProvider(LOW_PRIORITY$m, this);
28966
+ contextPad.registerProvider(LOW_PRIORITY$n, this);
29107
28967
 
29108
28968
  this._contextPad = contextPad;
29109
28969
  this._popupMenu = popupMenu;
@@ -29733,7 +29593,7 @@
29733
29593
  * @typedef {import('../modeling/Modeling').default} Modeling
29734
29594
  */
29735
29595
 
29736
- var LOW_PRIORITY$l = 100;
29596
+ var LOW_PRIORITY$m = 100;
29737
29597
 
29738
29598
 
29739
29599
  /**
@@ -29746,7 +29606,7 @@
29746
29606
  */
29747
29607
  function AutoPlace$1(eventBus, modeling, canvas) {
29748
29608
 
29749
- eventBus.on('autoPlace', LOW_PRIORITY$l, function(context) {
29609
+ eventBus.on('autoPlace', LOW_PRIORITY$m, function(context) {
29750
29610
  var shape = context.shape,
29751
29611
  source = context.source;
29752
29612
 
@@ -33830,7 +33690,7 @@
33830
33690
  */
33831
33691
 
33832
33692
  var HIGH_PRIORITY$h = 1100,
33833
- LOW_PRIORITY$k = 900;
33693
+ LOW_PRIORITY$l = 900;
33834
33694
 
33835
33695
  var MARKER_OK$3 = 'connect-ok',
33836
33696
  MARKER_NOT_OK$3 = 'connect-not-ok';
@@ -33874,7 +33734,7 @@
33874
33734
  });
33875
33735
  });
33876
33736
 
33877
- eventBus.on('connect.hover', LOW_PRIORITY$k, function(event) {
33737
+ eventBus.on('connect.hover', LOW_PRIORITY$l, function(event) {
33878
33738
  var context = event.context,
33879
33739
  hover = event.hover,
33880
33740
  canExecute = context.canExecute;
@@ -34355,12 +34215,10 @@
34355
34215
 
34356
34216
  if (gfx.childNodes) {
34357
34217
 
34358
- // TODO: use forEach once we drop PhantomJS
34359
- for (var i = 0; i < gfx.childNodes.length; i++) {
34218
+ gfx.childNodes.forEach((childNode) => {
34219
+ self._cloneMarkers(childNode, className, rootGfx);
34220
+ });
34360
34221
 
34361
- // recursively clone markers of child nodes
34362
- self._cloneMarkers(gfx.childNodes[ i ], className, rootGfx);
34363
- }
34364
34222
  }
34365
34223
 
34366
34224
  if (!canHaveMarker(gfx)) {
@@ -34647,9 +34505,8 @@
34647
34505
  var ELEMENT_LABEL_DISTANCE = 10;
34648
34506
 
34649
34507
  /**
34650
- * A component that makes sure that external labels are added
34651
- * together with respective elements and properly updated (DI wise)
34652
- * during move.
34508
+ * A behavior that ensures that labels are positioned in a way that they do not
34509
+ * overlap with other elements or connections.
34653
34510
  *
34654
34511
  * @param {EventBus} eventBus
34655
34512
  * @param {Modeling} modeling
@@ -34710,6 +34567,10 @@
34710
34567
  return;
34711
34568
  }
34712
34569
 
34570
+ if (isConnection$1(element)) {
34571
+ return;
34572
+ }
34573
+
34713
34574
  var optimalPosition = getOptimalPosition(element);
34714
34575
 
34715
34576
  // no optimal position found
@@ -34970,7 +34831,7 @@
34970
34831
  * @typedef {import('didi').Injector} Injector
34971
34832
  */
34972
34833
 
34973
- var LOW_PRIORITY$j = 500;
34834
+ var LOW_PRIORITY$k = 500;
34974
34835
 
34975
34836
 
34976
34837
  /**
@@ -34986,7 +34847,7 @@
34986
34847
 
34987
34848
  var self = this;
34988
34849
 
34989
- this.postExecuted('elements.create', LOW_PRIORITY$j, function(context) {
34850
+ this.postExecuted('elements.create', LOW_PRIORITY$k, function(context) {
34990
34851
  var elements = context.elements;
34991
34852
 
34992
34853
  elements = elements.filter(function(shape) {
@@ -35009,7 +34870,7 @@
35009
34870
  }, true);
35010
34871
 
35011
34872
 
35012
- this.preExecute('elements.move', LOW_PRIORITY$j, function(context) {
34873
+ this.preExecute('elements.move', LOW_PRIORITY$k, function(context) {
35013
34874
  var shapes = context.shapes,
35014
34875
  host = context.newHost;
35015
34876
 
@@ -36441,7 +36302,7 @@
36441
36302
  * @typedef {import('../../space-tool/BpmnSpaceTool').default} SpaceTool
36442
36303
  */
36443
36304
 
36444
- var LOW_PRIORITY$i = 500;
36305
+ var LOW_PRIORITY$j = 500;
36445
36306
 
36446
36307
 
36447
36308
  /**
@@ -36554,7 +36415,7 @@
36554
36415
  /**
36555
36416
  * Adjust sizes of other lanes after lane deletion
36556
36417
  */
36557
- this.postExecuted('shape.delete', LOW_PRIORITY$i, function(event) {
36418
+ this.postExecuted('shape.delete', LOW_PRIORITY$j, function(event) {
36558
36419
 
36559
36420
  var context = event.context,
36560
36421
  hints = context.hints,
@@ -36587,7 +36448,7 @@
36587
36448
  * @typedef {import('didi').Injector} Injector
36588
36449
  */
36589
36450
 
36590
- var LOW_PRIORITY$h = 500;
36451
+ var LOW_PRIORITY$i = 500;
36591
36452
 
36592
36453
 
36593
36454
  /**
@@ -36603,7 +36464,7 @@
36603
36464
 
36604
36465
  var self = this;
36605
36466
 
36606
- this.postExecuted('elements.create', LOW_PRIORITY$h, function(context) {
36467
+ this.postExecuted('elements.create', LOW_PRIORITY$i, function(context) {
36607
36468
  var elements = context.elements;
36608
36469
 
36609
36470
  elements.filter(function(shape) {
@@ -36617,7 +36478,7 @@
36617
36478
  });
36618
36479
  }, true);
36619
36480
 
36620
- this.preExecute('elements.move', LOW_PRIORITY$h, function(context) {
36481
+ this.preExecute('elements.move', LOW_PRIORITY$i, function(context) {
36621
36482
  var shapes = context.shapes,
36622
36483
  newHost = context.newHost;
36623
36484
 
@@ -39661,14 +39522,11 @@
39661
39522
 
39662
39523
  if (/n/.test(resizeDirection)) {
39663
39524
  minTrbl.top = laneTrbl.bottom - minDimensions.height;
39664
- } else
39665
- if (/e/.test(resizeDirection)) {
39525
+ } else if (/e/.test(resizeDirection)) {
39666
39526
  minTrbl.right = laneTrbl.left + minDimensions.width;
39667
- } else
39668
- if (/s/.test(resizeDirection)) {
39527
+ } else if (/s/.test(resizeDirection)) {
39669
39528
  minTrbl.bottom = laneTrbl.top + minDimensions.height;
39670
- } else
39671
- if (/w/.test(resizeDirection)) {
39529
+ } else if (/w/.test(resizeDirection)) {
39672
39530
  minTrbl.left = laneTrbl.right - minDimensions.width;
39673
39531
  }
39674
39532
 
@@ -39859,7 +39717,7 @@
39859
39717
  * @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL
39860
39718
  */
39861
39719
 
39862
- var LOW_PRIORITY$g = 500;
39720
+ var LOW_PRIORITY$h = 500;
39863
39721
 
39864
39722
 
39865
39723
  /**
@@ -39989,7 +39847,7 @@
39989
39847
  }
39990
39848
  });
39991
39849
 
39992
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$g, function(context) {
39850
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$h, function(context) {
39993
39851
  var descriptor = context.descriptor,
39994
39852
  businessObject = descriptor.businessObject,
39995
39853
  referencedRootElement = descriptor.referencedRootElement;
@@ -40234,7 +40092,7 @@
40234
40092
  * @typedef {import('../../../model/Types').ModdleElement} ModdleElement
40235
40093
  */
40236
40094
 
40237
- var LOW_PRIORITY$f = 400;
40095
+ var LOW_PRIORITY$g = 400;
40238
40096
  var HIGH_PRIORITY$d = 600;
40239
40097
 
40240
40098
  var DEFAULT_POSITION = {
@@ -40487,7 +40345,7 @@
40487
40345
 
40488
40346
 
40489
40347
  // create/remove plane for the subprocess
40490
- this.executed('shape.toggleCollapse', LOW_PRIORITY$f, function(context) {
40348
+ this.executed('shape.toggleCollapse', LOW_PRIORITY$g, function(context) {
40491
40349
  var shape = context.shape;
40492
40350
 
40493
40351
  if (!is$1(shape, 'bpmn:SubProcess')) {
@@ -40505,7 +40363,7 @@
40505
40363
 
40506
40364
 
40507
40365
  // create/remove plane for the subprocess
40508
- this.reverted('shape.toggleCollapse', LOW_PRIORITY$f, function(context) {
40366
+ this.reverted('shape.toggleCollapse', LOW_PRIORITY$g, function(context) {
40509
40367
  var shape = context.shape;
40510
40368
 
40511
40369
  if (!is$1(shape, 'bpmn:SubProcess')) {
@@ -40952,7 +40810,7 @@
40952
40810
  * @typedef {import('../Modeling').default} Modeling
40953
40811
  */
40954
40812
 
40955
- var LOW_PRIORITY$e = 500;
40813
+ var LOW_PRIORITY$f = 500;
40956
40814
 
40957
40815
  /**
40958
40816
  * @param {EventBus} eventBus
@@ -41013,7 +40871,7 @@
41013
40871
  };
41014
40872
  }
41015
40873
 
41016
- this.executed([ 'shape.toggleCollapse' ], LOW_PRIORITY$e, function(e) {
40874
+ this.executed([ 'shape.toggleCollapse' ], LOW_PRIORITY$f, function(e) {
41017
40875
 
41018
40876
  var context = e.context,
41019
40877
  shape = context.shape;
@@ -41036,7 +40894,7 @@
41036
40894
  }
41037
40895
  });
41038
40896
 
41039
- this.reverted([ 'shape.toggleCollapse' ], LOW_PRIORITY$e, function(e) {
40897
+ this.reverted([ 'shape.toggleCollapse' ], LOW_PRIORITY$f, function(e) {
41040
40898
 
41041
40899
  var context = e.context;
41042
40900
  var shape = context.shape;
@@ -41051,7 +40909,7 @@
41051
40909
  }
41052
40910
  });
41053
40911
 
41054
- this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY$e, function(e) {
40912
+ this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY$f, function(e) {
41055
40913
  var shape = e.context.shape,
41056
40914
  defaultSize = elementFactory.getDefaultSize(shape),
41057
40915
  newBounds;
@@ -41206,7 +41064,7 @@
41206
41064
  * @typedef {import('../Modeling').default} Modeling
41207
41065
  */
41208
41066
 
41209
- var LOW_PRIORITY$d = 500,
41067
+ var LOW_PRIORITY$e = 500,
41210
41068
  HIGH_PRIORITY$c = 5000;
41211
41069
 
41212
41070
 
@@ -41284,7 +41142,7 @@
41284
41142
  initContext();
41285
41143
  });
41286
41144
 
41287
- this.postExecuted(laneRefUpdateEvents, LOW_PRIORITY$d, function(event) {
41145
+ this.postExecuted(laneRefUpdateEvents, LOW_PRIORITY$e, function(event) {
41288
41146
  releaseContext();
41289
41147
  });
41290
41148
 
@@ -43420,7 +43278,7 @@
43420
43278
  * @typedef {import('../../draw/Styles').default} Styles
43421
43279
  */
43422
43280
 
43423
- var LOW_PRIORITY$c = 750;
43281
+ var LOW_PRIORITY$d = 750;
43424
43282
 
43425
43283
  /**
43426
43284
  * @param {Canvas} canvas
@@ -43471,7 +43329,7 @@
43471
43329
  return dragGroup;
43472
43330
  }
43473
43331
 
43474
- eventBus.on('create.move', LOW_PRIORITY$c, function(event) {
43332
+ eventBus.on('create.move', LOW_PRIORITY$d, function(event) {
43475
43333
 
43476
43334
  var hover = event.hover,
43477
43335
  context = event.context,
@@ -44230,7 +44088,7 @@
44230
44088
  });
44231
44089
  }
44232
44090
 
44233
- var LOW_PRIORITY$b = 750;
44091
+ var LOW_PRIORITY$c = 750;
44234
44092
 
44235
44093
  /**
44236
44094
  * BPMN-specific copy & paste.
@@ -44247,7 +44105,7 @@
44247
44105
  return moddleCopy.copyElement(bo, targetBo, null, clone);
44248
44106
  }
44249
44107
 
44250
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$b, function(context) {
44108
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$c, function(context) {
44251
44109
  var descriptor = context.descriptor,
44252
44110
  element = context.element,
44253
44111
  businessObject = getBusinessObject(element);
@@ -44344,7 +44202,7 @@
44344
44202
 
44345
44203
  // copy + paste processRef with participant
44346
44204
 
44347
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$b, function(context) {
44205
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$c, function(context) {
44348
44206
  var descriptor = context.descriptor,
44349
44207
  element = context.element;
44350
44208
 
@@ -44370,7 +44228,7 @@
44370
44228
 
44371
44229
  // resolve references
44372
44230
 
44373
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$b, function(context) {
44231
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$c, function(context) {
44374
44232
  var cache = context.cache,
44375
44233
  descriptor = context.descriptor;
44376
44234
 
@@ -45156,7 +45014,7 @@
45156
45014
  * @typedef {import('../../core/EventBus').Event} Event
45157
45015
  */
45158
45016
 
45159
- var LOW_PRIORITY$a = 250;
45017
+ var LOW_PRIORITY$b = 250;
45160
45018
 
45161
45019
  /**
45162
45020
  * The tool manager acts as middle-man between the available tool's and the Palette,
@@ -45235,7 +45093,7 @@
45235
45093
  eventsToRegister.push(event + '.canceled');
45236
45094
  });
45237
45095
 
45238
- eventBus.on(eventsToRegister, LOW_PRIORITY$a, function(event) {
45096
+ eventBus.on(eventsToRegister, LOW_PRIORITY$b, function(event) {
45239
45097
 
45240
45098
  // We defer the de-activation of the tool to the .activate phase,
45241
45099
  // so we're able to check if we want to toggle off the current
@@ -46025,7 +45883,7 @@
46025
45883
  var MARKER_DRAGGING$1 = 'djs-dragging',
46026
45884
  MARKER_RESIZING$1 = 'djs-resizing';
46027
45885
 
46028
- var LOW_PRIORITY$9 = 250;
45886
+ var LOW_PRIORITY$a = 250;
46029
45887
 
46030
45888
  /**
46031
45889
  * @typedef {import('../../core/Canvas').default} Canvas
@@ -46107,7 +45965,7 @@
46107
45965
  });
46108
45966
 
46109
45967
  // add and update move/resize previews
46110
- eventBus.on('spaceTool.move', LOW_PRIORITY$9, function(event) {
45968
+ eventBus.on('spaceTool.move', LOW_PRIORITY$a, function(event) {
46111
45969
 
46112
45970
  var context = event.context,
46113
45971
  line = context.line,
@@ -46987,7 +46845,7 @@
46987
46845
  return collection;
46988
46846
  }
46989
46847
 
46990
- var LOW_PRIORITY$8 = 250,
46848
+ var LOW_PRIORITY$9 = 250,
46991
46849
  HIGH_PRIORITY$8 = 1400;
46992
46850
 
46993
46851
  /**
@@ -47026,7 +46884,7 @@
47026
46884
  });
47027
46885
 
47028
46886
  // add labels to visual's group
47029
- movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$8, function(e) {
46887
+ movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$9, function(e) {
47030
46888
 
47031
46889
  var context = e.context,
47032
46890
  shapes = context.shapes;
@@ -47169,7 +47027,7 @@
47169
47027
  * @typedef {import('../modeling/Modeling').default} Modeling
47170
47028
  */
47171
47029
 
47172
- var LOW_PRIORITY$7 = 251,
47030
+ var LOW_PRIORITY$8 = 251,
47173
47031
  HIGH_PRIORITY$7 = 1401;
47174
47032
 
47175
47033
  var MARKER_ATTACH$1 = 'attach-ok';
@@ -47211,7 +47069,7 @@
47211
47069
  });
47212
47070
 
47213
47071
  // add attachers to the visual's group
47214
- movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$7, function(e) {
47072
+ movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$8, function(e) {
47215
47073
 
47216
47074
  var context = e.context,
47217
47075
  shapes = context.shapes,
@@ -48214,17 +48072,13 @@
48214
48072
  }
48215
48073
 
48216
48074
  containment = 'lanes';
48217
- } else
48218
-
48219
- if (is$1(businessObject, 'bpmn:FlowElement')) {
48075
+ } else if (is$1(businessObject, 'bpmn:FlowElement')) {
48220
48076
 
48221
48077
  if (newParent) {
48222
48078
 
48223
48079
  if (is$1(newParent, 'bpmn:Participant')) {
48224
48080
  newParent = newParent.processRef;
48225
- } else
48226
-
48227
- if (is$1(newParent, 'bpmn:Lane')) {
48081
+ } else if (is$1(newParent, 'bpmn:Lane')) {
48228
48082
  do {
48229
48083
 
48230
48084
  // unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer)
@@ -48236,9 +48090,7 @@
48236
48090
 
48237
48091
  containment = 'flowElements';
48238
48092
 
48239
- } else
48240
-
48241
- if (is$1(businessObject, 'bpmn:Artifact')) {
48093
+ } else if (is$1(businessObject, 'bpmn:Artifact')) {
48242
48094
 
48243
48095
  while (newParent &&
48244
48096
  !is$1(newParent, 'bpmn:Process') &&
@@ -48254,14 +48106,9 @@
48254
48106
  }
48255
48107
 
48256
48108
  containment = 'artifacts';
48257
- } else
48258
-
48259
- if (is$1(businessObject, 'bpmn:MessageFlow')) {
48109
+ } else if (is$1(businessObject, 'bpmn:MessageFlow')) {
48260
48110
  containment = 'messageFlows';
48261
-
48262
- } else
48263
-
48264
- if (is$1(businessObject, 'bpmn:Participant')) {
48111
+ } else if (is$1(businessObject, 'bpmn:Participant')) {
48265
48112
  containment = 'participants';
48266
48113
 
48267
48114
  // make sure the participants process is properly attached / detached
@@ -48283,13 +48130,9 @@
48283
48130
  process.$parent = definitions;
48284
48131
  }
48285
48132
  }
48286
- } else
48287
-
48288
- if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48133
+ } else if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48289
48134
  containment = 'dataOutputAssociations';
48290
- } else
48291
-
48292
- if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48135
+ } else if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48293
48136
  containment = 'dataInputAssociations';
48294
48137
  }
48295
48138
 
@@ -48385,9 +48228,7 @@
48385
48228
 
48386
48229
  businessObject.targetRef = newTargetBo;
48387
48230
  }
48388
- } else
48389
-
48390
- if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48231
+ } else if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48391
48232
 
48392
48233
  // handle obnoxious isMsome sourceRef
48393
48234
  businessObject.get('sourceRef')[0] = newSourceBo;
@@ -48395,9 +48236,7 @@
48395
48236
  visualParent = context.parent || context.newParent || newTargetBo;
48396
48237
 
48397
48238
  this.updateSemanticParent(businessObject, newTargetBo, visualParent);
48398
- } else
48399
-
48400
- if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48239
+ } else if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48401
48240
  visualParent = context.parent || context.newParent || newSourceBo;
48402
48241
 
48403
48242
  this.updateSemanticParent(businessObject, newSourceBo, visualParent);
@@ -48614,8 +48453,7 @@
48614
48453
 
48615
48454
  if (elementType === 'root') {
48616
48455
  di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
48617
- } else
48618
- if (elementType === 'connection') {
48456
+ } else if (elementType === 'connection') {
48619
48457
  di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
48620
48458
  } else {
48621
48459
  di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
@@ -52088,15 +51926,13 @@
52088
51926
  if (isHorizontalLane) {
52089
51927
  if (location === 'left') {
52090
51928
  location = 'top';
52091
- } else
52092
- if (location === 'right') {
51929
+ } else if (location === 'right') {
52093
51930
  location = 'bottom';
52094
51931
  }
52095
51932
  } else {
52096
51933
  if (location === 'top') {
52097
51934
  location = 'left';
52098
- } else
52099
- if (location === 'bottom') {
51935
+ } else if (location === 'bottom') {
52100
51936
  location = 'right';
52101
51937
  }
52102
51938
  }
@@ -52157,22 +51993,19 @@
52157
51993
  spacePos = lanePosition + 10;
52158
51994
  direction = 'n';
52159
51995
  axis = 'y';
52160
- } else
52161
- if (location === 'left') {
51996
+ } else if (location === 'left') {
52162
51997
  offset = -120;
52163
51998
  lanePosition = shape.x;
52164
51999
  spacePos = lanePosition + 10;
52165
52000
  direction = 'w';
52166
52001
  axis = 'x';
52167
- } else
52168
- if (location === 'bottom') {
52002
+ } else if (location === 'bottom') {
52169
52003
  offset = 120;
52170
52004
  lanePosition = shape.y + shape.height;
52171
52005
  spacePos = lanePosition - 10;
52172
52006
  direction = 's';
52173
52007
  axis = 'y';
52174
- } else
52175
- if (location === 'right') {
52008
+ } else if (location === 'right') {
52176
52009
  offset = 120;
52177
52010
  lanePosition = shape.x + shape.width;
52178
52011
  spacePos = lanePosition - 10;
@@ -55193,10 +55026,12 @@
55193
55026
  * to edit an elements text directly in the diagram
55194
55027
  *
55195
55028
  * @param {EventBus} eventBus the event bus
55029
+ * @param {Canvas} canvas the canvas
55196
55030
  */
55197
55031
  function DirectEditing(eventBus, canvas) {
55198
55032
 
55199
55033
  this._eventBus = eventBus;
55034
+ this._canvas = canvas;
55200
55035
 
55201
55036
  this._providers = [];
55202
55037
  this._textbox = new TextBox({
@@ -55260,6 +55095,9 @@
55260
55095
  this._active = null;
55261
55096
 
55262
55097
  this.resizable = undefined;
55098
+
55099
+ // restoreFocus API is available from diagram-js@15.0.0
55100
+ this._canvas.restoreFocus && this._canvas.restoreFocus();
55263
55101
  };
55264
55102
 
55265
55103
 
@@ -56811,26 +56649,24 @@
56811
56649
  var self = this;
56812
56650
  var translate = this._translate;
56813
56651
 
56814
- function toggleLoopEntry(event, entry) {
56815
-
56816
- // remove
56652
+ function toggleLoopCharacteristics(event, entry) {
56817
56653
  if (entry.active) {
56818
56654
  self._modeling.updateProperties(target, { loopCharacteristics: undefined });
56655
+
56819
56656
  return;
56820
56657
  }
56821
56658
 
56822
- const currentLoopCharacteristics = target.businessObject.get('loopCharacteristics'),
56823
- newLoopCharacteristics = self._moddle.create(entry.options.loopCharacteristics);
56824
-
56825
- // copy old properties
56826
- if (currentLoopCharacteristics) {
56827
- self._moddleCopy.copyElement(currentLoopCharacteristics, newLoopCharacteristics);
56828
- }
56659
+ var loopCharacteristics = target.businessObject.get('loopCharacteristics');
56829
56660
 
56830
- // update `isSequential` property
56831
- newLoopCharacteristics.set('isSequential', entry.options.isSequential);
56661
+ if (loopCharacteristics && is$1(loopCharacteristics, entry.options.loopCharacteristics)) {
56662
+ self._modeling.updateModdleProperties(target, loopCharacteristics, { isSequential: entry.options.isSequential });
56663
+ } else {
56664
+ loopCharacteristics = self._moddle.create(entry.options.loopCharacteristics, {
56665
+ isSequential: entry.options.isSequential
56666
+ });
56832
56667
 
56833
- self._modeling.updateProperties(target, { loopCharacteristics: newLoopCharacteristics });
56668
+ self._modeling.updateProperties(target, { loopCharacteristics: loopCharacteristics });
56669
+ }
56834
56670
  }
56835
56671
 
56836
56672
  var businessObject = getBusinessObject(target),
@@ -56852,7 +56688,7 @@
56852
56688
  className: 'bpmn-icon-parallel-mi-marker',
56853
56689
  title: translate('Parallel multi-instance'),
56854
56690
  active: isParallel,
56855
- action: toggleLoopEntry,
56691
+ action: toggleLoopCharacteristics,
56856
56692
  options: {
56857
56693
  loopCharacteristics: 'bpmn:MultiInstanceLoopCharacteristics',
56858
56694
  isSequential: false
@@ -56862,7 +56698,7 @@
56862
56698
  className: 'bpmn-icon-sequential-mi-marker',
56863
56699
  title: translate('Sequential multi-instance'),
56864
56700
  active: isSequential,
56865
- action: toggleLoopEntry,
56701
+ action: toggleLoopCharacteristics,
56866
56702
  options: {
56867
56703
  loopCharacteristics: 'bpmn:MultiInstanceLoopCharacteristics',
56868
56704
  isSequential: true
@@ -56872,7 +56708,7 @@
56872
56708
  className: 'bpmn-icon-loop-marker',
56873
56709
  title: translate('Loop'),
56874
56710
  active: isLoop,
56875
- action: toggleLoopEntry,
56711
+ action: toggleLoopCharacteristics,
56876
56712
  options: {
56877
56713
  loopCharacteristics: 'bpmn:StandardLoopCharacteristics'
56878
56714
  }
@@ -57409,9 +57245,7 @@
57409
57245
  { eventDefinitionType: 'bpmn:SignalEventDefinition' }
57410
57246
  )
57411
57247
  });
57412
- } else
57413
-
57414
- if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
57248
+ } else if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
57415
57249
 
57416
57250
  assign$1(actions, {
57417
57251
  'append.compensation-activity':
@@ -57424,9 +57258,7 @@
57424
57258
  }
57425
57259
  )
57426
57260
  });
57427
- } else
57428
-
57429
- if (!is$1(businessObject, 'bpmn:EndEvent') &&
57261
+ } else if (!is$1(businessObject, 'bpmn:EndEvent') &&
57430
57262
  !businessObject.isForCompensation &&
57431
57263
  !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
57432
57264
  !isEventSubProcess(businessObject)) {
@@ -57906,7 +57738,7 @@
57906
57738
  * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').PopupMenuTarget} PopupMenuTarget
57907
57739
  */
57908
57740
 
57909
- var LOW_PRIORITY$6 = 900;
57741
+ var LOW_PRIORITY$7 = 900;
57910
57742
 
57911
57743
  /**
57912
57744
  * A provider for the distribute elements popup menu.
@@ -57925,7 +57757,7 @@
57925
57757
  this._popupMenu = popupMenu;
57926
57758
  this._rules = rules;
57927
57759
 
57928
- popupMenu.registerProvider('align-elements', LOW_PRIORITY$6, this);
57760
+ popupMenu.registerProvider('align-elements', LOW_PRIORITY$7, this);
57929
57761
  }
57930
57762
 
57931
57763
  DistributeElementsMenuProvider.$inject = [
@@ -58498,7 +58330,7 @@
58498
58330
  */
58499
58331
 
58500
58332
  var LOWER_PRIORITY = 1200;
58501
- var LOW_PRIORITY$5 = 800;
58333
+ var LOW_PRIORITY$6 = 800;
58502
58334
 
58503
58335
  /**
58504
58336
  * Basic grid snapping that covers connecting, creating, moving, resizing shapes, moving bendpoints
@@ -58516,7 +58348,7 @@
58516
58348
 
58517
58349
  var self = this;
58518
58350
 
58519
- eventBus.on('diagram.init', LOW_PRIORITY$5, function() {
58351
+ eventBus.on('diagram.init', LOW_PRIORITY$6, function() {
58520
58352
  self.setActive(active);
58521
58353
  });
58522
58354
 
@@ -59400,17 +59232,13 @@
59400
59232
 
59401
59233
  if (is$1(element, 'bpmn:Lane')) {
59402
59234
  return self._createParticipantHit(element, gfx);
59403
- } else
59404
-
59405
- if (is$1(element, 'bpmn:Participant')) {
59235
+ } else if (is$1(element, 'bpmn:Participant')) {
59406
59236
  if (isExpanded(element)) {
59407
59237
  return self._createParticipantHit(element, gfx);
59408
59238
  } else {
59409
59239
  return self._createDefaultHit(element, gfx);
59410
59240
  }
59411
- } else
59412
-
59413
- if (is$1(element, 'bpmn:SubProcess')) {
59241
+ } else if (is$1(element, 'bpmn:SubProcess')) {
59414
59242
  if (isExpanded(element)) {
59415
59243
  return self._createSubProcessHit(element, gfx);
59416
59244
  } else {
@@ -60149,7 +59977,7 @@
60149
59977
  var MARKER_RESIZING = 'djs-resizing',
60150
59978
  MARKER_RESIZE_NOT_OK = 'resize-not-ok';
60151
59979
 
60152
- var LOW_PRIORITY$4 = 500;
59980
+ var LOW_PRIORITY$5 = 500;
60153
59981
 
60154
59982
  /**
60155
59983
  * @typedef {import('../../core/Canvas').default} Canvas
@@ -60215,7 +60043,7 @@
60215
60043
  }
60216
60044
 
60217
60045
  // add and update previews
60218
- eventBus.on('resize.move', LOW_PRIORITY$4, function(event) {
60046
+ eventBus.on('resize.move', LOW_PRIORITY$5, function(event) {
60219
60047
  updateFrame(event.context);
60220
60048
  });
60221
60049
 
@@ -61520,6 +61348,285 @@
61520
61348
  modelingFeedback: [ 'type', ModelingFeedback ]
61521
61349
  };
61522
61350
 
61351
+ var LOW_PRIORITY$4 = 500;
61352
+
61353
+ var DEFAULT_PRIORITY$2 = 1000;
61354
+
61355
+ /**
61356
+ * @typedef {import('../../model/Types').Element} Element
61357
+ *
61358
+ * @typedef {import('./OutlineProvider').default} OutlineProvider
61359
+ * @typedef {import('../../core/EventBus').default} EventBus
61360
+ * @typedef {import('../../draw/Styles').default} Styles
61361
+ */
61362
+
61363
+ /**
61364
+ * @class
61365
+ *
61366
+ * A plugin that adds an outline to shapes and connections that may be activated and styled
61367
+ * via CSS classes.
61368
+ *
61369
+ * @param {EventBus} eventBus
61370
+ * @param {Styles} styles
61371
+ */
61372
+ function Outline(eventBus, styles) {
61373
+
61374
+ this._eventBus = eventBus;
61375
+
61376
+ this.offset = 5;
61377
+
61378
+ var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
61379
+
61380
+ var self = this;
61381
+
61382
+ /**
61383
+ * @param {SVGElement} gfx
61384
+ *
61385
+ * @return {SVGElement} outline
61386
+ */
61387
+ function createOutline(gfx) {
61388
+ var outline = create$1('rect');
61389
+
61390
+ attr(outline, assign$1({
61391
+ x: 0,
61392
+ y: 0,
61393
+ rx: 4,
61394
+ width: 100,
61395
+ height: 100
61396
+ }, OUTLINE_STYLE));
61397
+
61398
+ return outline;
61399
+ }
61400
+
61401
+ // A low priortity is necessary, because outlines of labels have to be updated
61402
+ // after the label bounds have been updated in the renderer.
61403
+ eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$4, function(event) {
61404
+ var element = event.element,
61405
+ gfx = event.gfx;
61406
+
61407
+ var outline = query('.djs-outline', gfx);
61408
+
61409
+ if (!outline) {
61410
+ outline = self.getOutline(element) || createOutline();
61411
+ append(gfx, outline);
61412
+ }
61413
+
61414
+ self.updateShapeOutline(outline, element);
61415
+ });
61416
+
61417
+ eventBus.on([ 'connection.added', 'connection.changed' ], function(event) {
61418
+ var element = event.element,
61419
+ gfx = event.gfx;
61420
+
61421
+ var outline = query('.djs-outline', gfx);
61422
+
61423
+ if (!outline) {
61424
+ outline = createOutline();
61425
+ append(gfx, outline);
61426
+ }
61427
+
61428
+ self.updateConnectionOutline(outline, element);
61429
+ });
61430
+ }
61431
+
61432
+
61433
+ /**
61434
+ * Updates the outline of a shape respecting the dimension of the
61435
+ * element and an outline offset.
61436
+ *
61437
+ * @param {SVGElement} outline
61438
+ * @param {Element} element
61439
+ */
61440
+ Outline.prototype.updateShapeOutline = function(outline, element) {
61441
+
61442
+ var updated = false;
61443
+ var providers = this._getProviders();
61444
+
61445
+ if (providers.length) {
61446
+ forEach$1(providers, function(provider) {
61447
+ updated = updated || provider.updateOutline(element, outline);
61448
+ });
61449
+ }
61450
+
61451
+ if (!updated) {
61452
+ attr(outline, {
61453
+ x: -this.offset,
61454
+ y: -this.offset,
61455
+ width: element.width + this.offset * 2,
61456
+ height: element.height + this.offset * 2
61457
+ });
61458
+ }
61459
+ };
61460
+
61461
+ /**
61462
+ * Updates the outline of a connection respecting the bounding box of
61463
+ * the connection and an outline offset.
61464
+ * Register an outline provider with the given priority.
61465
+ *
61466
+ * @param {SVGElement} outline
61467
+ * @param {Element} connection
61468
+ */
61469
+ Outline.prototype.updateConnectionOutline = function(outline, connection) {
61470
+ var bbox = getBBox(connection);
61471
+
61472
+ attr(outline, {
61473
+ x: bbox.x - this.offset,
61474
+ y: bbox.y - this.offset,
61475
+ width: bbox.width + this.offset * 2,
61476
+ height: bbox.height + this.offset * 2
61477
+ });
61478
+ };
61479
+
61480
+ /**
61481
+ * Register an outline provider with the given priority.
61482
+ *
61483
+ * @param {number} priority
61484
+ * @param {OutlineProvider} provider
61485
+ */
61486
+ Outline.prototype.registerProvider = function(priority, provider) {
61487
+ if (!provider) {
61488
+ provider = priority;
61489
+ priority = DEFAULT_PRIORITY$2;
61490
+ }
61491
+
61492
+ this._eventBus.on('outline.getProviders', priority, function(event) {
61493
+ event.providers.push(provider);
61494
+ });
61495
+ };
61496
+
61497
+ /**
61498
+ * Returns the registered outline providers.
61499
+ *
61500
+ * @returns {OutlineProvider[]}
61501
+ */
61502
+ Outline.prototype._getProviders = function() {
61503
+ var event = this._eventBus.createEvent({
61504
+ type: 'outline.getProviders',
61505
+ providers: []
61506
+ });
61507
+
61508
+ this._eventBus.fire(event);
61509
+
61510
+ return event.providers;
61511
+ };
61512
+
61513
+ /**
61514
+ * Returns the outline for an element.
61515
+ *
61516
+ * @param {Element} element
61517
+ */
61518
+ Outline.prototype.getOutline = function(element) {
61519
+ var outline;
61520
+ var providers = this._getProviders();
61521
+
61522
+ forEach$1(providers, function(provider) {
61523
+
61524
+ if (!isFunction(provider.getOutline)) {
61525
+ return;
61526
+ }
61527
+
61528
+ outline = outline || provider.getOutline(element);
61529
+ });
61530
+
61531
+ return outline;
61532
+ };
61533
+
61534
+ Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
61535
+
61536
+ var SELECTION_OUTLINE_PADDING = 6;
61537
+
61538
+ /**
61539
+ * @typedef {import('../../model/Types').Element} Element
61540
+ *
61541
+ * @typedef {import('../../core/EventBus').default} EventBus
61542
+ * @typedef {import('../selection/Selection').default} Selection
61543
+ * @typedef {import('../../core/Canvas').default} Canvas
61544
+ */
61545
+
61546
+ /**
61547
+ * @class
61548
+ *
61549
+ * A plugin that adds an outline to shapes and connections that may be activated and styled
61550
+ * via CSS classes.
61551
+ *
61552
+ * @param {EventBus} eventBus
61553
+ * @param {Canvas} canvas
61554
+ * @param {Selection} selection
61555
+ */
61556
+ function MultiSelectionOutline(eventBus, canvas, selection) {
61557
+ this._canvas = canvas;
61558
+
61559
+ var self = this;
61560
+
61561
+ eventBus.on('element.changed', function(event) {
61562
+ if (selection.isSelected(event.element)) {
61563
+ self._updateMultiSelectionOutline(selection.get());
61564
+ }
61565
+ });
61566
+
61567
+ eventBus.on('selection.changed', function(event) {
61568
+ var newSelection = event.newSelection;
61569
+
61570
+ self._updateMultiSelectionOutline(newSelection);
61571
+ });
61572
+ }
61573
+
61574
+
61575
+
61576
+ MultiSelectionOutline.prototype._updateMultiSelectionOutline = function(selection) {
61577
+ var layer = this._canvas.getLayer('selectionOutline');
61578
+
61579
+ clear(layer);
61580
+
61581
+ var enabled = selection.length > 1;
61582
+
61583
+ var container = this._canvas.getContainer();
61584
+
61585
+ classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
61586
+
61587
+ if (!enabled) {
61588
+ return;
61589
+ }
61590
+
61591
+ var bBox = addSelectionOutlinePadding(getBBox(selection));
61592
+
61593
+ var rect = create$1('rect');
61594
+
61595
+ attr(rect, assign$1({
61596
+ rx: 3
61597
+ }, bBox));
61598
+
61599
+ classes(rect).add('djs-selection-outline');
61600
+
61601
+ append(layer, rect);
61602
+ };
61603
+
61604
+
61605
+ MultiSelectionOutline.$inject = [ 'eventBus', 'canvas', 'selection' ];
61606
+
61607
+ // helpers //////////
61608
+
61609
+ function addSelectionOutlinePadding(bBox) {
61610
+ return {
61611
+ x: bBox.x - SELECTION_OUTLINE_PADDING,
61612
+ y: bBox.y - SELECTION_OUTLINE_PADDING,
61613
+ width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
61614
+ height: bBox.height + SELECTION_OUTLINE_PADDING * 2
61615
+ };
61616
+ }
61617
+
61618
+ /**
61619
+ * @type { import('didi').ModuleDeclaration }
61620
+ */
61621
+ var Ouline = {
61622
+ __depends__: [
61623
+ SelectionModule
61624
+ ],
61625
+ __init__: [ 'outline', 'multiSelectionOutline' ],
61626
+ outline: [ 'type', Outline ],
61627
+ multiSelectionOutline: [ 'type', MultiSelectionOutline ]
61628
+ };
61629
+
61523
61630
  /**
61524
61631
  * @typedef {import('../../core/Types').ElementLike} Element
61525
61632
  * @typedef {import('../../core/Types').ShapeLike} Shape
@@ -62022,7 +62129,7 @@
62022
62129
  __depends__: [
62023
62130
  InteractionEventsModule$1,
62024
62131
  SelectionModule,
62025
- OutlineModule$1,
62132
+ Ouline,
62026
62133
  RulesModule$1,
62027
62134
  DraggingModule,
62028
62135
  PreviewSupportModule
@@ -64962,7 +65069,6 @@
64962
65069
  });
64963
65070
 
64964
65071
  if (!searchResults.length) {
64965
- this._clearMarkers();
64966
65072
  this._selection.select(null);
64967
65073
 
64968
65074
  return;
@@ -65039,16 +65145,6 @@
65039
65145
  };
65040
65146
 
65041
65147
 
65042
- /**
65043
- * Clears all markers.
65044
- */
65045
- SearchPad.prototype._clearMarkers = function() {
65046
- for (var id in this._results) {
65047
- this._canvas.removeMarker(this._results[id].element, 'djs-search-preselected');
65048
- }
65049
- };
65050
-
65051
-
65052
65148
  /**
65053
65149
  * Get currently selected result.
65054
65150
  *
@@ -65117,6 +65213,8 @@
65117
65213
  this._cachedSelection = this._selection.get();
65118
65214
  this._cachedViewbox = this._canvas.viewbox();
65119
65215
 
65216
+ this._selection.select(null);
65217
+
65120
65218
  this._bindEvents();
65121
65219
 
65122
65220
  this._open = true;
@@ -65165,14 +65263,14 @@
65165
65263
  classes$1(this._canvas.getContainer()).remove('djs-search-open');
65166
65264
  classes$1(this._container).remove('open');
65167
65265
 
65168
- this._clearMarkers();
65169
-
65170
65266
  this._clearResults();
65171
65267
 
65172
65268
  this._searchInput.value = '';
65173
65269
  this._searchInput.blur();
65174
65270
 
65175
65271
  this._eventBus.fire('searchPad.closed');
65272
+
65273
+ this._canvas.restoreFocus();
65176
65274
  };
65177
65275
 
65178
65276
 
@@ -65205,8 +65303,6 @@
65205
65303
  return;
65206
65304
  }
65207
65305
 
65208
- this._clearMarkers();
65209
-
65210
65306
  // removing preselection from current node
65211
65307
  if (selectedNode) {
65212
65308
  classes$1(selectedNode).remove(SearchPad.RESULT_SELECTED_CLASS);
@@ -65223,8 +65319,6 @@
65223
65319
 
65224
65320
  this._selection.select(element);
65225
65321
 
65226
- this._canvas.addMarker(element, 'djs-search-preselected');
65227
-
65228
65322
  this._eventBus.fire('searchPad.preselected', element);
65229
65323
  };
65230
65324
 
@@ -65291,10 +65385,13 @@
65291
65385
  var htmlText = '';
65292
65386
 
65293
65387
  tokens.forEach(function(t) {
65294
- if (t.matched) {
65295
- htmlText += '<b class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + escapeHTML(t.matched) + '</b>';
65388
+ var text = escapeHTML(t.value || t.matched || t.normal);
65389
+ var match = t.match || t.matched;
65390
+
65391
+ if (match) {
65392
+ htmlText += '<b class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + text + '</b>';
65296
65393
  } else {
65297
- htmlText += escapeHTML(t.normal);
65394
+ htmlText += text;
65298
65395
  }
65299
65396
  });
65300
65397
 
@@ -65352,7 +65449,11 @@
65352
65449
  * @typedef {import('diagram-js/lib/features/search-pad/SearchPad').default} SearchPad
65353
65450
  *
65354
65451
  * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').default} SearchPadProvider
65355
- * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').SearchResult} SearchResult
65452
+ * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').SearchResult} SearchPadResult
65453
+ * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').Token} SearchPadToken
65454
+ * @typedef {import('diagram-js/lib/features/search/search').default} Search
65455
+ * @typedef {import('diagram-js/lib/features/search/search').SearchResult} SearchResult
65456
+ * @typedef {import('diagram-js/lib/features/search/search').Token} SearchToken
65356
65457
  */
65357
65458
 
65358
65459
  /**
@@ -65363,10 +65464,12 @@
65363
65464
  * @param {ElementRegistry} elementRegistry
65364
65465
  * @param {SearchPad} searchPad
65365
65466
  * @param {Canvas} canvas
65467
+ * @param {Search} search
65366
65468
  */
65367
- function BpmnSearchProvider(elementRegistry, searchPad, canvas) {
65469
+ function BpmnSearchProvider(elementRegistry, searchPad, canvas, search) {
65368
65470
  this._elementRegistry = elementRegistry;
65369
65471
  this._canvas = canvas;
65472
+ this._search = search;
65370
65473
 
65371
65474
  searchPad.registerProvider(this);
65372
65475
  }
@@ -65374,13 +65477,14 @@
65374
65477
  BpmnSearchProvider.$inject = [
65375
65478
  'elementRegistry',
65376
65479
  'searchPad',
65377
- 'canvas'
65480
+ 'canvas',
65481
+ 'search'
65378
65482
  ];
65379
65483
 
65380
65484
  /**
65381
65485
  * @param {string} pattern
65382
65486
  *
65383
- * @return {SearchResult[]}
65487
+ * @return {SearchPadResult[]}
65384
65488
  */
65385
65489
  BpmnSearchProvider.prototype.find = function(pattern) {
65386
65490
  var rootElements = this._canvas.getRootElements();
@@ -65389,167 +65493,261 @@
65389
65493
  return !isLabel(element) && !rootElements.includes(element);
65390
65494
  });
65391
65495
 
65392
- return elements
65393
- .reduce(function(results, element) {
65394
- var label = getLabel(element);
65395
-
65396
- var primaryTokens = findMatches(label, pattern),
65397
- secondaryTokens = findMatches(element.id, pattern);
65398
-
65399
- if (hasMatch(primaryTokens) || hasMatch(secondaryTokens)) {
65400
- return [
65401
- ...results,
65402
- {
65403
- primaryTokens,
65404
- secondaryTokens,
65405
- element
65406
- }
65407
- ];
65408
- }
65409
-
65410
- return results;
65411
- }, [])
65412
- .sort(function(a, b) {
65413
- return compareTokens(a.primaryTokens, b.primaryTokens)
65414
- || compareTokens(a.secondaryTokens, b.secondaryTokens)
65415
- || compareStrings(getLabel(a.element), getLabel(b.element))
65416
- || compareStrings(a.element.id, b.element.id);
65417
- })
65418
- .map(function(result) {
65496
+ return this._search(
65497
+ elements.map(element => {
65419
65498
  return {
65420
- element: result.element,
65421
- primaryTokens: result.primaryTokens.map(function(token) {
65422
- return omit(token, [ 'index' ]);
65423
- }),
65424
- secondaryTokens: result.secondaryTokens.map(function(token) {
65425
- return omit(token, [ 'index' ]);
65426
- })
65499
+ element,
65500
+ label: getLabel(element),
65501
+ id: element.id
65427
65502
  };
65428
- });
65503
+ }),
65504
+ pattern, {
65505
+ keys: [
65506
+ 'label',
65507
+ 'id'
65508
+ ]
65509
+ }
65510
+ ).map(toSearchPadResult);
65429
65511
  };
65430
65512
 
65431
65513
  /**
65432
- * @param {Token} token
65514
+ * @param {SearchResult} token
65433
65515
  *
65434
- * @return {boolean}
65516
+ * @return {SearchPadResult}
65435
65517
  */
65436
- function isMatch(token) {
65437
- return 'matched' in token;
65518
+ function toSearchPadResult(result) {
65519
+
65520
+ const {
65521
+ item: {
65522
+ element
65523
+ },
65524
+ tokens
65525
+ } = result;
65526
+
65527
+ return {
65528
+ element,
65529
+ primaryTokens: tokens.label,
65530
+ secondaryTokens: tokens.id
65531
+ };
65438
65532
  }
65439
65533
 
65534
+ var SearchModule = {
65535
+ __depends__: [
65536
+ SearchPadModule,
65537
+ SearchModule$1
65538
+ ],
65539
+ __init__: [ 'bpmnSearch' ],
65540
+ bpmnSearch: [ 'type', BpmnSearchProvider ]
65541
+ };
65542
+
65543
+ const DATA_OBJECT_REFERENCE_OUTLINE_PATH = 'M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z';
65544
+ const DATA_STORE_REFERENCE_OUTLINE_PATH = 'M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z';
65545
+
65440
65546
  /**
65441
- * @param {Token[]} tokens
65547
+ * @typedef { import('diagram-js/lib/util/Types').Dimensions} Dimensions
65548
+ */
65549
+
65550
+ /**
65551
+ * @type {Dimensions}
65552
+ */
65553
+ const DATA_OBJECT_REFERENCE_STANDARD_SIZE = { width: 36, height: 50 };
65554
+
65555
+ /**
65556
+ * @type {Dimensions}
65557
+ */
65558
+ const DATA_STORE_REFERENCE_STANDARD_SIZE = { width: 50, height: 50 };
65559
+
65560
+ /**
65561
+ * Create a path element with given attributes.
65562
+ * @param {string} path
65563
+ * @param {Object} attrs
65564
+ * @param {Object} OUTLINE_STYLE
65565
+ * @return {SVGElement}
65566
+ */
65567
+ function createPath(path, attrs, OUTLINE_STYLE) {
65568
+ return create$1('path', {
65569
+ d: path,
65570
+ strokeWidth: 2,
65571
+ transform: `translate(${attrs.x}, ${attrs.y})`,
65572
+ ...OUTLINE_STYLE
65573
+ });
65574
+ }
65575
+
65576
+ /**
65577
+ * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').default } BaseOutlineProvider
65442
65578
  *
65443
- * @return {boolean}
65579
+ * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').Outline } Outline
65580
+ *
65581
+ * @typedef { import('diagram-js/lib/draw/Styles').default } Styles
65582
+ *
65583
+ * @typedef { import('diagram-js/lib/model/Types').Element } Element
65584
+ */
65585
+
65586
+ const DEFAULT_OFFSET = 5;
65587
+
65588
+ /**
65589
+ * BPMN-specific outline provider.
65590
+ *
65591
+ * @implements {BaseOutlineProvider}
65592
+ *
65593
+ * @param {Outline} outline
65594
+ * @param {Styles} styles
65444
65595
  */
65445
- function hasMatch(tokens) {
65446
- return tokens.find(isMatch);
65596
+ function OutlineProvider(outline, styles) {
65597
+
65598
+ this._styles = styles;
65599
+ outline.registerProvider(this);
65447
65600
  }
65448
65601
 
65602
+ OutlineProvider.$inject = [
65603
+ 'outline',
65604
+ 'styles'
65605
+ ];
65606
+
65449
65607
  /**
65450
- * Compares two token arrays.
65608
+ * Returns outline for a given element.
65451
65609
  *
65452
- * @param {Token[]} tokensA
65453
- * @param {Token[]} tokensB
65610
+ * @param {Element} element
65454
65611
  *
65455
- * @returns {number}
65612
+ * @return {Outline}
65456
65613
  */
65457
- function compareTokens(tokensA, tokensB) {
65458
- const tokensAHasMatch = hasMatch(tokensA),
65459
- tokensBHasMatch = hasMatch(tokensB);
65614
+ OutlineProvider.prototype.getOutline = function(element) {
65460
65615
 
65461
- if (tokensAHasMatch && !tokensBHasMatch) {
65462
- return -1;
65463
- }
65616
+ const OUTLINE_STYLE = this._styles.cls('djs-outline', [ 'no-fill' ]);
65464
65617
 
65465
- if (!tokensAHasMatch && tokensBHasMatch) {
65466
- return 1;
65467
- }
65618
+ var outline;
65468
65619
 
65469
- if (!tokensAHasMatch && !tokensBHasMatch) {
65470
- return 0;
65620
+ if (isLabel(element)) {
65621
+ return;
65471
65622
  }
65472
65623
 
65473
- const tokensAFirstMatch = tokensA.find(isMatch),
65474
- tokensBFirstMatch = tokensB.find(isMatch);
65624
+ if (is$1(element, 'bpmn:Gateway')) {
65625
+ outline = create$1('rect');
65475
65626
 
65476
- if (tokensAFirstMatch.index < tokensBFirstMatch.index) {
65477
- return -1;
65478
- }
65627
+ assign$1(outline.style, {
65628
+ 'transform-box': 'fill-box',
65629
+ 'transform': 'rotate(45deg)',
65630
+ 'transform-origin': 'center'
65631
+ });
65479
65632
 
65480
- if (tokensAFirstMatch.index > tokensBFirstMatch.index) {
65481
- return 1;
65633
+ attr(outline, assign$1({
65634
+ x: 2,
65635
+ y: 2,
65636
+ rx: 4,
65637
+ width: element.width - 4,
65638
+ height: element.height - 4,
65639
+ }, OUTLINE_STYLE));
65640
+
65641
+ } else if (isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess', 'bpmn:Group', 'bpmn:CallActivity' ])) {
65642
+ outline = create$1('rect');
65643
+
65644
+ attr(outline, assign$1({
65645
+ x: -DEFAULT_OFFSET,
65646
+ y: -DEFAULT_OFFSET,
65647
+ rx: 14,
65648
+ width: element.width + DEFAULT_OFFSET * 2,
65649
+ height: element.height + DEFAULT_OFFSET * 2
65650
+ }, OUTLINE_STYLE));
65651
+
65652
+ } else if (is$1(element, 'bpmn:EndEvent')) {
65653
+
65654
+ outline = create$1('circle');
65655
+
65656
+ // Extra 1px offset needed due to increased stroke-width of end event
65657
+ // which makes it bigger than other events.
65658
+
65659
+ attr(outline, assign$1({
65660
+ cx: element.width / 2,
65661
+ cy: element.height / 2,
65662
+ r: element.width / 2 + DEFAULT_OFFSET + 1
65663
+ }, OUTLINE_STYLE));
65664
+
65665
+ } else if (is$1(element, 'bpmn:Event')) {
65666
+ outline = create$1('circle');
65667
+
65668
+ attr(outline, assign$1({
65669
+ cx: element.width / 2,
65670
+ cy: element.height / 2,
65671
+ r: element.width / 2 + DEFAULT_OFFSET
65672
+ }, OUTLINE_STYLE));
65673
+
65674
+ } else if (is$1(element, 'bpmn:DataObjectReference') && isStandardSize(element, 'bpmn:DataObjectReference')) {
65675
+
65676
+ outline = createPath(
65677
+ DATA_OBJECT_REFERENCE_OUTLINE_PATH,
65678
+ { x: -6, y: -6 },
65679
+ OUTLINE_STYLE
65680
+ );
65681
+
65682
+ } else if (is$1(element, 'bpmn:DataStoreReference') && isStandardSize(element, 'bpmn:DataStoreReference')) {
65683
+
65684
+ outline = createPath(
65685
+ DATA_STORE_REFERENCE_OUTLINE_PATH,
65686
+ { x: -6, y: -6 },
65687
+ OUTLINE_STYLE
65688
+ );
65482
65689
  }
65483
65690
 
65484
- return 0;
65485
- }
65691
+ return outline;
65692
+ };
65486
65693
 
65487
65694
  /**
65488
- * Compares two strings.
65489
- *
65490
- * @param {string} [a]
65491
- * @param {string} [b]
65695
+ * Updates the outline for a given element.
65696
+ * Returns true if the update for the given element was handled by this provider.
65492
65697
  *
65493
- * @returns {number}
65698
+ * @param {Element} element
65699
+ * @param {Outline} outline
65700
+ * @returns {boolean}
65494
65701
  */
65495
- function compareStrings(a = '', b = '') {
65496
- return a.localeCompare(b);
65497
- }
65702
+ OutlineProvider.prototype.updateOutline = function(element, outline) {
65498
65703
 
65499
- /**
65500
- * @param {string} text
65501
- * @param {string} pattern
65502
- *
65503
- * @return {Token[]}
65504
- */
65505
- function findMatches(text, pattern) {
65506
- var tokens = [],
65507
- originalText = text;
65704
+ if (isLabel(element)) {
65705
+ return;
65706
+ }
65508
65707
 
65509
- if (!text) {
65510
- return tokens;
65708
+ if (isAny(element, [ 'bpmn:SubProcess', 'bpmn:Group' ])) {
65709
+
65710
+ attr(outline, {
65711
+ width: element.width + DEFAULT_OFFSET * 2,
65712
+ height: element.height + DEFAULT_OFFSET * 2
65713
+ });
65714
+
65715
+ return true;
65716
+
65717
+ } else if (isAny(element, [
65718
+ 'bpmn:Event',
65719
+ 'bpmn:Gateway',
65720
+ 'bpmn:DataStoreReference',
65721
+ 'bpmn:DataObjectReference'
65722
+ ])) {
65723
+ return true;
65511
65724
  }
65512
65725
 
65513
- text = text.toLowerCase();
65514
- pattern = pattern.toLowerCase();
65726
+ return false;
65727
+ };
65515
65728
 
65516
- var index = text.indexOf(pattern);
65517
65729
 
65518
- if (index > -1) {
65519
- if (index !== 0) {
65520
- tokens.push({
65521
- normal: originalText.slice(0, index),
65522
- index: 0
65523
- });
65524
- }
65730
+ // helpers //////////
65525
65731
 
65526
- tokens.push({
65527
- matched: originalText.slice(index, index + pattern.length),
65528
- index: index
65529
- });
65732
+ function isStandardSize(element, type) {
65733
+ var standardSize;
65530
65734
 
65531
- if (pattern.length + index < text.length) {
65532
- tokens.push({
65533
- normal: originalText.slice(index + pattern.length),
65534
- index: index + pattern.length
65535
- });
65536
- }
65537
- } else {
65538
- tokens.push({
65539
- normal: originalText,
65540
- index: 0
65541
- });
65735
+ if (type === 'bpmn:DataObjectReference') {
65736
+ standardSize = DATA_OBJECT_REFERENCE_STANDARD_SIZE;
65737
+ } else if (type === 'bpmn:DataStoreReference') {
65738
+ standardSize = DATA_STORE_REFERENCE_STANDARD_SIZE;
65542
65739
  }
65543
65740
 
65544
- return tokens;
65741
+ return element.width === standardSize.width
65742
+ && element.height === standardSize.height;
65545
65743
  }
65546
65744
 
65547
- var SearchModule = {
65745
+ var OutlineModule = {
65548
65746
  __depends__: [
65549
- SearchPadModule
65747
+ Ouline
65550
65748
  ],
65551
- __init__: [ 'bpmnSearch' ],
65552
- bpmnSearch: [ 'type', BpmnSearchProvider ]
65749
+ __init__: [ 'outlineProvider' ],
65750
+ outlineProvider: [ 'type', OutlineProvider ]
65553
65751
  };
65554
65752
 
65555
65753
  var initialDiagram =
@@ -65704,7 +65902,8 @@
65704
65902
  ReplacePreviewModule,
65705
65903
  ResizeModule,
65706
65904
  SnappingModule,
65707
- SearchModule
65905
+ SearchModule,
65906
+ OutlineModule
65708
65907
  ];
65709
65908
 
65710
65909
 
@@ -98283,6 +98482,21 @@
98283
98482
  width: "16",
98284
98483
  height: "16"
98285
98484
  };
98485
+ var CloseIcon = function CloseIcon(props) {
98486
+ return u("svg", {
98487
+ ...props,
98488
+ children: u("path", {
98489
+ fillRule: "evenodd",
98490
+ d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
98491
+ fill: "currentColor"
98492
+ })
98493
+ });
98494
+ };
98495
+ CloseIcon.defaultProps = {
98496
+ xmlns: "http://www.w3.org/2000/svg",
98497
+ width: "16",
98498
+ height: "16"
98499
+ };
98286
98500
  var DragIcon = function DragIcon(props) {
98287
98501
  return u("svg", {
98288
98502
  ...props,
@@ -98327,26 +98541,17 @@
98327
98541
  fill: "none",
98328
98542
  xmlns: "http://www.w3.org/2000/svg"
98329
98543
  };
98330
- var HelpIcon = function HelpIcon(props) {
98544
+ var LaunchIcon = function LaunchIcon(props) {
98331
98545
  return u("svg", {
98332
98546
  ...props,
98333
98547
  children: [u("path", {
98334
- d: "M16 2a14 14 0 1 0 14 14A14 14 0 0 0 16 2Zm0 26a12 12 0 1 1 12-12 12 12 0 0 1-12 12Z"
98335
- }), u("circle", {
98336
- cx: "16",
98337
- cy: "23.5",
98338
- r: "1.5"
98548
+ d: "M26 28H6a2.003 2.003 0 0 1-2-2V6a2.003 2.003 0 0 1 2-2h10v2H6v20h20V16h2v10a2.003 2.003 0 0 1-2 2Z"
98339
98549
  }), u("path", {
98340
- d: "M17 8h-1.5a4.49 4.49 0 0 0-4.5 4.5v.5h2v-.5a2.5 2.5 0 0 1 2.5-2.5H17a2.5 2.5 0 0 1 0 5h-2v4.5h2V17a4.5 4.5 0 0 0 0-9Z"
98341
- }), u("path", {
98342
- style: {
98343
- fill: "none"
98344
- },
98345
- d: "M0 0h32v32H0z"
98550
+ d: "M20 2v2h6.586L18 12.586 19.414 14 28 5.414V12h2V2H20z"
98346
98551
  })]
98347
98552
  });
98348
98553
  };
98349
- HelpIcon.defaultProps = {
98554
+ LaunchIcon.defaultProps = {
98350
98555
  xmlns: "http://www.w3.org/2000/svg",
98351
98556
  viewBox: "0 0 32 32"
98352
98557
  };
@@ -98368,21 +98573,6 @@
98368
98573
  height: "16",
98369
98574
  viewBox: "0 0 32 32"
98370
98575
  };
98371
- var CloseIcon = function CloseIcon(props) {
98372
- return u("svg", {
98373
- ...props,
98374
- children: u("path", {
98375
- fillRule: "evenodd",
98376
- d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
98377
- fill: "currentColor"
98378
- })
98379
- });
98380
- };
98381
- CloseIcon.defaultProps = {
98382
- xmlns: "http://www.w3.org/2000/svg",
98383
- width: "16",
98384
- height: "16"
98385
- };
98386
98576
 
98387
98577
  function Header(props) {
98388
98578
  const {
@@ -98422,7 +98612,7 @@
98422
98612
  }), u("div", {
98423
98613
  class: "bio-properties-panel-header-actions",
98424
98614
  children: documentationRef ? u("a", {
98425
- rel: "noopener",
98615
+ rel: "noreferrer",
98426
98616
  class: "bio-properties-panel-header-link",
98427
98617
  href: documentationRef,
98428
98618
  title: "Open documentation",
@@ -98442,19 +98632,19 @@
98442
98632
  errors: {}
98443
98633
  });
98444
98634
 
98445
- /**
98446
- * @typedef {Function} <propertiesPanel.showEntry> callback
98447
- *
98448
- * @example
98449
- *
98450
- * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
98451
- * // ...
98452
- * });
98453
- *
98454
- * @param {Object} context
98455
- * @param {boolean} [context.focus]
98456
- *
98457
- * @returns void
98635
+ /**
98636
+ * @typedef {Function} <propertiesPanel.showEntry> callback
98637
+ *
98638
+ * @example
98639
+ *
98640
+ * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
98641
+ * // ...
98642
+ * });
98643
+ *
98644
+ * @param {Object} context
98645
+ * @param {boolean} [context.focus]
98646
+ *
98647
+ * @returns void
98458
98648
  */
98459
98649
 
98460
98650
  const EventContext = F$2({
@@ -98473,20 +98663,20 @@
98473
98663
  getTooltipForId: () => {}
98474
98664
  });
98475
98665
 
98476
- /**
98477
- * Accesses the global TooltipContext and returns a tooltip for a given id and element.
98478
- *
98479
- * @example
98480
- * ```jsx
98481
- * function TextField(props) {
98482
- * const tooltip = useTooltipContext('input1', element);
98483
- * }
98484
- * ```
98485
- *
98486
- * @param {string} id
98487
- * @param {object} element
98488
- *
98489
- * @returns {string}
98666
+ /**
98667
+ * Accesses the global TooltipContext and returns a tooltip for a given id and element.
98668
+ *
98669
+ * @example
98670
+ * ```jsx
98671
+ * function TextField(props) {
98672
+ * const tooltip = useTooltipContext('input1', element);
98673
+ * }
98674
+ * ```
98675
+ *
98676
+ * @param {string} id
98677
+ * @param {object} element
98678
+ *
98679
+ * @returns {string}
98490
98680
  */
98491
98681
  function useTooltipContext(id, element) {
98492
98682
  const {
@@ -98639,20 +98829,20 @@
98639
98829
  return `bio-properties-panel-${id}`;
98640
98830
  }
98641
98831
 
98642
- /**
98643
- * Accesses the global DescriptionContext and returns a description for a given id and element.
98644
- *
98645
- * @example
98646
- * ```jsx
98647
- * function TextField(props) {
98648
- * const description = useDescriptionContext('input1', element);
98649
- * }
98650
- * ```
98651
- *
98652
- * @param {string} id
98653
- * @param {object} element
98654
- *
98655
- * @returns {string}
98832
+ /**
98833
+ * Accesses the global DescriptionContext and returns a description for a given id and element.
98834
+ *
98835
+ * @example
98836
+ * ```jsx
98837
+ * function TextField(props) {
98838
+ * const description = useDescriptionContext('input1', element);
98839
+ * }
98840
+ * ```
98841
+ *
98842
+ * @param {string} id
98843
+ * @param {object} element
98844
+ *
98845
+ * @returns {string}
98656
98846
  */
98657
98847
  function useDescriptionContext(id, element) {
98658
98848
  const {
@@ -98674,11 +98864,11 @@
98674
98864
  return errors;
98675
98865
  }
98676
98866
 
98677
- /**
98678
- * Subscribe to an event immediately. Update subscription after inputs changed.
98679
- *
98680
- * @param {string} event
98681
- * @param {Function} callback
98867
+ /**
98868
+ * Subscribe to an event immediately. Update subscription after inputs changed.
98869
+ *
98870
+ * @param {string} event
98871
+ * @param {Function} callback
98682
98872
  */
98683
98873
  function useEvent(event, callback, eventBus) {
98684
98874
  const eventContext = q$1(EventContext);
@@ -98708,20 +98898,20 @@
98708
98898
  }, [callback, event, eventBus]);
98709
98899
  }
98710
98900
 
98711
- /**
98712
- * Creates a state that persists in the global LayoutContext.
98713
- *
98714
- * @example
98715
- * ```jsx
98716
- * function Group(props) {
98717
- * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
98718
- * }
98719
- * ```
98720
- *
98721
- * @param {(string|number)[]} path
98722
- * @param {any} [defaultValue]
98723
- *
98724
- * @returns {[ any, Function ]}
98901
+ /**
98902
+ * Creates a state that persists in the global LayoutContext.
98903
+ *
98904
+ * @example
98905
+ * ```jsx
98906
+ * function Group(props) {
98907
+ * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
98908
+ * }
98909
+ * ```
98910
+ *
98911
+ * @param {(string|number)[]} path
98912
+ * @param {any} [defaultValue]
98913
+ *
98914
+ * @returns {[ any, Function ]}
98725
98915
  */
98726
98916
  function useLayoutState(path, defaultValue) {
98727
98917
  const {
@@ -98735,11 +98925,11 @@
98735
98925
  return [layoutForKey, setState];
98736
98926
  }
98737
98927
 
98738
- /**
98739
- * @pinussilvestrus: we need to introduce our own hook to persist the previous
98740
- * state on updates.
98741
- *
98742
- * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
98928
+ /**
98929
+ * @pinussilvestrus: we need to introduce our own hook to persist the previous
98930
+ * state on updates.
98931
+ *
98932
+ * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
98743
98933
  */
98744
98934
 
98745
98935
  function usePrevious(value) {
@@ -98750,12 +98940,12 @@
98750
98940
  return ref.current;
98751
98941
  }
98752
98942
 
98753
- /**
98754
- * Subscribe to `propertiesPanel.showEntry`.
98755
- *
98756
- * @param {string} id
98757
- *
98758
- * @returns {import('preact').Ref}
98943
+ /**
98944
+ * Subscribe to `propertiesPanel.showEntry`.
98945
+ *
98946
+ * @param {string} id
98947
+ *
98948
+ * @returns {import('preact').Ref}
98759
98949
  */
98760
98950
  function useShowEntryEvent(id) {
98761
98951
  const {
@@ -98786,20 +98976,20 @@
98786
98976
  return ref;
98787
98977
  }
98788
98978
 
98789
- /**
98790
- * @callback setSticky
98791
- * @param {boolean} value
98979
+ /**
98980
+ * @callback setSticky
98981
+ * @param {boolean} value
98792
98982
  */
98793
98983
 
98794
- /**
98795
- * Use IntersectionObserver to identify when DOM element is in sticky mode.
98796
- * If sticky is observered setSticky(true) will be called.
98797
- * If sticky mode is left, setSticky(false) will be called.
98798
- *
98799
- *
98800
- * @param {Object} ref
98801
- * @param {string} scrollContainerSelector
98802
- * @param {setSticky} setSticky
98984
+ /**
98985
+ * Use IntersectionObserver to identify when DOM element is in sticky mode.
98986
+ * If sticky is observered setSticky(true) will be called.
98987
+ * If sticky mode is left, setSticky(false) will be called.
98988
+ *
98989
+ *
98990
+ * @param {Object} ref
98991
+ * @param {string} scrollContainerSelector
98992
+ * @param {setSticky} setSticky
98803
98993
  */
98804
98994
  function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
98805
98995
  const [scrollContainer, setScrollContainer] = h(query(scrollContainerSelector));
@@ -98853,19 +99043,19 @@
98853
99043
  }, [ref.current, scrollContainer, setSticky]);
98854
99044
  }
98855
99045
 
98856
- /**
98857
- * Creates a static function reference with changing body.
98858
- * This is necessary when external libraries require a callback function
98859
- * that has references to state variables.
98860
- *
98861
- * Usage:
98862
- * const callback = useStaticCallback((val) => {val === currentState});
98863
- *
98864
- * The `callback` reference is static and can be safely used in external
98865
- * libraries or as a prop that does not cause rerendering of children.
98866
- *
98867
- * @param {Function} callback function with changing reference
98868
- * @returns {Function} static function reference
99046
+ /**
99047
+ * Creates a static function reference with changing body.
99048
+ * This is necessary when external libraries require a callback function
99049
+ * that has references to state variables.
99050
+ *
99051
+ * Usage:
99052
+ * const callback = useStaticCallback((val) => {val === currentState});
99053
+ *
99054
+ * The `callback` reference is static and can be safely used in external
99055
+ * libraries or as a prop that does not cause rerendering of children.
99056
+ *
99057
+ * @param {Function} callback function with changing reference
99058
+ * @returns {Function} static function reference
98869
99059
  */
98870
99060
  function useStaticCallback(callback) {
98871
99061
  const callbackRef = _(callback);
@@ -99008,13 +99198,13 @@
99008
99198
  return null;
99009
99199
  }
99010
99200
 
99011
- /**
99012
- * @typedef { {
99013
- * text: (element: object) => string,
99014
- * icon?: (element: Object) => import('preact').Component
99015
- * } } PlaceholderDefinition
99016
- *
99017
- * @param { PlaceholderDefinition } props
99201
+ /**
99202
+ * @typedef { {
99203
+ * text: (element: object) => string,
99204
+ * icon?: (element: Object) => import('preact').Component
99205
+ * } } PlaceholderDefinition
99206
+ *
99207
+ * @param { PlaceholderDefinition } props
99018
99208
  */
99019
99209
  function Placeholder(props) {
99020
99210
  const {
@@ -99053,9 +99243,9 @@
99053
99243
 
99054
99244
  const noop$6 = () => {};
99055
99245
 
99056
- /**
99057
- * Buffer `.focus()` calls while the editor is not initialized.
99058
- * Set Focus inside when the editor is ready.
99246
+ /**
99247
+ * Buffer `.focus()` calls while the editor is not initialized.
99248
+ * Set Focus inside when the editor is ready.
99059
99249
  */
99060
99250
  const useBufferedFocus$1 = function (editor, ref) {
99061
99251
  const [buffer, setBuffer] = h(undefined);
@@ -99156,9 +99346,9 @@
99156
99346
 
99157
99347
  const noop$5 = () => {};
99158
99348
 
99159
- /**
99160
- * Buffer `.focus()` calls while the editor is not initialized.
99161
- * Set Focus inside when the editor is ready.
99349
+ /**
99350
+ * Buffer `.focus()` calls while the editor is not initialized.
99351
+ * Set Focus inside when the editor is ready.
99162
99352
  */
99163
99353
  const useBufferedFocus = function (editor, ref) {
99164
99354
  const [buffer, setBuffer] = h(undefined);
@@ -99207,10 +99397,10 @@
99207
99397
  p(() => {
99208
99398
  let editor;
99209
99399
 
99210
- /* Trigger FEEL toggle when
99211
- *
99212
- * - `backspace` is pressed
99213
- * - AND the cursor is at the beginning of the input
99400
+ /* Trigger FEEL toggle when
99401
+ *
99402
+ * - `backspace` is pressed
99403
+ * - AND the cursor is at the beginning of the input
99214
99404
  */
99215
99405
  const onKeyDown = e => {
99216
99406
  if (e.key !== 'Backspace' || !editor) {
@@ -99292,22 +99482,22 @@
99292
99482
  source: null
99293
99483
  });
99294
99484
 
99295
- /**
99296
- * Add a dragger that calls back the passed function with
99297
- * { event, delta } on drag.
99298
- *
99299
- * @example
99300
- *
99301
- * function dragMove(event, delta) {
99302
- * // we are dragging (!!)
99303
- * }
99304
- *
99305
- * domElement.addEventListener('dragstart', dragger(dragMove));
99306
- *
99307
- * @param {Function} fn
99308
- * @param {Element} [dragPreview]
99309
- *
99310
- * @return {Function} drag start callback function
99485
+ /**
99486
+ * Add a dragger that calls back the passed function with
99487
+ * { event, delta } on drag.
99488
+ *
99489
+ * @example
99490
+ *
99491
+ * function dragMove(event, delta) {
99492
+ * // we are dragging (!!)
99493
+ * }
99494
+ *
99495
+ * domElement.addEventListener('dragstart', dragger(dragMove));
99496
+ *
99497
+ * @param {Function} fn
99498
+ * @param {Element} [dragPreview]
99499
+ *
99500
+ * @return {Function} drag start callback function
99311
99501
  */
99312
99502
  function createDragger(fn, dragPreview) {
99313
99503
  let self;
@@ -99362,23 +99552,23 @@
99362
99552
 
99363
99553
  const noop$3 = () => {};
99364
99554
 
99365
- /**
99366
- * A generic popup component.
99367
- *
99368
- * @param {Object} props
99369
- * @param {HTMLElement} [props.container]
99370
- * @param {string} [props.className]
99371
- * @param {boolean} [props.delayInitialFocus]
99372
- * @param {{x: number, y: number}} [props.position]
99373
- * @param {number} [props.width]
99374
- * @param {number} [props.height]
99375
- * @param {Function} props.onClose
99376
- * @param {Function} [props.onPostActivate]
99377
- * @param {Function} [props.onPostDeactivate]
99378
- * @param {boolean} [props.returnFocus]
99379
- * @param {boolean} [props.closeOnEscape]
99380
- * @param {string} props.title
99381
- * @param {Ref} [ref]
99555
+ /**
99556
+ * A generic popup component.
99557
+ *
99558
+ * @param {Object} props
99559
+ * @param {HTMLElement} [props.container]
99560
+ * @param {string} [props.className]
99561
+ * @param {boolean} [props.delayInitialFocus]
99562
+ * @param {{x: number, y: number}} [props.position]
99563
+ * @param {number} [props.width]
99564
+ * @param {number} [props.height]
99565
+ * @param {Function} props.onClose
99566
+ * @param {Function} [props.onPostActivate]
99567
+ * @param {Function} [props.onPostDeactivate]
99568
+ * @param {boolean} [props.returnFocus]
99569
+ * @param {boolean} [props.closeOnEscape]
99570
+ * @param {string} props.title
99571
+ * @param {Ref} [ref]
99382
99572
  */
99383
99573
  function PopupComponent(props, globalRef) {
99384
99574
  const {
@@ -99597,12 +99787,12 @@
99597
99787
  const FEEL_POPUP_WIDTH = 700;
99598
99788
  const FEEL_POPUP_HEIGHT = 250;
99599
99789
 
99600
- /**
99601
- * FEEL popup component, built as a singleton. Emits lifecycle events as follows:
99602
- * - `feelPopup.open` - fired before the popup is mounted
99603
- * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
99604
- * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
99605
- * - `feelPopup.closed` - fired after the popup is unmounted
99790
+ /**
99791
+ * FEEL popup component, built as a singleton. Emits lifecycle events as follows:
99792
+ * - `feelPopup.open` - fired before the popup is mounted
99793
+ * - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
99794
+ * - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
99795
+ * - `feelPopup.closed` - fired after the popup is unmounted
99606
99796
  */
99607
99797
  function FEELPopupRoot(props) {
99608
99798
  const {
@@ -99612,7 +99802,8 @@
99612
99802
  on() {},
99613
99803
  off() {}
99614
99804
  },
99615
- popupContainer
99805
+ popupContainer,
99806
+ getPopupLinks = () => []
99616
99807
  } = props;
99617
99808
  const prevElement = usePrevious(element);
99618
99809
  const [popupConfig, setPopupConfig] = h({});
@@ -99687,6 +99878,7 @@
99687
99878
  children: [open && u(FeelPopupComponent, {
99688
99879
  onClose: handleClose,
99689
99880
  container: popupContainer,
99881
+ getLinks: getPopupLinks,
99690
99882
  sourceElement: sourceElement,
99691
99883
  emit: emit,
99692
99884
  ...popupConfig
@@ -99696,6 +99888,7 @@
99696
99888
  function FeelPopupComponent(props) {
99697
99889
  const {
99698
99890
  container,
99891
+ getLinks,
99699
99892
  id,
99700
99893
  hostLanguage,
99701
99894
  onInput,
@@ -99772,17 +99965,17 @@
99772
99965
  closeButtonTooltip: "Save and close",
99773
99966
  onClose: onClose,
99774
99967
  draggable: true,
99775
- children: [type === 'feel' && u("a", {
99776
- href: "https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/",
99777
- target: "_blank",
99778
- class: "bio-properties-panel-feel-popup__title-link",
99779
- children: ["Learn FEEL expressions", u(HelpIcon, {})]
99780
- }), type === 'feelers' && u("a", {
99781
- href: "https://docs.camunda.io/docs/components/modeler/forms/configuration/forms-config-templating-syntax/",
99782
- target: "_blank",
99783
- class: "bio-properties-panel-feel-popup__title-link",
99784
- children: ["Learn templating", u(HelpIcon, {})]
99785
- })]
99968
+ children: u(g$2, {
99969
+ children: getLinks(type).map((link, index) => {
99970
+ return u("a", {
99971
+ rel: "noreferrer",
99972
+ href: link.href,
99973
+ target: "_blank",
99974
+ class: "bio-properties-panel-feel-popup__title-link",
99975
+ children: [link.title, u(LaunchIcon, {})]
99976
+ }, index);
99977
+ })
99978
+ })
99786
99979
  }), u(Popup.Body, {
99787
99980
  children: u("div", {
99788
99981
  onKeyDownCapture: onKeyDownCapture,
@@ -99825,11 +100018,11 @@
99825
100018
  return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
99826
100019
  }
99827
100020
 
99828
- /**
99829
- * This hook behaves like useEffect, but does not trigger on the first render.
99830
- *
99831
- * @param {Function} effect
99832
- * @param {Array} deps
100021
+ /**
100022
+ * This hook behaves like useEffect, but does not trigger on the first render.
100023
+ *
100024
+ * @param {Function} effect
100025
+ * @param {Array} deps
99833
100026
  */
99834
100027
  function useUpdateEffect(effect, deps) {
99835
100028
  const isMounted = _(false);
@@ -100194,84 +100387,85 @@
100194
100387
  const DEFAULT_DESCRIPTION = {};
100195
100388
  const DEFAULT_TOOLTIP = {};
100196
100389
 
100197
- /**
100198
- * @typedef { {
100199
- * component: import('preact').Component,
100200
- * id: String,
100201
- * isEdited?: Function
100202
- * } } EntryDefinition
100203
- *
100204
- * @typedef { {
100205
- * autoFocusEntry: String,
100206
- * autoOpen?: Boolean,
100207
- * entries: Array<EntryDefinition>,
100208
- * id: String,
100209
- * label: String,
100210
- * remove: (event: MouseEvent) => void
100211
- * } } ListItemDefinition
100212
- *
100213
- * @typedef { {
100214
- * add: (event: MouseEvent) => void,
100215
- * component: import('preact').Component,
100216
- * element: Object,
100217
- * id: String,
100218
- * items: Array<ListItemDefinition>,
100219
- * label: String,
100220
- * shouldOpen?: Boolean
100221
- * } } ListGroupDefinition
100222
- *
100223
- * @typedef { {
100224
- * component?: import('preact').Component,
100225
- * entries: Array<EntryDefinition>,
100226
- * id: String,
100227
- * label: String,
100228
- * shouldOpen?: Boolean
100229
- * } } GroupDefinition
100230
- *
100231
- * @typedef { {
100232
- * [id: String]: GetDescriptionFunction
100233
- * } } DescriptionConfig
100234
- *
100235
- * @typedef { {
100236
- * [id: String]: GetTooltipFunction
100237
- * } } TooltipConfig
100238
- *
100239
- * @callback { {
100240
- * @param {string} id
100241
- * @param {Object} element
100242
- * @returns {string}
100243
- * } } GetDescriptionFunction
100244
- *
100245
- * @callback { {
100246
- * @param {string} id
100247
- * @param {Object} element
100248
- * @returns {string}
100249
- * } } GetTooltipFunction
100250
- *
100251
- * @typedef { {
100252
- * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
100253
- * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
100254
- * } } PlaceholderProvider
100255
- *
100390
+ /**
100391
+ * @typedef { {
100392
+ * component: import('preact').Component,
100393
+ * id: String,
100394
+ * isEdited?: Function
100395
+ * } } EntryDefinition
100396
+ *
100397
+ * @typedef { {
100398
+ * autoFocusEntry: String,
100399
+ * autoOpen?: Boolean,
100400
+ * entries: Array<EntryDefinition>,
100401
+ * id: String,
100402
+ * label: String,
100403
+ * remove: (event: MouseEvent) => void
100404
+ * } } ListItemDefinition
100405
+ *
100406
+ * @typedef { {
100407
+ * add: (event: MouseEvent) => void,
100408
+ * component: import('preact').Component,
100409
+ * element: Object,
100410
+ * id: String,
100411
+ * items: Array<ListItemDefinition>,
100412
+ * label: String,
100413
+ * shouldOpen?: Boolean
100414
+ * } } ListGroupDefinition
100415
+ *
100416
+ * @typedef { {
100417
+ * component?: import('preact').Component,
100418
+ * entries: Array<EntryDefinition>,
100419
+ * id: String,
100420
+ * label: String,
100421
+ * shouldOpen?: Boolean
100422
+ * } } GroupDefinition
100423
+ *
100424
+ * @typedef { {
100425
+ * [id: String]: GetDescriptionFunction
100426
+ * } } DescriptionConfig
100427
+ *
100428
+ * @typedef { {
100429
+ * [id: String]: GetTooltipFunction
100430
+ * } } TooltipConfig
100431
+ *
100432
+ * @callback { {
100433
+ * @param {string} id
100434
+ * @param {Object} element
100435
+ * @returns {string}
100436
+ * } } GetDescriptionFunction
100437
+ *
100438
+ * @callback { {
100439
+ * @param {string} id
100440
+ * @param {Object} element
100441
+ * @returns {string}
100442
+ * } } GetTooltipFunction
100443
+ *
100444
+ * @typedef { {
100445
+ * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
100446
+ * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
100447
+ * } } PlaceholderProvider
100448
+ *
100256
100449
  */
100257
100450
 
100258
- /**
100259
- * A basic properties panel component. Describes *how* content will be rendered, accepts
100260
- * data from implementor to describe *what* will be rendered.
100261
- *
100262
- * @param {Object} props
100263
- * @param {Object|Array} props.element
100264
- * @param {import('./components/Header').HeaderProvider} props.headerProvider
100265
- * @param {PlaceholderProvider} [props.placeholderProvider]
100266
- * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
100267
- * @param {Object} [props.layoutConfig]
100268
- * @param {Function} [props.layoutChanged]
100269
- * @param {DescriptionConfig} [props.descriptionConfig]
100270
- * @param {Function} [props.descriptionLoaded]
100271
- * @param {TooltipConfig} [props.tooltipConfig]
100272
- * @param {Function} [props.tooltipLoaded]
100273
- * @param {HTMLElement} [props.feelPopupContainer]
100274
- * @param {Object} [props.eventBus]
100451
+ /**
100452
+ * A basic properties panel component. Describes *how* content will be rendered, accepts
100453
+ * data from implementor to describe *what* will be rendered.
100454
+ *
100455
+ * @param {Object} props
100456
+ * @param {Object|Array} props.element
100457
+ * @param {import('./components/Header').HeaderProvider} props.headerProvider
100458
+ * @param {PlaceholderProvider} [props.placeholderProvider]
100459
+ * @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
100460
+ * @param {Object} [props.layoutConfig]
100461
+ * @param {Function} [props.layoutChanged]
100462
+ * @param {DescriptionConfig} [props.descriptionConfig]
100463
+ * @param {Function} [props.descriptionLoaded]
100464
+ * @param {TooltipConfig} [props.tooltipConfig]
100465
+ * @param {Function} [props.tooltipLoaded]
100466
+ * @param {HTMLElement} [props.feelPopupContainer]
100467
+ * @param {Function} [props.getFeelPopupLinks]
100468
+ * @param {Object} [props.eventBus]
100275
100469
  */
100276
100470
  function PropertiesPanel(props) {
100277
100471
  const {
@@ -100286,6 +100480,7 @@
100286
100480
  tooltipConfig,
100287
100481
  tooltipLoaded,
100288
100482
  feelPopupContainer,
100483
+ getFeelPopupLinks,
100289
100484
  eventBus
100290
100485
  } = props;
100291
100486
 
@@ -100390,6 +100585,7 @@
100390
100585
  element: element,
100391
100586
  eventBus: eventBus,
100392
100587
  popupContainer: feelPopupContainer,
100588
+ getPopupLinks: getFeelPopupLinks,
100393
100589
  children: u("div", {
100394
100590
  class: "bio-properties-panel",
100395
100591
  children: [u(Header, {
@@ -100442,11 +100638,11 @@
100442
100638
 
100443
100639
  // hooks //////////////////
100444
100640
 
100445
- /**
100446
- * This hook behaves like useLayoutEffect, but does not trigger on the first render.
100447
- *
100448
- * @param {Function} effect
100449
- * @param {Array} deps
100641
+ /**
100642
+ * This hook behaves like useLayoutEffect, but does not trigger on the first render.
100643
+ *
100644
+ * @param {Function} effect
100645
+ * @param {Array} deps
100450
100646
  */
100451
100647
  function useUpdateLayoutEffect(effect, deps) {
100452
100648
  const isMounted = _(false);
@@ -100513,18 +100709,18 @@
100513
100709
  });
100514
100710
  }
100515
100711
 
100516
- /**
100517
- * @param {Object} props
100518
- * @param {Object} props.element
100519
- * @param {String} props.id
100520
- * @param {String} props.description
100521
- * @param {String} props.label
100522
- * @param {Function} props.getValue
100523
- * @param {Function} props.setValue
100524
- * @param {Function} props.onFocus
100525
- * @param {Function} props.onBlur
100526
- * @param {string|import('preact').Component} props.tooltip
100527
- * @param {boolean} [props.disabled]
100712
+ /**
100713
+ * @param {Object} props
100714
+ * @param {Object} props.element
100715
+ * @param {String} props.id
100716
+ * @param {String} props.description
100717
+ * @param {String} props.label
100718
+ * @param {Function} props.getValue
100719
+ * @param {Function} props.setValue
100720
+ * @param {Function} props.onFocus
100721
+ * @param {Function} props.onBlur
100722
+ * @param {string|import('preact').Component} props.tooltip
100723
+ * @param {boolean} [props.disabled]
100528
100724
  */
100529
100725
  function CheckboxEntry(props) {
100530
100726
  const {
@@ -100645,20 +100841,20 @@
100645
100841
  });
100646
100842
  }
100647
100843
 
100648
- /**
100649
- * @param {object} props
100650
- * @param {object} props.element
100651
- * @param {string} props.id
100652
- * @param {string} [props.description]
100653
- * @param {string} props.label
100654
- * @param {Function} props.getValue
100655
- * @param {Function} props.setValue
100656
- * @param {Function} props.onFocus
100657
- * @param {Function} props.onBlur
100658
- * @param {Function} props.getOptions
100659
- * @param {boolean} [props.disabled]
100660
- * @param {Function} [props.validate]
100661
- * @param {string|import('preact').Component} props.tooltip
100844
+ /**
100845
+ * @param {object} props
100846
+ * @param {object} props.element
100847
+ * @param {string} props.id
100848
+ * @param {string} [props.description]
100849
+ * @param {string} props.label
100850
+ * @param {Function} props.getValue
100851
+ * @param {Function} props.setValue
100852
+ * @param {Function} props.onFocus
100853
+ * @param {Function} props.onBlur
100854
+ * @param {Function} props.getOptions
100855
+ * @param {boolean} [props.disabled]
100856
+ * @param {Function} [props.validate]
100857
+ * @param {string|import('preact').Component} props.tooltip
100662
100858
  */
100663
100859
  function SelectEntry(props) {
100664
100860
  const {
@@ -100951,20 +101147,20 @@
100951
101147
  });
100952
101148
  }
100953
101149
 
100954
- /**
100955
- * @param {Object} props
100956
- * @param {Object} props.element
100957
- * @param {String} props.id
100958
- * @param {String} props.description
100959
- * @param {Boolean} props.debounce
100960
- * @param {Boolean} props.disabled
100961
- * @param {String} props.label
100962
- * @param {Function} props.getValue
100963
- * @param {Function} props.setValue
100964
- * @param {Function} props.onFocus
100965
- * @param {Function} props.onBlur
100966
- * @param {string|import('preact').Component} props.tooltip
100967
- * @param {Function} props.validate
101150
+ /**
101151
+ * @param {Object} props
101152
+ * @param {Object} props.element
101153
+ * @param {String} props.id
101154
+ * @param {String} props.description
101155
+ * @param {Boolean} props.debounce
101156
+ * @param {Boolean} props.disabled
101157
+ * @param {String} props.label
101158
+ * @param {Function} props.getValue
101159
+ * @param {Function} props.setValue
101160
+ * @param {Function} props.onFocus
101161
+ * @param {Function} props.onBlur
101162
+ * @param {string|import('preact').Component} props.tooltip
101163
+ * @param {Function} props.validate
100968
101164
  */
100969
101165
  function TextfieldEntry(props) {
100970
101166
  const {
@@ -101057,20 +101253,20 @@
101057
101253
  this._eventBus = eventBus;
101058
101254
  }
101059
101255
 
101060
- /**
101061
- * Check if the FEEL popup is open.
101062
- * @return {Boolean}
101256
+ /**
101257
+ * Check if the FEEL popup is open.
101258
+ * @return {Boolean}
101063
101259
  */
101064
101260
  isOpen() {
101065
101261
  return this._eventBus.fire('feelPopup._isOpen');
101066
101262
  }
101067
101263
 
101068
- /**
101069
- * Open the FEEL popup.
101070
- *
101071
- * @param {String} entryId
101072
- * @param {Object} popupConfig
101073
- * @param {HTMLElement} sourceElement
101264
+ /**
101265
+ * Open the FEEL popup.
101266
+ *
101267
+ * @param {String} entryId
101268
+ * @param {Object} popupConfig
101269
+ * @param {HTMLElement} sourceElement
101074
101270
  */
101075
101271
  open(entryId, popupConfig, sourceElement) {
101076
101272
  return this._eventBus.fire('feelPopup._open', {
@@ -101080,8 +101276,8 @@
101080
101276
  });
101081
101277
  }
101082
101278
 
101083
- /**
101084
- * Close the FEEL popup.
101279
+ /**
101280
+ * Close the FEEL popup.
101085
101281
  */
101086
101282
  close() {
101087
101283
  return this._eventBus.fire('feelPopup._close');
@@ -102548,7 +102744,8 @@
102548
102744
  layoutConfig: initialLayoutConfig,
102549
102745
  descriptionConfig,
102550
102746
  tooltipConfig,
102551
- feelPopupContainer
102747
+ feelPopupContainer,
102748
+ getFeelPopupLinks
102552
102749
  } = props;
102553
102750
  const canvas = injector.get('canvas');
102554
102751
  const elementRegistry = injector.get('elementRegistry');
@@ -102725,6 +102922,7 @@
102725
102922
  tooltipConfig: tooltipConfig,
102726
102923
  tooltipLoaded: onTooltipLoaded,
102727
102924
  feelPopupContainer: feelPopupContainer,
102925
+ getFeelPopupLinks: getFeelPopupLinks,
102728
102926
  eventBus: eventBus
102729
102927
  })
102730
102928
  });
@@ -102733,8 +102931,7 @@
102733
102931
  // helpers //////////////////////////
102734
102932
 
102735
102933
  function isImplicitRoot$1(element) {
102736
- // Backwards compatibility for diagram-js<7.4.0, see https://github.com/bpmn-io/bpmn-properties-panel/pull/102
102737
- return element && (element.isImplicit || element.id === '__implicitroot');
102934
+ return element && element.isImplicit;
102738
102935
  }
102739
102936
  function findElement(elements, element) {
102740
102937
  return find$1(elements, e => e === element);
@@ -102758,7 +102955,8 @@
102758
102955
  layout: layoutConfig,
102759
102956
  description: descriptionConfig,
102760
102957
  tooltip: tooltipConfig,
102761
- feelPopupContainer
102958
+ feelPopupContainer,
102959
+ getFeelPopupLinks
102762
102960
  } = config || {};
102763
102961
  this._eventBus = eventBus;
102764
102962
  this._injector = injector;
@@ -102766,6 +102964,7 @@
102766
102964
  this._descriptionConfig = descriptionConfig;
102767
102965
  this._tooltipConfig = tooltipConfig;
102768
102966
  this._feelPopupContainer = feelPopupContainer;
102967
+ this._getFeelPopupLinks = getFeelPopupLinks;
102769
102968
  this._container = domify$1('<div style="height: 100%" class="bio-properties-panel-container"></div>');
102770
102969
  var commandStack = injector.get('commandStack', false);
102771
102970
  commandStack && setupKeyboard(this._container, eventBus, commandStack);
@@ -102877,7 +103076,8 @@
102877
103076
  layoutConfig: this._layoutConfig,
102878
103077
  descriptionConfig: this._descriptionConfig,
102879
103078
  tooltipConfig: this._tooltipConfig,
102880
- feelPopupContainer: this._feelPopupContainer
103079
+ feelPopupContainer: this._feelPopupContainer,
103080
+ getFeelPopupLinks: this._getFeelPopupLinks
102881
103081
  }), this._container);
102882
103082
  this._eventBus.fire('propertiesPanel.rendered');
102883
103083
  }
@@ -102893,8 +103093,7 @@
102893
103093
  // helpers ///////////////////////
102894
103094
 
102895
103095
  function isImplicitRoot(element) {
102896
- // Backwards compatibility for diagram-js<7.4.0, see https://github.com/bpmn-io/bpmn-properties-panel/pull/102
102897
- return element && (element.isImplicit || element.id === '__implicitroot');
103096
+ return element && element.isImplicit;
102898
103097
  }
102899
103098
 
102900
103099
  /**
@@ -104960,7 +105159,7 @@
104960
105159
  }), u("a", {
104961
105160
  href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-date",
104962
105161
  target: "_blank",
104963
- rel: "noopener",
105162
+ rel: "noopener noreferrer",
104964
105163
  children: translate('Documentation: Timer events')
104965
105164
  })]
104966
105165
  });
@@ -104981,7 +105180,7 @@
104981
105180
  }), u("a", {
104982
105181
  href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-cycle",
104983
105182
  target: "_blank",
104984
- rel: "noopener",
105183
+ rel: "noopener noreferrer",
104985
105184
  children: translate('Documentation: Timer events')
104986
105185
  })]
104987
105186
  });
@@ -105006,7 +105205,7 @@
105006
105205
  }), u("a", {
105007
105206
  href: "https://docs.camunda.org/manual/latest/reference/bpmn20/events/timer-events/#time-duration",
105008
105207
  target: "_blank",
105009
- rel: "noopener",
105208
+ rel: "noopener noreferrer",
105010
105209
  children: translate('Documentation: Timer events')
105011
105210
  })]
105012
105211
  });