@lvce-editor/source-control-worker 2.17.0 → 2.19.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 +228 -220
- package/package.json +1 -1
|
@@ -1255,8 +1255,8 @@ const getDisplayItemsGroup = (group, expandedGroups, iconDefinitions) => {
|
|
|
1255
1255
|
const displayItems = [];
|
|
1256
1256
|
const {
|
|
1257
1257
|
id,
|
|
1258
|
-
|
|
1259
|
-
|
|
1258
|
+
items,
|
|
1259
|
+
label
|
|
1260
1260
|
} = group;
|
|
1261
1261
|
if (!items) {
|
|
1262
1262
|
throw new Error('Source control group is missing an items property');
|
|
@@ -1269,18 +1269,18 @@ const getDisplayItemsGroup = (group, expandedGroups, iconDefinitions) => {
|
|
|
1269
1269
|
const icon = isExpanded ? 'ChevronDown' : 'ChevronRight';
|
|
1270
1270
|
if (length > 0) {
|
|
1271
1271
|
displayItems.push({
|
|
1272
|
+
badgeCount: length,
|
|
1273
|
+
decorationIcon: '',
|
|
1274
|
+
decorationIconTitle: '',
|
|
1275
|
+
decorationStrikeThrough: false,
|
|
1276
|
+
detail: '',
|
|
1272
1277
|
file: '',
|
|
1278
|
+
groupId: id,
|
|
1279
|
+
icon,
|
|
1273
1280
|
label,
|
|
1274
|
-
detail: '',
|
|
1275
1281
|
posInSet: 1,
|
|
1276
1282
|
setSize: 1,
|
|
1277
|
-
|
|
1278
|
-
decorationIcon: '',
|
|
1279
|
-
decorationIconTitle: '',
|
|
1280
|
-
decorationStrikeThrough: false,
|
|
1281
|
-
type,
|
|
1282
|
-
badgeCount: length,
|
|
1283
|
-
groupId: id
|
|
1283
|
+
type
|
|
1284
1284
|
});
|
|
1285
1285
|
}
|
|
1286
1286
|
if (isExpanded) {
|
|
@@ -1296,20 +1296,20 @@ const getDisplayItemsGroup = (group, expandedGroups, iconDefinitions) => {
|
|
|
1296
1296
|
const folderName = file.slice(0, -baseName.length - 1);
|
|
1297
1297
|
const actualDecorationIcon = getActualDecorationIcon(iconDefinitions, icon);
|
|
1298
1298
|
displayItems.push({
|
|
1299
|
-
|
|
1300
|
-
|
|
1299
|
+
badgeCount: 0,
|
|
1300
|
+
decorationIcon: actualDecorationIcon,
|
|
1301
|
+
decorationIconTitle: iconTitle,
|
|
1302
|
+
decorationStrikeThrough: strikeThrough,
|
|
1301
1303
|
detail: folderName,
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
+
file,
|
|
1305
|
+
groupId: id,
|
|
1304
1306
|
icon: getFileIcon({
|
|
1305
1307
|
name: file
|
|
1306
1308
|
}),
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
type: File
|
|
1311
|
-
badgeCount: 0,
|
|
1312
|
-
groupId: id
|
|
1309
|
+
label: baseName,
|
|
1310
|
+
posInSet: i + 1,
|
|
1311
|
+
setSize: length,
|
|
1312
|
+
type: File
|
|
1313
1313
|
});
|
|
1314
1314
|
}
|
|
1315
1315
|
}
|
|
@@ -1340,8 +1340,8 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1340
1340
|
for (const dirent of dirents) {
|
|
1341
1341
|
if (!(dirent.file in fileIconCache)) {
|
|
1342
1342
|
missingRequests.push({
|
|
1343
|
-
|
|
1344
|
-
|
|
1343
|
+
name: dirent.label,
|
|
1344
|
+
type: getIconType(dirent.type)
|
|
1345
1345
|
});
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
@@ -1703,17 +1703,17 @@ const sourceControlInput = () => {
|
|
|
1703
1703
|
|
|
1704
1704
|
const loadContent = async (state, savedState) => {
|
|
1705
1705
|
const {
|
|
1706
|
-
itemHeight,
|
|
1707
|
-
height,
|
|
1708
|
-
minimumSliderSize,
|
|
1709
|
-
workspacePath,
|
|
1710
1706
|
fileIconCache,
|
|
1711
|
-
|
|
1707
|
+
height,
|
|
1712
1708
|
inputFontFamily,
|
|
1713
1709
|
inputFontSize,
|
|
1714
1710
|
inputFontWeight,
|
|
1715
1711
|
inputLetterSpacing,
|
|
1716
|
-
inputLineHeight
|
|
1712
|
+
inputLineHeight,
|
|
1713
|
+
itemHeight,
|
|
1714
|
+
minimumSliderSize,
|
|
1715
|
+
width,
|
|
1716
|
+
workspacePath
|
|
1717
1717
|
} = state;
|
|
1718
1718
|
const root = workspacePath;
|
|
1719
1719
|
const scheme = getProtocol(root);
|
|
@@ -1732,6 +1732,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1732
1732
|
|
|
1733
1733
|
// TODO make preferences async and more functional
|
|
1734
1734
|
const splitButtonEnabled = await get$1('sourceControl.splitButtonEnabled');
|
|
1735
|
+
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
1735
1736
|
const total = displayItems.length;
|
|
1736
1737
|
const contentHeight = total * itemHeight;
|
|
1737
1738
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -1748,6 +1749,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1748
1749
|
...state,
|
|
1749
1750
|
actionsCache,
|
|
1750
1751
|
allGroups,
|
|
1752
|
+
badgeCount,
|
|
1751
1753
|
decorationIcons: iconDefinitions,
|
|
1752
1754
|
enabledProviderIds,
|
|
1753
1755
|
fileIconCache: newFileIconCache,
|
|
@@ -1778,8 +1780,8 @@ const warn = (...args) => {
|
|
|
1778
1780
|
|
|
1779
1781
|
const acceptInput = async state => {
|
|
1780
1782
|
const {
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
+
enabledProviderIds,
|
|
1784
|
+
inputValue
|
|
1783
1785
|
} = state;
|
|
1784
1786
|
if (enabledProviderIds.length === 0) {
|
|
1785
1787
|
info('[ViewletSourceControl] no source control provider found');
|
|
@@ -1796,10 +1798,10 @@ const acceptInput = async state => {
|
|
|
1796
1798
|
|
|
1797
1799
|
const {
|
|
1798
1800
|
get,
|
|
1799
|
-
set,
|
|
1800
|
-
wrapCommand,
|
|
1801
1801
|
getCommandIds,
|
|
1802
1802
|
registerCommands,
|
|
1803
|
+
set,
|
|
1804
|
+
wrapCommand,
|
|
1803
1805
|
wrapGetter
|
|
1804
1806
|
} = create();
|
|
1805
1807
|
|
|
@@ -1807,25 +1809,40 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1807
1809
|
const state = {
|
|
1808
1810
|
actionsCache: Object.create(null),
|
|
1809
1811
|
allGroups: [],
|
|
1812
|
+
badgeCount: 0,
|
|
1813
|
+
decorationIcons: [],
|
|
1810
1814
|
deltaY: 0,
|
|
1811
1815
|
enabledProviderIds: [],
|
|
1816
|
+
expandedGroups: Object.create(null),
|
|
1812
1817
|
fileIconCache: Object.create(null),
|
|
1813
1818
|
finalDeltaY: 0,
|
|
1819
|
+
focus: 0,
|
|
1814
1820
|
gitRoot: '',
|
|
1815
1821
|
handleOffset: 0,
|
|
1816
1822
|
headerHeight: 40,
|
|
1817
1823
|
// TODO
|
|
1818
1824
|
height,
|
|
1825
|
+
history: [],
|
|
1826
|
+
iconDefinitions: [],
|
|
1819
1827
|
id,
|
|
1820
1828
|
index: [],
|
|
1829
|
+
inputBoxHeight: 30,
|
|
1830
|
+
inputBoxMaxHeight: 214,
|
|
1831
|
+
inputFontFamily: 'system-ui, Ubuntu, "Droid Sans", sans-serif',
|
|
1832
|
+
inputFontSize: 13,
|
|
1833
|
+
inputFontWeight: 400,
|
|
1834
|
+
inputLetterSpacing: 0,
|
|
1835
|
+
inputLineHeight: 20,
|
|
1836
|
+
inputPlaceholder: '',
|
|
1837
|
+
inputSource: 0,
|
|
1821
1838
|
inputValue: '',
|
|
1822
|
-
|
|
1839
|
+
isVisible: true,
|
|
1823
1840
|
itemHeight: 20,
|
|
1824
1841
|
items: [],
|
|
1842
|
+
maxInputLines: 5,
|
|
1825
1843
|
maxLineY: 0,
|
|
1826
1844
|
merge: [],
|
|
1827
1845
|
minimumSliderSize: 20,
|
|
1828
|
-
inputBoxHeight: 30,
|
|
1829
1846
|
minLineY: 0,
|
|
1830
1847
|
providerId: '',
|
|
1831
1848
|
root: '',
|
|
@@ -1833,28 +1850,13 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1833
1850
|
scrollBarHeight: 0,
|
|
1834
1851
|
splitButtonEnabled: false,
|
|
1835
1852
|
untracked: [],
|
|
1853
|
+
viewMode: 1,
|
|
1836
1854
|
visibleItems: [],
|
|
1837
1855
|
width,
|
|
1838
1856
|
workingTree: [],
|
|
1839
1857
|
workspacePath,
|
|
1840
1858
|
x,
|
|
1841
|
-
y
|
|
1842
|
-
inputPlaceholder: '',
|
|
1843
|
-
inputSource: 0,
|
|
1844
|
-
maxInputLines: 5,
|
|
1845
|
-
inputFontFamily: 'system-ui, Ubuntu, "Droid Sans", sans-serif',
|
|
1846
|
-
inputFontSize: 13,
|
|
1847
|
-
inputFontWeight: 400,
|
|
1848
|
-
inputLetterSpacing: 0,
|
|
1849
|
-
inputLineHeight: 20,
|
|
1850
|
-
inputBoxMaxHeight: 214,
|
|
1851
|
-
history: [],
|
|
1852
|
-
viewMode: 1,
|
|
1853
|
-
iconDefinitions: [],
|
|
1854
|
-
decorationIcons: [],
|
|
1855
|
-
focus: 0,
|
|
1856
|
-
isVisible: true,
|
|
1857
|
-
badgeCount: 0
|
|
1859
|
+
y
|
|
1858
1860
|
};
|
|
1859
1861
|
set(id, state, state);
|
|
1860
1862
|
};
|
|
@@ -1896,15 +1898,17 @@ const diff = (oldState, newState) => {
|
|
|
1896
1898
|
|
|
1897
1899
|
const diff2 = uid => {
|
|
1898
1900
|
const {
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
+
newState,
|
|
1902
|
+
oldState
|
|
1901
1903
|
} = get(uid);
|
|
1902
1904
|
const result = diff(oldState, newState);
|
|
1903
1905
|
return result;
|
|
1904
1906
|
};
|
|
1905
1907
|
|
|
1906
|
-
const getBadgeCount =
|
|
1907
|
-
|
|
1908
|
+
const getBadgeCount = ({
|
|
1909
|
+
badgeCount
|
|
1910
|
+
}) => {
|
|
1911
|
+
return badgeCount;
|
|
1908
1912
|
};
|
|
1909
1913
|
|
|
1910
1914
|
const getInfo = uid => {
|
|
@@ -1928,53 +1932,53 @@ const text = data => {
|
|
|
1928
1932
|
|
|
1929
1933
|
const getKeyBindings = () => {
|
|
1930
1934
|
return [{
|
|
1931
|
-
key: CtrlCmd | Enter,
|
|
1932
1935
|
command: 'Source Control.acceptInput',
|
|
1936
|
+
key: CtrlCmd | Enter,
|
|
1933
1937
|
when: FocusSourceControlInput
|
|
1934
1938
|
}];
|
|
1935
1939
|
};
|
|
1936
1940
|
|
|
1937
1941
|
const getMenuEntries = () => {
|
|
1938
1942
|
return [{
|
|
1939
|
-
label: openChanges(),
|
|
1940
|
-
flags: None,
|
|
1941
1943
|
command: /* TODO */'-1',
|
|
1942
|
-
id: ''
|
|
1943
|
-
}, {
|
|
1944
|
-
label: openFile(),
|
|
1945
1944
|
flags: None,
|
|
1946
|
-
|
|
1947
|
-
|
|
1945
|
+
id: '',
|
|
1946
|
+
label: openChanges()
|
|
1948
1947
|
}, {
|
|
1949
|
-
label: openFileHead(),
|
|
1950
|
-
flags: None,
|
|
1951
1948
|
command: /* TODO */'-1',
|
|
1952
|
-
id: ''
|
|
1953
|
-
}, {
|
|
1954
|
-
label: discardChanges(),
|
|
1955
1949
|
flags: None,
|
|
1956
|
-
|
|
1957
|
-
|
|
1950
|
+
id: '',
|
|
1951
|
+
label: openFile()
|
|
1958
1952
|
}, {
|
|
1959
|
-
label: stageChanges(),
|
|
1960
|
-
flags: None,
|
|
1961
1953
|
command: /* TODO */'-1',
|
|
1962
|
-
id: ''
|
|
1963
|
-
}, {
|
|
1964
|
-
label: addToGitignore(),
|
|
1965
1954
|
flags: None,
|
|
1955
|
+
id: '',
|
|
1956
|
+
label: openFileHead()
|
|
1957
|
+
}, {
|
|
1966
1958
|
command: /* TODO */'-1',
|
|
1967
|
-
|
|
1959
|
+
flags: None,
|
|
1960
|
+
id: '',
|
|
1961
|
+
label: discardChanges()
|
|
1968
1962
|
}, {
|
|
1969
|
-
|
|
1963
|
+
command: /* TODO */'-1',
|
|
1970
1964
|
flags: None,
|
|
1965
|
+
id: '',
|
|
1966
|
+
label: stageChanges()
|
|
1967
|
+
}, {
|
|
1971
1968
|
command: /* TODO */'-1',
|
|
1972
|
-
|
|
1969
|
+
flags: None,
|
|
1970
|
+
id: '',
|
|
1971
|
+
label: addToGitignore()
|
|
1973
1972
|
}, {
|
|
1974
|
-
|
|
1973
|
+
command: /* TODO */'-1',
|
|
1975
1974
|
flags: None,
|
|
1975
|
+
id: '',
|
|
1976
|
+
label: revealInExplorerView()
|
|
1977
|
+
}, {
|
|
1976
1978
|
command: /* TODO */'-1',
|
|
1977
|
-
|
|
1979
|
+
flags: None,
|
|
1980
|
+
id: '',
|
|
1981
|
+
label: openContainingFolder()
|
|
1978
1982
|
}];
|
|
1979
1983
|
};
|
|
1980
1984
|
|
|
@@ -1993,14 +1997,14 @@ const Refresh$1 = 'Refresh';
|
|
|
1993
1997
|
|
|
1994
1998
|
const refresh = async state => {
|
|
1995
1999
|
const {
|
|
1996
|
-
|
|
2000
|
+
actionsCache,
|
|
2001
|
+
enabledProviderIds,
|
|
2002
|
+
fileIconCache,
|
|
1997
2003
|
height,
|
|
2004
|
+
iconDefinitions,
|
|
2005
|
+
itemHeight,
|
|
1998
2006
|
minimumSliderSize,
|
|
1999
|
-
|
|
2000
|
-
enabledProviderIds,
|
|
2001
|
-
splitButtonEnabled,
|
|
2002
|
-
actionsCache,
|
|
2003
|
-
iconDefinitions
|
|
2007
|
+
splitButtonEnabled
|
|
2004
2008
|
} = state;
|
|
2005
2009
|
const {
|
|
2006
2010
|
allGroups,
|
|
@@ -2008,6 +2012,7 @@ const refresh = async state => {
|
|
|
2008
2012
|
} = await getGroups(enabledProviderIds);
|
|
2009
2013
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2010
2014
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2015
|
+
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
2011
2016
|
const total = displayItems.length;
|
|
2012
2017
|
const contentHeight = total * itemHeight;
|
|
2013
2018
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -2022,6 +2027,7 @@ const refresh = async state => {
|
|
|
2022
2027
|
...state,
|
|
2023
2028
|
actionsCache,
|
|
2024
2029
|
allGroups,
|
|
2030
|
+
badgeCount,
|
|
2025
2031
|
enabledProviderIds,
|
|
2026
2032
|
fileIconCache: newFileIconCache,
|
|
2027
2033
|
finalDeltaY,
|
|
@@ -2043,13 +2049,13 @@ const viewAsTree = state => {
|
|
|
2043
2049
|
|
|
2044
2050
|
const handleActionClick = async (state, actionName) => {
|
|
2045
2051
|
switch (actionName) {
|
|
2052
|
+
case CommitAndPush:
|
|
2053
|
+
warn(`[source-control-worker] CommitAndPush action not yet implemented`);
|
|
2054
|
+
return state;
|
|
2046
2055
|
case Refresh$1:
|
|
2047
2056
|
return refresh(state);
|
|
2048
2057
|
case ViewAsTree:
|
|
2049
2058
|
return viewAsTree(state);
|
|
2050
|
-
case CommitAndPush:
|
|
2051
|
-
warn(`[source-control-worker] CommitAndPush action not yet implemented`);
|
|
2052
|
-
return state;
|
|
2053
2059
|
default:
|
|
2054
2060
|
warn(`[source-control-worker] Unknown action name: ${actionName}`);
|
|
2055
2061
|
return state;
|
|
@@ -2081,8 +2087,8 @@ const handleButtonClick = async (state, clickedIndex) => {
|
|
|
2081
2087
|
const getIndex = (state, eventX, eventY) => {
|
|
2082
2088
|
const {
|
|
2083
2089
|
headerHeight,
|
|
2084
|
-
|
|
2085
|
-
|
|
2090
|
+
itemHeight,
|
|
2091
|
+
y
|
|
2086
2092
|
} = state;
|
|
2087
2093
|
const relativeY = eventY - y - headerHeight;
|
|
2088
2094
|
const index = Math.floor(relativeY / itemHeight);
|
|
@@ -2115,14 +2121,15 @@ const handleClickSourceControlButtons = async (state, index, name) => {
|
|
|
2115
2121
|
|
|
2116
2122
|
const updateVisibleItems = async (state, expandedGroups) => {
|
|
2117
2123
|
const {
|
|
2118
|
-
itemHeight,
|
|
2119
|
-
height,
|
|
2120
2124
|
actionsCache,
|
|
2121
|
-
fileIconCache,
|
|
2122
2125
|
allGroups,
|
|
2123
|
-
|
|
2126
|
+
fileIconCache,
|
|
2127
|
+
height,
|
|
2128
|
+
iconDefinitions,
|
|
2129
|
+
itemHeight
|
|
2124
2130
|
} = state;
|
|
2125
2131
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2132
|
+
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
2126
2133
|
const total = displayItems.length;
|
|
2127
2134
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
2128
2135
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
@@ -2131,11 +2138,12 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2131
2138
|
const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, fileIconCache);
|
|
2132
2139
|
return {
|
|
2133
2140
|
...state,
|
|
2134
|
-
|
|
2135
|
-
visibleItems,
|
|
2141
|
+
badgeCount,
|
|
2136
2142
|
expandedGroups,
|
|
2143
|
+
items: displayItems,
|
|
2144
|
+
maxLineY,
|
|
2137
2145
|
minLineY,
|
|
2138
|
-
|
|
2146
|
+
visibleItems
|
|
2139
2147
|
};
|
|
2140
2148
|
};
|
|
2141
2149
|
|
|
@@ -2246,19 +2254,19 @@ const handleInputFocus = async state => {
|
|
|
2246
2254
|
|
|
2247
2255
|
const handleInput = async (state, value, inputSource = User) => {
|
|
2248
2256
|
const {
|
|
2249
|
-
width,
|
|
2250
2257
|
inputFontFamily,
|
|
2251
2258
|
inputFontSize,
|
|
2252
2259
|
inputFontWeight,
|
|
2253
2260
|
inputLetterSpacing,
|
|
2254
|
-
inputLineHeight
|
|
2261
|
+
inputLineHeight,
|
|
2262
|
+
width
|
|
2255
2263
|
} = state;
|
|
2256
2264
|
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight);
|
|
2257
2265
|
return {
|
|
2258
2266
|
...state,
|
|
2259
|
-
|
|
2267
|
+
inputBoxHeight,
|
|
2260
2268
|
inputSource,
|
|
2261
|
-
|
|
2269
|
+
inputValue: value
|
|
2262
2270
|
};
|
|
2263
2271
|
};
|
|
2264
2272
|
|
|
@@ -2311,12 +2319,12 @@ const handleMouseOverAt = async (state, eventX, eventY) => {
|
|
|
2311
2319
|
|
|
2312
2320
|
const setDeltaY = async (state, newDeltaY) => {
|
|
2313
2321
|
const {
|
|
2314
|
-
itemHeight,
|
|
2315
|
-
items,
|
|
2316
|
-
height,
|
|
2317
|
-
headerHeight,
|
|
2318
2322
|
actionsCache,
|
|
2319
|
-
fileIconCache
|
|
2323
|
+
fileIconCache,
|
|
2324
|
+
headerHeight,
|
|
2325
|
+
height,
|
|
2326
|
+
itemHeight,
|
|
2327
|
+
items
|
|
2320
2328
|
} = state;
|
|
2321
2329
|
const normalizedDeltaY = Math.max(newDeltaY, 0);
|
|
2322
2330
|
const newMinLineY = Math.floor(normalizedDeltaY / itemHeight);
|
|
@@ -2328,9 +2336,9 @@ const setDeltaY = async (state, newDeltaY) => {
|
|
|
2328
2336
|
return {
|
|
2329
2337
|
...state,
|
|
2330
2338
|
deltaY: newDeltaY,
|
|
2331
|
-
|
|
2339
|
+
maxLineY,
|
|
2332
2340
|
minLineY: newMinLineY,
|
|
2333
|
-
|
|
2341
|
+
visibleItems: visible
|
|
2334
2342
|
};
|
|
2335
2343
|
};
|
|
2336
2344
|
|
|
@@ -2417,8 +2425,8 @@ ${indentRules}
|
|
|
2417
2425
|
|
|
2418
2426
|
const renderFocusContext = (oldState, newState) => {
|
|
2419
2427
|
const {
|
|
2420
|
-
|
|
2421
|
-
|
|
2428
|
+
focus,
|
|
2429
|
+
id
|
|
2422
2430
|
} = newState;
|
|
2423
2431
|
return [SetFocusContext, id, focus];
|
|
2424
2432
|
};
|
|
@@ -2463,33 +2471,33 @@ const HandleClickAction = 10;
|
|
|
2463
2471
|
|
|
2464
2472
|
const getSourceControlInputDom = inputPlaceholder => {
|
|
2465
2473
|
return [{
|
|
2466
|
-
type: TextArea,
|
|
2467
|
-
className: mergeClassNames(InputBox, 'MultilineInputBox'),
|
|
2468
2474
|
ariaLabel: sourceControlInput(),
|
|
2469
2475
|
autocapitalize: 'off',
|
|
2470
2476
|
autocorrect: 'off',
|
|
2471
2477
|
childCount: 0,
|
|
2478
|
+
className: mergeClassNames(InputBox, 'MultilineInputBox'),
|
|
2472
2479
|
name: SourceControlInput,
|
|
2473
2480
|
onFocus: HandleFocus,
|
|
2474
2481
|
onInput: HandleInput,
|
|
2475
2482
|
placeholder: inputPlaceholder,
|
|
2476
|
-
spellcheck: false
|
|
2483
|
+
spellcheck: false,
|
|
2484
|
+
type: TextArea
|
|
2477
2485
|
}];
|
|
2478
2486
|
};
|
|
2479
2487
|
|
|
2480
2488
|
const getSourceControlHeaderVirtualDom = inputPlaceholder => {
|
|
2481
2489
|
return [{
|
|
2482
|
-
|
|
2490
|
+
childCount: 1,
|
|
2483
2491
|
className: SourceControlHeader,
|
|
2484
|
-
|
|
2492
|
+
type: Div
|
|
2485
2493
|
}, ...getSourceControlInputDom(inputPlaceholder)];
|
|
2486
2494
|
};
|
|
2487
2495
|
|
|
2488
2496
|
const className$1 = mergeClassNames(Badge, SourceControlBadge);
|
|
2489
2497
|
const parentNode = {
|
|
2490
|
-
|
|
2498
|
+
childCount: 1,
|
|
2491
2499
|
className: className$1,
|
|
2492
|
-
|
|
2500
|
+
type: Div
|
|
2493
2501
|
};
|
|
2494
2502
|
const getBadgeVirtualDom = count => {
|
|
2495
2503
|
return [parentNode, text(`${count}`)];
|
|
@@ -2497,10 +2505,10 @@ const getBadgeVirtualDom = count => {
|
|
|
2497
2505
|
|
|
2498
2506
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
2499
2507
|
return {
|
|
2500
|
-
|
|
2508
|
+
childCount: 0,
|
|
2501
2509
|
className: `MaskIcon MaskIcon${icon}`,
|
|
2502
2510
|
role: None$1,
|
|
2503
|
-
|
|
2511
|
+
type
|
|
2504
2512
|
};
|
|
2505
2513
|
};
|
|
2506
2514
|
|
|
@@ -2510,12 +2518,12 @@ const getButtonVirtualDom = button => {
|
|
|
2510
2518
|
label
|
|
2511
2519
|
} = button;
|
|
2512
2520
|
return [{
|
|
2513
|
-
type: Button$2,
|
|
2514
|
-
className: SourceControlButton,
|
|
2515
|
-
title: label,
|
|
2516
2521
|
ariaLabel: label,
|
|
2517
2522
|
childCount: 1,
|
|
2518
|
-
|
|
2523
|
+
className: SourceControlButton,
|
|
2524
|
+
name: label,
|
|
2525
|
+
title: label,
|
|
2526
|
+
type: Button$2
|
|
2519
2527
|
}, getIconVirtualDom(icon, Span)];
|
|
2520
2528
|
};
|
|
2521
2529
|
|
|
@@ -2524,9 +2532,9 @@ const getButtonsVirtualDom = buttons => {
|
|
|
2524
2532
|
return [];
|
|
2525
2533
|
}
|
|
2526
2534
|
return [{
|
|
2527
|
-
|
|
2535
|
+
childCount: buttons.length,
|
|
2528
2536
|
className: SourceControlButtons,
|
|
2529
|
-
|
|
2537
|
+
type: Div
|
|
2530
2538
|
}, ...buttons.flatMap(getButtonVirtualDom)];
|
|
2531
2539
|
};
|
|
2532
2540
|
|
|
@@ -2549,54 +2557,54 @@ const PaddingRight = '12px';
|
|
|
2549
2557
|
|
|
2550
2558
|
const createItemDirectory = item => {
|
|
2551
2559
|
const {
|
|
2552
|
-
posInSet,
|
|
2553
|
-
setSize,
|
|
2554
|
-
icon,
|
|
2555
|
-
label,
|
|
2556
2560
|
badgeCount,
|
|
2557
|
-
decorationStrikeThrough,
|
|
2558
|
-
type,
|
|
2559
2561
|
buttons,
|
|
2560
|
-
|
|
2562
|
+
decorationStrikeThrough,
|
|
2563
|
+
icon,
|
|
2564
|
+
indent,
|
|
2565
|
+
label,
|
|
2566
|
+
posInSet,
|
|
2567
|
+
setSize,
|
|
2568
|
+
type
|
|
2561
2569
|
} = item;
|
|
2562
2570
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
2563
2571
|
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
2564
2572
|
const hasButtons = buttons.length;
|
|
2565
2573
|
const treeItemClassName = getTreeItemClassName(indent);
|
|
2566
2574
|
return [{
|
|
2567
|
-
type: Div,
|
|
2568
|
-
className: treeItemClassName,
|
|
2569
|
-
role: TreeItem$1,
|
|
2570
2575
|
ariaExpanded: type === DirectoryExpanded,
|
|
2571
2576
|
ariaPosInSet: posInSet,
|
|
2572
2577
|
ariaSetSize: setSize,
|
|
2573
2578
|
childCount: 3 + (hasButtons ? 1 : 0),
|
|
2574
|
-
|
|
2579
|
+
className: treeItemClassName,
|
|
2580
|
+
paddingRight: PaddingRight,
|
|
2581
|
+
role: TreeItem$1,
|
|
2582
|
+
type: Div
|
|
2575
2583
|
}, {
|
|
2576
|
-
|
|
2584
|
+
childCount: 0,
|
|
2577
2585
|
className: mergeClassNames(Chevron, `MaskIcon${icon}`),
|
|
2578
|
-
|
|
2586
|
+
type: Div
|
|
2579
2587
|
}, {
|
|
2580
|
-
|
|
2588
|
+
childCount: 1,
|
|
2581
2589
|
className: labelClassName,
|
|
2582
|
-
|
|
2590
|
+
type: Div
|
|
2583
2591
|
}, text(label), ...buttonsDom, ...getBadgeVirtualDom(badgeCount)];
|
|
2584
2592
|
};
|
|
2585
2593
|
|
|
2586
2594
|
const getFileIconVirtualDom = icon => {
|
|
2587
2595
|
return {
|
|
2588
|
-
|
|
2596
|
+
childCount: 0,
|
|
2589
2597
|
className: FileIcon,
|
|
2590
|
-
src: icon,
|
|
2591
2598
|
role: None$1,
|
|
2592
|
-
|
|
2599
|
+
src: icon,
|
|
2600
|
+
type: Img
|
|
2593
2601
|
};
|
|
2594
2602
|
};
|
|
2595
2603
|
|
|
2596
2604
|
const chevron = {
|
|
2597
|
-
|
|
2605
|
+
childCount: 1,
|
|
2598
2606
|
className: Chevron,
|
|
2599
|
-
|
|
2607
|
+
type: Div
|
|
2600
2608
|
};
|
|
2601
2609
|
const getIconsDom = (icon, fileIcon) => {
|
|
2602
2610
|
if (icon === ChevronRight) {
|
|
@@ -2606,18 +2614,18 @@ const getIconsDom = (icon, fileIcon) => {
|
|
|
2606
2614
|
};
|
|
2607
2615
|
const createItemOther = item => {
|
|
2608
2616
|
const {
|
|
2609
|
-
|
|
2610
|
-
setSize,
|
|
2611
|
-
icon,
|
|
2612
|
-
file,
|
|
2613
|
-
label,
|
|
2617
|
+
buttons,
|
|
2614
2618
|
decorationIcon,
|
|
2615
2619
|
decorationIconTitle,
|
|
2616
2620
|
decorationStrikeThrough,
|
|
2617
2621
|
detail,
|
|
2618
|
-
|
|
2622
|
+
file,
|
|
2619
2623
|
fileIcon,
|
|
2620
|
-
|
|
2624
|
+
icon,
|
|
2625
|
+
indent,
|
|
2626
|
+
label,
|
|
2627
|
+
posInSet,
|
|
2628
|
+
setSize
|
|
2621
2629
|
} = item;
|
|
2622
2630
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
2623
2631
|
const dom = [];
|
|
@@ -2625,44 +2633,44 @@ const createItemOther = item => {
|
|
|
2625
2633
|
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
2626
2634
|
const treeItemClassName = getTreeItemClassName(indent);
|
|
2627
2635
|
dom.push({
|
|
2628
|
-
type: Div,
|
|
2629
|
-
className: treeItemClassName,
|
|
2630
|
-
role: TreeItem$1,
|
|
2631
2636
|
ariaPosInSet: posInSet,
|
|
2632
2637
|
ariaSetSize: setSize,
|
|
2633
|
-
title: file,
|
|
2634
2638
|
childCount: 3 + (hasButtons ? 1 : 0),
|
|
2635
|
-
|
|
2639
|
+
className: treeItemClassName,
|
|
2640
|
+
paddingRight: '12px',
|
|
2641
|
+
role: TreeItem$1,
|
|
2642
|
+
title: file,
|
|
2643
|
+
type: Div
|
|
2636
2644
|
}, ...getIconsDom(icon, fileIcon));
|
|
2637
2645
|
const labelDom = {
|
|
2638
|
-
|
|
2646
|
+
childCount: 1,
|
|
2639
2647
|
className: labelClassName,
|
|
2640
|
-
|
|
2648
|
+
type: Div
|
|
2641
2649
|
};
|
|
2642
2650
|
dom.push(labelDom, text(label));
|
|
2643
2651
|
if (detail) {
|
|
2644
2652
|
labelDom.childCount++;
|
|
2645
2653
|
dom.push({
|
|
2646
|
-
|
|
2654
|
+
childCount: 1,
|
|
2647
2655
|
className: LabelDetail,
|
|
2648
|
-
|
|
2656
|
+
type: Span
|
|
2649
2657
|
}, text(detail));
|
|
2650
2658
|
}
|
|
2651
2659
|
dom.push(...buttonsDom);
|
|
2652
2660
|
dom.push({
|
|
2653
|
-
|
|
2661
|
+
childCount: 0,
|
|
2654
2662
|
className: DecorationIcon,
|
|
2655
|
-
title: decorationIconTitle,
|
|
2656
2663
|
src: decorationIcon,
|
|
2657
|
-
|
|
2664
|
+
title: decorationIconTitle,
|
|
2665
|
+
type: Img
|
|
2658
2666
|
});
|
|
2659
2667
|
return dom;
|
|
2660
2668
|
};
|
|
2661
2669
|
|
|
2662
2670
|
const getSourceControlItemVirtualDom = item => {
|
|
2663
2671
|
switch (item.type) {
|
|
2664
|
-
case DirectoryExpanded:
|
|
2665
2672
|
case Directory:
|
|
2673
|
+
case DirectoryExpanded:
|
|
2666
2674
|
return createItemDirectory(item);
|
|
2667
2675
|
default:
|
|
2668
2676
|
return createItemOther(item);
|
|
@@ -2671,13 +2679,13 @@ const getSourceControlItemVirtualDom = item => {
|
|
|
2671
2679
|
|
|
2672
2680
|
const getSourceControlListVirtualDom = items => {
|
|
2673
2681
|
return [{
|
|
2674
|
-
type: Div,
|
|
2675
|
-
className: SourceControlItems,
|
|
2676
|
-
role: Tree$1,
|
|
2677
2682
|
childCount: items.length,
|
|
2683
|
+
className: SourceControlItems,
|
|
2678
2684
|
onClick: HandleClickAt,
|
|
2685
|
+
onPointerOut: HandleMouseOutAt,
|
|
2679
2686
|
onPointerOver: HandleMouseOverAt,
|
|
2680
|
-
|
|
2687
|
+
role: Tree$1,
|
|
2688
|
+
type: Div
|
|
2681
2689
|
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
2682
2690
|
};
|
|
2683
2691
|
|
|
@@ -2686,27 +2694,27 @@ const getSplitButtonVirtualDom = (hasItems, splitButtonEnabled, buttonText) => {
|
|
|
2686
2694
|
return [];
|
|
2687
2695
|
}
|
|
2688
2696
|
return [{
|
|
2689
|
-
|
|
2697
|
+
childCount: 3,
|
|
2690
2698
|
className: mergeClassNames(SplitButton, hasItems ? '' : SplitButtonDisabled),
|
|
2691
|
-
|
|
2699
|
+
type: Div
|
|
2692
2700
|
}, {
|
|
2693
|
-
type: Div,
|
|
2694
|
-
className: mergeClassNames(SplitButtonContent, hasItems ? '' : SplitButtonContentDisabled),
|
|
2695
2701
|
childCount: 1,
|
|
2696
|
-
|
|
2702
|
+
className: mergeClassNames(SplitButtonContent, hasItems ? '' : SplitButtonContentDisabled),
|
|
2703
|
+
tabIndex: 0,
|
|
2704
|
+
type: Div
|
|
2697
2705
|
}, text(buttonText), {
|
|
2698
|
-
|
|
2706
|
+
childCount: 0,
|
|
2699
2707
|
className: SplitButtonSeparator,
|
|
2700
|
-
|
|
2708
|
+
type: Div
|
|
2701
2709
|
}, {
|
|
2702
|
-
type: Div,
|
|
2703
|
-
className: mergeClassNames(SplitButtonDropDown, hasItems ? '' : SplitButtonDropDownDisabled),
|
|
2704
2710
|
childCount: 1,
|
|
2705
|
-
|
|
2711
|
+
className: mergeClassNames(SplitButtonDropDown, hasItems ? '' : SplitButtonDropDownDisabled),
|
|
2712
|
+
tabIndex: 0,
|
|
2713
|
+
type: Div
|
|
2706
2714
|
}, {
|
|
2707
|
-
|
|
2715
|
+
childCount: 0,
|
|
2708
2716
|
className: mergeClassNames(MaskIcon, MaskIconChevronDown),
|
|
2709
|
-
|
|
2717
|
+
type: Div
|
|
2710
2718
|
}];
|
|
2711
2719
|
};
|
|
2712
2720
|
|
|
@@ -2714,24 +2722,24 @@ const className = mergeClassNames(Viewlet, SourceControl);
|
|
|
2714
2722
|
const getSourceControlVirtualDom = (items, splitButtonEnabled, inputPlaceholder) => {
|
|
2715
2723
|
const hasItems = items.length > 0;
|
|
2716
2724
|
const dom = [{
|
|
2717
|
-
|
|
2725
|
+
childCount: splitButtonEnabled ? 3 : 2,
|
|
2718
2726
|
className: className,
|
|
2719
|
-
tabIndex: 0,
|
|
2720
2727
|
onContextMenu: HandleContextMenu,
|
|
2721
2728
|
onMouseOver: HandleMouseOver,
|
|
2722
2729
|
// onMouseOut: DomEventListenerFunctions.HandleMouseOut,
|
|
2723
2730
|
onWheel: HandleWheel,
|
|
2724
|
-
|
|
2731
|
+
tabIndex: 0,
|
|
2732
|
+
type: Div
|
|
2725
2733
|
}, ...getSourceControlHeaderVirtualDom(inputPlaceholder), ...getSplitButtonVirtualDom(hasItems, splitButtonEnabled, 'Commit'), ...getSourceControlListVirtualDom(items)];
|
|
2726
2734
|
return dom;
|
|
2727
2735
|
};
|
|
2728
2736
|
|
|
2729
2737
|
const renderItems = (oldState, newState) => {
|
|
2730
2738
|
const {
|
|
2731
|
-
|
|
2732
|
-
splitButtonEnabled,
|
|
2739
|
+
id,
|
|
2733
2740
|
inputPlaceholder,
|
|
2734
|
-
|
|
2741
|
+
splitButtonEnabled,
|
|
2742
|
+
visibleItems
|
|
2735
2743
|
} = newState;
|
|
2736
2744
|
const dom = getSourceControlVirtualDom(visibleItems, splitButtonEnabled, inputPlaceholder);
|
|
2737
2745
|
return [SetDom2, id, dom];
|
|
@@ -2747,14 +2755,14 @@ const renderValue = (oldState, newState) => {
|
|
|
2747
2755
|
|
|
2748
2756
|
const getRenderer = diffType => {
|
|
2749
2757
|
switch (diffType) {
|
|
2750
|
-
case RenderItems:
|
|
2751
|
-
return renderItems;
|
|
2752
|
-
case RenderValue:
|
|
2753
|
-
return renderValue;
|
|
2754
2758
|
case RenderCss:
|
|
2755
2759
|
return renderCss;
|
|
2756
2760
|
case RenderFocusContext:
|
|
2757
2761
|
return renderFocusContext;
|
|
2762
|
+
case RenderItems:
|
|
2763
|
+
return renderItems;
|
|
2764
|
+
case RenderValue:
|
|
2765
|
+
return renderValue;
|
|
2758
2766
|
default:
|
|
2759
2767
|
throw new Error('unknown renderer');
|
|
2760
2768
|
}
|
|
@@ -2774,8 +2782,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
2774
2782
|
|
|
2775
2783
|
const render2 = (uid, diffResult) => {
|
|
2776
2784
|
const {
|
|
2777
|
-
|
|
2778
|
-
|
|
2785
|
+
newState,
|
|
2786
|
+
oldState
|
|
2779
2787
|
} = get(uid);
|
|
2780
2788
|
set(uid, newState, newState);
|
|
2781
2789
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2790,38 +2798,38 @@ const Refresh = 'Refresh';
|
|
|
2790
2798
|
|
|
2791
2799
|
const getActions = () => {
|
|
2792
2800
|
return [{
|
|
2793
|
-
|
|
2801
|
+
command: '',
|
|
2802
|
+
icon: ListFlat,
|
|
2794
2803
|
id: viewAsTree$1(),
|
|
2795
2804
|
name: ViewAsTree,
|
|
2796
|
-
|
|
2797
|
-
command: ''
|
|
2805
|
+
type: Button
|
|
2798
2806
|
}, {
|
|
2799
|
-
|
|
2807
|
+
command: '',
|
|
2808
|
+
icon: Check,
|
|
2800
2809
|
id: commitAndPush(),
|
|
2801
2810
|
name: CommitAndPush,
|
|
2802
|
-
|
|
2803
|
-
command: ''
|
|
2811
|
+
type: Button
|
|
2804
2812
|
}, {
|
|
2805
|
-
|
|
2813
|
+
command: '',
|
|
2814
|
+
icon: Refresh,
|
|
2806
2815
|
id: refresh$1(),
|
|
2807
2816
|
name: Refresh$1,
|
|
2808
|
-
|
|
2809
|
-
command: ''
|
|
2817
|
+
type: Button
|
|
2810
2818
|
}];
|
|
2811
2819
|
};
|
|
2812
2820
|
|
|
2813
2821
|
const getActionButtonVirtualDom = action => {
|
|
2814
2822
|
const {
|
|
2815
|
-
id,
|
|
2816
2823
|
icon,
|
|
2824
|
+
id,
|
|
2817
2825
|
label
|
|
2818
2826
|
} = action;
|
|
2819
2827
|
return [{
|
|
2820
|
-
|
|
2828
|
+
childCount: 1,
|
|
2821
2829
|
className: IconButton,
|
|
2822
|
-
title: id,
|
|
2823
2830
|
name: label,
|
|
2824
|
-
|
|
2831
|
+
title: id,
|
|
2832
|
+
type: Button$2
|
|
2825
2833
|
}, getIconVirtualDom(icon)];
|
|
2826
2834
|
};
|
|
2827
2835
|
|
|
@@ -2830,8 +2838,8 @@ const getActionVirtualDom = action => {
|
|
|
2830
2838
|
case Button:
|
|
2831
2839
|
{
|
|
2832
2840
|
const actionButton = {
|
|
2833
|
-
id: action.id,
|
|
2834
2841
|
icon: action.icon,
|
|
2842
|
+
id: action.id,
|
|
2835
2843
|
label: action.name
|
|
2836
2844
|
};
|
|
2837
2845
|
return getActionButtonVirtualDom(actionButton);
|
|
@@ -2843,11 +2851,11 @@ const getActionVirtualDom = action => {
|
|
|
2843
2851
|
|
|
2844
2852
|
const getActionsVirtualDom = actions => {
|
|
2845
2853
|
return [{
|
|
2846
|
-
|
|
2854
|
+
childCount: actions.length,
|
|
2847
2855
|
className: Actions,
|
|
2856
|
+
onClick: HandleClickAction,
|
|
2848
2857
|
role: ToolBar,
|
|
2849
|
-
|
|
2850
|
-
onClick: HandleClickAction
|
|
2858
|
+
type: Div
|
|
2851
2859
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
2852
2860
|
};
|
|
2853
2861
|
|
|
@@ -2901,26 +2909,26 @@ const saveState = uid => {
|
|
|
2901
2909
|
newState
|
|
2902
2910
|
} = value;
|
|
2903
2911
|
const {
|
|
2904
|
-
root,
|
|
2905
|
-
maxLineY,
|
|
2906
2912
|
expandedGroups,
|
|
2907
|
-
inputValue
|
|
2913
|
+
inputValue,
|
|
2914
|
+
maxLineY,
|
|
2915
|
+
root
|
|
2908
2916
|
} = newState;
|
|
2909
2917
|
return {
|
|
2910
|
-
root,
|
|
2911
|
-
minLineY: 0,
|
|
2912
|
-
maxLineY,
|
|
2913
2918
|
deltaY: 0,
|
|
2914
2919
|
expandedGroups,
|
|
2915
|
-
inputValue
|
|
2920
|
+
inputValue,
|
|
2921
|
+
maxLineY,
|
|
2922
|
+
minLineY: 0,
|
|
2923
|
+
root
|
|
2916
2924
|
};
|
|
2917
2925
|
};
|
|
2918
2926
|
|
|
2919
2927
|
const updateIcons = async state => {
|
|
2920
2928
|
const {
|
|
2921
2929
|
items,
|
|
2922
|
-
|
|
2923
|
-
|
|
2930
|
+
maxLineY,
|
|
2931
|
+
minLineY
|
|
2924
2932
|
} = state;
|
|
2925
2933
|
const visible = items.slice(minLineY, maxLineY);
|
|
2926
2934
|
const newFileIconCache = await getFileIcons(visible, Object.create(null));
|