@lvce-editor/activity-bar-worker 1.30.0 → 2.1.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/activityBarWorkerMain.js +261 -186
- package/package.json +1 -1
|
@@ -54,6 +54,49 @@ class VError extends Error {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
class AssertionError extends Error {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = 'AssertionError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const Object$1 = 1;
|
|
64
|
+
const Number$1 = 2;
|
|
65
|
+
const Array$1 = 3;
|
|
66
|
+
const String = 4;
|
|
67
|
+
const Boolean$1 = 5;
|
|
68
|
+
const Function = 6;
|
|
69
|
+
const Null = 7;
|
|
70
|
+
const Unknown = 8;
|
|
71
|
+
const getType = value => {
|
|
72
|
+
switch (typeof value) {
|
|
73
|
+
case 'number':
|
|
74
|
+
return Number$1;
|
|
75
|
+
case 'function':
|
|
76
|
+
return Function;
|
|
77
|
+
case 'string':
|
|
78
|
+
return String;
|
|
79
|
+
case 'object':
|
|
80
|
+
if (value === null) {
|
|
81
|
+
return Null;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
return Array$1;
|
|
85
|
+
}
|
|
86
|
+
return Object$1;
|
|
87
|
+
case 'boolean':
|
|
88
|
+
return Boolean$1;
|
|
89
|
+
default:
|
|
90
|
+
return Unknown;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const number = value => {
|
|
94
|
+
const type = getType(value);
|
|
95
|
+
if (type !== Number$1) {
|
|
96
|
+
throw new AssertionError('expected value to be of type number');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
57
100
|
const isMessagePort = value => {
|
|
58
101
|
return value && value instanceof MessagePort;
|
|
59
102
|
};
|
|
@@ -913,6 +956,14 @@ const create$2 = rpcId => {
|
|
|
913
956
|
const {
|
|
914
957
|
invoke,
|
|
915
958
|
set: set$1} = create$2(RendererWorker);
|
|
959
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
960
|
+
number(uid);
|
|
961
|
+
number(menuId);
|
|
962
|
+
number(x);
|
|
963
|
+
number(y);
|
|
964
|
+
// @ts-ignore
|
|
965
|
+
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
966
|
+
};
|
|
916
967
|
|
|
917
968
|
const toCommandId = key => {
|
|
918
969
|
const dotIndex = key.indexOf('.');
|
|
@@ -947,10 +998,11 @@ const create$1 = () => {
|
|
|
947
998
|
wrapCommand(fn) {
|
|
948
999
|
const wrapped = async (uid, ...args) => {
|
|
949
1000
|
const {
|
|
1001
|
+
oldState,
|
|
950
1002
|
newState
|
|
951
1003
|
} = states[uid];
|
|
952
1004
|
const newerState = await fn(newState, ...args);
|
|
953
|
-
if (newState === newerState) {
|
|
1005
|
+
if (oldState === newerState || newState === newerState) {
|
|
954
1006
|
return;
|
|
955
1007
|
}
|
|
956
1008
|
const latest = states[uid];
|
|
@@ -999,37 +1051,38 @@ const terminate = () => {
|
|
|
999
1051
|
};
|
|
1000
1052
|
|
|
1001
1053
|
const {
|
|
1054
|
+
diff,
|
|
1002
1055
|
get,
|
|
1003
|
-
set,
|
|
1004
|
-
registerCommands,
|
|
1005
1056
|
getCommandIds,
|
|
1006
|
-
|
|
1057
|
+
registerCommands,
|
|
1058
|
+
set,
|
|
1007
1059
|
wrapCommand,
|
|
1008
|
-
|
|
1060
|
+
wrapGetter
|
|
1009
1061
|
} = create$1();
|
|
1010
1062
|
|
|
1011
1063
|
// TODO parentUid might ot be needed
|
|
1012
1064
|
const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) => {
|
|
1013
1065
|
const state = {
|
|
1066
|
+
activityBarItems: [],
|
|
1014
1067
|
currentViewletId: '',
|
|
1015
|
-
|
|
1068
|
+
filteredItems: [],
|
|
1016
1069
|
focus: 0,
|
|
1017
1070
|
focused: false,
|
|
1018
1071
|
focusedIndex: -1,
|
|
1019
|
-
scrollBarHeight: 0,
|
|
1020
|
-
width,
|
|
1021
1072
|
height,
|
|
1022
|
-
x,
|
|
1023
|
-
y,
|
|
1024
|
-
sideBarVisible: false,
|
|
1025
|
-
activityBarItems: [],
|
|
1026
|
-
selectedIndex: -1,
|
|
1027
1073
|
itemHeight: 48,
|
|
1028
|
-
updateState: '',
|
|
1029
|
-
updateProgress: 0,
|
|
1030
|
-
filteredItems: [],
|
|
1031
1074
|
numberOfVisibleItems: 0,
|
|
1032
|
-
|
|
1075
|
+
platform: 0,
|
|
1076
|
+
scrollBarHeight: 0,
|
|
1077
|
+
selectedIndex: -1,
|
|
1078
|
+
sideBarLocation: 0,
|
|
1079
|
+
sideBarVisible: false,
|
|
1080
|
+
uid: id,
|
|
1081
|
+
updateProgress: 0,
|
|
1082
|
+
updateState: '',
|
|
1083
|
+
width,
|
|
1084
|
+
x,
|
|
1085
|
+
y
|
|
1033
1086
|
};
|
|
1034
1087
|
set(id, state, state);
|
|
1035
1088
|
return state;
|
|
@@ -1077,8 +1130,8 @@ const focus = state => {
|
|
|
1077
1130
|
const focusIndex = (state, index) => {
|
|
1078
1131
|
return {
|
|
1079
1132
|
...state,
|
|
1080
|
-
|
|
1081
|
-
|
|
1133
|
+
focused: true,
|
|
1134
|
+
focusedIndex: index
|
|
1082
1135
|
};
|
|
1083
1136
|
};
|
|
1084
1137
|
|
|
@@ -1106,36 +1159,36 @@ const focusNone = state => {
|
|
|
1106
1159
|
|
|
1107
1160
|
const getKeyBindings = () => {
|
|
1108
1161
|
return [{
|
|
1109
|
-
key: DownArrow,
|
|
1110
1162
|
command: 'ActivityBar.focusNext',
|
|
1163
|
+
key: DownArrow,
|
|
1111
1164
|
when: FocusActivityBar
|
|
1112
1165
|
}, {
|
|
1113
|
-
key: UpArrow,
|
|
1114
1166
|
command: 'ActivityBar.focusPrevious',
|
|
1167
|
+
key: UpArrow,
|
|
1115
1168
|
when: FocusActivityBar
|
|
1116
1169
|
}, {
|
|
1117
|
-
key: Home,
|
|
1118
1170
|
command: 'ActivityBar.focusFirst',
|
|
1171
|
+
key: Home,
|
|
1119
1172
|
when: FocusActivityBar
|
|
1120
1173
|
}, {
|
|
1121
|
-
key: PageUp,
|
|
1122
1174
|
command: 'ActivityBar.focusFirst',
|
|
1175
|
+
key: PageUp,
|
|
1123
1176
|
when: FocusActivityBar
|
|
1124
1177
|
}, {
|
|
1125
|
-
key: PageDown,
|
|
1126
1178
|
command: 'ActivityBar.focusLast',
|
|
1179
|
+
key: PageDown,
|
|
1127
1180
|
when: FocusActivityBar
|
|
1128
1181
|
}, {
|
|
1129
|
-
key: End,
|
|
1130
1182
|
command: 'ActivityBar.focusLast',
|
|
1183
|
+
key: End,
|
|
1131
1184
|
when: FocusActivityBar
|
|
1132
1185
|
}, {
|
|
1133
|
-
key: Space,
|
|
1134
1186
|
command: 'ActivityBar.selectCurrent',
|
|
1187
|
+
key: Space,
|
|
1135
1188
|
when: FocusActivityBar
|
|
1136
1189
|
}, {
|
|
1137
|
-
key: Enter,
|
|
1138
1190
|
command: 'ActivityBar.selectCurrent',
|
|
1191
|
+
key: Enter,
|
|
1139
1192
|
when: FocusActivityBar
|
|
1140
1193
|
}];
|
|
1141
1194
|
};
|
|
@@ -1213,17 +1266,17 @@ const menuEntryMoveSideBar = sideBarLocation => {
|
|
|
1213
1266
|
switch (sideBarLocation) {
|
|
1214
1267
|
case Left:
|
|
1215
1268
|
return {
|
|
1216
|
-
|
|
1217
|
-
label: moveSideBarRight(),
|
|
1269
|
+
command: 'Layout.moveSideBarRight',
|
|
1218
1270
|
flags: None,
|
|
1219
|
-
|
|
1271
|
+
id: 'moveSideBarRight',
|
|
1272
|
+
label: moveSideBarRight()
|
|
1220
1273
|
};
|
|
1221
1274
|
case Right:
|
|
1222
1275
|
return {
|
|
1223
|
-
|
|
1224
|
-
label: moveSideBarLeft(),
|
|
1276
|
+
command: 'Layout.moveSideBarLeft',
|
|
1225
1277
|
flags: None,
|
|
1226
|
-
|
|
1278
|
+
id: 'moveSideBarLeft',
|
|
1279
|
+
label: moveSideBarLeft()
|
|
1227
1280
|
};
|
|
1228
1281
|
default:
|
|
1229
1282
|
throw new Error('unexpected side bar location');
|
|
@@ -1231,20 +1284,20 @@ const menuEntryMoveSideBar = sideBarLocation => {
|
|
|
1231
1284
|
};
|
|
1232
1285
|
|
|
1233
1286
|
const menuEntrySeparator = {
|
|
1234
|
-
|
|
1235
|
-
label: '',
|
|
1287
|
+
command: '',
|
|
1236
1288
|
flags: Separator,
|
|
1237
|
-
|
|
1289
|
+
id: 'separator',
|
|
1290
|
+
label: ''
|
|
1238
1291
|
};
|
|
1239
1292
|
|
|
1240
1293
|
const toContextMenuItem$1 = activityBarItem => {
|
|
1241
1294
|
const isEnabled = activityBarItem.flags & Enabled;
|
|
1242
1295
|
return {
|
|
1243
|
-
|
|
1296
|
+
command: '',
|
|
1297
|
+
flags: isEnabled ? Checked : Unchecked,
|
|
1244
1298
|
id: '',
|
|
1245
1299
|
// TODO
|
|
1246
|
-
|
|
1247
|
-
command: ''
|
|
1300
|
+
label: activityBarItem.id
|
|
1248
1301
|
};
|
|
1249
1302
|
};
|
|
1250
1303
|
const getMenuEntriesActivityBar = state => {
|
|
@@ -1253,10 +1306,10 @@ const getMenuEntriesActivityBar = state => {
|
|
|
1253
1306
|
sideBarLocation
|
|
1254
1307
|
} = state;
|
|
1255
1308
|
return [...activityBarItems.map(toContextMenuItem$1), menuEntrySeparator, menuEntryMoveSideBar(sideBarLocation), {
|
|
1256
|
-
|
|
1257
|
-
label: hideActivityBar(),
|
|
1309
|
+
command: 'Layout.hideActivityBar',
|
|
1258
1310
|
flags: None,
|
|
1259
|
-
|
|
1311
|
+
id: 'hideActivityBar',
|
|
1312
|
+
label: hideActivityBar()
|
|
1260
1313
|
}];
|
|
1261
1314
|
};
|
|
1262
1315
|
|
|
@@ -1279,11 +1332,12 @@ const getHiddenItems = state => {
|
|
|
1279
1332
|
|
|
1280
1333
|
const toContextMenuItem = activityBarItem => {
|
|
1281
1334
|
return {
|
|
1282
|
-
|
|
1283
|
-
id: '8000',
|
|
1335
|
+
command: '-1',
|
|
1284
1336
|
// TODO
|
|
1285
1337
|
flags: None,
|
|
1286
|
-
|
|
1338
|
+
id: '8000',
|
|
1339
|
+
// TODO
|
|
1340
|
+
label: activityBarItem.id
|
|
1287
1341
|
};
|
|
1288
1342
|
};
|
|
1289
1343
|
const getMenuEntriesAdditionalViews = state => {
|
|
@@ -1319,50 +1373,43 @@ const colorTheme = () => {
|
|
|
1319
1373
|
const keyBindingsUri = 'app://keybindings';
|
|
1320
1374
|
const getMenuEntriesSettings = () => {
|
|
1321
1375
|
return [{
|
|
1322
|
-
|
|
1323
|
-
label: commandPalette(),
|
|
1376
|
+
command: 'QuickPick.showEverything',
|
|
1324
1377
|
flags: None,
|
|
1325
|
-
|
|
1378
|
+
id: 'commandPalette',
|
|
1379
|
+
label: commandPalette()
|
|
1326
1380
|
}, menuEntrySeparator, {
|
|
1327
|
-
|
|
1328
|
-
label: settings(),
|
|
1381
|
+
command: 'Preferences.openSettingsJson',
|
|
1329
1382
|
flags: None,
|
|
1330
|
-
|
|
1383
|
+
id: 'settings',
|
|
1384
|
+
label: settings()
|
|
1331
1385
|
}, {
|
|
1332
|
-
|
|
1333
|
-
label: keyboardShortcuts(),
|
|
1334
|
-
flags: None,
|
|
1386
|
+
args: [keyBindingsUri],
|
|
1335
1387
|
command: 'Main.openUri',
|
|
1336
|
-
|
|
1388
|
+
flags: None,
|
|
1389
|
+
id: 'keyboardShortcuts',
|
|
1390
|
+
label: keyboardShortcuts()
|
|
1337
1391
|
}, {
|
|
1338
|
-
|
|
1339
|
-
label: colorTheme(),
|
|
1392
|
+
command: 'QuickPick.showColorTheme',
|
|
1340
1393
|
flags: None,
|
|
1341
|
-
|
|
1394
|
+
id: 'colorTheme',
|
|
1395
|
+
label: colorTheme()
|
|
1342
1396
|
}, menuEntrySeparator, {
|
|
1343
|
-
|
|
1344
|
-
label: checkForUpdates(),
|
|
1397
|
+
command: 'AutoUpdater.checkForUpdates',
|
|
1345
1398
|
flags: None,
|
|
1346
|
-
|
|
1399
|
+
id: 'checkForUpdates',
|
|
1400
|
+
label: checkForUpdates()
|
|
1347
1401
|
}];
|
|
1348
1402
|
};
|
|
1349
1403
|
|
|
1350
|
-
const getMenuEntries = (
|
|
1351
|
-
const tuple = get(id);
|
|
1352
|
-
if (!tuple) {
|
|
1353
|
-
return [];
|
|
1354
|
-
}
|
|
1355
|
-
const {
|
|
1356
|
-
newState
|
|
1357
|
-
} = tuple;
|
|
1404
|
+
const getMenuEntries = (state, options) => {
|
|
1358
1405
|
const {
|
|
1359
1406
|
menuId
|
|
1360
1407
|
} = options;
|
|
1361
1408
|
switch (menuId) {
|
|
1362
1409
|
case ActivityBar$3:
|
|
1363
|
-
return getMenuEntriesActivityBar(
|
|
1410
|
+
return getMenuEntriesActivityBar(state);
|
|
1364
1411
|
case ActivityBarAdditionalViews:
|
|
1365
|
-
return getMenuEntriesAdditionalViews(
|
|
1412
|
+
return getMenuEntriesAdditionalViews(state);
|
|
1366
1413
|
case Settings$1:
|
|
1367
1414
|
return getMenuEntriesSettings();
|
|
1368
1415
|
default:
|
|
@@ -1374,6 +1421,34 @@ const getMenuEntryIds = () => {
|
|
|
1374
1421
|
return [ActivityBar$3, ActivityBarAdditionalViews, Settings$1];
|
|
1375
1422
|
};
|
|
1376
1423
|
|
|
1424
|
+
const updateItemsWithBadgeCount = async items => {
|
|
1425
|
+
try {
|
|
1426
|
+
const badgeCounts = await invoke('Layout.getBadgeCounts');
|
|
1427
|
+
const newItems = items.map(item => {
|
|
1428
|
+
const badgeCount = badgeCounts[item.id] || 0;
|
|
1429
|
+
const badgeText = badgeCount ? `${badgeCount}` : '';
|
|
1430
|
+
return {
|
|
1431
|
+
...item,
|
|
1432
|
+
badgeText
|
|
1433
|
+
};
|
|
1434
|
+
});
|
|
1435
|
+
return newItems;
|
|
1436
|
+
} catch {
|
|
1437
|
+
return items;
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
|
|
1441
|
+
const handleBadgeCountChange = async state => {
|
|
1442
|
+
const {
|
|
1443
|
+
filteredItems
|
|
1444
|
+
} = state;
|
|
1445
|
+
const newItems = await updateItemsWithBadgeCount(filteredItems);
|
|
1446
|
+
return {
|
|
1447
|
+
...state,
|
|
1448
|
+
filteredItems: newItems
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1377
1452
|
const handleBlur = state => {
|
|
1378
1453
|
return {
|
|
1379
1454
|
...state,
|
|
@@ -1411,8 +1486,7 @@ const getIndexFromPosition = (y, eventX, eventY, itemHeight, itemCount, height)
|
|
|
1411
1486
|
};
|
|
1412
1487
|
|
|
1413
1488
|
const show2 = async (uid, menuId, x, y, args) => {
|
|
1414
|
-
|
|
1415
|
-
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1489
|
+
await showContextMenu2(uid, menuId, x, y, args);
|
|
1416
1490
|
};
|
|
1417
1491
|
|
|
1418
1492
|
const handleClickAdditionalViews = async (state, eventX, eventY, viewletId) => {
|
|
@@ -1440,8 +1514,8 @@ const hide = async () => {
|
|
|
1440
1514
|
|
|
1441
1515
|
const handleClickOther = async (state, x, y, viewletId) => {
|
|
1442
1516
|
const {
|
|
1443
|
-
|
|
1444
|
-
|
|
1517
|
+
currentViewletId,
|
|
1518
|
+
sideBarVisible
|
|
1445
1519
|
} = state;
|
|
1446
1520
|
if (sideBarVisible) {
|
|
1447
1521
|
if (currentViewletId === viewletId) {
|
|
@@ -1478,10 +1552,10 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1478
1552
|
const item = filteredItems[index];
|
|
1479
1553
|
const viewletId = item.id;
|
|
1480
1554
|
switch (viewletId) {
|
|
1481
|
-
case 'Settings':
|
|
1482
|
-
return handleClickSettings(state, x, y);
|
|
1483
1555
|
case 'Additional Views':
|
|
1484
1556
|
return handleClickAdditionalViews(state, x, y, viewletId);
|
|
1557
|
+
case 'Settings':
|
|
1558
|
+
return handleClickSettings(state, x, y);
|
|
1485
1559
|
default:
|
|
1486
1560
|
return handleClickOther(state, x, y, viewletId);
|
|
1487
1561
|
}
|
|
@@ -1490,9 +1564,9 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1490
1564
|
const handleClick = async (state, button, eventX, eventY) => {
|
|
1491
1565
|
const {
|
|
1492
1566
|
filteredItems,
|
|
1567
|
+
height,
|
|
1493
1568
|
itemHeight,
|
|
1494
|
-
y
|
|
1495
|
-
height
|
|
1569
|
+
y
|
|
1496
1570
|
} = state;
|
|
1497
1571
|
const index = getIndexFromPosition(y, eventX, eventY, itemHeight, filteredItems.length, height);
|
|
1498
1572
|
return handleClickIndex(state, button, index, eventX, eventY);
|
|
@@ -1525,11 +1599,11 @@ const getFilteredActivityBarItems = (items, height, itemHeight) => {
|
|
|
1525
1599
|
return items;
|
|
1526
1600
|
}
|
|
1527
1601
|
const showMoreItem = {
|
|
1528
|
-
id: 'Additional Views',
|
|
1529
|
-
title: additionalViews(),
|
|
1530
|
-
icon: Ellipsis,
|
|
1531
1602
|
flags: Button,
|
|
1532
|
-
|
|
1603
|
+
icon: Ellipsis,
|
|
1604
|
+
id: 'Additional Views',
|
|
1605
|
+
keyShortcuts: '',
|
|
1606
|
+
title: additionalViews()
|
|
1533
1607
|
};
|
|
1534
1608
|
return [...items.slice(0, numberOfVisibleItems - 2), showMoreItem, items.at(-1)];
|
|
1535
1609
|
};
|
|
@@ -1540,19 +1614,19 @@ const handleResize = (state, dimensions) => {
|
|
|
1540
1614
|
itemHeight
|
|
1541
1615
|
} = state;
|
|
1542
1616
|
const {
|
|
1543
|
-
|
|
1544
|
-
y,
|
|
1617
|
+
height,
|
|
1545
1618
|
width,
|
|
1546
|
-
|
|
1619
|
+
x,
|
|
1620
|
+
y
|
|
1547
1621
|
} = dimensions;
|
|
1548
1622
|
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
1549
1623
|
return {
|
|
1550
1624
|
...state,
|
|
1551
|
-
|
|
1552
|
-
y,
|
|
1553
|
-
width,
|
|
1625
|
+
filteredItems,
|
|
1554
1626
|
height,
|
|
1555
|
-
|
|
1627
|
+
width,
|
|
1628
|
+
x,
|
|
1629
|
+
y
|
|
1556
1630
|
};
|
|
1557
1631
|
};
|
|
1558
1632
|
|
|
@@ -1604,10 +1678,10 @@ const handleSideBarViewletChange = (state, id, ...args) => {
|
|
|
1604
1678
|
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
1605
1679
|
return {
|
|
1606
1680
|
...state,
|
|
1607
|
-
selectedIndex: index,
|
|
1608
|
-
currentViewletId: id,
|
|
1609
1681
|
activityBarItems: newActivityBarItems,
|
|
1682
|
+
currentViewletId: id,
|
|
1610
1683
|
filteredItems,
|
|
1684
|
+
selectedIndex: index,
|
|
1611
1685
|
sideBarVisible: true
|
|
1612
1686
|
};
|
|
1613
1687
|
};
|
|
@@ -1644,9 +1718,9 @@ const handleUpdateStateChange = async (state, config) => {
|
|
|
1644
1718
|
const newItems = getNewItems(filteredItems, config.state);
|
|
1645
1719
|
return {
|
|
1646
1720
|
...state,
|
|
1647
|
-
|
|
1721
|
+
filteredItems: newItems,
|
|
1648
1722
|
updateProgress: config.progress,
|
|
1649
|
-
|
|
1723
|
+
updateState: config.state
|
|
1650
1724
|
};
|
|
1651
1725
|
};
|
|
1652
1726
|
|
|
@@ -1660,50 +1734,50 @@ const getActivityBarItems = () => {
|
|
|
1660
1734
|
return [
|
|
1661
1735
|
// Top
|
|
1662
1736
|
{
|
|
1663
|
-
id: Explorer,
|
|
1664
|
-
title: explorer(),
|
|
1665
|
-
icon: Files,
|
|
1666
1737
|
flags: Tab | Enabled,
|
|
1667
|
-
|
|
1738
|
+
icon: Files,
|
|
1739
|
+
id: Explorer,
|
|
1740
|
+
keyShortcuts: 'Control+Shift+E',
|
|
1741
|
+
title: explorer()
|
|
1668
1742
|
}, {
|
|
1669
|
-
id: Search,
|
|
1670
|
-
title: search(),
|
|
1671
|
-
icon: Search$1,
|
|
1672
1743
|
flags: Tab | Enabled,
|
|
1673
|
-
|
|
1744
|
+
icon: Search$1,
|
|
1745
|
+
id: Search,
|
|
1746
|
+
keyShortcuts: 'Control+Shift+F',
|
|
1747
|
+
title: search()
|
|
1674
1748
|
}, {
|
|
1675
|
-
id: SourceControl,
|
|
1676
|
-
title: sourceControl(),
|
|
1677
|
-
icon: SourceControl$1,
|
|
1678
1749
|
flags: Tab | Enabled,
|
|
1679
|
-
|
|
1750
|
+
icon: SourceControl$1,
|
|
1751
|
+
id: SourceControl,
|
|
1752
|
+
keyShortcuts: 'Control+Shift+G',
|
|
1753
|
+
title: sourceControl()
|
|
1680
1754
|
}, {
|
|
1681
|
-
id: RunAndDebug,
|
|
1682
|
-
title: runAndDebug(),
|
|
1683
|
-
icon: DebugAlt2,
|
|
1684
1755
|
flags: Tab | Enabled,
|
|
1685
|
-
|
|
1756
|
+
icon: DebugAlt2,
|
|
1757
|
+
id: RunAndDebug,
|
|
1758
|
+
keyShortcuts: 'Control+Shift+D',
|
|
1759
|
+
title: runAndDebug()
|
|
1686
1760
|
}, {
|
|
1687
|
-
id: Extensions,
|
|
1688
|
-
title: extensions(),
|
|
1689
|
-
icon: Extensions$1,
|
|
1690
1761
|
flags: Tab | Enabled,
|
|
1691
|
-
|
|
1762
|
+
icon: Extensions$1,
|
|
1763
|
+
id: Extensions,
|
|
1764
|
+
keyShortcuts: 'Control+Shift+X',
|
|
1765
|
+
title: extensions()
|
|
1692
1766
|
},
|
|
1693
1767
|
// Bottom
|
|
1694
1768
|
{
|
|
1695
|
-
id: 'Settings',
|
|
1696
|
-
title: settings$1(),
|
|
1697
|
-
icon: SettingsGear,
|
|
1698
1769
|
flags: Button | Enabled | MarginTop,
|
|
1699
|
-
|
|
1770
|
+
icon: SettingsGear,
|
|
1771
|
+
id: 'Settings',
|
|
1772
|
+
keyShortcuts: '',
|
|
1773
|
+
title: settings$1()
|
|
1700
1774
|
}];
|
|
1701
1775
|
};
|
|
1702
1776
|
|
|
1703
1777
|
const loadContent = async (state, savedState) => {
|
|
1704
1778
|
const {
|
|
1705
|
-
|
|
1706
|
-
|
|
1779
|
+
height,
|
|
1780
|
+
itemHeight
|
|
1707
1781
|
} = state;
|
|
1708
1782
|
const items = getActivityBarItems();
|
|
1709
1783
|
const explorerIndex = 0;
|
|
@@ -1729,8 +1803,8 @@ const getCss = itemHeight => {
|
|
|
1729
1803
|
|
|
1730
1804
|
const renderCss = (oldState, newState) => {
|
|
1731
1805
|
const {
|
|
1732
|
-
|
|
1733
|
-
|
|
1806
|
+
itemHeight,
|
|
1807
|
+
uid
|
|
1734
1808
|
} = newState;
|
|
1735
1809
|
const css = getCss(itemHeight);
|
|
1736
1810
|
return [SetCss, uid, css];
|
|
@@ -1786,17 +1860,17 @@ const getAriaSelected = (isTab, isSelected) => {
|
|
|
1786
1860
|
|
|
1787
1861
|
const getBadgeVirtualDom = () => {
|
|
1788
1862
|
return [{
|
|
1789
|
-
|
|
1863
|
+
childCount: 1,
|
|
1790
1864
|
className: ActivityBarItemBadge,
|
|
1791
|
-
|
|
1865
|
+
type: Div
|
|
1792
1866
|
}, {
|
|
1793
|
-
|
|
1867
|
+
childCount: 1,
|
|
1794
1868
|
className: BadgeContent,
|
|
1795
|
-
|
|
1869
|
+
type: Div
|
|
1796
1870
|
}, {
|
|
1797
|
-
|
|
1871
|
+
childCount: 0,
|
|
1798
1872
|
className: mergeClassNames(Icon, ActivityBarBadgeIcon, MaskIconProgress),
|
|
1799
|
-
|
|
1873
|
+
type: Div
|
|
1800
1874
|
}];
|
|
1801
1875
|
};
|
|
1802
1876
|
|
|
@@ -1817,8 +1891,8 @@ const getClassName = (isFocused, marginTop, isSelected) => {
|
|
|
1817
1891
|
const getActivityBarItemInProgressDom = item => {
|
|
1818
1892
|
const {
|
|
1819
1893
|
flags,
|
|
1820
|
-
|
|
1821
|
-
|
|
1894
|
+
icon,
|
|
1895
|
+
title
|
|
1822
1896
|
} = item;
|
|
1823
1897
|
const isTab = flags & Tab;
|
|
1824
1898
|
const isSelected = flags & Selected;
|
|
@@ -1829,27 +1903,27 @@ const getActivityBarItemInProgressDom = item => {
|
|
|
1829
1903
|
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1830
1904
|
className += ' ' + ActivityBarItemNested;
|
|
1831
1905
|
return [{
|
|
1832
|
-
type: Div,
|
|
1833
|
-
className,
|
|
1834
1906
|
ariaLabel: '',
|
|
1835
|
-
title,
|
|
1836
|
-
role,
|
|
1837
1907
|
ariaSelected,
|
|
1838
|
-
childCount: 2
|
|
1908
|
+
childCount: 2,
|
|
1909
|
+
className,
|
|
1910
|
+
role,
|
|
1911
|
+
title,
|
|
1912
|
+
type: Div
|
|
1839
1913
|
}, {
|
|
1840
|
-
|
|
1914
|
+
childCount: 0,
|
|
1841
1915
|
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1842
1916
|
role: None$1,
|
|
1843
|
-
|
|
1917
|
+
type: Div
|
|
1844
1918
|
}, ...getBadgeVirtualDom()];
|
|
1845
1919
|
};
|
|
1846
1920
|
|
|
1847
1921
|
const getActivityBarItemWithBadgeDom = item => {
|
|
1848
1922
|
const {
|
|
1923
|
+
badgeText,
|
|
1849
1924
|
flags,
|
|
1850
|
-
title,
|
|
1851
1925
|
icon,
|
|
1852
|
-
|
|
1926
|
+
title
|
|
1853
1927
|
} = item;
|
|
1854
1928
|
if (!badgeText) {
|
|
1855
1929
|
// TODO should not happen
|
|
@@ -1864,40 +1938,40 @@ const getActivityBarItemWithBadgeDom = item => {
|
|
|
1864
1938
|
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1865
1939
|
className += ' ' + ActivityBarItemNested;
|
|
1866
1940
|
return [{
|
|
1867
|
-
type: Div,
|
|
1868
|
-
className,
|
|
1869
1941
|
ariaLabel: '',
|
|
1870
|
-
title,
|
|
1871
|
-
role,
|
|
1872
1942
|
ariaSelected,
|
|
1873
|
-
childCount: 2
|
|
1943
|
+
childCount: 2,
|
|
1944
|
+
className,
|
|
1945
|
+
role,
|
|
1946
|
+
title,
|
|
1947
|
+
type: Div
|
|
1874
1948
|
}, {
|
|
1875
|
-
|
|
1949
|
+
childCount: 0,
|
|
1876
1950
|
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1877
1951
|
role: None$1,
|
|
1878
|
-
|
|
1952
|
+
type: Div
|
|
1879
1953
|
}, {
|
|
1880
|
-
|
|
1954
|
+
childCount: 1,
|
|
1881
1955
|
className: ActivityBarItemBadge,
|
|
1882
|
-
|
|
1956
|
+
type: Div
|
|
1883
1957
|
}, text(badgeText)];
|
|
1884
1958
|
};
|
|
1885
1959
|
|
|
1886
1960
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
1887
1961
|
return {
|
|
1888
|
-
|
|
1962
|
+
childCount: 0,
|
|
1889
1963
|
className: `MaskIcon MaskIcon${icon}`,
|
|
1890
1964
|
role: None$1,
|
|
1891
|
-
|
|
1965
|
+
type
|
|
1892
1966
|
};
|
|
1893
1967
|
};
|
|
1894
1968
|
|
|
1895
1969
|
const getActivityBarItemVirtualDom = item => {
|
|
1896
1970
|
const {
|
|
1971
|
+
badgeText,
|
|
1897
1972
|
flags,
|
|
1898
|
-
title,
|
|
1899
1973
|
icon,
|
|
1900
|
-
|
|
1974
|
+
title
|
|
1901
1975
|
} = item;
|
|
1902
1976
|
const isTab = flags & Tab;
|
|
1903
1977
|
const isSelected = flags & Selected;
|
|
@@ -1909,13 +1983,13 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1909
1983
|
const className = getClassName(isFocused, marginTop, isSelected);
|
|
1910
1984
|
if (isSelected) {
|
|
1911
1985
|
return [{
|
|
1912
|
-
type: Div,
|
|
1913
|
-
className,
|
|
1914
1986
|
ariaLabel: '',
|
|
1915
|
-
title,
|
|
1916
|
-
role,
|
|
1917
1987
|
ariaSelected,
|
|
1918
|
-
childCount: 1
|
|
1988
|
+
childCount: 1,
|
|
1989
|
+
className,
|
|
1990
|
+
role,
|
|
1991
|
+
title,
|
|
1992
|
+
type: Div
|
|
1919
1993
|
}, getIconVirtualDom(icon)];
|
|
1920
1994
|
}
|
|
1921
1995
|
|
|
@@ -1927,13 +2001,13 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1927
2001
|
return getActivityBarItemWithBadgeDom(item);
|
|
1928
2002
|
}
|
|
1929
2003
|
return [{
|
|
1930
|
-
type: Div,
|
|
1931
|
-
className: mergeClassNames(className, `Icon${icon}`),
|
|
1932
2004
|
ariaLabel: '',
|
|
1933
|
-
title,
|
|
1934
|
-
role,
|
|
1935
2005
|
ariaSelected,
|
|
1936
|
-
childCount: 0
|
|
2006
|
+
childCount: 0,
|
|
2007
|
+
className: mergeClassNames(className, `Icon${icon}`),
|
|
2008
|
+
role,
|
|
2009
|
+
title,
|
|
2010
|
+
type: Div
|
|
1937
2011
|
}];
|
|
1938
2012
|
};
|
|
1939
2013
|
|
|
@@ -1945,25 +2019,25 @@ const getVirtualDom = visibleItems => {
|
|
|
1945
2019
|
const className = mergeClassNames(Viewlet, ActivityBar$1);
|
|
1946
2020
|
const getActivityBarVirtualDom = visibleItems => {
|
|
1947
2021
|
return [{
|
|
1948
|
-
type: Div,
|
|
1949
|
-
id: ActivityBar,
|
|
1950
|
-
className,
|
|
1951
|
-
role: ToolBar,
|
|
1952
|
-
ariaRoleDescription: activityBar(),
|
|
1953
2022
|
ariaOrientation: Vertical,
|
|
1954
|
-
|
|
1955
|
-
|
|
2023
|
+
ariaRoleDescription: activityBar(),
|
|
2024
|
+
childCount: visibleItems.length,
|
|
2025
|
+
className,
|
|
2026
|
+
id: ActivityBar,
|
|
2027
|
+
onBlur: HandleBlur,
|
|
1956
2028
|
onContextMenu: HandleContextMenu,
|
|
1957
2029
|
onFocus: HandleFocus,
|
|
1958
|
-
|
|
1959
|
-
|
|
2030
|
+
onMouseDown: HandleMouseDown,
|
|
2031
|
+
role: ToolBar,
|
|
2032
|
+
tabIndex: 0,
|
|
2033
|
+
type: Div
|
|
1960
2034
|
}, ...getVirtualDom(visibleItems)];
|
|
1961
2035
|
};
|
|
1962
2036
|
|
|
1963
2037
|
const renderItems = (oldState, newState) => {
|
|
1964
2038
|
const {
|
|
1965
|
-
|
|
1966
|
-
|
|
2039
|
+
filteredItems,
|
|
2040
|
+
uid
|
|
1967
2041
|
} = newState;
|
|
1968
2042
|
const dom = getActivityBarVirtualDom(filteredItems);
|
|
1969
2043
|
return [SetDom2, uid, dom];
|
|
@@ -1971,14 +2045,14 @@ const renderItems = (oldState, newState) => {
|
|
|
1971
2045
|
|
|
1972
2046
|
const getRenderer = diffType => {
|
|
1973
2047
|
switch (diffType) {
|
|
1974
|
-
case RenderItems:
|
|
1975
|
-
return renderItems;
|
|
1976
|
-
case RenderFocusContext:
|
|
1977
|
-
return renderFocusContext;
|
|
1978
|
-
case RenderFocus:
|
|
1979
|
-
return renderFocusContext;
|
|
1980
2048
|
case RenderCss:
|
|
1981
2049
|
return renderCss;
|
|
2050
|
+
case RenderFocus:
|
|
2051
|
+
return renderFocusContext;
|
|
2052
|
+
case RenderFocusContext:
|
|
2053
|
+
return renderFocusContext;
|
|
2054
|
+
case RenderItems:
|
|
2055
|
+
return renderItems;
|
|
1982
2056
|
default:
|
|
1983
2057
|
throw new Error('unknown renderer');
|
|
1984
2058
|
}
|
|
@@ -1998,8 +2072,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
1998
2072
|
|
|
1999
2073
|
const render2 = (uid, diffResult) => {
|
|
2000
2074
|
const {
|
|
2001
|
-
|
|
2002
|
-
|
|
2075
|
+
newState,
|
|
2076
|
+
oldState
|
|
2003
2077
|
} = get(uid);
|
|
2004
2078
|
set(uid, newState, newState);
|
|
2005
2079
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2027,12 +2101,12 @@ const renderEventListeners = () => {
|
|
|
2027
2101
|
|
|
2028
2102
|
const saveState = state => {
|
|
2029
2103
|
const {
|
|
2030
|
-
|
|
2031
|
-
|
|
2104
|
+
currentViewletId,
|
|
2105
|
+
uid
|
|
2032
2106
|
} = state;
|
|
2033
2107
|
return {
|
|
2034
|
-
|
|
2035
|
-
|
|
2108
|
+
currentViewletId,
|
|
2109
|
+
uid
|
|
2036
2110
|
};
|
|
2037
2111
|
};
|
|
2038
2112
|
|
|
@@ -2060,8 +2134,9 @@ const commandMap = {
|
|
|
2060
2134
|
'ActivityBar.focusNone': wrapCommand(focusNone),
|
|
2061
2135
|
'ActivityBar.getCommandIds': getCommandIds,
|
|
2062
2136
|
'ActivityBar.getKeyBindings': getKeyBindings,
|
|
2063
|
-
'ActivityBar.getMenuEntries': getMenuEntries,
|
|
2137
|
+
'ActivityBar.getMenuEntries': wrapGetter(getMenuEntries),
|
|
2064
2138
|
'ActivityBar.getMenuEntryIds': getMenuEntryIds,
|
|
2139
|
+
'ActivityBar.handleBadgeCountChange': wrapCommand(handleBadgeCountChange),
|
|
2065
2140
|
'ActivityBar.handleBlur': wrapCommand(handleBlur),
|
|
2066
2141
|
'ActivityBar.handleClick': wrapCommand(handleClick),
|
|
2067
2142
|
'ActivityBar.handleClickIndex': wrapCommand(handleClickIndex),
|