@lvce-editor/extension-search-view 4.12.0 → 4.13.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.
@@ -1138,7 +1138,7 @@ const LeftClick = 0;
1138
1138
 
1139
1139
  const DebugWorker = 55;
1140
1140
  const ExtensionHostWorker = 44;
1141
- const RendererWorker$1 = 1;
1141
+ const RendererWorker$2 = 1;
1142
1142
 
1143
1143
  const None$2 = 0;
1144
1144
  const Input = 1;
@@ -1306,9 +1306,6 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
1306
1306
  return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
1307
1307
  };
1308
1308
 
1309
- const User = 1;
1310
- const Script = 2;
1311
-
1312
1309
  const getScrollBarY$1 = (delta, finalDelta, size, scrollBarSize) => {
1313
1310
  if (finalDelta === 0) {
1314
1311
  return 0;
@@ -1459,8 +1456,16 @@ const searchExtensions = async (extensions, value, platform, assetDir) => {
1459
1456
  };
1460
1457
 
1461
1458
  // TODO debounce
1462
- const handleInput = async (state, value, inputSource = User) => {
1459
+ const handleChange = async (state, update) => {
1460
+ const fullNewState = {
1461
+ ...state,
1462
+ ...update
1463
+ };
1463
1464
  try {
1465
+ const value = fullNewState.searchValue;
1466
+ const {
1467
+ inputSource
1468
+ } = fullNewState;
1464
1469
  const hasValue = value.length > 0;
1465
1470
  const inputActions = getInputActions(hasValue);
1466
1471
  const {
@@ -1524,18 +1529,19 @@ const handleInput = async (state, value, inputSource = User) => {
1524
1529
  // TODO send error to error worker
1525
1530
  await handleError(error);
1526
1531
  return {
1527
- ...state,
1528
- searchValue: value,
1532
+ ...fullNewState,
1529
1533
  message: `${error}`
1530
1534
  };
1531
1535
  }
1532
1536
  };
1533
1537
 
1534
1538
  const clearSearchResults = state => {
1535
- return handleInput({
1539
+ return handleChange(state, {
1536
1540
  ...state,
1537
- focus: Input
1538
- }, '', Script$1);
1541
+ focus: Input,
1542
+ searchValue: '',
1543
+ inputSource: Script$1
1544
+ });
1539
1545
  };
1540
1546
 
1541
1547
  const closeSuggest = state => {
@@ -1617,7 +1623,7 @@ const {
1617
1623
  invokeAndTransfer,
1618
1624
  set: set$3,
1619
1625
  dispose: dispose$2
1620
- } = create$1(RendererWorker$1);
1626
+ } = create$1(RendererWorker$2);
1621
1627
  const searchFileHtml = async uri => {
1622
1628
  return invoke$2('ExtensionHost.searchFileWithHtml', uri);
1623
1629
  };
@@ -1627,6 +1633,10 @@ const getFilePathElectron = async file => {
1627
1633
  const showContextMenu$1 = async (x, y, id, ...args) => {
1628
1634
  return invoke$2('ContextMenu.show', x, y, id, ...args);
1629
1635
  };
1636
+ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1637
+ // @ts-ignore
1638
+ await RendererWorker.invoke('ContextMenu.show2', uid, menuId, x, y, args);
1639
+ };
1630
1640
  const getElectronVersion = async () => {
1631
1641
  return invoke$2('Process.getElectronVersion');
1632
1642
  };
@@ -1856,7 +1866,7 @@ const openExtensionSearch = async () => {
1856
1866
  };
1857
1867
  const setExtensionsSearchValue = async searchValue => {
1858
1868
  // @ts-ignore
1859
- return invoke$2('Extensions.handleInput', searchValue);
1869
+ return invoke$2('Extensions.handleInput', searchValue, Script$1);
1860
1870
  };
1861
1871
  const openExternal = async uri => {
1862
1872
  // @ts-ignore
@@ -1886,7 +1896,7 @@ const registerMockRpc = commandMap => {
1886
1896
  return mockRpc;
1887
1897
  };
1888
1898
 
1889
- const RendererWorker = {
1899
+ const RendererWorker$1 = {
1890
1900
  __proto__: null,
1891
1901
  activateByEvent,
1892
1902
  applyBulkReplacement,
@@ -1958,6 +1968,7 @@ const RendererWorker = {
1958
1968
  setWebViewPort,
1959
1969
  setWorkspacePath,
1960
1970
  showContextMenu: showContextMenu$1,
1971
+ showContextMenu2,
1961
1972
  showErrorDialog,
1962
1973
  showMessageBox,
1963
1974
  showSaveFilePicker,
@@ -2092,13 +2103,16 @@ const isEqual$2 = (oldState, newState) => {
2092
2103
  if (!newState.focus) {
2093
2104
  return true;
2094
2105
  }
2095
- return oldState.focus === newState.focus;
2106
+ return oldState.focus === newState.focus && oldState.inputSource === newState.inputSource;
2096
2107
  };
2097
2108
 
2098
2109
  const isEqual$1 = (oldState, newState) => {
2099
2110
  return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY && oldState.focusedIndex === newState.focusedIndex && oldState.message === newState.message && oldState.inputActions === newState.inputActions && oldState.placeholder === newState.placeholder && oldState.scrollBarHeight === newState.scrollBarHeight;
2100
2111
  };
2101
2112
 
2113
+ const User = 1;
2114
+ const Script = 2;
2115
+
2102
2116
  const isEqual = (oldState, newState) => {
2103
2117
  return newState.inputSource === User || oldState.searchValue === newState.searchValue;
2104
2118
  };
@@ -2148,6 +2162,7 @@ const focusIndexScrollDown = (state, index, listHeight, itemHeight, itemsLength)
2148
2162
  return {
2149
2163
  ...state,
2150
2164
  focusedIndex: index,
2165
+ listFocusedIndex: index,
2151
2166
  minLineY: newMinLineY,
2152
2167
  maxLineY: newMaxLineY,
2153
2168
  focused: true,
@@ -2170,6 +2185,7 @@ const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) =
2170
2185
  return {
2171
2186
  ...state,
2172
2187
  focusedIndex: index,
2188
+ listFocusedIndex: index,
2173
2189
  minLineY: newMinLineY,
2174
2190
  maxLineY: newMaxLineY,
2175
2191
  focused: true,
@@ -2195,6 +2211,7 @@ const focusIndex = (state, index) => {
2195
2211
  return {
2196
2212
  ...state,
2197
2213
  focusedIndex: -1,
2214
+ listFocusedIndex: -1,
2198
2215
  focused: true
2199
2216
  };
2200
2217
  }
@@ -2208,6 +2225,7 @@ const focusIndex = (state, index) => {
2208
2225
  return {
2209
2226
  ...state,
2210
2227
  focusedIndex: index,
2228
+ listFocusedIndex: index,
2211
2229
  focused: true
2212
2230
  };
2213
2231
  };
@@ -2408,7 +2426,7 @@ const {
2408
2426
  showContextMenu,
2409
2427
  openUri: openUri$1,
2410
2428
  sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1
2411
- } = RendererWorker;
2429
+ } = RendererWorker$1;
2412
2430
 
2413
2431
  const openUri = async uri => {
2414
2432
  return openUri$1(uri);
@@ -2514,6 +2532,13 @@ const handleHeaderContextMenu = async state => {
2514
2532
  return state;
2515
2533
  };
2516
2534
 
2535
+ const handleInput = async (state, value, inputSource = User) => {
2536
+ return handleChange(state, {
2537
+ searchValue: value,
2538
+ inputSource
2539
+ });
2540
+ };
2541
+
2517
2542
  // TODO show error / warning when installment fails / times out
2518
2543
  const handleInstall = async (state, id) => {
2519
2544
  return state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",