@lvce-editor/source-control-worker 2.16.0 → 2.18.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 +226 -219
- 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);
|
|
@@ -1778,8 +1778,8 @@ const warn = (...args) => {
|
|
|
1778
1778
|
|
|
1779
1779
|
const acceptInput = async state => {
|
|
1780
1780
|
const {
|
|
1781
|
-
|
|
1782
|
-
|
|
1781
|
+
enabledProviderIds,
|
|
1782
|
+
inputValue
|
|
1783
1783
|
} = state;
|
|
1784
1784
|
if (enabledProviderIds.length === 0) {
|
|
1785
1785
|
info('[ViewletSourceControl] no source control provider found');
|
|
@@ -1796,10 +1796,10 @@ const acceptInput = async state => {
|
|
|
1796
1796
|
|
|
1797
1797
|
const {
|
|
1798
1798
|
get,
|
|
1799
|
-
set,
|
|
1800
|
-
wrapCommand,
|
|
1801
1799
|
getCommandIds,
|
|
1802
1800
|
registerCommands,
|
|
1801
|
+
set,
|
|
1802
|
+
wrapCommand,
|
|
1803
1803
|
wrapGetter
|
|
1804
1804
|
} = create();
|
|
1805
1805
|
|
|
@@ -1807,25 +1807,40 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1807
1807
|
const state = {
|
|
1808
1808
|
actionsCache: Object.create(null),
|
|
1809
1809
|
allGroups: [],
|
|
1810
|
+
badgeCount: 0,
|
|
1811
|
+
decorationIcons: [],
|
|
1810
1812
|
deltaY: 0,
|
|
1811
1813
|
enabledProviderIds: [],
|
|
1814
|
+
expandedGroups: Object.create(null),
|
|
1812
1815
|
fileIconCache: Object.create(null),
|
|
1813
1816
|
finalDeltaY: 0,
|
|
1817
|
+
focus: 0,
|
|
1814
1818
|
gitRoot: '',
|
|
1815
1819
|
handleOffset: 0,
|
|
1816
1820
|
headerHeight: 40,
|
|
1817
1821
|
// TODO
|
|
1818
1822
|
height,
|
|
1823
|
+
history: [],
|
|
1824
|
+
iconDefinitions: [],
|
|
1819
1825
|
id,
|
|
1820
1826
|
index: [],
|
|
1827
|
+
inputBoxHeight: 30,
|
|
1828
|
+
inputBoxMaxHeight: 214,
|
|
1829
|
+
inputFontFamily: 'system-ui, Ubuntu, "Droid Sans", sans-serif',
|
|
1830
|
+
inputFontSize: 13,
|
|
1831
|
+
inputFontWeight: 400,
|
|
1832
|
+
inputLetterSpacing: 0,
|
|
1833
|
+
inputLineHeight: 20,
|
|
1834
|
+
inputPlaceholder: '',
|
|
1835
|
+
inputSource: 0,
|
|
1821
1836
|
inputValue: '',
|
|
1822
|
-
|
|
1837
|
+
isVisible: true,
|
|
1823
1838
|
itemHeight: 20,
|
|
1824
1839
|
items: [],
|
|
1840
|
+
maxInputLines: 5,
|
|
1825
1841
|
maxLineY: 0,
|
|
1826
1842
|
merge: [],
|
|
1827
1843
|
minimumSliderSize: 20,
|
|
1828
|
-
inputBoxHeight: 30,
|
|
1829
1844
|
minLineY: 0,
|
|
1830
1845
|
providerId: '',
|
|
1831
1846
|
root: '',
|
|
@@ -1833,28 +1848,13 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1833
1848
|
scrollBarHeight: 0,
|
|
1834
1849
|
splitButtonEnabled: false,
|
|
1835
1850
|
untracked: [],
|
|
1851
|
+
viewMode: 1,
|
|
1836
1852
|
visibleItems: [],
|
|
1837
1853
|
width,
|
|
1838
1854
|
workingTree: [],
|
|
1839
1855
|
workspacePath,
|
|
1840
1856
|
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
|
|
1857
|
+
y
|
|
1858
1858
|
};
|
|
1859
1859
|
set(id, state, state);
|
|
1860
1860
|
};
|
|
@@ -1896,15 +1896,17 @@ const diff = (oldState, newState) => {
|
|
|
1896
1896
|
|
|
1897
1897
|
const diff2 = uid => {
|
|
1898
1898
|
const {
|
|
1899
|
-
|
|
1900
|
-
|
|
1899
|
+
newState,
|
|
1900
|
+
oldState
|
|
1901
1901
|
} = get(uid);
|
|
1902
1902
|
const result = diff(oldState, newState);
|
|
1903
1903
|
return result;
|
|
1904
1904
|
};
|
|
1905
1905
|
|
|
1906
|
-
const getBadgeCount =
|
|
1907
|
-
|
|
1906
|
+
const getBadgeCount = ({
|
|
1907
|
+
badgeCount
|
|
1908
|
+
}) => {
|
|
1909
|
+
return badgeCount;
|
|
1908
1910
|
};
|
|
1909
1911
|
|
|
1910
1912
|
const getInfo = uid => {
|
|
@@ -1928,53 +1930,53 @@ const text = data => {
|
|
|
1928
1930
|
|
|
1929
1931
|
const getKeyBindings = () => {
|
|
1930
1932
|
return [{
|
|
1931
|
-
key: CtrlCmd | Enter,
|
|
1932
1933
|
command: 'Source Control.acceptInput',
|
|
1934
|
+
key: CtrlCmd | Enter,
|
|
1933
1935
|
when: FocusSourceControlInput
|
|
1934
1936
|
}];
|
|
1935
1937
|
};
|
|
1936
1938
|
|
|
1937
1939
|
const getMenuEntries = () => {
|
|
1938
1940
|
return [{
|
|
1939
|
-
label: openChanges(),
|
|
1940
|
-
flags: None,
|
|
1941
1941
|
command: /* TODO */'-1',
|
|
1942
|
-
id: ''
|
|
1943
|
-
}, {
|
|
1944
|
-
label: openFile(),
|
|
1945
1942
|
flags: None,
|
|
1946
|
-
|
|
1947
|
-
|
|
1943
|
+
id: '',
|
|
1944
|
+
label: openChanges()
|
|
1948
1945
|
}, {
|
|
1949
|
-
label: openFileHead(),
|
|
1950
|
-
flags: None,
|
|
1951
1946
|
command: /* TODO */'-1',
|
|
1952
|
-
id: ''
|
|
1953
|
-
}, {
|
|
1954
|
-
label: discardChanges(),
|
|
1955
1947
|
flags: None,
|
|
1956
|
-
|
|
1957
|
-
|
|
1948
|
+
id: '',
|
|
1949
|
+
label: openFile()
|
|
1958
1950
|
}, {
|
|
1959
|
-
label: stageChanges(),
|
|
1960
|
-
flags: None,
|
|
1961
1951
|
command: /* TODO */'-1',
|
|
1962
|
-
id: ''
|
|
1963
|
-
}, {
|
|
1964
|
-
label: addToGitignore(),
|
|
1965
1952
|
flags: None,
|
|
1953
|
+
id: '',
|
|
1954
|
+
label: openFileHead()
|
|
1955
|
+
}, {
|
|
1966
1956
|
command: /* TODO */'-1',
|
|
1967
|
-
|
|
1957
|
+
flags: None,
|
|
1958
|
+
id: '',
|
|
1959
|
+
label: discardChanges()
|
|
1968
1960
|
}, {
|
|
1969
|
-
|
|
1961
|
+
command: /* TODO */'-1',
|
|
1970
1962
|
flags: None,
|
|
1963
|
+
id: '',
|
|
1964
|
+
label: stageChanges()
|
|
1965
|
+
}, {
|
|
1971
1966
|
command: /* TODO */'-1',
|
|
1972
|
-
|
|
1967
|
+
flags: None,
|
|
1968
|
+
id: '',
|
|
1969
|
+
label: addToGitignore()
|
|
1973
1970
|
}, {
|
|
1974
|
-
|
|
1971
|
+
command: /* TODO */'-1',
|
|
1975
1972
|
flags: None,
|
|
1973
|
+
id: '',
|
|
1974
|
+
label: revealInExplorerView()
|
|
1975
|
+
}, {
|
|
1976
1976
|
command: /* TODO */'-1',
|
|
1977
|
-
|
|
1977
|
+
flags: None,
|
|
1978
|
+
id: '',
|
|
1979
|
+
label: openContainingFolder()
|
|
1978
1980
|
}];
|
|
1979
1981
|
};
|
|
1980
1982
|
|
|
@@ -1993,14 +1995,14 @@ const Refresh$1 = 'Refresh';
|
|
|
1993
1995
|
|
|
1994
1996
|
const refresh = async state => {
|
|
1995
1997
|
const {
|
|
1996
|
-
|
|
1998
|
+
actionsCache,
|
|
1999
|
+
enabledProviderIds,
|
|
2000
|
+
fileIconCache,
|
|
1997
2001
|
height,
|
|
2002
|
+
iconDefinitions,
|
|
2003
|
+
itemHeight,
|
|
1998
2004
|
minimumSliderSize,
|
|
1999
|
-
|
|
2000
|
-
enabledProviderIds,
|
|
2001
|
-
splitButtonEnabled,
|
|
2002
|
-
actionsCache,
|
|
2003
|
-
iconDefinitions
|
|
2005
|
+
splitButtonEnabled
|
|
2004
2006
|
} = state;
|
|
2005
2007
|
const {
|
|
2006
2008
|
allGroups,
|
|
@@ -2043,13 +2045,13 @@ const viewAsTree = state => {
|
|
|
2043
2045
|
|
|
2044
2046
|
const handleActionClick = async (state, actionName) => {
|
|
2045
2047
|
switch (actionName) {
|
|
2048
|
+
case CommitAndPush:
|
|
2049
|
+
warn(`[source-control-worker] CommitAndPush action not yet implemented`);
|
|
2050
|
+
return state;
|
|
2046
2051
|
case Refresh$1:
|
|
2047
2052
|
return refresh(state);
|
|
2048
2053
|
case ViewAsTree:
|
|
2049
2054
|
return viewAsTree(state);
|
|
2050
|
-
case CommitAndPush:
|
|
2051
|
-
warn(`[source-control-worker] CommitAndPush action not yet implemented`);
|
|
2052
|
-
return state;
|
|
2053
2055
|
default:
|
|
2054
2056
|
warn(`[source-control-worker] Unknown action name: ${actionName}`);
|
|
2055
2057
|
return state;
|
|
@@ -2081,8 +2083,8 @@ const handleButtonClick = async (state, clickedIndex) => {
|
|
|
2081
2083
|
const getIndex = (state, eventX, eventY) => {
|
|
2082
2084
|
const {
|
|
2083
2085
|
headerHeight,
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
+
itemHeight,
|
|
2087
|
+
y
|
|
2086
2088
|
} = state;
|
|
2087
2089
|
const relativeY = eventY - y - headerHeight;
|
|
2088
2090
|
const index = Math.floor(relativeY / itemHeight);
|
|
@@ -2115,12 +2117,12 @@ const handleClickSourceControlButtons = async (state, index, name) => {
|
|
|
2115
2117
|
|
|
2116
2118
|
const updateVisibleItems = async (state, expandedGroups) => {
|
|
2117
2119
|
const {
|
|
2118
|
-
itemHeight,
|
|
2119
|
-
height,
|
|
2120
2120
|
actionsCache,
|
|
2121
|
-
fileIconCache,
|
|
2122
2121
|
allGroups,
|
|
2123
|
-
|
|
2122
|
+
fileIconCache,
|
|
2123
|
+
height,
|
|
2124
|
+
iconDefinitions,
|
|
2125
|
+
itemHeight
|
|
2124
2126
|
} = state;
|
|
2125
2127
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2126
2128
|
const total = displayItems.length;
|
|
@@ -2131,11 +2133,11 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2131
2133
|
const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, fileIconCache);
|
|
2132
2134
|
return {
|
|
2133
2135
|
...state,
|
|
2134
|
-
items: displayItems,
|
|
2135
|
-
visibleItems,
|
|
2136
2136
|
expandedGroups,
|
|
2137
|
+
items: displayItems,
|
|
2138
|
+
maxLineY,
|
|
2137
2139
|
minLineY,
|
|
2138
|
-
|
|
2140
|
+
visibleItems
|
|
2139
2141
|
};
|
|
2140
2142
|
};
|
|
2141
2143
|
|
|
@@ -2246,19 +2248,19 @@ const handleInputFocus = async state => {
|
|
|
2246
2248
|
|
|
2247
2249
|
const handleInput = async (state, value, inputSource = User) => {
|
|
2248
2250
|
const {
|
|
2249
|
-
width,
|
|
2250
2251
|
inputFontFamily,
|
|
2251
2252
|
inputFontSize,
|
|
2252
2253
|
inputFontWeight,
|
|
2253
2254
|
inputLetterSpacing,
|
|
2254
|
-
inputLineHeight
|
|
2255
|
+
inputLineHeight,
|
|
2256
|
+
width
|
|
2255
2257
|
} = state;
|
|
2256
2258
|
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight);
|
|
2257
2259
|
return {
|
|
2258
2260
|
...state,
|
|
2259
|
-
|
|
2261
|
+
inputBoxHeight,
|
|
2260
2262
|
inputSource,
|
|
2261
|
-
|
|
2263
|
+
inputValue: value
|
|
2262
2264
|
};
|
|
2263
2265
|
};
|
|
2264
2266
|
|
|
@@ -2311,12 +2313,12 @@ const handleMouseOverAt = async (state, eventX, eventY) => {
|
|
|
2311
2313
|
|
|
2312
2314
|
const setDeltaY = async (state, newDeltaY) => {
|
|
2313
2315
|
const {
|
|
2314
|
-
itemHeight,
|
|
2315
|
-
items,
|
|
2316
|
-
height,
|
|
2317
|
-
headerHeight,
|
|
2318
2316
|
actionsCache,
|
|
2319
|
-
fileIconCache
|
|
2317
|
+
fileIconCache,
|
|
2318
|
+
headerHeight,
|
|
2319
|
+
height,
|
|
2320
|
+
itemHeight,
|
|
2321
|
+
items
|
|
2320
2322
|
} = state;
|
|
2321
2323
|
const normalizedDeltaY = Math.max(newDeltaY, 0);
|
|
2322
2324
|
const newMinLineY = Math.floor(normalizedDeltaY / itemHeight);
|
|
@@ -2328,9 +2330,9 @@ const setDeltaY = async (state, newDeltaY) => {
|
|
|
2328
2330
|
return {
|
|
2329
2331
|
...state,
|
|
2330
2332
|
deltaY: newDeltaY,
|
|
2331
|
-
|
|
2333
|
+
maxLineY,
|
|
2332
2334
|
minLineY: newMinLineY,
|
|
2333
|
-
|
|
2335
|
+
visibleItems: visible
|
|
2334
2336
|
};
|
|
2335
2337
|
};
|
|
2336
2338
|
|
|
@@ -2417,8 +2419,8 @@ ${indentRules}
|
|
|
2417
2419
|
|
|
2418
2420
|
const renderFocusContext = (oldState, newState) => {
|
|
2419
2421
|
const {
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
+
focus,
|
|
2423
|
+
id
|
|
2422
2424
|
} = newState;
|
|
2423
2425
|
return [SetFocusContext, id, focus];
|
|
2424
2426
|
};
|
|
@@ -2459,36 +2461,37 @@ const HandleMouseOutAt = 6;
|
|
|
2459
2461
|
const HandleMouseOver = 7;
|
|
2460
2462
|
const HandleMouseOverAt = 8;
|
|
2461
2463
|
const HandleWheel = 9;
|
|
2464
|
+
const HandleClickAction = 10;
|
|
2462
2465
|
|
|
2463
2466
|
const getSourceControlInputDom = inputPlaceholder => {
|
|
2464
2467
|
return [{
|
|
2465
|
-
type: TextArea,
|
|
2466
|
-
className: mergeClassNames(InputBox, 'MultilineInputBox'),
|
|
2467
2468
|
ariaLabel: sourceControlInput(),
|
|
2468
2469
|
autocapitalize: 'off',
|
|
2469
2470
|
autocorrect: 'off',
|
|
2470
2471
|
childCount: 0,
|
|
2472
|
+
className: mergeClassNames(InputBox, 'MultilineInputBox'),
|
|
2471
2473
|
name: SourceControlInput,
|
|
2472
2474
|
onFocus: HandleFocus,
|
|
2473
2475
|
onInput: HandleInput,
|
|
2474
2476
|
placeholder: inputPlaceholder,
|
|
2475
|
-
spellcheck: false
|
|
2477
|
+
spellcheck: false,
|
|
2478
|
+
type: TextArea
|
|
2476
2479
|
}];
|
|
2477
2480
|
};
|
|
2478
2481
|
|
|
2479
2482
|
const getSourceControlHeaderVirtualDom = inputPlaceholder => {
|
|
2480
2483
|
return [{
|
|
2481
|
-
|
|
2484
|
+
childCount: 1,
|
|
2482
2485
|
className: SourceControlHeader,
|
|
2483
|
-
|
|
2486
|
+
type: Div
|
|
2484
2487
|
}, ...getSourceControlInputDom(inputPlaceholder)];
|
|
2485
2488
|
};
|
|
2486
2489
|
|
|
2487
2490
|
const className$1 = mergeClassNames(Badge, SourceControlBadge);
|
|
2488
2491
|
const parentNode = {
|
|
2489
|
-
|
|
2492
|
+
childCount: 1,
|
|
2490
2493
|
className: className$1,
|
|
2491
|
-
|
|
2494
|
+
type: Div
|
|
2492
2495
|
};
|
|
2493
2496
|
const getBadgeVirtualDom = count => {
|
|
2494
2497
|
return [parentNode, text(`${count}`)];
|
|
@@ -2496,10 +2499,10 @@ const getBadgeVirtualDom = count => {
|
|
|
2496
2499
|
|
|
2497
2500
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
2498
2501
|
return {
|
|
2499
|
-
|
|
2502
|
+
childCount: 0,
|
|
2500
2503
|
className: `MaskIcon MaskIcon${icon}`,
|
|
2501
2504
|
role: None$1,
|
|
2502
|
-
|
|
2505
|
+
type
|
|
2503
2506
|
};
|
|
2504
2507
|
};
|
|
2505
2508
|
|
|
@@ -2509,12 +2512,12 @@ const getButtonVirtualDom = button => {
|
|
|
2509
2512
|
label
|
|
2510
2513
|
} = button;
|
|
2511
2514
|
return [{
|
|
2512
|
-
type: Button$2,
|
|
2513
|
-
className: SourceControlButton,
|
|
2514
|
-
title: label,
|
|
2515
2515
|
ariaLabel: label,
|
|
2516
2516
|
childCount: 1,
|
|
2517
|
-
|
|
2517
|
+
className: SourceControlButton,
|
|
2518
|
+
name: label,
|
|
2519
|
+
title: label,
|
|
2520
|
+
type: Button$2
|
|
2518
2521
|
}, getIconVirtualDom(icon, Span)];
|
|
2519
2522
|
};
|
|
2520
2523
|
|
|
@@ -2523,9 +2526,9 @@ const getButtonsVirtualDom = buttons => {
|
|
|
2523
2526
|
return [];
|
|
2524
2527
|
}
|
|
2525
2528
|
return [{
|
|
2526
|
-
|
|
2529
|
+
childCount: buttons.length,
|
|
2527
2530
|
className: SourceControlButtons,
|
|
2528
|
-
|
|
2531
|
+
type: Div
|
|
2529
2532
|
}, ...buttons.flatMap(getButtonVirtualDom)];
|
|
2530
2533
|
};
|
|
2531
2534
|
|
|
@@ -2548,54 +2551,54 @@ const PaddingRight = '12px';
|
|
|
2548
2551
|
|
|
2549
2552
|
const createItemDirectory = item => {
|
|
2550
2553
|
const {
|
|
2551
|
-
posInSet,
|
|
2552
|
-
setSize,
|
|
2553
|
-
icon,
|
|
2554
|
-
label,
|
|
2555
2554
|
badgeCount,
|
|
2556
|
-
decorationStrikeThrough,
|
|
2557
|
-
type,
|
|
2558
2555
|
buttons,
|
|
2559
|
-
|
|
2556
|
+
decorationStrikeThrough,
|
|
2557
|
+
icon,
|
|
2558
|
+
indent,
|
|
2559
|
+
label,
|
|
2560
|
+
posInSet,
|
|
2561
|
+
setSize,
|
|
2562
|
+
type
|
|
2560
2563
|
} = item;
|
|
2561
2564
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
2562
2565
|
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
2563
2566
|
const hasButtons = buttons.length;
|
|
2564
2567
|
const treeItemClassName = getTreeItemClassName(indent);
|
|
2565
2568
|
return [{
|
|
2566
|
-
type: Div,
|
|
2567
|
-
className: treeItemClassName,
|
|
2568
|
-
role: TreeItem$1,
|
|
2569
2569
|
ariaExpanded: type === DirectoryExpanded,
|
|
2570
2570
|
ariaPosInSet: posInSet,
|
|
2571
2571
|
ariaSetSize: setSize,
|
|
2572
2572
|
childCount: 3 + (hasButtons ? 1 : 0),
|
|
2573
|
-
|
|
2573
|
+
className: treeItemClassName,
|
|
2574
|
+
paddingRight: PaddingRight,
|
|
2575
|
+
role: TreeItem$1,
|
|
2576
|
+
type: Div
|
|
2574
2577
|
}, {
|
|
2575
|
-
|
|
2578
|
+
childCount: 0,
|
|
2576
2579
|
className: mergeClassNames(Chevron, `MaskIcon${icon}`),
|
|
2577
|
-
|
|
2580
|
+
type: Div
|
|
2578
2581
|
}, {
|
|
2579
|
-
|
|
2582
|
+
childCount: 1,
|
|
2580
2583
|
className: labelClassName,
|
|
2581
|
-
|
|
2584
|
+
type: Div
|
|
2582
2585
|
}, text(label), ...buttonsDom, ...getBadgeVirtualDom(badgeCount)];
|
|
2583
2586
|
};
|
|
2584
2587
|
|
|
2585
2588
|
const getFileIconVirtualDom = icon => {
|
|
2586
2589
|
return {
|
|
2587
|
-
|
|
2590
|
+
childCount: 0,
|
|
2588
2591
|
className: FileIcon,
|
|
2589
|
-
src: icon,
|
|
2590
2592
|
role: None$1,
|
|
2591
|
-
|
|
2593
|
+
src: icon,
|
|
2594
|
+
type: Img
|
|
2592
2595
|
};
|
|
2593
2596
|
};
|
|
2594
2597
|
|
|
2595
2598
|
const chevron = {
|
|
2596
|
-
|
|
2599
|
+
childCount: 1,
|
|
2597
2600
|
className: Chevron,
|
|
2598
|
-
|
|
2601
|
+
type: Div
|
|
2599
2602
|
};
|
|
2600
2603
|
const getIconsDom = (icon, fileIcon) => {
|
|
2601
2604
|
if (icon === ChevronRight) {
|
|
@@ -2605,18 +2608,18 @@ const getIconsDom = (icon, fileIcon) => {
|
|
|
2605
2608
|
};
|
|
2606
2609
|
const createItemOther = item => {
|
|
2607
2610
|
const {
|
|
2608
|
-
|
|
2609
|
-
setSize,
|
|
2610
|
-
icon,
|
|
2611
|
-
file,
|
|
2612
|
-
label,
|
|
2611
|
+
buttons,
|
|
2613
2612
|
decorationIcon,
|
|
2614
2613
|
decorationIconTitle,
|
|
2615
2614
|
decorationStrikeThrough,
|
|
2616
2615
|
detail,
|
|
2617
|
-
|
|
2616
|
+
file,
|
|
2618
2617
|
fileIcon,
|
|
2619
|
-
|
|
2618
|
+
icon,
|
|
2619
|
+
indent,
|
|
2620
|
+
label,
|
|
2621
|
+
posInSet,
|
|
2622
|
+
setSize
|
|
2620
2623
|
} = item;
|
|
2621
2624
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
2622
2625
|
const dom = [];
|
|
@@ -2624,44 +2627,44 @@ const createItemOther = item => {
|
|
|
2624
2627
|
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
2625
2628
|
const treeItemClassName = getTreeItemClassName(indent);
|
|
2626
2629
|
dom.push({
|
|
2627
|
-
type: Div,
|
|
2628
|
-
className: treeItemClassName,
|
|
2629
|
-
role: TreeItem$1,
|
|
2630
2630
|
ariaPosInSet: posInSet,
|
|
2631
2631
|
ariaSetSize: setSize,
|
|
2632
|
-
title: file,
|
|
2633
2632
|
childCount: 3 + (hasButtons ? 1 : 0),
|
|
2634
|
-
|
|
2633
|
+
className: treeItemClassName,
|
|
2634
|
+
paddingRight: '12px',
|
|
2635
|
+
role: TreeItem$1,
|
|
2636
|
+
title: file,
|
|
2637
|
+
type: Div
|
|
2635
2638
|
}, ...getIconsDom(icon, fileIcon));
|
|
2636
2639
|
const labelDom = {
|
|
2637
|
-
|
|
2640
|
+
childCount: 1,
|
|
2638
2641
|
className: labelClassName,
|
|
2639
|
-
|
|
2642
|
+
type: Div
|
|
2640
2643
|
};
|
|
2641
2644
|
dom.push(labelDom, text(label));
|
|
2642
2645
|
if (detail) {
|
|
2643
2646
|
labelDom.childCount++;
|
|
2644
2647
|
dom.push({
|
|
2645
|
-
|
|
2648
|
+
childCount: 1,
|
|
2646
2649
|
className: LabelDetail,
|
|
2647
|
-
|
|
2650
|
+
type: Span
|
|
2648
2651
|
}, text(detail));
|
|
2649
2652
|
}
|
|
2650
2653
|
dom.push(...buttonsDom);
|
|
2651
2654
|
dom.push({
|
|
2652
|
-
|
|
2655
|
+
childCount: 0,
|
|
2653
2656
|
className: DecorationIcon,
|
|
2654
|
-
title: decorationIconTitle,
|
|
2655
2657
|
src: decorationIcon,
|
|
2656
|
-
|
|
2658
|
+
title: decorationIconTitle,
|
|
2659
|
+
type: Img
|
|
2657
2660
|
});
|
|
2658
2661
|
return dom;
|
|
2659
2662
|
};
|
|
2660
2663
|
|
|
2661
2664
|
const getSourceControlItemVirtualDom = item => {
|
|
2662
2665
|
switch (item.type) {
|
|
2663
|
-
case DirectoryExpanded:
|
|
2664
2666
|
case Directory:
|
|
2667
|
+
case DirectoryExpanded:
|
|
2665
2668
|
return createItemDirectory(item);
|
|
2666
2669
|
default:
|
|
2667
2670
|
return createItemOther(item);
|
|
@@ -2670,13 +2673,13 @@ const getSourceControlItemVirtualDom = item => {
|
|
|
2670
2673
|
|
|
2671
2674
|
const getSourceControlListVirtualDom = items => {
|
|
2672
2675
|
return [{
|
|
2673
|
-
type: Div,
|
|
2674
|
-
className: SourceControlItems,
|
|
2675
|
-
role: Tree$1,
|
|
2676
2676
|
childCount: items.length,
|
|
2677
|
+
className: SourceControlItems,
|
|
2677
2678
|
onClick: HandleClickAt,
|
|
2679
|
+
onPointerOut: HandleMouseOutAt,
|
|
2678
2680
|
onPointerOver: HandleMouseOverAt,
|
|
2679
|
-
|
|
2681
|
+
role: Tree$1,
|
|
2682
|
+
type: Div
|
|
2680
2683
|
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
2681
2684
|
};
|
|
2682
2685
|
|
|
@@ -2685,27 +2688,27 @@ const getSplitButtonVirtualDom = (hasItems, splitButtonEnabled, buttonText) => {
|
|
|
2685
2688
|
return [];
|
|
2686
2689
|
}
|
|
2687
2690
|
return [{
|
|
2688
|
-
|
|
2691
|
+
childCount: 3,
|
|
2689
2692
|
className: mergeClassNames(SplitButton, hasItems ? '' : SplitButtonDisabled),
|
|
2690
|
-
|
|
2693
|
+
type: Div
|
|
2691
2694
|
}, {
|
|
2692
|
-
type: Div,
|
|
2693
|
-
className: mergeClassNames(SplitButtonContent, hasItems ? '' : SplitButtonContentDisabled),
|
|
2694
2695
|
childCount: 1,
|
|
2695
|
-
|
|
2696
|
+
className: mergeClassNames(SplitButtonContent, hasItems ? '' : SplitButtonContentDisabled),
|
|
2697
|
+
tabIndex: 0,
|
|
2698
|
+
type: Div
|
|
2696
2699
|
}, text(buttonText), {
|
|
2697
|
-
|
|
2700
|
+
childCount: 0,
|
|
2698
2701
|
className: SplitButtonSeparator,
|
|
2699
|
-
|
|
2702
|
+
type: Div
|
|
2700
2703
|
}, {
|
|
2701
|
-
type: Div,
|
|
2702
|
-
className: mergeClassNames(SplitButtonDropDown, hasItems ? '' : SplitButtonDropDownDisabled),
|
|
2703
2704
|
childCount: 1,
|
|
2704
|
-
|
|
2705
|
+
className: mergeClassNames(SplitButtonDropDown, hasItems ? '' : SplitButtonDropDownDisabled),
|
|
2706
|
+
tabIndex: 0,
|
|
2707
|
+
type: Div
|
|
2705
2708
|
}, {
|
|
2706
|
-
|
|
2709
|
+
childCount: 0,
|
|
2707
2710
|
className: mergeClassNames(MaskIcon, MaskIconChevronDown),
|
|
2708
|
-
|
|
2711
|
+
type: Div
|
|
2709
2712
|
}];
|
|
2710
2713
|
};
|
|
2711
2714
|
|
|
@@ -2713,24 +2716,24 @@ const className = mergeClassNames(Viewlet, SourceControl);
|
|
|
2713
2716
|
const getSourceControlVirtualDom = (items, splitButtonEnabled, inputPlaceholder) => {
|
|
2714
2717
|
const hasItems = items.length > 0;
|
|
2715
2718
|
const dom = [{
|
|
2716
|
-
|
|
2719
|
+
childCount: splitButtonEnabled ? 3 : 2,
|
|
2717
2720
|
className: className,
|
|
2718
|
-
tabIndex: 0,
|
|
2719
2721
|
onContextMenu: HandleContextMenu,
|
|
2720
2722
|
onMouseOver: HandleMouseOver,
|
|
2721
2723
|
// onMouseOut: DomEventListenerFunctions.HandleMouseOut,
|
|
2722
2724
|
onWheel: HandleWheel,
|
|
2723
|
-
|
|
2725
|
+
tabIndex: 0,
|
|
2726
|
+
type: Div
|
|
2724
2727
|
}, ...getSourceControlHeaderVirtualDom(inputPlaceholder), ...getSplitButtonVirtualDom(hasItems, splitButtonEnabled, 'Commit'), ...getSourceControlListVirtualDom(items)];
|
|
2725
2728
|
return dom;
|
|
2726
2729
|
};
|
|
2727
2730
|
|
|
2728
2731
|
const renderItems = (oldState, newState) => {
|
|
2729
2732
|
const {
|
|
2730
|
-
|
|
2731
|
-
splitButtonEnabled,
|
|
2733
|
+
id,
|
|
2732
2734
|
inputPlaceholder,
|
|
2733
|
-
|
|
2735
|
+
splitButtonEnabled,
|
|
2736
|
+
visibleItems
|
|
2734
2737
|
} = newState;
|
|
2735
2738
|
const dom = getSourceControlVirtualDom(visibleItems, splitButtonEnabled, inputPlaceholder);
|
|
2736
2739
|
return [SetDom2, id, dom];
|
|
@@ -2746,14 +2749,14 @@ const renderValue = (oldState, newState) => {
|
|
|
2746
2749
|
|
|
2747
2750
|
const getRenderer = diffType => {
|
|
2748
2751
|
switch (diffType) {
|
|
2749
|
-
case RenderItems:
|
|
2750
|
-
return renderItems;
|
|
2751
|
-
case RenderValue:
|
|
2752
|
-
return renderValue;
|
|
2753
2752
|
case RenderCss:
|
|
2754
2753
|
return renderCss;
|
|
2755
2754
|
case RenderFocusContext:
|
|
2756
2755
|
return renderFocusContext;
|
|
2756
|
+
case RenderItems:
|
|
2757
|
+
return renderItems;
|
|
2758
|
+
case RenderValue:
|
|
2759
|
+
return renderValue;
|
|
2757
2760
|
default:
|
|
2758
2761
|
throw new Error('unknown renderer');
|
|
2759
2762
|
}
|
|
@@ -2773,8 +2776,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
2773
2776
|
|
|
2774
2777
|
const render2 = (uid, diffResult) => {
|
|
2775
2778
|
const {
|
|
2776
|
-
|
|
2777
|
-
|
|
2779
|
+
newState,
|
|
2780
|
+
oldState
|
|
2778
2781
|
} = get(uid);
|
|
2779
2782
|
set(uid, newState, newState);
|
|
2780
2783
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2789,38 +2792,38 @@ const Refresh = 'Refresh';
|
|
|
2789
2792
|
|
|
2790
2793
|
const getActions = () => {
|
|
2791
2794
|
return [{
|
|
2792
|
-
|
|
2795
|
+
command: '',
|
|
2796
|
+
icon: ListFlat,
|
|
2793
2797
|
id: viewAsTree$1(),
|
|
2794
2798
|
name: ViewAsTree,
|
|
2795
|
-
|
|
2796
|
-
command: ''
|
|
2799
|
+
type: Button
|
|
2797
2800
|
}, {
|
|
2798
|
-
|
|
2801
|
+
command: '',
|
|
2802
|
+
icon: Check,
|
|
2799
2803
|
id: commitAndPush(),
|
|
2800
2804
|
name: CommitAndPush,
|
|
2801
|
-
|
|
2802
|
-
command: ''
|
|
2805
|
+
type: Button
|
|
2803
2806
|
}, {
|
|
2804
|
-
|
|
2807
|
+
command: '',
|
|
2808
|
+
icon: Refresh,
|
|
2805
2809
|
id: refresh$1(),
|
|
2806
2810
|
name: Refresh$1,
|
|
2807
|
-
|
|
2808
|
-
command: ''
|
|
2811
|
+
type: Button
|
|
2809
2812
|
}];
|
|
2810
2813
|
};
|
|
2811
2814
|
|
|
2812
2815
|
const getActionButtonVirtualDom = action => {
|
|
2813
2816
|
const {
|
|
2814
|
-
id,
|
|
2815
2817
|
icon,
|
|
2818
|
+
id,
|
|
2816
2819
|
label
|
|
2817
2820
|
} = action;
|
|
2818
2821
|
return [{
|
|
2819
|
-
|
|
2822
|
+
childCount: 1,
|
|
2820
2823
|
className: IconButton,
|
|
2821
|
-
title: id,
|
|
2822
2824
|
name: label,
|
|
2823
|
-
|
|
2825
|
+
title: id,
|
|
2826
|
+
type: Button$2
|
|
2824
2827
|
}, getIconVirtualDom(icon)];
|
|
2825
2828
|
};
|
|
2826
2829
|
|
|
@@ -2829,8 +2832,8 @@ const getActionVirtualDom = action => {
|
|
|
2829
2832
|
case Button:
|
|
2830
2833
|
{
|
|
2831
2834
|
const actionButton = {
|
|
2832
|
-
id: action.id,
|
|
2833
2835
|
icon: action.icon,
|
|
2836
|
+
id: action.id,
|
|
2834
2837
|
label: action.name
|
|
2835
2838
|
};
|
|
2836
2839
|
return getActionButtonVirtualDom(actionButton);
|
|
@@ -2842,10 +2845,11 @@ const getActionVirtualDom = action => {
|
|
|
2842
2845
|
|
|
2843
2846
|
const getActionsVirtualDom = actions => {
|
|
2844
2847
|
return [{
|
|
2845
|
-
|
|
2848
|
+
childCount: actions.length,
|
|
2846
2849
|
className: Actions,
|
|
2850
|
+
onClick: HandleClickAction,
|
|
2847
2851
|
role: ToolBar,
|
|
2848
|
-
|
|
2852
|
+
type: Div
|
|
2849
2853
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
2850
2854
|
};
|
|
2851
2855
|
|
|
@@ -2886,6 +2890,9 @@ const renderEventListeners = () => {
|
|
|
2886
2890
|
name: HandleWheel,
|
|
2887
2891
|
params: ['handleWheel', DeltaMode, DeltaY],
|
|
2888
2892
|
passive: true
|
|
2893
|
+
}, {
|
|
2894
|
+
name: HandleClickAction,
|
|
2895
|
+
params: ['handleActionClick', TargetName]
|
|
2889
2896
|
}];
|
|
2890
2897
|
};
|
|
2891
2898
|
|
|
@@ -2896,26 +2903,26 @@ const saveState = uid => {
|
|
|
2896
2903
|
newState
|
|
2897
2904
|
} = value;
|
|
2898
2905
|
const {
|
|
2899
|
-
root,
|
|
2900
|
-
maxLineY,
|
|
2901
2906
|
expandedGroups,
|
|
2902
|
-
inputValue
|
|
2907
|
+
inputValue,
|
|
2908
|
+
maxLineY,
|
|
2909
|
+
root
|
|
2903
2910
|
} = newState;
|
|
2904
2911
|
return {
|
|
2905
|
-
root,
|
|
2906
|
-
minLineY: 0,
|
|
2907
|
-
maxLineY,
|
|
2908
2912
|
deltaY: 0,
|
|
2909
2913
|
expandedGroups,
|
|
2910
|
-
inputValue
|
|
2914
|
+
inputValue,
|
|
2915
|
+
maxLineY,
|
|
2916
|
+
minLineY: 0,
|
|
2917
|
+
root
|
|
2911
2918
|
};
|
|
2912
2919
|
};
|
|
2913
2920
|
|
|
2914
2921
|
const updateIcons = async state => {
|
|
2915
2922
|
const {
|
|
2916
2923
|
items,
|
|
2917
|
-
|
|
2918
|
-
|
|
2924
|
+
maxLineY,
|
|
2925
|
+
minLineY
|
|
2919
2926
|
} = state;
|
|
2920
2927
|
const visible = items.slice(minLineY, maxLineY);
|
|
2921
2928
|
const newFileIconCache = await getFileIcons(visible, Object.create(null));
|