@lvce-editor/activity-bar-worker 2.0.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 +203 -172
- 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,50 +1734,50 @@ 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;
|
|
@@ -1773,8 +1803,8 @@ const getCss = itemHeight => {
|
|
|
1773
1803
|
|
|
1774
1804
|
const renderCss = (oldState, newState) => {
|
|
1775
1805
|
const {
|
|
1776
|
-
|
|
1777
|
-
|
|
1806
|
+
itemHeight,
|
|
1807
|
+
uid
|
|
1778
1808
|
} = newState;
|
|
1779
1809
|
const css = getCss(itemHeight);
|
|
1780
1810
|
return [SetCss, uid, css];
|
|
@@ -1830,17 +1860,17 @@ const getAriaSelected = (isTab, isSelected) => {
|
|
|
1830
1860
|
|
|
1831
1861
|
const getBadgeVirtualDom = () => {
|
|
1832
1862
|
return [{
|
|
1833
|
-
|
|
1863
|
+
childCount: 1,
|
|
1834
1864
|
className: ActivityBarItemBadge,
|
|
1835
|
-
|
|
1865
|
+
type: Div
|
|
1836
1866
|
}, {
|
|
1837
|
-
|
|
1867
|
+
childCount: 1,
|
|
1838
1868
|
className: BadgeContent,
|
|
1839
|
-
|
|
1869
|
+
type: Div
|
|
1840
1870
|
}, {
|
|
1841
|
-
|
|
1871
|
+
childCount: 0,
|
|
1842
1872
|
className: mergeClassNames(Icon, ActivityBarBadgeIcon, MaskIconProgress),
|
|
1843
|
-
|
|
1873
|
+
type: Div
|
|
1844
1874
|
}];
|
|
1845
1875
|
};
|
|
1846
1876
|
|
|
@@ -1861,8 +1891,8 @@ const getClassName = (isFocused, marginTop, isSelected) => {
|
|
|
1861
1891
|
const getActivityBarItemInProgressDom = item => {
|
|
1862
1892
|
const {
|
|
1863
1893
|
flags,
|
|
1864
|
-
|
|
1865
|
-
|
|
1894
|
+
icon,
|
|
1895
|
+
title
|
|
1866
1896
|
} = item;
|
|
1867
1897
|
const isTab = flags & Tab;
|
|
1868
1898
|
const isSelected = flags & Selected;
|
|
@@ -1873,27 +1903,27 @@ const getActivityBarItemInProgressDom = item => {
|
|
|
1873
1903
|
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1874
1904
|
className += ' ' + ActivityBarItemNested;
|
|
1875
1905
|
return [{
|
|
1876
|
-
type: Div,
|
|
1877
|
-
className,
|
|
1878
1906
|
ariaLabel: '',
|
|
1879
|
-
title,
|
|
1880
|
-
role,
|
|
1881
1907
|
ariaSelected,
|
|
1882
|
-
childCount: 2
|
|
1908
|
+
childCount: 2,
|
|
1909
|
+
className,
|
|
1910
|
+
role,
|
|
1911
|
+
title,
|
|
1912
|
+
type: Div
|
|
1883
1913
|
}, {
|
|
1884
|
-
|
|
1914
|
+
childCount: 0,
|
|
1885
1915
|
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1886
1916
|
role: None$1,
|
|
1887
|
-
|
|
1917
|
+
type: Div
|
|
1888
1918
|
}, ...getBadgeVirtualDom()];
|
|
1889
1919
|
};
|
|
1890
1920
|
|
|
1891
1921
|
const getActivityBarItemWithBadgeDom = item => {
|
|
1892
1922
|
const {
|
|
1923
|
+
badgeText,
|
|
1893
1924
|
flags,
|
|
1894
|
-
title,
|
|
1895
1925
|
icon,
|
|
1896
|
-
|
|
1926
|
+
title
|
|
1897
1927
|
} = item;
|
|
1898
1928
|
if (!badgeText) {
|
|
1899
1929
|
// TODO should not happen
|
|
@@ -1908,40 +1938,40 @@ const getActivityBarItemWithBadgeDom = item => {
|
|
|
1908
1938
|
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1909
1939
|
className += ' ' + ActivityBarItemNested;
|
|
1910
1940
|
return [{
|
|
1911
|
-
type: Div,
|
|
1912
|
-
className,
|
|
1913
1941
|
ariaLabel: '',
|
|
1914
|
-
title,
|
|
1915
|
-
role,
|
|
1916
1942
|
ariaSelected,
|
|
1917
|
-
childCount: 2
|
|
1943
|
+
childCount: 2,
|
|
1944
|
+
className,
|
|
1945
|
+
role,
|
|
1946
|
+
title,
|
|
1947
|
+
type: Div
|
|
1918
1948
|
}, {
|
|
1919
|
-
|
|
1949
|
+
childCount: 0,
|
|
1920
1950
|
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1921
1951
|
role: None$1,
|
|
1922
|
-
|
|
1952
|
+
type: Div
|
|
1923
1953
|
}, {
|
|
1924
|
-
|
|
1954
|
+
childCount: 1,
|
|
1925
1955
|
className: ActivityBarItemBadge,
|
|
1926
|
-
|
|
1956
|
+
type: Div
|
|
1927
1957
|
}, text(badgeText)];
|
|
1928
1958
|
};
|
|
1929
1959
|
|
|
1930
1960
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
1931
1961
|
return {
|
|
1932
|
-
|
|
1962
|
+
childCount: 0,
|
|
1933
1963
|
className: `MaskIcon MaskIcon${icon}`,
|
|
1934
1964
|
role: None$1,
|
|
1935
|
-
|
|
1965
|
+
type
|
|
1936
1966
|
};
|
|
1937
1967
|
};
|
|
1938
1968
|
|
|
1939
1969
|
const getActivityBarItemVirtualDom = item => {
|
|
1940
1970
|
const {
|
|
1971
|
+
badgeText,
|
|
1941
1972
|
flags,
|
|
1942
|
-
title,
|
|
1943
1973
|
icon,
|
|
1944
|
-
|
|
1974
|
+
title
|
|
1945
1975
|
} = item;
|
|
1946
1976
|
const isTab = flags & Tab;
|
|
1947
1977
|
const isSelected = flags & Selected;
|
|
@@ -1953,13 +1983,13 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1953
1983
|
const className = getClassName(isFocused, marginTop, isSelected);
|
|
1954
1984
|
if (isSelected) {
|
|
1955
1985
|
return [{
|
|
1956
|
-
type: Div,
|
|
1957
|
-
className,
|
|
1958
1986
|
ariaLabel: '',
|
|
1959
|
-
title,
|
|
1960
|
-
role,
|
|
1961
1987
|
ariaSelected,
|
|
1962
|
-
childCount: 1
|
|
1988
|
+
childCount: 1,
|
|
1989
|
+
className,
|
|
1990
|
+
role,
|
|
1991
|
+
title,
|
|
1992
|
+
type: Div
|
|
1963
1993
|
}, getIconVirtualDom(icon)];
|
|
1964
1994
|
}
|
|
1965
1995
|
|
|
@@ -1971,13 +2001,13 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1971
2001
|
return getActivityBarItemWithBadgeDom(item);
|
|
1972
2002
|
}
|
|
1973
2003
|
return [{
|
|
1974
|
-
type: Div,
|
|
1975
|
-
className: mergeClassNames(className, `Icon${icon}`),
|
|
1976
2004
|
ariaLabel: '',
|
|
1977
|
-
title,
|
|
1978
|
-
role,
|
|
1979
2005
|
ariaSelected,
|
|
1980
|
-
childCount: 0
|
|
2006
|
+
childCount: 0,
|
|
2007
|
+
className: mergeClassNames(className, `Icon${icon}`),
|
|
2008
|
+
role,
|
|
2009
|
+
title,
|
|
2010
|
+
type: Div
|
|
1981
2011
|
}];
|
|
1982
2012
|
};
|
|
1983
2013
|
|
|
@@ -1989,25 +2019,25 @@ const getVirtualDom = visibleItems => {
|
|
|
1989
2019
|
const className = mergeClassNames(Viewlet, ActivityBar$1);
|
|
1990
2020
|
const getActivityBarVirtualDom = visibleItems => {
|
|
1991
2021
|
return [{
|
|
1992
|
-
type: Div,
|
|
1993
|
-
id: ActivityBar,
|
|
1994
|
-
className,
|
|
1995
|
-
role: ToolBar,
|
|
1996
|
-
ariaRoleDescription: activityBar(),
|
|
1997
2022
|
ariaOrientation: Vertical,
|
|
1998
|
-
|
|
1999
|
-
|
|
2023
|
+
ariaRoleDescription: activityBar(),
|
|
2024
|
+
childCount: visibleItems.length,
|
|
2025
|
+
className,
|
|
2026
|
+
id: ActivityBar,
|
|
2027
|
+
onBlur: HandleBlur,
|
|
2000
2028
|
onContextMenu: HandleContextMenu,
|
|
2001
2029
|
onFocus: HandleFocus,
|
|
2002
|
-
|
|
2003
|
-
|
|
2030
|
+
onMouseDown: HandleMouseDown,
|
|
2031
|
+
role: ToolBar,
|
|
2032
|
+
tabIndex: 0,
|
|
2033
|
+
type: Div
|
|
2004
2034
|
}, ...getVirtualDom(visibleItems)];
|
|
2005
2035
|
};
|
|
2006
2036
|
|
|
2007
2037
|
const renderItems = (oldState, newState) => {
|
|
2008
2038
|
const {
|
|
2009
|
-
|
|
2010
|
-
|
|
2039
|
+
filteredItems,
|
|
2040
|
+
uid
|
|
2011
2041
|
} = newState;
|
|
2012
2042
|
const dom = getActivityBarVirtualDom(filteredItems);
|
|
2013
2043
|
return [SetDom2, uid, dom];
|
|
@@ -2015,14 +2045,14 @@ const renderItems = (oldState, newState) => {
|
|
|
2015
2045
|
|
|
2016
2046
|
const getRenderer = diffType => {
|
|
2017
2047
|
switch (diffType) {
|
|
2018
|
-
case RenderItems:
|
|
2019
|
-
return renderItems;
|
|
2020
|
-
case RenderFocusContext:
|
|
2021
|
-
return renderFocusContext;
|
|
2022
|
-
case RenderFocus:
|
|
2023
|
-
return renderFocusContext;
|
|
2024
2048
|
case RenderCss:
|
|
2025
2049
|
return renderCss;
|
|
2050
|
+
case RenderFocus:
|
|
2051
|
+
return renderFocusContext;
|
|
2052
|
+
case RenderFocusContext:
|
|
2053
|
+
return renderFocusContext;
|
|
2054
|
+
case RenderItems:
|
|
2055
|
+
return renderItems;
|
|
2026
2056
|
default:
|
|
2027
2057
|
throw new Error('unknown renderer');
|
|
2028
2058
|
}
|
|
@@ -2042,8 +2072,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
2042
2072
|
|
|
2043
2073
|
const render2 = (uid, diffResult) => {
|
|
2044
2074
|
const {
|
|
2045
|
-
|
|
2046
|
-
|
|
2075
|
+
newState,
|
|
2076
|
+
oldState
|
|
2047
2077
|
} = get(uid);
|
|
2048
2078
|
set(uid, newState, newState);
|
|
2049
2079
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2071,12 +2101,12 @@ const renderEventListeners = () => {
|
|
|
2071
2101
|
|
|
2072
2102
|
const saveState = state => {
|
|
2073
2103
|
const {
|
|
2074
|
-
|
|
2075
|
-
|
|
2104
|
+
currentViewletId,
|
|
2105
|
+
uid
|
|
2076
2106
|
} = state;
|
|
2077
2107
|
return {
|
|
2078
|
-
|
|
2079
|
-
|
|
2108
|
+
currentViewletId,
|
|
2109
|
+
uid
|
|
2080
2110
|
};
|
|
2081
2111
|
};
|
|
2082
2112
|
|
|
@@ -2106,6 +2136,7 @@ const commandMap = {
|
|
|
2106
2136
|
'ActivityBar.getKeyBindings': getKeyBindings,
|
|
2107
2137
|
'ActivityBar.getMenuEntries': wrapGetter(getMenuEntries),
|
|
2108
2138
|
'ActivityBar.getMenuEntryIds': getMenuEntryIds,
|
|
2139
|
+
'ActivityBar.handleBadgeCountChange': wrapCommand(handleBadgeCountChange),
|
|
2109
2140
|
'ActivityBar.handleBlur': wrapCommand(handleBlur),
|
|
2110
2141
|
'ActivityBar.handleClick': wrapCommand(handleClick),
|
|
2111
2142
|
'ActivityBar.handleClickIndex': wrapCommand(handleClickIndex),
|