bpmn-js 18.0.0 → 18.1.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
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v18.0.0
2
+ * bpmn-js - bpmn-modeler v18.1.1
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2024-11-06
11
+ * Date: 2024-11-21
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2738,7 +2738,7 @@
2738
2738
  * @return {string}
2739
2739
  */
2740
2740
  function componentsToPath(elements) {
2741
- return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
2741
+ return elements.flat().join(',').replace(/,?([A-Za-z]),?/g, '$1');
2742
2742
  }
2743
2743
 
2744
2744
  /**
@@ -25370,7 +25370,7 @@
25370
25370
  * `keyboard.bind=true|false` configuration option.
25371
25371
  *
25372
25372
  * @param {Object} config
25373
- * @param {EventTarget} [config.bindTo]
25373
+ * @param {boolean} [config.bind]
25374
25374
  * @param {EventBus} eventBus
25375
25375
  */
25376
25376
  function Keyboard(config, eventBus) {
@@ -25446,10 +25446,17 @@
25446
25446
  /**
25447
25447
  * Bind keyboard events to the given DOM node.
25448
25448
  *
25449
+ * @overlord
25450
+ * @deprecated No longer in use since version 15.0.0.
25451
+ *
25449
25452
  * @param {EventTarget} node
25450
25453
  */
25454
+ /**
25455
+ * Bind keyboard events to the canvas node.
25456
+ */
25451
25457
  Keyboard.prototype.bind = function(node) {
25452
25458
 
25459
+ // legacy <node> argument provided
25453
25460
  if (node) {
25454
25461
  console.error('unsupported argument <node>', new Error(compatMessage));
25455
25462
  }
@@ -27753,7 +27760,7 @@
27753
27760
  return originalEntries;
27754
27761
  }
27755
27762
 
27756
- if (!value) {
27763
+ if (!value.trim()) {
27757
27764
  return originalEntries.filter(({ rank = 0 }) => rank >= 0);
27758
27765
  }
27759
27766
 
@@ -28630,6 +28637,12 @@
28630
28637
  keys
28631
28638
  } = options;
28632
28639
 
28640
+ pattern = pattern.trim().toLowerCase();
28641
+
28642
+ if (!pattern) {
28643
+ throw new Error('<pattern> must not be empty');
28644
+ }
28645
+
28633
28646
  const words = pattern.trim().toLowerCase().split(/\s+/);
28634
28647
 
28635
28648
  return items.flatMap((item) => {
@@ -28757,22 +28770,33 @@
28757
28770
  }
28758
28771
 
28759
28772
  /**
28760
- * Score a token.
28773
+ * Score a token based on its characteristics
28774
+ * and the length of the matched content.
28761
28775
  *
28762
28776
  * @param { Token } token
28763
28777
  *
28764
28778
  * @returns { number }
28765
28779
  */
28766
28780
  function scoreToken(token) {
28781
+ const modifier = Math.log(token.value.length);
28782
+
28767
28783
  if (!token.match) {
28768
- return 0;
28784
+ return -0.07 * modifier;
28769
28785
  }
28770
28786
 
28771
- return token.start
28772
- ? 1.37
28773
- : token.wordStart
28774
- ? 1.13
28775
- : 1;
28787
+ return (
28788
+ token.start
28789
+ ? (
28790
+ token.end
28791
+ ? 131.9
28792
+ : 7.87
28793
+ )
28794
+ : (
28795
+ token.wordStart
28796
+ ? 2.19
28797
+ : 1
28798
+ )
28799
+ ) * modifier;
28776
28800
  }
28777
28801
 
28778
28802
  /**
@@ -28811,7 +28835,12 @@
28811
28835
  const tokens = [];
28812
28836
  const matchedWords = {};
28813
28837
 
28814
- const regexpString = words.map(escapeRegexp).flatMap(str => [ '(?<wordStart>\\b' + str + ')', str ]).join('|');
28838
+ const wordsEscaped = words.map(escapeRegexp);
28839
+
28840
+ const regexpString = [
28841
+ `(?<all>${wordsEscaped.join('\\s+')})`,
28842
+ ...wordsEscaped
28843
+ ].join('|');
28815
28844
 
28816
28845
  const regexp = new RegExp(regexpString, 'ig');
28817
28846
 
@@ -28822,6 +28851,17 @@
28822
28851
 
28823
28852
  const [ value ] = match;
28824
28853
 
28854
+ const startIndex = match.index;
28855
+ const endIndex = match.index + value.length;
28856
+
28857
+ const start = startIndex === 0;
28858
+ const end = endIndex === string.length;
28859
+
28860
+ const all = !!match.groups.all;
28861
+
28862
+ const wordStart = start || /\s/.test(string.charAt(startIndex - 1));
28863
+ const wordEnd = end || /\s/.test(string.charAt(endIndex + 1));
28864
+
28825
28865
  if (match.index > lastIndex) {
28826
28866
 
28827
28867
  // add previous token (NO match)
@@ -28836,11 +28876,18 @@
28836
28876
  value,
28837
28877
  index: match.index,
28838
28878
  match: true,
28839
- wordStart: !!match.groups.wordStart,
28840
- start: match.index === 0
28879
+ wordStart,
28880
+ wordEnd,
28881
+ start,
28882
+ end,
28883
+ all
28841
28884
  });
28842
28885
 
28843
- matchedWords[value.toLowerCase()] = true;
28886
+ const newMatchedWords = all ? words : [ value ];
28887
+
28888
+ for (const word of newMatchedWords) {
28889
+ matchedWords[word.toLowerCase()] = true;
28890
+ }
28844
28891
 
28845
28892
  lastIndex = match.index + value.length;
28846
28893
  }
@@ -65041,7 +65088,7 @@
65041
65088
  this._clearResults();
65042
65089
 
65043
65090
  // do not search on empty query
65044
- if (!pattern || pattern === '') {
65091
+ if (!pattern.trim()) {
65045
65092
  return;
65046
65093
  }
65047
65094
 
@@ -65052,7 +65099,6 @@
65052
65099
  });
65053
65100
 
65054
65101
  if (!searchResults.length) {
65055
- this._clearMarkers();
65056
65102
  this._selection.select(null);
65057
65103
 
65058
65104
  return;
@@ -65129,16 +65175,6 @@
65129
65175
  };
65130
65176
 
65131
65177
 
65132
- /**
65133
- * Clears all markers.
65134
- */
65135
- SearchPad.prototype._clearMarkers = function() {
65136
- for (var id in this._results) {
65137
- this._canvas.removeMarker(this._results[id].element, 'djs-search-preselected');
65138
- }
65139
- };
65140
-
65141
-
65142
65178
  /**
65143
65179
  * Get currently selected result.
65144
65180
  *
@@ -65207,6 +65243,8 @@
65207
65243
  this._cachedSelection = this._selection.get();
65208
65244
  this._cachedViewbox = this._canvas.viewbox();
65209
65245
 
65246
+ this._selection.select(null);
65247
+
65210
65248
  this._bindEvents();
65211
65249
 
65212
65250
  this._open = true;
@@ -65255,8 +65293,6 @@
65255
65293
  classes$1(this._canvas.getContainer()).remove('djs-search-open');
65256
65294
  classes$1(this._container).remove('open');
65257
65295
 
65258
- this._clearMarkers();
65259
-
65260
65296
  this._clearResults();
65261
65297
 
65262
65298
  this._searchInput.value = '';
@@ -65297,8 +65333,6 @@
65297
65333
  return;
65298
65334
  }
65299
65335
 
65300
- this._clearMarkers();
65301
-
65302
65336
  // removing preselection from current node
65303
65337
  if (selectedNode) {
65304
65338
  classes$1(selectedNode).remove(SearchPad.RESULT_SELECTED_CLASS);
@@ -65315,8 +65349,6 @@
65315
65349
 
65316
65350
  this._selection.select(element);
65317
65351
 
65318
- this._canvas.addMarker(element, 'djs-search-preselected');
65319
-
65320
65352
  this._eventBus.fire('searchPad.preselected', element);
65321
65353
  };
65322
65354