@lvce-editor/text-search-worker 5.22.0 → 5.23.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.
@@ -596,7 +596,7 @@ const create$4$1 = (method, params) => {
596
596
  };
597
597
  };
598
598
  const callbacks = Object.create(null);
599
- const set$5 = (id, fn) => {
599
+ const set$4 = (id, fn) => {
600
600
  callbacks[id] = fn;
601
601
  };
602
602
  const get$3 = id => {
@@ -615,7 +615,7 @@ const registerPromise = () => {
615
615
  resolve,
616
616
  promise
617
617
  } = Promise.withResolvers();
618
- set$5(id, resolve);
618
+ set$4(id, resolve);
619
619
  return {
620
620
  id,
621
621
  promise
@@ -960,7 +960,7 @@ const send$1 = (transport, method, ...params) => {
960
960
  const message = create$4$1(method, params);
961
961
  transport.send(message);
962
962
  };
963
- const invoke$4 = (ipc, method, ...params) => {
963
+ const invoke$3 = (ipc, method, ...params) => {
964
964
  return invokeHelper(ipc, method, params, false);
965
965
  };
966
966
  const invokeAndTransfer$1 = (ipc, method, ...params) => {
@@ -999,7 +999,7 @@ const createRpc = ipc => {
999
999
  send$1(ipc, method, ...params);
1000
1000
  },
1001
1001
  invoke(method, ...params) {
1002
- return invoke$4(ipc, method, ...params);
1002
+ return invoke$3(ipc, method, ...params);
1003
1003
  },
1004
1004
  invokeAndTransfer(method, ...params) {
1005
1005
  return invokeAndTransfer$1(ipc, method, ...params);
@@ -1136,109 +1136,6 @@ const WebWorkerRpcClient = {
1136
1136
  __proto__: null,
1137
1137
  create: create$4
1138
1138
  };
1139
- const createMockRpc = ({
1140
- commandMap
1141
- }) => {
1142
- const invocations = [];
1143
- const invoke = (method, ...params) => {
1144
- invocations.push([method, ...params]);
1145
- const command = commandMap[method];
1146
- if (!command) {
1147
- throw new Error(`command ${method} not found`);
1148
- }
1149
- return command(...params);
1150
- };
1151
- const mockRpc = {
1152
- invoke,
1153
- invokeAndTransfer: invoke,
1154
- invocations
1155
- };
1156
- return mockRpc;
1157
- };
1158
-
1159
- const toCommandId = key => {
1160
- const dotIndex = key.indexOf('.');
1161
- return key.slice(dotIndex + 1);
1162
- };
1163
- const create$3 = () => {
1164
- const states = Object.create(null);
1165
- const commandMapRef = {};
1166
- return {
1167
- get(uid) {
1168
- return states[uid];
1169
- },
1170
- set(uid, oldState, newState) {
1171
- states[uid] = {
1172
- oldState,
1173
- newState
1174
- };
1175
- },
1176
- dispose(uid) {
1177
- delete states[uid];
1178
- },
1179
- getKeys() {
1180
- return Object.keys(states).map(key => {
1181
- return Number.parseInt(key);
1182
- });
1183
- },
1184
- clear() {
1185
- for (const key of Object.keys(states)) {
1186
- delete states[key];
1187
- }
1188
- },
1189
- wrapCommand(fn) {
1190
- const wrapped = async (uid, ...args) => {
1191
- const {
1192
- newState
1193
- } = states[uid];
1194
- const newerState = await fn(newState, ...args);
1195
- if (newState === newerState) {
1196
- return;
1197
- }
1198
- const latest = states[uid];
1199
- states[uid] = {
1200
- oldState: latest.oldState,
1201
- newState: newerState
1202
- };
1203
- };
1204
- return wrapped;
1205
- },
1206
- wrapGetter(fn) {
1207
- const wrapped = (uid, ...args) => {
1208
- const {
1209
- newState
1210
- } = states[uid];
1211
- return fn(newState, ...args);
1212
- };
1213
- return wrapped;
1214
- },
1215
- diff(uid, modules, numbers) {
1216
- const {
1217
- oldState,
1218
- newState
1219
- } = states[uid];
1220
- const diffResult = [];
1221
- for (let i = 0; i < modules.length; i++) {
1222
- const fn = modules[i];
1223
- if (!fn(oldState, newState)) {
1224
- diffResult.push(numbers[i]);
1225
- }
1226
- }
1227
- return diffResult;
1228
- },
1229
- getCommandIds() {
1230
- const keys = Object.keys(commandMapRef);
1231
- const ids = keys.map(toCommandId);
1232
- return ids;
1233
- },
1234
- registerCommands(commandMap) {
1235
- Object.assign(commandMapRef, commandMap);
1236
- }
1237
- };
1238
- };
1239
- const terminate = () => {
1240
- globalThis.close();
1241
- };
1242
1139
 
1243
1140
  const Alert = 'alert';
1244
1141
  const Button$3 = 'button';
@@ -1328,8 +1225,6 @@ const DeltaY = 'event.deltaY';
1328
1225
  const TargetName = 'event.target.name';
1329
1226
  const TargetValue = 'event.target.value';
1330
1227
 
1331
- const Script$1 = 2;
1332
-
1333
1228
  const Search$1 = 18;
1334
1229
 
1335
1230
  const None$1 = 0;
@@ -1339,8 +1234,7 @@ const LeftClick = 0;
1339
1234
  const Electron = 2;
1340
1235
  const Remote = 3;
1341
1236
 
1342
- const DebugWorker = 55;
1343
- const RendererWorker$1 = 1;
1237
+ const RendererWorker = 1;
1344
1238
  const SearchProcess = 77;
1345
1239
  const IconThemeWorker = 7009;
1346
1240
 
@@ -1368,6 +1262,178 @@ const FocusSearchWholeWord = 34;
1368
1262
  const FocusToggleDetails = 1010;
1369
1263
  const FocusToggleReplace = 1020;
1370
1264
 
1265
+ const rpcs = Object.create(null);
1266
+ const set$3 = (id, rpc) => {
1267
+ rpcs[id] = rpc;
1268
+ };
1269
+ const get$2 = id => {
1270
+ return rpcs[id];
1271
+ };
1272
+
1273
+ const create$3 = rpcId => {
1274
+ return {
1275
+ // @ts-ignore
1276
+ invoke(method, ...params) {
1277
+ const rpc = get$2(rpcId);
1278
+ // @ts-ignore
1279
+ return rpc.invoke(method, ...params);
1280
+ },
1281
+ // @ts-ignore
1282
+ invokeAndTransfer(method, ...params) {
1283
+ const rpc = get$2(rpcId);
1284
+ // @ts-ignore
1285
+ return rpc.invokeAndTransfer(method, ...params);
1286
+ },
1287
+ set(rpc) {
1288
+ set$3(rpcId, rpc);
1289
+ },
1290
+ async dispose() {
1291
+ const rpc = get$2(rpcId);
1292
+ await rpc.dispose();
1293
+ }
1294
+ };
1295
+ };
1296
+
1297
+ const {
1298
+ invoke: invoke$2,
1299
+ set: set$2} = create$3(IconThemeWorker);
1300
+ const getIcons = async iconRequests => {
1301
+ // @ts-ignore
1302
+ return invoke$2('IconTheme.getIcons', iconRequests);
1303
+ };
1304
+
1305
+ const {
1306
+ invoke: invoke$1,
1307
+ invokeAndTransfer,
1308
+ set: set$1} = create$3(RendererWorker);
1309
+ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1310
+ // @ts-ignore
1311
+ await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1312
+ };
1313
+ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1314
+ const command = 'IconTheme.handleMessagePort';
1315
+ // @ts-ignore
1316
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1317
+ };
1318
+ const sendMessagePortToSearchProcess = async port => {
1319
+ await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1320
+ };
1321
+ const writeClipBoardText = async text => {
1322
+ await invoke$1('ClipBoard.writeText', /* text */text);
1323
+ };
1324
+ const openUri$1 = async (uri, focus, options) => {
1325
+ await invoke$1('Main.openUri', uri, focus, options);
1326
+ };
1327
+
1328
+ const createLazyRpc = rpcId => {
1329
+ let rpcPromise;
1330
+ let factory;
1331
+ const createRpc = async () => {
1332
+ const rpc = await factory();
1333
+ set$3(rpcId, rpc);
1334
+ };
1335
+ const ensureRpc = async () => {
1336
+ if (!rpcPromise) {
1337
+ rpcPromise = createRpc();
1338
+ }
1339
+ await rpcPromise;
1340
+ };
1341
+ return {
1342
+ setFactory(value) {
1343
+ factory = value;
1344
+ },
1345
+ async invoke(method, ...params) {
1346
+ await ensureRpc();
1347
+ const rpc = get$2(rpcId);
1348
+ return rpc.invoke(method, ...params);
1349
+ }
1350
+ };
1351
+ };
1352
+
1353
+ const toCommandId = key => {
1354
+ const dotIndex = key.indexOf('.');
1355
+ return key.slice(dotIndex + 1);
1356
+ };
1357
+ const create$2 = () => {
1358
+ const states = Object.create(null);
1359
+ const commandMapRef = {};
1360
+ return {
1361
+ get(uid) {
1362
+ return states[uid];
1363
+ },
1364
+ set(uid, oldState, newState) {
1365
+ states[uid] = {
1366
+ oldState,
1367
+ newState
1368
+ };
1369
+ },
1370
+ dispose(uid) {
1371
+ delete states[uid];
1372
+ },
1373
+ getKeys() {
1374
+ return Object.keys(states).map(key => {
1375
+ return Number.parseInt(key);
1376
+ });
1377
+ },
1378
+ clear() {
1379
+ for (const key of Object.keys(states)) {
1380
+ delete states[key];
1381
+ }
1382
+ },
1383
+ wrapCommand(fn) {
1384
+ const wrapped = async (uid, ...args) => {
1385
+ const {
1386
+ newState
1387
+ } = states[uid];
1388
+ const newerState = await fn(newState, ...args);
1389
+ if (newState === newerState) {
1390
+ return;
1391
+ }
1392
+ const latest = states[uid];
1393
+ states[uid] = {
1394
+ oldState: latest.oldState,
1395
+ newState: newerState
1396
+ };
1397
+ };
1398
+ return wrapped;
1399
+ },
1400
+ wrapGetter(fn) {
1401
+ const wrapped = (uid, ...args) => {
1402
+ const {
1403
+ newState
1404
+ } = states[uid];
1405
+ return fn(newState, ...args);
1406
+ };
1407
+ return wrapped;
1408
+ },
1409
+ diff(uid, modules, numbers) {
1410
+ const {
1411
+ oldState,
1412
+ newState
1413
+ } = states[uid];
1414
+ const diffResult = [];
1415
+ for (let i = 0; i < modules.length; i++) {
1416
+ const fn = modules[i];
1417
+ if (!fn(oldState, newState)) {
1418
+ diffResult.push(numbers[i]);
1419
+ }
1420
+ }
1421
+ return diffResult;
1422
+ },
1423
+ getCommandIds() {
1424
+ const keys = Object.keys(commandMapRef);
1425
+ const ids = keys.map(toCommandId);
1426
+ return ids;
1427
+ },
1428
+ registerCommands(commandMap) {
1429
+ Object.assign(commandMapRef, commandMap);
1430
+ }
1431
+ };
1432
+ };
1433
+ const terminate = () => {
1434
+ globalThis.close();
1435
+ };
1436
+
1371
1437
  const mergeClassNames = (...classNames) => {
1372
1438
  return classNames.filter(Boolean).join(' ');
1373
1439
  };
@@ -1665,439 +1731,6 @@ const collapseDetails = state => {
1665
1731
  };
1666
1732
  };
1667
1733
 
1668
- const rpcs = Object.create(null);
1669
- const set$4 = (id, rpc) => {
1670
- rpcs[id] = rpc;
1671
- };
1672
- const get$2 = id => {
1673
- return rpcs[id];
1674
- };
1675
-
1676
- const create$2 = rpcId => {
1677
- return {
1678
- // @ts-ignore
1679
- invoke(method, ...params) {
1680
- const rpc = get$2(rpcId);
1681
- // @ts-ignore
1682
- return rpc.invoke(method, ...params);
1683
- },
1684
- // @ts-ignore
1685
- invokeAndTransfer(method, ...params) {
1686
- const rpc = get$2(rpcId);
1687
- // @ts-ignore
1688
- return rpc.invokeAndTransfer(method, ...params);
1689
- },
1690
- set(rpc) {
1691
- set$4(rpcId, rpc);
1692
- },
1693
- async dispose() {
1694
- const rpc = get$2(rpcId);
1695
- await rpc.dispose();
1696
- }
1697
- };
1698
- };
1699
-
1700
- const {
1701
- invoke: invoke$3,
1702
- set: set$3} = create$2(IconThemeWorker);
1703
- const getIcons$1 = async iconRequests => {
1704
- // @ts-ignore
1705
- return invoke$3('IconTheme.getIcons', iconRequests);
1706
- };
1707
-
1708
- const {
1709
- invoke: invoke$2,
1710
- invokeAndTransfer,
1711
- set: set$2,
1712
- dispose
1713
- } = create$2(RendererWorker$1);
1714
- const searchFileHtml = async uri => {
1715
- return invoke$2('ExtensionHost.searchFileWithHtml', uri);
1716
- };
1717
- const getFilePathElectron = async file => {
1718
- return invoke$2('FileSystemHandle.getFilePathElectron', file);
1719
- };
1720
- const showContextMenu = async (x, y, id, ...args) => {
1721
- return invoke$2('ContextMenu.show', x, y, id, ...args);
1722
- };
1723
- const showContextMenu2$1 = async (uid, menuId, x, y, args) => {
1724
- // @ts-ignore
1725
- await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
1726
- };
1727
- const getElectronVersion = async () => {
1728
- return invoke$2('Process.getElectronVersion');
1729
- };
1730
- const applyBulkReplacement$1 = async bulkEdits => {
1731
- await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
1732
- };
1733
- const setColorTheme = async id => {
1734
- // @ts-ignore
1735
- return invoke$2(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1736
- };
1737
- const getNodeVersion = async () => {
1738
- return invoke$2('Process.getNodeVersion');
1739
- };
1740
- const getChromeVersion = async () => {
1741
- return invoke$2('Process.getChromeVersion');
1742
- };
1743
- const getV8Version = async () => {
1744
- return invoke$2('Process.getV8Version');
1745
- };
1746
- const getFileHandles = async fileIds => {
1747
- const files = await invoke$2('FileSystemHandle.getFileHandles', fileIds);
1748
- return files;
1749
- };
1750
- const setWorkspacePath = async path => {
1751
- await invoke$2('Workspace.setPath', path);
1752
- };
1753
- const registerWebViewInterceptor = async (id, port) => {
1754
- await invokeAndTransfer('WebView.registerInterceptor', id, port);
1755
- };
1756
- const unregisterWebViewInterceptor = async id => {
1757
- await invoke$2('WebView.unregisterInterceptor', id);
1758
- };
1759
- const sendMessagePortToEditorWorker = async (port, rpcId) => {
1760
- const command = 'HandleMessagePort.handleMessagePort';
1761
- // @ts-ignore
1762
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1763
- };
1764
- const sendMessagePortToErrorWorker = async (port, rpcId) => {
1765
- const command = 'Errors.handleMessagePort';
1766
- // @ts-ignore
1767
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1768
- };
1769
- const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1770
- const command = 'Markdown.handleMessagePort';
1771
- // @ts-ignore
1772
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1773
- };
1774
- const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1775
- const command = 'IconTheme.handleMessagePort';
1776
- // @ts-ignore
1777
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1778
- };
1779
- const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1780
- const command = 'FileSystem.handleMessagePort';
1781
- // @ts-ignore
1782
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1783
- };
1784
- const readFile = async uri => {
1785
- return invoke$2('FileSystem.readFile', uri);
1786
- };
1787
- const getWebViewSecret = async key => {
1788
- // @ts-ignore
1789
- return invoke$2('WebView.getSecret', key);
1790
- };
1791
- const setWebViewPort = async (uid, port, origin, portType) => {
1792
- return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1793
- };
1794
- const setFocus = key => {
1795
- return invoke$2('Focus.setFocus', key);
1796
- };
1797
- const getFileIcon = async options => {
1798
- return invoke$2('IconTheme.getFileIcon', options);
1799
- };
1800
- const getColorThemeNames = async () => {
1801
- return invoke$2('ColorTheme.getColorThemeNames');
1802
- };
1803
- const disableExtension = async id => {
1804
- // @ts-ignore
1805
- return invoke$2('ExtensionManagement.disable', id);
1806
- };
1807
- const enableExtension = async id => {
1808
- // @ts-ignore
1809
- return invoke$2('ExtensionManagement.enable', id);
1810
- };
1811
- const handleDebugChange = async params => {
1812
- // @ts-ignore
1813
- return invoke$2('Run And Debug.handleChange', params);
1814
- };
1815
- const getFolderIcon = async options => {
1816
- return invoke$2('IconTheme.getFolderIcon', options);
1817
- };
1818
- const closeWidget = async widgetId => {
1819
- return invoke$2('Viewlet.closeWidget', widgetId);
1820
- };
1821
- const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1822
- const command = 'HandleMessagePort.handleMessagePort2';
1823
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1824
- };
1825
- const sendMessagePortToSearchProcess$1 = async port => {
1826
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1827
- };
1828
- const confirm = async (message, options) => {
1829
- // @ts-ignore
1830
- const result = await invoke$2('ConfirmPrompt.prompt', message, options);
1831
- return result;
1832
- };
1833
- const getRecentlyOpened = async () => {
1834
- return invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1835
- };
1836
- const getKeyBindings$1 = async () => {
1837
- return invoke$2('KeyBindingsInitial.getKeyBindings');
1838
- };
1839
- const writeClipBoardText$1 = async text => {
1840
- await invoke$2('ClipBoard.writeText', /* text */text);
1841
- };
1842
- const writeClipBoardImage = async blob => {
1843
- // @ts-ignore
1844
- await invoke$2('ClipBoard.writeImage', /* text */blob);
1845
- };
1846
- const searchFileMemory = async uri => {
1847
- // @ts-ignore
1848
- return invoke$2('ExtensionHost.searchFileWithMemory', uri);
1849
- };
1850
- const searchFileFetch = async uri => {
1851
- return invoke$2('ExtensionHost.searchFileWithFetch', uri);
1852
- };
1853
- const showMessageBox = async options => {
1854
- return invoke$2('ElectronDialog.showMessageBox', options);
1855
- };
1856
- const handleDebugResumed = async params => {
1857
- await invoke$2('Run And Debug.handleResumed', params);
1858
- };
1859
- const openWidget = async name => {
1860
- await invoke$2('Viewlet.openWidget', name);
1861
- };
1862
- const getIcons = async requests => {
1863
- const icons = await invoke$2('IconTheme.getIcons', requests);
1864
- return icons;
1865
- };
1866
- const activateByEvent = event => {
1867
- return invoke$2('ExtensionHostManagement.activateByEvent', event);
1868
- };
1869
- const setAdditionalFocus = focusKey => {
1870
- // @ts-ignore
1871
- return invoke$2('Focus.setAdditionalFocus', focusKey);
1872
- };
1873
- const getActiveEditorId = () => {
1874
- // @ts-ignore
1875
- return invoke$2('GetActiveEditor.getActiveEditorId');
1876
- };
1877
- const getWorkspacePath = () => {
1878
- return invoke$2('Workspace.getPath');
1879
- };
1880
- const sendMessagePortToRendererProcess = async port => {
1881
- const command = 'HandleMessagePort.handleMessagePort';
1882
- // @ts-ignore
1883
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1884
- };
1885
- const getPreference = async key => {
1886
- return await invoke$2('Preferences.get', key);
1887
- };
1888
- const getAllExtensions = async () => {
1889
- return invoke$2('ExtensionManagement.getAllExtensions');
1890
- };
1891
- const rerenderEditor = async key => {
1892
- // @ts-ignore
1893
- return invoke$2('Editor.rerender', key);
1894
- };
1895
- const handleDebugPaused = async params => {
1896
- await invoke$2('Run And Debug.handlePaused', params);
1897
- };
1898
- const openUri$2 = async (uri, focus, options) => {
1899
- await invoke$2('Main.openUri', uri, focus, options);
1900
- };
1901
- const sendMessagePortToSyntaxHighlightingWorker = async port => {
1902
- await invokeAndTransfer(
1903
- // @ts-ignore
1904
- 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1905
- };
1906
- const handleDebugScriptParsed = async script => {
1907
- await invoke$2('Run And Debug.handleScriptParsed', script);
1908
- };
1909
- const getWindowId = async () => {
1910
- return invoke$2('GetWindowId.getWindowId');
1911
- };
1912
- const getBlob = async uri => {
1913
- // @ts-ignore
1914
- return invoke$2('FileSystem.getBlob', uri);
1915
- };
1916
- const getExtensionCommands = async () => {
1917
- return invoke$2('ExtensionHost.getCommands');
1918
- };
1919
- const showErrorDialog = async errorInfo => {
1920
- // @ts-ignore
1921
- await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
1922
- };
1923
- const getFolderSize = async uri => {
1924
- // @ts-ignore
1925
- return await invoke$2('FileSystem.getFolderSize', uri);
1926
- };
1927
- const getExtension = async id => {
1928
- // @ts-ignore
1929
- return invoke$2('ExtensionManagement.getExtension', id);
1930
- };
1931
- const getMarkdownDom = async html => {
1932
- // @ts-ignore
1933
- return invoke$2('Markdown.getVirtualDom', html);
1934
- };
1935
- const renderMarkdown = async (markdown, options) => {
1936
- // @ts-ignore
1937
- return invoke$2('Markdown.renderMarkdown', markdown, options);
1938
- };
1939
- const openNativeFolder = async uri => {
1940
- // @ts-ignore
1941
- await invoke$2('OpenNativeFolder.openNativeFolder', uri);
1942
- };
1943
- const uninstallExtension = async id => {
1944
- return invoke$2('ExtensionManagement.uninstall', id);
1945
- };
1946
- const installExtension = async id => {
1947
- // @ts-ignore
1948
- return invoke$2('ExtensionManagement.install', id);
1949
- };
1950
- const openExtensionSearch = async () => {
1951
- // @ts-ignore
1952
- return invoke$2('SideBar.openViewlet', 'Extensions');
1953
- };
1954
- const setExtensionsSearchValue = async searchValue => {
1955
- // @ts-ignore
1956
- return invoke$2('Extensions.handleInput', searchValue, Script$1);
1957
- };
1958
- const openExternal = async uri => {
1959
- // @ts-ignore
1960
- await invoke$2('Open.openExternal', uri);
1961
- };
1962
- const openUrl = async uri => {
1963
- // @ts-ignore
1964
- await invoke$2('Open.openUrl', uri);
1965
- };
1966
- const getAllPreferences = async () => {
1967
- // @ts-ignore
1968
- return invoke$2('Preferences.getAll');
1969
- };
1970
- const showSaveFilePicker = async () => {
1971
- // @ts-ignore
1972
- return invoke$2('FilePicker.showSaveFilePicker');
1973
- };
1974
- const getLogsDir = async () => {
1975
- // @ts-ignore
1976
- return invoke$2('PlatformPaths.getLogsDir');
1977
- };
1978
- const registerMockRpc = commandMap => {
1979
- const mockRpc = createMockRpc({
1980
- commandMap
1981
- });
1982
- set$2(mockRpc);
1983
- return mockRpc;
1984
- };
1985
-
1986
- const RendererWorker = {
1987
- __proto__: null,
1988
- activateByEvent,
1989
- applyBulkReplacement: applyBulkReplacement$1,
1990
- closeWidget,
1991
- confirm,
1992
- disableExtension,
1993
- dispose,
1994
- enableExtension,
1995
- getActiveEditorId,
1996
- getAllExtensions,
1997
- getAllPreferences,
1998
- getBlob,
1999
- getChromeVersion,
2000
- getColorThemeNames,
2001
- getElectronVersion,
2002
- getExtension,
2003
- getExtensionCommands,
2004
- getFileHandles,
2005
- getFileIcon,
2006
- getFilePathElectron,
2007
- getFolderIcon,
2008
- getFolderSize,
2009
- getIcons,
2010
- getKeyBindings: getKeyBindings$1,
2011
- getLogsDir,
2012
- getMarkdownDom,
2013
- getNodeVersion,
2014
- getPreference,
2015
- getRecentlyOpened,
2016
- getV8Version,
2017
- getWebViewSecret,
2018
- getWindowId,
2019
- getWorkspacePath,
2020
- handleDebugChange,
2021
- handleDebugPaused,
2022
- handleDebugResumed,
2023
- handleDebugScriptParsed,
2024
- installExtension,
2025
- invoke: invoke$2,
2026
- invokeAndTransfer,
2027
- openExtensionSearch,
2028
- openExternal,
2029
- openNativeFolder,
2030
- openUri: openUri$2,
2031
- openUrl,
2032
- openWidget,
2033
- readFile,
2034
- registerMockRpc,
2035
- registerWebViewInterceptor,
2036
- renderMarkdown,
2037
- rerenderEditor,
2038
- searchFileFetch,
2039
- searchFileHtml,
2040
- searchFileMemory,
2041
- sendMessagePortToEditorWorker,
2042
- sendMessagePortToErrorWorker,
2043
- sendMessagePortToExtensionHostWorker,
2044
- sendMessagePortToFileSystemWorker,
2045
- sendMessagePortToIconThemeWorker,
2046
- sendMessagePortToMarkdownWorker,
2047
- sendMessagePortToRendererProcess,
2048
- sendMessagePortToSearchProcess: sendMessagePortToSearchProcess$1,
2049
- sendMessagePortToSyntaxHighlightingWorker,
2050
- set: set$2,
2051
- setAdditionalFocus,
2052
- setColorTheme,
2053
- setExtensionsSearchValue,
2054
- setFocus,
2055
- setWebViewPort,
2056
- setWorkspacePath,
2057
- showContextMenu,
2058
- showContextMenu2: showContextMenu2$1,
2059
- showErrorDialog,
2060
- showMessageBox,
2061
- showSaveFilePicker,
2062
- uninstallExtension,
2063
- unregisterWebViewInterceptor,
2064
- writeClipBoardImage,
2065
- writeClipBoardText: writeClipBoardText$1
2066
- };
2067
-
2068
- const createLazyRpc = rpcId => {
2069
- let rpcPromise;
2070
- let factory;
2071
- const createRpc = async () => {
2072
- const rpc = await factory();
2073
- set$4(rpcId, rpc);
2074
- };
2075
- const ensureRpc = async () => {
2076
- if (!rpcPromise) {
2077
- rpcPromise = createRpc();
2078
- }
2079
- await rpcPromise;
2080
- };
2081
- return {
2082
- setFactory(value) {
2083
- factory = value;
2084
- },
2085
- async invoke(method, ...params) {
2086
- await ensureRpc();
2087
- const rpc = get$2(rpcId);
2088
- return rpc.invoke(method, ...params);
2089
- }
2090
- };
2091
- };
2092
-
2093
- const {
2094
- invoke: invoke$1,
2095
- openUri: openUri$1,
2096
- sendMessagePortToSearchProcess,
2097
- set: set$1,
2098
- showContextMenu2,
2099
- writeClipBoardText} = RendererWorker;
2100
-
2101
1734
  const copy = async state => {
2102
1735
  const {
2103
1736
  items,
@@ -2133,7 +1766,7 @@ const {
2133
1766
  registerCommands,
2134
1767
  getCommandIds,
2135
1768
  wrapGetter
2136
- } = create$3();
1769
+ } = create$2();
2137
1770
 
2138
1771
  const List = 1;
2139
1772
 
@@ -2291,6 +1924,78 @@ const remove$1 = (array, index, deleteCount) => {
2291
1924
  return array.toSpliced(index, deleteCount);
2292
1925
  };
2293
1926
 
1927
+ const getSetSize = (items, index) => {
1928
+ let setSize = 0;
1929
+ for (let i = index + 1; i < items.length; i++) {
1930
+ if (items[i].type === File) {
1931
+ break;
1932
+ }
1933
+ setSize++;
1934
+ }
1935
+ return setSize;
1936
+ };
1937
+ const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
1938
+ const setSize = getSetSize(items, index);
1939
+ return {
1940
+ startIndex: index,
1941
+ removeCount: setSize + 1,
1942
+ newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
1943
+ newFileCount: fileCount - 1,
1944
+ newMatchCount: matchCount - setSize
1945
+ };
1946
+ };
1947
+ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
1948
+ for (let i = index; i >= 0; i--) {
1949
+ if (items[i].type === File) {
1950
+ const setSize = getSetSize(items, i);
1951
+ if (setSize === 1) {
1952
+ return {
1953
+ startIndex: i,
1954
+ removeCount: 2,
1955
+ newFocusedIndex: i - 1,
1956
+ newFileCount: fileCount - 1,
1957
+ newMatchCount: matchCount - 1
1958
+ };
1959
+ }
1960
+ return {
1961
+ startIndex: index,
1962
+ removeCount: 1,
1963
+ newFocusedIndex: index,
1964
+ newFileCount: fileCount,
1965
+ newMatchCount: matchCount - 1
1966
+ };
1967
+ }
1968
+ }
1969
+ throw new Error('could not compute indices to remove');
1970
+ };
1971
+ const getRemoveIndices = (items, index, matchCount, fileCount) => {
1972
+ const item = items[index];
1973
+ switch (item.type) {
1974
+ case File:
1975
+ return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
1976
+ case Match:
1977
+ return getRemoveIndicesMatch(items, index, matchCount, fileCount);
1978
+ default:
1979
+ throw new Error('unknown search result type');
1980
+ }
1981
+ };
1982
+ const removeItemFromItems = (items, index, matchCount, fileCount) => {
1983
+ const {
1984
+ startIndex,
1985
+ removeCount,
1986
+ newFocusedIndex,
1987
+ newFileCount,
1988
+ newMatchCount
1989
+ } = getRemoveIndices(items, index, matchCount, fileCount);
1990
+ const newItems = remove$1(items, startIndex, removeCount);
1991
+ return {
1992
+ newItems,
1993
+ newFocusedIndex,
1994
+ newFileCount,
1995
+ newMatchCount
1996
+ };
1997
+ };
1998
+
2294
1999
  const emptyObject = {};
