@lvce-editor/output-view 1.13.0 → 1.15.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 +351 -326
- package/package.json +1 -1
|
@@ -515,7 +515,7 @@ const create$4$1 = (method, params) => {
|
|
|
515
515
|
};
|
|
516
516
|
};
|
|
517
517
|
const callbacks = Object.create(null);
|
|
518
|
-
const set$
|
|
518
|
+
const set$4 = (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$
|
|
537
|
+
set$4(id, resolve);
|
|
538
538
|
return {
|
|
539
539
|
id,
|
|
540
540
|
promise
|
|
@@ -1092,235 +1092,27 @@ const terminate = () => {
|
|
|
1092
1092
|
globalThis.close();
|
|
1093
1093
|
};
|
|
1094
1094
|
|
|
1095
|
-
const closeFindWidget = async state => {
|
|
1096
|
-
// TODO
|
|
1097
|
-
return {
|
|
1098
|
-
...state
|
|
1099
|
-
};
|
|
1100
|
-
};
|
|
1101
|
-
|
|
1102
|
-
const User = 1;
|
|
1103
|
-
const Script = 2;
|
|
1104
|
-
|
|
1105
|
-
const {
|
|
1106
|
-
get: get$1,
|
|
1107
|
-
set: set$4,
|
|
1108
|
-
wrapCommand,
|
|
1109
|
-
wrapGetter,
|
|
1110
|
-
getKeys
|
|
1111
|
-
} = create$2();
|
|
1112
|
-
|
|
1113
|
-
const create$1 = (id, uri, x, y, width, height, platform, parentId) => {
|
|
1114
|
-
number(parentId);
|
|
1115
|
-
const state = {
|
|
1116
|
-
uid: id,
|
|
1117
|
-
parentId,
|
|
1118
|
-
uri,
|
|
1119
|
-
focusedIndex: -2,
|
|
1120
|
-
message: '',
|
|
1121
|
-
itemHeight: 22,
|
|
1122
|
-
x,
|
|
1123
|
-
y,
|
|
1124
|
-
width,
|
|
1125
|
-
height,
|
|
1126
|
-
filterValue: '',
|
|
1127
|
-
inputSource: User,
|
|
1128
|
-
minLineY: 0,
|
|
1129
|
-
maxLineY: 0,
|
|
1130
|
-
listItems: [],
|
|
1131
|
-
collapsedUris: [],
|
|
1132
|
-
selectedOption: '',
|
|
1133
|
-
smallWidthBreakPoint: 650,
|
|
1134
|
-
workspaceUri: '',
|
|
1135
|
-
options: [],
|
|
1136
|
-
error: '',
|
|
1137
|
-
errorCode: 0,
|
|
1138
|
-
buttons: [],
|
|
1139
|
-
filteredItems: [],
|
|
1140
|
-
platform,
|
|
1141
|
-
watchId: 0
|
|
1142
|
-
};
|
|
1143
|
-
set$4(id, state, state);
|
|
1144
|
-
};
|
|
1145
|
-
|
|
1146
|
-
const isEqual$2 = (oldState, newState) => {
|
|
1147
|
-
return newState.inputSource === User || oldState.filterValue === newState.filterValue;
|
|
1148
|
-
};
|
|
1149
|
-
|
|
1150
|
-
const isEqual$1 = (oldState, newState) => {
|
|
1151
|
-
return oldState.selectedOption === newState.selectedOption && oldState.listItems === newState.listItems;
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
const isEqual = (oldState, newState) => {
|
|
1155
|
-
return oldState.selectedOption === newState.selectedOption;
|
|
1156
|
-
};
|
|
1157
|
-
|
|
1158
|
-
const RenderItems = 1;
|
|
1159
|
-
const RenderFilterValue = 2;
|
|
1160
|
-
const RenderSelectedItem = 3;
|
|
1161
|
-
|
|
1162
|
-
const modules = [isEqual$1, isEqual$2, isEqual];
|
|
1163
|
-
const numbers = [RenderItems, RenderFilterValue, RenderSelectedItem];
|
|
1164
|
-
|
|
1165
|
-
const diff = (oldState, newState) => {
|
|
1166
|
-
const diffResult = [];
|
|
1167
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1168
|
-
const fn = modules[i];
|
|
1169
|
-
if (!fn(oldState, newState)) {
|
|
1170
|
-
diffResult.push(numbers[i]);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
return diffResult;
|
|
1174
|
-
};
|
|
1175
|
-
|
|
1176
|
-
const diff2 = uid => {
|
|
1177
|
-
const {
|
|
1178
|
-
oldState,
|
|
1179
|
-
newState
|
|
1180
|
-
} = get$1(uid);
|
|
1181
|
-
const diffResult = diff(oldState, newState);
|
|
1182
|
-
return diffResult;
|
|
1183
|
-
};
|
|
1184
|
-
|
|
1185
|
-
const focusIndex = (state, index) => {
|
|
1186
|
-
return {
|
|
1187
|
-
...state,
|
|
1188
|
-
focusedIndex: index
|
|
1189
|
-
};
|
|
1190
|
-
};
|
|
1191
|
-
|
|
1192
|
-
const commandMapRef = {};
|
|
1193
|
-
|
|
1194
|
-
const toCommandId = key => {
|
|
1195
|
-
const dotIndex = key.indexOf('.');
|
|
1196
|
-
return key.slice(dotIndex + 1);
|
|
1197
|
-
};
|
|
1198
|
-
const getCommandIds = () => {
|
|
1199
|
-
const keys = Object.keys(commandMapRef);
|
|
1200
|
-
const ids = keys.map(toCommandId);
|
|
1201
|
-
return ids;
|
|
1202
|
-
};
|
|
1203
|
-
|
|
1204
|
-
const ToolBar = 'toolbar';
|
|
1205
|
-
const AriaRoles = {
|
|
1206
|
-
__proto__: null,
|
|
1207
|
-
ToolBar};
|
|
1208
|
-
const Space = 9;
|
|
1209
|
-
const PageUp = 10;
|
|
1210
|
-
const PageDown = 11;
|
|
1211
|
-
const End = 255;
|
|
1212
|
-
const Home = 12;
|
|
1213
|
-
const LeftArrow = 13;
|
|
1214
|
-
const UpArrow = 14;
|
|
1215
|
-
const RightArrow = 15;
|
|
1216
|
-
const DownArrow = 16;
|
|
1217
|
-
const KeyCode = {
|
|
1218
|
-
__proto__: null,
|
|
1219
|
-
DownArrow,
|
|
1220
|
-
End,
|
|
1221
|
-
Home,
|
|
1222
|
-
LeftArrow,
|
|
1223
|
-
PageDown,
|
|
1224
|
-
PageUp,
|
|
1225
|
-
RightArrow,
|
|
1226
|
-
Space,
|
|
1227
|
-
UpArrow
|
|
1228
|
-
};
|
|
1229
|
-
const mergeClassNames = (...classNames) => {
|
|
1230
|
-
return classNames.filter(Boolean).join(' ');
|
|
1231
|
-
};
|
|
1232
|
-
const Button$1 = 1;
|
|
1233
|
-
const Div = 4;
|
|
1234
|
-
const Input = 6;
|
|
1235
|
-
const Text = 12;
|
|
1236
|
-
const Select$2 = 63;
|
|
1237
|
-
const Option$1 = 64;
|
|
1238
|
-
const VirtualDomElements = {
|
|
1239
|
-
__proto__: null,
|
|
1240
|
-
Button: Button$1,
|
|
1241
|
-
Div,
|
|
1242
|
-
Input,
|
|
1243
|
-
Option: Option$1,
|
|
1244
|
-
Select: Select$2};
|
|
1245
|
-
const text = data => {
|
|
1246
|
-
return {
|
|
1247
|
-
type: Text,
|
|
1248
|
-
text: data,
|
|
1249
|
-
childCount: 0
|
|
1250
|
-
};
|
|
1251
|
-
};
|
|
1252
|
-
|
|
1253
|
-
const FocusProblems = 19;
|
|
1254
|
-
|
|
1255
|
-
const getKeyBindings = () => {
|
|
1256
|
-
return [{
|
|
1257
|
-
key: KeyCode.DownArrow,
|
|
1258
|
-
command: 'Problems.focusNext',
|
|
1259
|
-
when: FocusProblems
|
|
1260
|
-
}, {
|
|
1261
|
-
key: KeyCode.UpArrow,
|
|
1262
|
-
command: 'Problems.focusPrevious',
|
|
1263
|
-
when: FocusProblems
|
|
1264
|
-
}, {
|
|
1265
|
-
key: KeyCode.Home,
|
|
1266
|
-
command: 'Problems.focusFirst',
|
|
1267
|
-
when: FocusProblems
|
|
1268
|
-
}, {
|
|
1269
|
-
key: KeyCode.PageUp,
|
|
1270
|
-
command: 'Problems.focusFirst',
|
|
1271
|
-
when: FocusProblems
|
|
1272
|
-
}, {
|
|
1273
|
-
key: KeyCode.PageDown,
|
|
1274
|
-
command: 'Problems.focusLast',
|
|
1275
|
-
when: FocusProblems
|
|
1276
|
-
}, {
|
|
1277
|
-
key: KeyCode.End,
|
|
1278
|
-
command: 'Problems.focusLast',
|
|
1279
|
-
when: FocusProblems
|
|
1280
|
-
}, {
|
|
1281
|
-
key: KeyCode.Space,
|
|
1282
|
-
command: 'Problems.selectCurrent',
|
|
1283
|
-
when: FocusProblems
|
|
1284
|
-
}, {
|
|
1285
|
-
key: KeyCode.Home,
|
|
1286
|
-
command: 'Problems.focusFirst',
|
|
1287
|
-
when: FocusProblems
|
|
1288
|
-
}, {
|
|
1289
|
-
key: KeyCode.End,
|
|
1290
|
-
command: 'Problems.focusLast',
|
|
1291
|
-
when: FocusProblems
|
|
1292
|
-
}, {
|
|
1293
|
-
key: KeyCode.LeftArrow,
|
|
1294
|
-
command: 'Problems.handleArrowLeft',
|
|
1295
|
-
when: FocusProblems
|
|
1296
|
-
}, {
|
|
1297
|
-
key: KeyCode.RightArrow,
|
|
1298
|
-
command: 'Problems.handleArrowRight',
|
|
1299
|
-
when: FocusProblems
|
|
1300
|
-
}];
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
1095
|
const rpcs = Object.create(null);
|
|
1304
1096
|
const set$g = (id, rpc) => {
|
|
1305
1097
|
rpcs[id] = rpc;
|
|
1306
1098
|
};
|
|
1307
|
-
const get = id => {
|
|
1099
|
+
const get$1 = id => {
|
|
1308
1100
|
return rpcs[id];
|
|
1309
1101
|
};
|
|
1310
1102
|
|
|
1311
1103
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1312
1104
|
|
|
1313
|
-
const create = rpcId => {
|
|
1105
|
+
const create$1 = rpcId => {
|
|
1314
1106
|
return {
|
|
1315
1107
|
// @ts-ignore
|
|
1316
1108
|
invoke(method, ...params) {
|
|
1317
|
-
const rpc = get(rpcId);
|
|
1109
|
+
const rpc = get$1(rpcId);
|
|
1318
1110
|
// @ts-ignore
|
|
1319
1111
|
return rpc.invoke(method, ...params);
|
|
1320
1112
|
},
|
|
1321
1113
|
// @ts-ignore
|
|
1322
1114
|
invokeAndTransfer(method, ...params) {
|
|
1323
|
-
const rpc = get(rpcId);
|
|
1115
|
+
const rpc = get$1(rpcId);
|
|
1324
1116
|
// @ts-ignore
|
|
1325
1117
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1326
1118
|
},
|
|
@@ -1328,7 +1120,7 @@ const create = rpcId => {
|
|
|
1328
1120
|
set$g(rpcId, rpc);
|
|
1329
1121
|
},
|
|
1330
1122
|
async dispose() {
|
|
1331
|
-
const rpc = get(rpcId);
|
|
1123
|
+
const rpc = get$1(rpcId);
|
|
1332
1124
|
await rpc.dispose();
|
|
1333
1125
|
}
|
|
1334
1126
|
};
|
|
@@ -1388,7 +1180,7 @@ const RpcId = {
|
|
|
1388
1180
|
};
|
|
1389
1181
|
const {
|
|
1390
1182
|
invoke: invoke$9,
|
|
1391
|
-
set: set$9} = create(ExtensionHostWorker);
|
|
1183
|
+
set: set$9} = create$1(ExtensionHostWorker);
|
|
1392
1184
|
const ExtensionHost = {
|
|
1393
1185
|
__proto__: null,
|
|
1394
1186
|
invoke: invoke$9,
|
|
@@ -1399,7 +1191,7 @@ const {
|
|
|
1399
1191
|
invokeAndTransfer: invokeAndTransfer$7,
|
|
1400
1192
|
set: set$7,
|
|
1401
1193
|
dispose: dispose$7
|
|
1402
|
-
} = create(FileSystemWorker$1);
|
|
1194
|
+
} = create$1(FileSystemWorker$1);
|
|
1403
1195
|
const remove = async dirent => {
|
|
1404
1196
|
return invoke$7('FileSystem.remove', dirent);
|
|
1405
1197
|
};
|
|
@@ -1475,7 +1267,7 @@ const FileSystemWorker = {
|
|
|
1475
1267
|
const {
|
|
1476
1268
|
invoke: invoke$3,
|
|
1477
1269
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
1478
|
-
set: set$3} = create(RendererWorker$1);
|
|
1270
|
+
set: set$3$1} = create$1(RendererWorker$1);
|
|
1479
1271
|
const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
|
|
1480
1272
|
const command = 'FileSystem.handleMessagePort';
|
|
1481
1273
|
// @ts-ignore
|
|
@@ -1494,14 +1286,21 @@ const RendererWorker = {
|
|
|
1494
1286
|
invoke: invoke$3,
|
|
1495
1287
|
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
|
|
1496
1288
|
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
|
|
1497
|
-
set: set$3};
|
|
1289
|
+
set: set$3$1};
|
|
1498
1290
|
|
|
1499
1291
|
const {
|
|
1500
|
-
set: set$
|
|
1292
|
+
set: set$3,
|
|
1501
1293
|
readFile,
|
|
1502
1294
|
writeFile
|
|
1503
1295
|
} = FileSystemWorker;
|
|
1504
1296
|
|
|
1297
|
+
const filterItems = (items, filterValue) => {
|
|
1298
|
+
if (!filterValue) {
|
|
1299
|
+
return items;
|
|
1300
|
+
}
|
|
1301
|
+
return items.filter(item => item.includes(filterValue));
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1505
1304
|
const isFileNotFoundError = error => {
|
|
1506
1305
|
return error.message.includes('File not found');
|
|
1507
1306
|
};
|
|
@@ -1535,8 +1334,10 @@ const loadLines = async uri => {
|
|
|
1535
1334
|
const clear = async state => {
|
|
1536
1335
|
const {
|
|
1537
1336
|
selectedOption,
|
|
1538
|
-
options
|
|
1337
|
+
options,
|
|
1338
|
+
filterValue
|
|
1539
1339
|
} = state;
|
|
1340
|
+
// TODO make uri a property of state to make the code simpler
|
|
1540
1341
|
const option = options.find(option => option.id === selectedOption);
|
|
1541
1342
|
if (!option) {
|
|
1542
1343
|
return state;
|
|
@@ -1550,16 +1351,254 @@ const clear = async state => {
|
|
|
1550
1351
|
code,
|
|
1551
1352
|
error
|
|
1552
1353
|
} = await loadLines(uri);
|
|
1354
|
+
const filteredItems = filterItems(lines, filterValue);
|
|
1553
1355
|
return {
|
|
1554
1356
|
...state,
|
|
1555
1357
|
listItems: lines,
|
|
1556
1358
|
error,
|
|
1557
|
-
errorCode: code
|
|
1359
|
+
errorCode: code,
|
|
1360
|
+
filteredItems
|
|
1361
|
+
};
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
const closeFindWidget = async state => {
|
|
1365
|
+
// TODO
|
|
1366
|
+
return {
|
|
1367
|
+
...state
|
|
1368
|
+
};
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
const User = 1;
|
|
1372
|
+
const Script = 2;
|
|
1373
|
+
|
|
1374
|
+
const {
|
|
1375
|
+
get,
|
|
1376
|
+
set: set$2,
|
|
1377
|
+
wrapCommand,
|
|
1378
|
+
wrapGetter,
|
|
1379
|
+
getKeys
|
|
1380
|
+
} = create$2();
|
|
1381
|
+
|
|
1382
|
+
const create = (id, uri, x, y, width, height, platform, parentId) => {
|
|
1383
|
+
number(parentId);
|
|
1384
|
+
const state = {
|
|
1385
|
+
buttons: [],
|
|
1386
|
+
collapsedUris: [],
|
|
1387
|
+
error: '',
|
|
1388
|
+
errorCode: 0,
|
|
1389
|
+
filteredItems: [],
|
|
1390
|
+
filterValue: '',
|
|
1391
|
+
focusedIndex: -2,
|
|
1392
|
+
height,
|
|
1393
|
+
inputSource: User,
|
|
1394
|
+
itemHeight: 22,
|
|
1395
|
+
listItems: [],
|
|
1396
|
+
logLevel: 0,
|
|
1397
|
+
maxLineY: 0,
|
|
1398
|
+
message: '',
|
|
1399
|
+
minLineY: 0,
|
|
1400
|
+
options: [],
|
|
1401
|
+
parentId,
|
|
1402
|
+
platform,
|
|
1403
|
+
scrollLockEnabled: false,
|
|
1404
|
+
selectedOption: '',
|
|
1405
|
+
smallWidthBreakPoint: 650,
|
|
1406
|
+
uid: id,
|
|
1407
|
+
uri,
|
|
1408
|
+
watchId: 0,
|
|
1409
|
+
width,
|
|
1410
|
+
workspaceUri: '',
|
|
1411
|
+
x,
|
|
1412
|
+
y
|
|
1558
1413
|
};
|
|
1414
|
+
set$2(id, state, state);
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1417
|
+
const isEqual$2 = (oldState, newState) => {
|
|
1418
|
+
return newState.inputSource === User || oldState.filterValue === newState.filterValue;
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1422
|
+
return oldState.selectedOption === newState.selectedOption && oldState.listItems === newState.listItems && oldState.filteredItems === newState.filteredItems;
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
const isEqual = (oldState, newState) => {
|
|
1426
|
+
return oldState.selectedOption === newState.selectedOption;
|
|
1427
|
+
};
|
|
1428
|
+
|
|
1429
|
+
const RenderItems = 1;
|
|
1430
|
+
const RenderFilterValue = 2;
|
|
1431
|
+
const RenderSelectedItem = 3;
|
|
1432
|
+
|
|
1433
|
+
const modules = [isEqual$1, isEqual$2, isEqual];
|
|
1434
|
+
const numbers = [RenderItems, RenderFilterValue, RenderSelectedItem];
|
|
1435
|
+
|
|
1436
|
+
const diff = (oldState, newState) => {
|
|
1437
|
+
const diffResult = [];
|
|
1438
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1439
|
+
const fn = modules[i];
|
|
1440
|
+
if (!fn(oldState, newState)) {
|
|
1441
|
+
diffResult.push(numbers[i]);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
return diffResult;
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
const diff2 = uid => {
|
|
1448
|
+
const {
|
|
1449
|
+
oldState,
|
|
1450
|
+
newState
|
|
1451
|
+
} = get(uid);
|
|
1452
|
+
const diffResult = diff(oldState, newState);
|
|
1453
|
+
return diffResult;
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
const disableScrollLock = async state => {
|
|
1457
|
+
const {
|
|
1458
|
+
scrollLockEnabled
|
|
1459
|
+
} = state;
|
|
1460
|
+
if (!scrollLockEnabled) {
|
|
1461
|
+
return state;
|
|
1462
|
+
}
|
|
1463
|
+
return {
|
|
1464
|
+
...state,
|
|
1465
|
+
scrollLockEnabled: false
|
|
1466
|
+
};
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
const enableScrollLock = async state => {
|
|
1470
|
+
const {
|
|
1471
|
+
scrollLockEnabled
|
|
1472
|
+
} = state;
|
|
1473
|
+
if (scrollLockEnabled) {
|
|
1474
|
+
return state;
|
|
1475
|
+
}
|
|
1476
|
+
return {
|
|
1477
|
+
...state,
|
|
1478
|
+
scrollLockEnabled: true
|
|
1479
|
+
};
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
const focusIndex = (state, index) => {
|
|
1483
|
+
return {
|
|
1484
|
+
...state,
|
|
1485
|
+
focusedIndex: index
|
|
1486
|
+
};
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
const commandMapRef = {};
|
|
1490
|
+
|
|
1491
|
+
const toCommandId = key => {
|
|
1492
|
+
const dotIndex = key.indexOf('.');
|
|
1493
|
+
return key.slice(dotIndex + 1);
|
|
1494
|
+
};
|
|
1495
|
+
const getCommandIds = () => {
|
|
1496
|
+
const keys = Object.keys(commandMapRef);
|
|
1497
|
+
const ids = keys.map(toCommandId);
|
|
1498
|
+
return ids;
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
const ToolBar = 'toolbar';
|
|
1502
|
+
const AriaRoles = {
|
|
1503
|
+
__proto__: null,
|
|
1504
|
+
ToolBar};
|
|
1505
|
+
const Space = 9;
|
|
1506
|
+
const PageUp = 10;
|
|
1507
|
+
const PageDown = 11;
|
|
1508
|
+
const End = 255;
|
|
1509
|
+
const Home = 12;
|
|
1510
|
+
const LeftArrow = 13;
|
|
1511
|
+
const UpArrow = 14;
|
|
1512
|
+
const RightArrow = 15;
|
|
1513
|
+
const DownArrow = 16;
|
|
1514
|
+
const KeyCode = {
|
|
1515
|
+
__proto__: null,
|
|
1516
|
+
DownArrow,
|
|
1517
|
+
End,
|
|
1518
|
+
Home,
|
|
1519
|
+
LeftArrow,
|
|
1520
|
+
PageDown,
|
|
1521
|
+
PageUp,
|
|
1522
|
+
RightArrow,
|
|
1523
|
+
Space,
|
|
1524
|
+
UpArrow
|
|
1525
|
+
};
|
|
1526
|
+
const mergeClassNames = (...classNames) => {
|
|
1527
|
+
return classNames.filter(Boolean).join(' ');
|
|
1528
|
+
};
|
|
1529
|
+
const Button = 1;
|
|
1530
|
+
const Div = 4;
|
|
1531
|
+
const Input = 6;
|
|
1532
|
+
const Text = 12;
|
|
1533
|
+
const Select$1 = 63;
|
|
1534
|
+
const Option$1 = 64;
|
|
1535
|
+
const VirtualDomElements = {
|
|
1536
|
+
__proto__: null,
|
|
1537
|
+
Button,
|
|
1538
|
+
Div,
|
|
1539
|
+
Input,
|
|
1540
|
+
Option: Option$1,
|
|
1541
|
+
Select: Select$1};
|
|
1542
|
+
const text = data => {
|
|
1543
|
+
return {
|
|
1544
|
+
type: Text,
|
|
1545
|
+
text: data,
|
|
1546
|
+
childCount: 0
|
|
1547
|
+
};
|
|
1548
|
+
};
|
|
1549
|
+
|
|
1550
|
+
const FocusProblems = 19;
|
|
1551
|
+
|
|
1552
|
+
const getKeyBindings = () => {
|
|
1553
|
+
return [{
|
|
1554
|
+
key: KeyCode.DownArrow,
|
|
1555
|
+
command: 'Problems.focusNext',
|
|
1556
|
+
when: FocusProblems
|
|
1557
|
+
}, {
|
|
1558
|
+
key: KeyCode.UpArrow,
|
|
1559
|
+
command: 'Problems.focusPrevious',
|
|
1560
|
+
when: FocusProblems
|
|
1561
|
+
}, {
|
|
1562
|
+
key: KeyCode.Home,
|
|
1563
|
+
command: 'Problems.focusFirst',
|
|
1564
|
+
when: FocusProblems
|
|
1565
|
+
}, {
|
|
1566
|
+
key: KeyCode.PageUp,
|
|
1567
|
+
command: 'Problems.focusFirst',
|
|
1568
|
+
when: FocusProblems
|
|
1569
|
+
}, {
|
|
1570
|
+
key: KeyCode.PageDown,
|
|
1571
|
+
command: 'Problems.focusLast',
|
|
1572
|
+
when: FocusProblems
|
|
1573
|
+
}, {
|
|
1574
|
+
key: KeyCode.End,
|
|
1575
|
+
command: 'Problems.focusLast',
|
|
1576
|
+
when: FocusProblems
|
|
1577
|
+
}, {
|
|
1578
|
+
key: KeyCode.Space,
|
|
1579
|
+
command: 'Problems.selectCurrent',
|
|
1580
|
+
when: FocusProblems
|
|
1581
|
+
}, {
|
|
1582
|
+
key: KeyCode.Home,
|
|
1583
|
+
command: 'Problems.focusFirst',
|
|
1584
|
+
when: FocusProblems
|
|
1585
|
+
}, {
|
|
1586
|
+
key: KeyCode.End,
|
|
1587
|
+
command: 'Problems.focusLast',
|
|
1588
|
+
when: FocusProblems
|
|
1589
|
+
}, {
|
|
1590
|
+
key: KeyCode.LeftArrow,
|
|
1591
|
+
command: 'Problems.handleArrowLeft',
|
|
1592
|
+
when: FocusProblems
|
|
1593
|
+
}, {
|
|
1594
|
+
key: KeyCode.RightArrow,
|
|
1595
|
+
command: 'Problems.handleArrowRight',
|
|
1596
|
+
when: FocusProblems
|
|
1597
|
+
}];
|
|
1559
1598
|
};
|
|
1560
1599
|
|
|
1561
1600
|
const Filter = 'filter';
|
|
1562
|
-
const Output$
|
|
1601
|
+
const Output$1 = 'output';
|
|
1563
1602
|
const MainProcess = 'MainProcess';
|
|
1564
1603
|
const SharedProcess = 'SharedProcess';
|
|
1565
1604
|
const Clear = 'Clear';
|
|
@@ -1583,6 +1622,11 @@ const handleButtonClick = async (state, name) => {
|
|
|
1583
1622
|
return fn(state);
|
|
1584
1623
|
};
|
|
1585
1624
|
|
|
1625
|
+
const handleContextMenu = async (state, x, y, button) => {
|
|
1626
|
+
// TODO open context menu
|
|
1627
|
+
return state;
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1586
1630
|
const handleData = async state => {
|
|
1587
1631
|
// TODO
|
|
1588
1632
|
return {
|
|
@@ -1597,14 +1641,7 @@ const handleError = async state => {
|
|
|
1597
1641
|
};
|
|
1598
1642
|
};
|
|
1599
1643
|
|
|
1600
|
-
const
|
|
1601
|
-
if (!filterValue) {
|
|
1602
|
-
return items;
|
|
1603
|
-
}
|
|
1604
|
-
return items.filter(item => item.includes(filterValue));
|
|
1605
|
-
};
|
|
1606
|
-
|
|
1607
|
-
const handleFilterInput = async (state, value) => {
|
|
1644
|
+
const handleFilterInput = async (state, value, inputSource = User) => {
|
|
1608
1645
|
const {
|
|
1609
1646
|
listItems
|
|
1610
1647
|
} = state;
|
|
@@ -1612,7 +1649,8 @@ const handleFilterInput = async (state, value) => {
|
|
|
1612
1649
|
return {
|
|
1613
1650
|
...state,
|
|
1614
1651
|
filterValue: value,
|
|
1615
|
-
filteredItems: filteredItems
|
|
1652
|
+
filteredItems: filteredItems,
|
|
1653
|
+
inputSource
|
|
1616
1654
|
};
|
|
1617
1655
|
};
|
|
1618
1656
|
|
|
@@ -1632,7 +1670,7 @@ const {
|
|
|
1632
1670
|
const handleFileChange = async watchId => {
|
|
1633
1671
|
const keys = getKeys();
|
|
1634
1672
|
for (const key of keys) {
|
|
1635
|
-
const instance = get
|
|
1673
|
+
const instance = get(key);
|
|
1636
1674
|
if (instance.newState.watchId === watchId) {
|
|
1637
1675
|
// @ts-ignore
|
|
1638
1676
|
await invoke$1('Output.refresh');
|
|
@@ -1647,13 +1685,22 @@ const registerWatchCallback = (id, fn) => {
|
|
|
1647
1685
|
const executeWatchCallBack = id => {
|
|
1648
1686
|
watchCallbacks[id](id);
|
|
1649
1687
|
};
|
|
1688
|
+
const unregisterWatchCallback = id => {
|
|
1689
|
+
delete watchCallbacks[id];
|
|
1690
|
+
};
|
|
1650
1691
|
|
|
1651
|
-
const setupChangeListener = async (
|
|
1692
|
+
const setupChangeListener = async (oldWatchId, newWatchId, uri) => {
|
|
1652
1693
|
try {
|
|
1694
|
+
if (oldWatchId) {
|
|
1695
|
+
unregisterWatchCallback(oldWatchId);
|
|
1696
|
+
// @ts-ignore
|
|
1697
|
+
await FileSystemWorker.invoke('FileSystem.unwatchFile', oldWatchId);
|
|
1698
|
+
}
|
|
1699
|
+
// TODO dispose old watcher
|
|
1653
1700
|
const rpcId = RpcId.OutputWorker;
|
|
1654
|
-
registerWatchCallback(
|
|
1701
|
+
registerWatchCallback(newWatchId, handleFileChange);
|
|
1655
1702
|
// @ts-ignore
|
|
1656
|
-
await FileSystemWorker.invoke(
|
|
1703
|
+
await FileSystemWorker.invoke('FileSystem.watchFile', newWatchId, /* path */uri, rpcId);
|
|
1657
1704
|
} catch {
|
|
1658
1705
|
// ignore
|
|
1659
1706
|
}
|
|
@@ -1662,7 +1709,8 @@ const setupChangeListener = async (watchId, uri) => {
|
|
|
1662
1709
|
const selectChannel = async (state, id) => {
|
|
1663
1710
|
const {
|
|
1664
1711
|
options,
|
|
1665
|
-
filterValue
|
|
1712
|
+
filterValue,
|
|
1713
|
+
watchId
|
|
1666
1714
|
} = state;
|
|
1667
1715
|
const matchingOption = options.find(option => option.id === id);
|
|
1668
1716
|
if (!matchingOption) {
|
|
@@ -1676,8 +1724,8 @@ const selectChannel = async (state, id) => {
|
|
|
1676
1724
|
} = await loadLines(matchingOption.uri);
|
|
1677
1725
|
|
|
1678
1726
|
// TODO memory leak and race condition, need to dispose file watcher of previous uri
|
|
1679
|
-
const
|
|
1680
|
-
await setupChangeListener(watchId, matchingOption.uri);
|
|
1727
|
+
const newWatchId = createWatchId();
|
|
1728
|
+
await setupChangeListener(watchId, newWatchId, matchingOption.uri);
|
|
1681
1729
|
const filteredItems = filterItems(lines, filterValue);
|
|
1682
1730
|
return {
|
|
1683
1731
|
...state,
|
|
@@ -1686,7 +1734,7 @@ const selectChannel = async (state, id) => {
|
|
|
1686
1734
|
listItems: lines,
|
|
1687
1735
|
filteredItems,
|
|
1688
1736
|
selectedOption: id,
|
|
1689
|
-
watchId
|
|
1737
|
+
watchId: newWatchId
|
|
1690
1738
|
};
|
|
1691
1739
|
};
|
|
1692
1740
|
|
|
@@ -1737,7 +1785,7 @@ const createFileSystemWorkerRpc = async () => {
|
|
|
1737
1785
|
|
|
1738
1786
|
const initializeFileSystemWorker = async () => {
|
|
1739
1787
|
const rpc = await createFileSystemWorkerRpc();
|
|
1740
|
-
set$
|
|
1788
|
+
set$3(rpc);
|
|
1741
1789
|
};
|
|
1742
1790
|
|
|
1743
1791
|
const initialize = async () => {
|
|
@@ -1765,7 +1813,7 @@ const loadButtons = () => {
|
|
|
1765
1813
|
}, {
|
|
1766
1814
|
id: Settings,
|
|
1767
1815
|
label: 'Settings',
|
|
1768
|
-
icon: '
|
|
1816
|
+
icon: 'MaskIconSettingsGear'
|
|
1769
1817
|
}];
|
|
1770
1818
|
};
|
|
1771
1819
|
|
|
@@ -1818,7 +1866,8 @@ const getMatchingOpen = (options, id) => {
|
|
|
1818
1866
|
};
|
|
1819
1867
|
const loadContent = async (state, savedState) => {
|
|
1820
1868
|
const {
|
|
1821
|
-
platform
|
|
1869
|
+
platform,
|
|
1870
|
+
watchId
|
|
1822
1871
|
} = state;
|
|
1823
1872
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
1824
1873
|
const selectedId = getSelectedItem(platform);
|
|
@@ -1835,8 +1884,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1835
1884
|
error,
|
|
1836
1885
|
code
|
|
1837
1886
|
} = await loadLines(uri);
|
|
1838
|
-
const
|
|
1839
|
-
await setupChangeListener(watchId, uri);
|
|
1887
|
+
const newWatchId = createWatchId();
|
|
1888
|
+
await setupChangeListener(watchId, newWatchId, uri);
|
|
1840
1889
|
const buttons = loadButtons();
|
|
1841
1890
|
return {
|
|
1842
1891
|
...state,
|
|
@@ -1849,7 +1898,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1849
1898
|
options,
|
|
1850
1899
|
selectedOption: selectedId,
|
|
1851
1900
|
buttons,
|
|
1852
|
-
watchId
|
|
1901
|
+
watchId: newWatchId
|
|
1853
1902
|
};
|
|
1854
1903
|
};
|
|
1855
1904
|
|
|
@@ -1860,73 +1909,8 @@ const openFindWidget = async state => {
|
|
|
1860
1909
|
};
|
|
1861
1910
|
};
|
|
1862
1911
|
|
|
1863
|
-
const Button = 1;
|
|
1864
|
-
const Select$1 = 2;
|
|
1865
|
-
|
|
1866
|
-
const Blank = 'Blank';
|
|
1867
|
-
const ClearAll = 'ClearAll';
|
|
1868
|
-
|
|
1869
|
-
const emptyObject = {};
|
|
1870
|
-
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1871
|
-
const i18nString = (key, placeholders = emptyObject) => {
|
|
1872
|
-
if (placeholders === emptyObject) {
|
|
1873
|
-
return key;
|
|
1874
|
-
}
|
|
1875
|
-
const replacer = (match, rest) => {
|
|
1876
|
-
return placeholders[rest];
|
|
1877
|
-
};
|
|
1878
|
-
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1879
|
-
};
|
|
1880
|
-
|
|
1881
|
-
const Output$1 = 'output';
|
|
1882
|
-
const ClearOutput = 'clear output';
|
|
1883
|
-
const TurnOffAutoScroll = 'Turn auto scrolling off';
|
|
1884
|
-
const OpenLogFile = 'open output log file';
|
|
1885
|
-
const LogFileNotFound$1 = 'The log file was not found.';
|
|
1886
|
-
|
|
1887
|
-
const output = () => {
|
|
1888
|
-
return i18nString(Output$1);
|
|
1889
|
-
};
|
|
1890
|
-
const clearOutput = () => {
|
|
1891
|
-
return i18nString(ClearOutput);
|
|
1892
|
-
};
|
|
1893
|
-
const turnOffAutoScroll = () => {
|
|
1894
|
-
return i18nString(TurnOffAutoScroll);
|
|
1895
|
-
};
|
|
1896
|
-
const openLogFile = () => {
|
|
1897
|
-
return i18nString(OpenLogFile);
|
|
1898
|
-
};
|
|
1899
|
-
const logFileNotFound = () => {
|
|
1900
|
-
return i18nString(LogFileNotFound$1);
|
|
1901
|
-
};
|
|
1902
|
-
|
|
1903
|
-
const toSelectOption = option => {
|
|
1904
|
-
return option.name;
|
|
1905
|
-
};
|
|
1906
|
-
const toSelectOptions = options => {
|
|
1907
|
-
return options.map(toSelectOption);
|
|
1908
|
-
};
|
|
1909
1912
|
const getActions = state => {
|
|
1910
|
-
|
|
1911
|
-
options
|
|
1912
|
-
} = state;
|
|
1913
|
-
return [{
|
|
1914
|
-
type: Select$1,
|
|
1915
|
-
id: output(),
|
|
1916
|
-
options: toSelectOptions(options)
|
|
1917
|
-
}, {
|
|
1918
|
-
type: Button,
|
|
1919
|
-
id: clearOutput(),
|
|
1920
|
-
icon: ClearAll
|
|
1921
|
-
}, {
|
|
1922
|
-
type: Button,
|
|
1923
|
-
id: turnOffAutoScroll(),
|
|
1924
|
-
icon: Blank
|
|
1925
|
-
}, {
|
|
1926
|
-
type: Button,
|
|
1927
|
-
id: openLogFile(),
|
|
1928
|
-
icon: Blank
|
|
1929
|
-
}];
|
|
1913
|
+
return [];
|
|
1930
1914
|
};
|
|
1931
1915
|
|
|
1932
1916
|
const refresh = async state => {
|
|
@@ -1955,7 +1939,7 @@ const refresh = async state => {
|
|
|
1955
1939
|
};
|
|
1956
1940
|
|
|
1957
1941
|
const renderFilterValue = (oldState, newState) => {
|
|
1958
|
-
return ['Viewlet.setValueByName', Filter, newState.filterValue];
|
|
1942
|
+
return ['Viewlet.setValueByName', newState.parentId, Filter, newState.filterValue];
|
|
1959
1943
|
};
|
|
1960
1944
|
|
|
1961
1945
|
const IconButton = 'IconButton';
|
|
@@ -1988,7 +1972,25 @@ const getContentDom = (lines, error) => {
|
|
|
1988
1972
|
}, ...lines.flatMap(getLineDom)];
|
|
1989
1973
|
};
|
|
1990
1974
|
|
|
1991
|
-
const LogFileNotFound = 1;
|
|
1975
|
+
const LogFileNotFound$1 = 1;
|
|
1976
|
+
|
|
1977
|
+
const emptyObject = {};
|
|
1978
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1979
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1980
|
+
if (placeholders === emptyObject) {
|
|
1981
|
+
return key;
|
|
1982
|
+
}
|
|
1983
|
+
const replacer = (match, rest) => {
|
|
1984
|
+
return placeholders[rest];
|
|
1985
|
+
};
|
|
1986
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1987
|
+
};
|
|
1988
|
+
|
|
1989
|
+
const LogFileNotFound = 'The log file was not found.';
|
|
1990
|
+
|
|
1991
|
+
const logFileNotFound = () => {
|
|
1992
|
+
return i18nString(LogFileNotFound);
|
|
1993
|
+
};
|
|
1992
1994
|
|
|
1993
1995
|
const getLogFileNotFoundDom = () => {
|
|
1994
1996
|
return [{
|
|
@@ -2003,7 +2005,7 @@ const getErrorDom = (errorCode, error) => {
|
|
|
2003
2005
|
if (!error) {
|
|
2004
2006
|
return [];
|
|
2005
2007
|
}
|
|
2006
|
-
if (errorCode === LogFileNotFound) {
|
|
2008
|
+
if (errorCode === LogFileNotFound$1) {
|
|
2007
2009
|
return getLogFileNotFoundDom();
|
|
2008
2010
|
}
|
|
2009
2011
|
return [{
|
|
@@ -2029,7 +2031,7 @@ const renderItems = (oldState, newState) => {
|
|
|
2029
2031
|
|
|
2030
2032
|
const renderSelectedItem = (oldState, newState) => {
|
|
2031
2033
|
const value = newState.selectedOption;
|
|
2032
|
-
const name = Output$
|
|
2034
|
+
const name = Output$1;
|
|
2033
2035
|
return ['Viewlet.setValueByName', newState.parentId, name, value];
|
|
2034
2036
|
};
|
|
2035
2037
|
|
|
@@ -2059,8 +2061,8 @@ const render2 = (uid, diffResult) => {
|
|
|
2059
2061
|
const {
|
|
2060
2062
|
oldState,
|
|
2061
2063
|
newState
|
|
2062
|
-
} = get
|
|
2063
|
-
set$
|
|
2064
|
+
} = get(uid);
|
|
2065
|
+
set$2(uid, newState, newState);
|
|
2064
2066
|
const commands = applyRender(oldState, newState, diffResult);
|
|
2065
2067
|
return commands;
|
|
2066
2068
|
};
|
|
@@ -2107,7 +2109,8 @@ const getFilterVirtualDom = () => {
|
|
|
2107
2109
|
className: 'InputBox FilterInput',
|
|
2108
2110
|
childCount: 0,
|
|
2109
2111
|
placeholder,
|
|
2110
|
-
onInput: HandleFilterInput
|
|
2112
|
+
onInput: HandleFilterInput,
|
|
2113
|
+
name: Filter
|
|
2111
2114
|
}];
|
|
2112
2115
|
};
|
|
2113
2116
|
|
|
@@ -2129,7 +2132,7 @@ const getSelectVirtualDom = options => {
|
|
|
2129
2132
|
type: VirtualDomElements.Select,
|
|
2130
2133
|
className: Select,
|
|
2131
2134
|
childCount: options.length,
|
|
2132
|
-
name: Output$
|
|
2135
|
+
name: Output$1,
|
|
2133
2136
|
onChange: HandleSelect
|
|
2134
2137
|
}, ...options.flatMap(getOptionVirtualDom)];
|
|
2135
2138
|
};
|
|
@@ -2192,14 +2195,30 @@ const resize = (state, dimensions) => {
|
|
|
2192
2195
|
};
|
|
2193
2196
|
};
|
|
2194
2197
|
|
|
2198
|
+
const saveOutputAs = async state => {
|
|
2199
|
+
// TODO show open file picker
|
|
2200
|
+
// TODO write to file
|
|
2201
|
+
// TODO if error occurs, show error dialog
|
|
2202
|
+
return state;
|
|
2203
|
+
};
|
|
2204
|
+
|
|
2195
2205
|
const saveState = state => {
|
|
2196
2206
|
const {
|
|
2197
2207
|
filterValue,
|
|
2198
|
-
collapsedUris
|
|
2208
|
+
collapsedUris,
|
|
2209
|
+
selectedOption
|
|
2199
2210
|
} = state;
|
|
2200
2211
|
return {
|
|
2201
2212
|
filterValue,
|
|
2202
|
-
collapsedUris
|
|
2213
|
+
collapsedUris,
|
|
2214
|
+
selectedOption
|
|
2215
|
+
};
|
|
2216
|
+
};
|
|
2217
|
+
|
|
2218
|
+
const setLogLevel = async (state, logLevel) => {
|
|
2219
|
+
return {
|
|
2220
|
+
...state,
|
|
2221
|
+
logLevel
|
|
2203
2222
|
};
|
|
2204
2223
|
};
|
|
2205
2224
|
|
|
@@ -2211,31 +2230,37 @@ const setOutputChannel = async state => {
|
|
|
2211
2230
|
};
|
|
2212
2231
|
|
|
2213
2232
|
const commandMap = {
|
|
2233
|
+
'Output.clear': wrapCommand(clear),
|
|
2214
2234
|
'Output.closeFindWidget': wrapCommand(closeFindWidget),
|
|
2215
|
-
'Output.create': create
|
|
2235
|
+
'Output.create': create,
|
|
2216
2236
|
'Output.diff2': diff2,
|
|
2237
|
+
'Output.disableScrollLock': wrapCommand(disableScrollLock),
|
|
2238
|
+
'Output.enableScrollLock': wrapCommand(enableScrollLock),
|
|
2217
2239
|
'Output.executeWatchCallback': executeWatchCallBack,
|
|
2218
2240
|
'Output.focusIndex': wrapCommand(focusIndex),
|
|
2219
2241
|
'Output.getActions': getActions,
|
|
2220
2242
|
'Output.getCommandIds': getCommandIds,
|
|
2221
2243
|
'Output.getKeyBindings': getKeyBindings,
|
|
2222
2244
|
'Output.handleButtonClick': wrapCommand(handleButtonClick),
|
|
2245
|
+
'Output.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2223
2246
|
'Output.handleData': wrapCommand(handleData),
|
|
2224
2247
|
'Output.handleError': wrapCommand(handleError),
|
|
2225
|
-
'Output.selectChannel': wrapCommand(selectChannel),
|
|
2226
2248
|
'Output.handleFilterInput': wrapCommand(handleFilterInput),
|
|
2227
2249
|
'Output.handleSelect': wrapCommand(handleSelect),
|
|
2228
2250
|
'Output.initialize': initialize,
|
|
2229
2251
|
'Output.loadContent2': wrapCommand(loadContent),
|
|
2230
2252
|
'Output.openFindWidget': wrapCommand(openFindWidget),
|
|
2253
|
+
'Output.refresh': wrapCommand(refresh),
|
|
2231
2254
|
'Output.render2': render2,
|
|
2232
2255
|
'Output.renderActions': wrapGetter(renderActions),
|
|
2233
2256
|
'Output.renderEventListeners': renderEventListeners,
|
|
2234
2257
|
'Output.resize': resize,
|
|
2258
|
+
'Output.saveOutputAs': wrapCommand(saveOutputAs),
|
|
2235
2259
|
'Output.saveState': saveState,
|
|
2260
|
+
'Output.selectChannel': wrapCommand(selectChannel),
|
|
2261
|
+
'Output.setLogLevel': setLogLevel,
|
|
2236
2262
|
'Output.setOutputChannel': wrapCommand(setOutputChannel),
|
|
2237
|
-
'Output.terminate': terminate
|
|
2238
|
-
'Output.refresh': wrapCommand(refresh)
|
|
2263
|
+
'Output.terminate': terminate
|
|
2239
2264
|
};
|
|
2240
2265
|
|
|
2241
2266
|
const listen = async () => {
|