@lvce-editor/activity-bar-worker 1.22.0 → 1.23.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.
|
@@ -843,6 +843,7 @@ const Tab$1 = 'tab';
|
|
|
843
843
|
const ToolBar = 'toolbar';
|
|
844
844
|
|
|
845
845
|
const Div = 4;
|
|
846
|
+
const Text = 12;
|
|
846
847
|
|
|
847
848
|
const Button$1 = 'event.button';
|
|
848
849
|
const ClientX = 'event.clientX';
|
|
@@ -1296,14 +1297,27 @@ const handleSideBarViewletChange = (state, id, ...args) => {
|
|
|
1296
1297
|
};
|
|
1297
1298
|
};
|
|
1298
1299
|
|
|
1300
|
+
const CheckingForUpdate = 1;
|
|
1301
|
+
const WaitingForRestart = 4;
|
|
1302
|
+
|
|
1299
1303
|
const getNewItems = (items, state) => {
|
|
1300
1304
|
return items.map(item => {
|
|
1301
|
-
if (item.id === 'Settings'
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1305
|
+
if (item.id === 'Settings') {
|
|
1306
|
+
if (state === CheckingForUpdate) {
|
|
1307
|
+
return {
|
|
1308
|
+
...item,
|
|
1309
|
+
badgeIcon: 'clock',
|
|
1310
|
+
flags: item.flags | Progress
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
if (state === WaitingForRestart) {
|
|
1314
|
+
return {
|
|
1315
|
+
...item,
|
|
1316
|
+
badgeIcon: '',
|
|
1317
|
+
badgeText: '1'
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
return item;
|
|
1307
1321
|
}
|
|
1308
1322
|
return item;
|
|
1309
1323
|
});
|
|
@@ -1460,6 +1474,14 @@ const mergeClassNames = (...classNames) => {
|
|
|
1460
1474
|
return classNames.filter(Boolean).join(' ');
|
|
1461
1475
|
};
|
|
1462
1476
|
|
|
1477
|
+
const text = data => {
|
|
1478
|
+
return {
|
|
1479
|
+
type: Text,
|
|
1480
|
+
text: data,
|
|
1481
|
+
childCount: 0
|
|
1482
|
+
};
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1463
1485
|
const Vertical = 'vertical';
|
|
1464
1486
|
|
|
1465
1487
|
const ActivityBar$1 = 'ActivityBar';
|
|
@@ -1549,6 +1571,45 @@ const getActivityBarItemInProgressDom = item => {
|
|
|
1549
1571
|
}, ...getBadgeVirtualDom()];
|
|
1550
1572
|
};
|
|
1551
1573
|
|
|
1574
|
+
const getActivityBarItemWithBadgeDom = item => {
|
|
1575
|
+
const {
|
|
1576
|
+
flags,
|
|
1577
|
+
title,
|
|
1578
|
+
icon,
|
|
1579
|
+
badgeText
|
|
1580
|
+
} = item;
|
|
1581
|
+
if (!badgeText) {
|
|
1582
|
+
// TODO should not happen
|
|
1583
|
+
return [];
|
|
1584
|
+
}
|
|
1585
|
+
const isTab = flags & Tab;
|
|
1586
|
+
const isSelected = flags & Selected;
|
|
1587
|
+
const isFocused = flags & Focused;
|
|
1588
|
+
const role = isTab ? Tab$1 : Button$2;
|
|
1589
|
+
const ariaSelected = getAriaSelected(isTab, isSelected);
|
|
1590
|
+
const marginTop = flags & MarginTop;
|
|
1591
|
+
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1592
|
+
className += ' ' + ActivityBarItemNested;
|
|
1593
|
+
return [{
|
|
1594
|
+
type: Div,
|
|
1595
|
+
className,
|
|
1596
|
+
ariaLabel: '',
|
|
1597
|
+
title,
|
|
1598
|
+
role,
|
|
1599
|
+
ariaSelected,
|
|
1600
|
+
childCount: 2
|
|
1601
|
+
}, {
|
|
1602
|
+
type: Div,
|
|
1603
|
+
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1604
|
+
role: None,
|
|
1605
|
+
childCount: 0
|
|
1606
|
+
}, {
|
|
1607
|
+
type: Div,
|
|
1608
|
+
className: ActivityBarItemBadge,
|
|
1609
|
+
childCount: 1
|
|
1610
|
+
}, text(badgeText)];
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1552
1613
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
1553
1614
|
return {
|
|
1554
1615
|
type,
|
|
@@ -1562,7 +1623,8 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1562
1623
|
const {
|
|
1563
1624
|
flags,
|
|
1564
1625
|
title,
|
|
1565
|
-
icon
|
|
1626
|
+
icon,
|
|
1627
|
+
badgeText
|
|
1566
1628
|
} = item;
|
|
1567
1629
|
const isTab = flags & Tab;
|
|
1568
1630
|
const isSelected = flags & Selected;
|
|
@@ -1588,6 +1650,9 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1588
1650
|
if (isProgress) {
|
|
1589
1651
|
return getActivityBarItemInProgressDom(item);
|
|
1590
1652
|
}
|
|
1653
|
+
if (badgeText) {
|
|
1654
|
+
return getActivityBarItemWithBadgeDom(item);
|
|
1655
|
+
}
|
|
1591
1656
|
return [{
|
|
1592
1657
|
type: Div,
|
|
1593
1658
|
className: mergeClassNames(className, `Icon${icon}`),
|