@lvce-editor/text-search-view 1.7.0 → 1.8.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.
@@ -1135,7 +1135,7 @@ const createMockRpc = ({
1135
1135
  };
1136
1136
 
1137
1137
  const rpcs = Object.create(null);
1138
- const set$5 = (id, rpc) => {
1138
+ const set$7 = (id, rpc) => {
1139
1139
  rpcs[id] = rpc;
1140
1140
  };
1141
1141
  const get$1 = id => {
@@ -1168,7 +1168,7 @@ const create$3 = rpcId => {
1168
1168
  const mockRpc = createMockRpc({
1169
1169
  commandMap
1170
1170
  });
1171
- set$5(rpcId, mockRpc);
1171
+ set$7(rpcId, mockRpc);
1172
1172
  // @ts-ignore
1173
1173
  mockRpc[Symbol.dispose] = () => {
1174
1174
  remove$2(rpcId);
@@ -1177,7 +1177,7 @@ const create$3 = rpcId => {
1177
1177
  return mockRpc;
1178
1178
  },
1179
1179
  set(rpc) {
1180
- set$5(rpcId, rpc);
1180
+ set$7(rpcId, rpc);
1181
1181
  }
1182
1182
  };
1183
1183
  };
@@ -1445,6 +1445,7 @@ const LeftClick = 0;
1445
1445
 
1446
1446
  const DialogWorker = 7014;
1447
1447
  const IconThemeWorker = 7009;
1448
+ const RendererProcess = 1670;
1448
1449
  const RendererWorker = 1;
1449
1450
  const TextSearchWorker = 7010;
1450
1451
 
@@ -1475,30 +1476,35 @@ const FocusToggleDetails = 1010;
1475
1476
  const FocusToggleReplace = 1020;
1476
1477
 
1477
1478
  const {
1478
- invoke: invoke$3,
1479
- set: set$4
1479
+ invoke: invoke$5,
1480
+ set: set$6
1480
1481
  } = create$3(DialogWorker);
1481
1482
 
1482
1483
  const {
1483
- invoke: invoke$2,
1484
- set: set$3
1484
+ invoke: invoke$4,
1485
+ set: set$5
1485
1486
  } = create$3(IconThemeWorker);
1486
1487
  const getIcons = async iconRequests => {
1487
1488
  // @ts-ignore
1488
- return invoke$2('IconTheme.getIcons', iconRequests);
1489
+ return invoke$4('IconTheme.getIcons', iconRequests);
1489
1490
  };
1490
1491
 
1491
1492
  const {
1492
- invoke: invoke$1,
1493
+ invoke: invoke$3,
1494
+ set: set$4
1495
+ } = create$3(RendererProcess);
1496
+
1497
+ const {
1498
+ invoke: invoke$2,
1493
1499
  invokeAndTransfer,
1494
- set: set$2
1500
+ set: set$3
1495
1501
  } = create$3(RendererWorker);
1496
1502
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1497
1503
  number(uid);
1498
1504
  number(menuId);
1499
1505
  number(x);
1500
1506
  number(y);
1501
- await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1507
+ await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
1502
1508
  };
1503
1509
  const sendMessagePortToTextSearchWorker = async (port, rpcId) => {
1504
1510
  const command = 'HandleMessagePort.handleMessagePort';
@@ -1513,30 +1519,30 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1513
1519
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1514
1520
  };
1515
1521
  const handleWorkspaceRefresh = async () => {
1516
- return invoke$1('Layout.handleWorkspaceRefresh');
1522
+ return invoke$2('Layout.handleWorkspaceRefresh');
1517
1523
  };
1518
1524
  const writeClipBoardText = async text => {
1519
- await invoke$1('ClipBoard.writeText', /* text */text);
1525
+ await invoke$2('ClipBoard.writeText', /* text */text);
1520
1526
  };
1521
1527
  const getPreference = async key => {
1522
- return await invoke$1('Preferences.get', key);
1528
+ return await invoke$2('Preferences.get', key);
1523
1529
  };
1524
1530
  const openUri$1 = async (uri, focus, options) => {
1525
- await invoke$1('Main.openUri', uri, focus, options);
1531
+ await invoke$2('Main.openUri', uri, focus, options);
1526
1532
  };
1527
1533
 
1528
1534
  const {
1529
- invoke,
1530
- set: set$1
1535
+ invoke: invoke$1,
1536
+ set: set$2
1531
1537
  } = create$3(TextSearchWorker);
1532
1538
  const getIncrementalResults = async (searchId, minLineY, maxLineY) => {
1533
- return invoke('TextSearch.getIncrementalResults', searchId, minLineY, maxLineY);
1539
+ return invoke$1('TextSearch.getIncrementalResults', searchId, minLineY, maxLineY);
1534
1540
  };
1535
1541
  const search$1 = async (...args) => {
1536
- return invoke('TextSearch.search', ...args);
1542
+ return invoke$1('TextSearch.search', ...args);
1537
1543
  };
1538
1544
  const searchIncremental = async (...args) => {
1539
- return invoke('TextSearch.searchIncremental', ...args);
1545
+ return invoke$1('TextSearch.searchIncremental', ...args);
1540
1546
  };
1541
1547
 
1542
1548
  const toCommandId = key => {
@@ -2361,7 +2367,7 @@ const writeText = async text => {
2361
2367
  await writeClipBoardText(text);
2362
2368
  };
2363
2369
  const readText = async () => {
2364
- return await invoke$1('ClipBoard.readText');
2370
+ return await invoke$2('ClipBoard.readText');
2365
2371
  };
2366
2372
 
2367
2373
  const getActualIndex$1 = state => {
@@ -2439,7 +2445,7 @@ const {
2439
2445
  get,
2440
2446
  getCommandIds,
2441
2447
  registerCommands,
2442
- set,
2448
+ set: set$1,
2443
2449
  wrapAsyncCommand,
2444
2450
  wrapCommand,
2445
2451
  wrapGetter
@@ -2552,7 +2558,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
2552
2558
  viewMode: List,
2553
2559
  workspacePath: workspacePath
2554
2560
  };
2555
- set(uid, state, state);
2561
+ set$1(uid, state, state);
2556
2562
  return state;
2557
2563
  };
2558
2564
 
@@ -3516,7 +3522,7 @@ const openSearchEditor = async state => {
3516
3522
 
3517
3523
  const getSearchExcludes = async (fallback = []) => {
3518
3524
  try {
3519
- const value = await invoke$1('Preferences.get', 'search.exclude');
3525
+ const value = await invoke$2('Preferences.get', 'search.exclude');
3520
3526
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
3521
3527
  return [];
3522
3528
  }
@@ -3593,7 +3599,7 @@ const getProtocol = uri => {
3593
3599
  };
3594
3600
 
3595
3601
  const measureTextHeight = (text, fontFamily, fontSize, lineHeight, width) => {
3596
- return invoke$1('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, `${lineHeight}px`, width);
3602
+ return invoke$2('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, `${lineHeight}px`, width);
3597
3603
  };
3598
3604
 
3599
3605
  const SearchWarningFontFamily = 'system-ui';
@@ -3633,7 +3639,7 @@ const textSearch = async (root, query, options, assetDir, platform, searchId, ui
3633
3639
  if (!hasOpenEditors(options.flags)) {
3634
3640
  return search$1(root, query, options, assetDir, platform, searchId, uid);
3635
3641
  }
3636
- const openEditorUris = await invoke$1('GetActiveEditor.getOpenEditorUris');
3642
+ const openEditorUris = await invoke$2('GetActiveEditor.getOpenEditorUris');
3637
3643
  return search$1(root, query, {
3638
3644
  ...options,
3639
3645
  openEditorUris
@@ -3778,9 +3784,9 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
3778
3784
  maxLineY: visible.length,
3779
3785
  minLineY: 0
3780
3786
  };
3781
- set(uid, latest2.oldState, updatedState2);
3787
+ set$1(uid, latest2.oldState, updatedState2);
3782
3788
  // @ts-ignore
3783
- await invoke$1('Search.rerender');
3789
+ await invoke$2('Search.rerender');
3784
3790
  await waitForNextFrame();
3785
3791
  }
3786
3792
  await resultPromise;
@@ -3817,7 +3823,7 @@ const handleUpdateIncremental = async (state, update) => {
3817
3823
  ...partialNewState,
3818
3824
  searchId
3819
3825
  };
3820
- set(uid, latest1.oldState, updatedState1);
3826
+ set$1(uid, latest1.oldState, updatedState1);
3821
3827
 
3822
3828
  // TODO await promise?
3823
3829
  void textSearchIncremental(root, value, {
@@ -3859,7 +3865,7 @@ const handleUpdatePullBased = async (state, update) => {
3859
3865
  searchId,
3860
3866
  searchResults: []
3861
3867
  };
3862
- set(previousUid, state, partialNewState);
3868
+ set$1(previousUid, state, partialNewState);
3863
3869
  const {
3864
3870
  assetDir,
3865
3871
  contextLines,
@@ -4034,7 +4040,7 @@ const noop = state => {
4034
4040
  };
4035
4041
 
4036
4042
  const applyBulkReplacement = async bulkEdits => {
4037
- await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
4043
+ await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
4038
4044
  };
4039
4045
 
4040
4046
  const getReplacedMessage = (fileCount, replaceCount, replacement) => {
@@ -4095,12 +4101,12 @@ const getReplacingMessage = (fileCount, replaceCount) => {
4095
4101
  const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
4096
4102
  const prompt = async (text, options) => {
4097
4103
  try {
4098
- return await invoke$3('ConfirmPrompt.prompt', text, options);
4104
+ return await invoke$5('ConfirmPrompt.prompt', text, options);
4099
4105
  } catch (error) {
4100
4106
  if (!String(error).includes(missingDialogWorkerRelay)) {
4101
4107
  throw error;
4102
4108
  }
4103
- return invoke$1('ConfirmPrompt.prompt', text, options);
4109
+ return invoke$2('ConfirmPrompt.prompt', text, options);
4104
4110
  }
4105
4111
  };
4106
4112
 
@@ -4301,7 +4307,7 @@ const replaceAllWithProgress = async context => {
4301
4307
  ...latestState,
4302
4308
  message
4303
4309
  }));
4304
- await invoke$1('Search.rerender');
4310
+ await invoke$2('Search.rerender');
4305
4311
  const updatedState = await replaceAllConfirmed(context.getState(), fileIndex);
4306
4312
  await context.updateState(() => updatedState);
4307
4313
  };
@@ -4800,6 +4806,31 @@ const handleListFocus = async state => {
4800
4806
  };
4801
4807
  };
4802
4808
 
4809
+ const state = {
4810
+ connected: false
4811
+ };
4812
+ const isConnected = () => {
4813
+ const {
4814
+ connected
4815
+ } = state;
4816
+ return connected;
4817
+ };
4818
+ const invoke = (method, ...params) => {
4819
+ return invoke$3(method, ...params);
4820
+ };
4821
+ const set = rpc => {
4822
+ set$4(rpc);
4823
+ state.connected = true;
4824
+ };
4825
+
4826
+ const handleMessagePort = async port => {
4827
+ const rpc = await create$7({
4828
+ commandMap: {},
4829
+ messagePort: port
4830
+ });
4831
+ set(rpc);
4832
+ };
4833
+
4803
4834
  const handlePullResultsFound = async (state, resultSearchId, newResults) => {
4804
4835
  const {
4805
4836
  fileIconCache,
@@ -4849,8 +4880,8 @@ const handlePullResultsFound = async (state, resultSearchId, newResults) => {
4849
4880
  scrollBarHeight
4850
4881
  };
4851
4882
  const oldState = latest ? latest.oldState : state;
4852
- set(uid, oldState, updatedState);
4853
- await invoke$1('Search.rerender');
4883
+ set$1(uid, oldState, updatedState);
4884
+ await invoke$2('Search.rerender');
4854
4885
  return state;
4855
4886
  };
4856
4887
 
@@ -4933,7 +4964,7 @@ const launchIconThemeWorker = async () => {
4933
4964
 
4934
4965
  const initializeIconThemeWorker = async () => {
4935
4966
  const rpc = await launchIconThemeWorker();
4936
- set$3(rpc);
4967
+ set$5(rpc);
4937
4968
  };
4938
4969
 
4939
4970
  const commandMap$1 = {
@@ -4952,7 +4983,7 @@ const launchTextSearchWorker = async () => {
4952
4983
 
4953
4984
  const initializeTextSearchWorker = async () => {
4954
4985
  const rpc = await launchTextSearchWorker();
4955
- set$1(rpc);
4986
+ set$2(rpc);
4956
4987
  };
4957
4988
 
4958
4989
  const initialize = async () => {
@@ -6633,14 +6664,23 @@ const applyRender = (oldState, newState, diffResult) => {
6633
6664
  return commands;
6634
6665
  };
6635
6666
 
6667
+ const renderDirect = async (uid, commands) => {
6668
+ const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
6669
+ const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
6670
+ const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
6671
+ return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
6672
+ };
6636
6673
  const render2 = (uid, diffResult) => {
6637
6674
  const {
6638
6675
  newState,
6639
6676
  oldState
6640
6677
  } = get(uid);
6641
- set(uid, newState, newState);
6678
+ set$1(uid, newState, newState);
6642
6679
  const commands = applyRender(oldState, newState, diffResult);
6643
- return commands;
6680
+ if (!isConnected()) {
6681
+ return commands;
6682
+ }
6683
+ return renderDirect(uid, commands);
6644
6684
  };
6645
6685
 
6646
6686
  const Button = 1;
@@ -6983,7 +7023,7 @@ const handleContextMenuMouseAt = async (state, eventX, eventY) => {
6983
7023
  newState,
6984
7024
  oldState
6985
7025
  } = get(uid);
6986
- set(uid, oldState, {
7026
+ set$1(uid, oldState, {
6987
7027
  ...newState,
6988
7028
  focusedIndex: index,
6989
7029
  listFocusedIndex: index
@@ -7076,6 +7116,7 @@ const commandMap = {
7076
7116
  'TextSearch.handleListBlur': wrapCommand(handleListBlur),
7077
7117
  'TextSearch.handleListFocus': wrapCommand(handleListFocus),
7078
7118
  'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
7119
+ 'TextSearch.handleMessagePort': handleMessagePort,
7079
7120
  'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound),
7080
7121
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
7081
7122
  'TextSearch.handleResize': wrapCommand(handleResize),
@@ -7126,12 +7167,12 @@ const listen = async () => {
7126
7167
  const rpc = await create$4({
7127
7168
  commandMap: commandMap
7128
7169
  });
7129
- set$2(rpc);
7170
+ set$3(rpc);
7130
7171
  const dialogRpc = await create$5({
7131
7172
  commandMap: {},
7132
7173
  send: sendMessagePortToDialogWorker
7133
7174
  });
7134
- set$4(dialogRpc);
7175
+ set$6(dialogRpc);
7135
7176
  };
7136
7177
 
7137
7178
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-view",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Text Search View",
5
5
  "keywords": [
6
6
  "text-search"