@lvce-editor/source-control-worker 3.6.0 → 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.
@@ -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 listHeight = getListHeight(total, itemHeight, height);
1957
- const scrollBarHeight = getScrollBarSize(height, contentHeight, minimumSliderSize);
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,
@@ -1981,6 +2010,7 @@ const loadContent = async (state, savedState) => {
1981
2010
  inputPlaceholder,
1982
2011
  inputValue,
1983
2012
  items: displayItems,
2013
+ loading: false,
1984
2014
  maxLineY,
1985
2015
  root,
1986
2016
  scrollBarHeight,
@@ -2059,6 +2089,7 @@ const createDefaultState = () => ({
2059
2089
  isVisible: true,
2060
2090
  itemHeight: 20,
2061
2091
  items: [],
2092
+ loading: false,
2062
2093
  maxInputLines: 5,
2063
2094
  maxLineY: 0,
2064
2095
  merge: [],
@@ -2098,26 +2129,36 @@ const create2 = (id, _uri, x, y, width, height, workspacePath, platform, assetDi
2098
2129
  assetDir,
2099
2130
  height,
2100
2131
  id,
2101
- initial: true,
2132
+ initial: false,
2133
+ loading: true,
2102
2134
  platform,
2103
2135
  width,
2104
2136
  workspacePath,
2105
2137
  x,
2106
2138
  y
2107
2139
  };
2108
- set(id, state, state);
2140
+ set(id, {
2141
+ ...state,
2142
+ initial: true,
2143
+ loading: false
2144
+ }, state);
2109
2145
  };
2110
2146
 
2111
- const isEqual$3 = (oldState, newState) => {
2112
- return oldState.inputBoxHeight === newState.inputBoxHeight;
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
+ };
2152
+ const isEqual$4 = (oldState, newState) => {
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);
2113
2154
  };
2114
2155
 
2115
- const isEqual$2 = (oldState, newState) => {
2156
+ const isEqual$3 = (oldState, newState) => {
2116
2157
  return oldState.focus === newState.focus;
2117
2158
  };
2118
2159
 
2119
- const isEqual$1 = (oldState, newState) => {
2120
- return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.sourceControlButtons === newState.sourceControlButtons && oldState.visibleItems === newState.visibleItems;
2160
+ const isEqual$2 = (oldState, newState) => {
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;
2121
2162
  };
2122
2163
 
2123
2164
  const RenderItems = 4;
@@ -2126,11 +2167,11 @@ const RenderValue = 8;
2126
2167
  const RenderCss = 10;
2127
2168
  const RenderIncremental = 11;
2128
2169
 
2129
- const isEqual = (oldState, newState) => {
2170
+ const isEqual$1 = (oldState, newState) => {
2130
2171
  return newState.inputSource === User || oldState.inputValue === newState.inputValue;
2131
2172
  };
2132
2173
 
2133
- const modules = [isEqual$1, isEqual, isEqual$3, isEqual$2];
2174
+ const modules = [isEqual$2, isEqual$1, isEqual$4, isEqual$3];
2134
2175
  const numbers = [RenderIncremental, RenderValue, RenderCss, RenderFocusContext];
2135
2176
 
2136
2177
  const diff = (oldState, newState) => {
@@ -2590,6 +2631,7 @@ const refresh = async state => {
2590
2631
  assetDir,
2591
2632
  enabledProviderIds,
2592
2633
  fileIconCache,
2634
+ headerHeight,
2593
2635
  height,
2594
2636
  iconDefinitions,
2595
2637
  itemHeight,
@@ -2607,8 +2649,9 @@ const refresh = async state => {
2607
2649
  const badgeCount = await getBadgeCount$1(enabledProviderIds, assetDir, platform);
2608
2650
  const total = displayItems.length;
2609
2651
  const contentHeight = total * itemHeight;
2610
- const listHeight = getListHeight(total, itemHeight, height);
2611
- const scrollBarHeight = getScrollBarSize(height, contentHeight, minimumSliderSize);
2652
+ const availableListHeight = Math.max(height - headerHeight, 0);
2653
+ const listHeight = getListHeight(total, itemHeight, availableListHeight);
2654
+ const scrollBarHeight = getScrollBarSize(availableListHeight, contentHeight, minimumSliderSize);
2612
2655
  const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
2613
2656
  const minLineY = 0;
2614
2657
  const maxLineY = Math.min(numberOfVisible, total);
@@ -2620,12 +2663,14 @@ const refresh = async state => {
2620
2663
  actionsCache,
2621
2664
  allGroups,
2622
2665
  badgeCount,
2666
+ deltaY: 0,
2623
2667
  enabledProviderIds,
2624
2668
  fileIconCache: newFileIconCache,
2625
2669
  finalDeltaY,
2626
2670
  gitRoot,
2627
2671
  items: displayItems,
2628
2672
  maxLineY,
2673
+ minLineY,
2629
2674
  scrollBarHeight,
2630
2675
  splitButtonEnabled,
2631
2676
  visibleItems
@@ -2720,14 +2765,20 @@ const updateVisibleItems = async (state, expandedGroups) => {
2720
2765
  actionsCache,
2721
2766
  allGroups,
2722
2767
  fileIconCache,
2768
+ headerHeight,
2723
2769
  height,
2724
2770
  iconDefinitions,
2725
- itemHeight
2771
+ itemHeight,
2772
+ minimumSliderSize
2726
2773
  } = state;
2727
2774
  const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
2728
2775
  const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
2729
2776
  const total = displayItems.length;
2730
- const listHeight = getListHeight(total, itemHeight, height);
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);
2731
2782
  const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
2732
2783
  const minLineY = 0;
2733
2784
  const maxLineY = Math.min(numberOfVisible, total);
@@ -2735,10 +2786,13 @@ const updateVisibleItems = async (state, expandedGroups) => {
2735
2786
  return {
2736
2787
  ...state,
2737
2788
  badgeCount,
2789
+ deltaY: 0,
2738
2790
  expandedGroups,
2791
+ finalDeltaY,
2739
2792
  items: displayItems,
2740
2793
  maxLineY,
2741
2794
  minLineY,
2795
+ scrollBarHeight,
2742
2796
  visibleItems
2743
2797
  };
2744
2798
  };
@@ -2897,18 +2951,10 @@ const handleMouseOverAt = async (state, eventX, eventY) => {
2897
2951
  return handleMouseOver(state, index);
2898
2952
  };
2899
2953
 
2900
- const handleSourceControlButtonClick = async (state, name) => {
2901
- const button = state.sourceControlButtons.find(button => button.label === name);
2902
- if (!button) {
2903
- warn(`[source-control-worker] Source control button not found ${name}`);
2904
- return state;
2905
- }
2906
- await executeCommand(button.command, state.assetDir, state.platform, state.inputValue);
2907
- const newState = await loadContent(state, {});
2954
+ const handleScrollBarCaptureLost = state => {
2908
2955
  return {
2909
- ...newState,
2910
- inputMessage: '',
2911
- inputValue: ''
2956
+ ...state,
2957
+ scrollBarActive: false
2912
2958
  };
2913
2959
  };
2914
2960
 
@@ -2916,12 +2962,13 @@ const setDeltaY = async (state, newDeltaY) => {
2916
2962
  const {
2917
2963
  actionsCache,
2918
2964
  fileIconCache,
2965
+ finalDeltaY,
2919
2966
  headerHeight,
2920
2967
  height,
2921
2968
  itemHeight,
2922
2969
  items
2923
2970
  } = state;
2924
- const normalizedDeltaY = Math.max(newDeltaY, 0);
2971
+ const normalizedDeltaY = Math.min(Math.max(newDeltaY, 0), finalDeltaY);
2925
2972
  const newMinLineY = Math.floor(normalizedDeltaY / itemHeight);
2926
2973
  const total = items.length;
2927
2974
  const listHeight = height - headerHeight;
@@ -2930,19 +2977,109 @@ const setDeltaY = async (state, newDeltaY) => {
2930
2977
  const visible = getVisibleSourceControlItems(items, newMinLineY, maxLineY, actionsCache, fileIconCache);
2931
2978
  return {
2932
2979
  ...state,
2933
- deltaY: newDeltaY,
2980
+ deltaY: normalizedDeltaY,
2934
2981
  maxLineY,
2935
2982
  minLineY: newMinLineY,
2936
2983
  visibleItems: visible
2937
2984
  };
2938
2985
  };
2939
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
+
2940
3053
  const handleWheel = async (state, deltaMode, deltaY) => {
2941
3054
  return setDeltaY(state, state.deltaY + deltaY);
2942
3055
  };
2943
3056
 
3057
+ const isEqual = (oldProviderIds, newProviderIds) => {
3058
+ if (oldProviderIds.length !== newProviderIds.length) {
3059
+ return false;
3060
+ }
3061
+ for (let index = 0; index < oldProviderIds.length; index++) {
3062
+ if (oldProviderIds[index] !== newProviderIds[index]) {
3063
+ return false;
3064
+ }
3065
+ }
3066
+ return true;
3067
+ };
2944
3068
  const handleWorkspaceRefresh = async state => {
2945
- return refresh(state);
3069
+ const {
3070
+ assetDir,
3071
+ enabledProviderIds,
3072
+ platform,
3073
+ workspacePath
3074
+ } = state;
3075
+ const scheme = getProtocol(workspacePath);
3076
+ const newProviderIds = await getEnabledProviderIds(scheme, workspacePath, assetDir, platform);
3077
+ if (isEqual(enabledProviderIds, newProviderIds)) {
3078
+ return refresh(state);
3079
+ }
3080
+ return loadContent(state, {
3081
+ inputValue: state.inputValue
3082
+ });
2946
3083
  };
2947
3084
 
2948
3085
  const sendMessagePortToExtensionHostWorker = async port => {
@@ -3022,21 +3159,36 @@ const getUnique = items => {
3022
3159
 
3023
3160
  const renderCss = (oldState, newState) => {
3024
3161
  const {
3162
+ deltaY,
3163
+ finalDeltaY,
3164
+ headerHeight,
3165
+ height,
3025
3166
  id,
3026
3167
  inputBoxHeight,
3168
+ itemHeight,
3169
+ scrollBarHeight,
3027
3170
  visibleItems
3028
3171
  } = newState;
3029
3172
  const indents = visibleItems.map(item => item.indent);
3030
3173
  const uniqueIndents = getUnique(indents);
3031
3174
  const indentRules = uniqueIndents.map(getIndentRule).join('\n');
3032
- const css = indentRules ? `:root {
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 {
3033
3180
  --SourceControlInputHeight: ${inputBoxHeight}px;
3034
3181
  }
3035
- ${indentRules}
3036
- ` : `:root {
3037
- --SourceControlInputHeight: ${inputBoxHeight}px;
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;
3038
3190
  }
3039
- `;
3191
+ ${indentCss}`;
3040
3192
  return [SetCss, id, css];
3041
3193
  };
3042
3194
 
@@ -3059,7 +3211,14 @@ const IconButton = 'IconButton';
3059
3211
  const InputBox = 'InputBox';
3060
3212
  const Label = 'Label';
3061
3213
  const LabelDetail = 'LabelDetail';
3214
+ const List = 'List';
3062
3215
  const Message = 'Message';
3216
+ const Progress = 'Progress';
3217
+ const ProgressContainer = 'ProgressContainer';
3218
+ const ScrollBar = 'ScrollBar';
3219
+ const ScrollBarSmall = 'ScrollBarSmall';
3220
+ const ScrollBarThumb = 'ScrollBarThumb';
3221
+ const ScrollBarThumbActive = 'ScrollBarThumbActive';
3063
3222
  const SourceControl = 'SourceControl';
3064
3223
  const SourceControlButton = 'SourceControlButton';
3065
3224
  const SourceControlHeader = 'SourceControlHeader';
@@ -3082,11 +3241,26 @@ const HandleMouseOverAt = 8;
3082
3241
  const HandleWheel = 9;
3083
3242
  const HandleClickAction = 10;
3084
3243
  const HandleClickSourceControlButton = 11;
3244
+ const HandleScrollBarMove = 12;
3245
+ const HandleScrollBarPointerCaptureLost = 13;
3246
+ const HandleScrollBarPointerDown = 14;
3247
+
3248
+ const getProgressVirtualDom = () => {
3249
+ return [{
3250
+ childCount: 1,
3251
+ className: ProgressContainer,
3252
+ type: Div
3253
+ }, {
3254
+ childCount: 0,
3255
+ className: Progress,
3256
+ type: Div
3257
+ }];
3258
+ };
3085
3259
 
3086
3260
  const getIconVirtualDom = (icon, type = Div) => {
3087
3261
  return {
3088
3262
  childCount: 0,
3089
- className: `MaskIcon MaskIcon${icon}`,
3263
+ className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
3090
3264
  role: None$1,
3091
3265
  type
3092
3266
  };
@@ -3152,6 +3326,22 @@ const getSourceControlHeaderVirtualDom = (inputPlaceholder, inputMessage) => {
3152
3326
  }, ...inputDom];
3153
3327
  };
3154
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
+
3155
3345
  const className$1 = mergeClassNames(Badge, SourceControlBadge);
3156
3346
  const parentNode = {
3157
3347
  childCount: 1,
@@ -3327,8 +3517,13 @@ const getSourceControlItemVirtualDom = item => {
3327
3517
  }
3328
3518
  };
3329
3519
 
3330
- const getSourceControlListVirtualDom = items => {
3520
+ const getSourceControlListVirtualDom = (items, scrollBarHeight, scrollBarActive) => {
3521
+ const scrollBarDom = getScrollBarVirtualDom(scrollBarHeight, scrollBarActive);
3331
3522
  return [{
3523
+ childCount: scrollBarDom.length > 0 ? 2 : 1,
3524
+ className: mergeClassNames(Viewlet, List),
3525
+ type: Div
3526
+ }, {
3332
3527
  childCount: items.length,
3333
3528
  className: SourceControlItems,
3334
3529
  onClick: HandleClickAt,
@@ -3336,20 +3531,22 @@ const getSourceControlListVirtualDom = items => {
3336
3531
  onPointerOver: HandleMouseOverAt,
3337
3532
  role: Tree$1,
3338
3533
  type: Div
3339
- }, ...items.flatMap(getSourceControlItemVirtualDom)];
3534
+ }, ...items.flatMap(getSourceControlItemVirtualDom), ...scrollBarDom];
3340
3535
  };
3341
3536
 
3342
3537
  const className = mergeClassNames(Viewlet, SourceControl);
3343
- const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, inputMessage, message) => {
3538
+ const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, inputMessage, message, loading, scrollBarHeight, scrollBarActive) => {
3344
3539
  const content = message ? [{
3345
3540
  childCount: 1,
3346
3541
  className: Message,
3347
3542
  paddingLeft: '20px',
3348
3543
  paddingRight: '20px',
3349
3544
  type: Div
3350
- }, 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)];
3546
+ const progressDom = loading ? getProgressVirtualDom() : [];
3351
3547
  const dom = [{
3352
- childCount: message ? 1 : 2 + buttons.length,
3548
+ ariaBusy: loading,
3549
+ childCount: (message ? 1 : 2 + buttons.length) + (loading ? 1 : 0),
3353
3550
  className: className,
3354
3551
  onContextMenu: HandleContextMenu,
3355
3552
  onMouseOver: HandleMouseOver,
@@ -3357,7 +3554,7 @@ const getSourceControlVirtualDom = (items, buttons, disabled, placeholder, input
3357
3554
  onWheel: HandleWheel,
3358
3555
  tabIndex: 0,
3359
3556
  type: Div
3360
- }, ...content];
3557
+ }, ...progressDom, ...content];
3361
3558
  return dom;
3362
3559
  };
3363
3560
 
@@ -3369,14 +3566,17 @@ const renderItems = (oldState, newState) => {
3369
3566
  inputMessage,
3370
3567
  inputPlaceholder,
3371
3568
  items,
3569
+ loading,
3570
+ scrollBarActive,
3571
+ scrollBarHeight,
3372
3572
  sourceControlButtons,
3373
3573
  visibleItems
3374
3574
  } = newState;
3375
3575
  if (initial) {
3376
3576
  return [SetDom2, id, []];
3377
3577
  }
3378
- const unavailableMessage = enabledProviderIds.length === 0 ? noSourceControlProvider() : '';
3379
- const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, unavailableMessage);
3578
+ const unavailableMessage = !loading && enabledProviderIds.length === 0 ? noSourceControlProvider() : '';
3579
+ const dom = getSourceControlVirtualDom(visibleItems, sourceControlButtons, items.length === 0, inputPlaceholder, inputMessage, unavailableMessage, loading, scrollBarHeight, scrollBarActive);
3380
3580
  return [SetDom2, id, dom];
3381
3581
  };
3382
3582
 
@@ -3569,6 +3769,17 @@ const renderEventListeners = () => {
3569
3769
  }, {
3570
3770
  name: HandleClickSourceControlButton,
3571
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']
3572
3783
  }];
3573
3784
  };
3574
3785
 
@@ -3612,7 +3823,7 @@ const updateIcons = async state => {
3612
3823
  const viewAsList = state => {
3613
3824
  return {
3614
3825
  ...state,
3615
- viewMode: List
3826
+ viewMode: List$1
3616
3827
  };
3617
3828
  };
3618
3829
 
@@ -3644,6 +3855,9 @@ const commandMap = {
3644
3855
  'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
3645
3856
  'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
3646
3857
  'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
3858
+ 'SourceControl.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
3859
+ 'SourceControl.handleScrollBarClick': wrapCommand(handleScrollBarClick),
3860
+ 'SourceControl.handleScrollBarMove': wrapCommand(handleScrollBarMove),
3647
3861
  'SourceControl.handleSourceControlButtonClick': wrapCommand(handleSourceControlButtonClick),
3648
3862
  'SourceControl.handleWheel': wrapCommand(handleWheel),
3649
3863
  'SourceControl.handleWorkspaceRefresh': wrapCommand(handleWorkspaceRefresh),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"