@lvce-editor/file-search-worker 5.3.0 → 5.4.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.
@@ -809,6 +809,9 @@ const createRpc = ipc => {
809
809
  },
810
810
  invokeAndTransfer(method, ...params) {
811
811
  return invokeAndTransfer(ipc, method, ...params);
812
+ },
813
+ async dispose() {
814
+ await ipc?.dispose();
812
815
  }
813
816
  };
814
817
  return rpc;
@@ -944,7 +947,7 @@ const getQuickPickProviderId = prefix => {
944
947
  }
945
948
  };
946
949
 
947
- const getVisibleItems$i = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
950
+ const getVisibleItems$i = (picks, icons) => {
948
951
  return [];
949
952
  };
950
953
 
@@ -1052,9 +1055,9 @@ const state$b = {
1052
1055
  provider: QuickPickNoop,
1053
1056
  prefix: 'string-that-should-never-match-another-string'
1054
1057
  };
1055
- const getVisibleItems$g = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
1058
+ const getVisibleItems$g = (picks, icons) => {
1056
1059
  const items = picks.map(pick => pick.pick);
1057
- const visibleItems = state$b.provider.getVisibleItems(items, minLineY, maxLineY, focusedIndex, setSize, icons);
1060
+ const visibleItems = state$b.provider.getVisibleItems(items, icons);
1058
1061
  return visibleItems;
1059
1062
  };
1060
1063
 
@@ -1599,53 +1602,47 @@ const getKeyBindings = () => {
1599
1602
  }];
1600
1603
  };
1601
1604
 
