@lvce-editor/activity-bar-worker 1.19.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.
- package/dist/activityBarWorkerMain.js +130 -43
- package/package.json +1 -1
|
@@ -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,18 +1474,28 @@ 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';
|
|
1466
1488
|
const ActivityBarItem = 'ActivityBarItem';
|
|
1467
1489
|
const ActivityBarItemNested = 'ActivityBarItemNested';
|
|
1468
1490
|
const ActivityBarItemSelected = 'ActivityBarItemSelected';
|
|
1469
|
-
const
|
|
1491
|
+
const ActivityBarItemBadge = 'ActivityBarItemBadge';
|
|
1470
1492
|
const BadgeContent = 'BadgeContent';
|
|
1471
1493
|
const FocusOutline = 'FocusOutline';
|
|
1472
1494
|
const Icon = 'Icon';
|
|
1473
1495
|
const MarginTopAuto = 'MarginTopAuto';
|
|
1474
1496
|
const Viewlet = 'Viewlet';
|
|
1497
|
+
const MaskIconProgress = 'MaskIconProgress';
|
|
1498
|
+
const ActivityBarBadgeIcon = 'ActivityBarBadgeIcon';
|
|
1475
1499
|
|
|
1476
1500
|
const HandleBlur = 1;
|
|
1477
1501
|
const HandleContextMenu = 2;
|
|
@@ -1480,6 +1504,29 @@ const HandleMouseDown = 4;
|
|
|
1480
1504
|
|
|
1481
1505
|
const ActivityBar = 'ActivityBar';
|
|
1482
1506
|
|
|
1507
|
+
const getAriaSelected = (isTab, isSelected) => {
|
|
1508
|
+
if (!isTab) {
|
|
1509
|
+
return undefined;
|
|
1510
|
+
}
|
|
1511
|
+
return Boolean(isSelected);
|
|
1512
|
+
};
|
|
1513
|
+
|
|
1514
|
+
const getBadgeVirtualDom = () => {
|
|
1515
|
+
return [{
|
|
1516
|
+
type: Div,
|
|
1517
|
+
className: ActivityBarItemBadge,
|
|
1518
|
+
childCount: 1
|
|
1519
|
+
}, {
|
|
1520
|
+
type: Div,
|
|
1521
|
+
className: BadgeContent,
|
|
1522
|
+
childCount: 1
|
|
1523
|
+
}, {
|
|
1524
|
+
type: Div,
|
|
1525
|
+
className: mergeClassNames(Icon, ActivityBarBadgeIcon, MaskIconProgress),
|
|
1526
|
+
childCount: 0
|
|
1527
|
+
}];
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1483
1530
|
const getClassName = (isFocused, marginTop, isSelected) => {
|
|
1484
1531
|
const classNames = [ActivityBarItem];
|
|
1485
1532
|
if (isFocused) {
|
|
@@ -1494,6 +1541,75 @@ const getClassName = (isFocused, marginTop, isSelected) => {
|
|
|
1494
1541
|
return mergeClassNames(...classNames);
|
|
1495
1542
|
};
|
|
1496
1543
|
|
|
1544
|
+
const getActivityBarItemInProgressDom = item => {
|
|
1545
|
+
const {
|
|
1546
|
+
flags,
|
|
1547
|
+
title,
|
|
1548
|
+
icon
|
|
1549
|
+
} = item;
|
|
1550
|
+
const isTab = flags & Tab;
|
|
1551
|
+
const isSelected = flags & Selected;
|
|
1552
|
+
const isFocused = flags & Focused;
|
|
1553
|
+
const role = isTab ? Tab$1 : Button$2;
|
|
1554
|
+
const ariaSelected = getAriaSelected(isTab, isSelected);
|
|
1555
|
+
const marginTop = flags & MarginTop;
|
|
1556
|
+
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1557
|
+
className += ' ' + ActivityBarItemNested;
|
|
1558
|
+
return [{
|
|
1559
|
+
type: Div,
|
|
1560
|
+
className,
|
|
1561
|
+
ariaLabel: '',
|
|
1562
|
+
title,
|
|
1563
|
+
role,
|
|
1564
|
+
ariaSelected,
|
|
1565
|
+
childCount: 2
|
|
1566
|
+
}, {
|
|
1567
|
+
type: Div,
|
|
1568
|
+
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1569
|
+
role: None,
|
|
1570
|
+
childCount: 0
|
|
1571
|
+
}, ...getBadgeVirtualDom()];
|
|
1572
|
+
};
|
|
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
|
+
|
|
1497
1613
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
1498
1614
|
return {
|
|
1499
1615
|
type,
|
|
@@ -1503,17 +1619,12 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
1503
1619
|
};
|
|
1504
1620
|
};
|
|
1505
1621
|
|
|
1506
|
-
const getAriaSelected = (isTab, isSelected) => {
|
|
1507
|
-
if (!isTab) {
|
|
1508
|
-
return undefined;
|
|
1509
|
-
}
|
|
1510
|
-
return Boolean(isSelected);
|
|
1511
|
-
};
|
|
1512
1622
|
const getActivityBarItemVirtualDom = item => {
|
|
1513
1623
|
const {
|
|
1514
1624
|
flags,
|
|
1515
1625
|
title,
|
|
1516
|
-
icon
|
|
1626
|
+
icon,
|
|
1627
|
+
badgeText
|
|
1517
1628
|
} = item;
|
|
1518
1629
|
const isTab = flags & Tab;
|
|
1519
1630
|
const isSelected = flags & Selected;
|
|
@@ -1522,7 +1633,7 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1522
1633
|
const role = isTab ? Tab$1 : Button$2;
|
|
1523
1634
|
const ariaSelected = getAriaSelected(isTab, isSelected);
|
|
1524
1635
|
const marginTop = flags & MarginTop;
|
|
1525
|
-
|
|
1636
|
+
const className = getClassName(isFocused, marginTop, isSelected);
|
|
1526
1637
|
if (isSelected) {
|
|
1527
1638
|
return [{
|
|
1528
1639
|
type: Div,
|
|
@@ -1537,34 +1648,10 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1537
1648
|
|
|
1538
1649
|
// TODO support progress on selected activity bar item
|
|
1539
1650
|
if (isProgress) {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
ariaLabel: '',
|
|
1545
|
-
title,
|
|
1546
|
-
role,
|
|
1547
|
-
ariaSelected,
|
|
1548
|
-
childCount: 2
|
|
1549
|
-
}, {
|
|
1550
|
-
type: Div,
|
|
1551
|
-
className: Icon,
|
|
1552
|
-
role: None,
|
|
1553
|
-
childCount: 0,
|
|
1554
|
-
maskImage: icon
|
|
1555
|
-
}, {
|
|
1556
|
-
type: Div,
|
|
1557
|
-
className: Badge,
|
|
1558
|
-
childCount: 1
|
|
1559
|
-
}, {
|
|
1560
|
-
type: Div,
|
|
1561
|
-
className: BadgeContent,
|
|
1562
|
-
childCount: 1
|
|
1563
|
-
}, {
|
|
1564
|
-
type: Div,
|
|
1565
|
-
className: Icon,
|
|
1566
|
-
maskImage: 'Progress'
|
|
1567
|
-
}];
|
|
1651
|
+
return getActivityBarItemInProgressDom(item);
|
|
1652
|
+
}
|
|
1653
|
+
if (badgeText) {
|
|
1654
|
+
return getActivityBarItemWithBadgeDom(item);
|
|
1568
1655
|
}
|
|
1569
1656
|
return [{
|
|
1570
1657
|
type: Div,
|