custom-electron-titlebar 3.2.6 → 3.2.10

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.
Files changed (239) hide show
  1. package/.github/FUNDING.yml +1 -0
  2. package/README.md +15 -24
  3. package/_config.yml +1 -0
  4. package/{lib → build}/browser/browser.d.ts +0 -0
  5. package/{lib → build}/browser/browser.js +0 -0
  6. package/{lib → build}/browser/browser.js.map +0 -0
  7. package/{lib → build}/browser/event.d.ts +0 -0
  8. package/{lib → build}/browser/event.js +2 -1
  9. package/{lib → build}/browser/event.js.map +1 -1
  10. package/{lib → build}/browser/iframe.d.ts +0 -0
  11. package/{lib → build}/browser/iframe.js +0 -0
  12. package/{lib → build}/browser/iframe.js.map +0 -0
  13. package/{lib → build}/browser/keyboardEvent.d.ts +0 -0
  14. package/{lib → build}/browser/keyboardEvent.js +0 -0
  15. package/{lib → build}/browser/keyboardEvent.js.map +0 -0
  16. package/{lib → build}/browser/mouseEvent.d.ts +0 -0
  17. package/{lib → build}/browser/mouseEvent.js +0 -0
  18. package/{lib → build}/browser/mouseEvent.js.map +0 -0
  19. package/{lib → build}/common/arrays.d.ts +0 -0
  20. package/{lib → build}/common/arrays.js +0 -0
  21. package/{lib → build}/common/arrays.js.map +0 -0
  22. package/{lib → build}/common/async.d.ts +0 -0
  23. package/{lib → build}/common/async.js +0 -0
  24. package/{lib → build}/common/async.js.map +0 -0
  25. package/{lib → build}/common/charCode.d.ts +0 -0
  26. package/{lib → build}/common/charCode.js +0 -0
  27. package/{lib → build}/common/charCode.js.map +0 -0
  28. package/{lib → build}/common/color.d.ts +0 -0
  29. package/{lib → build}/common/color.js +0 -0
  30. package/{lib → build}/common/color.js.map +0 -0
  31. package/{lib → build}/common/dom.d.ts +0 -0
  32. package/{lib → build}/common/dom.js +16 -14
  33. package/build/common/dom.js.map +1 -0
  34. package/{lib → build}/common/event.d.ts +0 -0
  35. package/{lib → build}/common/event.js +1 -1
  36. package/build/common/event.js.map +1 -0
  37. package/{lib → build}/common/iterator.d.ts +0 -0
  38. package/{lib → build}/common/iterator.js +0 -0
  39. package/{lib → build}/common/iterator.js.map +0 -0
  40. package/{lib → build}/common/keyCodes.d.ts +0 -0
  41. package/{lib → build}/common/keyCodes.js +0 -0
  42. package/{lib → build}/common/keyCodes.js.map +0 -0
  43. package/{lib → build}/common/lifecycle.d.ts +0 -0
  44. package/{lib → build}/common/lifecycle.js +0 -0
  45. package/{lib → build}/common/lifecycle.js.map +0 -0
  46. package/{lib → build}/common/linkedList.d.ts +0 -0
  47. package/{lib → build}/common/linkedList.js +0 -0
  48. package/{lib → build}/common/linkedList.js.map +0 -0
  49. package/{lib → build}/common/platform.d.ts +0 -0
  50. package/{lib → build}/common/platform.js +0 -0
  51. package/{lib → build}/common/platform.js.map +0 -0
  52. package/{lib → build}/index.d.ts +0 -0
  53. package/{lib → build}/index.js +0 -0
  54. package/{lib → build}/index.js.map +0 -0
  55. package/{lib → build}/menu/menu.d.ts +0 -0
  56. package/{lib → build}/menu/menu.js +38 -38
  57. package/build/menu/menu.js.map +1 -0
  58. package/{lib → build}/menu/menuitem.d.ts +10 -2
  59. package/{lib → build}/menu/menuitem.js +70 -34
  60. package/build/menu/menuitem.js.map +1 -0
  61. package/{lib → build}/menubar.d.ts +0 -0
  62. package/{lib → build}/menubar.js +29 -30
  63. package/build/menubar.js.map +1 -0
  64. package/{lib → build}/themebar.d.ts +0 -0
  65. package/{lib → build}/themebar.js +2 -2
  66. package/build/themebar.js.map +1 -0
  67. package/{lib → build}/titlebar.d.ts +0 -0
  68. package/{lib → build}/titlebar.js +61 -58
  69. package/build/titlebar.js.map +1 -0
  70. package/package.json +13 -7
  71. package/lib/common/dom.js.map +0 -1
  72. package/lib/common/enableNativeMenuCommands.d.ts +0 -1
  73. package/lib/common/enableNativeMenuCommands.js +0 -32
  74. package/lib/common/enableNativeMenuCommands.js.map +0 -1
  75. package/lib/common/event.js.map +0 -1
  76. package/lib/main.d.ts +0 -1
  77. package/lib/main.js +0 -14
  78. package/lib/main.js.map +0 -1
  79. package/lib/menu/menu.js.map +0 -1
  80. package/lib/menu/menuitem.js.map +0 -1
  81. package/lib/menubar.js.map +0 -1
  82. package/lib/themebar.js.map +0 -1
  83. package/lib/titlebar.js.map +0 -1
  84. package/lib/vs/base/browser/browser.js +0 -150
  85. package/lib/vs/base/browser/canIUse.js +0 -58
  86. package/lib/vs/base/browser/codicons.js +0 -37
  87. package/lib/vs/base/browser/contextmenu.js +0 -9
  88. package/lib/vs/base/browser/dnd.js +0 -113
  89. package/lib/vs/base/browser/dom.js +0 -1417
  90. package/lib/vs/base/browser/event.js +0 -36
  91. package/lib/vs/base/browser/fastDomNode.js +0 -265
  92. package/lib/vs/base/browser/formattedTextRenderer.js +0 -248
  93. package/lib/vs/base/browser/globalMouseMoveMonitor.js +0 -137
  94. package/lib/vs/base/browser/history.js +0 -9
  95. package/lib/vs/base/browser/iframe.js +0 -126
  96. package/lib/vs/base/browser/keyboardEvent.js +0 -599
  97. package/lib/vs/base/browser/mouseEvent.js +0 -155
  98. package/lib/vs/base/browser/touch.js +0 -315
  99. package/lib/vs/base/browser/ui/actionbar/actionViewItems.js +0 -397
  100. package/lib/vs/base/browser/ui/actionbar/actionbar.js +0 -583
  101. package/lib/vs/base/browser/ui/checkbox/checkbox.js +0 -251
  102. package/lib/vs/base/browser/ui/codicons/codiconLabel.js +0 -31
  103. package/lib/vs/base/browser/ui/codicons/codiconStyles.js +0 -47
  104. package/lib/vs/base/browser/ui/contextview/contextview.js +0 -367
  105. package/lib/vs/base/browser/ui/dropdown/dropdown.js +0 -256
  106. package/lib/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +0 -120
  107. package/lib/vs/base/browser/ui/keybindingLabel/keybindingLabel.js +0 -118
  108. package/lib/vs/base/browser/ui/list/list.js +0 -54
  109. package/lib/vs/base/browser/ui/list/listPaging.js +0 -322
  110. package/lib/vs/base/browser/ui/list/listView.js +0 -1388
  111. package/lib/vs/base/browser/ui/list/listWidget.js +0 -1709
  112. package/lib/vs/base/browser/ui/list/rangeMap.js +0 -223
  113. package/lib/vs/base/browser/ui/list/rowCache.js +0 -113
  114. package/lib/vs/base/browser/ui/list/splice.js +0 -23
  115. package/lib/vs/base/browser/ui/menu/menu.js +0 -1371
  116. package/lib/vs/base/browser/ui/menu/menubar.js +0 -1139
  117. package/lib/vs/base/browser/ui/scrollbar/abstractScrollbar.js +0 -278
  118. package/lib/vs/base/browser/ui/scrollbar/horizontalScrollbar.js +0 -115
  119. package/lib/vs/base/browser/ui/scrollbar/scrollableElement.js +0 -646
  120. package/lib/vs/base/browser/ui/scrollbar/scrollableElementOptions.js +0 -9
  121. package/lib/vs/base/browser/ui/scrollbar/scrollbarArrow.js +0 -106
  122. package/lib/vs/base/browser/ui/scrollbar/scrollbarState.js +0 -184
  123. package/lib/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js +0 -116
  124. package/lib/vs/base/browser/ui/scrollbar/verticalScrollbar.js +0 -114
  125. package/lib/vs/base/browser/ui/selectBox/selectBox.js +0 -85
  126. package/lib/vs/base/browser/ui/selectBox/selectBoxCustom.js +0 -985
  127. package/lib/vs/base/browser/ui/selectBox/selectBoxNative.js +0 -188
  128. package/lib/vs/base/browser/ui/toolbar/toolbar.js +0 -206
  129. package/lib/vs/base/browser/ui/widget.js +0 -69
  130. package/lib/vs/base/common/actions.js +0 -224
  131. package/lib/vs/base/common/amd.js +0 -31
  132. package/lib/vs/base/common/arrays.js +0 -641
  133. package/lib/vs/base/common/assert.js +0 -21
  134. package/lib/vs/base/common/async.js +0 -966
  135. package/lib/vs/base/common/buffer.js +0 -250
  136. package/lib/vs/base/common/cache.js +0 -40
  137. package/lib/vs/base/common/cancellation.js +0 -146
  138. package/lib/vs/base/common/charCode.js +0 -9
  139. package/lib/vs/base/common/codicon.js +0 -136
  140. package/lib/vs/base/common/codicons.js +0 -1378
  141. package/lib/vs/base/common/collections.js +0 -133
  142. package/lib/vs/base/common/color.js +0 -716
  143. package/lib/vs/base/common/comparers.js +0 -280
  144. package/lib/vs/base/common/console.js +0 -142
  145. package/lib/vs/base/common/date.js +0 -113
  146. package/lib/vs/base/common/decorators.js +0 -169
  147. package/lib/vs/base/common/errorMessage.js +0 -93
  148. package/lib/vs/base/common/errors.js +0 -213
  149. package/lib/vs/base/common/errorsWithActions.js +0 -28
  150. package/lib/vs/base/common/event.js +0 -873
  151. package/lib/vs/base/common/extpath.js +0 -401
  152. package/lib/vs/base/common/filters.js +0 -948
  153. package/lib/vs/base/common/functional.js +0 -28
  154. package/lib/vs/base/common/fuzzyScorer.js +0 -811
  155. package/lib/vs/base/common/glob.js +0 -696
  156. package/lib/vs/base/common/hash.js +0 -359
  157. package/lib/vs/base/common/history.js +0 -116
  158. package/lib/vs/base/common/htmlContent.js +0 -162
  159. package/lib/vs/base/common/idGenerator.js +0 -25
  160. package/lib/vs/base/common/iterator.js +0 -118
  161. package/lib/vs/base/common/json.js +0 -1624
  162. package/lib/vs/base/common/jsonEdit.js +0 -272
  163. package/lib/vs/base/common/jsonErrorMessages.js +0 -69
  164. package/lib/vs/base/common/jsonFormatter.js +0 -316
  165. package/lib/vs/base/common/jsonSchema.js +0 -9
  166. package/lib/vs/base/common/keyCodes.js +0 -591
  167. package/lib/vs/base/common/keybindingLabels.js +0 -231
  168. package/lib/vs/base/common/keybindingParser.js +0 -142
  169. package/lib/vs/base/common/labels.js +0 -430
  170. package/lib/vs/base/common/lazy.js +0 -71
  171. package/lib/vs/base/common/lifecycle.js +0 -308
  172. package/lib/vs/base/common/linkedList.js +0 -152
  173. package/lib/vs/base/common/linkedText.js +0 -73
  174. package/lib/vs/base/common/map.js +0 -1108
  175. package/lib/vs/base/common/marshalling.js +0 -80
  176. package/lib/vs/base/common/mime.js +0 -321
  177. package/lib/vs/base/common/navigator.js +0 -50
  178. package/lib/vs/base/common/network.js +0 -160
  179. package/lib/vs/base/common/normalization.js +0 -78
  180. package/lib/vs/base/common/numbers.js +0 -55
  181. package/lib/vs/base/common/objects.js +0 -268
  182. package/lib/vs/base/common/paging.js +0 -190
  183. package/lib/vs/base/common/parsers.js +0 -78
  184. package/lib/vs/base/common/path.js +0 -1550
  185. package/lib/vs/base/common/platform.js +0 -245
  186. package/lib/vs/base/common/process.js +0 -52
  187. package/lib/vs/base/common/processes.js +0 -32
  188. package/lib/vs/base/common/range.js +0 -79
  189. package/lib/vs/base/common/resourceTree.js +0 -185
  190. package/lib/vs/base/common/resources.js +0 -421
  191. package/lib/vs/base/common/scanCode.js +0 -1472
  192. package/lib/vs/base/common/scrollable.js +0 -397
  193. package/lib/vs/base/common/search.js +0 -55
  194. package/lib/vs/base/common/sequence.js +0 -64
  195. package/lib/vs/base/common/severity.js +0 -55
  196. package/lib/vs/base/common/skipList.js +0 -234
  197. package/lib/vs/base/common/stopwatch.js +0 -45
  198. package/lib/vs/base/common/stream.js +0 -418
  199. package/lib/vs/base/common/strings.js +0 -1283
  200. package/lib/vs/base/common/styler.js +0 -9
  201. package/lib/vs/base/common/types.js +0 -296
  202. package/lib/vs/base/common/uint.js +0 -46
  203. package/lib/vs/base/common/uri.js +0 -756
  204. package/lib/vs/base/common/uriIpc.js +0 -154
  205. package/lib/vs/base/common/uuid.js +0 -70
  206. package/lib/vs/nls.mock.js +0 -31
  207. package/lib/vs/platform/actions/browser/menuEntryActionViewItem.js +0 -342
  208. package/lib/vs/platform/actions/common/actions.js +0 -456
  209. package/lib/vs/platform/actions/common/menuService.js +0 -194
  210. package/lib/vs/platform/clipboard/browser/clipboardService.js +0 -99
  211. package/lib/vs/platform/clipboard/common/clipboardService.js +0 -14
  212. package/lib/vs/platform/contextkey/common/contextkey.js +0 -1210
  213. package/lib/vs/platform/contextkey/common/contextkeys.js +0 -23
  214. package/lib/vs/platform/contextview/browser/contextView.js +0 -15
  215. package/lib/vs/platform/contextview/browser/contextViewService.js +0 -96
  216. package/lib/vs/platform/environment/common/argv.js +0 -9
  217. package/lib/vs/platform/environment/common/environment.js +0 -15
  218. package/lib/vs/platform/instantiation/common/descriptors.js +0 -25
  219. package/lib/vs/platform/instantiation/common/extensions.js +0 -26
  220. package/lib/vs/platform/instantiation/common/graph.js +0 -93
  221. package/lib/vs/platform/instantiation/common/instantiation.js +0 -84
  222. package/lib/vs/platform/instantiation/common/instantiationService.js +0 -361
  223. package/lib/vs/platform/instantiation/common/serviceCollection.js +0 -39
  224. package/lib/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -73
  225. package/lib/vs/platform/keybinding/common/keybinding.js +0 -14
  226. package/lib/vs/platform/keybinding/common/keybindingResolver.js +0 -391
  227. package/lib/vs/platform/keybinding/common/keybindingsRegistry.js +0 -229
  228. package/lib/vs/platform/keybinding/common/resolvedKeybindingItem.js +0 -47
  229. package/lib/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js +0 -160
  230. package/lib/vs/platform/layout/browser/layoutService.js +0 -14
  231. package/lib/vs/platform/menubar/common/menubar.js +0 -34
  232. package/lib/vs/platform/registry/common/platform.js +0 -38
  233. package/lib/vs/platform/theme/browser/checkbox.js +0 -32
  234. package/lib/vs/platform/theme/common/colorRegistry.js +0 -1154
  235. package/lib/vs/platform/theme/common/styler.js +0 -290
  236. package/lib/vs/platform/theme/common/theme.js +0 -21
  237. package/lib/vs/platform/theme/common/themeService.js +0 -176
  238. package/lib/vs/platform/theme/common/tokenClassificationRegistry.js +0 -540
  239. package/lib/vs/platform/theme/test/common/testThemeService.js +0 -98