1602
- const InsertText = 'insertText';
1603
- const DeleteContentBackward = 'deleteContentBackward';
1604
- const DeleteContentForward = 'deleteContentForward';
1605
- const DeleteWordForward = 'deleteWordForward';
1606
- const DeleteWordBackward = 'deleteWordBackward';
1607
- const InsertLineBreak = 'insertLineBreak';
1608
- const InsertCompositionText = 'insertCompositionText';
1609
- const InsertFromPaste = 'insertFromPaste';
1610
-
1611
- const RE_ALPHA_NUMERIC = /[a-z\d]/i;
1612
- const isAlphaNumeric = character => {
1613
- return RE_ALPHA_NUMERIC.test(character);
1614
- };
1615
-
1616
- const getNewValueInsertText = (value, selectionStart, selectionEnd, data) => {
1617
- if (selectionStart === value.length) {
1618
- const newValue = value + data;
1605
+ const getNewValueDeleteContentBackward = (value, selectionStart, selectionEnd, data) => {
1606
+ const after = value.slice(selectionEnd);
1607
+ if (selectionStart === selectionEnd) {
1608
+ const before = value.slice(0, selectionStart - 1);
1609
+ const newValue = before + after;
1619
1610
  return {
1620
1611
  newValue,
1621
- cursorOffset: newValue.length
1612
+ cursorOffset: before.length
1622
1613
  };
1623
1614
  }
1624
1615
  const before = value.slice(0, selectionStart);
1625
- const after = value.slice(selectionEnd);
1626
- const newValue = before + data + after;
1616
+ const newValue = before + after;
1627
1617
  return {
1628
1618
  newValue,
1629
- cursorOffset: selectionStart + data.length
1619
+ cursorOffset: selectionStart
1630
1620
  };
1631
1621
  };
1632
- const getNewValueDeleteContentBackward = (value, selectionStart, selectionEnd, data) => {
1633
- const after = value.slice(selectionEnd);
1622
+
1623
+ const getNewValueDeleteContentForward = (value, selectionStart, selectionEnd, data) => {
1624
+ const before = value.slice(0, selectionStart);
1634
1625
  if (selectionStart === selectionEnd) {
1635
- const before = value.slice(0, selectionStart - 1);
1626
+ const after = value.slice(selectionEnd + 1);
1636
1627
  const newValue = before + after;
1637
1628
  return {
1638
1629
  newValue,
1639
- cursorOffset: before.length
1630
+ cursorOffset: selectionStart
1640
1631
  };
1641
1632
  }
1642
- const before = value.slice(0, selectionStart);
1633
+ const after = value.slice(selectionEnd);
1643
1634
  const newValue = before + after;
1644
1635
  return {
1645
1636
  newValue,
1646
1637
  cursorOffset: selectionStart
1647
1638
  };
1648
1639
  };
1640
+
1641
+ const RE_ALPHA_NUMERIC = /[a-z\d]/i;
1642
+ const isAlphaNumeric = character => {
1643
+ return RE_ALPHA_NUMERIC.test(character);
1644
+ };
1645
+
1649
1646
  const getNewValueDeleteWordBackward = (value, selectionStart, selectionEnd, data) => {
1650
1647
  const after = value.slice(selectionEnd);
1651
1648
  if (selectionStart === selectionEnd) {
@@ -1667,14 +1664,19 @@ const getNewValueDeleteWordBackward = (value, selectionStart, selectionEnd, data
1667
1664
  cursorOffset: selectionStart
1668
1665
  };
1669
1666
  };
1670
- const getNewValueDeleteContentForward = (value, selectionStart, selectionEnd, data) => {
1667
+
1668
+ const getNewValueDeleteWordForward = (value, selectionStart, selectionEnd, data) => {
1671
1669
  const before = value.slice(0, selectionStart);
1672
1670
  if (selectionStart === selectionEnd) {
1673
- const after = value.slice(selectionEnd + 1);
1671
+ let startIndex = Math.min(selectionStart + 1, value.length - 1);
1672
+ while (startIndex < value.length && isAlphaNumeric(value[startIndex])) {
1673
+ startIndex++;
1674
+ }
1675
+ const after = value.slice(startIndex);
1674
1676
  const newValue = before + after;
1675
1677
  return {
1676
1678
  newValue,
1677
- cursorOffset: selectionStart
1679
+ cursorOffset: before.length
1678
1680
  };
1679
1681
  }
1680
1682
  const after = value.slice(selectionEnd);
@@ -1684,36 +1686,44 @@ const getNewValueDeleteContentForward = (value, selectionStart, selectionEnd, da
1684
1686
  cursorOffset: selectionStart
1685
1687
  };
1686
1688
  };
1687
- const getNewValueDeleteWordForward = (value, selectionStart, selectionEnd, data) => {
1688
- const before = value.slice(0, selectionStart);
1689
- if (selectionStart === selectionEnd) {
1690
- let startIndex = Math.min(selectionStart + 1, value.length - 1);
1691
- while (startIndex < value.length && isAlphaNumeric(value[startIndex])) {
1692
- startIndex++;
1693
- }
1694
- const after = value.slice(startIndex);
1695
- const newValue = before + after;
1689
+
1690
+ const getNewValueInsertText = (value, selectionStart, selectionEnd, data) => {
1691
+ if (selectionStart === value.length) {
1692
+ const newValue = value + data;
1696
1693
  return {
1697
1694
  newValue,
1698
- cursorOffset: before.length
1695
+ cursorOffset: newValue.length
1699
1696
  };
1700
1697
  }
1698
+ const before = value.slice(0, selectionStart);
1701
1699
  const after = value.slice(selectionEnd);
1702
- const newValue = before + after;
1700
+ const newValue = before + data + after;
1703
1701
  return {
1704
1702
  newValue,
1705
- cursorOffset: selectionStart
1703
+ cursorOffset: selectionStart + data.length
1706
1704
  };
1707
1705
  };
1706
+
1708
1707
  const getNewValueInsertCompositionText = (value, selectionStart, selectionEnd, data) => {
1709
1708
  return getNewValueInsertText(value, selectionStart, selectionEnd, data);
1710
1709
  };
1710
+
1711
1711
  const getNewValueInsertLineBreak = (value, selectionStart, selectionEnd, data) => {
1712
1712
  return {
1713
1713
  newValue: value,
1714
1714
  cursorOffset: selectionEnd
1715
1715
  };
1716
1716
  };
1717
+
1718
+ const InsertText = 'insertText';
1719
+ const DeleteContentBackward = 'deleteContentBackward';
1720
+ const DeleteContentForward = 'deleteContentForward';
1721
+ const DeleteWordForward = 'deleteWordForward';
1722
+ const DeleteWordBackward = 'deleteWordBackward';
1723
+ const InsertLineBreak = 'insertLineBreak';
1724
+ const InsertCompositionText = 'insertCompositionText';
1725
+ const InsertFromPaste = 'insertFromPaste';
1726
+
1717
1727
  const getNewValueFunction = inputType => {
1718
1728
  switch (inputType) {
1719
1729
  case InsertFromPaste:
@@ -2144,10 +2154,13 @@ const add = menuEntries => {
2144
2154
  state$9.menuEntries = [...state$9.menuEntries, ...menuEntries];
2145
2155
  };
2146
2156
 
2147
- const getVisible = (provider, items, minLineY, maxLineY, focusedIndex, icons) => {
2148
- const setSize = items.length;
2157
+ const getVisible$1 = (provider, items, minLineY, maxLineY, icons) => {
2149
2158
  const range = items.slice(minLineY, maxLineY);
2150
- const protoVisibleItems = provider.getVisibleItems(range, minLineY, maxLineY, focusedIndex, setSize, icons);
2159
+ const protoVisibleItems = provider.getVisibleItems(range, icons);
2160
+ return protoVisibleItems;
2161
+ };
2162
+
2163
+ const getVisible = (setSize, protoVisibleItems, minLineY, focusedIndex) => {
2151
2164
  const visibleItems = protoVisibleItems.map((visibleItem, i) => {
2152
2165
  return {
2153
2166
  ...visibleItem,
@@ -2160,7 +2173,8 @@ const getVisible = (provider, items, minLineY, maxLineY, focusedIndex, icons) =>
2160
2173
  };
2161
2174
 
2162
2175
  const createQuickPickViewModel = (oldState, newState) => {
2163
- const visibleItems = getVisible(newState.provider, newState.items, newState.minLineY, newState.maxLineY, newState.focusedIndex, newState.icons);
2176
+ const protoVisibleItems = getVisible$1(newState.provider, newState.items, newState.minLineY, newState.maxLineY, newState.icons);
2177
+ const visibleItems = getVisible(newState.items.length, protoVisibleItems, newState.minLineY, newState.focusedIndex);
2164
2178
  const oldFocusedIndex = oldState.focusedIndex - oldState.minLineY;
2165
2179
  const newFocusedIndex = newState.focusedIndex - newState.minLineY;
2166
2180
  const maxLineY = Math.min(newState.maxLineY, newState.items.length);
@@ -2574,7 +2588,7 @@ const getPickIcon$d = pick => {
2574
2588
  const getPickLabel$d = pick => {
2575
2589
  return pick;
2576
2590
  };
2577
- const getVisibleItems$f = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
2591
+ const getVisibleItems$f = (picks, icons) => {
2578
2592
  const visibleItems = picks.map((item, index) => {
2579
2593
  const pick = item.pick;
2580
2594
  return {
@@ -2687,7 +2701,7 @@ const getPickIcon$b = () => {
2687
2701
  const getPickLabel$b = pick => {
2688
2702
  return pick.label;
2689
2703
  };
2690
- const getVisibleItems$d = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
2704
+ const getVisibleItems$d = (picks, icons) => {
2691
2705
  const visibleItems = picks.map((item, index) => {
2692
2706
  const pick = item;
2693
2707
  return {
@@ -2861,8 +2875,8 @@ const convertIcon$1 = icon => {
2861
2875
  const getPickIcon$9 = pick => {
2862
2876
  return convertIcon$1(pick.icon);
2863
2877
  };
2864
- const getVisibleItems$b = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
2865
- const visibleItems = picks.slice(minLineY, maxLineY + 1).map((pick, index) => ({
2878
+ const getVisibleItems$b = (picks, icons) => {
2879
+ const visibleItems = picks.map((pick, index) => ({
2866
2880
  description: getPickDescription$9(pick),
2867
2881
  fileIcon: '',
2868
2882
  icon: getPickIcon$9(pick),
@@ -2970,7 +2984,7 @@ const getProtocol = uri => {
2970
2984
  return '';
2971
2985
  };
2972
2986
 
2973
- const getVisibleItems$9 = (files, minLineY, maxLineY, focusedIndex, setSize, icons) => {
2987
+ const getVisibleItems$9 = (files, icons) => {
2974
2988
  const visibleItems = files.map((item, i) => {
2975
2989
  const pick = item.pick;
2976
2990
  const label = getPickLabel$7(pick);
@@ -3148,7 +3162,7 @@ const getPickIcon$5 = () => {
3148
3162
  const getPickLabel$5 = pick => {
3149
3163
  return pathBaseName(pick);
3150
3164
  };
3151
- const getVisibleItems$7 = (picks, minLineY, maxLineY, focusedIndex, setSize, icons) => {
3165
+ const getVisibleItems$7 = (picks, icons) => {
3152
3166
  const visibleItems = picks.map((item, index) => {
3153
3167
  const pick = item.pick;
3154
3168
  const fileIcon = icons[index];
@@ -3157,7 +3171,7 @@ const getVisibleItems$7 = (picks, minLineY, maxLineY, focusedIndex, setSize, ico
3157
3171
  fileIcon,
3158
3172
  icon: getPickIcon$5(),
3159
3173
  label: getPickLabel$5(pick),
3160
- matches: pick.matches
3174
+ matches: pick.matches || []
3161
3175
  };
3162
3176
  });
3163
3177
  return visibleItems;
@@ -3252,7 +3266,7 @@ const QuickPickEntriesOpenRecent = {
3252
3266
  state: state$3
3253
3267
  };
3254
3268
 
3255
- const getVisibleItems$5 = (picks, minLineY, maxLineY, focusedIndex, setSize) => {
3269
+ const getVisibleItems$5 = picks => {
3256
3270
  return [];
3257
3271
  };
3258
3272
 
@@ -3321,7 +3335,7 @@ const getPickIcon$2 = value => {
3321
3335
  const getPickLabel$2 = value => {
3322
3336
  return value;
3323
3337
  };
3324
- const getVisibleItems$3 = (picks, minLineY, maxLineY, focusedIndex, setSize) => {
3338
+ const getVisibleItems$3 = picks => {
3325
3339
  const visibleItems = picks.map((pick, index) => ({
3326
3340
  description: getPickDescription$2(),
3327
3341
  fileIcon: '',
@@ -3395,7 +3409,7 @@ const QuickPickEntriesView = {
3395
3409
  state: state$1
3396
3410
  };
3397
3411
 
3398
- const getVisibleItems$1 = (picks, minLineY, maxLineY, focusedIndex, setSize) => {
3412
+ const getVisibleItems$1 = picks => {
3399
3413
  const visibleItems = picks.map((pick, index) => ({
3400
3414
  description: '',
3401
3415
  fileIcon: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "text-search"