@lvce-editor/source-control-worker 3.6.1 → 3.6.2
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 +204 -38
- package/package.json +1 -1
|
@@ -1087,6 +1087,7 @@ const Tree$1 = 'tree';
|
|
|
1087
1087
|
const TreeItem$1 = 'treeitem';
|
|
1088
1088
|
|
|
1089
1089
|
const Badge = 'Badge';
|
|
1090
|
+
const MaskIcon = 'MaskIcon';
|
|
1090
1091
|
const SourceControlBadge = 'SourceControlBadge';
|
|
1091
1092
|
|
|
1092
1093
|
const Directory = 3;
|
|
@@ -1133,7 +1134,7 @@ const SetDom2 = 'Viewlet.setDom2';
|
|
|
1133
1134
|
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1134
1135
|
const SetValueByName = 'Viewlet.setValueByName';
|
|
1135
1136
|
|
|
1136
|
-
const List = 1;
|
|
1137
|
+
const List$1 = 1;
|
|
1137
1138
|
const Tree = 2;
|
|
1138
1139
|
|
|
1139
1140
|
const FocusSourceControlInput = 24;
|
|
@@ -1832,11 +1833,38 @@ const restoreState = savedState => {
|
|
|
1832
1833
|
};
|
|
1833
1834
|
|
|
1834
1835
|
const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
1835
|
-
if (size >= contentSize) {
|
|
1836
|
+
if (size <= 0 || size >= contentSize) {
|
|
1836
1837
|
return 0;
|
|
1837
1838
|
}
|
|
1838
1839
|
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
1839
1840
|
};
|
|
1841
|
+
const getScrollBarOffset = (delta, finalDelta, size, scrollBarSize) => {
|
|
1842
|
+
const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
|
|
1843
|
+
return scrollBarOffset;
|
|
1844
|
+
};
|
|
1845
|
+
const getScrollBarY = getScrollBarOffset;
|
|
1846
|
+
const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
|
|
1847
|
+
const halfScrollBarHeight = scrollBarHeight / 2;
|
|
1848
|
+
if (relativeY <= halfScrollBarHeight) {
|
|
1849
|
+
// clicked at top
|
|
1850
|
+
return {
|
|
1851
|
+
handleOffset: relativeY,
|
|
1852
|
+
percent: 0
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
if (relativeY <= height - halfScrollBarHeight) {
|
|
1856
|
+
// clicked in middle
|
|
1857
|
+
return {
|
|
1858
|
+
handleOffset: halfScrollBarHeight,
|
|
1859
|
+
percent: (relativeY - halfScrollBarHeight) / (height - scrollBarHeight)
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
// clicked at bottom
|
|
1863
|
+
return {
|
|
1864
|
+
handleOffset: scrollBarHeight - height + relativeY,
|
|
1865
|
+
percent: 1
|
|
1866
|
+
};
|
|
1867
|
+
};
|
|
1840
1868
|
|
|
1841
1869
|
const emptyObject = {};
|
|
1842
1870
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
@@ -1951,19 +1979,20 @@ const loadContent = async (state, savedState) => {
|
|
|
1951
1979
|
// TODO make preferences async and more functional
|
|
1952
1980
|
const splitButtonEnabled = await get$1('sourceControl.splitButtonEnabled');
|
|
1953
1981
|
const badgeCount = await getBadgeCount$1(enabledProviderIds, assetDir, platform);
|
|
1982
|
+
const inputPlaceholder = messageEnterToCommitOnMaster();
|
|
1983
|
+
const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
1984
|
+
const headerHeight = getHeaderHeight(inputBoxHeight, sourceControlButtons);
|
|
1954
1985
|
const total = displayItems.length;
|
|
1955
1986
|
const contentHeight = total * itemHeight;
|
|
1956
|
-
const
|
|
1957
|
-
const
|
|
1987
|
+
const availableListHeight = Math.max(height - headerHeight, 0);
|
|
1988
|
+
const listHeight = getListHeight(total, itemHeight, availableListHeight);
|
|
1989
|
+
const scrollBarHeight = getScrollBarSize(availableListHeight, contentHeight, minimumSliderSize);
|
|
1958
1990
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
1959
1991
|
const minLineY = 0;
|
|
1960
1992
|
const maxLineY = Math.min(numberOfVisible, total);
|
|
1961
1993
|
const newFileIconCache = await getFileIcons(displayItems, fileIconCache);
|
|
1962
1994
|
const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, newFileIconCache);
|
|
1963
1995
|
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
1964
|
-
const inputPlaceholder = messageEnterToCommitOnMaster();
|
|
1965
|
-
const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
1966
|
-
const headerHeight = getHeaderHeight(inputBoxHeight, sourceControlButtons);
|
|
1967
1996
|
return {
|
|
1968
1997
|
...state,
|
|
1969
1998
|
actionsCache,
|
|
@@ -2115,8 +2144,13 @@ const create2 = (id, _uri, x, y, width, height, workspacePath, platform, assetDi
|
|
|
2115
2144
|
}, state);
|
|
2116
2145
|
};
|
|
2117
2146
|
|
|
2147
|
+
const haveSameIndents = (oldState, newState) => {
|
|
2148
|
+
const oldItems = oldState.visibleItems;
|
|
2149
|
+
const newItems = newState.visibleItems;
|
|
2150
|
+
return oldItems.length === newItems.length && oldItems.every((item, index) => item.indent === newItems[index].indent);
|
|
2151
|
+
};
|
|
2118
2152
|
const isEqual$4 = (oldState, newState) => {
|
|
2119
|
-
return oldState.inputBoxHeight === newState.inputBoxHeight;
|
|
2153
|
+
return oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.headerHeight === newState.headerHeight && oldState.height === newState.height && oldState.inputBoxHeight === newState.inputBoxHeight && oldState.itemHeight === newState.itemHeight && oldState.scrollBarHeight === newState.scrollBarHeight && haveSameIndents(oldState, newState);
|
|
2120
2154
|
};
|
|
2121
2155
|
|
|
2122
2156
|
const isEqual$3 = (oldState, newState) => {
|
|
@@ -2124,7 +2158,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
2124
2158
|
};
|
|
2125
2159
|
|
|
2126
2160
|
const isEqual$2 = (oldState, newState) => {
|
|
2127
|
-
return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.loading === newState.loading && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.sourceControlButtons === newState.sourceControlButtons && oldState.visibleItems === newState.visibleItems;
|
|
2161
|
+
return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.loading === newState.loading && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.scrollBarActive === newState.scrollBarActive && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.sourceControlButtons === newState.sourceControlButtons && oldState.visibleItems === newState.visibleItems;
|
|
2128
2162
|
};
|
|
2129
2163
|
|
|
2130
2164
|
const RenderItems = 4;
|
|
@@ -2597,6 +2631,7 @@ const refresh = async state => {
|
|
|
2597
2631
|
assetDir,
|
|
2598
2632
|
enabledProviderIds,
|
|
2599
2633
|
fileIconCache,
|
|
2634
|
+
headerHeight,
|
|
2600
2635
|
height,
|
|
2601
2636
|
iconDefinitions,
|
|
2602
2637
|
itemHeight,
|
|
@@ -2614,8 +2649,9 @@ const refresh = async state => {
|
|
|
2614
2649
|
const badgeCount = await getBadgeCount$1(enabledProviderIds, assetDir, platform);
|
|
2615
2650
|
const total = displayItems.length;
|
|
2616
2651
|
const contentHeight = total * itemHeight;
|
|
2617
|
-
const
|
|
2618
|
-
const
|
|
2652
|
+
const availableListHeight = Math.max(height - headerHeight, 0);
|
|
2653
|
+
const listHeight = getListHeight(total, itemHeight, availableListHeight);
|
|
2654
|
+
const scrollBarHeight = getScrollBarSize(availableListHeight, contentHeight, minimumSliderSize);
|
|
2619
2655
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
2620
2656
|
const minLineY = 0;
|
|
2621
2657
|
const maxLineY = Math.min(numberOfVisible, total);
|
|
@@ -2627,12 +2663,14 @@ const refresh = async state => {
|
|
|
2627
2663
|
actionsCache,
|
|
2628
2664
|
allGroups,
|
|
2629
2665
|
badgeCount,
|
|
2666
|
+
deltaY: 0,
|
|
2630
2667
|
enabledProviderIds,
|
|
2631
2668
|
fileIconCache: newFileIconCache,
|
|
2632
2669
|
finalDeltaY,
|
|
2633
2670
|
gitRoot,
|
|
2634
2671
|
items: displayItems,
|
|
2635
2672
|
maxLineY,
|
|
2673
|
+
minLineY,
|
|
2636
2674
|
scrollBarHeight,
|
|
2637
2675
|
splitButtonEnabled,
|
|
2638
2676
|
visibleItems
|
|
@@ -2727,14 +2765,20 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2727
2765
|
actionsCache,
|
|
2728
2766
|
allGroups,
|
|
2729
2767
|
fileIconCache,
|
|
2768
|
+
headerHeight,
|
|
2730
2769
|
height,
|
|
2731
2770
|
iconDefinitions,
|
|
2732
|
-
itemHeight
|
|
2771
|
+
itemHeight,
|
|
2772
|
+
minimumSliderSize
|
|
2733
2773
|
} = state;
|
|
2734
2774
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2735
2775
|
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
2736
2776
|
const total = displayItems.length;
|
|
2737
|
-
const
|
|
2777
|
+
const availableListHeight = Math.max(height - headerHeight, 0);
|
|
2778
|
+
const listHeight = getListHeight(total, itemHeight, availableListHeight);
|
|
2779
|
+
const contentHeight = total * itemHeight;
|
|
2780
|
+
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
2781
|
+
const scrollBarHeight = getScrollBarSize(availableListHeight, contentHeight, minimumSliderSize);
|
|
2738
2782
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
2739
2783
|
const minLineY = 0;
|
|
2740
2784
|
const maxLineY = Math.min(numberOfVisible, total);
|
|
@@ -2742,10 +2786,13 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2742
2786
|
return {
|
|
2743
2787
|
...state,
|
|
2744
2788
|
badgeCount,
|
|
2789
|
+
deltaY: 0,
|
|
2745
2790
|
expandedGroups,
|
|
2791
|
+
finalDeltaY,
|
|
2746
2792
|
items: displayItems,
|
|
2747
2793
|
maxLineY,
|
|
2748
2794
|
minLineY,
|
|
2795
|
+
scrollBarHeight,
|
|
2749
2796
|
visibleItems
|
|
2750
2797
|
};
|
|
2751
2798
|
};
|
|
@@ -2904,18 +2951,10 @@ const handleMouseOverAt = async (state, eventX, eventY) => {
|
|
|
2904
2951
|
return handleMouseOver(state, index);
|
|
2905
2952
|
};
|
|
2906
2953
|
|
|
2907
|
-
const
|
|
2908
|
-
const button = state.sourceControlButtons.find(button => button.label === name);
|
|
2909
|
-
if (!button) {
|
|
2910
|
-
warn(`[source-control-worker] Source control button not found ${name}`);
|
|
2911
|
-
return state;
|
|
2912
|
-
}
|
|
2913
|
-
await executeCommand(button.command, state.assetDir, state.platform, state.inputValue);
|
|
2914
|
-
const newState = await loadContent(state, {});
|
|
2954
|
+
const handleScrollBarCaptureLost = state => {
|
|
2915
2955
|
return {
|
|
2916
|
-
...
|
|
2917
|
-
|
|
2918
|
-
inputValue: ''
|
|
2956
|
+
...state,
|
|
2957
|
+
scrollBarActive: false
|
|
2919
2958
|
};
|
|
2920
2959
|
};
|
|
2921
2960
|
|
|
@@ -2923,12 +2962,13 @@ const setDeltaY = async (state, newDeltaY) => {
|
|
|
2923
2962
|
const {
|
|
2924
2963
|
actionsCache,
|
|
2925
2964
|
fileIconCache,
|
|
2965
|
+
finalDeltaY,
|
|
2926
2966
|
headerHeight,
|
|
2927
2967
|
height,
|
|
2928
2968
|
itemHeight,
|
|
2929
2969
|
items
|
|
2930
2970
|
} = state;
|
|
2931
|
-
const normalizedDeltaY = Math.max(newDeltaY, 0);
|
|
2971
|
+
const normalizedDeltaY = Math.min(Math.max(newDeltaY, 0), finalDeltaY);
|
|
2932
2972
|
const newMinLineY = Math.floor(normalizedDeltaY / itemHeight);
|
|
2933
2973
|
const total = items.length;
|
|
2934
2974
|
const listHeight = height - headerHeight;
|
|
@@ -2937,13 +2977,79 @@ const setDeltaY = async (state, newDeltaY) => {
|
|
|
2937
2977
|
const visible = getVisibleSourceControlItems(items, newMinLineY, maxLineY, actionsCache, fileIconCache);
|
|
2938
2978
|
return {
|
|
2939
2979
|
...state,
|
|
2940
|
-
deltaY:
|
|
2980
|
+
deltaY: normalizedDeltaY,
|
|
2941
2981
|
maxLineY,
|
|
2942
2982
|
minLineY: newMinLineY,
|
|
2943
2983
|
visibleItems: visible
|
|
2944
2984
|
};
|
|
2945
2985
|
};
|
|
2946
2986
|
|
|
2987
|
+
const handleScrollBarClick = async (state, eventY) => {
|
|
2988
|
+
const {
|
|
2989
|
+
deltaY,
|
|
2990
|
+
finalDeltaY,
|
|
2991
|
+
headerHeight,
|
|
2992
|
+
height,
|
|
2993
|
+
scrollBarHeight,
|
|
2994
|
+
y
|
|
2995
|
+
} = state;
|
|
2996
|
+
const listHeight = Math.max(height - headerHeight, 0);
|
|
2997
|
+
const relativeY = eventY - y - headerHeight;
|
|
2998
|
+
const currentScrollBarY = getScrollBarY(deltaY, finalDeltaY, listHeight, scrollBarHeight);
|
|
2999
|
+
const offsetInThumb = relativeY - currentScrollBarY;
|
|
3000
|
+
if (offsetInThumb >= 0 && offsetInThumb < scrollBarHeight) {
|
|
3001
|
+
return {
|
|
3002
|
+
...state,
|
|
3003
|
+
handleOffset: offsetInThumb,
|
|
3004
|
+
scrollBarActive: true
|
|
3005
|
+
};
|
|
3006
|
+
}
|
|
3007
|
+
const {
|
|
3008
|
+
handleOffset,
|
|
3009
|
+
percent
|
|
3010
|
+
} = getNewDeltaPercent(listHeight, scrollBarHeight, relativeY);
|
|
3011
|
+
return {
|
|
3012
|
+
...(await setDeltaY(state, percent * finalDeltaY)),
|
|
3013
|
+
handleOffset,
|
|
3014
|
+
scrollBarActive: true
|
|
3015
|
+
};
|
|
3016
|
+
};
|
|
3017
|
+
|
|
3018
|
+
const handleScrollBarMove = async (state, eventY) => {
|
|
3019
|
+
const {
|
|
3020
|
+
finalDeltaY,
|
|
3021
|
+
handleOffset,
|
|
3022
|
+
headerHeight,
|
|
3023
|
+
height,
|
|
3024
|
+
scrollBarActive,
|
|
3025
|
+
scrollBarHeight,
|
|
3026
|
+
y
|
|
3027
|
+
} = state;
|
|
3028
|
+
if (!scrollBarActive) {
|
|
3029
|
+
return state;
|
|
3030
|
+
}
|
|
3031
|
+
const listHeight = Math.max(height - headerHeight, 0);
|
|
3032
|
+
const relativeY = eventY - y - headerHeight - handleOffset;
|
|
3033
|
+
const availableTrackHeight = listHeight - scrollBarHeight;
|
|
3034
|
+
const percent = availableTrackHeight <= 0 ? 0 : relativeY / availableTrackHeight;
|
|
3035
|
+
return setDeltaY(state, percent * finalDeltaY);
|
|
3036
|
+
};
|
|
3037
|
+
|
|
3038
|
+
const handleSourceControlButtonClick = async (state, name) => {
|
|
3039
|
+
const button = state.sourceControlButtons.find(button => button.label === name);
|
|
3040
|
+
if (!button) {
|
|
3041
|
+
warn(`[source-control-worker] Source control button not found ${name}`);
|
|
3042
|
+
return state;
|
|
3043
|
+
}
|
|
3044
|
+
await executeCommand(button.command, state.assetDir, state.platform, state.inputValue);
|
|
3045
|
+
const newState = await loadContent(state, {});
|
|
3046
|
+
return {
|
|
3047
|
+
...newState,
|
|
3048
|
+
inputMessage: '',
|
|
3049
|
+
inputValue: ''
|
|
3050
|
+
};
|
|
3051
|
+
};
|
|
3052
|
+
|
|
2947
3053
|
const handleWheel = async (state, deltaMode, deltaY) => {
|
|
2948
3054
|
return setDeltaY(state, state.deltaY + deltaY);
|
|
2949
3055
|
};
|
|
@@ -3053,21 +3159,36 @@ const getUnique = items => {
|
|
|
3053
3159
|
|
|
3054
3160
|
const renderCss = (oldState, newState) => {
|
|
3055
3161
|
const {
|
|
3162
|
+
deltaY,
|
|
3163
|
+
finalDeltaY,
|
|
3164
|
+
headerHeight,
|
|
3165
|
+
height,
|
|
3056
3166
|
id,
|
|
3057
3167
|
inputBoxHeight,
|
|
3168
|
+
itemHeight,
|
|
3169
|
+
scrollBarHeight,
|
|
3058
3170
|
visibleItems
|
|
3059
3171
|
} = newState;
|
|
3060
3172
|
const indents = visibleItems.map(item => item.indent);
|
|
3061
3173
|
const uniqueIndents = getUnique(indents);
|
|
3062
3174
|
const indentRules = uniqueIndents.map(getIndentRule).join('\n');
|
|
3063
|
-
const
|
|
3175
|
+
const listHeight = Math.max(height - headerHeight, 0);
|
|
3176
|
+
const scrollBarY = scrollBarHeight > 0 ? getScrollBarY(deltaY, finalDeltaY, listHeight, scrollBarHeight) : 0;
|
|
3177
|
+
const itemOffset = -(deltaY % itemHeight);
|
|
3178
|
+
const indentCss = indentRules ? `\n${indentRules}\n` : '';
|
|
3179
|
+
const css = `:root {
|
|
3064
3180
|
--SourceControlInputHeight: ${inputBoxHeight}px;
|
|
3065
3181
|
}
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3182
|
+
|
|
3183
|
+
.SourceControl .ScrollBarThumb {
|
|
3184
|
+
height: ${scrollBarHeight}px;
|
|
3185
|
+
translate: 0 ${Math.round(scrollBarY)}px;
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
.SourceControlItems > .TreeItem:first-child {
|
|
3189
|
+
margin-top: ${itemOffset}px;
|
|
3069
3190
|
}
|
|
3070
|
-
`;
|
|
3191
|
+
${indentCss}`;
|
|
3071
3192
|
return [SetCss, id, css];
|
|
3072
3193
|
};
|
|
3073
3194
|
|
|
@@ -3090,9 +3211,14 @@ const IconButton = 'IconButton';
|
|
|
3090
3211
|
const InputBox = 'InputBox';
|
|
3091
3212
|
const Label = 'Label';
|
|
3092
3213
|
const LabelDetail = 'LabelDetail';
|
|
3214
|
+
const List = 'List';
|
|
3093
3215
|
const Message = 'Message';
|
|
3094
3216
|
const Progress = 'Progress';
|
|
3095
3217
|
const ProgressContainer = 'ProgressContainer';
|
|
3218
|
+
const ScrollBar = 'ScrollBar';
|
|
3219
|
+
const ScrollBarSmall = 'ScrollBarSmall';
|
|
3220
|
+
const ScrollBarThumb = 'ScrollBarThumb';
|
|
3221
|
+
const ScrollBarThumbActive = 'ScrollBarThumbActive';
|
|
3096
3222
|
const SourceControl = 'SourceControl';
|
|
3097
3223
|
const SourceControlButton = 'SourceControlButton';
|
|
3098
3224
|
const SourceControlHeader = 'SourceControlHeader';
|
|
@@ -3115,6 +3241,9 @@ const HandleMouseOverAt = 8;
|
|
|
3115
3241
|
const HandleWheel = 9;
|
|
3116
3242
|
const HandleClickAction = 10;
|
|
3117
3243
|
const HandleClickSourceControlButton = 11;
|
|
3244
|
+
const HandleScrollBarMove = 12;
|
|
3245
|
+
const HandleScrollBarPointerCaptureLost = 13;
|
|
3246
|
+
const HandleScrollBarPointerDown = 14;
|
|
3118
3247
|
|
|
3119
3248
|
const getProgressVirtualDom = () => {
|
|
3120
3249
|
return [{
|
|
@@ -3131,7 +3260,7 @@ const getProgressVirtualDom = () => {
|
|
|
3131
3260
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
3132
3261
|
return {
|
|
3133
3262
|
childCount: 0,
|
|
3134
|
-
className:
|
|
3263
|
+
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
3135
3264
|
role: None$1,
|
|
3136
3265
|
type
|
|
3137
3266
|
};
|
|
@@ -3197,6 +3326,22 @@ const getSourceControlHeaderVirtualDom = (inputPlaceholder, inputMessage) => {
|
|
|
3197
3326
|
}, ...inputDom];
|
|
3198
3327
|
};
|
|
3199
3328
|
|
|
3329
|
+
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarActive) => {
|
|
3330
|
+
if (scrollBarHeight <= 0) {
|
|
3331
|
+
return [];
|
|
3332
|
+
}
|
|
3333
|
+
return [{
|
|
3334
|
+
childCount: 1,
|
|
3335
|
+
className: mergeClassNames(ScrollBar, ScrollBarSmall),
|
|
3336
|
+
onPointerDown: HandleScrollBarPointerDown,
|
|
3337
|
+
type: Div
|
|
3338
|
+
}, {
|
|
3339
|
+
childCount: 0,
|
|
3340
|
+
className: mergeClassNames(ScrollBarThumb, scrollBarActive ? ScrollBarThumbActive : ''),
|
|
3341
|
+
type: Div
|
|
3342
|
+
}];
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3200
3345
|
const className$1 = mergeClassNames(Badge, SourceControlBadge);
|
|
3201
3346
|
const parentNode = {
|
|
3202
3347
|
childCount: 1,
|
|
@@ -3372,8 +3517,13 @@ const getSourceControlItemVirtualDom = item => {
|
|
|
3372
3517
|
}
|
|
3373
3518
|
};
|
|
3374
3519
|
|
|
3375
|
-
const getSourceControlListVirtualDom = items => {
|
|
3520
|
+
const getSourceControlListVirtualDom = (items, scrollBarHeight, scrollBarActive) => {
|
|
3521
|
+
const scrollBarDom = getScrollBarVirtualDom(scrollBarHeight, scrollBarActive);
|
|
3376
3522
|
return [{
|
|
3523
|
+
childCount: scrollBarDom.length > 0 ? 2 : 1,
|
|
3524
|
+
className: mergeClassNames(Viewlet, List),
|
|
3525
|
+
type: Div
|
|
3526
|
+
}, {
|
|
3377
3527
|
childCount: items.length,
|
|
3378
3528
|
className: SourceControlItems,
|
|
3379
3529
|
onClick: HandleClickAt,
|
|
@@ -3381,18 +3531,18 @@ const getSourceControlListVirtualDom = items => {
|
|
|
3381
3531
|
onPointerOver: HandleMouseOverAt,
|
|
3382
3532
|
role: Tree$1,
|
|
3383
3533
|
type: Div
|
|
3384
|
-
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
3534
|
+
}, ...items.flatMap(getSourceControlItemVirtualDom), ...scrollBarDom];
|
|
3385
3535
|
};
|
|
3386
3536
|
|
|
3387
3537
|
const className = mergeClassNames(Viewlet, SourceControl);
|
|
3388
|
-
const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, inputMessage, message, loading) => {
|
|
3538
|
+
const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, inputMessage, message, loading, scrollBarHeight, scrollBarActive) => {
|
|
3389
3539
|
const content = message ? [{
|
|
3390
3540
|
childCount: 1,
|
|
3391
3541
|
className: Message,
|
|
3392
3542
|
paddingLeft: '20px',
|
|
3393
3543
|
paddingRight: '20px',
|
|
3394
3544
|
type: Div
|
|
3395
|
-
}, text(message)] : [...getSourceControlHeaderVirtualDom(placeholder, inputMessage), ...buttons.flatMap(button => getSourceControlButtonVirtualDom(button, disabled)), ...getSourceControlListVirtualDom(items)];
|
|
3545
|
+
}, text(message)] : [...getSourceControlHeaderVirtualDom(placeholder, inputMessage), ...buttons.flatMap(button => getSourceControlButtonVirtualDom(button, disabled)), ...getSourceControlListVirtualDom(items, scrollBarHeight, scrollBarActive)];
|
|
3396
3546
|
const progressDom = loading ? getProgressVirtualDom() : [];
|
|
3397
3547
|
const dom = [{
|
|
3398
3548
|
ariaBusy: loading,
|
|
@@ -3417,6 +3567,8 @@ const renderItems = (oldState, newState) => {
|
|
|
3417
3567
|
inputPlaceholder,
|
|
3418
3568
|
items,
|
|
3419
3569
|
loading,
|
|
3570
|
+
scrollBarActive,
|
|
3571
|
+
scrollBarHeight,
|
|
3420
3572
|
sourceControlButtons,
|
|
3421
3573
|
visibleItems
|
|
3422
3574
|
} = newState;
|
|
@@ -3424,7 +3576,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3424
3576
|
return [SetDom2, id, []];
|
|
3425
3577
|
}
|
|
3426
3578
|
const unavailableMessage = !loading && enabledProviderIds.length === 0 ? noSourceControlProvider() : '';
|
|
3427
|
-
const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, unavailableMessage, loading);
|
|
3579
|
+
const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, unavailableMessage, loading, scrollBarHeight, scrollBarActive);
|
|
3428
3580
|
return [SetDom2, id, dom];
|
|
3429
3581
|
};
|
|
3430
3582
|
|
|
@@ -3617,6 +3769,17 @@ const renderEventListeners = () => {
|
|
|
3617
3769
|
}, {
|
|
3618
3770
|
name: HandleClickSourceControlButton,
|
|
3619
3771
|
params: ['handleSourceControlButtonClick', TargetName]
|
|
3772
|
+
}, {
|
|
3773
|
+
name: HandleScrollBarPointerDown,
|
|
3774
|
+
params: ['handleScrollBarClick', ClientY],
|
|
3775
|
+
preventDefault: true,
|
|
3776
|
+
trackPointerEvents: [HandleScrollBarMove, HandleScrollBarPointerCaptureLost]
|
|
3777
|
+
}, {
|
|
3778
|
+
name: HandleScrollBarMove,
|
|
3779
|
+
params: ['handleScrollBarMove', ClientY]
|
|
3780
|
+
}, {
|
|
3781
|
+
name: HandleScrollBarPointerCaptureLost,
|
|
3782
|
+
params: ['handleScrollBarCaptureLost']
|
|
3620
3783
|
}];
|
|
3621
3784
|
};
|
|
3622
3785
|
|
|
@@ -3660,7 +3823,7 @@ const updateIcons = async state => {
|
|
|
3660
3823
|
const viewAsList = state => {
|
|
3661
3824
|
return {
|
|
3662
3825
|
...state,
|
|
3663
|
-
viewMode: List
|
|
3826
|
+
viewMode: List$1
|
|
3664
3827
|
};
|
|
3665
3828
|
};
|
|
3666
3829
|
|
|
@@ -3692,6 +3855,9 @@ const commandMap = {
|
|
|
3692
3855
|
'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
|
|
3693
3856
|
'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
|
|
3694
3857
|
'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
|
|
3858
|
+
'SourceControl.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
3859
|
+
'SourceControl.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
3860
|
+
'SourceControl.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
3695
3861
|
'SourceControl.handleSourceControlButtonClick': wrapCommand(handleSourceControlButtonClick),
|
|
3696
3862
|
'SourceControl.handleWheel': wrapCommand(handleWheel),
|
|
3697
3863
|
'SourceControl.handleWorkspaceRefresh': wrapCommand(handleWorkspaceRefresh),
|