camunda-bpmn-js 5.1.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -984,7 +984,7 @@
984
984
  background: var(--search-result-hover-background-color);
985
985
  }
986
986
 
987
- .djs-element.djs-search-preselected .djs-outline {
987
+ .djs-search-open .djs-element .djs-outline {
988
988
  fill: var(--search-preselected-background-color) !important;
989
989
  }
990
990
 
@@ -2755,7 +2755,7 @@
2755
2755
  * @return {string}
2756
2756
  */
2757
2757
  function componentsToPath(elements) {
2758
- return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
2758
+ return elements.flat().join(',').replace(/,?([A-Za-z]),?/g, '$1');
2759
2759
  }
2760
2760
 
2761
2761
  /**
@@ -25387,7 +25387,7 @@
25387
25387
  * `keyboard.bind=true|false` configuration option.
25388
25388
  *
25389
25389
  * @param {Object} config
25390
- * @param {EventTarget} [config.bindTo]
25390
+ * @param {boolean} [config.bind]
25391
25391
  * @param {EventBus} eventBus
25392
25392
  */
25393
25393
  function Keyboard(config, eventBus) {
@@ -25463,10 +25463,17 @@
25463
25463
  /**
25464
25464
  * Bind keyboard events to the given DOM node.
25465
25465
  *
25466
+ * @overlord
25467
+ * @deprecated No longer in use since version 15.0.0.
25468
+ *
25466
25469
  * @param {EventTarget} node
25467
25470
  */
25471
+ /**
25472
+ * Bind keyboard events to the canvas node.
25473
+ */
25468
25474
  Keyboard.prototype.bind = function(node) {
25469
25475
 
25476
+ // legacy <node> argument provided
25470
25477
  if (node) {
25471
25478
  console.error('unsupported argument <node>', new Error(compatMessage));
25472
25479
  }
@@ -27770,7 +27777,7 @@
27770
27777
  return originalEntries;
27771
27778
  }
27772
27779
 
27773
- if (!value) {
27780
+ if (!value.trim()) {
27774
27781
  return originalEntries.filter(({ rank = 0 }) => rank >= 0);
27775
27782
  }
27776
27783
 
@@ -28647,6 +28654,12 @@
28647
28654
  keys
28648
28655
  } = options;
28649
28656
 
28657
+ pattern = pattern.trim().toLowerCase();
28658
+
28659
+ if (!pattern) {
28660
+ throw new Error('<pattern> must not be empty');
28661
+ }
28662
+
28650
28663
  const words = pattern.trim().toLowerCase().split(/\s+/);
28651
28664
 
28652
28665
  return items.flatMap((item) => {
@@ -28774,22 +28787,33 @@
28774
28787
  }
28775
28788
 
28776
28789
  /**
28777
- * Score a token.
28790
+ * Score a token based on its characteristics
28791
+ * and the length of the matched content.
28778
28792
  *
28779
28793
  * @param { Token } token
28780
28794
  *
28781
28795
  * @returns { number }
28782
28796
  */
28783
28797
  function scoreToken(token) {
28798
+ const modifier = Math.log(token.value.length);
28799
+
28784
28800
  if (!token.match) {
28785
- return 0;
28801
+ return -0.07 * modifier;
28786
28802
  }
28787
28803
 
28788
- return token.start
28789
- ? 1.37
28790
- : token.wordStart
28791
- ? 1.13
28792
- : 1;
28804
+ return (
28805
+ token.start
28806
+ ? (
28807
+ token.end
28808
+ ? 131.9
28809
+ : 7.87
28810
+ )
28811
+ : (
28812
+ token.wordStart
28813
+ ? 2.19
28814
+ : 1
28815
+ )
28816
+ ) * modifier;
28793
28817
  }
28794
28818
 
28795
28819
  /**
@@ -28828,7 +28852,12 @@
28828
28852
  const tokens = [];
28829
28853
  const matchedWords = {};
28830
28854
 
28831
- const regexpString = words.map(escapeRegexp).flatMap(str => [ '(?<wordStart>\\b' + str + ')', str ]).join('|');
28855
+ const wordsEscaped = words.map(escapeRegexp);
28856
+
28857
+ const regexpString = [
28858
+ `(?<all>${wordsEscaped.join('\\s+')})`,
28859
+ ...wordsEscaped
28860
+ ].join('|');
28832
28861
 
28833
28862
  const regexp = new RegExp(regexpString, 'ig');
28834
28863
 
@@ -28839,6 +28868,17 @@
28839
28868
 
28840
28869
  const [ value ] = match;
28841
28870
 
28871
+ const startIndex = match.index;
28872
+ const endIndex = match.index + value.length;
28873
+
28874
+ const start = startIndex === 0;
28875
+ const end = endIndex === string.length;
28876
+
28877
+ const all = !!match.groups.all;
28878
+
28879
+ const wordStart = start || /\s/.test(string.charAt(startIndex - 1));
28880
+ const wordEnd = end || /\s/.test(string.charAt(endIndex + 1));
28881
+
28842
28882
  if (match.index > lastIndex) {
28843
28883
 
28844
28884
  // add previous token (NO match)
@@ -28853,11 +28893,18 @@
28853
28893
  value,
28854
28894
  index: match.index,
28855
28895
  match: true,
28856
- wordStart: !!match.groups.wordStart,
28857
- start: match.index === 0
28896
+ wordStart,
28897
+ wordEnd,
28898
+ start,
28899
+ end,
28900
+ all
28858
28901
  });
28859
28902
 
28860
- matchedWords[value.toLowerCase()] = true;
28903
+ const newMatchedWords = all ? words : [ value ];
28904
+
28905
+ for (const word of newMatchedWords) {
28906
+ matchedWords[word.toLowerCase()] = true;
28907
+ }
28861
28908
 
28862
28909
  lastIndex = match.index + value.length;
28863
28910
  }
@@ -65058,7 +65105,7 @@
65058
65105
  this._clearResults();
65059
65106
 
65060
65107
  // do not search on empty query
65061
- if (!pattern || pattern === '') {
65108
+ if (!pattern.trim()) {
65062
65109
  return;
65063
65110
  }
65064
65111
 
@@ -102965,7 +103012,7 @@
102965
103012
  this._tooltipConfig = tooltipConfig;
102966
103013
  this._feelPopupContainer = feelPopupContainer;
102967
103014
  this._getFeelPopupLinks = getFeelPopupLinks;
102968
- this._container = domify$1('<div style="height: 100%" class="bio-properties-panel-container"></div>');
103015
+ this._container = domify$1('<div style="height: 100%" tabindex="-1" class="bio-properties-panel-container"></div>');
102969
103016
  var commandStack = injector.get('commandStack', false);
102970
103017
  commandStack && setupKeyboard(this._container, eventBus, commandStack);
102971
103018
  eventBus.on('diagram.init', () => {