@lvce-editor/activity-bar-worker 1.8.0 → 1.10.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.
@@ -742,7 +742,7 @@ const send = (transport, method, ...params) => {
742
742
  const message = create$4(method, params);
743
743
  transport.send(message);
744
744
  };
745
- const invoke$2 = (ipc, method, ...params) => {
745
+ const invoke$1 = (ipc, method, ...params) => {
746
746
  return invokeHelper(ipc, method, params, false);
747
747
  };
748
748
  const invokeAndTransfer$1 = (ipc, method, ...params) => {
@@ -781,7 +781,7 @@ const createRpc = ipc => {
781
781
  send(ipc, method, ...params);
782
782
  },
783
783
  invoke(method, ...params) {
784
- return invoke$2(ipc, method, ...params);
784
+ return invoke$1(ipc, method, ...params);
785
785
  },
786
786
  invokeAndTransfer(method, ...params) {
787
787
  return invokeAndTransfer$1(ipc, method, ...params);
@@ -1073,6 +1073,10 @@ const Home = 12;
1073
1073
  const UpArrow = 14;
1074
1074
  const DownArrow = 16;
1075
1075
 
1076
+ const ActivityBar$3 = 1;
1077
+ const Settings$1 = 12;
1078
+ const ActivityBarAdditionalViews = 17;
1079
+
1076
1080
  const LeftClick = 0;
1077
1081
 
1078
1082
  const DebugWorker = 55;
@@ -1136,15 +1140,6 @@ const getIndexFromPosition = (y, eventX, eventY, itemHeight, itemCount) => {
1136
1140
  return index;
1137
1141
  };
1138
1142
 
1139
- const show = async (x, y, id, ...args) => {
1140
- // TODO
1141
- };
1142
-
1143
- const handleClickAdditionalViews = async (state, x, y, viewletId) => {
1144
- await show();
1145
- return state;
1146
- };
1147
-
1148
1143
  const rpcs = Object.create(null);
1149
1144
  const set$2 = (id, rpc) => {
1150
1145
  rpcs[id] = rpc;
@@ -1178,51 +1173,51 @@ const create = rpcId => {
1178
1173
  };
1179
1174
 
1180
1175
  const {
1181
- invoke: invoke$1,
1176
+ invoke,
1182
1177
  invokeAndTransfer,
1183
1178
  set: set$1,
1184
1179
  dispose
1185
1180
  } = create(RendererWorker$1);
1186
1181
  const searchFileHtml = async uri => {
1187
- return invoke$1('ExtensionHost.searchFileWithHtml', uri);
1182
+ return invoke('ExtensionHost.searchFileWithHtml', uri);
1188
1183
  };
1189
1184
  const getFilePathElectron = async file => {
1190
- return invoke$1('FileSystemHandle.getFilePathElectron', file);
1185
+ return invoke('FileSystemHandle.getFilePathElectron', file);
1191
1186
  };
1192
1187
  const showContextMenu = async (x, y, id, ...args) => {
1193
- return invoke$1('ContextMenu.show', x, y, id, ...args);
1188
+ return invoke('ContextMenu.show', x, y, id, ...args);
1194
1189
  };
1195
1190
  const getElectronVersion = async () => {
1196
- return invoke$1('Process.getElectronVersion');
1191
+ return invoke('Process.getElectronVersion');
1197
1192
  };
1198
1193
  const applyBulkReplacement = async bulkEdits => {
1199
- await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
1194
+ await invoke('BulkReplacement.applyBulkReplacement', bulkEdits);
1200
1195
  };
1201
1196
  const setColorTheme = async id => {
1202
1197
  // @ts-ignore
1203
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1198
+ return invoke(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1204
1199
  };
1205
1200
  const getNodeVersion = async () => {
1206
- return invoke$1('Process.getNodeVersion');
1201
+ return invoke('Process.getNodeVersion');
1207
1202
  };
1208
1203
  const getChromeVersion = async () => {
1209
- return invoke$1('Process.getChromeVersion');
1204
+ return invoke('Process.getChromeVersion');
1210
1205
  };
1211
1206
  const getV8Version = async () => {
1212
- return invoke$1('Process.getV8Version');
1207
+ return invoke('Process.getV8Version');
1213
1208
  };
1214
1209
  const getFileHandles = async fileIds => {
1215
- const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
1210
+ const files = await invoke('FileSystemHandle.getFileHandles', fileIds);
1216
1211
  return files;
1217
1212
  };
1218
1213
  const setWorkspacePath = async path => {
1219
- await invoke$1('Workspace.setPath', path);
1214
+ await invoke('Workspace.setPath', path);
1220
1215
  };
1221
1216
  const registerWebViewInterceptor = async (id, port) => {
1222
1217
  await invokeAndTransfer('WebView.registerInterceptor', id, port);
1223
1218
  };
1224
1219
  const unregisterWebViewInterceptor = async id => {
1225
- await invoke$1('WebView.unregisterInterceptor', id);
1220
+ await invoke('WebView.unregisterInterceptor', id);
1226
1221
  };
1227
1222
  const sendMessagePortToEditorWorker = async (port, rpcId) => {
1228
1223
  const command = 'HandleMessagePort.handleMessagePort';
@@ -1250,41 +1245,41 @@ const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1250
1245
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1251
1246
  };
1252
1247
  const readFile = async uri => {
1253
- return invoke$1('FileSystem.readFile', uri);
1248
+ return invoke('FileSystem.readFile', uri);
1254
1249
  };
1255
1250
  const getWebViewSecret = async key => {
1256
1251
  // @ts-ignore
1257
- return invoke$1('WebView.getSecret', key);
1252
+ return invoke('WebView.getSecret', key);
1258
1253
  };
1259
1254
  const setWebViewPort = async (uid, port, origin, portType) => {
1260
1255
  return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1261
1256
  };
1262
1257
  const setFocus = key => {
1263
- return invoke$1('Focus.setFocus', key);
1258
+ return invoke('Focus.setFocus', key);
1264
1259
  };
1265
1260
  const getFileIcon = async options => {
1266
- return invoke$1('IconTheme.getFileIcon', options);
1261
+ return invoke('IconTheme.getFileIcon', options);
1267
1262
  };
1268
1263
  const getColorThemeNames = async () => {
1269
- return invoke$1('ColorTheme.getColorThemeNames');
1264
+ return invoke('ColorTheme.getColorThemeNames');
1270
1265
  };
1271
1266
  const disableExtension = async id => {
1272
1267
  // @ts-ignore
1273
- return invoke$1('ExtensionManagement.disable', id);
1268
+ return invoke('ExtensionManagement.disable', id);
1274
1269
  };
1275
1270
  const enableExtension = async id => {
1276
1271
  // @ts-ignore
1277
- return invoke$1('ExtensionManagement.enable', id);
1272
+ return invoke('ExtensionManagement.enable', id);
1278
1273
  };
1279
1274
  const handleDebugChange = async params => {
1280
1275
  // @ts-ignore
1281
- return invoke$1('Run And Debug.handleChange', params);
1276
+ return invoke('Run And Debug.handleChange', params);
1282
1277
  };
1283
1278
  const getFolderIcon = async options => {
1284
- return invoke$1('IconTheme.getFolderIcon', options);
1279
+ return invoke('IconTheme.getFolderIcon', options);
1285
1280
  };
1286
1281
  const closeWidget = async widgetId => {
1287
- return invoke$1('Viewlet.closeWidget', widgetId);
1282
+ return invoke('Viewlet.closeWidget', widgetId);
1288
1283
  };
1289
1284
  const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1290
1285
  const command = 'HandleMessagePort.handleMessagePort2';
@@ -1295,55 +1290,55 @@ const sendMessagePortToSearchProcess = async port => {
1295
1290
  };
1296
1291
  const confirm = async (message, options) => {
1297
1292
  // @ts-ignore
1298
- const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1293
+ const result = await invoke('ConfirmPrompt.prompt', message, options);
1299
1294
  return result;
1300
1295
  };
1301
1296
  const getRecentlyOpened = async () => {
1302
- return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1297
+ return invoke(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1303
1298
  };
1304
1299
  const getKeyBindings = async () => {
1305
- return invoke$1('KeyBindingsInitial.getKeyBindings');
1300
+ return invoke('KeyBindingsInitial.getKeyBindings');
1306
1301
  };
1307
1302
  const writeClipBoardText = async text => {
1308
- await invoke$1('ClipBoard.writeText', /* text */text);
1303
+ await invoke('ClipBoard.writeText', /* text */text);
1309
1304
  };
1310
1305
  const writeClipBoardImage = async blob => {
1311
1306
  // @ts-ignore
1312
- await invoke$1('ClipBoard.writeImage', /* text */blob);
1307
+ await invoke('ClipBoard.writeImage', /* text */blob);
1313
1308
  };
1314
1309
  const searchFileMemory = async uri => {
1315
1310
  // @ts-ignore
1316
- return invoke$1('ExtensionHost.searchFileWithMemory', uri);
1311
+ return invoke('ExtensionHost.searchFileWithMemory', uri);
1317
1312
  };
1318
1313
  const searchFileFetch = async uri => {
1319
- return invoke$1('ExtensionHost.searchFileWithFetch', uri);
1314
+ return invoke('ExtensionHost.searchFileWithFetch', uri);
1320
1315
  };
1321
1316
  const showMessageBox = async options => {
1322
- return invoke$1('ElectronDialog.showMessageBox', options);
1317
+ return invoke('ElectronDialog.showMessageBox', options);
1323
1318
  };
1324
1319
  const handleDebugResumed = async params => {
1325
- await invoke$1('Run And Debug.handleResumed', params);
1320
+ await invoke('Run And Debug.handleResumed', params);
1326
1321
  };
1327
1322
  const openWidget = async name => {
1328
- await invoke$1('Viewlet.openWidget', name);
1323
+ await invoke('Viewlet.openWidget', name);
1329
1324
  };
1330
1325
  const getIcons = async requests => {
1331
- const icons = await invoke$1('IconTheme.getIcons', requests);
1326
+ const icons = await invoke('IconTheme.getIcons', requests);
1332
1327
  return icons;
1333
1328
  };
1334
1329
  const activateByEvent = event => {
1335
- return invoke$1('ExtensionHostManagement.activateByEvent', event);
1330
+ return invoke('ExtensionHostManagement.activateByEvent', event);
1336
1331
  };
1337
1332
  const setAdditionalFocus = focusKey => {
1338
1333
  // @ts-ignore
1339
- return invoke$1('Focus.setAdditionalFocus', focusKey);
1334
+ return invoke('Focus.setAdditionalFocus', focusKey);
1340
1335
  };
1341
1336
  const getActiveEditorId = () => {
1342
1337
  // @ts-ignore
1343
- return invoke$1('GetActiveEditor.getActiveEditorId');
1338
+ return invoke('GetActiveEditor.getActiveEditorId');
1344
1339
  };
1345
1340
  const getWorkspacePath = () => {
1346
- return invoke$1('Workspace.getPath');
1341
+ return invoke('Workspace.getPath');
1347
1342
  };
1348
1343
  const sendMessagePortToRendererProcess = async port => {
1349
1344
  const command = 'HandleMessagePort.handleMessagePort';
@@ -1351,20 +1346,20 @@ const sendMessagePortToRendererProcess = async port => {
1351
1346
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1352
1347
  };
1353
1348
  const getPreference = async key => {
1354
- return await invoke$1('Preferences.get', key);
1349
+ return await invoke('Preferences.get', key);
1355
1350
  };
1356
1351
  const getAllExtensions = async () => {
1357
- return invoke$1('ExtensionManagement.getAllExtensions');
1352
+ return invoke('ExtensionManagement.getAllExtensions');
1358
1353
  };
1359
1354
  const rerenderEditor = async key => {
1360
1355
  // @ts-ignore
1361
- return invoke$1('Editor.rerender', key);
1356
+ return invoke('Editor.rerender', key);
1362
1357
  };
1363
1358
  const handleDebugPaused = async params => {
1364
- await invoke$1('Run And Debug.handlePaused', params);
1359
+ await invoke('Run And Debug.handlePaused', params);
1365
1360
  };
1366
1361
  const openUri = async (uri, focus, options) => {
1367
- await invoke$1('Main.openUri', uri, focus, options);
1362
+ await invoke('Main.openUri', uri, focus, options);
1368
1363
  };
1369
1364
  const sendMessagePortToSyntaxHighlightingWorker = async port => {
1370
1365
  await invokeAndTransfer(
@@ -1372,76 +1367,76 @@ const sendMessagePortToSyntaxHighlightingWorker = async port => {
1372
1367
  'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1373
1368
  };
1374
1369
  const handleDebugScriptParsed = async script => {
1375
- await invoke$1('Run And Debug.handleScriptParsed', script);
1370
+ await invoke('Run And Debug.handleScriptParsed', script);
1376
1371
  };
1377
1372
  const getWindowId = async () => {
1378
- return invoke$1('GetWindowId.getWindowId');
1373
+ return invoke('GetWindowId.getWindowId');
1379
1374
  };
1380
1375
  const getBlob = async uri => {
1381
1376
  // @ts-ignore
1382
- return invoke$1('FileSystem.getBlob', uri);
1377
+ return invoke('FileSystem.getBlob', uri);
1383
1378
  };
1384
1379
  const getExtensionCommands = async () => {
1385
- return invoke$1('ExtensionHost.getCommands');
1380
+ return invoke('ExtensionHost.getCommands');
1386
1381
  };
1387
1382
  const showErrorDialog = async errorInfo => {
1388
1383
  // @ts-ignore
1389
- await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
1384
+ await invoke('ErrorHandling.showErrorDialog', errorInfo);
1390
1385
  };
1391
1386
  const getFolderSize = async uri => {
1392
1387
  // @ts-ignore
1393
- return await invoke$1('FileSystem.getFolderSize', uri);
1388
+ return await invoke('FileSystem.getFolderSize', uri);
1394
1389
  };
1395
1390
  const getExtension = async id => {
1396
1391
  // @ts-ignore
1397
- return invoke$1('ExtensionManagement.getExtension', id);
1392
+ return invoke('ExtensionManagement.getExtension', id);
1398
1393
  };
1399
1394
  const getMarkdownDom = async html => {
1400
1395
  // @ts-ignore
1401
- return invoke$1('Markdown.getVirtualDom', html);
1396
+ return invoke('Markdown.getVirtualDom', html);
1402
1397
  };
1403
1398
  const renderMarkdown = async (markdown, options) => {
1404
1399
  // @ts-ignore
1405
- return invoke$1('Markdown.renderMarkdown', markdown, options);
1400
+ return invoke('Markdown.renderMarkdown', markdown, options);
1406
1401
  };
1407
1402
  const openNativeFolder = async uri => {
1408
1403
  // @ts-ignore
1409
- await invoke$1('OpenNativeFolder.openNativeFolder', uri);
1404
+ await invoke('OpenNativeFolder.openNativeFolder', uri);
1410
1405
  };
1411
1406
  const uninstallExtension = async id => {
1412
- return invoke$1('ExtensionManagement.uninstall', id);
1407
+ return invoke('ExtensionManagement.uninstall', id);
1413
1408
  };
1414
1409
  const installExtension = async id => {
1415
1410
  // @ts-ignore
1416
- return invoke$1('ExtensionManagement.install', id);
1411
+ return invoke('ExtensionManagement.install', id);
1417
1412
  };
1418
1413
  const openExtensionSearch = async () => {
1419
1414
  // @ts-ignore
1420
- return invoke$1('SideBar.openViewlet', 'Extensions');
1415
+ return invoke('SideBar.openViewlet', 'Extensions');
1421
1416
  };
1422
1417
  const setExtensionsSearchValue = async searchValue => {
1423
1418
  // @ts-ignore
1424
- return invoke$1('Extensions.handleInput', searchValue);
1419
+ return invoke('Extensions.handleInput', searchValue);
1425
1420
  };
1426
1421
  const openExternal = async uri => {
1427
1422
  // @ts-ignore
1428
- await invoke$1('Open.openExternal', uri);
1423
+ await invoke('Open.openExternal', uri);
1429
1424
  };
1430
1425
  const openUrl = async uri => {
1431
1426
  // @ts-ignore
1432
- await invoke$1('Open.openUrl', uri);
1427
+ await invoke('Open.openUrl', uri);
1433
1428
  };
1434
1429
  const getAllPreferences = async () => {
1435
1430
  // @ts-ignore
1436
- return invoke$1('Preferences.getAll');
1431
+ return invoke('Preferences.getAll');
1437
1432
  };
1438
1433
  const showSaveFilePicker = async () => {
1439
1434
  // @ts-ignore
1440
- return invoke$1('FilePicker.showSaveFilePicker');
1435
+ return invoke('FilePicker.showSaveFilePicker');
1441
1436
  };
1442
1437
  const getLogsDir = async () => {
1443
1438
  // @ts-ignore
1444
- return invoke$1('PlatformPaths.getLogsDir');
1439
+ return invoke('PlatformPaths.getLogsDir');
1445
1440
  };
1446
1441
  const registerMockRpc = commandMap => {
1447
1442
  const mockRpc = createMockRpc({
@@ -1490,7 +1485,7 @@ const RendererWorker = {
1490
1485
  handleDebugResumed,
1491
1486
  handleDebugScriptParsed,
1492
1487
  installExtension,
1493
- invoke: invoke$1,
1488
+ invoke,
1494
1489
  invokeAndTransfer,
1495
1490
  openExtensionSearch,
1496
1491
  openExternal,
@@ -1532,34 +1527,42 @@ const RendererWorker = {
1532
1527
  writeClipBoardText
1533
1528
  };
1534
1529
 
1535
- const {
1536
- set,
1537
- invoke
1538
- } = RendererWorker;
1530
+ const show$1 = async (x, y, id, ...args) => {
1531
+ await showContextMenu(x, y, id, args);
1532
+ };
1539
1533
 
1540
- const handleClickOther = async (state, x, y, viewletId) => {
1541
- // TODO ask renderer worker asynchronously if sidebar is visible
1534
+ const handleClickAdditionalViews = async (state, x, y, viewletId) => {
1535
+ await show$1(x, y, ActivityBarAdditionalViews);
1536
+ return state;
1537
+ };
1538
+
1539
+ const show = async id => {
1540
+ // @ts-ignore
1541
+ await invoke('Layout.showSideBar', /* id */id);
1542
+ };
1543
+ const hide = async () => {
1544
+ await invoke('Layout.hideSideBar');
1545
+ };
1542
1546
 
1547
+ const handleClickOther = async (state, x, y, viewletId) => {
1543
1548
  const {
1544
1549
  sideBarVisible,
1545
1550
  currentViewletId
1546
1551
  } = state;
1547
1552
  if (sideBarVisible) {
1548
1553
  if (currentViewletId === viewletId) {
1549
- await invoke('Layout.hideSideBar');
1554
+ await hide();
1550
1555
  } else {
1551
- await invoke(/* SideBar.show */'SideBar.show', /* id */viewletId);
1556
+ await show(viewletId);
1552
1557
  }
1553
1558
  } else {
1554
- // TODO should show side bar with viewletId
1555
- // @ts-ignore
1556
- await invoke('Layout.showSideBar');
1559
+ await show(currentViewletId);
1557
1560
  }
1558
1561
  return state;
1559
1562
  };
1560
1563
 
1561
1564
  const handleClickSettings = async (state, x, y, viewletId) => {
1562
- await show();
1565
+ await show$1(x, y, Settings$1);
1563
1566
  return state;
1564
1567
  };
1565
1568
 
@@ -1577,9 +1580,9 @@ const handleClickIndex = async (state, button, index, x, y) => {
1577
1580
  const viewletId = item.id;
1578
1581
  switch (viewletId) {
1579
1582
  case 'Settings':
1580
- return handleClickSettings(state);
1583
+ return handleClickSettings(state, x, y);
1581
1584
  case 'Additional Views':
1582
- return handleClickAdditionalViews(state);
1585
+ return handleClickAdditionalViews(state, x, y);
1583
1586
  default:
1584
1587
  return handleClickOther(state, x, y, viewletId);
1585
1588
  }
@@ -1596,7 +1599,7 @@ const handleClick = async (state, button, eventX, eventY) => {
1596
1599
  };
1597
1600
 
1598
1601
  const handleContextMenu = async (state, button, x, y) => {
1599
- await show();
1602
+ await show$1(x, y, ActivityBar$3);
1600
1603
  return state;
1601
1604
  };
1602
1605
 
@@ -1614,10 +1617,14 @@ const findIndex = (activityBarItems, id) => {
1614
1617
  };
1615
1618
 
1616
1619
  const handleSideBarViewletChange = (state, id, ...args) => {
1617
- const index = findIndex(state.activityBarItems, id);
1620
+ const {
1621
+ activityBarItems
1622
+ } = state;
1623
+ const index = findIndex(activityBarItems, id);
1618
1624
  return {
1619
1625
  ...state,
1620
- selectedIndex: index
1626
+ selectedIndex: index,
1627
+ currentViewletId: id
1621
1628
  };
1622
1629
  };
1623
1630
 
@@ -1941,7 +1948,8 @@ const renderEventListeners = () => {
1941
1948
  params: ['handleFocus']
1942
1949
  }, {
1943
1950
  name: HandleContextMenu,
1944
- params: ['handleContextMenu', Button$1, ClientX, ClientY]
1951
+ params: ['handleContextMenu', Button$1, ClientX, ClientY],
1952
+ preventDefault: true
1945
1953
  }, {
1946
1954
  name: HandleMouseDown,
1947
1955
  params: ['handleClick', Button$1, ClientX, ClientY],
@@ -1983,6 +1991,9 @@ const commandMap = {
1983
1991
  'ActivityBar.terminate': terminate
1984
1992
  };
1985
1993
 
1994
+ const {
1995
+ set} = RendererWorker;
1996
+
1986
1997
  const listen = async () => {
1987
1998
  registerCommands(commandMap);
1988
1999
  const rpc = await WebWorkerRpcClient.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/activity-bar-worker",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",