@lvce-editor/activity-bar-worker 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activityBarWorkerMain.js +205 -173
- package/package.json +1 -1
|
@@ -1051,37 +1051,38 @@ const terminate = () => {
|
|
|
1051
1051
|
};
|
|
1052
1052
|
|
|
1053
1053
|
const {
|
|
1054
|
+
diff,
|
|
1054
1055
|
get,
|
|
1055
|
-
set,
|
|
1056
|
-
registerCommands,
|
|
1057
1056
|
getCommandIds,
|
|
1058
|
-
|
|
1057
|
+
registerCommands,
|
|
1058
|
+
set,
|
|
1059
1059
|
wrapCommand,
|
|
1060
|
-
|
|
1060
|
+
wrapGetter
|
|
1061
1061
|
} = create$1();
|
|
1062
1062
|
|
|
1063
1063
|
// TODO parentUid might ot be needed
|
|
1064
1064
|
const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) => {
|
|
1065
1065
|
const state = {
|
|
1066
|
+
activityBarItems: [],
|
|
1066
1067
|
currentViewletId: '',
|
|
1067
|
-
|
|
1068
|
+
filteredItems: [],
|
|
1068
1069
|
focus: 0,
|
|
1069
1070
|
focused: false,
|
|
1070
1071
|
focusedIndex: -1,
|
|
1071
|
-
scrollBarHeight: 0,
|
|
1072
|
-
width,
|
|
1073
1072
|
height,
|
|
1074
|
-
x,
|
|
1075
|
-
y,
|
|
1076
|
-
sideBarVisible: false,
|
|
1077
|
-
activityBarItems: [],
|
|
1078
|
-
selectedIndex: -1,
|
|
1079
1073
|
itemHeight: 48,
|
|
1080
|
-
updateState: '',
|
|
1081
|
-
updateProgress: 0,
|
|
1082
|
-
filteredItems: [],
|
|
1083
1074
|
numberOfVisibleItems: 0,
|
|
1084
|
-
|
|
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
|
|
1085
1086
|
};
|
|
1086
1087
|
set(id, state, state);
|
|
1087
1088
|
return state;
|
|
@@ -1129,8 +1130,8 @@ const focus = state => {
|
|
|
1129
1130
|
const focusIndex = (state, index) => {
|
|
1130
1131
|
return {
|
|
1131
1132
|
...state,
|
|
1132
|
-
|
|
1133
|
-
|
|
1133
|
+
focused: true,
|
|
1134
|
+
focusedIndex: index
|
|
1134
1135
|
};
|
|
1135
1136
|
};
|
|
1136
1137
|
|
|
@@ -1158,36 +1159,36 @@ const focusNone = state => {
|
|
|
1158
1159
|
|
|
1159
1160
|
const getKeyBindings = () => {
|
|
1160
1161
|
return [{
|
|
1161
|
-
key: DownArrow,
|
|
1162
1162
|
command: 'ActivityBar.focusNext',
|
|
1163
|
+
key: DownArrow,
|
|
1163
1164
|
when: FocusActivityBar
|
|
1164
1165
|
}, {
|
|
1165
|
-
key: UpArrow,
|
|
1166
1166
|
command: 'ActivityBar.focusPrevious',
|
|
1167
|
+
key: UpArrow,
|
|
1167
1168
|
when: FocusActivityBar
|
|
1168
1169
|
}, {
|
|
1169
|
-
key: Home,
|
|
1170
1170
|
command: 'ActivityBar.focusFirst',
|
|
1171
|
+
key: Home,
|
|
1171
1172
|
when: FocusActivityBar
|
|
1172
1173
|
}, {
|
|
1173
|
-
key: PageUp,
|
|
1174
1174
|
command: 'ActivityBar.focusFirst',
|
|
1175
|
+
key: PageUp,
|
|
1175
1176
|
when: FocusActivityBar
|
|
1176
1177
|
}, {
|
|
1177
|
-
key: PageDown,
|
|
1178
1178
|
command: 'ActivityBar.focusLast',
|
|
1179
|
+
key: PageDown,
|
|
1179
1180
|
when: FocusActivityBar
|
|
1180
1181
|
}, {
|
|
1181
|
-
key: End,
|
|
1182
1182
|
command: 'ActivityBar.focusLast',
|
|
1183
|
+
key: End,
|
|
1183
1184
|
when: FocusActivityBar
|
|
1184
1185
|
}, {
|
|
1185
|
-
key: Space,
|
|
1186
1186
|
command: 'ActivityBar.selectCurrent',
|
|
1187
|
+
key: Space,
|
|
1187
1188
|
when: FocusActivityBar
|
|
1188
1189
|
}, {
|
|
1189
|
-
key: Enter,
|
|
1190
1190
|
command: 'ActivityBar.selectCurrent',
|
|
1191
|
+
key: Enter,
|
|
1191
1192
|
when: FocusActivityBar
|
|
1192
1193
|
}];
|
|
1193
1194
|
};
|
|
@@ -1265,17 +1266,17 @@ const menuEntryMoveSideBar = sideBarLocation => {
|
|
|
1265
1266
|
switch (sideBarLocation) {
|
|
1266
1267
|
case Left:
|
|
1267
1268
|
return {
|
|
1268
|
-
|
|
1269
|
-
label: moveSideBarRight(),
|
|
1269
|
+
command: 'Layout.moveSideBarRight',
|
|
1270
1270
|
flags: None,
|
|
1271
|
-
|
|
1271
|
+
id: 'moveSideBarRight',
|
|
1272
|
+
label: moveSideBarRight()
|
|
1272
1273
|
};
|
|
1273
1274
|
case Right:
|
|
1274
1275
|
return {
|
|
1275
|
-
|
|
1276
|
-
label: moveSideBarLeft(),
|
|
1276
|
+
command: 'Layout.moveSideBarLeft',
|
|
1277
1277
|
flags: None,
|
|
1278
|
-
|
|
1278
|
+
id: 'moveSideBarLeft',
|
|
1279
|
+
label: moveSideBarLeft()
|
|
1279
1280
|
};
|
|
1280
1281
|
default:
|
|
1281
1282
|
throw new Error('unexpected side bar location');
|
|
@@ -1283,20 +1284,20 @@ const menuEntryMoveSideBar = sideBarLocation => {
|
|
|
1283
1284
|
};
|
|
1284
1285
|
|
|
1285
1286
|
const menuEntrySeparator = {
|
|
1286
|
-
|
|
1287
|
-
label: '',
|
|
1287
|
+
command: '',
|
|
1288
1288
|
flags: Separator,
|
|
1289
|
-
|
|
1289
|
+
id: 'separator',
|
|
1290
|
+
label: ''
|
|
1290
1291
|
};
|
|
1291
1292
|
|
|
1292
1293
|
const toContextMenuItem$1 = activityBarItem => {
|
|
1293
1294
|
const isEnabled = activityBarItem.flags & Enabled;
|
|
1294
1295
|
return {
|
|
1295
|
-
|
|
1296
|
+
command: '',
|
|
1297
|
+
flags: isEnabled ? Checked : Unchecked,
|
|
1296
1298
|
id: '',
|
|
1297
1299
|
// TODO
|
|
1298
|
-
|
|
1299
|
-
command: ''
|
|
1300
|
+
label: activityBarItem.id
|
|
1300
1301
|
};
|
|
1301
1302
|
};
|
|
1302
1303
|
const getMenuEntriesActivityBar = state => {
|
|
@@ -1305,10 +1306,10 @@ const getMenuEntriesActivityBar = state => {
|
|
|
1305
1306
|
sideBarLocation
|
|
1306
1307
|
} = state;
|
|
1307
1308
|
return [...activityBarItems.map(toContextMenuItem$1), menuEntrySeparator, menuEntryMoveSideBar(sideBarLocation), {
|
|
1308
|
-
|
|
1309
|
-
label: hideActivityBar(),
|
|
1309
|
+
command: 'Layout.hideActivityBar',
|
|
1310
1310
|
flags: None,
|
|
1311
|
-
|
|
1311
|
+
id: 'hideActivityBar',
|
|
1312
|
+
label: hideActivityBar()
|
|
1312
1313
|
}];
|
|
1313
1314
|
};
|
|
1314
1315
|
|
|
@@ -1331,11 +1332,12 @@ const getHiddenItems = state => {
|
|
|
1331
1332
|
|
|
1332
1333
|
const toContextMenuItem = activityBarItem => {
|
|
1333
1334
|
return {
|
|
1334
|
-
|
|
1335
|
-
id: '8000',
|
|
1335
|
+
command: '-1',
|
|
1336
1336
|
// TODO
|
|
1337
1337
|
flags: None,
|
|
1338
|
-
|
|
1338
|
+
id: '8000',
|
|
1339
|
+
// TODO
|
|
1340
|
+
label: activityBarItem.id
|
|
1339
1341
|
};
|
|
1340
1342
|
};
|
|
1341
1343
|
const getMenuEntriesAdditionalViews = state => {
|
|
@@ -1371,31 +1373,31 @@ const colorTheme = () => {
|
|
|
1371
1373
|
const keyBindingsUri = 'app://keybindings';
|
|
1372
1374
|
const getMenuEntriesSettings = () => {
|
|
1373
1375
|
return [{
|
|
1374
|
-
|
|
1375
|
-
label: commandPalette(),
|
|
1376
|
+
command: 'QuickPick.showEverything',
|
|
1376
1377
|
flags: None,
|
|
1377
|
-
|
|
1378
|
+
id: 'commandPalette',
|
|
1379
|
+
label: commandPalette()
|
|
1378
1380
|
}, menuEntrySeparator, {
|
|
1379
|
-
|
|
1380
|
-
label: settings(),
|
|
1381
|
+
command: 'Preferences.openSettingsJson',
|
|
1381
1382
|
flags: None,
|
|
1382
|
-
|
|
1383
|
+
id: 'settings',
|
|
1384
|
+
label: settings()
|
|
1383
1385
|
}, {
|
|
1384
|
-
|
|
1385
|
-
label: keyboardShortcuts(),
|
|
1386
|
-
flags: None,
|
|
1386
|
+
args: [keyBindingsUri],
|
|
1387
1387
|
command: 'Main.openUri',
|
|
1388
|
-
|
|
1388
|
+
flags: None,
|
|
1389
|
+
id: 'keyboardShortcuts',
|
|
1390
|
+
label: keyboardShortcuts()
|
|
1389
1391
|
}, {
|
|
1390
|
-
|
|
1391
|
-
label: colorTheme(),
|
|
1392
|
+
command: 'QuickPick.showColorTheme',
|
|
1392
1393
|
flags: None,
|
|
1393
|
-
|
|
1394
|
+
id: 'colorTheme',
|
|
1395
|
+
label: colorTheme()
|
|
1394
1396
|
}, menuEntrySeparator, {
|
|
1395
|
-
|
|
1396
|
-
label: checkForUpdates(),
|
|
1397
|
+
command: 'AutoUpdater.checkForUpdates',
|
|
1397
1398
|
flags: None,
|
|
1398
|
-
|
|
1399
|
+
id: 'checkForUpdates',
|
|
1400
|
+
label: checkForUpdates()
|
|
1399
1401
|
}];
|
|
1400
1402
|
};
|
|
1401
1403
|
|
|
@@ -1419,6 +1421,34 @@ const getMenuEntryIds = () => {
|
|
|
1419
1421
|
return [ActivityBar$3, ActivityBarAdditionalViews, Settings$1];
|
|
1420
1422
|
};
|
|
1421
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
|
+
|
|
1422
1452
|
const handleBlur = state => {
|
|
1423
1453
|
return {
|
|
1424
1454
|
...state,
|
|
@@ -1484,8 +1514,8 @@ const hide = async () => {
|
|
|
1484
1514
|
|
|
1485
1515
|
const handleClickOther = async (state, x, y, viewletId) => {
|
|
1486
1516
|
const {
|
|
1487
|
-
|
|
1488
|
-
|
|
1517
|
+
currentViewletId,
|
|
1518
|
+
sideBarVisible
|
|
1489
1519
|
} = state;
|
|
1490
1520
|
if (sideBarVisible) {
|
|
1491
1521
|
if (currentViewletId === viewletId) {
|
|
@@ -1522,10 +1552,10 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1522
1552
|
const item = filteredItems[index];
|
|
1523
1553
|
const viewletId = item.id;
|
|
1524
1554
|
switch (viewletId) {
|
|
1525
|
-
case 'Settings':
|
|
1526
|
-
return handleClickSettings(state, x, y);
|
|
1527
1555
|
case 'Additional Views':
|
|
1528
1556
|
return handleClickAdditionalViews(state, x, y, viewletId);
|
|
1557
|
+
case 'Settings':
|
|
1558
|
+
return handleClickSettings(state, x, y);
|
|
1529
1559
|
default:
|
|
1530
1560
|
return handleClickOther(state, x, y, viewletId);
|
|
1531
1561
|
}
|
|
@@ -1534,9 +1564,9 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1534
1564
|
const handleClick = async (state, button, eventX, eventY) => {
|
|
1535
1565
|
const {
|
|
1536
1566
|
filteredItems,
|
|
1567
|
+
height,
|
|
1537
1568
|
itemHeight,
|
|
1538
|
-
y
|
|
1539
|
-
height
|
|
1569
|
+
y
|
|
1540
1570
|
} = state;
|
|
1541
1571
|
const index = getIndexFromPosition(y, eventX, eventY, itemHeight, filteredItems.length, height);
|
|
1542
1572
|
return handleClickIndex(state, button, index, eventX, eventY);
|
|
@@ -1569,11 +1599,11 @@ const getFilteredActivityBarItems = (items, height, itemHeight) => {
|
|
|
1569
1599
|
return items;
|
|
1570
1600
|
}
|
|
1571
1601
|
const showMoreItem = {
|
|
1572
|
-
id: 'Additional Views',
|
|
1573
|
-
title: additionalViews(),
|
|
1574
|
-
icon: Ellipsis,
|
|
1575
1602
|
flags: Button,
|
|
1576
|
-
|
|
1603
|
+
icon: Ellipsis,
|
|
1604
|
+
id: 'Additional Views',
|
|
1605
|
+
keyShortcuts: '',
|
|
1606
|
+
title: additionalViews()
|
|
1577
1607
|
};
|
|
1578
1608
|
return [...items.slice(0, numberOfVisibleItems - 2), showMoreItem, items.at(-1)];
|
|
1579
1609
|
};
|
|
@@ -1584,19 +1614,19 @@ const handleResize = (state, dimensions) => {
|
|
|
1584
1614
|
itemHeight
|
|
1585
1615
|
} = state;
|
|
1586
1616
|
const {
|
|
1587
|
-
|
|
1588
|
-
y,
|
|
1617
|
+
height,
|
|
1589
1618
|
width,
|
|
1590
|
-
|
|
1619
|
+
x,
|
|
1620
|
+
y
|
|
1591
1621
|
} = dimensions;
|
|
1592
1622
|
const filteredItems = getFilteredActivityBarItems(activityBarItems, height, itemHeight);
|
|
1593
1623
|
return {
|
|
1594
1624
|
...state,
|
|
1595
|
-
|
|
1596
|
-
y,
|
|
1597
|
-
width,
|
|
1625
|
+
filteredItems,
|
|
1598
1626
|
height,
|
|
1599
|
-
|
|
1627
|
+
width,
|
|
1628
|
+
x,
|
|
1629
|
+
y
|
|
1600
1630
|
};
|
|
1601
1631
|
};
|
|
1602
1632
|
|
|
@@ -1648,10 +1678,10 @@ const handleSideBarViewletChange = (state, id, ...args) => {
|
|
|
1648
1678
|
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
1649
1679
|
return {
|
|
1650
1680
|
...state,
|
|
1651
|
-
selectedIndex: index,
|
|
1652
|
-
currentViewletId: id,
|
|
1653
1681
|
activityBarItems: newActivityBarItems,
|
|
1682
|
+
currentViewletId: id,
|
|
1654
1683
|
filteredItems,
|
|
1684
|
+
selectedIndex: index,
|
|
1655
1685
|
sideBarVisible: true
|
|
1656
1686
|
};
|
|
1657
1687
|
};
|
|
@@ -1688,9 +1718,9 @@ const handleUpdateStateChange = async (state, config) => {
|
|
|
1688
1718
|
const newItems = getNewItems(filteredItems, config.state);
|
|
1689
1719
|
return {
|
|
1690
1720
|
...state,
|
|
1691
|
-
|
|
1721
|
+
filteredItems: newItems,
|
|
1692
1722
|
updateProgress: config.progress,
|
|
1693
|
-
|
|
1723
|
+
updateState: config.state
|
|
1694
1724
|
};
|
|
1695
1725
|
};
|
|
1696
1726
|
|
|
@@ -1704,60 +1734,61 @@ const getActivityBarItems = () => {
|
|
|
1704
1734
|
return [
|
|
1705
1735
|
// Top
|
|
1706
1736
|
{
|
|
1707
|
-
id: Explorer,
|
|
1708
|
-
title: explorer(),
|
|
1709
|
-
icon: Files,
|
|
1710
1737
|
flags: Tab | Enabled,
|
|
1711
|
-
|
|
1738
|
+
icon: Files,
|
|
1739
|
+
id: Explorer,
|
|
1740
|
+
keyShortcuts: 'Control+Shift+E',
|
|
1741
|
+
title: explorer()
|
|
1712
1742
|
}, {
|
|
1713
|
-
id: Search,
|
|
1714
|
-
title: search(),
|
|
1715
|
-
icon: Search$1,
|
|
1716
1743
|
flags: Tab | Enabled,
|
|
1717
|
-
|
|
1744
|
+
icon: Search$1,
|
|
1745
|
+
id: Search,
|
|
1746
|
+
keyShortcuts: 'Control+Shift+F',
|
|
1747
|
+
title: search()
|
|
1718
1748
|
}, {
|
|
1719
|
-
id: SourceControl,
|
|
1720
|
-
title: sourceControl(),
|
|
1721
|
-
icon: SourceControl$1,
|
|
1722
1749
|
flags: Tab | Enabled,
|
|
1723
|
-
|
|
1750
|
+
icon: SourceControl$1,
|
|
1751
|
+
id: SourceControl,
|
|
1752
|
+
keyShortcuts: 'Control+Shift+G',
|
|
1753
|
+
title: sourceControl()
|
|
1724
1754
|
}, {
|
|
1725
|
-
id: RunAndDebug,
|
|
1726
|
-
title: runAndDebug(),
|
|
1727
|
-
icon: DebugAlt2,
|
|
1728
1755
|
flags: Tab | Enabled,
|
|
1729
|
-
|
|
1756
|
+
icon: DebugAlt2,
|
|
1757
|
+
id: RunAndDebug,
|
|
1758
|
+
keyShortcuts: 'Control+Shift+D',
|
|
1759
|
+
title: runAndDebug()
|
|
1730
1760
|
}, {
|
|
1731
|
-
id: Extensions,
|
|
1732
|
-
title: extensions(),
|
|
1733
|
-
icon: Extensions$1,
|
|
1734
1761
|
flags: Tab | Enabled,
|
|
1735
|
-
|
|
1762
|
+
icon: Extensions$1,
|
|
1763
|
+
id: Extensions,
|
|
1764
|
+
keyShortcuts: 'Control+Shift+X',
|
|
1765
|
+
title: extensions()
|
|
1736
1766
|
},
|
|
1737
1767
|
// Bottom
|
|
1738
1768
|
{
|
|
1739
|
-
id: 'Settings',
|
|
1740
|
-
title: settings$1(),
|
|
1741
|
-
icon: SettingsGear,
|
|
1742
1769
|
flags: Button | Enabled | MarginTop,
|
|
1743
|
-
|
|
1770
|
+
icon: SettingsGear,
|
|
1771
|
+
id: 'Settings',
|
|
1772
|
+
keyShortcuts: '',
|
|
1773
|
+
title: settings$1()
|
|
1744
1774
|
}];
|
|
1745
1775
|
};
|
|
1746
1776
|
|
|
1747
1777
|
const loadContent = async (state, savedState) => {
|
|
1748
1778
|
const {
|
|
1749
|
-
|
|
1750
|
-
|
|
1779
|
+
height,
|
|
1780
|
+
itemHeight
|
|
1751
1781
|
} = state;
|
|
1752
1782
|
const items = getActivityBarItems();
|
|
1753
1783
|
const explorerIndex = 0;
|
|
1754
1784
|
const itemsWithSelected = markSelected(items, explorerIndex);
|
|
1755
1785
|
const filteredItems = getFilteredActivityBarItems(itemsWithSelected, height, itemHeight);
|
|
1786
|
+
const newItems = await updateItemsWithBadgeCount(filteredItems);
|
|
1756
1787
|
return {
|
|
1757
1788
|
...state,
|
|
1758
1789
|
activityBarItems: itemsWithSelected,
|
|
1759
1790
|
currentViewletId: Explorer,
|
|
1760
|
-
filteredItems,
|
|
1791
|
+
filteredItems: newItems,
|
|
1761
1792
|
selectedIndex: explorerIndex,
|
|
1762
1793
|
sideBarLocation: Left,
|
|
1763
1794
|
sideBarVisible: true
|
|
@@ -1773,8 +1804,8 @@ const getCss = itemHeight => {
|
|
|
1773
1804
|
|
|
1774
1805
|
const renderCss = (oldState, newState) => {
|
|
1775
1806
|
const {
|
|
1776
|
-
|
|
1777
|
-
|
|
1807
|
+
itemHeight,
|
|
1808
|
+
uid
|
|
1778
1809
|
} = newState;
|
|
1779
1810
|
const css = getCss(itemHeight);
|
|
1780
1811
|
return [SetCss, uid, css];
|
|
@@ -1830,17 +1861,17 @@ const getAriaSelected = (isTab, isSelected) => {
|
|
|
1830
1861
|
|
|
1831
1862
|
const getBadgeVirtualDom = () => {
|
|
1832
1863
|
return [{
|
|
1833
|
-
|
|
1864
|
+
childCount: 1,
|
|
1834
1865
|
className: ActivityBarItemBadge,
|
|
1835
|
-
|
|
1866
|
+
type: Div
|
|
1836
1867
|
}, {
|
|
1837
|
-
|
|
1868
|
+
childCount: 1,
|
|
1838
1869
|
className: BadgeContent,
|
|
1839
|
-
|
|
1870
|
+
type: Div
|
|
1840
1871
|
}, {
|
|
1841
|
-
|
|
1872
|
+
childCount: 0,
|
|
1842
1873
|
className: mergeClassNames(Icon, ActivityBarBadgeIcon, MaskIconProgress),
|
|
1843
|
-
|
|
1874
|
+
type: Div
|
|
1844
1875
|
}];
|
|
1845
1876
|
};
|
|
1846
1877
|
|
|
@@ -1861,8 +1892,8 @@ const getClassName = (isFocused, marginTop, isSelected) => {
|
|
|
1861
1892
|
const getActivityBarItemInProgressDom = item => {
|
|
1862
1893
|
const {
|
|
1863
1894
|
flags,
|
|
1864
|
-
|
|
1865
|
-
|
|
1895
|
+
icon,
|
|
1896
|
+
title
|
|
1866
1897
|
} = item;
|
|
1867
1898
|
const isTab = flags & Tab;
|
|
1868
1899
|
const isSelected = flags & Selected;
|
|
@@ -1873,27 +1904,27 @@ const getActivityBarItemInProgressDom = item => {
|
|
|
1873
1904
|
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1874
1905
|
className += ' ' + ActivityBarItemNested;
|
|
1875
1906
|
return [{
|
|
1876
|
-
type: Div,
|
|
1877
|
-
className,
|
|
1878
1907
|
ariaLabel: '',
|
|
1879
|
-
title,
|
|
1880
|
-
role,
|
|
1881
1908
|
ariaSelected,
|
|
1882
|
-
childCount: 2
|
|
1909
|
+
childCount: 2,
|
|
1910
|
+
className,
|
|
1911
|
+
role,
|
|
1912
|
+
title,
|
|
1913
|
+
type: Div
|
|
1883
1914
|
}, {
|
|
1884
|
-
|
|
1915
|
+
childCount: 0,
|
|
1885
1916
|
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1886
1917
|
role: None$1,
|
|
1887
|
-
|
|
1918
|
+
type: Div
|
|
1888
1919
|
}, ...getBadgeVirtualDom()];
|
|
1889
1920
|
};
|
|
1890
1921
|
|
|
1891
1922
|
const getActivityBarItemWithBadgeDom = item => {
|
|
1892
1923
|
const {
|
|
1924
|
+
badgeText,
|
|
1893
1925
|
flags,
|
|
1894
|
-
title,
|
|
1895
1926
|
icon,
|
|
1896
|
-
|
|
1927
|
+
title
|
|
1897
1928
|
} = item;
|
|
1898
1929
|
if (!badgeText) {
|
|
1899
1930
|
// TODO should not happen
|
|
@@ -1908,40 +1939,40 @@ const getActivityBarItemWithBadgeDom = item => {
|
|
|
1908
1939
|
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1909
1940
|
className += ' ' + ActivityBarItemNested;
|
|
1910
1941
|
return [{
|
|
1911
|
-
type: Div,
|
|
1912
|
-
className,
|
|
1913
1942
|
ariaLabel: '',
|
|
1914
|
-
title,
|
|
1915
|
-
role,
|
|
1916
1943
|
ariaSelected,
|
|
1917
|
-
childCount: 2
|
|
1944
|
+
childCount: 2,
|
|
1945
|
+
className,
|
|
1946
|
+
role,
|
|
1947
|
+
title,
|
|
1948
|
+
type: Div
|
|
1918
1949
|
}, {
|
|
1919
|
-
|
|
1950
|
+
childCount: 0,
|
|
1920
1951
|
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1921
1952
|
role: None$1,
|
|
1922
|
-
|
|
1953
|
+
type: Div
|
|
1923
1954
|
}, {
|
|
1924
|
-
|
|
1955
|
+
childCount: 1,
|
|
1925
1956
|
className: ActivityBarItemBadge,
|
|
1926
|
-
|
|
1957
|
+
type: Div
|
|
1927
1958
|
}, text(badgeText)];
|
|
1928
1959
|
};
|
|
1929
1960
|
|
|
1930
1961
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
1931
1962
|
return {
|
|
1932
|
-
|
|
1963
|
+
childCount: 0,
|
|
1933
1964
|
className: `MaskIcon MaskIcon${icon}`,
|
|
1934
1965
|
role: None$1,
|
|
1935
|
-
|
|
1966
|
+
type
|
|
1936
1967
|
};
|
|
1937
1968
|
};
|
|
1938
1969
|
|
|
1939
1970
|
const getActivityBarItemVirtualDom = item => {
|
|
1940
1971
|
const {
|
|
1972
|
+
badgeText,
|
|
1941
1973
|
flags,
|
|
1942
|
-
title,
|
|
1943
1974
|
icon,
|
|
1944
|
-
|
|
1975
|
+
title
|
|
1945
1976
|
} = item;
|
|
1946
1977
|
const isTab = flags & Tab;
|
|
1947
1978
|
const isSelected = flags & Selected;
|
|
@@ -1953,13 +1984,13 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1953
1984
|
const className = getClassName(isFocused, marginTop, isSelected);
|
|
1954
1985
|
if (isSelected) {
|
|
1955
1986
|
return [{
|
|
1956
|
-
type: Div,
|
|
1957
|
-
className,
|
|
1958
1987
|
ariaLabel: '',
|
|
1959
|
-
title,
|
|
1960
|
-
role,
|
|
1961
1988
|
ariaSelected,
|
|
1962
|
-
childCount: 1
|
|
1989
|
+
childCount: 1,
|
|
1990
|
+
className,
|
|
1991
|
+
role,
|
|
1992
|
+
title,
|
|
1993
|
+
type: Div
|
|
1963
1994
|
}, getIconVirtualDom(icon)];
|
|
1964
1995
|
}
|
|
1965
1996
|
|
|
@@ -1971,13 +2002,13 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1971
2002
|
return getActivityBarItemWithBadgeDom(item);
|
|
1972
2003
|
}
|
|
1973
2004
|
return [{
|
|
1974
|
-
type: Div,
|
|
1975
|
-
className: mergeClassNames(className, `Icon${icon}`),
|
|
1976
2005
|
ariaLabel: '',
|
|
1977
|
-
title,
|
|
1978
|
-
role,
|
|
1979
2006
|
ariaSelected,
|
|
1980
|
-
childCount: 0
|
|
2007
|
+
childCount: 0,
|
|
2008
|
+
className: mergeClassNames(className, `Icon${icon}`),
|
|
2009
|
+
role,
|
|
2010
|
+
title,
|
|
2011
|
+
type: Div
|
|
1981
2012
|
}];
|
|
1982
2013
|
};
|
|
1983
2014
|
|
|
@@ -1989,25 +2020,25 @@ const getVirtualDom = visibleItems => {
|
|
|
1989
2020
|
const className = mergeClassNames(Viewlet, ActivityBar$1);
|
|
1990
2021
|
const getActivityBarVirtualDom = visibleItems => {
|
|
1991
2022
|
return [{
|
|
1992
|
-
type: Div,
|
|
1993
|
-
id: ActivityBar,
|
|
1994
|
-
className,
|
|
1995
|
-
role: ToolBar,
|
|
1996
|
-
ariaRoleDescription: activityBar(),
|
|
1997
2023
|
ariaOrientation: Vertical,
|
|
1998
|
-
|
|
1999
|
-
|
|
2024
|
+
ariaRoleDescription: activityBar(),
|
|
2025
|
+
childCount: visibleItems.length,
|
|
2026
|
+
className,
|
|
2027
|
+
id: ActivityBar,
|
|
2028
|
+
onBlur: HandleBlur,
|
|
2000
2029
|
onContextMenu: HandleContextMenu,
|
|
2001
2030
|
onFocus: HandleFocus,
|
|
2002
|
-
|
|
2003
|
-
|
|
2031
|
+
onMouseDown: HandleMouseDown,
|
|
2032
|
+
role: ToolBar,
|
|
2033
|
+
tabIndex: 0,
|
|
2034
|
+
type: Div
|
|
2004
2035
|
}, ...getVirtualDom(visibleItems)];
|
|
2005
2036
|
};
|
|
2006
2037
|
|
|
2007
2038
|
const renderItems = (oldState, newState) => {
|
|
2008
2039
|
const {
|
|
2009
|
-
|
|
2010
|
-
|
|
2040
|
+
filteredItems,
|
|
2041
|
+
uid
|
|
2011
2042
|
} = newState;
|
|
2012
2043
|
const dom = getActivityBarVirtualDom(filteredItems);
|
|
2013
2044
|
return [SetDom2, uid, dom];
|
|
@@ -2015,14 +2046,14 @@ const renderItems = (oldState, newState) => {
|
|
|
2015
2046
|
|
|
2016
2047
|
const getRenderer = diffType => {
|
|
2017
2048
|
switch (diffType) {
|
|
2018
|
-
case RenderItems:
|
|
2019
|
-
return renderItems;
|
|
2020
|
-
case RenderFocusContext:
|
|
2021
|
-
return renderFocusContext;
|
|
2022
|
-
case RenderFocus:
|
|
2023
|
-
return renderFocusContext;
|
|
2024
2049
|
case RenderCss:
|
|
2025
2050
|
return renderCss;
|
|
2051
|
+
case RenderFocus:
|
|
2052
|
+
return renderFocusContext;
|
|
2053
|
+
case RenderFocusContext:
|
|
2054
|
+
return renderFocusContext;
|
|
2055
|
+
case RenderItems:
|
|
2056
|
+
return renderItems;
|
|
2026
2057
|
default:
|
|
2027
2058
|
throw new Error('unknown renderer');
|
|
2028
2059
|
}
|
|
@@ -2042,8 +2073,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
2042
2073
|
|
|
2043
2074
|
const render2 = (uid, diffResult) => {
|
|
2044
2075
|
const {
|
|
2045
|
-
|
|
2046
|
-
|
|
2076
|
+
newState,
|
|
2077
|
+
oldState
|
|
2047
2078
|
} = get(uid);
|
|
2048
2079
|
set(uid, newState, newState);
|
|
2049
2080
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2071,12 +2102,12 @@ const renderEventListeners = () => {
|
|
|
2071
2102
|
|
|
2072
2103
|
const saveState = state => {
|
|
2073
2104
|
const {
|
|
2074
|
-
|
|
2075
|
-
|
|
2105
|
+
currentViewletId,
|
|
2106
|
+
uid
|
|
2076
2107
|
} = state;
|
|
2077
2108
|
return {
|
|
2078
|
-
|
|
2079
|
-
|
|
2109
|
+
currentViewletId,
|
|
2110
|
+
uid
|
|
2080
2111
|
};
|
|
2081
2112
|
};
|
|
2082
2113
|
|
|
@@ -2106,6 +2137,7 @@ const commandMap = {
|
|
|
2106
2137
|
'ActivityBar.getKeyBindings': getKeyBindings,
|
|
2107
2138
|
'ActivityBar.getMenuEntries': wrapGetter(getMenuEntries),
|
|
2108
2139
|
'ActivityBar.getMenuEntryIds': getMenuEntryIds,
|
|
2140
|
+
'ActivityBar.handleBadgeCountChange': wrapCommand(handleBadgeCountChange),
|
|
2109
2141
|
'ActivityBar.handleBlur': wrapCommand(handleBlur),
|
|
2110
2142
|
'ActivityBar.handleClick': wrapCommand(handleClick),
|
|
2111
2143
|
'ActivityBar.handleClickIndex': wrapCommand(handleClickIndex),
|