@lvce-editor/source-control-worker 1.4.0 → 1.6.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/sourceControlWorkerMain.js +160 -171
- package/package.json +1 -1
|
@@ -1030,39 +1030,39 @@ const {
|
|
|
1030
1030
|
|
|
1031
1031
|
const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
1032
1032
|
const state = {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
items: [],
|
|
1036
|
-
x,
|
|
1037
|
-
y,
|
|
1038
|
-
width,
|
|
1039
|
-
height,
|
|
1033
|
+
actionsCache: Object.create(null),
|
|
1034
|
+
allGroups: [],
|
|
1040
1035
|
deltaY: 0,
|
|
1041
|
-
|
|
1042
|
-
maxLineY: 0,
|
|
1036
|
+
enabledProviderIds: [],
|
|
1043
1037
|
fileIconCache: Object.create(null),
|
|
1044
|
-
icons: [],
|
|
1045
1038
|
finalDeltaY: 0,
|
|
1039
|
+
gitRoot: '',
|
|
1046
1040
|
handleOffset: 0,
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1041
|
+
headerHeight: 40,
|
|
1042
|
+
// TODO
|
|
1043
|
+
height,
|
|
1044
|
+
id,
|
|
1050
1045
|
index: [],
|
|
1051
|
-
untracked: [],
|
|
1052
|
-
workingTree: [],
|
|
1053
1046
|
inputValue: '',
|
|
1054
|
-
buttonIndex: -1,
|
|
1055
|
-
enabledProviderIds: [],
|
|
1056
1047
|
isExpanded: true,
|
|
1057
|
-
buttons: [],
|
|
1058
|
-
providerId: '',
|
|
1059
|
-
splitButtonEnabled: false,
|
|
1060
|
-
allGroups: [],
|
|
1061
|
-
gitRoot: '',
|
|
1062
1048
|
itemHeight: 20,
|
|
1049
|
+
items: [],
|
|
1050
|
+
maxLineY: 0,
|
|
1051
|
+
merge: [],
|
|
1063
1052
|
minimumSliderSize: 20,
|
|
1053
|
+
minLineY: 0,
|
|
1054
|
+
providerId: '',
|
|
1055
|
+
root: '',
|
|
1056
|
+
scrollBarActive: false,
|
|
1057
|
+
scrollBarHeight: 0,
|
|
1058
|
+
splitButtonEnabled: false,
|
|
1059
|
+
untracked: [],
|
|
1060
|
+
visibleItems: [],
|
|
1061
|
+
width,
|
|
1062
|
+
workingTree: [],
|
|
1064
1063
|
workspacePath,
|
|
1065
|
-
|
|
1064
|
+
x,
|
|
1065
|
+
y
|
|
1066
1066
|
};
|
|
1067
1067
|
set$1(id, state, state);
|
|
1068
1068
|
};
|
|
@@ -1071,7 +1071,7 @@ const RenderItems = 4;
|
|
|
1071
1071
|
|
|
1072
1072
|
const diffType = RenderItems;
|
|
1073
1073
|
const isEqual = (oldState, newState) => {
|
|
1074
|
-
return oldState.allGroups === newState.allGroups && oldState.
|
|
1074
|
+
return oldState.allGroups === newState.allGroups && oldState.visibleItems === newState.visibleItems && oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY;
|
|
1075
1075
|
};
|
|
1076
1076
|
|
|
1077
1077
|
const modules = [isEqual];
|
|
@@ -1097,7 +1097,7 @@ const diff2 = uid => {
|
|
|
1097
1097
|
return result;
|
|
1098
1098
|
};
|
|
1099
1099
|
|
|
1100
|
-
const commandIds = ['acceptInput', '
|
|
1100
|
+
const commandIds = ['acceptInput', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusNone', 'focusPrevious', 'handleClick', 'handleClickAt', 'handleFocus', 'handleIconThemeChange', 'handleMouseOut', 'handleMouseOutAt', 'handleMouseOver', 'handleMouseOverAt', 'handleWheel', 'selectIndex'];
|
|
1101
1101
|
|
|
1102
1102
|
const getCommandIds = () => {
|
|
1103
1103
|
return commandIds;
|
|
@@ -1243,10 +1243,6 @@ const getDisplayItems = (allGroups, isExpanded) => {
|
|
|
1243
1243
|
return displayItems;
|
|
1244
1244
|
};
|
|
1245
1245
|
|
|
1246
|
-
const getIconsCached = (dirents, fileIconCache) => {
|
|
1247
|
-
return dirents.map(dirent => fileIconCache[dirent]);
|
|
1248
|
-
};
|
|
1249
|
-
|
|
1250
1246
|
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1251
1247
|
const missingRequests = [];
|
|
1252
1248
|
for (const dirent of dirents) {
|
|
@@ -1261,14 +1257,6 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1261
1257
|
return missingRequests;
|
|
1262
1258
|
};
|
|
1263
1259
|
|
|
1264
|
-
const getPath = item => {
|
|
1265
|
-
return item.file;
|
|
1266
|
-
};
|
|
1267
|
-
|
|
1268
|
-
const getPaths = items => {
|
|
1269
|
-
return items.map(getPath);
|
|
1270
|
-
};
|
|
1271
|
-
|
|
1272
1260
|
const getFileIcon = async name => {
|
|
1273
1261
|
return invoke$1('IconTheme.getFileIcon', {
|
|
1274
1262
|
name
|
|
@@ -1305,12 +1293,7 @@ const getFileIcons = async (dirents, fileIconCache) => {
|
|
|
1305
1293
|
const missingRequests = getMissingIconRequests(dirents, fileIconCache);
|
|
1306
1294
|
const newIcons = await requestFileIcons(missingRequests);
|
|
1307
1295
|
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
1308
|
-
|
|
1309
|
-
const icons = getIconsCached(paths, newFileIconCache);
|
|
1310
|
-
return {
|
|
1311
|
-
icons,
|
|
1312
|
-
newFileIconCache
|
|
1313
|
-
};
|
|
1296
|
+
return newFileIconCache;
|
|
1314
1297
|
};
|
|
1315
1298
|
|
|
1316
1299
|
const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
@@ -1401,62 +1384,59 @@ const getProtocol = uri => {
|
|
|
1401
1384
|
return Disk;
|
|
1402
1385
|
};
|
|
1403
1386
|
|
|
1404
|
-
const
|
|
1405
|
-
|
|
1387
|
+
const emptySourceControlButtons = [];
|
|
1388
|
+
|
|
1389
|
+
const getContextId = (groupId, type) => {
|
|
1390
|
+
if (type === File) {
|
|
1391
|
+
return `${groupId}-item`;
|
|
1392
|
+
}
|
|
1393
|
+
return groupId;
|
|
1406
1394
|
};
|
|
1407
1395
|
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
|
|
1396
|
+
const getVisibleSourceControlItems = (items, minLineY, maxLineY, actionsCache, fileIconCache) => {
|
|
1397
|
+
const visible = [];
|
|
1398
|
+
for (let i = minLineY; i < maxLineY; i++) {
|
|
1399
|
+
const item = items[i];
|
|
1400
|
+
const contextId = getContextId(item.groupId, item.type);
|
|
1401
|
+
const buttons = actionsCache[contextId] || emptySourceControlButtons;
|
|
1402
|
+
const fileIcon = fileIconCache[item.file] || '';
|
|
1403
|
+
visible.push({
|
|
1404
|
+
...item,
|
|
1405
|
+
buttons,
|
|
1406
|
+
fileIcon
|
|
1407
|
+
});
|
|
1411
1408
|
}
|
|
1412
|
-
return
|
|
1409
|
+
return visible;
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
const get = key => {
|
|
1413
|
+
return false;
|
|
1413
1414
|
};
|
|
1414
1415
|
|
|
1415
1416
|
const getExtensions = async () => {
|
|
1416
1417
|
return invoke('Extensions.getExtensions');
|
|
1417
1418
|
};
|
|
1418
1419
|
|
|
1419
|
-
const
|
|
1420
|
-
cache: Object.create(null)
|
|
1421
|
-
};
|
|
1422
|
-
const getContextId = (groupId, type) => {
|
|
1423
|
-
if (type === File) {
|
|
1424
|
-
return `${groupId}-item`;
|
|
1425
|
-
}
|
|
1426
|
-
return groupId;
|
|
1427
|
-
};
|
|
1428
|
-
const ensureActions = async () => {
|
|
1429
|
-
if (Object.keys(state.cache).length > 0) {
|
|
1430
|
-
return;
|
|
1431
|
-
}
|
|
1420
|
+
const requestSourceActions = async () => {
|
|
1432
1421
|
const extensions = await getExtensions();
|
|
1422
|
+
const newCache = Object.create(null);
|
|
1433
1423
|
for (const extension of extensions) {
|
|
1434
1424
|
if (extension && extension['source-control-actions']) {
|
|
1435
1425
|
for (const [key, value] of Object.entries(extension['source-control-actions'])) {
|
|
1436
|
-
|
|
1426
|
+
newCache[key] = value;
|
|
1437
1427
|
}
|
|
1438
1428
|
}
|
|
1439
1429
|
}
|
|
1440
|
-
|
|
1441
|
-
const getSourceControlActions = async (providerId, groupId, type) => {
|
|
1442
|
-
string(groupId);
|
|
1443
|
-
await ensureActions();
|
|
1444
|
-
const contextId = getContextId(groupId, type);
|
|
1445
|
-
const value = state.cache[contextId] || [];
|
|
1446
|
-
return value;
|
|
1430
|
+
return newCache;
|
|
1447
1431
|
};
|
|
1448
1432
|
|
|
1449
|
-
const
|
|
1450
|
-
if (
|
|
1451
|
-
return
|
|
1452
|
-
}
|
|
1453
|
-
const item = displayItems[buttonIndex];
|
|
1454
|
-
if (!item) {
|
|
1455
|
-
return [];
|
|
1433
|
+
const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
1434
|
+
if (size >= contentSize) {
|
|
1435
|
+
return 0;
|
|
1456
1436
|
}
|
|
1457
|
-
|
|
1458
|
-
return actions;
|
|
1437
|
+
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
1459
1438
|
};
|
|
1439
|
+
|
|
1460
1440
|
const loadContent = async state => {
|
|
1461
1441
|
const {
|
|
1462
1442
|
itemHeight,
|
|
@@ -1473,46 +1453,43 @@ const loadContent = async state => {
|
|
|
1473
1453
|
gitRoot
|
|
1474
1454
|
} = await getGroups(enabledProviderIds);
|
|
1475
1455
|
const isExpanded = true;
|
|
1476
|
-
const
|
|
1477
|
-
const
|
|
1456
|
+
const displayItems = getDisplayItems(allGroups, isExpanded);
|
|
1457
|
+
const cache = await requestSourceActions();
|
|
1478
1458
|
const splitButtonEnabled = get();
|
|
1479
|
-
const total =
|
|
1459
|
+
const total = displayItems.length;
|
|
1480
1460
|
const contentHeight = total * itemHeight;
|
|
1481
1461
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
1482
1462
|
const scrollBarHeight = getScrollBarSize(height, contentHeight, minimumSliderSize);
|
|
1483
1463
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
1464
|
+
const minLineY = 0;
|
|
1484
1465
|
const maxLineY = Math.min(numberOfVisible, total);
|
|
1466
|
+
const slicedItems = displayItems.slice(minLineY, maxLineY);
|
|
1467
|
+
const newFileIconCache = await getFileIcons(slicedItems, fileIconCache);
|
|
1468
|
+
const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, cache, newFileIconCache);
|
|
1485
1469
|
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
1486
|
-
const {
|
|
1487
|
-
icons,
|
|
1488
|
-
newFileIconCache
|
|
1489
|
-
} = await getFileIcons(items, fileIconCache);
|
|
1490
1470
|
return {
|
|
1491
1471
|
...state,
|
|
1492
1472
|
allGroups,
|
|
1493
1473
|
gitRoot,
|
|
1494
|
-
items,
|
|
1474
|
+
items: displayItems,
|
|
1475
|
+
visibleItems,
|
|
1495
1476
|
enabledProviderIds,
|
|
1496
1477
|
isExpanded,
|
|
1497
|
-
buttons,
|
|
1498
1478
|
root,
|
|
1499
1479
|
splitButtonEnabled,
|
|
1500
1480
|
maxLineY,
|
|
1501
1481
|
scrollBarHeight,
|
|
1502
1482
|
finalDeltaY,
|
|
1503
|
-
icons,
|
|
1504
1483
|
fileIconCache: newFileIconCache
|
|
1505
1484
|
};
|
|
1506
1485
|
};
|
|
1507
1486
|
|
|
1508
1487
|
const handleButtonClick = async (state, clickedIndex) => {
|
|
1509
1488
|
const {
|
|
1510
|
-
|
|
1511
|
-
buttons,
|
|
1512
|
-
items
|
|
1489
|
+
visibleItems
|
|
1513
1490
|
} = state;
|
|
1514
|
-
const
|
|
1515
|
-
const
|
|
1491
|
+
const item = visibleItems[clickedIndex];
|
|
1492
|
+
const button = item.buttons[clickedIndex];
|
|
1516
1493
|
if (!button) {
|
|
1517
1494
|
return state;
|
|
1518
1495
|
}
|
|
@@ -1628,27 +1605,41 @@ const handleFocus = async state => {
|
|
|
1628
1605
|
return state;
|
|
1629
1606
|
};
|
|
1630
1607
|
|
|
1631
|
-
const
|
|
1608
|
+
const handleMouseOut = (state, index) => {
|
|
1632
1609
|
const {
|
|
1633
|
-
items
|
|
1634
|
-
providerId,
|
|
1635
|
-
buttonIndex
|
|
1610
|
+
items
|
|
1636
1611
|
} = state;
|
|
1637
|
-
if (index ===
|
|
1638
|
-
return
|
|
1612
|
+
if (index === -1 || index > items.length) {
|
|
1613
|
+
return {
|
|
1614
|
+
...state
|
|
1615
|
+
};
|
|
1639
1616
|
}
|
|
1617
|
+
return state;
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
const handleMouseOutAt = (state, eventX, eventY) => {
|
|
1621
|
+
const index = getIndex(state, eventX, eventY);
|
|
1622
|
+
return handleMouseOut(state, index);
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
const handleMouseOver = async (state, index) => {
|
|
1626
|
+
const {
|
|
1627
|
+
items
|
|
1628
|
+
} = state;
|
|
1640
1629
|
const item = items[index];
|
|
1641
1630
|
if (!item) {
|
|
1642
1631
|
return state;
|
|
1643
1632
|
}
|
|
1644
|
-
const actions = await getSourceControlActions(providerId, item.groupId, item.type);
|
|
1645
1633
|
return {
|
|
1646
|
-
...state
|
|
1647
|
-
buttonIndex: index,
|
|
1648
|
-
buttons: actions
|
|
1634
|
+
...state
|
|
1649
1635
|
};
|
|
1650
1636
|
};
|
|
1651
1637
|
|
|
1638
|
+
const handleMouseOverAt = async (state, eventX, eventY) => {
|
|
1639
|
+
const index = getIndex(state, eventX, eventY);
|
|
1640
|
+
return handleMouseOver(state, index);
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1652
1643
|
const getPortTuple = () => {
|
|
1653
1644
|
const {
|
|
1654
1645
|
port1,
|
|
@@ -1691,6 +1682,7 @@ const initialize = async () => {
|
|
|
1691
1682
|
};
|
|
1692
1683
|
|
|
1693
1684
|
const Actions = 'Actions';
|
|
1685
|
+
const Grow = 'Grow';
|
|
1694
1686
|
const Chevron = 'Chevron';
|
|
1695
1687
|
const ChevronRight = 'ChevronRight';
|
|
1696
1688
|
const DecorationIcon = 'DecorationIcon';
|
|
@@ -1722,6 +1714,7 @@ const HandleContextMenu = 'handleContextMenu';
|
|
|
1722
1714
|
const HandleFocus = 'handleFocus';
|
|
1723
1715
|
const HandleInput = 'handleInput';
|
|
1724
1716
|
const HandleMouseOut = 'handleMouseOut';
|
|
1717
|
+
const HandleMouseOutAt = 'handleMouseOutAt';
|
|
1725
1718
|
const HandleMouseOver = 'handleMouseOver';
|
|
1726
1719
|
const HandleMouseOverAt = 'handleMouseOverAt';
|
|
1727
1720
|
const HandleWheel = 'handleWheel';
|
|
@@ -1781,37 +1774,6 @@ const ToolBar = 'toolbar';
|
|
|
1781
1774
|
const Tree = 'tree';
|
|
1782
1775
|
const TreeItem = 'treeitem';
|
|
1783
1776
|
|
|
1784
|
-
const emptySourceControlButtons = [];
|
|
1785
|
-
|
|
1786
|
-
const getIconVirtualDom = (icon, type = Div) => {
|
|
1787
|
-
return {
|
|
1788
|
-
type,
|
|
1789
|
-
className: `MaskIcon MaskIcon${icon}`,
|
|
1790
|
-
role: None,
|
|
1791
|
-
childCount: 0
|
|
1792
|
-
};
|
|
1793
|
-
};
|
|
1794
|
-
|
|
1795
|
-
const addButtons = (dom, buttons) => {
|
|
1796
|
-
if (buttons === emptySourceControlButtons) {
|
|
1797
|
-
return;
|
|
1798
|
-
}
|
|
1799
|
-
dom[0].childCount += buttons.length;
|
|
1800
|
-
for (const button of buttons) {
|
|
1801
|
-
const {
|
|
1802
|
-
icon,
|
|
1803
|
-
label
|
|
1804
|
-
} = button;
|
|
1805
|
-
dom.push({
|
|
1806
|
-
type: Button$1,
|
|
1807
|
-
className: SourceControlButton,
|
|
1808
|
-
title: label,
|
|
1809
|
-
ariaLabel: label,
|
|
1810
|
-
childCount: 1
|
|
1811
|
-
}, getIconVirtualDom(icon, Span));
|
|
1812
|
-
}
|
|
1813
|
-
};
|
|
1814
|
-
|
|
1815
1777
|
const mergeClassNames = (...classNames) => {
|
|
1816
1778
|
return classNames.filter(Boolean).join(' ');
|
|
1817
1779
|
};
|
|
@@ -1832,10 +1794,44 @@ const getBadgeVirtualDom = (className, count) => {
|
|
|
1832
1794
|
}, text(`${count}`)];
|
|
1833
1795
|
};
|
|
1834
1796
|
|
|
1797
|
+
const getIconVirtualDom = (icon, type = Div) => {
|
|
1798
|
+
return {
|
|
1799
|
+
type,
|
|
1800
|
+
className: `MaskIcon MaskIcon${icon}`,
|
|
1801
|
+
role: None,
|
|
1802
|
+
childCount: 0
|
|
1803
|
+
};
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1806
|
+
const getButtonVirtualDom = button => {
|
|
1807
|
+
const {
|
|
1808
|
+
icon,
|
|
1809
|
+
label
|
|
1810
|
+
} = button;
|
|
1811
|
+
return [{
|
|
1812
|
+
type: Button$1,
|
|
1813
|
+
className: SourceControlButton,
|
|
1814
|
+
title: label,
|
|
1815
|
+
ariaLabel: label,
|
|
1816
|
+
childCount: 1
|
|
1817
|
+
}, getIconVirtualDom(icon, Span)];
|
|
1818
|
+
};
|
|
1819
|
+
|
|
1820
|
+
const getButtonsVirtualDom = buttons => {
|
|
1821
|
+
if (buttons === emptySourceControlButtons) {
|
|
1822
|
+
return [];
|
|
1823
|
+
}
|
|
1824
|
+
return [{
|
|
1825
|
+
type: Div,
|
|
1826
|
+
className: 'SourceControlButtons',
|
|
1827
|
+
childCount: buttons.length
|
|
1828
|
+
}, ...buttons.flatMap(getButtonVirtualDom)];
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1835
1831
|
const getLabelClassName = decorationStrikeThrough => {
|
|
1836
|
-
let className = Label
|
|
1832
|
+
let className = mergeClassNames(Label, Grow);
|
|
1837
1833
|
if (decorationStrikeThrough) {
|
|
1838
|
-
className
|
|
1834
|
+
className = mergeClassNames(className, StrikeThrough);
|
|
1839
1835
|
}
|
|
1840
1836
|
return className;
|
|
1841
1837
|
};
|
|
@@ -1855,28 +1851,27 @@ const createItemDirectory = item => {
|
|
|
1855
1851
|
buttons
|
|
1856
1852
|
} = item;
|
|
1857
1853
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
1858
|
-
const
|
|
1854
|
+
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
1855
|
+
const hasButtons = buttons.length;
|
|
1856
|
+
return [{
|
|
1859
1857
|
type: Div,
|
|
1860
1858
|
className: TreeItem$1,
|
|
1861
1859
|
role: TreeItem,
|
|
1862
1860
|
ariaExpanded: type === DirectoryExpanded,
|
|
1863
1861
|
ariaPosInSet: posInSet,
|
|
1864
1862
|
ariaSetSize: setSize,
|
|
1865
|
-
childCount: 3,
|
|
1863
|
+
childCount: 3 + (hasButtons ? 1 : 0),
|
|
1866
1864
|
paddingLeft: PaddingLeft,
|
|
1867
1865
|
paddingRight: PaddingRight
|
|
1868
1866
|
}, {
|
|
1869
1867
|
type: Div,
|
|
1870
|
-
className:
|
|
1868
|
+
className: mergeClassNames(Chevron, `MaskIcon${icon}`),
|
|
1871
1869
|
childCount: 0
|
|
1872
1870
|
}, {
|
|
1873
1871
|
type: Div,
|
|
1874
1872
|
className: labelClassName,
|
|
1875
1873
|
childCount: 1
|
|
1876
|
-
}, text(label)];
|
|
1877
|
-
addButtons(dom, buttons);
|
|
1878
|
-
dom.push(...getBadgeVirtualDom(SourceControlBadge, badgeCount));
|
|
1879
|
-
return dom;
|
|
1874
|
+
}, text(label), ...buttonsDom, ...getBadgeVirtualDom(SourceControlBadge, badgeCount)];
|
|
1880
1875
|
};
|
|
1881
1876
|
|
|
1882
1877
|
const getFileIconVirtualDom = icon => {
|
|
@@ -1916,6 +1911,8 @@ const createItemOther = item => {
|
|
|
1916
1911
|
} = item;
|
|
1917
1912
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
1918
1913
|
const dom = [];
|
|
1914
|
+
const hasButtons = buttons.length;
|
|
1915
|
+
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
1919
1916
|
dom.push({
|
|
1920
1917
|
type: Div,
|
|
1921
1918
|
className: TreeItem$1,
|
|
@@ -1923,7 +1920,7 @@ const createItemOther = item => {
|
|
|
1923
1920
|
ariaPosInSet: posInSet,
|
|
1924
1921
|
ariaSetSize: setSize,
|
|
1925
1922
|
title: file,
|
|
1926
|
-
childCount: 3,
|
|
1923
|
+
childCount: 3 + (hasButtons ? 1 : 0),
|
|
1927
1924
|
paddingLeft: '1rem',
|
|
1928
1925
|
paddingRight: '12px'
|
|
1929
1926
|
}, ...getIconsDom(icon, fileIcon));
|
|
@@ -1941,7 +1938,7 @@ const createItemOther = item => {
|
|
|
1941
1938
|
childCount: 1
|
|
1942
1939
|
}, text(detail));
|
|
1943
1940
|
}
|
|
1944
|
-
|
|
1941
|
+
dom.push(...buttonsDom);
|
|
1945
1942
|
dom.push({
|
|
1946
1943
|
type: Img,
|
|
1947
1944
|
className: DecorationIcon,
|
|
@@ -1968,7 +1965,9 @@ const getSourceControlListVirtualDom = items => {
|
|
|
1968
1965
|
className: SourceControlItems,
|
|
1969
1966
|
role: Tree,
|
|
1970
1967
|
childCount: items.length,
|
|
1971
|
-
onClick: HandleClickAt
|
|
1968
|
+
onClick: HandleClickAt,
|
|
1969
|
+
onPointerOver: HandleMouseOverAt,
|
|
1970
|
+
onPointerOut: HandleMouseOutAt
|
|
1972
1971
|
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
1973
1972
|
};
|
|
1974
1973
|
|
|
@@ -2016,23 +2015,8 @@ const getSourceControlVirtualDom = (items, splitButtonEnabled) => {
|
|
|
2016
2015
|
return dom;
|
|
2017
2016
|
};
|
|
2018
2017
|
|
|
2019
|
-
const getVisibleSourceControlItems = (items, minLineY, maxLineY, buttons, buttonIndex, icons) => {
|
|
2020
|
-
const visible = [];
|
|
2021
|
-
for (let i = minLineY; i < maxLineY; i++) {
|
|
2022
|
-
const item = items[i];
|
|
2023
|
-
const itemButtons = i === buttonIndex ? buttons : emptySourceControlButtons;
|
|
2024
|
-
const fileIcon = icons[i - minLineY];
|
|
2025
|
-
visible.push({
|
|
2026
|
-
...item,
|
|
2027
|
-
buttons: itemButtons,
|
|
2028
|
-
fileIcon
|
|
2029
|
-
});
|
|
2030
|
-
}
|
|
2031
|
-
return visible;
|
|
2032
|
-
};
|
|
2033
|
-
|
|
2034
2018
|
const renderItems = (oldState, newState) => {
|
|
2035
|
-
const visible =
|
|
2019
|
+
const visible = newState.visibleItems;
|
|
2036
2020
|
const dom = getSourceControlVirtualDom(visible, newState.splitButtonEnabled);
|
|
2037
2021
|
return ['Viewlet.setDom2', dom];
|
|
2038
2022
|
};
|
|
@@ -2126,6 +2110,9 @@ const renderEventListeners = () => {
|
|
|
2126
2110
|
}, {
|
|
2127
2111
|
name: HandleMouseOver,
|
|
2128
2112
|
params: ['handleMouseOver', 'event.clientX', 'event.clientY']
|
|
2113
|
+
}, {
|
|
2114
|
+
name: HandleMouseOutAt,
|
|
2115
|
+
params: ['handleMouseOutAt', 'event.clientX', 'event.clientY']
|
|
2129
2116
|
}, {
|
|
2130
2117
|
name: HandleInput,
|
|
2131
2118
|
params: ['handleInput', 'event.target.value']
|
|
@@ -2148,13 +2135,15 @@ const saveState = uid => {
|
|
|
2148
2135
|
} = value;
|
|
2149
2136
|
const {
|
|
2150
2137
|
root,
|
|
2151
|
-
maxLineY
|
|
2138
|
+
maxLineY,
|
|
2139
|
+
isExpanded
|
|
2152
2140
|
} = newState;
|
|
2153
2141
|
return {
|
|
2154
2142
|
root,
|
|
2155
2143
|
minLineY: 0,
|
|
2156
2144
|
maxLineY,
|
|
2157
|
-
deltaY: 0
|
|
2145
|
+
deltaY: 0,
|
|
2146
|
+
isExpanded
|
|
2158
2147
|
};
|
|
2159
2148
|
};
|
|
2160
2149
|
|
|
@@ -2169,13 +2158,10 @@ const updateIcons = async state => {
|
|
|
2169
2158
|
maxLineY
|
|
2170
2159
|
} = state;
|
|
2171
2160
|
const visible = items.slice(minLineY, maxLineY);
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2174
|
-
newFileIconCache
|
|
2175
|
-
} = await getFileIcons(visible, Object.create(null));
|
|
2161
|
+
const newFileIconCache = await getFileIcons(visible, Object.create(null));
|
|
2162
|
+
// TODO update visible items
|
|
2176
2163
|
return {
|
|
2177
2164
|
...state,
|
|
2178
|
-
icons,
|
|
2179
2165
|
fileIconCache: newFileIconCache
|
|
2180
2166
|
};
|
|
2181
2167
|
};
|
|
@@ -2188,9 +2174,12 @@ const commandMap = {
|
|
|
2188
2174
|
'SourceControl.handleButtonClick': wrapCommand(handleButtonClick),
|
|
2189
2175
|
'SourceControl.handleClickAt': wrapCommand(handleClickAt),
|
|
2190
2176
|
'SourceControl.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2177
|
+
'SourceControl.handleFocus': wrapCommand(handleFocus),
|
|
2178
|
+
'SourceControl.handleMouseOut': wrapCommand(handleMouseOut),
|
|
2179
|
+
'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
|
|
2191
2180
|
'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
|
|
2181
|
+
'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
|
|
2192
2182
|
'SourceControl.loadContent': wrapCommand(loadContent),
|
|
2193
|
-
'SourceControl.handleFocus': wrapCommand(handleFocus),
|
|
2194
2183
|
'SourceControl.render2': render2,
|
|
2195
2184
|
'SourceControl.renderActions2': renderActions,
|
|
2196
2185
|
'SourceControl.renderEventListeners': renderEventListeners,
|