@lvce-editor/output-view 1.1.0 → 1.3.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.
- package/dist/outputViewWorkerMain.js +532 -51
- package/package.json +1 -1
|
@@ -940,6 +940,7 @@ const {
|
|
|
940
940
|
const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
|
|
941
941
|
const state = {
|
|
942
942
|
uid: id,
|
|
943
|
+
uri,
|
|
943
944
|
focusedIndex: -2,
|
|
944
945
|
message: '',
|
|
945
946
|
itemHeight: 22,
|
|
@@ -953,8 +954,11 @@ const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
|
|
|
953
954
|
maxLineY: 0,
|
|
954
955
|
listItems: [],
|
|
955
956
|
collapsedUris: [],
|
|
957
|
+
selectedOption: '',
|
|
956
958
|
smallWidthBreakPoint: 650,
|
|
957
|
-
workspaceUri
|
|
959
|
+
workspaceUri,
|
|
960
|
+
options: [],
|
|
961
|
+
error: ''
|
|
958
962
|
};
|
|
959
963
|
set$1(id, state, state);
|
|
960
964
|
};
|
|
@@ -964,7 +968,7 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
964
968
|
};
|
|
965
969
|
|
|
966
970
|
const isEqual = (oldState, newState) => {
|
|
967
|
-
return oldState.filterValue === newState.filterValue && oldState.message === newState.message;
|
|
971
|
+
return oldState.filterValue === newState.filterValue && oldState.message === newState.message && oldState.options === newState.options && oldState.listItems === newState.listItems;
|
|
968
972
|
};
|
|
969
973
|
|
|
970
974
|
const RenderItems = 1;
|
|
@@ -1037,14 +1041,25 @@ const KeyCode = {
|
|
|
1037
1041
|
Space,
|
|
1038
1042
|
UpArrow
|
|
1039
1043
|
};
|
|
1044
|
+
const mergeClassNames = (...classNames) => {
|
|
1045
|
+
return classNames.filter(Boolean).join(' ');
|
|
1046
|
+
};
|
|
1040
1047
|
const Div = 4;
|
|
1048
|
+
const Text = 12;
|
|
1041
1049
|
const VirtualDomElements = {
|
|
1042
1050
|
__proto__: null,
|
|
1043
1051
|
Div};
|
|
1052
|
+
const text = data => {
|
|
1053
|
+
return {
|
|
1054
|
+
type: Text,
|
|
1055
|
+
text: data,
|
|
1056
|
+
childCount: 0
|
|
1057
|
+
};
|
|
1058
|
+
};
|
|
1044
1059
|
|
|
1045
1060
|
const FocusProblems = 19;
|
|
1046
1061
|
|
|
1047
|
-
const getKeyBindings = () => {
|
|
1062
|
+
const getKeyBindings$1 = () => {
|
|
1048
1063
|
return [{
|
|
1049
1064
|
key: KeyCode.DownArrow,
|
|
1050
1065
|
command: 'Problems.focusNext',
|
|
@@ -1108,6 +1123,391 @@ const handleError = async state => {
|
|
|
1108
1123
|
|
|
1109
1124
|
const initialize = async () => {};
|
|
1110
1125
|
|
|
1126
|
+
const getSelectedItem = platform => {
|
|
1127
|
+
return 'file:///tmp/log-main-process.txt';
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
const rpcs = Object.create(null);
|
|
1131
|
+
const set$g = (id, rpc) => {
|
|
1132
|
+
rpcs[id] = rpc;
|
|
1133
|
+
};
|
|
1134
|
+
const get = id => {
|
|
1135
|
+
return rpcs[id];
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1139
|
+
|
|
1140
|
+
const create = rpcId => {
|
|
1141
|
+
return {
|
|
1142
|
+
// @ts-ignore
|
|
1143
|
+
invoke(method, ...params) {
|
|
1144
|
+
const rpc = get(rpcId);
|
|
1145
|
+
// @ts-ignore
|
|
1146
|
+
return rpc.invoke(method, ...params);
|
|
1147
|
+
},
|
|
1148
|
+
// @ts-ignore
|
|
1149
|
+
invokeAndTransfer(method, ...params) {
|
|
1150
|
+
const rpc = get(rpcId);
|
|
1151
|
+
// @ts-ignore
|
|
1152
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1153
|
+
},
|
|
1154
|
+
set(rpc) {
|
|
1155
|
+
set$g(rpcId, rpc);
|
|
1156
|
+
},
|
|
1157
|
+
async dispose() {
|
|
1158
|
+
const rpc = get(rpcId);
|
|
1159
|
+
await rpc.dispose();
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
};
|
|
1163
|
+
const DebugWorker$1 = 55;
|
|
1164
|
+
const RendererWorker$1 = 1;
|
|
1165
|
+
const {
|
|
1166
|
+
invoke: invoke$3,
|
|
1167
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1168
|
+
set: set$3,
|
|
1169
|
+
dispose: dispose$3
|
|
1170
|
+
} = create(RendererWorker$1);
|
|
1171
|
+
const searchFileHtml = async uri => {
|
|
1172
|
+
return invoke$3('ExtensionHost.searchFileWithHtml', uri);
|
|
1173
|
+
};
|
|
1174
|
+
const getFilePathElectron = async file => {
|
|
1175
|
+
return invoke$3('FileSystemHandle.getFilePathElectron', file);
|
|
1176
|
+
};
|
|
1177
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
1178
|
+
return invoke$3('ContextMenu.show', x, y, id, ...args);
|
|
1179
|
+
};
|
|
1180
|
+
const getElectronVersion = async () => {
|
|
1181
|
+
return invoke$3('Process.getElectronVersion');
|
|
1182
|
+
};
|
|
1183
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
1184
|
+
await invoke$3('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1185
|
+
};
|
|
1186
|
+
const setColorTheme = async id => {
|
|
1187
|
+
// @ts-ignore
|
|
1188
|
+
return invoke$3(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1189
|
+
};
|
|
1190
|
+
const getNodeVersion = async () => {
|
|
1191
|
+
return invoke$3('Process.getNodeVersion');
|
|
1192
|
+
};
|
|
1193
|
+
const getChromeVersion = async () => {
|
|
1194
|
+
return invoke$3('Process.getChromeVersion');
|
|
1195
|
+
};
|
|
1196
|
+
const getV8Version = async () => {
|
|
1197
|
+
return invoke$3('Process.getV8Version');
|
|
1198
|
+
};
|
|
1199
|
+
const getFileHandles = async fileIds => {
|
|
1200
|
+
const files = await invoke$3('FileSystemHandle.getFileHandles', fileIds);
|
|
1201
|
+
return files;
|
|
1202
|
+
};
|
|
1203
|
+
const setWorkspacePath = async path => {
|
|
1204
|
+
await invoke$3('Workspace.setPath', path);
|
|
1205
|
+
};
|
|
1206
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
1207
|
+
await invokeAndTransfer$3('WebView.registerInterceptor', id, port);
|
|
1208
|
+
};
|
|
1209
|
+
const unregisterWebViewInterceptor = async id => {
|
|
1210
|
+
await invoke$3('WebView.unregisterInterceptor', id);
|
|
1211
|
+
};
|
|
1212
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1213
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1214
|
+
// @ts-ignore
|
|
1215
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1216
|
+
};
|
|
1217
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1218
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1219
|
+
// @ts-ignore
|
|
1220
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1221
|
+
};
|
|
1222
|
+
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1223
|
+
const command = 'Markdown.handleMessagePort';
|
|
1224
|
+
// @ts-ignore
|
|
1225
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1226
|
+
};
|
|
1227
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1228
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1229
|
+
// @ts-ignore
|
|
1230
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1231
|
+
};
|
|
1232
|
+
const readFile = async uri => {
|
|
1233
|
+
return invoke$3('FileSystem.readFile', uri);
|
|
1234
|
+
};
|
|
1235
|
+
const getWebViewSecret = async key => {
|
|
1236
|
+
// @ts-ignore
|
|
1237
|
+
return invoke$3('WebView.getSecret', key);
|
|
1238
|
+
};
|
|
1239
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1240
|
+
return invokeAndTransfer$3('WebView.setPort', uid, port, origin, portType);
|
|
1241
|
+
};
|
|
1242
|
+
const setFocus = key => {
|
|
1243
|
+
return invoke$3('Focus.setFocus', key);
|
|
1244
|
+
};
|
|
1245
|
+
const getFileIcon = async options => {
|
|
1246
|
+
return invoke$3('IconTheme.getFileIcon', options);
|
|
1247
|
+
};
|
|
1248
|
+
const getColorThemeNames = async () => {
|
|
1249
|
+
return invoke$3('ColorTheme.getColorThemeNames');
|
|
1250
|
+
};
|
|
1251
|
+
const disableExtension = async id => {
|
|
1252
|
+
return invoke$3('ExtensionManagement.disable', id);
|
|
1253
|
+
};
|
|
1254
|
+
const enableExtension = async id => {
|
|
1255
|
+
// @ts-ignore
|
|
1256
|
+
return invoke$3('ExtensionManagement.enable', id);
|
|
1257
|
+
};
|
|
1258
|
+
const handleDebugChange = async params => {
|
|
1259
|
+
// @ts-ignore
|
|
1260
|
+
return invoke$3('Run And Debug.handleChange', params);
|
|
1261
|
+
};
|
|
1262
|
+
const getFolderIcon = async options => {
|
|
1263
|
+
return invoke$3('IconTheme.getFolderIcon', options);
|
|
1264
|
+
};
|
|
1265
|
+
const closeWidget = async widgetId => {
|
|
1266
|
+
return invoke$3('Viewlet.closeWidget', widgetId);
|
|
1267
|
+
};
|
|
1268
|
+
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1269
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1270
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1271
|
+
};
|
|
1272
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1273
|
+
await invokeAndTransfer$3('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1274
|
+
};
|
|
1275
|
+
const confirm = async (message, options) => {
|
|
1276
|
+
// @ts-ignore
|
|
1277
|
+
const result = await invoke$3('Confirmprompt.prompt', message, options);
|
|
1278
|
+
return result;
|
|
1279
|
+
};
|
|
1280
|
+
const getRecentlyOpened = async () => {
|
|
1281
|
+
return invoke$3(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1282
|
+
};
|
|
1283
|
+
const getKeyBindings = async () => {
|
|
1284
|
+
return invoke$3('KeyBindingsInitial.getKeyBindings');
|
|
1285
|
+
};
|
|
1286
|
+
const writeClipBoardText = async text => {
|
|
1287
|
+
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
1288
|
+
};
|
|
1289
|
+
const writeClipBoardImage = async blob => {
|
|
1290
|
+
// @ts-ignore
|
|
1291
|
+
await invoke$3('ClipBoard.writeImage', /* text */blob);
|
|
1292
|
+
};
|
|
1293
|
+
const searchFileMemory = async uri => {
|
|
1294
|
+
// @ts-ignore
|
|
1295
|
+
return invoke$3('ExtensionHost.searchFileWithMemory', uri);
|
|
1296
|
+
};
|
|
1297
|
+
const searchFileFetch = async uri => {
|
|
1298
|
+
return invoke$3('ExtensionHost.searchFileWithFetch', uri);
|
|
1299
|
+
};
|
|
1300
|
+
const showMessageBox = async options => {
|
|
1301
|
+
return invoke$3('ElectronDialog.showMessageBox', options);
|
|
1302
|
+
};
|
|
1303
|
+
const handleDebugResumed = async params => {
|
|
1304
|
+
await invoke$3('Run And Debug.handleResumed', params);
|
|
1305
|
+
};
|
|
1306
|
+
const openWidget = async name => {
|
|
1307
|
+
await invoke$3('Viewlet.openWidget', name);
|
|
1308
|
+
};
|
|
1309
|
+
const getIcons = async requests => {
|
|
1310
|
+
const icons = await invoke$3('IconTheme.getIcons', requests);
|
|
1311
|
+
return icons;
|
|
1312
|
+
};
|
|
1313
|
+
const activateByEvent = event => {
|
|
1314
|
+
return invoke$3('ExtensionHostManagement.activateByEvent', event);
|
|
1315
|
+
};
|
|
1316
|
+
const setAdditionalFocus = focusKey => {
|
|
1317
|
+
// @ts-ignore
|
|
1318
|
+
return invoke$3('Focus.setAdditionalFocus', focusKey);
|
|
1319
|
+
};
|
|
1320
|
+
const getActiveEditorId = () => {
|
|
1321
|
+
// @ts-ignore
|
|
1322
|
+
return invoke$3('GetActiveEditor.getActiveEditorId');
|
|
1323
|
+
};
|
|
1324
|
+
const getWorkspacePath = () => {
|
|
1325
|
+
return invoke$3('Workspace.getPath');
|
|
1326
|
+
};
|
|
1327
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1328
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1329
|
+
// @ts-ignore
|
|
1330
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker$1);
|
|
1331
|
+
};
|
|
1332
|
+
const getPreference = async key => {
|
|
1333
|
+
return await invoke$3('Preferences.get', key);
|
|
1334
|
+
};
|
|
1335
|
+
const getAllExtensions = async () => {
|
|
1336
|
+
return invoke$3('ExtensionManagement.getAllExtensions');
|
|
1337
|
+
};
|
|
1338
|
+
const rerenderEditor = async key => {
|
|
1339
|
+
// @ts-ignore
|
|
1340
|
+
return invoke$3('Editor.rerender', key);
|
|
1341
|
+
};
|
|
1342
|
+
const handleDebugPaused = async params => {
|
|
1343
|
+
await invoke$3('Run And Debug.handlePaused', params);
|
|
1344
|
+
};
|
|
1345
|
+
const openUri = async (uri, focus, options) => {
|
|
1346
|
+
await invoke$3('Main.openUri', uri, focus, options);
|
|
1347
|
+
};
|
|
1348
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1349
|
+
await invokeAndTransfer$3(
|
|
1350
|
+
// @ts-ignore
|
|
1351
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1352
|
+
};
|
|
1353
|
+
const handleDebugScriptParsed = async script => {
|
|
1354
|
+
await invoke$3('Run And Debug.handleScriptParsed', script);
|
|
1355
|
+
};
|
|
1356
|
+
const getWindowId = async () => {
|
|
1357
|
+
return invoke$3('GetWindowId.getWindowId');
|
|
1358
|
+
};
|
|
1359
|
+
const getBlob = async uri => {
|
|
1360
|
+
// @ts-ignore
|
|
1361
|
+
return invoke$3('FileSystem.getBlob', uri);
|
|
1362
|
+
};
|
|
1363
|
+
const getExtensionCommands = async () => {
|
|
1364
|
+
return invoke$3('ExtensionHost.getCommands');
|
|
1365
|
+
};
|
|
1366
|
+
const showErrorDialog = async errorInfo => {
|
|
1367
|
+
// @ts-ignore
|
|
1368
|
+
await invoke$3('ErrorHandling.showErrorDialog', errorInfo);
|
|
1369
|
+
};
|
|
1370
|
+
const getFolderSize = async uri => {
|
|
1371
|
+
// @ts-ignore
|
|
1372
|
+
return await invoke$3('FileSystem.getFolderSize', uri);
|
|
1373
|
+
};
|
|
1374
|
+
const getExtension = async id => {
|
|
1375
|
+
// @ts-ignore
|
|
1376
|
+
return invoke$3('ExtensionManagement.getExtension', id);
|
|
1377
|
+
};
|
|
1378
|
+
const getMarkdownDom = async html => {
|
|
1379
|
+
// @ts-ignore
|
|
1380
|
+
return invoke$3('Markdown.getVirtualDom', html);
|
|
1381
|
+
};
|
|
1382
|
+
const renderMarkdown = async (markdown, options) => {
|
|
1383
|
+
// @ts-ignore
|
|
1384
|
+
return invoke$3('Markdown.renderMarkdown', markdown, options);
|
|
1385
|
+
};
|
|
1386
|
+
const openNativeFolder = async uri => {
|
|
1387
|
+
// @ts-ignore
|
|
1388
|
+
await invoke$3('OpenNativeFolder.openNativeFolder', uri);
|
|
1389
|
+
};
|
|
1390
|
+
const uninstallExtension = async id => {
|
|
1391
|
+
return invoke$3('ExtensionManagement.uninstall', id);
|
|
1392
|
+
};
|
|
1393
|
+
const installExtension = async id => {
|
|
1394
|
+
// @ts-ignore
|
|
1395
|
+
return invoke$3('ExtensionManagement.install', id);
|
|
1396
|
+
};
|
|
1397
|
+
const openExtensionSearch = async () => {
|
|
1398
|
+
// @ts-ignore
|
|
1399
|
+
return invoke$3('SideBar.openViewlet', 'Extensions');
|
|
1400
|
+
};
|
|
1401
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
1402
|
+
// @ts-ignore
|
|
1403
|
+
return invoke$3('Extensions.handleInput', searchValue);
|
|
1404
|
+
};
|
|
1405
|
+
const openExternal = async uri => {
|
|
1406
|
+
// @ts-ignore
|
|
1407
|
+
await invoke$3('Open.openExternal', uri);
|
|
1408
|
+
};
|
|
1409
|
+
const openUrl = async uri => {
|
|
1410
|
+
// @ts-ignore
|
|
1411
|
+
await invoke$3('Open.openUrl', uri);
|
|
1412
|
+
};
|
|
1413
|
+
const getAllPreferences = async () => {
|
|
1414
|
+
// @ts-ignore
|
|
1415
|
+
return invoke$3('Preferences.getAll');
|
|
1416
|
+
};
|
|
1417
|
+
const RendererWorker = {
|
|
1418
|
+
__proto__: null,
|
|
1419
|
+
activateByEvent,
|
|
1420
|
+
applyBulkReplacement,
|
|
1421
|
+
closeWidget,
|
|
1422
|
+
confirm,
|
|
1423
|
+
disableExtension,
|
|
1424
|
+
dispose: dispose$3,
|
|
1425
|
+
enableExtension,
|
|
1426
|
+
getActiveEditorId,
|
|
1427
|
+
getAllExtensions,
|
|
1428
|
+
getAllPreferences,
|
|
1429
|
+
getBlob,
|
|
1430
|
+
getChromeVersion,
|
|
1431
|
+
getColorThemeNames,
|
|
1432
|
+
getElectronVersion,
|
|
1433
|
+
getExtension,
|
|
1434
|
+
getExtensionCommands,
|
|
1435
|
+
getFileHandles,
|
|
1436
|
+
getFileIcon,
|
|
1437
|
+
getFilePathElectron,
|
|
1438
|
+
getFolderIcon,
|
|
1439
|
+
getFolderSize,
|
|
1440
|
+
getIcons,
|
|
1441
|
+
getKeyBindings,
|
|
1442
|
+
getMarkdownDom,
|
|
1443
|
+
getNodeVersion,
|
|
1444
|
+
getPreference,
|
|
1445
|
+
getRecentlyOpened,
|
|
1446
|
+
getV8Version,
|
|
1447
|
+
getWebViewSecret,
|
|
1448
|
+
getWindowId,
|
|
1449
|
+
getWorkspacePath,
|
|
1450
|
+
handleDebugChange,
|
|
1451
|
+
handleDebugPaused,
|
|
1452
|
+
handleDebugResumed,
|
|
1453
|
+
handleDebugScriptParsed,
|
|
1454
|
+
installExtension,
|
|
1455
|
+
invoke: invoke$3,
|
|
1456
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1457
|
+
openExtensionSearch,
|
|
1458
|
+
openExternal,
|
|
1459
|
+
openNativeFolder,
|
|
1460
|
+
openUri,
|
|
1461
|
+
openUrl,
|
|
1462
|
+
openWidget,
|
|
1463
|
+
readFile,
|
|
1464
|
+
registerWebViewInterceptor,
|
|
1465
|
+
renderMarkdown,
|
|
1466
|
+
rerenderEditor,
|
|
1467
|
+
searchFileFetch,
|
|
1468
|
+
searchFileHtml,
|
|
1469
|
+
searchFileMemory,
|
|
1470
|
+
sendMessagePortToEditorWorker,
|
|
1471
|
+
sendMessagePortToErrorWorker,
|
|
1472
|
+
sendMessagePortToExtensionHostWorker,
|
|
1473
|
+
sendMessagePortToFileSystemWorker,
|
|
1474
|
+
sendMessagePortToMarkdownWorker,
|
|
1475
|
+
sendMessagePortToRendererProcess,
|
|
1476
|
+
sendMessagePortToSearchProcess,
|
|
1477
|
+
sendMessagePortToSyntaxHighlightingWorker,
|
|
1478
|
+
set: set$3,
|
|
1479
|
+
setAdditionalFocus,
|
|
1480
|
+
setColorTheme,
|
|
1481
|
+
setExtensionsSearchValue,
|
|
1482
|
+
setFocus,
|
|
1483
|
+
setWebViewPort,
|
|
1484
|
+
setWorkspacePath,
|
|
1485
|
+
showContextMenu,
|
|
1486
|
+
showErrorDialog,
|
|
1487
|
+
showMessageBox,
|
|
1488
|
+
uninstallExtension,
|
|
1489
|
+
unregisterWebViewInterceptor,
|
|
1490
|
+
writeClipBoardImage,
|
|
1491
|
+
writeClipBoardText
|
|
1492
|
+
};
|
|
1493
|
+
|
|
1494
|
+
const loadLines = async uri => {
|
|
1495
|
+
try {
|
|
1496
|
+
// TODO use log stream, updating the output when the file is changed
|
|
1497
|
+
const content = await RendererWorker.invoke('FileSystem.readFile', uri);
|
|
1498
|
+
const lines = content.split('\n');
|
|
1499
|
+
return {
|
|
1500
|
+
error: '',
|
|
1501
|
+
lines
|
|
1502
|
+
};
|
|
1503
|
+
} catch (error) {
|
|
1504
|
+
return {
|
|
1505
|
+
error: `${error}`,
|
|
1506
|
+
lines: []
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1510
|
+
|
|
1111
1511
|
const isString = value => {
|
|
1112
1512
|
return typeof value === 'string';
|
|
1113
1513
|
};
|
|
@@ -1119,11 +1519,19 @@ const getSavedCollapsedUris = savedState => {
|
|
|
1119
1519
|
};
|
|
1120
1520
|
const loadContent = async (state, savedState) => {
|
|
1121
1521
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
1522
|
+
const selectedUri = getSelectedItem();
|
|
1523
|
+
const {
|
|
1524
|
+
lines,
|
|
1525
|
+
error
|
|
1526
|
+
} = await loadLines(selectedUri);
|
|
1122
1527
|
return {
|
|
1123
1528
|
...state,
|
|
1124
1529
|
inputSource: Script,
|
|
1125
|
-
listItems:
|
|
1126
|
-
collapsedUris
|
|
1530
|
+
listItems: lines,
|
|
1531
|
+
collapsedUris,
|
|
1532
|
+
options: [],
|
|
1533
|
+
selectedOption: selectedUri,
|
|
1534
|
+
error
|
|
1127
1535
|
};
|
|
1128
1536
|
};
|
|
1129
1537
|
|
|
@@ -1134,15 +1542,129 @@ const openFindWidget = async state => {
|
|
|
1134
1542
|
};
|
|
1135
1543
|
};
|
|
1136
1544
|
|
|
1545
|
+
const Button = 1;
|
|
1546
|
+
const Select = 2;
|
|
1547
|
+
|
|
1548
|
+
const Blank = 'Blank';
|
|
1549
|
+
const ClearAll = 'ClearAll';
|
|
1550
|
+
|
|
1551
|
+
const emptyObject = {};
|
|
1552
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1553
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1554
|
+
if (placeholders === emptyObject) {
|
|
1555
|
+
return key;
|
|
1556
|
+
}
|
|
1557
|
+
const replacer = (match, rest) => {
|
|
1558
|
+
return placeholders[rest];
|
|
1559
|
+
};
|
|
1560
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1561
|
+
};
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* @enum {string}
|
|
1565
|
+
*/
|
|
1566
|
+
const UiStrings = {
|
|
1567
|
+
Output: 'output',
|
|
1568
|
+
ClearOutput: 'clear output',
|
|
1569
|
+
TurnOffAutoScroll: 'Turn auto scrolling off',
|
|
1570
|
+
OpenLogFile: 'open output log file'
|
|
1571
|
+
};
|
|
1572
|
+
const output = () => {
|
|
1573
|
+
return i18nString(UiStrings.Output);
|
|
1574
|
+
};
|
|
1575
|
+
const clearOutput = () => {
|
|
1576
|
+
return i18nString(UiStrings.ClearOutput);
|
|
1577
|
+
};
|
|
1578
|
+
const turnOffAutoScroll = () => {
|
|
1579
|
+
return i18nString(UiStrings.TurnOffAutoScroll);
|
|
1580
|
+
};
|
|
1581
|
+
const openLogFile = () => {
|
|
1582
|
+
return i18nString(UiStrings.OpenLogFile);
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
const toSelectOption = option => {
|
|
1586
|
+
return option.name;
|
|
1587
|
+
};
|
|
1588
|
+
const toSelectOptions = options => {
|
|
1589
|
+
return options.map(toSelectOption);
|
|
1590
|
+
};
|
|
1591
|
+
const getActions = state => {
|
|
1592
|
+
const {
|
|
1593
|
+
options
|
|
1594
|
+
} = state;
|
|
1595
|
+
return [{
|
|
1596
|
+
type: Select,
|
|
1597
|
+
id: output(),
|
|
1598
|
+
options: toSelectOptions(options)
|
|
1599
|
+
}, {
|
|
1600
|
+
type: Button,
|
|
1601
|
+
id: clearOutput(),
|
|
1602
|
+
icon: ClearAll
|
|
1603
|
+
}, {
|
|
1604
|
+
type: Button,
|
|
1605
|
+
id: turnOffAutoScroll(),
|
|
1606
|
+
icon: Blank
|
|
1607
|
+
}, {
|
|
1608
|
+
type: Button,
|
|
1609
|
+
id: openLogFile(),
|
|
1610
|
+
icon: Blank
|
|
1611
|
+
}];
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1137
1614
|
const Filter = 'filter';
|
|
1138
1615
|
|
|
1139
1616
|
const renderFilterValue = (oldState, newState) => {
|
|
1140
1617
|
return ['Viewlet.setValueByName', Filter, newState.filterValue];
|
|
1141
1618
|
};
|
|
1142
1619
|
|
|
1620
|
+
const Actions = 'Actions';
|
|
1621
|
+
const Viewlet = 'Viewlet';
|
|
1622
|
+
const Output = 'Output';
|
|
1623
|
+
|
|
1624
|
+
const parentNode = {
|
|
1625
|
+
type: VirtualDomElements.Div,
|
|
1626
|
+
className: 'Line',
|
|
1627
|
+
childCount: 1
|
|
1628
|
+
};
|
|
1629
|
+
const getLineDom = line => {
|
|
1630
|
+
return [parentNode, text(line)];
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
const getContentDom = (lines, error) => {
|
|
1634
|
+
if (error) {
|
|
1635
|
+
return [];
|
|
1636
|
+
}
|
|
1637
|
+
return [{
|
|
1638
|
+
type: VirtualDomElements.Div,
|
|
1639
|
+
className: 'OutputContent',
|
|
1640
|
+
role: 'log',
|
|
1641
|
+
tabIndex: 0,
|
|
1642
|
+
childCount: lines.length
|
|
1643
|
+
}, ...lines.flatMap(getLineDom)];
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
const getErrorDom = error => {
|
|
1647
|
+
if (!error) {
|
|
1648
|
+
return [];
|
|
1649
|
+
}
|
|
1650
|
+
return [{
|
|
1651
|
+
type: VirtualDomElements.Div,
|
|
1652
|
+
className: 'Error',
|
|
1653
|
+
tabIndex: 0,
|
|
1654
|
+
childCount: 1
|
|
1655
|
+
}, text(error)];
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
const getOutputVirtualDom = (lines, error) => {
|
|
1659
|
+
return [{
|
|
1660
|
+
type: VirtualDomElements.Div,
|
|
1661
|
+
className: mergeClassNames(Viewlet, Output),
|
|
1662
|
+
childCount: 1
|
|
1663
|
+
}, ...getContentDom(lines, error), ...getErrorDom(error)];
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1143
1666
|
const renderItems = (oldState, newState) => {
|
|
1144
|
-
|
|
1145
|
-
const dom = [];
|
|
1667
|
+
const dom = getOutputVirtualDom(newState.listItems, newState.error);
|
|
1146
1668
|
return ['Viewlet.setDom2', dom];
|
|
1147
1669
|
};
|
|
1148
1670
|
|
|
@@ -1176,8 +1698,6 @@ const render2 = (uid, diffResult) => {
|
|
|
1176
1698
|
return commands;
|
|
1177
1699
|
};
|
|
1178
1700
|
|
|
1179
|
-
const Actions = 'Actions';
|
|
1180
|
-
|
|
1181
1701
|
const getActionsVirtualDom = actions => {
|
|
1182
1702
|
return [{
|
|
1183
1703
|
type: VirtualDomElements.Div,
|
|
@@ -1251,11 +1771,11 @@ const commandMap = {
|
|
|
1251
1771
|
'Output.diff2': diff2,
|
|
1252
1772
|
'Output.focusIndex': wrapCommand(focusIndex),
|
|
1253
1773
|
'Output.getCommandIds': getCommandIds,
|
|
1254
|
-
'Output.getKeyBindings': getKeyBindings,
|
|
1774
|
+
'Output.getKeyBindings': getKeyBindings$1,
|
|
1255
1775
|
'Output.handleData': handleData,
|
|
1256
1776
|
'Output.handleError': handleError,
|
|
1257
1777
|
'Output.initialize': initialize,
|
|
1258
|
-
'Output.
|
|
1778
|
+
'Output.loadContent2': wrapCommand(loadContent),
|
|
1259
1779
|
'Output.openFindWidget': openFindWidget,
|
|
1260
1780
|
'Output.render2': render2,
|
|
1261
1781
|
'Output.renderActions': renderActions,
|
|
@@ -1263,49 +1783,10 @@ const commandMap = {
|
|
|
1263
1783
|
'Output.resize': resize,
|
|
1264
1784
|
'Output.saveState': saveState,
|
|
1265
1785
|
'Output.setOutputChannel': setOutputChannel,
|
|
1786
|
+
'Output.getActions': getActions,
|
|
1266
1787
|
'Output.terminate': terminate
|
|
1267
1788
|
};
|
|
1268
1789
|
|
|
1269
|
-
const rpcs = Object.create(null);
|
|
1270
|
-
const set$g = (id, rpc) => {
|
|
1271
|
-
rpcs[id] = rpc;
|
|
1272
|
-
};
|
|
1273
|
-
const get = id => {
|
|
1274
|
-
return rpcs[id];
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1278
|
-
|
|
1279
|
-
const create = rpcId => {
|
|
1280
|
-
return {
|
|
1281
|
-
// @ts-ignore
|
|
1282
|
-
invoke(method, ...params) {
|
|
1283
|
-
const rpc = get(rpcId);
|
|
1284
|
-
// @ts-ignore
|
|
1285
|
-
return rpc.invoke(method, ...params);
|
|
1286
|
-
},
|
|
1287
|
-
// @ts-ignore
|
|
1288
|
-
invokeAndTransfer(method, ...params) {
|
|
1289
|
-
const rpc = get(rpcId);
|
|
1290
|
-
// @ts-ignore
|
|
1291
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1292
|
-
},
|
|
1293
|
-
set(rpc) {
|
|
1294
|
-
set$g(rpcId, rpc);
|
|
1295
|
-
},
|
|
1296
|
-
async dispose() {
|
|
1297
|
-
const rpc = get(rpcId);
|
|
1298
|
-
await rpc.dispose();
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1301
|
-
};
|
|
1302
|
-
const RendererWorker$1 = 1;
|
|
1303
|
-
const {
|
|
1304
|
-
set: set$3} = create(RendererWorker$1);
|
|
1305
|
-
const RendererWorker = {
|
|
1306
|
-
__proto__: null,
|
|
1307
|
-
set: set$3};
|
|
1308
|
-
|
|
1309
1790
|
const {
|
|
1310
1791
|
set} = RendererWorker;
|
|
1311
1792
|
|