@lvce-editor/activity-bar-worker 1.19.0 → 1.22.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 +58 -36
- package/package.json +1 -1
|
@@ -1466,12 +1466,14 @@ const ActivityBar$1 = 'ActivityBar';
|
|
|
1466
1466
|
const ActivityBarItem = 'ActivityBarItem';
|
|
1467
1467
|
const ActivityBarItemNested = 'ActivityBarItemNested';
|
|
1468
1468
|
const ActivityBarItemSelected = 'ActivityBarItemSelected';
|
|
1469
|
-
const
|
|
1469
|
+
const ActivityBarItemBadge = 'ActivityBarItemBadge';
|
|
1470
1470
|
const BadgeContent = 'BadgeContent';
|
|
1471
1471
|
const FocusOutline = 'FocusOutline';
|
|
1472
1472
|
const Icon = 'Icon';
|
|
1473
1473
|
const MarginTopAuto = 'MarginTopAuto';
|
|
1474
1474
|
const Viewlet = 'Viewlet';
|
|
1475
|
+
const MaskIconProgress = 'MaskIconProgress';
|
|
1476
|
+
const ActivityBarBadgeIcon = 'ActivityBarBadgeIcon';
|
|
1475
1477
|
|
|
1476
1478
|
const HandleBlur = 1;
|
|
1477
1479
|
const HandleContextMenu = 2;
|
|
@@ -1480,6 +1482,29 @@ const HandleMouseDown = 4;
|
|
|
1480
1482
|
|
|
1481
1483
|
const ActivityBar = 'ActivityBar';
|
|
1482
1484
|
|
|
1485
|
+
const getAriaSelected = (isTab, isSelected) => {
|
|
1486
|
+
if (!isTab) {
|
|
1487
|
+
return undefined;
|
|
1488
|
+
}
|
|
1489
|
+
return Boolean(isSelected);
|
|
1490
|
+
};
|
|
1491
|
+
|
|
1492
|
+
const getBadgeVirtualDom = () => {
|
|
1493
|
+
return [{
|
|
1494
|
+
type: Div,
|
|
1495
|
+
className: ActivityBarItemBadge,
|
|
1496
|
+
childCount: 1
|
|
1497
|
+
}, {
|
|
1498
|
+
type: Div,
|
|
1499
|
+
className: BadgeContent,
|
|
1500
|
+
childCount: 1
|
|
1501
|
+
}, {
|
|
1502
|
+
type: Div,
|
|
1503
|
+
className: mergeClassNames(Icon, ActivityBarBadgeIcon, MaskIconProgress),
|
|
1504
|
+
childCount: 0
|
|
1505
|
+
}];
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1483
1508
|
const getClassName = (isFocused, marginTop, isSelected) => {
|
|
1484
1509
|
const classNames = [ActivityBarItem];
|
|
1485
1510
|
if (isFocused) {
|
|
@@ -1494,6 +1519,36 @@ const getClassName = (isFocused, marginTop, isSelected) => {
|
|
|
1494
1519
|
return mergeClassNames(...classNames);
|
|
1495
1520
|
};
|
|
1496
1521
|
|
|
1522
|
+
const getActivityBarItemInProgressDom = item => {
|
|
1523
|
+
const {
|
|
1524
|
+
flags,
|
|
1525
|
+
title,
|
|
1526
|
+
icon
|
|
1527
|
+
} = item;
|
|
1528
|
+
const isTab = flags & Tab;
|
|
1529
|
+
const isSelected = flags & Selected;
|
|
1530
|
+
const isFocused = flags & Focused;
|
|
1531
|
+
const role = isTab ? Tab$1 : Button$2;
|
|
1532
|
+
const ariaSelected = getAriaSelected(isTab, isSelected);
|
|
1533
|
+
const marginTop = flags & MarginTop;
|
|
1534
|
+
let className = getClassName(isFocused, marginTop, isSelected);
|
|
1535
|
+
className += ' ' + ActivityBarItemNested;
|
|
1536
|
+
return [{
|
|
1537
|
+
type: Div,
|
|
1538
|
+
className,
|
|
1539
|
+
ariaLabel: '',
|
|
1540
|
+
title,
|
|
1541
|
+
role,
|
|
1542
|
+
ariaSelected,
|
|
1543
|
+
childCount: 2
|
|
1544
|
+
}, {
|
|
1545
|
+
type: Div,
|
|
1546
|
+
className: mergeClassNames(Icon, `MaskIcon${icon}`),
|
|
1547
|
+
role: None,
|
|
1548
|
+
childCount: 0
|
|
1549
|
+
}, ...getBadgeVirtualDom()];
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1497
1552
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
1498
1553
|
return {
|
|
1499
1554
|
type,
|
|
@@ -1503,12 +1558,6 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
1503
1558
|
};
|
|
1504
1559
|
};
|
|
1505
1560
|
|
|
1506
|
-
const getAriaSelected = (isTab, isSelected) => {
|
|
1507
|
-
if (!isTab) {
|
|
1508
|
-
return undefined;
|
|
1509
|
-
}
|
|
1510
|
-
return Boolean(isSelected);
|
|
1511
|
-
};
|
|
1512
1561
|
const getActivityBarItemVirtualDom = item => {
|
|
1513
1562
|
const {
|
|
1514
1563
|
flags,
|
|
@@ -1522,7 +1571,7 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1522
1571
|
const role = isTab ? Tab$1 : Button$2;
|
|
1523
1572
|
const ariaSelected = getAriaSelected(isTab, isSelected);
|
|
1524
1573
|
const marginTop = flags & MarginTop;
|
|
1525
|
-
|
|
1574
|
+
const className = getClassName(isFocused, marginTop, isSelected);
|
|
1526
1575
|
if (isSelected) {
|
|
1527
1576
|
return [{
|
|
1528
1577
|
type: Div,
|
|
@@ -1537,34 +1586,7 @@ const getActivityBarItemVirtualDom = item => {
|
|
|
1537
1586
|
|
|
1538
1587
|
// TODO support progress on selected activity bar item
|
|
1539
1588
|
if (isProgress) {
|
|
1540
|
-
|
|
1541
|
-
return [{
|
|
1542
|
-
type: Div,
|
|
1543
|
-
className,
|
|
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
|
-
}];
|
|
1589
|
+
return getActivityBarItemInProgressDom(item);
|
|
1568
1590
|
}
|
|
1569
1591
|
return [{
|
|
1570
1592
|
type: Div,
|