bpmn-js 17.10.0 → 17.11.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.
package/README.md CHANGED
@@ -88,6 +88,8 @@ bpmn-js builds on top of a few powerful tools:
88
88
  * [bpmn-moddle](https://github.com/bpmn-io/bpmn-moddle): Read / write support for BPMN 2.0 XML in the browsers
89
89
  * [diagram-js](https://github.com/bpmn-io/diagram-js): Diagram rendering and editing toolkit
90
90
 
91
+ It is an extensible toolkit, complemented by many [additional utilities](https://github.com/bpmn-io/awesome-bpmn-io).
92
+
91
93
  ## License
92
94
 
93
95
  Use under the terms of the [bpmn.io license](http://bpmn.io/license).
@@ -74,14 +74,15 @@
74
74
  --resizer-fill-color: var(--color-blue-205-100-45);
75
75
  --resizer-stroke-color: var(--canvas-fill-color);
76
76
 
77
- --search-container-background-color: var(--color-grey-225-10-97);
78
- --search-container-border-color: var(--color-blue-205-100-50);
79
- --search-container-box-shadow-color: var(--color-blue-205-100-95);
80
- --search-container-box-shadow-inset-color: var(--color-grey-225-10-80);
77
+ --search-font-family: "IBM Plex Sans", sans-serif;
78
+ --search-font-size: 14px;
79
+ --search-container-background-color: var(--color-white);
80
+ --search-shadow-color: var(--color-black-opacity-30);
81
81
  --search-input-border-color: var(--color-grey-225-10-75);
82
- --search-result-border-color: var(--color-grey-225-10-75);
83
- --search-result-highlight-color: var(--color-black);
84
- --search-result-selected-color: var(--color-blue-205-100-45-opacity-30);
82
+ --search-input-focus-border-color: var(--color-blue-205-100-50);
83
+ --search-input-focus-background-color: var(--color-blue-205-100-95);
84
+ --search-result-hover-background-color: var(--color-grey-225-10-95);
85
+ --search-result-secondary-color: var(--color-grey-225-10-55);
85
86
 
86
87
  --shape-attach-allowed-stroke-color: var(--color-blue-205-100-50);
87
88
  --shape-connect-allowed-fill-color: var(--color-grey-225-10-97);
@@ -532,7 +533,7 @@ svg.new-parent {
532
533
  width: 100%;
533
534
  box-sizing: border-box;
534
535
  font-size: var(--popup-font-size);
535
- padding: 3px 6px;
536
+ padding: 3px 6px 3px 28px;
536
537
  border-radius: 2px;
537
538
  border: solid 1px var(--popup-search-border-color);
538
539
  line-height: 21px;
@@ -593,6 +594,8 @@ svg.new-parent {
593
594
  }
594
595
 
595
596
  .djs-popup-search {
597
+ position: relative;
598
+ width: auto;
596
599
  margin: 10px 12px;
597
600
  }
598
601
 
@@ -603,21 +606,12 @@ svg.new-parent {
603
606
  margin: 0;
604
607
  }
605
608
 
606
- .djs-popup-search {
607
- position: relative;
608
- width: auto;
609
- }
610
-
611
609
  .djs-popup-search-icon {
612
610
  position: absolute;
613
611
  left: 8px;
614
612
  top: 7px;
615
613
  }
616
614
 
617
- .djs-popup-search input {
618
- padding-left: 25px;
619
- }
620
-
621
615
  .djs-popup-results {
622
616
  margin: 7px 3px 7px 12px;
623
617
  list-style: none;
@@ -889,6 +883,14 @@ svg.new-parent {
889
883
  /**
890
884
  * search pad
891
885
  */
886
+ .djs-search-open .djs-context-pad {
887
+ display: none;
888
+ }
889
+
890
+ .djs-search-open .djs-connection.selected .djs-outline {
891
+ display: block;
892
+ }
893
+
892
894
  .djs-search-container {
893
895
  position: absolute;
894
896
  top: 20px;
@@ -902,76 +904,79 @@ svg.new-parent {
902
904
  max-width: 400px;
903
905
  z-index: 10;
904
906
 
905
- font-size: 1.05em;
906
- opacity: 0.9;
907
- background: var(--search-container-background-color);
908
- border: solid 1px var(--search-container-border-color);
907
+ font-family: var(--search-font-family);
908
+ font-size: var(--search-font-size);
909
909
  border-radius: 2px;
910
- box-shadow: 0 0 0 2px var(--search-container-box-shadow-color), 0 0 0 1px var(--search-container-box-shadow-inset-color) inset;
910
+ box-shadow: 0px 2px 6px var(--search-shadow-color);
911
911
  }
912
912
 
913
913
  .djs-search-container:not(.open) {
914
914
  display: none;
915
915
  }
916
916
 
917
+ .djs-search-input {
918
+ position: relative;
919
+ }
920
+
921
+ .djs-search-input svg {
922
+ position: absolute;
923
+ left: 8px;
924
+ top: 7px;
925
+ }
926
+
917
927
  .djs-search-input input {
918
- font-size: 1.05em;
928
+ font-size: var(--search-font-size);
919
929
  width: 100%;
920
- padding: 6px 10px;
930
+ padding: 3px 6px 3px 28px;
921
931
  border: 1px solid var(--search-input-border-color);
932
+ border-radius: 2px;
922
933
  box-sizing: border-box;
934
+ line-height: 21px;
923
935
  }
924
936
 
925
937
  .djs-search-input input:focus {
938
+ background-color: var(--search-input-focus-background-color);
939
+ border: solid 1px var(--search-input-focus-border-color);
926
940
  outline: none;
927
- border-color: var(--search-input-border-color);
928
941
  }
929
942
 
930
943
  .djs-search-results {
931
944
  position: relative;
932
945
  overflow-y: auto;
933
946
  max-height: 200px;
934
- }
935
-
936
- .djs-search-results:hover {
937
- cursor: pointer;
947
+ background: var(--search-container-background-color);
938
948
  }
939
949
 
940
950
  .djs-search-result {
941
- width: 100%;
942
- padding: 6px 10px;
943
- background: white;
944
- border-bottom: solid 1px var(--search-result-border-color);
945
- border-radius: 1px;
946
- }
947
-
948
- .djs-search-highlight {
949
- color: var(--search-result-highlight-color);
951
+ padding: 6px 8px;
950
952
  }
951
953
 
952
954
  .djs-search-result-primary {
953
- margin: 0 0 10px;
955
+ margin: 0 0 3px;
956
+ text-overflow: ellipsis;
957
+ overflow: hidden;
958
+ white-space: nowrap;
954
959
  }
955
960
 
956
961
  .djs-search-result-secondary {
957
962
  font-family: monospace;
958
963
  margin: 0;
964
+ text-overflow: ellipsis;
965
+ overflow: hidden;
966
+ white-space: nowrap;
967
+ color: var(--search-result-secondary-color);
959
968
  }
960
969
 
961
970
  .djs-search-result:hover {
962
- background: var(--search-result-selected-color);
971
+ background: var(--search-result-hover-background-color);
963
972
  }
964
973
 
965
974
  .djs-search-result-selected {
966
- background: var(--search-result-selected-color);
975
+ background: var(--search-result-hover-background-color);
967
976
  }
968
977
 
969
978
  .djs-search-result-selected:hover {
970
- background: var(--search-result-selected-color);
971
- }
972
-
973
- .djs-search-overlay {
974
- background: var(--search-result-selected-color);
979
+ background: var(--search-result-hover-background-color);
975
980
  }
976
981
 
977
982
  /**
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v17.10.0
2
+ * bpmn-js - bpmn-modeler v17.11.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-09-09
11
+ * Date: 2024-09-16
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -64769,12 +64769,9 @@
64769
64769
  /**
64770
64770
  * @typedef {import('../../core/Canvas').default} Canvas
64771
64771
  * @typedef {import('../../core/EventBus').default} EventBus
64772
- * @typedef {import('../overlays/Overlays').default} Overlays
64773
64772
  * @typedef {import('../selection/Selection').default} Selection
64774
64773
  * @typedef {import('../../i18n/translate/translate.js').default} Translate
64775
64774
  *
64776
- * @typedef {import('../overlays/Overlays').OverlayAttrs} OverlayAttrs
64777
- *
64778
64775
  * @typedef {import('../../util/Types').Dimensions} Dimensions
64779
64776
  *
64780
64777
  * @typedef {import('./SearchPadProvider').default} SearchPadProvider
@@ -64787,18 +64784,20 @@
64787
64784
  *
64788
64785
  * @param {Canvas} canvas
64789
64786
  * @param {EventBus} eventBus
64790
- * @param {Overlays} overlays
64791
64787
  * @param {Selection} selection
64792
64788
  * @param {Translate} translate
64793
64789
  */
64794
- function SearchPad(canvas, eventBus, overlays, selection, translate) {
64790
+ function SearchPad(canvas, eventBus, selection, translate) {
64795
64791
  this._open = false;
64796
64792
  this._results = [];
64797
64793
  this._eventMaps = [];
64798
64794
 
64795
+ this._cachedRootElement = null;
64796
+ this._cachedSelection = null;
64797
+ this._cachedViewbox = null;
64798
+
64799
64799
  this._canvas = canvas;
64800
64800
  this._eventBus = eventBus;
64801
- this._overlays = overlays;
64802
64801
  this._selection = selection;
64803
64802
  this._translate = translate;
64804
64803
 
@@ -64810,15 +64809,19 @@
64810
64809
  // attach search pad
64811
64810
  this._canvas.getContainer().appendChild(this._container);
64812
64811
 
64813
- // cleanup on destroy
64814
- eventBus.on([ 'canvas.destroy', 'diagram.destroy' ], this.close, this);
64812
+ // cleanup whenever appropriate
64813
+ eventBus.on([
64814
+ 'canvas.destroy',
64815
+ 'diagram.destroy',
64816
+ 'drag.init',
64817
+ 'elements.changed'
64818
+ ], this.close, this);
64815
64819
  }
64816
64820
 
64817
64821
 
64818
64822
  SearchPad.$inject = [
64819
64823
  'canvas',
64820
64824
  'eventBus',
64821
- 'overlays',
64822
64825
  'selection',
64823
64826
  'translate'
64824
64827
  ];
@@ -64840,7 +64843,7 @@
64840
64843
 
64841
64844
  // close search on clicking anywhere outside
64842
64845
  listen(document, 'html', 'click', function(e) {
64843
- self.close();
64846
+ self.close(false);
64844
64847
  });
64845
64848
 
64846
64849
  // stop event from propagating and closing search
@@ -64886,7 +64889,7 @@
64886
64889
  if (isKey('Enter', e)) {
64887
64890
  var selected = self._getCurrentResult();
64888
64891
 
64889
- return selected ? self._select(selected) : self.close();
64892
+ return selected ? self._select(selected) : self.close(false);
64890
64893
  }
64891
64894
 
64892
64895
  if (isKey('ArrowUp', e)) {
@@ -64935,6 +64938,10 @@
64935
64938
 
64936
64939
  var searchResults = this._searchProvider.find(pattern);
64937
64940
 
64941
+ searchResults = searchResults.filter(function(searchResult) {
64942
+ return !self._canvas.getRootElements().includes(searchResult.element);
64943
+ });
64944
+
64938
64945
  if (!searchResults.length) {
64939
64946
  return;
64940
64947
  }
@@ -65006,8 +65013,6 @@
65006
65013
 
65007
65014
  this._results = [];
65008
65015
 
65009
- this._resetOverlay();
65010
-
65011
65016
  this._eventBus.fire('searchPad.cleared');
65012
65017
  };
65013
65018
 
@@ -65076,10 +65081,15 @@
65076
65081
  return;
65077
65082
  }
65078
65083
 
65084
+ this._cachedRootElement = this._canvas.getRootElement();
65085
+ this._cachedSelection = this._selection.get();
65086
+ this._cachedViewbox = this._canvas.viewbox();
65087
+
65079
65088
  this._bindEvents();
65080
65089
 
65081
65090
  this._open = true;
65082
65091
 
65092
+ classes$1(this._canvas.getContainer()).add('djs-search-open');
65083
65093
  classes$1(this._container).add('open');
65084
65094
 
65085
65095
  this._searchInput.focus();
@@ -65091,15 +65101,36 @@
65091
65101
  /**
65092
65102
  * Close search pad.
65093
65103
  */
65094
- SearchPad.prototype.close = function() {
65104
+ SearchPad.prototype.close = function(restoreCached = true) {
65095
65105
  if (!this.isOpen()) {
65096
65106
  return;
65097
65107
  }
65098
65108
 
65109
+ if (restoreCached) {
65110
+ if (this._cachedRootElement) {
65111
+ this._canvas.setRootElement(this._cachedRootElement);
65112
+ }
65113
+
65114
+ if (this._cachedSelection) {
65115
+ this._selection.select(this._cachedSelection);
65116
+ }
65117
+
65118
+ if (this._cachedViewbox) {
65119
+ this._canvas.viewbox(this._cachedViewbox);
65120
+ }
65121
+
65122
+ this._eventBus.fire('searchPad.restored');
65123
+ }
65124
+
65125
+ this._cachedRootElement = null;
65126
+ this._cachedSelection = null;
65127
+ this._cachedViewbox = null;
65128
+
65099
65129
  this._unbindEvents();
65100
65130
 
65101
65131
  this._open = false;
65102
65132
 
65133
+ classes$1(this._canvas.getContainer()).remove('djs-search-open');
65103
65134
  classes$1(this._container).remove('open');
65104
65135
 
65105
65136
  this._clearResults();
@@ -65107,8 +65138,6 @@
65107
65138
  this._searchInput.value = '';
65108
65139
  this._searchInput.blur();
65109
65140
 
65110
- this._resetOverlay();
65111
-
65112
65141
  this._eventBus.fire('searchPad.closed');
65113
65142
  };
65114
65143
 
@@ -65152,9 +65181,11 @@
65152
65181
 
65153
65182
  classes$1(node).add(SearchPad.RESULT_SELECTED_CLASS);
65154
65183
 
65155
- this._resetOverlay(element);
65184
+ this._canvas.zoom(1);
65156
65185
 
65157
- this._canvas.scrollToElement(element, { top: 400 });
65186
+ this._canvas.scrollToElement(element, {
65187
+ top: 300
65188
+ });
65158
65189
 
65159
65190
  this._selection.select(element);
65160
65191
 
@@ -65171,9 +65202,10 @@
65171
65202
  var id = attr$1(node, SearchPad.RESULT_ID_ATTRIBUTE);
65172
65203
  var element = this._results[id].element;
65173
65204
 
65174
- this.close();
65205
+ this._cachedSelection = null;
65206
+ this._cachedViewbox = null;
65175
65207
 
65176
- this._resetOverlay();
65208
+ this.close(false);
65177
65209
 
65178
65210
  this._canvas.scrollToElement(element, { top: 400 });
65179
65211
 
@@ -65183,24 +65215,6 @@
65183
65215
  };
65184
65216
 
65185
65217
 
65186
- /**
65187
- * Reset overlay removes and, optionally, set
65188
- * overlay to a new element.
65189
- *
65190
- * @param {HTMLElement} element
65191
- */
65192
- SearchPad.prototype._resetOverlay = function(element) {
65193
- if (this._overlayId) {
65194
- this._overlays.remove(this._overlayId);
65195
- }
65196
-
65197
- if (element) {
65198
- var box = getBBox(element);
65199
- var overlay = constructOverlay(box);
65200
- this._overlayId = this._overlays.add(element, overlay);
65201
- }
65202
- };
65203
-
65204
65218
  SearchPad.prototype._getBoxHtml = function() {
65205
65219
  const box = domify$1(SearchPad.BOX_HTML);
65206
65220
  const input = query(SearchPad.INPUT_SELECTOR, box);
@@ -65213,39 +65227,6 @@
65213
65227
  };
65214
65228
 
65215
65229
 
65216
- /**
65217
- * Construct overlay object for the given bounding box.
65218
- *
65219
- * @param {Dimensions} box
65220
- *
65221
- * @return {OverlayAttrs}
65222
- */
65223
- function constructOverlay(box) {
65224
-
65225
- var offset = 6;
65226
- var w = box.width + offset * 2;
65227
- var h = box.height + offset * 2;
65228
-
65229
- var styles = {
65230
- width: w + 'px',
65231
- height: h + 'px'
65232
- };
65233
-
65234
- var html = domify$1('<div class="' + SearchPad.OVERLAY_CLASS + '"></div>');
65235
-
65236
- assign(html, styles);
65237
-
65238
- return {
65239
- position: {
65240
- bottom: h - offset,
65241
- right: w - offset
65242
- },
65243
- show: true,
65244
- html: html
65245
- };
65246
- }
65247
-
65248
-
65249
65230
  /**
65250
65231
  * Creates and appends child node from result tokens and HTML template.
65251
65232
  *
@@ -65273,7 +65254,7 @@
65273
65254
 
65274
65255
  tokens.forEach(function(t) {
65275
65256
  if (t.matched) {
65276
- htmlText += '<strong class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + escapeHTML(t.matched) + '</strong>';
65257
+ htmlText += '<b class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + escapeHTML(t.matched) + '</b>';
65277
65258
  } else {
65278
65259
  htmlText += escapeHTML(t.normal);
65279
65260
  }
@@ -65294,15 +65275,17 @@
65294
65275
  SearchPad.RESULT_SELECTED_SELECTOR = '.' + SearchPad.RESULT_SELECTED_CLASS;
65295
65276
  SearchPad.RESULT_ID_ATTRIBUTE = 'data-result-id';
65296
65277
  SearchPad.RESULT_HIGHLIGHT_CLASS = 'djs-search-highlight';
65297
- SearchPad.OVERLAY_CLASS = 'djs-search-overlay';
65298
65278
 
65299
65279
  SearchPad.BOX_HTML =
65300
- '<div class="djs-search-container djs-draggable djs-scrollable">' +
65301
- '<div class="djs-search-input">' +
65302
- '<input type="text"/>' +
65303
- '</div>' +
65304
- '<div class="djs-search-results"></div>' +
65305
- '</div>';
65280
+ `<div class="djs-search-container djs-scrollable">
65281
+ <div class="djs-search-input">
65282
+ <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
65283
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
65284
+ </svg>
65285
+ <input type="text" spellcheck="false" />
65286
+ </div>
65287
+ <div class="djs-search-results" />
65288
+ </div>` ;
65306
65289
 
65307
65290
  SearchPad.RESULT_HTML =
65308
65291
  '<div class="djs-search-result"></div>';
@@ -65365,48 +65348,114 @@
65365
65348
  var rootElements = this._canvas.getRootElements();
65366
65349
 
65367
65350
  var elements = this._elementRegistry.filter(function(element) {
65368
- if (element.labelTarget) {
65369
- return false;
65370
- }
65371
- return true;
65351
+ return !isLabel(element) && !rootElements.includes(element);
65372
65352
  });
65373
65353
 
65374
- // do not include root element
65375
- elements = filter(elements, function(element) {
65376
- return !rootElements.includes(element);
65377
- });
65354
+ return elements
65355
+ .reduce(function(results, element) {
65356
+ var label = getLabel(element);
65378
65357
 
65379
- elements = map$1(elements, function(element) {
65380
- return {
65381
- primaryTokens: matchAndSplit(getLabel(element), pattern),
65382
- secondaryTokens: matchAndSplit(element.id, pattern),
65383
- element: element
65384
- };
65385
- });
65358
+ var primaryTokens = findMatches(label, pattern),
65359
+ secondaryTokens = findMatches(element.id, pattern);
65386
65360
 
65387
- // exclude non-matched elements
65388
- elements = filter(elements, function(element) {
65389
- return hasMatched(element.primaryTokens) || hasMatched(element.secondaryTokens);
65390
- });
65391
-
65392
- elements = sortBy(elements, function(element) {
65393
- return getLabel(element.element) + element.element.id;
65394
- });
65361
+ if (hasMatch(primaryTokens) || hasMatch(secondaryTokens)) {
65362
+ return [
65363
+ ...results,
65364
+ {
65365
+ primaryTokens,
65366
+ secondaryTokens,
65367
+ element
65368
+ }
65369
+ ];
65370
+ }
65395
65371
 
65396
- return elements;
65372
+ return results;
65373
+ }, [])
65374
+ .sort(function(a, b) {
65375
+ return compareTokens(a.primaryTokens, b.primaryTokens)
65376
+ || compareTokens(a.secondaryTokens, b.secondaryTokens)
65377
+ || compareStrings(getLabel(a.element), getLabel(b.element))
65378
+ || compareStrings(a.element.id, b.element.id);
65379
+ })
65380
+ .map(function(result) {
65381
+ return {
65382
+ element: result.element,
65383
+ primaryTokens: result.primaryTokens.map(function(token) {
65384
+ return omit(token, [ 'index' ]);
65385
+ }),
65386
+ secondaryTokens: result.secondaryTokens.map(function(token) {
65387
+ return omit(token, [ 'index' ]);
65388
+ })
65389
+ };
65390
+ });
65397
65391
  };
65398
65392
 
65393
+ /**
65394
+ * @param {Token} token
65395
+ *
65396
+ * @return {boolean}
65397
+ */
65398
+ function isMatch(token) {
65399
+ return 'matched' in token;
65400
+ }
65401
+
65399
65402
  /**
65400
65403
  * @param {Token[]} tokens
65401
65404
  *
65402
65405
  * @return {boolean}
65403
65406
  */
65404
- function hasMatched(tokens) {
65405
- var matched = filter(tokens, function(token) {
65406
- return !!token.matched;
65407
- });
65407
+ function hasMatch(tokens) {
65408
+ return tokens.find(isMatch);
65409
+ }
65410
+
65411
+ /**
65412
+ * Compares two token arrays.
65413
+ *
65414
+ * @param {Token[]} tokensA
65415
+ * @param {Token[]} tokensB
65416
+ *
65417
+ * @returns {number}
65418
+ */
65419
+ function compareTokens(tokensA, tokensB) {
65420
+ const tokensAHasMatch = hasMatch(tokensA),
65421
+ tokensBHasMatch = hasMatch(tokensB);
65422
+
65423
+ if (tokensAHasMatch && !tokensBHasMatch) {
65424
+ return -1;
65425
+ }
65426
+
65427
+ if (!tokensAHasMatch && tokensBHasMatch) {
65428
+ return 1;
65429
+ }
65430
+
65431
+ if (!tokensAHasMatch && !tokensBHasMatch) {
65432
+ return 0;
65433
+ }
65434
+
65435
+ const tokensAFirstMatch = tokensA.find(isMatch),
65436
+ tokensBFirstMatch = tokensB.find(isMatch);
65437
+
65438
+ if (tokensAFirstMatch.index < tokensBFirstMatch.index) {
65439
+ return -1;
65440
+ }
65441
+
65442
+ if (tokensAFirstMatch.index > tokensBFirstMatch.index) {
65443
+ return 1;
65444
+ }
65408
65445
 
65409
- return matched.length > 0;
65446
+ return 0;
65447
+ }
65448
+
65449
+ /**
65450
+ * Compares two strings.
65451
+ *
65452
+ * @param {string} [a]
65453
+ * @param {string} [b]
65454
+ *
65455
+ * @returns {number}
65456
+ */
65457
+ function compareStrings(a = '', b = '') {
65458
+ return a.localeCompare(b);
65410
65459
  }
65411
65460
 
65412
65461
  /**
@@ -65415,7 +65464,7 @@
65415
65464
  *
65416
65465
  * @return {Token[]}
65417
65466
  */
65418
- function matchAndSplit(text, pattern) {
65467
+ function findMatches(text, pattern) {
65419
65468
  var tokens = [],
65420
65469
  originalText = text;
65421
65470
 
@@ -65426,27 +65475,31 @@
65426
65475
  text = text.toLowerCase();
65427
65476
  pattern = pattern.toLowerCase();
65428
65477
 
65429
- var i = text.indexOf(pattern);
65478
+ var index = text.indexOf(pattern);
65430
65479
 
65431
- if (i > -1) {
65432
- if (i !== 0) {
65480
+ if (index > -1) {
65481
+ if (index !== 0) {
65433
65482
  tokens.push({
65434
- normal: originalText.substr(0, i)
65483
+ normal: originalText.slice(0, index),
65484
+ index: 0
65435
65485
  });
65436
65486
  }
65437
65487
 
65438
65488
  tokens.push({
65439
- matched: originalText.substr(i, pattern.length)
65489
+ matched: originalText.slice(index, index + pattern.length),
65490
+ index: index
65440
65491
  });
65441
65492
 
65442
- if (pattern.length + i < text.length) {
65493
+ if (pattern.length + index < text.length) {
65443
65494
  tokens.push({
65444
- normal: originalText.substr(pattern.length + i, text.length)
65495
+ normal: originalText.slice(index + pattern.length),
65496
+ index: index + pattern.length
65445
65497
  });
65446
65498
  }
65447
65499
  } else {
65448
65500
  tokens.push({
65449
- normal: originalText
65501
+ normal: originalText,
65502
+ index: 0
65450
65503
  });
65451
65504
  }
65452
65505