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