@lvce-editor/source-control-worker 3.6.1 → 3.6.3
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 +210 -40
- 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
|
|
@@ -2689,12 +2727,13 @@ const handleButtonClick = async (state, clickedIndex) => {
|
|
|
2689
2727
|
|
|
2690
2728
|
const getIndex = (state, eventX, eventY) => {
|
|
2691
2729
|
const {
|
|
2730
|
+
deltaY,
|
|
2692
2731
|
headerHeight,
|
|
2693
2732
|
itemHeight,
|
|
2694
2733
|
y
|
|
2695
2734
|
} = state;
|
|
2696
2735
|
const relativeY = eventY - y - headerHeight;
|
|
2697
|
-
const index = Math.floor(relativeY / itemHeight);
|
|
2736
|
+
const index = Math.floor((relativeY + deltaY) / itemHeight);
|
|
2698
2737
|
return index;
|
|
2699
2738
|
};
|
|
2700
2739
|
|
|
@@ -2727,14 +2766,20 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2727
2766
|
actionsCache,
|
|
2728
2767
|
allGroups,
|
|
2729
2768
|
fileIconCache,
|
|
2769
|
+
headerHeight,
|
|
2730
2770
|
height,
|
|
2731
2771
|
iconDefinitions,
|
|
2732
|
-
itemHeight
|
|
2772
|
+
itemHeight,
|
|
2773
|
+
minimumSliderSize
|
|
2733
2774
|
} = state;
|
|
2734
2775
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2735
2776
|
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
2736
2777
|
const total = displayItems.length;
|
|
2737
|
-
const
|
|
2778
|
+
const availableListHeight = Math.max(height - headerHeight, 0);
|
|
2779
|
+
const listHeight = getListHeight(total, itemHeight, availableListHeight);
|
|
2780
|
+
const contentHeight = total * itemHeight;
|
|
2781
|
+
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
2782
|
+
const scrollBarHeight = getScrollBarSize(availableListHeight, contentHeight, minimumSliderSize);
|
|
2738
2783
|
const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
|
|
2739
2784
|
const minLineY = 0;
|
|
2740
2785
|
const maxLineY = Math.min(numberOfVisible, total);
|
|
@@ -2742,10 +2787,13 @@ const updateVisibleItems = async (state, expandedGroups) => {
|
|
|
2742
2787
|
return {
|
|
2743
2788
|
...state,
|
|
2744
2789
|
badgeCount,
|
|
2790
|
+
deltaY: 0,
|
|
2745
2791
|
expandedGroups,
|
|
2792
|
+
finalDeltaY,
|
|
2746
2793
|
items: displayItems,
|
|
2747
2794
|
maxLineY,
|
|
2748
2795
|
minLineY,
|
|
2796
|
+
scrollBarHeight,
|
|
2749
2797
|
visibleItems
|
|
2750
2798
|
};
|
|
2751
2799
|
};
|
|
@@ -2828,9 +2876,12 @@ const selectIndex = async (state, index) => {
|
|
|
2828
2876
|
};
|
|
2829
2877
|
|
|
2830
2878
|
const handleClickAt = async (state, eventX, eventY, name) => {
|
|
2879
|
+
const {
|
|
2880
|
+
minLineY
|
|
2881
|
+
} = state;
|
|
2831
2882
|
const index = getIndex(state, eventX, eventY);
|
|
2832
2883
|
if (name) {
|
|
2833
|
-
return handleClickSourceControlButtons(state, index, name);
|
|
2884
|
+
return handleClickSourceControlButtons(state, index - minLineY, name);
|
|
2834
2885
|
}
|
|
2835
2886
|
return selectIndex(state, index);
|
|
2836
2887
|
};
|
|
@@ -2904,18 +2955,10 @@ const handleMouseOverAt = async (state, eventX, eventY) => {
|
|
|
2904
2955
|
return handleMouseOver(state, index);
|
|
2905
2956
|
};
|
|
2906
2957
|
|
|
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, {});
|
|
2958
|
+
const handleScrollBarCaptureLost = state => {
|
|
2915
2959
|
return {
|
|
2916
|
-
...
|
|
2917
|
-
|
|
2918
|
-
inputValue: ''
|
|
2960
|
+
...state,
|
|
2961
|
+
scrollBarActive: false
|
|
2919
2962
|
};
|
|
2920
2963
|
};
|
|
2921
2964
|
|
|
@@ -2923,12 +2966,13 @@ const setDeltaY = async (state, newDeltaY) => {
|
|
|
2923
2966
|
const {
|
|
2924
2967
|
actionsCache,
|
|
2925
2968
|
fileIconCache,
|
|
2969
|
+
finalDeltaY,
|
|
2926
2970
|
headerHeight,
|
|
2927
2971
|
height,
|
|
2928
2972
|
itemHeight,
|
|
2929
2973
|
items
|
|
2930
2974
|
} = state;
|
|
2931
|
-
const normalizedDeltaY = Math.max(newDeltaY, 0);
|
|
2975
|
+
const normalizedDeltaY = Math.min(Math.max(newDeltaY, 0), finalDeltaY);
|
|
2932
2976
|
const newMinLineY = Math.floor(normalizedDeltaY / itemHeight);
|
|
2933
2977
|
const total = items.length;
|
|
2934
2978
|
const listHeight = height - headerHeight;
|
|
@@ -2937,13 +2981,79 @@ const setDeltaY = async (state, newDeltaY) => {
|
|
|
2937
2981
|
const visible = getVisibleSourceControlItems(items, newMinLineY, maxLineY, actionsCache, fileIconCache);
|
|
2938
2982
|
return {
|
|
2939
2983
|
...state,
|
|
2940
|
-
deltaY:
|
|
2984
|
+
deltaY: normalizedDeltaY,
|
|
2941
2985
|
maxLineY,
|
|
2942
2986
|
minLineY: newMinLineY,
|
|
2943
2987
|
visibleItems: visible
|
|
2944
2988
|
};
|
|
2945
2989
|
};
|
|
2946
2990
|
|
|
2991
|
+
const handleScrollBarClick = async (state, eventY) => {
|
|
2992
|
+
const {
|
|
2993
|
+
deltaY,
|
|
2994
|
+
finalDeltaY,
|
|
2995
|
+
headerHeight,
|
|
2996
|
+
height,
|
|
2997
|
+
scrollBarHeight,
|
|
2998
|
+
y
|
|
2999
|
+
} = state;
|
|
3000
|
+
const listHeight = Math.max(height - headerHeight, 0);
|
|
3001
|
+
const relativeY = eventY - y - headerHeight;
|
|
3002
|
+
const currentScrollBarY = getScrollBarY(deltaY, finalDeltaY, listHeight, scrollBarHeight);
|
|
3003
|
+
const offsetInThumb = relativeY - currentScrollBarY;
|
|
3004
|
+
if (offsetInThumb >= 0 && offsetInThumb < scrollBarHeight) {
|
|
3005
|
+
return {
|
|
3006
|
+
...state,
|
|
3007
|
+
handleOffset: offsetInThumb,
|
|
3008
|
+
scrollBarActive: true
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
const {
|
|
3012
|
+
handleOffset,
|
|
3013
|
+
percent
|
|
3014
|
+
} = getNewDeltaPercent(listHeight, scrollBarHeight, relativeY);
|
|
3015
|
+
return {
|
|
3016
|
+
...(await setDeltaY(state, percent * finalDeltaY)),
|
|
3017
|
+
handleOffset,
|
|
3018
|
+
scrollBarActive: true
|
|
3019
|
+
};
|
|
3020
|
+
};
|
|
3021
|
+
|
|
3022
|
+
const handleScrollBarMove = async (state, eventY) => {
|
|
3023
|
+
const {
|
|
3024
|
+
finalDeltaY,
|
|
3025
|
+
handleOffset,
|
|
3026
|
+
headerHeight,
|
|
3027
|
+
height,
|
|
3028
|
+
scrollBarActive,
|
|
3029
|
+
scrollBarHeight,
|
|
3030
|
+
y
|
|
3031
|
+
} = state;
|
|
3032
|
+
if (!scrollBarActive) {
|
|
3033
|
+
return state;
|
|
3034
|
+
}
|
|
3035
|
+
const listHeight = Math.max(height - headerHeight, 0);
|
|
3036
|
+
const relativeY = eventY - y - headerHeight - handleOffset;
|
|
3037
|
+
const availableTrackHeight = listHeight - scrollBarHeight;
|
|
3038
|
+
const percent = availableTrackHeight <= 0 ? 0 : relativeY / availableTrackHeight;
|
|
3039
|
+
return setDeltaY(state, percent * finalDeltaY);
|
|
3040
|
+
};
|
|
3041
|
+
|
|
3042
|
+
const handleSourceControlButtonClick = async (state, name) => {
|
|
3043
|
+
const button = state.sourceControlButtons.find(button => button.label === name);
|
|
3044
|
+
if (!button) {
|
|
3045
|
+
warn(`[source-control-worker] Source control button not found ${name}`);
|
|
3046
|
+
return state;
|
|
3047
|
+
}
|
|
3048
|
+
await executeCommand(button.command, state.assetDir, state.platform, state.inputValue);
|
|
3049
|
+
const newState = await loadContent(state, {});
|
|
3050
|
+
return {
|
|
3051
|
+
...newState,
|
|
3052
|
+
inputMessage: '',
|
|
3053
|
+
inputValue: ''
|
|
3054
|
+
};
|
|
3055
|
+
};
|
|
3056
|
+
|
|
2947
3057
|
const handleWheel = async (state, deltaMode, deltaY) => {
|
|
2948
3058
|
return setDeltaY(state, state.deltaY + deltaY);
|
|
2949
3059
|
};
|
|
@@ -3053,21 +3163,36 @@ const getUnique = items => {
|
|
|
3053
3163
|
|
|
3054
3164
|
const renderCss = (oldState, newState) => {
|
|
3055
3165
|
const {
|
|
3166
|
+
deltaY,
|
|
3167
|
+
finalDeltaY,
|
|
3168
|
+
headerHeight,
|
|
3169
|
+
height,
|
|
3056
3170
|
id,
|
|
3057
3171
|
inputBoxHeight,
|
|
3172
|
+
itemHeight,
|
|
3173
|
+
scrollBarHeight,
|
|
3058
3174
|
visibleItems
|
|
3059
3175
|
} = newState;
|
|
3060
3176
|
const indents = visibleItems.map(item => item.indent);
|
|
3061
3177
|
const uniqueIndents = getUnique(indents);
|
|
3062
3178
|
const indentRules = uniqueIndents.map(getIndentRule).join('\n');
|
|
3063
|
-
const
|
|
3179
|
+
const listHeight = Math.max(height - headerHeight, 0);
|
|
3180
|
+
const scrollBarY = scrollBarHeight > 0 ? getScrollBarY(deltaY, finalDeltaY, listHeight, scrollBarHeight) : 0;
|
|
3181
|
+
const itemOffset = -(deltaY % itemHeight);
|
|
3182
|
+
const indentCss = indentRules ? `\n${indentRules}\n` : '';
|
|
3183
|
+
const css = `:root {
|
|
3064
3184
|
--SourceControlInputHeight: ${inputBoxHeight}px;
|
|
3065
3185
|
}
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3186
|
+
|
|
3187
|
+
.SourceControl .ScrollBarThumb {
|
|
3188
|
+
height: ${scrollBarHeight}px;
|
|
3189
|
+
translate: 0 ${Math.round(scrollBarY)}px;
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
.SourceControlItems > .TreeItem:first-child {
|
|
3193
|
+
margin-top: ${itemOffset}px;
|
|
3069
3194
|
}
|
|
3070
|
-
`;
|
|
3195
|
+
${indentCss}`;
|
|
3071
3196
|
return [SetCss, id, css];
|
|
3072
3197
|
};
|
|
3073
3198
|
|
|
@@ -3090,9 +3215,14 @@ const IconButton = 'IconButton';
|
|
|
3090
3215
|
const InputBox = 'InputBox';
|
|
3091
3216
|
const Label = 'Label';
|
|
3092
3217
|
const LabelDetail = 'LabelDetail';
|
|
3218
|
+
const List = 'List';
|
|
3093
3219
|
const Message = 'Message';
|
|
3094
3220
|
const Progress = 'Progress';
|
|
3095
3221
|
const ProgressContainer = 'ProgressContainer';
|
|
3222
|
+
const ScrollBar = 'ScrollBar';
|
|
3223
|
+
const ScrollBarSmall = 'ScrollBarSmall';
|
|
3224
|
+
const ScrollBarThumb = 'ScrollBarThumb';
|
|
3225
|
+
const ScrollBarThumbActive = 'ScrollBarThumbActive';
|
|
3096
3226
|
const SourceControl = 'SourceControl';
|
|
3097
3227
|
const SourceControlButton = 'SourceControlButton';
|
|
3098
3228
|
const SourceControlHeader = 'SourceControlHeader';
|
|
@@ -3115,6 +3245,9 @@ const HandleMouseOverAt = 8;
|
|
|
3115
3245
|
const HandleWheel = 9;
|
|
3116
3246
|
const HandleClickAction = 10;
|
|
3117
3247
|
const HandleClickSourceControlButton = 11;
|
|
3248
|
+
const HandleScrollBarMove = 12;
|
|
3249
|
+
const HandleScrollBarPointerCaptureLost = 13;
|
|
3250
|
+
const HandleScrollBarPointerDown = 14;
|
|
3118
3251
|
|
|
3119
3252
|
const getProgressVirtualDom = () => {
|
|
3120
3253
|
return [{
|
|
@@ -3131,7 +3264,7 @@ const getProgressVirtualDom = () => {
|
|
|
3131
3264
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
3132
3265
|
return {
|
|
3133
3266
|
childCount: 0,
|
|
3134
|
-
className:
|
|
3267
|
+
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
3135
3268
|
role: None$1,
|
|
3136
3269
|
type
|
|
3137
3270
|
};
|
|
@@ -3197,6 +3330,22 @@ const getSourceControlHeaderVirtualDom = (inputPlaceholder, inputMessage) => {
|
|
|
3197
3330
|
}, ...inputDom];
|
|
3198
3331
|
};
|
|
3199
3332
|
|
|
3333
|
+
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarActive) => {
|
|
3334
|
+
if (scrollBarHeight <= 0) {
|
|
3335
|
+
return [];
|
|
3336
|
+
}
|
|
3337
|
+
return [{
|
|
3338
|
+
childCount: 1,
|
|
3339
|
+
className: mergeClassNames(ScrollBar, ScrollBarSmall),
|
|
3340
|
+
onPointerDown: HandleScrollBarPointerDown,
|
|
3341
|
+
type: Div
|
|
3342
|
+
}, {
|
|
3343
|
+
childCount: 0,
|
|
3344
|
+
className: mergeClassNames(ScrollBarThumb, scrollBarActive ? ScrollBarThumbActive : ''),
|
|
3345
|
+
type: Div
|
|
3346
|
+
}];
|
|
3347
|
+
};
|
|
3348
|
+
|
|
3200
3349
|
const className$1 = mergeClassNames(Badge, SourceControlBadge);
|
|
3201
3350
|
const parentNode = {
|
|
3202
3351
|
childCount: 1,
|
|
@@ -3372,8 +3521,13 @@ const getSourceControlItemVirtualDom = item => {
|
|
|
3372
3521
|
}
|
|
3373
3522
|
};
|
|
3374
3523
|
|
|
3375
|
-
const getSourceControlListVirtualDom = items => {
|
|
3524
|
+
const getSourceControlListVirtualDom = (items, scrollBarHeight, scrollBarActive) => {
|
|
3525
|
+
const scrollBarDom = getScrollBarVirtualDom(scrollBarHeight, scrollBarActive);
|
|
3376
3526
|
return [{
|
|
3527
|
+
childCount: scrollBarDom.length > 0 ? 2 : 1,
|
|
3528
|
+
className: mergeClassNames(Viewlet, List),
|
|
3529
|
+
type: Div
|
|
3530
|
+
}, {
|
|
3377
3531
|
childCount: items.length,
|
|
3378
3532
|
className: SourceControlItems,
|
|
3379
3533
|
onClick: HandleClickAt,
|
|
@@ -3381,18 +3535,18 @@ const getSourceControlListVirtualDom = items => {
|
|
|
3381
3535
|
onPointerOver: HandleMouseOverAt,
|
|
3382
3536
|
role: Tree$1,
|
|
3383
3537
|
type: Div
|
|
3384
|
-
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
3538
|
+
}, ...items.flatMap(getSourceControlItemVirtualDom), ...scrollBarDom];
|
|
3385
3539
|
};
|
|
3386
3540
|
|
|
3387
3541
|
const className = mergeClassNames(Viewlet, SourceControl);
|
|
3388
|
-
const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, inputMessage, message, loading) => {
|
|
3542
|
+
const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, inputMessage, message, loading, scrollBarHeight, scrollBarActive) => {
|
|
3389
3543
|
const content = message ? [{
|
|
3390
3544
|
childCount: 1,
|
|
3391
3545
|
className: Message,
|
|
3392
3546
|
paddingLeft: '20px',
|
|
3393
3547
|
paddingRight: '20px',
|
|
3394
3548
|
type: Div
|
|
3395
|
-
}, text(message)] : [...getSourceControlHeaderVirtualDom(placeholder, inputMessage), ...buttons.flatMap(button => getSourceControlButtonVirtualDom(button, disabled)), ...getSourceControlListVirtualDom(items)];
|
|
3549
|
+
}, text(message)] : [...getSourceControlHeaderVirtualDom(placeholder, inputMessage), ...buttons.flatMap(button => getSourceControlButtonVirtualDom(button, disabled)), ...getSourceControlListVirtualDom(items, scrollBarHeight, scrollBarActive)];
|
|
3396
3550
|
const progressDom = loading ? getProgressVirtualDom() : [];
|
|
3397
3551
|
const dom = [{
|
|
3398
3552
|
ariaBusy: loading,
|
|
@@ -3417,6 +3571,8 @@ const renderItems = (oldState, newState) => {
|
|
|
3417
3571
|
inputPlaceholder,
|
|
3418
3572
|
items,
|
|
3419
3573
|
loading,
|
|
3574
|
+
scrollBarActive,
|
|
3575
|
+
scrollBarHeight,
|
|
3420
3576
|
sourceControlButtons,
|
|
3421
3577
|
visibleItems
|
|
3422
3578
|
} = newState;
|
|
@@ -3424,7 +3580,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3424
3580
|
return [SetDom2, id, []];
|
|
3425
3581
|
}
|
|
3426
3582
|
const unavailableMessage = !loading && enabledProviderIds.length === 0 ? noSourceControlProvider() : '';
|
|
3427
|
-
const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, unavailableMessage, loading);
|
|
3583
|
+
const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, unavailableMessage, loading, scrollBarHeight, scrollBarActive);
|
|
3428
3584
|
return [SetDom2, id, dom];
|
|
3429
3585
|
};
|
|
3430
3586
|
|
|
@@ -3617,6 +3773,17 @@ const renderEventListeners = () => {
|
|
|
3617
3773
|
}, {
|
|
3618
3774
|
name: HandleClickSourceControlButton,
|
|
3619
3775
|
params: ['handleSourceControlButtonClick', TargetName]
|
|
3776
|
+
}, {
|
|
3777
|
+
name: HandleScrollBarPointerDown,
|
|
3778
|
+
params: ['handleScrollBarClick', ClientY],
|
|
3779
|
+
preventDefault: true,
|
|
3780
|
+
trackPointerEvents: [HandleScrollBarMove, HandleScrollBarPointerCaptureLost]
|
|
3781
|
+
}, {
|
|
3782
|
+
name: HandleScrollBarMove,
|
|
3783
|
+
params: ['handleScrollBarMove', ClientY]
|
|
3784
|
+
}, {
|
|
3785
|
+
name: HandleScrollBarPointerCaptureLost,
|
|
3786
|
+
params: ['handleScrollBarCaptureLost']
|
|
3620
3787
|
}];
|
|
3621
3788
|
};
|
|
3622
3789
|
|
|
@@ -3660,7 +3827,7 @@ const updateIcons = async state => {
|
|
|
3660
3827
|
const viewAsList = state => {
|
|
3661
3828
|
return {
|
|
3662
3829
|
...state,
|
|
3663
|
-
viewMode: List
|
|
3830
|
+
viewMode: List$1
|
|
3664
3831
|
};
|
|
3665
3832
|
};
|
|
3666
3833
|
|
|
@@ -3692,6 +3859,9 @@ const commandMap = {
|
|
|
3692
3859
|
'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
|
|
3693
3860
|
'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
|
|
3694
3861
|
'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
|
|
3862
|
+
'SourceControl.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
3863
|
+
'SourceControl.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
3864
|
+
'SourceControl.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
3695
3865
|
'SourceControl.handleSourceControlButtonClick': wrapCommand(handleSourceControlButtonClick),
|
|
3696
3866
|
'SourceControl.handleWheel': wrapCommand(handleWheel),
|
|
3697
3867
|
'SourceControl.handleWorkspaceRefresh': wrapCommand(handleWorkspaceRefresh),
|