2295
2000
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
2296
2001
  const i18nString = (key, placeholders = emptyObject) => {
@@ -2501,77 +2206,6 @@ const getStatusMessage = (resultCount, fileResultCount) => {
2501
2206
  return manyResultsInManyFiles(resultCount, fileResultCount);
2502
2207
  };
2503
2208
 
2504
- const getSetSize = (items, index) => {
2505
- let setSize = 0;
2506
- for (let i = index + 1; i < items.length; i++) {
2507
- if (items[i].type === File) {
2508
- break;
2509
- }
2510
- setSize++;
2511
- }
2512
- return setSize;
2513
- };
2514
- const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
2515
- const setSize = getSetSize(items, index);
2516
- return {
2517
- startIndex: index,
2518
- removeCount: setSize + 1,
2519
- newFocusedIndex: index + setSize + 1 < items.length ? index : index - 1,
2520
- newFileCount: fileCount - 1,
2521
- newMatchCount: matchCount - setSize
2522
- };
2523
- };
2524
- const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
2525
- for (let i = index; i >= 0; i--) {
2526
- if (items[i].type === File) {
2527
- const setSize = getSetSize(items, i);
2528
- if (setSize === 1) {
2529
- return {
2530
- startIndex: i,
2531
- removeCount: 2,
2532
- newFocusedIndex: i - 1,
2533
- newFileCount: fileCount - 1,
2534
- newMatchCount: matchCount - 1
2535
- };
2536
- }
2537
- return {
2538
- startIndex: index,
2539
- removeCount: 1,
2540
- newFocusedIndex: index,
2541
- newFileCount: fileCount,
2542
- newMatchCount: matchCount - 1
2543
- };
2544
- }
2545
- }
2546
- throw new Error('could not compute indices to remove');
2547
- };
2548
- const getRemoveIndices = (items, index, matchCount, fileCount) => {
2549
- const item = items[index];
2550
- switch (item.type) {
2551
- case File:
2552
- return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
2553
- case Match:
2554
- return getRemoveIndicesMatch(items, index, matchCount, fileCount);
2555
- default:
2556
- throw new Error('unknown search result type');
2557
- }
2558
- };
2559
- const removeItemFromItems = (items, index, matchCount, fileCount) => {
2560
- const {
2561
- startIndex,
2562
- removeCount,
2563
- newFocusedIndex,
2564
- newFileCount,
2565
- newMatchCount
2566
- } = getRemoveIndices(items, index, matchCount, fileCount);
2567
- const newItems = remove$1(items, startIndex, removeCount);
2568
- return {
2569
- newItems,
2570
- newFocusedIndex,
2571
- newFileCount,
2572
- newMatchCount
2573
- };
2574
- };
2575
2209
  const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) => {
2576
2210
  if (maxLineY > newItemsLength) {
2577
2211
  const diff = maxLineY - minLineY;
@@ -2989,7 +2623,7 @@ const requestFileIcons = async requests => {
2989
2623
  return [];
2990
2624
  }
2991
2625
  const simpleRequests = requests.map(toSimpleIconRequest);
2992
- const icons = await getIcons$1(simpleRequests);
2626
+ const icons = await getIcons(simpleRequests);
2993
2627
  return icons;
2994
2628
  };
2995
2629
 
@@ -3730,7 +3364,7 @@ const launchIconThemeWorker = async () => {
3730
3364
 
3731
3365
  const initializeIconThemeWorker = async () => {
3732
3366
  const rpc = await launchIconThemeWorker();
3733
- set$3(rpc);
3367
+ set$2(rpc);
3734
3368
  };
3735
3369
 
3736
3370
  const launchSearchProcessElectron = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "5.22.0",
3
+ "version": "5.23.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"