@@ -1,106 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.ScrollbarArrow = exports.ARROW_IMG_SIZE = void 0;
11
-
12
- const globalMouseMoveMonitor_1 = require("../../globalMouseMoveMonitor");
13
-
14
- const widget_1 = require("../widget");
15
-
16
- const async_1 = require("../../../common/async");
17
-
18
- const dom_1 = require("../../dom");
19
- /**
20
- * The arrow image size.
21
- */
22
-
23
-
24
- exports.ARROW_IMG_SIZE = 11;
25
-
26
- class ScrollbarArrow extends widget_1.Widget {
27
- constructor(opts) {
28
- super();
29
- this._onActivate = opts.onActivate;
30
- this.bgDomNode = document.createElement('div');
31
- this.bgDomNode.className = 'arrow-background';
32
- this.bgDomNode.style.position = 'absolute';
33
- this.bgDomNode.style.width = opts.bgWidth + 'px';
34
- this.bgDomNode.style.height = opts.bgHeight + 'px';
35
-
36
- if (typeof opts.top !== 'undefined') {
37
- this.bgDomNode.style.top = '0px';
38
- }
39
-
40
- if (typeof opts.left !== 'undefined') {
41
- this.bgDomNode.style.left = '0px';
42
- }
43
-
44
- if (typeof opts.bottom !== 'undefined') {
45
- this.bgDomNode.style.bottom = '0px';
46
- }
47
-
48
- if (typeof opts.right !== 'undefined') {
49
- this.bgDomNode.style.right = '0px';
50
- }
51
-
52
- this.domNode = document.createElement('div');
53
- this.domNode.className = opts.className;
54
- dom_1.addClasses(this.domNode, opts.icon.classNames);
55
- this.domNode.style.position = 'absolute';
56
- this.domNode.style.width = exports.ARROW_IMG_SIZE + 'px';
57
- this.domNode.style.height = exports.ARROW_IMG_SIZE + 'px';
58
-
59
- if (typeof opts.top !== 'undefined') {
60
- this.domNode.style.top = opts.top + 'px';
61
- }
62
-
63
- if (typeof opts.left !== 'undefined') {
64
- this.domNode.style.left = opts.left + 'px';
65
- }
66
-
67
- if (typeof opts.bottom !== 'undefined') {
68
- this.domNode.style.bottom = opts.bottom + 'px';
69
- }
70
-
71
- if (typeof opts.right !== 'undefined') {
72
- this.domNode.style.right = opts.right + 'px';
73
- }
74
-
75
- this._mouseMoveMonitor = this._register(new globalMouseMoveMonitor_1.GlobalMouseMoveMonitor());
76
- this.onmousedown(this.bgDomNode, e => this._arrowMouseDown(e));
77
- this.onmousedown(this.domNode, e => this._arrowMouseDown(e));
78
- this._mousedownRepeatTimer = this._register(new async_1.IntervalTimer());
79
- this._mousedownScheduleRepeatTimer = this._register(new async_1.TimeoutTimer());
80
- }
81
-
82
- _arrowMouseDown(e) {
83
- let scheduleRepeater = () => {
84
- this._mousedownRepeatTimer.cancelAndSet(() => this._onActivate(), 1000 / 24);
85
- };
86
-
87
- this._onActivate();
88
-
89
- this._mousedownRepeatTimer.cancel();
90
-
91
- this._mousedownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);
92
-
93
- this._mouseMoveMonitor.startMonitoring(e.target, e.buttons, globalMouseMoveMonitor_1.standardMouseMoveMerger, mouseMoveData => {
94
- /* Intentional empty */
95
- }, () => {
96
- this._mousedownRepeatTimer.cancel();
97
-
98
- this._mousedownScheduleRepeatTimer.cancel();
99
- });
100
-
101
- e.preventDefault();
102
- }
103
-
104
- }
105
-
106
- exports.ScrollbarArrow = ScrollbarArrow;
@@ -1,184 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.ScrollbarState = void 0;
11
- /**
12
- * The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged.
13
- */
14
-
15
- const MINIMUM_SLIDER_SIZE = 20;
16
-
17
- class ScrollbarState {
18
- constructor(arrowSize, scrollbarSize, oppositeScrollbarSize, visibleSize, scrollSize, scrollPosition) {
19
- this._scrollbarSize = Math.round(scrollbarSize);
20
- this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);
21
- this._arrowSize = Math.round(arrowSize);
22
- this._visibleSize = visibleSize;
23
- this._scrollSize = scrollSize;
24
- this._scrollPosition = scrollPosition;
25
- this._computedAvailableSize = 0;
26
- this._computedIsNeeded = false;
27
- this._computedSliderSize = 0;
28
- this._computedSliderRatio = 0;
29
- this._computedSliderPosition = 0;
30
-
31
- this._refreshComputedValues();
32
- }
33
-
34
- clone() {
35
- return new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);
36
- }
37
-
38
- setVisibleSize(visibleSize) {
39
- let iVisibleSize = Math.round(visibleSize);
40
-
41
- if (this._visibleSize !== iVisibleSize) {
42
- this._visibleSize = iVisibleSize;
43
-
44
- this._refreshComputedValues();
45
-
46
- return true;
47
- }
48
-
49
- return false;
50
- }
51
-
52
- setScrollSize(scrollSize) {
53
- let iScrollSize = Math.round(scrollSize);
54
-
55
- if (this._scrollSize !== iScrollSize) {
56
- this._scrollSize = iScrollSize;
57
-
58
- this._refreshComputedValues();
59
-
60
- return true;
61
- }
62
-
63
- return false;
64
- }
65
-
66
- setScrollPosition(scrollPosition) {
67
- let iScrollPosition = Math.round(scrollPosition);
68
-
69
- if (this._scrollPosition !== iScrollPosition) {
70
- this._scrollPosition = iScrollPosition;
71
-
72
- this._refreshComputedValues();
73
-
74
- return true;
75
- }
76
-
77
- return false;
78
- }
79
-
80
- setScrollbarSize(scrollbarSize) {
81
- this._scrollbarSize = scrollbarSize;
82
- }
83
-
84
- static _computeValues(oppositeScrollbarSize, arrowSize, visibleSize, scrollSize, scrollPosition) {
85
- const computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);
86
- const computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);
87
- const computedIsNeeded = scrollSize > 0 && scrollSize > visibleSize;
88
-
89
- if (!computedIsNeeded) {
90
- // There is no need for a slider
91
- return {
92
- computedAvailableSize: Math.round(computedAvailableSize),
93
- computedIsNeeded: computedIsNeeded,
94
- computedSliderSize: Math.round(computedRepresentableSize),
95
- computedSliderRatio: 0,
96
- computedSliderPosition: 0
97
- };
98
- } // We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise
99
-
100
-
101
- const computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize))); // The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize`
102
- // in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`.
103
-
104
- const computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);
105
- const computedSliderPosition = scrollPosition * computedSliderRatio;
106
- return {
107
- computedAvailableSize: Math.round(computedAvailableSize),
108
- computedIsNeeded: computedIsNeeded,
109
- computedSliderSize: Math.round(computedSliderSize),
110
- computedSliderRatio: computedSliderRatio,
111
- computedSliderPosition: Math.round(computedSliderPosition)
112
- };
113
- }
114
-
115
- _refreshComputedValues() {
116
- const r = ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition);
117
-
118
- this._computedAvailableSize = r.computedAvailableSize;
119
- this._computedIsNeeded = r.computedIsNeeded;
120
- this._computedSliderSize = r.computedSliderSize;
121
- this._computedSliderRatio = r.computedSliderRatio;
122
- this._computedSliderPosition = r.computedSliderPosition;
123
- }
124
-
125
- getArrowSize() {
126
- return this._arrowSize;
127
- }
128
-
129
- getScrollPosition() {
130
- return this._scrollPosition;
131
- }
132
-
133
- getRectangleLargeSize() {
134
- return this._computedAvailableSize;
135
- }
136
-
137
- getRectangleSmallSize() {
138
- return this._scrollbarSize;
139
- }
140
-
141
- isNeeded() {
142
- return this._computedIsNeeded;
143
- }
144
-
145
- getSliderSize() {
146
- return this._computedSliderSize;
147
- }
148
-
149
- getSliderPosition() {
150
- return this._computedSliderPosition;
151
- }
152
- /**
153
- * Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider.
154
- * `offset` is based on the same coordinate system as the `sliderPosition`.
155
- */
156
-
157
-
158
- getDesiredScrollPositionFromOffset(offset) {
159
- if (!this._computedIsNeeded) {
160
- // no need for a slider
161
- return 0;
162
- }
163
-
164
- let desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;
165
- return Math.round(desiredSliderPosition / this._computedSliderRatio);
166
- }
167
- /**
168
- * Compute a desired `scrollPosition` such that the slider moves by `delta`.
169
- */
170
-
171
-
172
- getDesiredScrollPositionFromDelta(delta) {
173
- if (!this._computedIsNeeded) {
174
- // no need for a slider
175
- return 0;
176
- }
177
-
178
- let desiredSliderPosition = this._computedSliderPosition + delta;
179
- return Math.round(desiredSliderPosition / this._computedSliderRatio);
180
- }
181
-
182
- }
183
-
184
- exports.ScrollbarState = ScrollbarState;
@@ -1,116 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.ScrollbarVisibilityController = void 0;
11
-
12
- const async_1 = require("../../../common/async");
13
-
14
- const lifecycle_1 = require("../../../common/lifecycle");
15
-
16
- class ScrollbarVisibilityController extends lifecycle_1.Disposable {
17
- constructor(visibility, visibleClassName, invisibleClassName) {
18
- super();
19
- this._visibility = visibility;
20
- this._visibleClassName = visibleClassName;
21
- this._invisibleClassName = invisibleClassName;
22
- this._domNode = null;
23
- this._isVisible = false;
24
- this._isNeeded = false;
25
- this._shouldBeVisible = false;
26
- this._revealTimer = this._register(new async_1.TimeoutTimer());
27
- } // ----------------- Hide / Reveal
28
-
29
-
30
- applyVisibilitySetting(shouldBeVisible) {
31
- if (this._visibility === 2
32
- /* Hidden */
33
- ) {
34
- return false;
35
- }
36
-
37
- if (this._visibility === 3
38
- /* Visible */
39
- ) {
40
- return true;
41
- }
42
-
43
- return shouldBeVisible;
44
- }
45
-
46
- setShouldBeVisible(rawShouldBeVisible) {
47
- let shouldBeVisible = this.applyVisibilitySetting(rawShouldBeVisible);
48
-
49
- if (this._shouldBeVisible !== shouldBeVisible) {
50
- this._shouldBeVisible = shouldBeVisible;
51
- this.ensureVisibility();
52
- }
53
- }
54
-
55
- setIsNeeded(isNeeded) {
56
- if (this._isNeeded !== isNeeded) {
57
- this._isNeeded = isNeeded;
58
- this.ensureVisibility();
59
- }
60
- }
61
-
62
- setDomNode(domNode) {
63
- this._domNode = domNode;
64
-
65
- this._domNode.setClassName(this._invisibleClassName); // Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration
66
-
67
-
68
- this.setShouldBeVisible(false);
69
- }
70
-
71
- ensureVisibility() {
72
- if (!this._isNeeded) {
73
- // Nothing to be rendered
74
- this._hide(false);
75
-
76
- return;
77
- }
78
-
79
- if (this._shouldBeVisible) {
80
- this._reveal();
81
- } else {
82
- this._hide(true);
83
- }
84
- }
85
-
86
- _reveal() {
87
- if (this._isVisible) {
88
- return;
89
- }
90
-
91
- this._isVisible = true; // The CSS animation doesn't play otherwise
92
-
93
- this._revealTimer.setIfNotSet(() => {
94
- if (this._domNode) {
95
- this._domNode.setClassName(this._visibleClassName);
96
- }
97
- }, 0);
98
- }
99
-
100
- _hide(withFadeAway) {
101
- this._revealTimer.cancel();
102
-
103
- if (!this._isVisible) {
104
- return;
105
- }
106
-
107
- this._isVisible = false;
108
-
109
- if (this._domNode) {
110
- this._domNode.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : ''));
111
- }
112
- }
113
-
114
- }
115
-
116
- exports.ScrollbarVisibilityController = ScrollbarVisibilityController;
@@ -1,114 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.VerticalScrollbar = void 0;
11
-
12
- const mouseEvent_1 = require("../../mouseEvent");
13
-
14
- const abstractScrollbar_1 = require("./abstractScrollbar");
15
-
16
- const scrollbarArrow_1 = require("./scrollbarArrow");
17
-
18
- const scrollbarState_1 = require("./scrollbarState");
19
-
20
- const codicons_1 = require("../../../common/codicons");
21
-
22
- const scrollbarButtonUpIcon = codicons_1.registerIcon('scrollbar-button-up', codicons_1.Codicon.triangleUp);
23
- const scrollbarButtonDownIcon = codicons_1.registerIcon('scrollbar-button-down', codicons_1.Codicon.triangleDown);
24
-
25
- class VerticalScrollbar extends abstractScrollbar_1.AbstractScrollbar {
26
- constructor(scrollable, options, host) {
27
- const scrollDimensions = scrollable.getScrollDimensions();
28
- const scrollPosition = scrollable.getCurrentScrollPosition();
29
- super({
30
- lazyRender: options.lazyRender,
31
- host: host,
32
- scrollbarState: new scrollbarState_1.ScrollbarState(options.verticalHasArrows ? options.arrowSize : 0, options.vertical === 2
33
- /* Hidden */
34
- ? 0 : options.verticalScrollbarSize, // give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom
35
- 0, scrollDimensions.height, scrollDimensions.scrollHeight, scrollPosition.scrollTop),
36
- visibility: options.vertical,
37
- extraScrollbarClassName: 'vertical',
38
- scrollable: scrollable
39
- });
40
-
41
- if (options.verticalHasArrows) {
42
- let arrowDelta = (options.arrowSize - scrollbarArrow_1.ARROW_IMG_SIZE) / 2;
43
- let scrollbarDelta = (options.verticalScrollbarSize - scrollbarArrow_1.ARROW_IMG_SIZE) / 2;
44
-
45
- this._createArrow({
46
- className: 'scra',
47
- icon: scrollbarButtonUpIcon,
48
- top: arrowDelta,
49
- left: scrollbarDelta,
50
- bottom: undefined,
51
- right: undefined,
52
- bgWidth: options.verticalScrollbarSize,
53
- bgHeight: options.arrowSize,
54
- onActivate: () => this._host.onMouseWheel(new mouseEvent_1.StandardWheelEvent(null, 0, 1))
55
- });
56
-
57
- this._createArrow({
58
- className: 'scra',
59
- icon: scrollbarButtonDownIcon,
60
- top: undefined,
61
- left: scrollbarDelta,
62
- bottom: arrowDelta,
63
- right: undefined,
64
- bgWidth: options.verticalScrollbarSize,
65
- bgHeight: options.arrowSize,
66
- onActivate: () => this._host.onMouseWheel(new mouseEvent_1.StandardWheelEvent(null, 0, -1))
67
- });
68
- }
69
-
70
- this._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined);
71
- }
72
-
73
- _updateSlider(sliderSize, sliderPosition) {
74
- this.slider.setHeight(sliderSize);
75
- this.slider.setTop(sliderPosition);
76
- }
77
-
78
- _renderDomNode(largeSize, smallSize) {
79
- this.domNode.setWidth(smallSize);
80
- this.domNode.setHeight(largeSize);
81
- this.domNode.setRight(0);
82
- this.domNode.setTop(0);
83
- }
84
-
85
- onDidScroll(e) {
86
- this._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender;
87
- this._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender;
88
- this._shouldRender = this._onElementSize(e.height) || this._shouldRender;
89
- return this._shouldRender;
90
- }
91
-
92
- _mouseDownRelativePosition(offsetX, offsetY) {
93
- return offsetY;
94
- }
95
-
96
- _sliderMousePosition(e) {
97
- return e.posy;
98
- }
99
-
100
- _sliderOrthogonalMousePosition(e) {
101
- return e.posx;
102
- }
103
-
104
- _updateScrollbarSize(size) {
105
- this.slider.setWidth(size);
106
- }
107
-
108
- writeScrollPosition(target, scrollPosition) {
109
- target.scrollTop = scrollPosition;
110
- }
111
-
112
- }
113
-
114
- exports.VerticalScrollbar = VerticalScrollbar;
@@ -1,85 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.SelectBox = exports.defaultStyles = void 0;
11
-
12
- require("../../../../css!./selectBox");
13
-
14
- const widget_1 = require("../widget");
15
-
16
- const color_1 = require("../../../common/color");
17
-
18
- const objects_1 = require("../../../common/objects");
19
-
20
- const selectBoxNative_1 = require("./selectBoxNative");
21
-
22
- const selectBoxCustom_1 = require("./selectBoxCustom");
23
-
24
- const platform_1 = require("../../../common/platform");
25
-
26
- exports.defaultStyles = {
27
- selectBackground: color_1.Color.fromHex('#3C3C3C'),
28
- selectForeground: color_1.Color.fromHex('#F0F0F0'),
29
- selectBorder: color_1.Color.fromHex('#3C3C3C')
30
- };
31
-
32
- class SelectBox extends widget_1.Widget {
33
- constructor(options, selected, contextViewProvider, styles = objects_1.deepClone(exports.defaultStyles), selectBoxOptions) {
34
- super(); // Default to native SelectBox for OSX unless overridden
35
-
36
- if (platform_1.isMacintosh && !(selectBoxOptions === null || selectBoxOptions === void 0 ? void 0 : selectBoxOptions.useCustomDrawn)) {
37
- this.selectBoxDelegate = new selectBoxNative_1.SelectBoxNative(options, selected, styles, selectBoxOptions);
38
- } else {
39
- this.selectBoxDelegate = new selectBoxCustom_1.SelectBoxList(options, selected, contextViewProvider, styles, selectBoxOptions);
40
- }
41
-
42
- this._register(this.selectBoxDelegate);
43
- } // Public SelectBox Methods - routed through delegate interface
44
-
45
-
46
- get onDidSelect() {
47
- return this.selectBoxDelegate.onDidSelect;
48
- }
49
-
50
- setOptions(options, selected) {
51
- this.selectBoxDelegate.setOptions(options, selected);
52
- }
53
-
54
- select(index) {
55
- this.selectBoxDelegate.select(index);
56
- }
57
-
58
- setAriaLabel(label) {
59
- this.selectBoxDelegate.setAriaLabel(label);
60
- }
61
-
62
- focus() {
63
- this.selectBoxDelegate.focus();
64
- }
65
-
66
- blur() {
67
- this.selectBoxDelegate.blur();
68
- } // Public Widget Methods - routed through delegate interface
69
-
70
-
71
- render(container) {
72
- this.selectBoxDelegate.render(container);
73
- }
74
-
75
- style(styles) {
76
- this.selectBoxDelegate.style(styles);
77
- }
78
-
79
- applyStyles() {
80
- this.selectBoxDelegate.applyStyles();
81
- }
82
-
83
- }
84
-
85
- exports.SelectBox = SelectBox;