@lvce-editor/explorer-view 3.5.0 → 3.7.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.
@@ -533,13 +533,13 @@ const create$4$1 = (method, params) => {
533
533
  };
534
534
  };
535
535
  const callbacks = Object.create(null);
536
- const set$4 = (id, fn) => {
536
+ const set$6 = (id, fn) => {
537
537
  callbacks[id] = fn;
538
538
  };
539
539
  const get$2 = id => {
540
540
  return callbacks[id];
541
541
  };
542
- const remove$1 = id => {
542
+ const remove$2 = id => {
543
543
  delete callbacks[id];
544
544
  };
545
545
  let id = 0;
@@ -552,7 +552,7 @@ const registerPromise = () => {
552
552
  resolve,
553
553
  promise
554
554
  } = Promise.withResolvers();
555
- set$4(id, resolve);
555
+ set$6(id, resolve);
556
556
  return {
557
557
  id,
558
558
  promise
@@ -632,7 +632,8 @@ const splitLines = lines => {
632
632
  return lines.split(NewLine);
633
633
  };
634
634
  const getCurrentStack = () => {
635
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
635
+ const stackLinesToSkip = 3;
636
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
636
637
  return currentStack;
637
638
  };
638
639
  const getNewLineIndex = (string, startIndex = undefined) => {
@@ -723,7 +724,7 @@ const resolve = (id, response) => {
723
724
  return;
724
725
  }
725
726
  fn(response);
726
- remove$1(id);
727
+ remove$2(id);
727
728
  };
728
729
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
729
730
  const getErrorType = prettyError => {
@@ -896,13 +897,19 @@ const send = (transport, method, ...params) => {
896
897
  const message = create$4$1(method, params);
897
898
  transport.send(message);
898
899
  };
899
- const invoke$2 = (ipc, method, ...params) => {
900
+ const invoke$4 = (ipc, method, ...params) => {
900
901
  return invokeHelper(ipc, method, params, false);
901
902
  };
902
- const invokeAndTransfer = (ipc, method, ...params) => {
903
+ const invokeAndTransfer$2 = (ipc, method, ...params) => {
903
904
  return invokeHelper(ipc, method, params, true);
904
905
  };
905
906
 
907
+ class CommandNotFoundError extends Error {
908
+ constructor(command) {
909
+ super(`Command not found ${command}`);
910
+ this.name = 'CommandNotFoundError';
911
+ }
912
+ }
906
913
  const commands = Object.create(null);
907
914
  const register = commandMap => {
908
915
  Object.assign(commands, commandMap);
@@ -913,7 +920,7 @@ const getCommand = key => {
913
920
  const execute = (command, ...args) => {
914
921
  const fn = getCommand(command);
915
922
  if (!fn) {
916
- throw new Error(`command not found ${command}`);
923
+ throw new CommandNotFoundError(command);
917
924
  }
918
925
  return fn(...args);
919
926
  };
@@ -929,10 +936,10 @@ const createRpc = ipc => {
929
936
  send(ipc, method, ...params);
930
937
  },
931
938
  invoke(method, ...params) {
932
- return invoke$2(ipc, method, ...params);
939
+ return invoke$4(ipc, method, ...params);
933
940
  },
934
941
  invokeAndTransfer(method, ...params) {
935
- return invokeAndTransfer(ipc, method, ...params);
942
+ return invokeAndTransfer$2(ipc, method, ...params);
936
943
  },
937
944
  async dispose() {
938
945
  await ipc?.dispose();
@@ -1025,16 +1032,41 @@ const Copy$1 = 3;
1025
1032
  const Rename$2 = 4;
1026
1033
  const Remove = 5;
1027
1034
 
1035
+ const Text = 12;
1036
+
1037
+ const Enter = 3;
1038
+ const Escape = 8;
1039
+ const Space = 9;
1040
+ const End = 255;
1041
+ const Home = 12;
1042
+ const LeftArrow = 13;
1043
+ const UpArrow = 14;
1044
+ const RightArrow = 15;
1045
+ const DownArrow = 16;
1046
+ const Delete$1 = 18;
1047
+ const KeyA = 29;
1048
+ const KeyC = 31;
1049
+ const KeyV = 50;
1050
+ const KeyX = 52;
1051
+ const F2 = 58;
1052
+ const Star = 131;
1053
+
1054
+ const CtrlCmd = 1 << 11 >>> 0;
1055
+ const Shift = 1 << 10 >>> 0;
1056
+ const Alt = 1 << 9 >>> 0;
1057
+
1058
+ const DebugWorker = 55;
1059
+ const FileSystemWorker$1 = 209;
1060
+ const RendererWorker$1 = 1;
1061
+
1028
1062
  const rpcs = Object.create(null);
1029
- const set$g = (id, rpc) => {
1063
+ const set$5 = (id, rpc) => {
1030
1064
  rpcs[id] = rpc;
1031
1065
  };
1032
1066
  const get$1 = id => {
1033
1067
  return rpcs[id];
1034
1068
  };
1035
1069
 
1036
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
1037
-
1038
1070
  const create$2 = rpcId => {
1039
1071
  return {
1040
1072
  // @ts-ignore
@@ -1050,7 +1082,7 @@ const create$2 = rpcId => {
1050
1082
  return rpc.invokeAndTransfer(method, ...params);
1051
1083
  },
1052
1084
  set(rpc) {
1053
- set$g(rpcId, rpc);
1085
+ set$5(rpcId, rpc);
1054
1086
  },
1055
1087
  async dispose() {
1056
1088
  const rpc = get$1(rpcId);
@@ -1058,40 +1090,425 @@ const create$2 = rpcId => {
1058
1090
  }
1059
1091
  };
1060
1092
  };
1061
- const RendererWorker$1 = 1;
1062
- const FileSystemWorker$1 = 209;
1093
+
1063
1094
  const {
1064
- set: set$7} = create$2(FileSystemWorker$1);
1095
+ invoke: invoke$3,
1096
+ invokeAndTransfer: invokeAndTransfer$1,
1097
+ set: set$4,
1098
+ dispose: dispose$1
1099
+ } = create$2(FileSystemWorker$1);
1100
+ const remove$1 = async dirent => {
1101
+ return invoke$3('FileSystem.remove', dirent);
1102
+ };
1103
+ const readDirWithFileTypes$1 = async uri => {
1104
+ return invoke$3('FileSystem.readDirWithFileTypes', uri);
1105
+ };
1106
+ const getPathSeparator$2 = async root => {
1107
+ // @ts-ignore
1108
+ return invoke$3('FileSystem.getPathSeparator', root);
1109
+ };
1110
+ const getRealPath$1 = async path => {
1111
+ return invoke$3('FileSystem.getRealPath', path);
1112
+ };
1113
+ const stat$1 = async dirent => {
1114
+ return invoke$3('FileSystem.stat', dirent);
1115
+ };
1116
+ const createFile = async uri => {
1117
+ return invoke$3('FileSystem.writeFile', uri, '');
1118
+ };
1119
+ const readFile$1 = async uri => {
1120
+ return invoke$3('FileSystem.readFile', uri);
1121
+ };
1122
+ const writeFile$1 = async (uri, content) => {
1123
+ return invoke$3('FileSystem.writeFile', uri, content);
1124
+ };
1125
+ const mkdir$1 = async uri => {
1126
+ return invoke$3('FileSystem.mkdir', uri);
1127
+ };
1128
+ const rename$2 = async (oldUri, newUri) => {
1129
+ return invoke$3('FileSystem.rename', oldUri, newUri);
1130
+ };
1131
+ const copy$2 = async (oldUri, newUri) => {
1132
+ return invoke$3('FileSystem.copy', oldUri, newUri);
1133
+ };
1134
+ const exists = async uri => {
1135
+ // @ts-ignore
1136
+ return invoke$3('FileSystem.exists', uri);
1137
+ };
1138
+ const getFolderSize$1 = async uri => {
1139
+ // @ts-ignore
1140
+ return invoke$3('FileSystem.getFolderSize', uri);
1141
+ };
1142
+ const readFileAsBlob = async uri => {
1143
+ // @ts-ignore
1144
+ return invoke$3('FileSystem.readFileAsBlob', uri);
1145
+ };
1146
+ const appendFile = async (uri, text) => {
1147
+ // @ts-ignore
1148
+ return invoke$3('FileSystem.appendFile', uri, text);
1149
+ };
1150
+
1065
1151
  const FileSystemWorker = {
1066
1152
  __proto__: null,
1067
- set: set$7};
1068
- const {
1153
+ appendFile,
1154
+ copy: copy$2,
1155
+ createFile,
1156
+ dispose: dispose$1,
1157
+ exists,
1158
+ getFolderSize: getFolderSize$1,
1159
+ getPathSeparator: getPathSeparator$2,
1160
+ getRealPath: getRealPath$1,
1069
1161
  invoke: invoke$3,
1070
- invokeAndTransfer: invokeAndTransfer$3,
1071
- set: set$3} = create$2(RendererWorker$1);
1162
+ invokeAndTransfer: invokeAndTransfer$1,
1163
+ mkdir: mkdir$1,
1164
+ readDirWithFileTypes: readDirWithFileTypes$1,
1165
+ readFile: readFile$1,
1166
+ readFileAsBlob,
1167
+ remove: remove$1,
1168
+ rename: rename$2,
1169
+ set: set$4,
1170
+ stat: stat$1,
1171
+ writeFile: writeFile$1
1172
+ };
1173
+
1174
+ const {
1175
+ invoke: invoke$2,
1176
+ invokeAndTransfer,
1177
+ set: set$3,
1178
+ dispose
1179
+ } = create$2(RendererWorker$1);
1180
+ const searchFileHtml = async uri => {
1181
+ return invoke$2('ExtensionHost.searchFileWithHtml', uri);
1182
+ };
1183
+ const getFilePathElectron$1 = async file => {
1184
+ return invoke$2('FileSystemHandle.getFilePathElectron', file);
1185
+ };
1072
1186
  const showContextMenu$1 = async (x, y, id, ...args) => {
1073
- return invoke$3('ContextMenu.show', x, y, id, ...args);
1187
+ return invoke$2('ContextMenu.show', x, y, id, ...args);
1188
+ };
1189
+ const getElectronVersion = async () => {
1190
+ return invoke$2('Process.getElectronVersion');
1191
+ };
1192
+ const applyBulkReplacement = async bulkEdits => {
1193
+ await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
1194
+ };
1195
+ const setColorTheme = async id => {
1196
+ // @ts-ignore
1197
+ return invoke$2(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1198
+ };
1199
+ const getNodeVersion = async () => {
1200
+ return invoke$2('Process.getNodeVersion');
1201
+ };
1202
+ const getChromeVersion = async () => {
1203
+ return invoke$2('Process.getChromeVersion');
1204
+ };
1205
+ const getV8Version = async () => {
1206
+ return invoke$2('Process.getV8Version');
1207
+ };
1208
+ const getFileHandles$1 = async fileIds => {
1209
+ const files = await invoke$2('FileSystemHandle.getFileHandles', fileIds);
1210
+ return files;
1211
+ };
1212
+ const setWorkspacePath = async path => {
1213
+ await invoke$2('Workspace.setPath', path);
1214
+ };
1215
+ const registerWebViewInterceptor = async (id, port) => {
1216
+ await invokeAndTransfer('WebView.registerInterceptor', id, port);
1217
+ };
1218
+ const unregisterWebViewInterceptor = async id => {
1219
+ await invoke$2('WebView.unregisterInterceptor', id);
1220
+ };
1221
+ const sendMessagePortToEditorWorker = async (port, rpcId) => {
1222
+ const command = 'HandleMessagePort.handleMessagePort';
1223
+ // @ts-ignore
1224
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1225
+ };
1226
+ const sendMessagePortToErrorWorker = async (port, rpcId) => {
1227
+ const command = 'Errors.handleMessagePort';
1228
+ // @ts-ignore
1229
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1230
+ };
1231
+ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1232
+ const command = 'Markdown.handleMessagePort';
1233
+ // @ts-ignore
1234
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1074
1235
  };
1075
1236
  const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
1076
1237
  const command = 'FileSystem.handleMessagePort';
1077
1238
  // @ts-ignore
1078
- await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1239
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1240
+ };
1241
+ const readFile = async uri => {
1242
+ return invoke$2('FileSystem.readFile', uri);
1243
+ };
1244
+ const getWebViewSecret = async key => {
1245
+ // @ts-ignore
1246
+ return invoke$2('WebView.getSecret', key);
1247
+ };
1248
+ const setWebViewPort = async (uid, port, origin, portType) => {
1249
+ return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1250
+ };
1251
+ const setFocus$1 = key => {
1252
+ return invoke$2('Focus.setFocus', key);
1253
+ };
1254
+ const getFileIcon = async options => {
1255
+ return invoke$2('IconTheme.getFileIcon', options);
1256
+ };
1257
+ const getColorThemeNames = async () => {
1258
+ return invoke$2('ColorTheme.getColorThemeNames');
1259
+ };
1260
+ const disableExtension = async id => {
1261
+ // @ts-ignore
1262
+ return invoke$2('ExtensionManagement.disable', id);
1263
+ };
1264
+ const enableExtension = async id => {
1265
+ // @ts-ignore
1266
+ return invoke$2('ExtensionManagement.enable', id);
1267
+ };
1268
+ const handleDebugChange = async params => {
1269
+ // @ts-ignore
1270
+ return invoke$2('Run And Debug.handleChange', params);
1271
+ };
1272
+ const getFolderIcon = async options => {
1273
+ return invoke$2('IconTheme.getFolderIcon', options);
1274
+ };
1275
+ const closeWidget = async widgetId => {
1276
+ return invoke$2('Viewlet.closeWidget', widgetId);
1277
+ };
1278
+ const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1279
+ const command = 'HandleMessagePort.handleMessagePort2';
1280
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1281
+ };
1282
+ const sendMessagePortToSearchProcess = async port => {
1283
+ await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1079
1284
  };
1080
1285
  const confirm$1 = async (message, options) => {
1081
1286
  // @ts-ignore
1082
- const result = await invoke$3('Confirmprompt.prompt', message, options);
1287
+ const result = await invoke$2('ConfirmPrompt.prompt', message, options);
1083
1288
  return result;
1084
1289
  };
1290
+ const getRecentlyOpened = async () => {
1291
+ return invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1292
+ };
1293
+ const getKeyBindings$1 = async () => {
1294
+ return invoke$2('KeyBindingsInitial.getKeyBindings');
1295
+ };
1085
1296
  const writeClipBoardText$1 = async text => {
1086
- await invoke$3('ClipBoard.writeText', /* text */text);
1297
+ await invoke$2('ClipBoard.writeText', /* text */text);
1087
1298
  };
1299
+ const writeClipBoardImage = async blob => {
1300
+ // @ts-ignore
1301
+ await invoke$2('ClipBoard.writeImage', /* text */blob);
1302
+ };
1303
+ const searchFileMemory = async uri => {
1304
+ // @ts-ignore
1305
+ return invoke$2('ExtensionHost.searchFileWithMemory', uri);
1306
+ };
1307
+ const searchFileFetch = async uri => {
1308
+ return invoke$2('ExtensionHost.searchFileWithFetch', uri);
1309
+ };
1310
+ const showMessageBox = async options => {
1311
+ return invoke$2('ElectronDialog.showMessageBox', options);
1312
+ };
1313
+ const handleDebugResumed = async params => {
1314
+ await invoke$2('Run And Debug.handleResumed', params);
1315
+ };
1316
+ const openWidget = async name => {
1317
+ await invoke$2('Viewlet.openWidget', name);
1318
+ };
1319
+ const getIcons = async requests => {
1320
+ const icons = await invoke$2('IconTheme.getIcons', requests);
1321
+ return icons;
1322
+ };
1323
+ const activateByEvent = event => {
1324
+ return invoke$2('ExtensionHostManagement.activateByEvent', event);
1325
+ };
1326
+ const setAdditionalFocus = focusKey => {
1327
+ // @ts-ignore
1328
+ return invoke$2('Focus.setAdditionalFocus', focusKey);
1329
+ };
1330
+ const getActiveEditorId = () => {
1331
+ // @ts-ignore
1332
+ return invoke$2('GetActiveEditor.getActiveEditorId');
1333
+ };
1334
+ const getWorkspacePath$1 = () => {
1335
+ return invoke$2('Workspace.getPath');
1336
+ };
1337
+ const sendMessagePortToRendererProcess = async port => {
1338
+ const command = 'HandleMessagePort.handleMessagePort';
1339
+ // @ts-ignore
1340
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1341
+ };
1342
+ const getPreference = async key => {
1343
+ return await invoke$2('Preferences.get', key);
1344
+ };
1345
+ const getAllExtensions = async () => {
1346
+ return invoke$2('ExtensionManagement.getAllExtensions');
1347
+ };
1348
+ const rerenderEditor = async key => {
1349
+ // @ts-ignore
1350
+ return invoke$2('Editor.rerender', key);
1351
+ };
1352
+ const handleDebugPaused = async params => {
1353
+ await invoke$2('Run And Debug.handlePaused', params);
1354
+ };
1355
+ const openUri$1 = async (uri, focus, options) => {
1356
+ await invoke$2('Main.openUri', uri, focus, options);
1357
+ };
1358
+ const sendMessagePortToSyntaxHighlightingWorker = async port => {
1359
+ await invokeAndTransfer(
1360
+ // @ts-ignore
1361
+ 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1362
+ };
1363
+ const handleDebugScriptParsed = async script => {
1364
+ await invoke$2('Run And Debug.handleScriptParsed', script);
1365
+ };
1366
+ const getWindowId = async () => {
1367
+ return invoke$2('GetWindowId.getWindowId');
1368
+ };
1369
+ const getBlob = async uri => {
1370
+ // @ts-ignore
1371
+ return invoke$2('FileSystem.getBlob', uri);
1372
+ };
1373
+ const getExtensionCommands = async () => {
1374
+ return invoke$2('ExtensionHost.getCommands');
1375
+ };
1376
+ const showErrorDialog = async errorInfo => {
1377
+ // @ts-ignore
1378
+ await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
1379
+ };
1380
+ const getFolderSize = async uri => {
1381
+ // @ts-ignore
1382
+ return await invoke$2('FileSystem.getFolderSize', uri);
1383
+ };
1384
+ const getExtension = async id => {
1385
+ // @ts-ignore
1386
+ return invoke$2('ExtensionManagement.getExtension', id);
1387
+ };
1388
+ const getMarkdownDom = async html => {
1389
+ // @ts-ignore
1390
+ return invoke$2('Markdown.getVirtualDom', html);
1391
+ };
1392
+ const renderMarkdown = async (markdown, options) => {
1393
+ // @ts-ignore
1394
+ return invoke$2('Markdown.renderMarkdown', markdown, options);
1395
+ };
1396
+ const openNativeFolder$1 = async uri => {
1397
+ // @ts-ignore
1398
+ await invoke$2('OpenNativeFolder.openNativeFolder', uri);
1399
+ };
1400
+ const uninstallExtension = async id => {
1401
+ return invoke$2('ExtensionManagement.uninstall', id);
1402
+ };
1403
+ const installExtension = async id => {
1404
+ // @ts-ignore
1405
+ return invoke$2('ExtensionManagement.install', id);
1406
+ };
1407
+ const openExtensionSearch = async () => {
1408
+ // @ts-ignore
1409
+ return invoke$2('SideBar.openViewlet', 'Extensions');
1410
+ };
1411
+ const setExtensionsSearchValue = async searchValue => {
1412
+ // @ts-ignore
1413
+ return invoke$2('Extensions.handleInput', searchValue);
1414
+ };
1415
+ const openExternal = async uri => {
1416
+ // @ts-ignore
1417
+ await invoke$2('Open.openExternal', uri);
1418
+ };
1419
+ const openUrl = async uri => {
1420
+ // @ts-ignore
1421
+ await invoke$2('Open.openUrl', uri);
1422
+ };
1423
+ const getAllPreferences = async () => {
1424
+ // @ts-ignore
1425
+ return invoke$2('Preferences.getAll');
1426
+ };
1427
+ const showSaveFilePicker = async () => {
1428
+ // @ts-ignore
1429
+ return invoke$2('FilePicker.showSaveFilePicker');
1430
+ };
1431
+ const getLogsDir = async () => {
1432
+ // @ts-ignore
1433
+ return invoke$2('PlatformPaths.getLogsDir');
1434
+ };
1435
+
1088
1436
  const RendererWorker = {
1089
1437
  __proto__: null,
1438
+ activateByEvent,
1439
+ applyBulkReplacement,
1440
+ closeWidget,
1090
1441
  confirm: confirm$1,
1091
- invoke: invoke$3,
1442
+ disableExtension,
1443
+ dispose,
1444
+ enableExtension,
1445
+ getActiveEditorId,
1446
+ getAllExtensions,
1447
+ getAllPreferences,
1448
+ getBlob,
1449
+ getChromeVersion,
1450
+ getColorThemeNames,
1451
+ getElectronVersion,
1452
+ getExtension,
1453
+ getExtensionCommands,
1454
+ getFileHandles: getFileHandles$1,
1455
+ getFileIcon,
1456
+ getFilePathElectron: getFilePathElectron$1,
1457
+ getFolderIcon,
1458
+ getFolderSize,
1459
+ getIcons,
1460
+ getKeyBindings: getKeyBindings$1,
1461
+ getLogsDir,
1462
+ getMarkdownDom,
1463
+ getNodeVersion,
1464
+ getPreference,
1465
+ getRecentlyOpened,
1466
+ getV8Version,
1467
+ getWebViewSecret,
1468
+ getWindowId,
1469
+ getWorkspacePath: getWorkspacePath$1,
1470
+ handleDebugChange,
1471
+ handleDebugPaused,
1472
+ handleDebugResumed,
1473
+ handleDebugScriptParsed,
1474
+ installExtension,
1475
+ invoke: invoke$2,
1476
+ invokeAndTransfer,
1477
+ openExtensionSearch,
1478
+ openExternal,
1479
+ openNativeFolder: openNativeFolder$1,
1480
+ openUri: openUri$1,
1481
+ openUrl,
1482
+ openWidget,
1483
+ readFile,
1484
+ registerWebViewInterceptor,
1485
+ renderMarkdown,
1486
+ rerenderEditor,
1487
+ searchFileFetch,
1488
+ searchFileHtml,
1489
+ searchFileMemory,
1490
+ sendMessagePortToEditorWorker,
1491
+ sendMessagePortToErrorWorker,
1492
+ sendMessagePortToExtensionHostWorker,
1092
1493
  sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
1494
+ sendMessagePortToMarkdownWorker,
1495
+ sendMessagePortToRendererProcess,
1496
+ sendMessagePortToSearchProcess,
1497
+ sendMessagePortToSyntaxHighlightingWorker,
1093
1498
  set: set$3,
1499
+ setAdditionalFocus,
1500
+ setColorTheme,
1501
+ setExtensionsSearchValue,
1502
+ setFocus: setFocus$1,
1503
+ setWebViewPort,
1504
+ setWorkspacePath,
1094
1505
  showContextMenu: showContextMenu$1,
1506
+ showErrorDialog,
1507
+ showMessageBox,
1508
+ showSaveFilePicker,
1509
+ uninstallExtension,
1510
+ unregisterWebViewInterceptor,
1511
+ writeClipBoardImage,
1095
1512
  writeClipBoardText: writeClipBoardText$1
1096
1513
  };
1097
1514
 
@@ -1638,7 +2055,7 @@ const Copy = 'Copy';
1638
2055
  const CopyPath = 'Copy Path';
1639
2056
  const CopyRelativePath = 'Copy Relative Path';
1640
2057
  const Cut = 'Cut';
1641
- const Delete$1 = 'Delete';
2058
+ const Delete = 'Delete';
1642
2059
  const FileNameCannotStartWithSlash = 'A file or folder name cannot start with a slash.';
1643
2060
  const FileOrFolderNameMustBeProvider = 'A file or folder name must be provided.';
1644
2061
  const FilesExplorer = 'Files Explorer';
@@ -1684,7 +2101,7 @@ const rename = () => {
1684
2101
  return i18nString(Rename);
1685
2102
  };
1686
2103
  const deleteItem = () => {
1687
- return i18nString(Delete$1);
2104
+ return i18nString(Delete);
1688
2105
  };
1689
2106
  const refresh$1 = () => {
1690
2107
  return i18nString(RefreshExplorer);
@@ -2600,59 +3017,17 @@ const getCommandIds = () => {
2600
3017
  return commandIds;
2601
3018
  };
2602
3019
 
2603
- const Enter = 3;
2604
- const Escape = 8;
2605
- const Space = 9;
2606
- const End = 255;
2607
- const Home = 12;
2608
- const LeftArrow = 13;
2609
- const UpArrow = 14;
2610
- const RightArrow = 15;
2611
- const DownArrow = 16;
2612
- const Delete = 18;
2613
- const KeyA = 29;
2614
- const KeyC = 31;
2615
- const KeyV = 50;
2616
- const KeyX = 52;
2617
- const F2 = 58;
2618
- const Star = 131;
2619
- const KeyCode = {
2620
- __proto__: null,
2621
- Delete,
2622
- DownArrow,
2623
- End,
2624
- Enter,
2625
- Escape,
2626
- F2,
2627
- Home,
2628
- KeyA,
2629
- KeyC,
2630
- KeyV,
2631
- KeyX,
2632
- LeftArrow,
2633
- RightArrow,
2634
- Space,
2635
- Star,
2636
- UpArrow
2637
- };
2638
- const CtrlCmd = 1 << 11 >>> 0;
2639
- const Shift = 1 << 10 >>> 0;
2640
- const Alt = 1 << 9 >>> 0;
2641
- const KeyModifier = {
2642
- __proto__: null,
2643
- Alt,
2644
- CtrlCmd,
2645
- Shift};
2646
3020
  const mergeClassNames = (...classNames) => {
2647
3021
  return classNames.filter(Boolean).join(' ');
2648
3022
  };
3023
+
2649
3024
  const px = value => {
2650
3025
  return `${value}px`;
2651
3026
  };
2652
3027
  const position = (x, y) => {
2653
3028
  return `${x}px ${y}px`;
2654
3029
  };
2655
- const Text = 12;
3030
+
2656
3031
  const text = data => {
2657
3032
  return {
2658
3033
  type: Text,
@@ -2666,91 +3041,91 @@ const FocusExplorerEditBox = 14;
2666
3041
 
2667
3042
  const getKeyBindings = () => {
2668
3043
  return [{
2669
- key: KeyModifier.Shift | KeyCode.UpArrow,
3044
+ key: Shift | UpArrow,
2670
3045
  command: 'Explorer.selectUp',
2671
3046
  when: FocusExplorer
2672
3047
  }, {
2673
- key: KeyModifier.Shift | KeyCode.DownArrow,
3048
+ key: Shift | DownArrow,
2674
3049
  command: 'Explorer.selectDown',
2675
3050
  when: FocusExplorer
2676
3051
  }, {
2677
- key: KeyCode.RightArrow,
3052
+ key: RightArrow,
2678
3053
  command: 'Explorer.handleArrowRight',
2679
3054
  when: FocusExplorer
2680
3055
  }, {
2681
- key: KeyCode.LeftArrow,
3056
+ key: LeftArrow,
2682
3057
  command: 'Explorer.handleArrowLeft',
2683
3058
  when: FocusExplorer
2684
3059
  }, {
2685
- key: KeyCode.Home,
3060
+ key: Home,
2686
3061
  command: 'Explorer.focusFirst',
2687
3062
  when: FocusExplorer
2688
3063
  }, {
2689
- key: KeyCode.End,
3064
+ key: End,
2690
3065
  command: 'Explorer.focusLast',
2691
3066
  when: FocusExplorer
2692
3067
  }, {
2693
- key: KeyCode.UpArrow,
3068
+ key: UpArrow,
2694
3069
  command: 'Explorer.focusPrevious',
2695
3070
  when: FocusExplorer
2696
3071
  }, {
2697
- key: KeyCode.DownArrow,
3072
+ key: DownArrow,
2698
3073
  command: 'Explorer.focusNext',
2699
3074
  when: FocusExplorer
2700
3075
  }, {
2701
- key: KeyModifier.CtrlCmd | KeyCode.Star,
3076
+ key: CtrlCmd | Star,
2702
3077
  command: 'Explorer.expandAll',
2703
3078
  when: FocusExplorer
2704
3079
  }, {
2705
- key: KeyModifier.Alt | KeyCode.RightArrow,
3080
+ key: Alt | RightArrow,
2706
3081
  command: 'Explorer.expandRecursively',
2707
3082
  when: FocusExplorer
2708
3083
  }, {
2709
- key: KeyModifier.CtrlCmd | KeyCode.LeftArrow,
3084
+ key: CtrlCmd | LeftArrow,
2710
3085
  command: 'Explorer.collapseAll',
2711
3086
  when: FocusExplorer
2712
3087
  }, {
2713
- key: KeyModifier.CtrlCmd | KeyCode.KeyV,
3088
+ key: CtrlCmd | KeyV,
2714
3089
  command: 'Explorer.handlePaste',
2715
3090
  when: FocusExplorer
2716
3091
  }, {
2717
- key: KeyModifier.CtrlCmd | KeyCode.KeyC,
3092
+ key: CtrlCmd | KeyC,
2718
3093
  command: 'Explorer.handleCopy',
2719
3094
  when: FocusExplorer
2720
3095
  }, {
2721
- key: KeyModifier.CtrlCmd | KeyCode.KeyX,
3096
+ key: CtrlCmd | KeyX,
2722
3097
  command: 'Explorer.handleCut',
2723
3098
  when: FocusExplorer
2724
3099
  }, {
2725
- key: KeyCode.F2,
3100
+ key: F2,
2726
3101
  command: 'Explorer.renameDirent',
2727
3102
  when: FocusExplorer
2728
3103
  }, {
2729
- key: KeyCode.Escape,
3104
+ key: Escape,
2730
3105
  command: 'Explorer.cancelEdit',
2731
3106
  when: FocusExplorerEditBox
2732
3107
  }, {
2733
- key: KeyCode.Enter,
3108
+ key: Enter,
2734
3109
  command: 'Explorer.acceptEdit',
2735
3110
  when: FocusExplorerEditBox
2736
3111
  }, {
2737
- key: KeyCode.Delete,
3112
+ key: Delete$1,
2738
3113
  command: 'Explorer.removeDirent',
2739
3114
  when: FocusExplorer
2740
3115
  }, {
2741
- key: KeyCode.Escape,
3116
+ key: Escape,
2742
3117
  command: 'Explorer.focusNone',
2743
3118
  when: FocusExplorer
2744
3119
  }, {
2745
- key: KeyCode.Space,
3120
+ key: Space,
2746
3121
  command: 'Explorer.handleClickCurrentButKeepFocus',
2747
3122
  when: FocusExplorer
2748
3123
  }, {
2749
- key: KeyCode.Enter,
3124
+ key: Enter,
2750
3125
  command: 'Explorer.handleClickCurrent',
2751
3126
  when: FocusExplorer
2752
3127
  }, {
2753
- key: KeyModifier.CtrlCmd | KeyCode.KeyA,
3128
+ key: CtrlCmd | KeyA,
2754
3129
  command: 'Explorer.selectAll',
2755
3130
  when: FocusExplorer
2756
3131
  }];
@@ -4124,18 +4499,26 @@ const generateUniqueName = (baseName, existingPaths, root) => {
4124
4499
  }
4125
4500
  };
4126
4501
 
4127
- const getFileOperationsCopy = (root, existingUris, files) => {
4502
+ const getFileOperationsCopy = (root, existingUris, files, focusedUri) => {
4128
4503
  const operations = [];
4129
4504
  for (const file of files) {
4130
4505
  const baseName = getBaseName('/', file);
4131
- const uniqueName = generateUniqueName(baseName, existingUris, root);
4132
- const newUri = join2(root, uniqueName);
4133
- operations.push({
4134
- type: Copy$1,
4135
- from: file,
4136
- // TODO ensure file is uri
4137
- path: newUri
4138
- });
4506
+ if (existingUris.includes(file)) {
4507
+ operations.push({
4508
+ type: Rename$2,
4509
+ from: file,
4510
+ path: join2(focusedUri, baseName)
4511
+ });
4512
+ } else {
4513
+ const uniqueName = generateUniqueName(baseName, existingUris, root);
4514
+ const newUri = join2(root, uniqueName);
4515
+ operations.push({
4516
+ type: Copy$1,
4517
+ from: file,
4518
+ // TODO ensure file is uri
4519
+ path: newUri
4520
+ });
4521
+ }
4139
4522
  }
4140
4523
  return operations;
4141
4524
  };
@@ -4150,10 +4533,12 @@ const handlePasteCopy = async (state, nativeFiles) => {
4150
4533
  // TODO use file operations and bulk edit
4151
4534
  const {
4152
4535
  items,
4153
- root
4536
+ root,
4537
+ focusedIndex
4154
4538
  } = state;
4539
+ const focusedUri = items[focusedIndex]?.path || root;
4155
4540
  const existingUris = items.map(item => item.path);
4156
- const operations = getFileOperationsCopy(root, existingUris, nativeFiles.files);
4541
+ const operations = getFileOperationsCopy(root, existingUris, nativeFiles.files, focusedUri);
4157
4542
  // TODO handle error?
4158
4543
  await applyFileOperations(operations);
4159
4544
 
@@ -4889,7 +5274,7 @@ const renderEditingSelection = (oldState, newState) => {
4889
5274
  return ['Viewlet.setSelectionByName', uid, ExplorerInput, editingSelectionStart, editingSelectionEnd];
4890
5275
  };
4891
5276
 
4892
- const renderFocus$1 = (oldState, newState) => {
5277
+ const renderFocus = (oldState, newState) => {
4893
5278
  if (newState.inputSource === User) {
4894
5279
  return [];
4895
5280
  }
@@ -4905,7 +5290,7 @@ const renderFocus$1 = (oldState, newState) => {
4905
5290
  return [];
4906
5291
  };
4907
5292
 
4908
- const renderFocus = (oldState, newState) => {
5293
+ const renderFocusContext = (oldState, newState) => {
4909
5294
  if (newState.focus === Input$1) {
4910
5295
  return ['Viewlet.setFocusContext', FocusExplorerEditBox];
4911
5296
  }
@@ -5404,9 +5789,9 @@ const getRenderer = diffType => {
5404
5789
  case RenderItems:
5405
5790
  return renderItems;
5406
5791
  case RenderFocus:
5407
- return renderFocus$1;
5408
- case RenderFocusContext:
5409
5792
  return renderFocus;
5793
+ case RenderFocusContext:
5794
+ return renderFocusContext;
5410
5795
  case RenderValue:
5411
5796
  return renderValue;
5412
5797
  case RenderSelection:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "3.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",