@lvce-editor/output-view 1.18.0 → 2.0.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.
@@ -515,7 +515,7 @@ const create$4$1 = (method, params) => {
515
515
  };
516
516
  };
517
517
  const callbacks = Object.create(null);
518
- const set$4 = (id, fn) => {
518
+ const set$8 = (id, fn) => {
519
519
  callbacks[id] = fn;
520
520
  };
521
521
  const get$2 = id => {
@@ -534,7 +534,7 @@ const registerPromise = () => {
534
534
  resolve,
535
535
  promise
536
536
  } = Promise.withResolvers();
537
- set$4(id, resolve);
537
+ set$8(id, resolve);
538
538
  return {
539
539
  id,
540
540
  promise
@@ -879,10 +879,10 @@ const send = (transport, method, ...params) => {
879
879
  const message = create$4$1(method, params);
880
880
  transport.send(message);
881
881
  };
882
- const invoke$2 = (ipc, method, ...params) => {
882
+ const invoke$5 = (ipc, method, ...params) => {
883
883
  return invokeHelper(ipc, method, params, false);
884
884
  };
885
- const invokeAndTransfer = (ipc, method, ...params) => {
885
+ const invokeAndTransfer$3 = (ipc, method, ...params) => {
886
886
  return invokeHelper(ipc, method, params, true);
887
887
  };
888
888
 
@@ -918,10 +918,10 @@ const createRpc = ipc => {
918
918
  send(ipc, method, ...params);
919
919
  },
920
920
  invoke(method, ...params) {
921
- return invoke$2(ipc, method, ...params);
921
+ return invoke$5(ipc, method, ...params);
922
922
  },
923
923
  invokeAndTransfer(method, ...params) {
924
- return invokeAndTransfer(ipc, method, ...params);
924
+ return invokeAndTransfer$3(ipc, method, ...params);
925
925
  },
926
926
  async dispose() {
927
927
  await ipc?.dispose();
@@ -1007,6 +1007,25 @@ const WebWorkerRpcClient = {
1007
1007
  __proto__: null,
1008
1008
  create: create$4
1009
1009
  };
1010
+ const createMockRpc = ({
1011
+ commandMap
1012
+ }) => {
1013
+ const invocations = [];
1014
+ const invoke = (method, ...params) => {
1015
+ invocations.push([method, ...params]);
1016
+ const command = commandMap[method];
1017
+ if (!command) {
1018
+ throw new Error(`command ${method} not found`);
1019
+ }
1020
+ return command(...params);
1021
+ };
1022
+ const mockRpc = {
1023
+ invoke,
1024
+ invokeAndTransfer: invoke,
1025
+ invocations
1026
+ };
1027
+ return mockRpc;
1028
+ };
1010
1029
 
1011
1030
  const toCommandId = key => {
1012
1031
  const dotIndex = key.indexOf('.');
@@ -1041,10 +1060,11 @@ const create$2 = () => {
1041
1060
  wrapCommand(fn) {
1042
1061
  const wrapped = async (uid, ...args) => {
1043
1062
  const {
1063
+ oldState,
1044
1064
  newState
1045
1065
  } = states[uid];
1046
1066
  const newerState = await fn(newState, ...args);
1047
- if (newState === newerState) {
1067
+ if (oldState === newerState || newState === newerState) {
1048
1068
  return;
1049
1069
  }
1050
1070
  const latest = states[uid];
@@ -1092,16 +1112,42 @@ const terminate = () => {
1092
1112
  globalThis.close();
1093
1113
  };
1094
1114
 
1115
+ const ToolBar = 'toolbar';
1116
+
1117
+ const Button = 1;
1118
+ const Div = 4;
1119
+ const Input = 6;
1120
+ const Text$1 = 12;
1121
+ const A = 53;
1122
+ const Select$1 = 63;
1123
+ const Option$1 = 64;
1124
+
1125
+ const Space = 9;
1126
+ const PageUp = 10;
1127
+ const PageDown = 11;
1128
+ const End = 255;
1129
+ const Home = 12;
1130
+ const LeftArrow = 13;
1131
+ const UpArrow = 14;
1132
+ const RightArrow = 15;
1133
+ const DownArrow = 16;
1134
+
1135
+ const Script$1 = 2;
1136
+
1137
+ const DebugWorker = 55;
1138
+ const ExtensionHostWorker = 44;
1139
+ const FileSystemWorker$1 = 209;
1140
+ const OutputWorker = 7001;
1141
+ const RendererWorker$1 = 1;
1142
+
1095
1143
  const rpcs = Object.create(null);
1096
- const set$g = (id, rpc) => {
1144
+ const set$7 = (id, rpc) => {
1097
1145
  rpcs[id] = rpc;
1098
1146
  };
1099
1147
  const get$1 = id => {
1100
1148
  return rpcs[id];
1101
1149
  };
1102
1150
 
1103
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
1104
-
1105
1151
  const create$1 = rpcId => {
1106
1152
  return {
1107
1153
  // @ts-ignore
@@ -1117,7 +1163,7 @@ const create$1 = rpcId => {
1117
1163
  return rpc.invokeAndTransfer(method, ...params);
1118
1164
  },
1119
1165
  set(rpc) {
1120
- set$g(rpcId, rpc);
1166
+ set$7(rpcId, rpc);
1121
1167
  },
1122
1168
  async dispose() {
1123
1169
  const rpc = get$1(rpcId);
@@ -1125,168 +1171,523 @@ const create$1 = rpcId => {
1125
1171
  }
1126
1172
  };
1127
1173
  };
1128
- const DebugWorker$1 = 55;
1129
- const EditorWorker$1 = 99;
1130
- const ExtensionHostWorker = 44;
1131
- const MainProcess$1 = -5;
1132
- const RendererWorker$1 = 1;
1133
- const RendererProcess$1 = 1670;
1134
- const SearchProcess$1 = 77;
1135
- const SearchProcessElectron = 2;
1136
- const SharedProcess$1 = 1;
1137
- const SourceControlWorker = 66;
1138
- const EmbedsProcess$1 = 207;
1139
- const EmbedsWorker = 208;
1140
- const FileSystemWorker$1 = 209;
1141
- const FileSystemProcess$1 = 210;
1142
- const MarkdownWorker$1 = 300;
1143
- const CompletionWorker = 301;
1144
- const ColorPickerWorker = 302;
1145
- const SourceActionWorker = 303;
1146
- const ErrorWorker$1 = 3308;
1147
- const SyntaxHighlightingWorker$1 = 3309;
1148
- const ClipBoardWorker$1 = 3400;
1149
- const ClipBoardProcess$1 = 3401;
1150
- const ExtensionDetailWorker = 3402;
1151
- const ProblemsWorker = 3403;
1152
- const OutputWorker = 7001;
1153
- const RpcId = {
1154
- __proto__: null,
1155
- ClipBoardProcess: ClipBoardProcess$1,
1156
- ClipBoardWorker: ClipBoardWorker$1,
1157
- ColorPickerWorker,
1158
- CompletionWorker,
1159
- DebugWorker: DebugWorker$1,
1160
- EditorWorker: EditorWorker$1,
1161
- EmbedsProcess: EmbedsProcess$1,
1162
- EmbedsWorker,
1163
- ErrorWorker: ErrorWorker$1,
1164
- ExtensionDetailWorker,
1165
- ExtensionHostWorker,
1166
- FileSystemProcess: FileSystemProcess$1,
1167
- FileSystemWorker: FileSystemWorker$1,
1168
- MainProcess: MainProcess$1,
1169
- MarkdownWorker: MarkdownWorker$1,
1170
- OutputWorker,
1171
- ProblemsWorker,
1172
- RendererProcess: RendererProcess$1,
1173
- RendererWorker: RendererWorker$1,
1174
- SearchProcess: SearchProcess$1,
1175
- SearchProcessElectron,
1176
- SharedProcess: SharedProcess$1,
1177
- SourceActionWorker,
1178
- SourceControlWorker,
1179
- SyntaxHighlightingWorker: SyntaxHighlightingWorker$1
1180
- };
1174
+
1181
1175
  const {
1182
- invoke: invoke$9,
1183
- set: set$9} = create$1(ExtensionHostWorker);
1176
+ invoke: invoke$4,
1177
+ invokeAndTransfer: invokeAndTransfer$2,
1178
+ set: set$6,
1179
+ dispose: dispose$2
1180
+ } = create$1(ExtensionHostWorker);
1181
+ const executeReferenceProvider = async (id, offset) => {
1182
+ // @ts-ignore
1183
+ return invoke$4('ExtensionHostReference.executeReferenceProvider', id, offset);
1184
+ };
1185
+ const executeFileReferenceProvider = async id => {
1186
+ // @ts-ignore
1187
+ return invoke$4('ExtensionHostReference.executeFileReferenceProvider', id);
1188
+ };
1189
+ const getRuntimeStatus = async extensionId => {
1190
+ // @ts-ignore
1191
+ return invoke$4('ExtensionHost.getRuntimeStatus', extensionId);
1192
+ };
1193
+ const registerMockRpc$2 = commandMap => {
1194
+ const mockRpc = createMockRpc({
1195
+ commandMap
1196
+ });
1197
+ set$6(mockRpc);
1198
+ return mockRpc;
1199
+ };
1200
+
1184
1201
  const ExtensionHost = {
1185
1202
  __proto__: null,
1186
- invoke: invoke$9,
1187
- set: set$9
1203
+ dispose: dispose$2,
1204
+ executeFileReferenceProvider,
1205
+ executeReferenceProvider,
1206
+ getRuntimeStatus,
1207
+ invoke: invoke$4,
1208
+ invokeAndTransfer: invokeAndTransfer$2,
1209
+ registerMockRpc: registerMockRpc$2,
1210
+ set: set$6
1188
1211
  };
1212
+
1189
1213
  const {
1190
- invoke: invoke$7,
1191
- invokeAndTransfer: invokeAndTransfer$7,
1192
- set: set$7,
1193
- dispose: dispose$7
1214
+ invoke: invoke$3,
1215
+ invokeAndTransfer: invokeAndTransfer$1,
1216
+ set: set$5,
1217
+ dispose: dispose$1
1194
1218
  } = create$1(FileSystemWorker$1);
1195
1219
  const remove = async dirent => {
1196
- return invoke$7('FileSystem.remove', dirent);
1220
+ return invoke$3('FileSystem.remove', dirent);
1197
1221
  };
1198
1222
  const readDirWithFileTypes = async uri => {
1199
- return invoke$7('FileSystem.readDirWithFileTypes', uri);
1223
+ return invoke$3('FileSystem.readDirWithFileTypes', uri);
1200
1224
  };
1201
1225
  const getPathSeparator = async root => {
1202
1226
  // @ts-ignore
1203
- return invoke$7('FileSystem.getPathSeparator', root);
1227
+ return invoke$3('FileSystem.getPathSeparator', root);
1204
1228
  };
1205
1229
  const getRealPath = async path => {
1206
- return invoke$7('FileSystem.getRealPath', path);
1230
+ return invoke$3('FileSystem.getRealPath', path);
1207
1231
  };
1208
1232
  const stat = async dirent => {
1209
- return invoke$7('FileSystem.stat', dirent);
1233
+ return invoke$3('FileSystem.stat', dirent);
1210
1234
  };
1211
1235
  const createFile = async uri => {
1212
- return invoke$7('FileSystem.writeFile', uri, '');
1236
+ return invoke$3('FileSystem.writeFile', uri, '');
1213
1237
  };
1214
- const readFile$1 = async uri => {
1215
- return invoke$7('FileSystem.readFile', uri);
1238
+ const readFile$2 = async uri => {
1239
+ return invoke$3('FileSystem.readFile', uri);
1216
1240
  };
1217
1241
  const writeFile$1 = async (uri, content) => {
1218
- return invoke$7('FileSystem.writeFile', uri, content);
1242
+ return invoke$3('FileSystem.writeFile', uri, content);
1219
1243
  };
1220
1244
  const mkdir = async uri => {
1221
- return invoke$7('FileSystem.mkdir', uri);
1245
+ return invoke$3('FileSystem.mkdir', uri);
1222
1246
  };
1223
1247
  const rename = async (oldUri, newUri) => {
1224
- return invoke$7('FileSystem.rename', oldUri, newUri);
1248
+ return invoke$3('FileSystem.rename', oldUri, newUri);
1225
1249
  };
1226
1250
  const copy = async (oldUri, newUri) => {
1227
- return invoke$7('FileSystem.copy', oldUri, newUri);
1251
+ return invoke$3('FileSystem.copy', oldUri, newUri);
1228
1252
  };
1229
1253
  const exists = async uri => {
1230
1254
  // @ts-ignore
1231
- return invoke$7('FileSystem.exists', uri);
1255
+ return invoke$3('FileSystem.exists', uri);
1232
1256
  };
1233
1257
  const getFolderSize$1 = async uri => {
1234
1258
  // @ts-ignore
1235
- return invoke$7('FileSystem.getFolderSize', uri);
1259
+ return invoke$3('FileSystem.getFolderSize', uri);
1236
1260
  };
1237
1261
  const readFileAsBlob = async uri => {
1238
1262
  // @ts-ignore
1239
- return invoke$7('FileSystem.readFileAsBlob', uri);
1263
+ return invoke$3('FileSystem.readFileAsBlob', uri);
1240
1264
  };
1241
1265
  const appendFile = async (uri, text) => {
1242
1266
  // @ts-ignore
1243
- return invoke$7('FileSystem.appendFile', uri, text);
1267
+ return invoke$3('FileSystem.appendFile', uri, text);
1244
1268
  };
1269
+ const registerMockRpc$1 = commandMap => {
1270
+ const mockRpc = createMockRpc({
1271
+ commandMap
1272
+ });
1273
+ set$5(mockRpc);
1274
+ return mockRpc;
1275
+ };
1276
+
1245
1277
  const FileSystemWorker = {
1246
1278
  __proto__: null,
1247
1279
  appendFile,
1248
1280
  copy,
1249
1281
  createFile,
1250
- dispose: dispose$7,
1282
+ dispose: dispose$1,
1251
1283
  exists,
1252
1284
  getFolderSize: getFolderSize$1,
1253
1285
  getPathSeparator,
1254
1286
  getRealPath,
1255
- invoke: invoke$7,
1256
- invokeAndTransfer: invokeAndTransfer$7,
1287
+ invoke: invoke$3,
1288
+ invokeAndTransfer: invokeAndTransfer$1,
1257
1289
  mkdir,
1258
1290
  readDirWithFileTypes,
1259
- readFile: readFile$1,
1291
+ readFile: readFile$2,
1260
1292
  readFileAsBlob,
1293
+ registerMockRpc: registerMockRpc$1,
1261
1294
  remove,
1262
1295
  rename,
1263
- set: set$7,
1296
+ set: set$5,
1264
1297
  stat,
1265
1298
  writeFile: writeFile$1
1266
1299
  };
1300
+
1267
1301
  const {
1268
- invoke: invoke$3,
1269
- invokeAndTransfer: invokeAndTransfer$3,
1270
- set: set$3$1} = create$1(RendererWorker$1);
1302
+ invoke: invoke$2,
1303
+ invokeAndTransfer,
1304
+ set: set$4,
1305
+ dispose
1306
+ } = create$1(RendererWorker$1);
1307
+ const searchFileHtml = async uri => {
1308
+ return invoke$2('ExtensionHost.searchFileWithHtml', uri);
1309
+ };
1310
+ const getFilePathElectron = async file => {
1311
+ return invoke$2('FileSystemHandle.getFilePathElectron', file);
1312
+ };
1313
+ /**
1314
+ * @deprecated
1315
+ */
1316
+ const showContextMenu = async (x, y, id, ...args) => {
1317
+ return invoke$2('ContextMenu.show', x, y, id, ...args);
1318
+ };
1319
+ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1320
+ number(uid);
1321
+ number(menuId);
1322
+ number(x);
1323
+ number(y);
1324
+ // @ts-ignore
1325
+ await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
1326
+ };
1327
+ const getElectronVersion = async () => {
1328
+ return invoke$2('Process.getElectronVersion');
1329
+ };
1330
+ const applyBulkReplacement = async bulkEdits => {
1331
+ await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
1332
+ };
1333
+ const setColorTheme = async id => {
1334
+ // @ts-ignore
1335
+ return invoke$2(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1336
+ };
1337
+ const getNodeVersion = async () => {
1338
+ return invoke$2('Process.getNodeVersion');
1339
+ };
1340
+ const getChromeVersion = async () => {
1341
+ return invoke$2('Process.getChromeVersion');
1342
+ };
1343
+ const getV8Version = async () => {
1344
+ return invoke$2('Process.getV8Version');
1345
+ };
1346
+ const getFileHandles = async fileIds => {
1347
+ const files = await invoke$2('FileSystemHandle.getFileHandles', fileIds);
1348
+ return files;
1349
+ };
1350
+ const setWorkspacePath = async path => {
1351
+ await invoke$2('Workspace.setPath', path);
1352
+ };
1353
+ const registerWebViewInterceptor = async (id, port) => {
1354
+ await invokeAndTransfer('WebView.registerInterceptor', id, port);
1355
+ };
1356
+ const unregisterWebViewInterceptor = async id => {
1357
+ await invoke$2('WebView.unregisterInterceptor', id);
1358
+ };
1359
+ const sendMessagePortToEditorWorker = async (port, rpcId) => {
1360
+ const command = 'HandleMessagePort.handleMessagePort';
1361
+ // @ts-ignore
1362
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1363
+ };
1364
+ const sendMessagePortToErrorWorker = async (port, rpcId) => {
1365
+ const command = 'Errors.handleMessagePort';
1366
+ // @ts-ignore
1367
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1368
+ };
1369
+ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1370
+ const command = 'Markdown.handleMessagePort';
1371
+ // @ts-ignore
1372
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1373
+ };
1374
+ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1375
+ const command = 'IconTheme.handleMessagePort';
1376
+ // @ts-ignore
1377
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1378
+ };
1271
1379
  const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
1272
1380
  const command = 'FileSystem.handleMessagePort';
1273
1381
  // @ts-ignore
1274
- await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1382
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1383
+ };
1384
+ const readFile$1 = async uri => {
1385
+ return invoke$2('FileSystem.readFile', uri);
1386
+ };
1387
+ const getWebViewSecret = async key => {
1388
+ // @ts-ignore
1389
+ return invoke$2('WebView.getSecret', key);
1390
+ };
1391
+ const setWebViewPort = async (uid, port, origin, portType) => {
1392
+ return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1393
+ };
1394
+ const setFocus = key => {
1395
+ return invoke$2('Focus.setFocus', key);
1396
+ };
1397
+ const getFileIcon = async options => {
1398
+ return invoke$2('IconTheme.getFileIcon', options);
1399
+ };
1400
+ const getColorThemeNames = async () => {
1401
+ return invoke$2('ColorTheme.getColorThemeNames');
1402
+ };
1403
+ const disableExtension = async id => {
1404
+ // @ts-ignore
1405
+ return invoke$2('ExtensionManagement.disable', id);
1406
+ };
1407
+ const enableExtension = async id => {
1408
+ // @ts-ignore
1409
+ return invoke$2('ExtensionManagement.enable', id);
1410
+ };
1411
+ const handleDebugChange = async params => {
1412
+ // @ts-ignore
1413
+ return invoke$2('Run And Debug.handleChange', params);
1414
+ };
1415
+ const getFolderIcon = async options => {
1416
+ return invoke$2('IconTheme.getFolderIcon', options);
1417
+ };
1418
+ const handleWorkspaceRefresh = async () => {
1419
+ return invoke$2('Layout.handleWorkspaceRefresh');
1420
+ };
1421
+ const closeWidget = async widgetId => {
1422
+ return invoke$2('Viewlet.closeWidget', widgetId);
1275
1423
  };
1276
1424
  const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
1277
1425
  const command = 'HandleMessagePort.handleMessagePort2';
1278
- await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1426
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1427
+ };
1428
+ const sendMessagePortToSearchProcess = async port => {
1429
+ await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1430
+ };
1431
+ const confirm = async (message, options) => {
1432
+ // @ts-ignore
1433
+ const result = await invoke$2('ConfirmPrompt.prompt', message, options);
1434
+ return result;
1435
+ };
1436
+ const getRecentlyOpened = async () => {
1437
+ return invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1438
+ };
1439
+ const getKeyBindings$1 = async () => {
1440
+ return invoke$2('KeyBindingsInitial.getKeyBindings');
1441
+ };
1442
+ const writeClipBoardText = async text => {
1443
+ await invoke$2('ClipBoard.writeText', /* text */text);
1444
+ };
1445
+ const readClipBoardText = async () => {
1446
+ return invoke$2('ClipBoard.readText');
1447
+ };
1448
+ const writeClipBoardImage = async blob => {
1449
+ // @ts-ignore
1450
+ await invoke$2('ClipBoard.writeImage', /* text */blob);
1451
+ };
1452
+ const searchFileMemory = async uri => {
1453
+ // @ts-ignore
1454
+ return invoke$2('ExtensionHost.searchFileWithMemory', uri);
1455
+ };
1456
+ const searchFileFetch = async uri => {
1457
+ return invoke$2('ExtensionHost.searchFileWithFetch', uri);
1458
+ };
1459
+ const showMessageBox = async options => {
1460
+ return invoke$2('ElectronDialog.showMessageBox', options);
1461
+ };
1462
+ const handleDebugResumed = async params => {
1463
+ await invoke$2('Run And Debug.handleResumed', params);
1464
+ };
1465
+ const openWidget = async name => {
1466
+ await invoke$2('Viewlet.openWidget', name);
1467
+ };
1468
+ const getIcons = async requests => {
1469
+ const icons = await invoke$2('IconTheme.getIcons', requests);
1470
+ return icons;
1279
1471
  };
1280
1472
  const activateByEvent$1 = event => {
1281
- return invoke$3('ExtensionHostManagement.activateByEvent', event);
1473
+ return invoke$2('ExtensionHostManagement.activateByEvent', event);
1282
1474
  };
1475
+ const setAdditionalFocus = focusKey => {
1476
+ // @ts-ignore
1477
+ return invoke$2('Focus.setAdditionalFocus', focusKey);
1478
+ };
1479
+ const getActiveEditorId = () => {
1480
+ // @ts-ignore
1481
+ return invoke$2('GetActiveEditor.getActiveEditorId');
1482
+ };
1483
+ const getWorkspacePath = () => {
1484
+ return invoke$2('Workspace.getPath');
1485
+ };
1486
+ const sendMessagePortToRendererProcess = async port => {
1487
+ const command = 'HandleMessagePort.handleMessagePort';
1488
+ // @ts-ignore
1489
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1490
+ };
1491
+ const sendMessagePortToTextMeasurementWorker = async port => {
1492
+ const command = 'TextMeasurement.handleMessagePort';
1493
+ // @ts-ignore
1494
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
1495
+ };
1496
+ const sendMessagePortToSourceControlWorker = async port => {
1497
+ const command = 'SourceControl.handleMessagePort';
1498
+ // @ts-ignore
1499
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSourceControlWorker', port, command, 0);
1500
+ };
1501
+ const getPreference = async key => {
1502
+ return await invoke$2('Preferences.get', key);
1503
+ };
1504
+ const getAllExtensions = async () => {
1505
+ return invoke$2('ExtensionManagement.getAllExtensions');
1506
+ };
1507
+ const rerenderEditor = async key => {
1508
+ // @ts-ignore
1509
+ return invoke$2('Editor.rerender', key);
1510
+ };
1511
+ const handleDebugPaused = async params => {
1512
+ await invoke$2('Run And Debug.handlePaused', params);
1513
+ };
1514
+ const openUri = async (uri, focus, options) => {
1515
+ await invoke$2('Main.openUri', uri, focus, options);
1516
+ };
1517
+ const sendMessagePortToSyntaxHighlightingWorker = async port => {
1518
+ await invokeAndTransfer(
1519
+ // @ts-ignore
1520
+ 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1521
+ };
1522
+ const handleDebugScriptParsed = async script => {
1523
+ await invoke$2('Run And Debug.handleScriptParsed', script);
1524
+ };
1525
+ const getWindowId = async () => {
1526
+ return invoke$2('GetWindowId.getWindowId');
1527
+ };
1528
+ const getBlob = async uri => {
1529
+ // @ts-ignore
1530
+ return invoke$2('FileSystem.getBlob', uri);
1531
+ };
1532
+ const getExtensionCommands = async () => {
1533
+ return invoke$2('ExtensionHost.getCommands');
1534
+ };
1535
+ const showErrorDialog = async errorInfo => {
1536
+ // @ts-ignore
1537
+ await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
1538
+ };
1539
+ const getFolderSize = async uri => {
1540
+ // @ts-ignore
1541
+ return await invoke$2('FileSystem.getFolderSize', uri);
1542
+ };
1543
+ const getExtension = async id => {
1544
+ // @ts-ignore
1545
+ return invoke$2('ExtensionManagement.getExtension', id);
1546
+ };
1547
+ const getMarkdownDom = async html => {
1548
+ // @ts-ignore
1549
+ return invoke$2('Markdown.getVirtualDom', html);
1550
+ };
1551
+ const renderMarkdown = async (markdown, options) => {
1552
+ // @ts-ignore
1553
+ return invoke$2('Markdown.renderMarkdown', markdown, options);
1554
+ };
1555
+ const openNativeFolder = async uri => {
1556
+ // @ts-ignore
1557
+ await invoke$2('OpenNativeFolder.openNativeFolder', uri);
1558
+ };
1559
+ const uninstallExtension = async id => {
1560
+ return invoke$2('ExtensionManagement.uninstall', id);
1561
+ };
1562
+ const installExtension = async id => {
1563
+ // @ts-ignore
1564
+ return invoke$2('ExtensionManagement.install', id);
1565
+ };
1566
+ const openExtensionSearch = async () => {
1567
+ // @ts-ignore
1568
+ return invoke$2('SideBar.openViewlet', 'Extensions');
1569
+ };
1570
+ const setExtensionsSearchValue = async searchValue => {
1571
+ // @ts-ignore
1572
+ return invoke$2('Extensions.handleInput', searchValue, Script$1);
1573
+ };
1574
+ const openExternal = async uri => {
1575
+ // @ts-ignore
1576
+ await invoke$2('Open.openExternal', uri);
1577
+ };
1578
+ const openUrl = async uri => {
1579
+ // @ts-ignore
1580
+ await invoke$2('Open.openUrl', uri);
1581
+ };
1582
+ const getAllPreferences = async () => {
1583
+ // @ts-ignore
1584
+ return invoke$2('Preferences.getAll');
1585
+ };
1586
+ const showSaveFilePicker = async () => {
1587
+ // @ts-ignore
1588
+ return invoke$2('FilePicker.showSaveFilePicker');
1589
+ };
1590
+ const getLogsDir$1 = async () => {
1591
+ // @ts-ignore
1592
+ return invoke$2('PlatformPaths.getLogsDir');
1593
+ };
1594
+ const measureTextBlockHeight = async (actualInput, fontFamily, fontSize, lineHeightPx, width) => {
1595
+ return invoke$2(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
1596
+ };
1597
+ const registerMockRpc = commandMap => {
1598
+ const mockRpc = createMockRpc({
1599
+ commandMap
1600
+ });
1601
+ set$4(mockRpc);
1602
+ return mockRpc;
1603
+ };
1604
+
1283
1605
  const RendererWorker = {
1284
1606
  __proto__: null,
1285
1607
  activateByEvent: activateByEvent$1,
1286
- invoke: invoke$3,
1608
+ applyBulkReplacement,
1609
+ closeWidget,
1610
+ confirm,
1611
+ disableExtension,
1612
+ dispose,
1613
+ enableExtension,
1614
+ getActiveEditorId,
1615
+ getAllExtensions,
1616
+ getAllPreferences,
1617
+ getBlob,
1618
+ getChromeVersion,
1619
+ getColorThemeNames,
1620
+ getElectronVersion,
1621
+ getExtension,
1622
+ getExtensionCommands,
1623
+ getFileHandles,
1624
+ getFileIcon,
1625
+ getFilePathElectron,
1626
+ getFolderIcon,
1627
+ getFolderSize,
1628
+ getIcons,
1629
+ getKeyBindings: getKeyBindings$1,
1630
+ getLogsDir: getLogsDir$1,
1631
+ getMarkdownDom,
1632
+ getNodeVersion,
1633
+ getPreference,
1634
+ getRecentlyOpened,
1635
+ getV8Version,
1636
+ getWebViewSecret,
1637
+ getWindowId,
1638
+ getWorkspacePath,
1639
+ handleDebugChange,
1640
+ handleDebugPaused,
1641
+ handleDebugResumed,
1642
+ handleDebugScriptParsed,
1643
+ handleWorkspaceRefresh,
1644
+ installExtension,
1645
+ invoke: invoke$2,
1646
+ invokeAndTransfer,
1647
+ measureTextBlockHeight,
1648
+ openExtensionSearch,
1649
+ openExternal,
1650
+ openNativeFolder,
1651
+ openUri,
1652
+ openUrl,
1653
+ openWidget,
1654
+ readClipBoardText,
1655
+ readFile: readFile$1,
1656
+ registerMockRpc,
1657
+ registerWebViewInterceptor,
1658
+ renderMarkdown,
1659
+ rerenderEditor,
1660
+ searchFileFetch,
1661
+ searchFileHtml,
1662
+ searchFileMemory,
1663
+ sendMessagePortToEditorWorker,
1664
+ sendMessagePortToErrorWorker,
1287
1665
  sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
1288
1666
  sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
1289
- set: set$3$1};
1667
+ sendMessagePortToIconThemeWorker,
1668
+ sendMessagePortToMarkdownWorker,
1669
+ sendMessagePortToRendererProcess,
1670
+ sendMessagePortToSearchProcess,
1671
+ sendMessagePortToSourceControlWorker,
1672
+ sendMessagePortToSyntaxHighlightingWorker,
1673
+ sendMessagePortToTextMeasurementWorker,
1674
+ set: set$4,
1675
+ setAdditionalFocus,
1676
+ setColorTheme,
1677
+ setExtensionsSearchValue,
1678
+ setFocus,
1679
+ setWebViewPort,
1680
+ setWorkspacePath,
1681
+ showContextMenu,
1682
+ showContextMenu2,
1683
+ showErrorDialog,
1684
+ showMessageBox,
1685
+ showSaveFilePicker,
1686
+ uninstallExtension,
1687
+ unregisterWebViewInterceptor,
1688
+ writeClipBoardImage,
1689
+ writeClipBoardText
1690
+ };
1290
1691
 
1291
1692
  const {
1292
1693
  set: set$3,
@@ -1294,22 +1695,74 @@ const {
1294
1695
  writeFile
1295
1696
  } = FileSystemWorker;
1296
1697
 
1698
+ const getTextFromParts = parts => {
1699
+ let result = '';
1700
+ for (const part of parts) {
1701
+ result += part.value;
1702
+ }
1703
+ return result;
1704
+ };
1297
1705
  const filterItems = (items, filterValue) => {
1298
1706
  if (!filterValue) {
1299
1707
  return items;
1300
1708
  }
1301
- return items.filter(item => item.includes(filterValue));
1709
+ return items.filter(parts => getTextFromParts(parts).includes(filterValue));
1302
1710
  };
1303
1711
 
1304
1712
  const isFileNotFoundError = error => {
1305
1713
  return error?.message?.includes('File not found') ?? false;
1306
1714
  };
1307
1715
 
1716
+ const RE_URL = /(?:https?:\/\/\S+|file:\/\/\S+)/;
1717
+ const getLinkMatch = text => {
1718
+ const match = text.match(RE_URL);
1719
+ return match ? match[0] : null;
1720
+ };
1721
+
1722
+ const Text = 1;
1723
+ const Link = 2;
1724
+
1725
+ const parseLine = line => {
1726
+ const parts = [];
1727
+ let rest = line;
1728
+ while (rest.length > 0) {
1729
+ const match = getLinkMatch(rest);
1730
+ if (!match) {
1731
+ if (rest) {
1732
+ parts.push({
1733
+ type: Text,
1734
+ value: rest
1735
+ });
1736
+ }
1737
+ break;
1738
+ }
1739
+ const index = rest.indexOf(match);
1740
+ if (index > 0) {
1741
+ parts.push({
1742
+ type: Text,
1743
+ value: rest.slice(0, index)
1744
+ });
1745
+ }
1746
+ parts.push({
1747
+ type: Link,
1748
+ value: match
1749
+ });
1750
+ rest = rest.slice(index + match.length);
1751
+ }
1752
+ if (parts.length === 0) {
1753
+ return [{
1754
+ type: Text,
1755
+ value: ''
1756
+ }];
1757
+ }
1758
+ return parts;
1759
+ };
1760
+
1308
1761
  const loadLines = async uri => {
1309
1762
  try {
1310
1763
  // TODO use log stream, updating the output when the file is changed
1311
1764
  const content = await readFile(uri);
1312
- const lines = content.split('\n');
1765
+ const lines = content.split('\n').map(parseLine);
1313
1766
  return {
1314
1767
  error: '',
1315
1768
  lines,
@@ -1377,8 +1830,8 @@ const {
1377
1830
  wrapCommand,
1378
1831
  wrapGetter,
1379
1832
  getKeys,
1380
- getCommandIds
1381
- } = create$2();
1833
+ getCommandIds,
1834
+ registerCommands} = create$2();
1382
1835
 
1383
1836
  const create = (id, uri, x, y, width, height, platform, parentId) => {
1384
1837
  number(parentId);
@@ -1487,50 +1940,13 @@ const focusIndex = (state, index) => {
1487
1940
  };
1488
1941
  };
1489
1942
 
1490
- const ToolBar = 'toolbar';
1491
- const AriaRoles = {
1492
- __proto__: null,
1493
- ToolBar};
1494
- const Space = 9;
1495
- const PageUp = 10;
1496
- const PageDown = 11;
1497
- const End = 255;
1498
- const Home = 12;
1499
- const LeftArrow = 13;
1500
- const UpArrow = 14;
1501
- const RightArrow = 15;
1502
- const DownArrow = 16;
1503
- const KeyCode = {
1504
- __proto__: null,
1505
- DownArrow,
1506
- End,
1507
- Home,
1508
- LeftArrow,
1509
- PageDown,
1510
- PageUp,
1511
- RightArrow,
1512
- Space,
1513
- UpArrow
1514
- };
1515
1943
  const mergeClassNames = (...classNames) => {
1516
1944
  return classNames.filter(Boolean).join(' ');
1517
1945
  };
1518
- const Button = 1;
1519
- const Div = 4;
1520
- const Input = 6;
1521
- const Text = 12;
1522
- const Select$1 = 63;
1523
- const Option$1 = 64;
1524
- const VirtualDomElements = {
1525
- __proto__: null,
1526
- Button,
1527
- Div,
1528
- Input,
1529
- Option: Option$1,
1530
- Select: Select$1};
1946
+
1531
1947
  const text = data => {
1532
1948
  return {
1533
- type: Text,
1949
+ type: Text$1,
1534
1950
  text: data,
1535
1951
  childCount: 0
1536
1952
  };
@@ -1540,47 +1956,47 @@ const FocusProblems = 19;
1540
1956
 
1541
1957
  const getKeyBindings = () => {
1542
1958
  return [{
1543
- key: KeyCode.DownArrow,
1959
+ key: DownArrow,
1544
1960
  command: 'Problems.focusNext',
1545
1961
  when: FocusProblems
1546
1962
  }, {
1547
- key: KeyCode.UpArrow,
1963
+ key: UpArrow,
1548
1964
  command: 'Problems.focusPrevious',
1549
1965
  when: FocusProblems
1550
1966
  }, {
1551
- key: KeyCode.Home,
1967
+ key: Home,
1552
1968
  command: 'Problems.focusFirst',
1553
1969
  when: FocusProblems
1554
1970
  }, {
1555
- key: KeyCode.PageUp,
1971
+ key: PageUp,
1556
1972
  command: 'Problems.focusFirst',
1557
1973
  when: FocusProblems
1558
1974
  }, {
1559
- key: KeyCode.PageDown,
1975
+ key: PageDown,
1560
1976
  command: 'Problems.focusLast',
1561
1977
  when: FocusProblems
1562
1978
  }, {
1563
- key: KeyCode.End,
1979
+ key: End,
1564
1980
  command: 'Problems.focusLast',
1565
1981
  when: FocusProblems
1566
1982
  }, {
1567
- key: KeyCode.Space,
1983
+ key: Space,
1568
1984
  command: 'Problems.selectCurrent',
1569
1985
  when: FocusProblems
1570
1986
  }, {
1571
- key: KeyCode.Home,
1987
+ key: Home,
1572
1988
  command: 'Problems.focusFirst',
1573
1989
  when: FocusProblems
1574
1990
  }, {
1575
- key: KeyCode.End,
1991
+ key: End,
1576
1992
  command: 'Problems.focusLast',
1577
1993
  when: FocusProblems
1578
1994
  }, {
1579
- key: KeyCode.LeftArrow,
1995
+ key: LeftArrow,
1580
1996
  command: 'Problems.handleArrowLeft',
1581
1997
  when: FocusProblems
1582
1998
  }, {
1583
- key: KeyCode.RightArrow,
1999
+ key: RightArrow,
1584
2000
  command: 'Problems.handleArrowRight',
1585
2001
  when: FocusProblems
1586
2002
  }];
@@ -1683,13 +2099,13 @@ const setupChangeListener = async (oldWatchId, newWatchId, uri) => {
1683
2099
  if (oldWatchId) {
1684
2100
  unregisterWatchCallback(oldWatchId);
1685
2101
  // @ts-ignore
1686
- await FileSystemWorker.invoke('FileSystem.unwatchFile', oldWatchId);
2102
+ await invoke$3('FileSystem.unwatchFile', oldWatchId);
1687
2103
  }
1688
2104
  // TODO dispose old watcher
1689
- const rpcId = RpcId.OutputWorker;
2105
+ const rpcId = OutputWorker;
1690
2106
  registerWatchCallback(newWatchId, handleFileChange);
1691
2107
  // @ts-ignore
1692
- await FileSystemWorker.invoke('FileSystem.watchFile', newWatchId, /* path */uri, rpcId);
2108
+ await invoke$3('FileSystem.watchFile', newWatchId, /* path */uri, rpcId);
1693
2109
  } catch {
1694
2110
  // ignore
1695
2111
  }
@@ -1758,7 +2174,7 @@ const initializeExtensionHost = async () => {
1758
2174
  };
1759
2175
 
1760
2176
  const sendMessagePortToFileSystemWorker = async port => {
1761
- await sendMessagePortToFileSystemWorker$1(port, RpcId.OutputWorker);
2177
+ await sendMessagePortToFileSystemWorker$1(port, OutputWorker);
1762
2178
  };
1763
2179
 
1764
2180
  const createFileSystemWorkerRpc = async () => {
@@ -1782,6 +2198,15 @@ const initialize = async () => {
1782
2198
  await Promise.all([initializeFileSystemWorker(), initializeExtensionHost()]);
1783
2199
  };
1784
2200
 
2201
+ const getLogsDir = async () => {
2202
+ try {
2203
+ // @ts-ignore
2204
+ return await invoke$1('PlatformPaths.getLogsDir');
2205
+ } catch {
2206
+ return `file:///tmp`;
2207
+ }
2208
+ };
2209
+
1785
2210
  const Web = 1;
1786
2211
 
1787
2212
  const getSelectedItem = (selectedOption, platform) => {
@@ -1859,7 +2284,7 @@ const getExtensionOptions = async () => {
1859
2284
  }
1860
2285
  };
1861
2286
 
1862
- const loadOptions = async platform => {
2287
+ const loadOptions = async (platform, logsFolderPath) => {
1863
2288
  const extensionOptions = await getExtensionOptions();
1864
2289
  if (platform === Web) {
1865
2290
  return extensionOptions;
@@ -1867,11 +2292,11 @@ const loadOptions = async platform => {
1867
2292
  return [{
1868
2293
  id: MainProcess,
1869
2294
  label: 'Main Process',
1870
- uri: 'file:///tmp/log-main-process.txt'
2295
+ uri: `${logsFolderPath}/log-main-process.txt`
1871
2296
  }, {
1872
2297
  id: SharedProcess,
1873
2298
  label: 'Shared Process',
1874
- uri: 'file:///tmp/log-shared-process.txt'
2299
+ uri: `${logsFolderPath}/log-shared-process.txt`
1875
2300
  }, ...extensionOptions];
1876
2301
  };
1877
2302
 
@@ -1922,13 +2347,14 @@ const loadContent = async (state, savedState) => {
1922
2347
  watchId
1923
2348
  } = state;
1924
2349
  const collapsedUris = getSavedCollapsedUris(savedState);
2350
+ const logsFolderPath = await getLogsDir();
1925
2351
  const {
1926
2352
  selectedOption,
1927
2353
  filterValue,
1928
2354
  scrollLockEnabled
1929
2355
  } = restoreState(savedState);
1930
2356
  const selectedId = getSelectedItem(selectedOption, platform);
1931
- const options = await loadOptions(platform);
2357
+ const options = await loadOptions(platform, logsFolderPath);
1932
2358
  const option = getMatchingOpen(options, selectedId);
1933
2359
  if (!option) {
1934
2360
  throw new Error('option not found');
@@ -2018,12 +2444,30 @@ const Error$1 = 'Error';
2018
2444
  const Line = 'Line';
2019
2445
 
2020
2446
  const parentNode = {
2021
- type: VirtualDomElements.Div,
2447
+ type: Div,
2022
2448
  className: Line,
2023
2449
  childCount: 1
2024
2450
  };
2025
- const getLineDom = line => {
2026
- return [parentNode, text(line)];
2451
+ const getLineDom = parts => {
2452
+ const children = [];
2453
+ for (const part of parts) {
2454
+ if (part.type === Text) {
2455
+ children.push(text(part.value));
2456
+ } else {
2457
+ children.push({
2458
+ type: A,
2459
+ href: part.value,
2460
+ target: '_blank',
2461
+ rel: 'noopener noreferrer',
2462
+ childCount: 1
2463
+ }, text(part.value));
2464
+ }
2465
+ }
2466
+ const lineNode = {
2467
+ ...parentNode,
2468
+ childCount: children.length
2469
+ };
2470
+ return [lineNode, ...children];
2027
2471
  };
2028
2472
 
2029
2473
  const getContentDom = (lines, error) => {
@@ -2031,7 +2475,7 @@ const getContentDom = (lines, error) => {
2031
2475
  return [];
2032
2476
  }
2033
2477
  return [{
2034
- type: VirtualDomElements.Div,
2478
+ type: Div,
2035
2479
  className: OutputContent,
2036
2480
  role: 'log',
2037
2481
  tabIndex: 0,
@@ -2043,7 +2487,7 @@ const LogFileNotFound = 1;
2043
2487
 
2044
2488
  const getLogFileNotFoundDom = () => {
2045
2489
  return [{
2046
- type: VirtualDomElements.Div,
2490
+ type: Div,
2047
2491
  className: Message,
2048
2492
  tabIndex: 0,
2049
2493
  childCount: 1
@@ -2058,7 +2502,7 @@ const getErrorDom = (errorCode, error) => {
2058
2502
  return getLogFileNotFoundDom();
2059
2503
  }
2060
2504
  return [{
2061
- type: VirtualDomElements.Div,
2505
+ type: Div,
2062
2506
  className: Error$1,
2063
2507
  tabIndex: 0,
2064
2508
  childCount: 1
@@ -2067,7 +2511,7 @@ const getErrorDom = (errorCode, error) => {
2067
2511
 
2068
2512
  const getOutputVirtualDom = (lines, errorCode, error) => {
2069
2513
  return [{
2070
- type: VirtualDomElements.Div,
2514
+ type: Div,
2071
2515
  className: mergeClassNames(Viewlet, Output),
2072
2516
  childCount: 1
2073
2517
  }, ...getContentDom(lines, error), ...getErrorDom(errorCode, error)];
@@ -2131,14 +2575,14 @@ const getActionButtonVirtualDom = button => {
2131
2575
  icon
2132
2576
  } = button;
2133
2577
  return [{
2134
- type: VirtualDomElements.Button,
2578
+ type: Button,
2135
2579
  className: IconButton,
2136
2580
  name: id,
2137
2581
  title: label,
2138
2582
  childCount: 1,
2139
2583
  onClick: HandleButtonClick
2140
2584
  }, {
2141
- type: VirtualDomElements.Div,
2585
+ type: Div,
2142
2586
  className: mergeClassNames(MaskIcon, icon)
2143
2587
  }];
2144
2588
  };
@@ -2150,11 +2594,11 @@ const getActionButtonsVirtualDom = buttons => {
2150
2594
  const getFilterVirtualDom = () => {
2151
2595
  const placeholder = 'Filter';
2152
2596
  return [{
2153
- type: VirtualDomElements.Div,
2597
+ type: Div,
2154
2598
  className: Filter,
2155
2599
  childCount: 1
2156
2600
  }, {
2157
- type: VirtualDomElements.Input,
2601
+ type: Input,
2158
2602
  className: mergeClassNames(InputBox, FilterInput),
2159
2603
  childCount: 0,
2160
2604
  placeholder,
@@ -2169,7 +2613,7 @@ const getOptionVirtualDom = option => {
2169
2613
  label
2170
2614
  } = option;
2171
2615
  return [{
2172
- type: VirtualDomElements.Option,
2616
+ type: Option$1,
2173
2617
  className: Option,
2174
2618
  childCount: 1,
2175
2619
  value: id
@@ -2178,7 +2622,7 @@ const getOptionVirtualDom = option => {
2178
2622
 
2179
2623
  const getSelectVirtualDom = options => {
2180
2624
  return [{
2181
- type: VirtualDomElements.Select,
2625
+ type: Select$1,
2182
2626
  className: Select,
2183
2627
  childCount: options.length,
2184
2628
  name: Output$1,
@@ -2194,9 +2638,9 @@ const getChildCount = buttonsLength => {
2194
2638
  const getActionsVirtualDom = (options, buttons) => {
2195
2639
  const childCount = getChildCount(buttons.length);
2196
2640
  return [{
2197
- type: VirtualDomElements.Div,
2641
+ type: Div,
2198
2642
  className: Actions,
2199
- role: AriaRoles.ToolBar,
2643
+ role: ToolBar,
2200
2644
  childCount
2201
2645
  }, ...getFilterVirtualDom(), ...getSelectVirtualDom(options), ...getActionButtonsVirtualDom(buttons)];
2202
2646
  };
@@ -2244,9 +2688,29 @@ const resize = (state, dimensions) => {
2244
2688
  };
2245
2689
  };
2246
2690
 
2691
+ const serializeLinePart = part => {
2692
+ return part.value;
2693
+ };
2694
+ const serializeLineParts = parts => {
2695
+ return parts.map(serializeLinePart).join('');
2696
+ };
2697
+ const serializeLines = lines => {
2698
+ return lines.map(serializeLineParts).join('\n');
2699
+ };
2700
+
2701
+ // no local use of Line/LinePart here; serializeLines handles typing
2702
+
2247
2703
  const saveOutputAs = async state => {
2248
- // TODO show open file picker
2249
- // TODO write to file
2704
+ // @ts-ignore
2705
+ const uri = await invoke$1('FilePicker.showSaveFilePicker');
2706
+ if (!uri) {
2707
+ return state;
2708
+ }
2709
+ const {
2710
+ listItems
2711
+ } = state;
2712
+ const content = serializeLines(listItems);
2713
+ await writeFile(uri, content);
2250
2714
  // TODO if error occurs, show error dialog
2251
2715
  return state;
2252
2716
  };
@@ -2306,7 +2770,7 @@ const commandMap = {
2306
2770
  'Output.renderActions': wrapGetter(renderActions),
2307
2771
  'Output.renderEventListeners': renderEventListeners,
2308
2772
  'Output.resize': resize,
2309
- 'Output.saveOutputAs': wrapCommand(saveOutputAs),
2773
+ 'Output.saveAs': wrapCommand(saveOutputAs),
2310
2774
  'Output.saveState': wrapGetter(saveState),
2311
2775
  'Output.selectChannel': wrapCommand(selectChannel),
2312
2776
  'Output.setLogLevel': setLogLevel,
@@ -2317,6 +2781,7 @@ const commandMap = {
2317
2781
  const commandMapRef = {};
2318
2782
 
2319
2783
  const listen = async () => {
2784
+ registerCommands(commandMap);
2320
2785
  Object.assign(commandMapRef, commandMap);
2321
2786
  const rpc = await WebWorkerRpcClient.create({
2322
2787
  commandMap: commandMapRef
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/output-view",
3
- "version": "1.18.0",
3
+ "version": "2.0.0",
4
4
  "description": "Output View Worker",
5
5
  "repository": {
6
6
  "type": "git",