@lvce-editor/source-control-worker 2.17.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 +222 -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);
|
|
@@ -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
|
};
|
|
@@ -2463,33 +2465,33 @@ const HandleClickAction = 10;
|
|
|
2463
2465
|
|
|
2464
2466
|
const getSourceControlInputDom = inputPlaceholder => {
|
|
2465
2467
|
return [{
|
|
2466
|
-
type: TextArea,
|
|
2467
|
-
className: mergeClassNames(InputBox, 'MultilineInputBox'),
|
|
2468
2468
|
ariaLabel: sourceControlInput(),
|
|
2469
2469
|
autocapitalize: 'off',
|
|
2470
2470
|
autocorrect: 'off',
|
|
2471
2471
|
childCount: 0,
|
|
2472
|
+
className: mergeClassNames(InputBox, 'MultilineInputBox'),
|
|
2472
2473
|
name: SourceControlInput,
|
|
2473
2474
|
onFocus: HandleFocus,
|
|
2474
2475
|
onInput: HandleInput,
|
|
2475
2476
|
placeholder: inputPlaceholder,
|
|
2476
|
-
spellcheck: false
|
|
2477
|
+
spellcheck: false,
|
|
2478
|
+
type: TextArea
|
|
2477
2479
|
}];
|
|
2478
2480
|
};
|
|
2479
2481
|
|
|
2480
2482
|
const getSourceControlHeaderVirtualDom = inputPlaceholder => {
|
|
2481
2483
|
return [{
|
|
2482
|
-
|
|
2484
|
+
childCount: 1,
|
|
2483
2485
|
className: SourceControlHeader,
|
|
2484
|
-
|
|
2486
|
+
type: Div
|
|
2485
2487
|
}, ...getSourceControlInputDom(inputPlaceholder)];
|
|
2486
2488
|
};
|
|
2487
2489
|
|
|
2488
2490
|
const className$1 = mergeClassNames(Badge, SourceControlBadge);
|
|
2489
2491
|
const parentNode = {
|
|
2490
|
-
|
|
2492
|
+
childCount: 1,
|
|
2491
2493
|
className: className$1,
|
|
2492
|
-
|
|
2494
|
+
type: Div
|
|
2493
2495
|
};
|
|
2494
2496
|
const getBadgeVirtualDom = count => {
|
|
2495
2497
|
return [parentNode, text(`${count}`)];
|
|
@@ -2497,10 +2499,10 @@ const getBadgeVirtualDom = count => {
|
|
|
2497
2499
|
|
|
2498
2500
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
2499
2501
|
return {
|
|
2500
|
-
|
|
2502
|
+
childCount: 0,
|
|
2501
2503
|
className: `MaskIcon MaskIcon${icon}`,
|
|
2502
2504
|
role: None$1,
|
|
2503
|
-
|
|
2505
|
+
type
|
|
2504
2506
|
};
|
|
2505
2507
|
};
|
|
2506
2508
|
|
|
@@ -2510,12 +2512,12 @@ const getButtonVirtualDom = button => {
|
|
|
2510
2512
|
label
|
|
2511
2513
|
} = button;
|
|
2512
2514
|
return [{
|
|
2513
|
-
type: Button$2,
|
|
2514
|
-
className: SourceControlButton,
|
|
2515
|
-
title: label,
|
|
2516
2515
|
ariaLabel: label,
|
|
2517
2516
|
childCount: 1,
|
|
2518
|
-
|
|
2517
|
+
className: SourceControlButton,
|
|
2518
|
+
name: label,
|
|
2519
|
+
title: label,
|
|
2520
|
+
type: Button$2
|
|
2519
2521
|
}, getIconVirtualDom(icon, Span)];
|
|
2520
2522
|
};
|
|
2521
2523
|
|
|
@@ -2524,9 +2526,9 @@ const getButtonsVirtualDom = buttons => {
|
|
|
2524
2526
|
return [];
|
|
2525
2527
|
}
|
|
2526
2528
|
return [{
|
|
2527
|
-
|
|
2529
|
+
childCount: buttons.length,
|
|
2528
2530
|
className: SourceControlButtons,
|
|
2529
|
-
|
|
2531
|
+
type: Div
|
|
2530
2532
|
}, ...buttons.flatMap(getButtonVirtualDom)];
|
|
2531
2533
|
};
|
|
2532
2534
|
|
|
@@ -2549,54 +2551,54 @@ const PaddingRight = '12px';
|
|
|
2549
2551
|
|
|
2550
2552
|
const createItemDirectory = item => {
|
|
2551
2553
|
const {
|
|
2552
|
-
posInSet,
|
|
2553
|
-
setSize,
|
|
2554
|
-
icon,
|
|
2555
|
-
label,
|
|
2556
2554
|
badgeCount,
|
|
2557
|
-
decorationStrikeThrough,
|
|
2558
|
-
type,
|
|
2559
2555
|
buttons,
|
|
2560
|
-
|
|
2556
|
+
decorationStrikeThrough,
|
|
2557
|
+
icon,
|
|
2558
|
+
indent,
|
|
2559
|
+
label,
|
|
2560
|
+
posInSet,
|
|
2561
|
+
setSize,
|
|
2562
|
+
type
|
|
2561
2563
|
} = item;
|
|
2562
2564
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
2563
2565
|
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
2564
2566
|
const hasButtons = buttons.length;
|
|
2565
2567
|
const treeItemClassName = getTreeItemClassName(indent);
|
|
2566
2568
|
return [{
|
|
2567
|
-
type: Div,
|
|
2568
|
-
className: treeItemClassName,
|
|
2569
|
-
role: TreeItem$1,
|
|
2570
2569
|
ariaExpanded: type === DirectoryExpanded,
|
|
2571
2570
|
ariaPosInSet: posInSet,
|
|
2572
2571
|
ariaSetSize: setSize,
|
|
2573
2572
|
childCount: 3 + (hasButtons ? 1 : 0),
|
|
2574
|
-
|
|
2573
|
+
className: treeItemClassName,
|
|
2574
|
+
paddingRight: PaddingRight,
|
|
2575
|
+
role: TreeItem$1,
|
|
2576
|
+
type: Div
|
|
2575
2577
|
}, {
|
|
2576
|
-
|
|
2578
|
+
childCount: 0,
|
|
2577
2579
|
className: mergeClassNames(Chevron, `MaskIcon${icon}`),
|
|
2578
|
-
|
|
2580
|
+
type: Div
|
|
2579
2581
|
}, {
|
|
2580
|
-
|
|
2582
|
+
childCount: 1,
|
|
2581
2583
|
className: labelClassName,
|
|
2582
|
-
|
|
2584
|
+
type: Div
|
|
2583
2585
|
}, text(label), ...buttonsDom, ...getBadgeVirtualDom(badgeCount)];
|
|
2584
2586
|
};
|
|
2585
2587
|
|
|
2586
2588
|
const getFileIconVirtualDom = icon => {
|
|
2587
2589
|
return {
|
|
2588
|
-
|
|
2590
|
+
childCount: 0,
|
|
2589
2591
|
className: FileIcon,
|
|
2590
|
-
src: icon,
|
|
2591
2592
|
role: None$1,
|
|
2592
|
-
|
|
2593
|
+
src: icon,
|
|
2594
|
+
type: Img
|
|
2593
2595
|
};
|
|
2594
2596
|
};
|
|
2595
2597
|
|
|
2596
2598
|
const chevron = {
|
|
2597
|
-
|
|
2599
|
+
childCount: 1,
|
|
2598
2600
|
className: Chevron,
|
|
2599
|
-
|
|
2601
|
+
type: Div
|
|
2600
2602
|
};
|
|
2601
2603
|
const getIconsDom = (icon, fileIcon) => {
|
|
2602
2604
|
if (icon === ChevronRight) {
|
|
@@ -2606,18 +2608,18 @@ const getIconsDom = (icon, fileIcon) => {
|
|
|
2606
2608
|
};
|
|
2607
2609
|
const createItemOther = item => {
|
|
2608
2610
|
const {
|
|
2609
|
-
|
|
2610
|
-
setSize,
|
|
2611
|
-
icon,
|
|
2612
|
-
file,
|
|
2613
|
-
label,
|
|
2611
|
+
buttons,
|
|
2614
2612
|
decorationIcon,
|
|
2615
2613
|
decorationIconTitle,
|
|
2616
2614
|
decorationStrikeThrough,
|
|
2617
2615
|
detail,
|
|
2618
|
-
|
|
2616
|
+
file,
|
|
2619
2617
|
fileIcon,
|
|
2620
|
-
|
|
2618
|
+
icon,
|
|
2619
|
+
indent,
|
|
2620
|
+
label,
|
|
2621
|
+
posInSet,
|
|
2622
|
+
setSize
|
|
2621
2623
|
} = item;
|
|
2622
2624
|
const labelClassName = getLabelClassName(decorationStrikeThrough);
|
|
2623
2625
|
const dom = [];
|
|
@@ -2625,44 +2627,44 @@ const createItemOther = item => {
|
|
|
2625
2627
|
const buttonsDom = getButtonsVirtualDom(buttons);
|
|
2626
2628
|
const treeItemClassName = getTreeItemClassName(indent);
|
|
2627
2629
|
dom.push({
|
|
2628
|
-
type: Div,
|
|
2629
|
-
className: treeItemClassName,
|
|
2630
|
-
role: TreeItem$1,
|
|
2631
2630
|
ariaPosInSet: posInSet,
|
|
2632
2631
|
ariaSetSize: setSize,
|
|
2633
|
-
title: file,
|
|
2634
2632
|
childCount: 3 + (hasButtons ? 1 : 0),
|
|
2635
|
-
|
|
2633
|
+
className: treeItemClassName,
|
|
2634
|
+
paddingRight: '12px',
|
|
2635
|
+
role: TreeItem$1,
|
|
2636
|
+
title: file,
|
|
2637
|
+
type: Div
|
|
2636
2638
|
}, ...getIconsDom(icon, fileIcon));
|
|
2637
2639
|
const labelDom = {
|
|
2638
|
-
|
|
2640
|
+
childCount: 1,
|
|
2639
2641
|
className: labelClassName,
|
|
2640
|
-
|
|
2642
|
+
type: Div
|
|
2641
2643
|
};
|
|
2642
2644
|
dom.push(labelDom, text(label));
|
|
2643
2645
|
if (detail) {
|
|
2644
2646
|
labelDom.childCount++;
|
|
2645
2647
|
dom.push({
|
|
2646
|
-
|
|
2648
|
+
childCount: 1,
|
|
2647
2649
|
className: LabelDetail,
|
|
2648
|
-
|
|
2650
|
+
type: Span
|
|
2649
2651
|
}, text(detail));
|
|
2650
2652
|
}
|
|
2651
2653
|
dom.push(...buttonsDom);
|
|
2652
2654
|
dom.push({
|
|
2653
|
-
|
|
2655
|
+
childCount: 0,
|
|
2654
2656
|
className: DecorationIcon,
|
|
2655
|
-
title: decorationIconTitle,
|
|
2656
2657
|
src: decorationIcon,
|
|
2657
|
-
|
|
2658
|
+
title: decorationIconTitle,
|
|
2659
|
+
type: Img
|
|
2658
2660
|
});
|
|
2659
2661
|
return dom;
|
|
2660
2662
|
};
|
|
2661
2663
|
|
|
2662
2664
|
const getSourceControlItemVirtualDom = item => {
|
|
2663
2665
|
switch (item.type) {
|
|
2664
|
-
case DirectoryExpanded:
|
|
2665
2666
|
case Directory:
|
|
2667
|
+
case DirectoryExpanded:
|
|
2666
2668
|
return createItemDirectory(item);
|
|
2667
2669
|
default:
|
|
2668
2670
|
return createItemOther(item);
|
|
@@ -2671,13 +2673,13 @@ const getSourceControlItemVirtualDom = item => {
|
|
|
2671
2673
|
|
|
2672
2674
|
const getSourceControlListVirtualDom = items => {
|
|
2673
2675
|
return [{
|
|
2674
|
-
type: Div,
|
|
2675
|
-
className: SourceControlItems,
|
|
2676
|
-
role: Tree$1,
|
|
2677
2676
|
childCount: items.length,
|
|
2677
|
+
className: SourceControlItems,
|
|
2678
2678
|
onClick: HandleClickAt,
|
|
2679
|
+
onPointerOut: HandleMouseOutAt,
|
|
2679
2680
|
onPointerOver: HandleMouseOverAt,
|
|
2680
|
-
|
|
2681
|
+
role: Tree$1,
|
|
2682
|
+
type: Div
|
|
2681
2683
|
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
2682
2684
|
};
|
|
2683
2685
|
|
|
@@ -2686,27 +2688,27 @@ const getSplitButtonVirtualDom = (hasItems, splitButtonEnabled, buttonText) => {
|
|
|
2686
2688
|
return [];
|
|
2687
2689
|
}
|
|
2688
2690
|
return [{
|
|
2689
|
-
|
|
2691
|
+
childCount: 3,
|
|
2690
2692
|
className: mergeClassNames(SplitButton, hasItems ? '' : SplitButtonDisabled),
|
|
2691
|
-
|
|
2693
|
+
type: Div
|
|
2692
2694
|
}, {
|
|
2693
|
-
type: Div,
|
|
2694
|
-
className: mergeClassNames(SplitButtonContent, hasItems ? '' : SplitButtonContentDisabled),
|
|
2695
2695
|
childCount: 1,
|
|
2696
|
-
|
|
2696
|
+
className: mergeClassNames(SplitButtonContent, hasItems ? '' : SplitButtonContentDisabled),
|
|
2697
|
+
tabIndex: 0,
|
|
2698
|
+
type: Div
|
|
2697
2699
|
}, text(buttonText), {
|
|
2698
|
-
|
|
2700
|
+
childCount: 0,
|
|
2699
2701
|
className: SplitButtonSeparator,
|
|
2700
|
-
|
|
2702
|
+
type: Div
|
|
2701
2703
|
}, {
|
|
2702
|
-
type: Div,
|
|
2703
|
-
className: mergeClassNames(SplitButtonDropDown, hasItems ? '' : SplitButtonDropDownDisabled),
|
|
2704
2704
|
childCount: 1,
|
|
2705
|
-
|
|
2705
|
+
className: mergeClassNames(SplitButtonDropDown, hasItems ? '' : SplitButtonDropDownDisabled),
|
|
2706
|
+
tabIndex: 0,
|
|
2707
|
+
type: Div
|
|
2706
2708
|
}, {
|
|
2707
|
-
|
|
2709
|
+
childCount: 0,
|
|
2708
2710
|
className: mergeClassNames(MaskIcon, MaskIconChevronDown),
|
|
2709
|
-
|
|
2711
|
+
type: Div
|
|
2710
2712
|
}];
|
|
2711
2713
|
};
|
|
2712
2714
|
|
|
@@ -2714,24 +2716,24 @@ const className = mergeClassNames(Viewlet, SourceControl);
|
|
|
2714
2716
|
const getSourceControlVirtualDom = (items, splitButtonEnabled, inputPlaceholder) => {
|
|
2715
2717
|
const hasItems = items.length > 0;
|
|
2716
2718
|
const dom = [{
|
|
2717
|
-
|
|
2719
|
+
childCount: splitButtonEnabled ? 3 : 2,
|
|
2718
2720
|
className: className,
|
|
2719
|
-
tabIndex: 0,
|
|
2720
2721
|
onContextMenu: HandleContextMenu,
|
|
2721
2722
|
onMouseOver: HandleMouseOver,
|
|
2722
2723
|
// onMouseOut: DomEventListenerFunctions.HandleMouseOut,
|
|
2723
2724
|
onWheel: HandleWheel,
|
|
2724
|
-
|
|
2725
|
+
tabIndex: 0,
|
|
2726
|
+
type: Div
|
|
2725
2727
|
}, ...getSourceControlHeaderVirtualDom(inputPlaceholder), ...getSplitButtonVirtualDom(hasItems, splitButtonEnabled, 'Commit'), ...getSourceControlListVirtualDom(items)];
|
|
2726
2728
|
return dom;
|
|
2727
2729
|
};
|
|
2728
2730
|
|
|
2729
2731
|
const renderItems = (oldState, newState) => {
|
|
2730
2732
|
const {
|
|
2731
|
-
|
|
2732
|
-
splitButtonEnabled,
|
|
2733
|
+
id,
|
|
2733
2734
|
inputPlaceholder,
|
|
2734
|
-
|
|
2735
|
+
splitButtonEnabled,
|
|
2736
|
+
visibleItems
|
|
2735
2737
|
} = newState;
|
|
2736
2738
|
const dom = getSourceControlVirtualDom(visibleItems, splitButtonEnabled, inputPlaceholder);
|
|
2737
2739
|
return [SetDom2, id, dom];
|
|
@@ -2747,14 +2749,14 @@ const renderValue = (oldState, newState) => {
|
|
|
2747
2749
|
|
|
2748
2750
|
const getRenderer = diffType => {
|
|
2749
2751
|
switch (diffType) {
|
|
2750
|
-
case RenderItems:
|
|
2751
|
-
return renderItems;
|
|
2752
|
-
case RenderValue:
|
|
2753
|
-
return renderValue;
|
|
2754
2752
|
case RenderCss:
|
|
2755
2753
|
return renderCss;
|
|
2756
2754
|
case RenderFocusContext:
|
|
2757
2755
|
return renderFocusContext;
|
|
2756
|
+
case RenderItems:
|
|
2757
|
+
return renderItems;
|
|
2758
|
+
case RenderValue:
|
|
2759
|
+
return renderValue;
|
|
2758
2760
|
default:
|
|
2759
2761
|
throw new Error('unknown renderer');
|
|
2760
2762
|
}
|
|
@@ -2774,8 +2776,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
2774
2776
|
|
|
2775
2777
|
const render2 = (uid, diffResult) => {
|
|
2776
2778
|
const {
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
+
newState,
|
|
2780
|
+
oldState
|
|
2779
2781
|
} = get(uid);
|
|
2780
2782
|
set(uid, newState, newState);
|
|
2781
2783
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2790,38 +2792,38 @@ const Refresh = 'Refresh';
|
|
|
2790
2792
|
|
|
2791
2793
|
const getActions = () => {
|
|
2792
2794
|
return [{
|
|
2793
|
-
|
|
2795
|
+
command: '',
|
|
2796
|
+
icon: ListFlat,
|
|
2794
2797
|
id: viewAsTree$1(),
|
|
2795
2798
|
name: ViewAsTree,
|
|
2796
|
-
|
|
2797
|
-
command: ''
|
|
2799
|
+
type: Button
|
|
2798
2800
|
}, {
|
|
2799
|
-
|
|
2801
|
+
command: '',
|
|
2802
|
+
icon: Check,
|
|
2800
2803
|
id: commitAndPush(),
|
|
2801
2804
|
name: CommitAndPush,
|
|
2802
|
-
|
|
2803
|
-
command: ''
|
|
2805
|
+
type: Button
|
|
2804
2806
|
}, {
|
|
2805
|
-
|
|
2807
|
+
command: '',
|
|
2808
|
+
icon: Refresh,
|
|
2806
2809
|
id: refresh$1(),
|
|
2807
2810
|
name: Refresh$1,
|
|
2808
|
-
|
|
2809
|
-
command: ''
|
|
2811
|
+
type: Button
|
|
2810
2812
|
}];
|
|
2811
2813
|
};
|
|
2812
2814
|
|
|
2813
2815
|
const getActionButtonVirtualDom = action => {
|
|
2814
2816
|
const {
|
|
2815
|
-
id,
|
|
2816
2817
|
icon,
|
|
2818
|
+
id,
|
|
2817
2819
|
label
|
|
2818
2820
|
} = action;
|
|
2819
2821
|
return [{
|
|
2820
|
-
|
|
2822
|
+
childCount: 1,
|
|
2821
2823
|
className: IconButton,
|
|
2822
|
-
title: id,
|
|
2823
2824
|
name: label,
|
|
2824
|
-
|
|
2825
|
+
title: id,
|
|
2826
|
+
type: Button$2
|
|
2825
2827
|
}, getIconVirtualDom(icon)];
|
|
2826
2828
|
};
|
|
2827
2829
|
|
|
@@ -2830,8 +2832,8 @@ const getActionVirtualDom = action => {
|
|
|
2830
2832
|
case Button:
|
|
2831
2833
|
{
|
|
2832
2834
|
const actionButton = {
|
|
2833
|
-
id: action.id,
|
|
2834
2835
|
icon: action.icon,
|
|
2836
|
+
id: action.id,
|
|
2835
2837
|
label: action.name
|
|
2836
2838
|
};
|
|
2837
2839
|
return getActionButtonVirtualDom(actionButton);
|
|
@@ -2843,11 +2845,11 @@ const getActionVirtualDom = action => {
|
|
|
2843
2845
|
|
|
2844
2846
|
const getActionsVirtualDom = actions => {
|
|
2845
2847
|
return [{
|
|
2846
|
-
|
|
2848
|
+
childCount: actions.length,
|
|
2847
2849
|
className: Actions,
|
|
2850
|
+
onClick: HandleClickAction,
|
|
2848
2851
|
role: ToolBar,
|
|
2849
|
-
|
|
2850
|
-
onClick: HandleClickAction
|
|
2852
|
+
type: Div
|
|
2851
2853
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
2852
2854
|
};
|
|
2853
2855
|
|
|
@@ -2901,26 +2903,26 @@ const saveState = uid => {
|
|
|
2901
2903
|
newState
|
|
2902
2904
|
} = value;
|
|
2903
2905
|
const {
|
|
2904
|
-
root,
|
|
2905
|
-
maxLineY,
|
|
2906
2906
|
expandedGroups,
|
|
2907
|
-
inputValue
|
|
2907
|
+
inputValue,
|
|
2908
|
+
maxLineY,
|
|
2909
|
+
root
|
|
2908
2910
|
} = newState;
|
|
2909
2911
|
return {
|
|
2910
|
-
root,
|
|
2911
|
-
minLineY: 0,
|
|
2912
|
-
maxLineY,
|
|
2913
2912
|
deltaY: 0,
|
|
2914
2913
|
expandedGroups,
|
|
2915
|
-
inputValue
|
|
2914
|
+
inputValue,
|
|
2915
|
+
maxLineY,
|
|
2916
|
+
minLineY: 0,
|
|
2917
|
+
root
|
|
2916
2918
|
};
|
|
2917
2919
|
};
|
|
2918
2920
|
|
|
2919
2921
|
const updateIcons = async state => {
|
|
2920
2922
|
const {
|
|
2921
2923
|
items,
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
+
maxLineY,
|
|
2925
|
+
minLineY
|
|
2924
2926
|
} = state;
|
|
2925
2927
|
const visible = items.slice(minLineY, maxLineY);
|
|
2926
2928
|
const newFileIconCache = await getFileIcons(visible, Object.create(null));
|