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,188 +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.SelectBoxNative = void 0;
11
-
12
- const lifecycle_1 = require("../../../common/lifecycle");
13
-
14
- const event_1 = require("../../../common/event");
15
-
16
- const dom = require("../../dom");
17
-
18
- const arrays = require("../../../common/arrays");
19
-
20
- const platform_1 = require("../../../common/platform");
21
-
22
- const touch_1 = require("../../touch");
23
-
24
- class SelectBoxNative extends lifecycle_1.Disposable {
25
- constructor(options, selected, styles, selectBoxOptions) {
26
- super();
27
- this.selected = 0;
28
- this.selectBoxOptions = selectBoxOptions || Object.create(null);
29
- this.options = [];
30
- this.selectElement = document.createElement('select');
31
- this.selectElement.className = 'monaco-select-box';
32
-
33
- if (typeof this.selectBoxOptions.ariaLabel === 'string') {
34
- this.selectElement.setAttribute('aria-label', this.selectBoxOptions.ariaLabel);
35
- }
36
-
37
- this._onDidSelect = this._register(new event_1.Emitter());
38
- this.styles = styles;
39
- this.registerListeners();
40
- this.setOptions(options, selected);
41
- }
42
-
43
- registerListeners() {
44
- this._register(touch_1.Gesture.addTarget(this.selectElement));
45
-
46
- [touch_1.EventType.Tap].forEach(eventType => {
47
- this._register(dom.addDisposableListener(this.selectElement, eventType, e => {
48
- this.selectElement.focus();
49
- }));
50
- });
51
-
52
- this._register(dom.addStandardDisposableListener(this.selectElement, 'click', e => {
53
- dom.EventHelper.stop(e, true);
54
- }));
55
-
56
- this._register(dom.addStandardDisposableListener(this.selectElement, 'change', e => {
57
- this.selectElement.title = e.target.value;
58
-
59
- this._onDidSelect.fire({
60
- index: e.target.selectedIndex,
61
- selected: e.target.value
62
- });
63
- }));
64
-
65
- this._register(dom.addStandardDisposableListener(this.selectElement, 'keydown', e => {
66
- let showSelect = false;
67
-
68
- if (platform_1.isMacintosh) {
69
- if (e.keyCode === 18
70
- /* DownArrow */
71
- || e.keyCode === 16
72
- /* UpArrow */
73
- || e.keyCode === 10
74
- /* Space */
75
- ) {
76
- showSelect = true;
77
- }
78
- } else {
79
- if (e.keyCode === 18
80
- /* DownArrow */
81
- && e.altKey || e.keyCode === 10
82
- /* Space */
83
- || e.keyCode === 3
84
- /* Enter */
85
- ) {
86
- showSelect = true;
87
- }
88
- }
89
-
90
- if (showSelect) {
91
- // Space, Enter, is used to expand select box, do not propagate it (prevent action bar action run)
92
- e.stopPropagation();
93
- }
94
- }));
95
- }
96
-
97
- get onDidSelect() {
98
- return this._onDidSelect.event;
99
- }
100
-
101
- setOptions(options, selected) {
102
- if (!this.options || !arrays.equals(this.options, options)) {
103
- this.options = options;
104
- this.selectElement.options.length = 0;
105
- this.options.forEach((option, index) => {
106
- this.selectElement.add(this.createOption(option.text, index, option.isDisabled));
107
- });
108
- }
109
-
110
- if (selected !== undefined) {
111
- this.select(selected);
112
- }
113
- }
114
-
115
- select(index) {
116
- if (this.options.length === 0) {
117
- this.selected = 0;
118
- } else if (index >= 0 && index < this.options.length) {
119
- this.selected = index;
120
- } else if (index > this.options.length - 1) {
121
- // Adjust index to end of list
122
- // This could make client out of sync with the select
123
- this.select(this.options.length - 1);
124
- } else if (this.selected < 0) {
125
- this.selected = 0;
126
- }
127
-
128
- this.selectElement.selectedIndex = this.selected;
129
-
130
- if (this.selected < this.options.length && typeof this.options[this.selected].text === 'string') {
131
- this.selectElement.title = this.options[this.selected].text;
132
- } else {
133
- this.selectElement.title = '';
134
- }
135
- }
136
-
137
- setAriaLabel(label) {
138
- this.selectBoxOptions.ariaLabel = label;
139
- this.selectElement.setAttribute('aria-label', label);
140
- }
141
-
142
- focus() {
143
- if (this.selectElement) {
144
- this.selectElement.focus();
145
- }
146
- }
147
-
148
- blur() {
149
- if (this.selectElement) {
150
- this.selectElement.blur();
151
- }
152
- }
153
-
154
- render(container) {
155
- container.classList.add('select-container');
156
- container.appendChild(this.selectElement);
157
- this.setOptions(this.options, this.selected);
158
- this.applyStyles();
159
- }
160
-
161
- style(styles) {
162
- this.styles = styles;
163
- this.applyStyles();
164
- }
165
-
166
- applyStyles() {
167
- // Style native select
168
- if (this.selectElement) {
169
- const background = this.styles.selectBackground ? this.styles.selectBackground.toString() : '';
170
- const foreground = this.styles.selectForeground ? this.styles.selectForeground.toString() : '';
171
- const border = this.styles.selectBorder ? this.styles.selectBorder.toString() : '';
172
- this.selectElement.style.backgroundColor = background;
173
- this.selectElement.style.color = foreground;
174
- this.selectElement.style.borderColor = border;
175
- }
176
- }
177
-
178
- createOption(value, index, disabled) {
179
- const option = document.createElement('option');
180
- option.value = value;
181
- option.text = value;
182
- option.disabled = !!disabled;
183
- return option;
184
- }
185
-
186
- }
187
-
188
- exports.SelectBoxNative = SelectBoxNative;
@@ -1,206 +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.ToolBar = void 0;
11
-
12
- require("../../../../css!./toolbar");
13
-
14
- const nls = require("../../../../nls");
15
-
16
- const actions_1 = require("../../../common/actions");
17
-
18
- const actionbar_1 = require("../actionbar/actionbar");
19
-
20
- const lifecycle_1 = require("../../../common/lifecycle");
21
-
22
- const types_1 = require("../../../common/types");
23
-
24
- const codicons_1 = require("../../../common/codicons");
25
-
26
- const event_1 = require("../../../common/event");
27
-
28
- const dropdownActionViewItem_1 = require("../dropdown/dropdownActionViewItem");
29
-
30
- const toolBarMoreIcon = codicons_1.registerIcon('toolbar-more', codicons_1.Codicon.more);
31
- /**
32
- * A widget that combines an action bar for primary actions and a dropdown for secondary actions.
33
- */
34
-
35
- class ToolBar extends lifecycle_1.Disposable {
36
- constructor(container, contextMenuProvider, options = {
37
- orientation: 0
38
- /* HORIZONTAL */
39
-
40
- }) {
41
- super();
42
- this.submenuActionViewItems = [];
43
- this.hasSecondaryActions = false;
44
- this._onDidChangeDropdownVisibility = this._register(new event_1.EventMultiplexer());
45
- this.onDidChangeDropdownVisibility = this._onDidChangeDropdownVisibility.event;
46
- this.disposables = new lifecycle_1.DisposableStore();
47
- this.options = options;
48
- this.lookupKeybindings = typeof this.options.getKeyBinding === 'function';
49
- this.toggleMenuAction = this._register(new ToggleMenuAction(() => {
50
- var _a;
51
-
52
- return (_a = this.toggleMenuActionViewItem) === null || _a === void 0 ? void 0 : _a.show();
53
- }, options.toggleMenuTitle));
54
- this.element = document.createElement('div');
55
- this.element.className = 'monaco-toolbar';
56
- container.appendChild(this.element);
57
- this.actionBar = this._register(new actionbar_1.ActionBar(this.element, {
58
- orientation: options.orientation,
59
- ariaLabel: options.ariaLabel,
60
- actionRunner: options.actionRunner,
61
- actionViewItemProvider: action => {
62
- if (action.id === ToggleMenuAction.ID) {
63
- this.toggleMenuActionViewItem = new dropdownActionViewItem_1.DropdownMenuActionViewItem(action, action.menuActions, contextMenuProvider, {
64
- actionViewItemProvider: this.options.actionViewItemProvider,
65
- actionRunner: this.actionRunner,
66
- keybindingProvider: this.options.getKeyBinding,
67
- classNames: toolBarMoreIcon.classNamesArray,
68
- anchorAlignmentProvider: this.options.anchorAlignmentProvider,
69
- menuAsChild: !!this.options.renderDropdownAsChildElement
70
- });
71
- this.toggleMenuActionViewItem.setActionContext(this.actionBar.context);
72
- this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility));
73
- return this.toggleMenuActionViewItem;
74
- }
75
-
76
- if (options.actionViewItemProvider) {
77
- const result = options.actionViewItemProvider(action);
78
-
79
- if (result) {
80
- return result;
81
- }
82
- }
83
-
84
- if (action instanceof actions_1.SubmenuAction) {
85
- const result = new dropdownActionViewItem_1.DropdownMenuActionViewItem(action, action.actions, contextMenuProvider, {
86
- actionViewItemProvider: this.options.actionViewItemProvider,
87
- actionRunner: this.actionRunner,
88
- keybindingProvider: this.options.getKeyBinding,
89
- classNames: action.class,
90
- anchorAlignmentProvider: this.options.anchorAlignmentProvider,
91
- menuAsChild: true
92
- });
93
- result.setActionContext(this.actionBar.context);
94
- this.submenuActionViewItems.push(result);
95
- this.disposables.add(this._onDidChangeDropdownVisibility.add(result.onDidChangeVisibility));
96
- return result;
97
- }
98
-
99
- return undefined;
100
- }
101
- }));
102
- }
103
-
104
- set actionRunner(actionRunner) {
105
- this.actionBar.actionRunner = actionRunner;
106
- }
107
-
108
- get actionRunner() {
109
- return this.actionBar.actionRunner;
110
- }
111
-
112
- set context(context) {
113
- this.actionBar.context = context;
114
-
115
- if (this.toggleMenuActionViewItem) {
116
- this.toggleMenuActionViewItem.setActionContext(context);
117
- }
118
-
119
- for (const actionViewItem of this.submenuActionViewItems) {
120
- actionViewItem.setActionContext(context);
121
- }
122
- }
123
-
124
- getElement() {
125
- return this.element;
126
- }
127
-
128
- getItemsWidth() {
129
- let itemsWidth = 0;
130
-
131
- for (let i = 0; i < this.actionBar.length(); i++) {
132
- itemsWidth += this.actionBar.getWidth(i);
133
- }
134
-
135
- return itemsWidth;
136
- }
137
-
138
- setAriaLabel(label) {
139
- this.actionBar.setAriaLabel(label);
140
- }
141
-
142
- setActions(primaryActions, secondaryActions) {
143
- this.clear();
144
- let primaryActionsToSet = primaryActions ? primaryActions.slice(0) : []; // Inject additional action to open secondary actions if present
145
-
146
- this.hasSecondaryActions = !!(secondaryActions && secondaryActions.length > 0);
147
-
148
- if (this.hasSecondaryActions && secondaryActions) {
149
- this.toggleMenuAction.menuActions = secondaryActions.slice(0);
150
- primaryActionsToSet.push(this.toggleMenuAction);
151
- }
152
-
153
- primaryActionsToSet.forEach(action => {
154
- this.actionBar.push(action, {
155
- icon: true,
156
- label: false,
157
- keybinding: this.getKeybindingLabel(action)
158
- });
159
- });
160
- }
161
-
162
- getKeybindingLabel(action) {
163
- var _a, _b;
164
-
165
- const key = this.lookupKeybindings ? (_b = (_a = this.options).getKeyBinding) === null || _b === void 0 ? void 0 : _b.call(_a, action) : undefined;
166
- return types_1.withNullAsUndefined(key === null || key === void 0 ? void 0 : key.getLabel());
167
- }
168
-
169
- clear() {
170
- this.submenuActionViewItems = [];
171
- this.disposables.clear();
172
- this.actionBar.clear();
173
- }
174
-
175
- dispose() {
176
- this.clear();
177
- super.dispose();
178
- }
179
-
180
- }
181
-
182
- exports.ToolBar = ToolBar;
183
-
184
- class ToggleMenuAction extends actions_1.Action {
185
- constructor(toggleDropdownMenu, title) {
186
- title = title || nls.localize('moreActions', "More Actions...");
187
- super(ToggleMenuAction.ID, title, undefined, true);
188
- this._menuActions = [];
189
- this.toggleDropdownMenu = toggleDropdownMenu;
190
- }
191
-
192
- async run() {
193
- this.toggleDropdownMenu();
194
- }
195
-
196
- get menuActions() {
197
- return this._menuActions;
198
- }
199
-
200
- set menuActions(actions) {
201
- this._menuActions = actions;
202
- }
203
-
204
- }
205
-
206
- ToggleMenuAction.ID = 'toolbar.toggle.more';
@@ -1,69 +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.Widget = void 0;
11
-
12
- const dom = require("../dom");
13
-
14
- const keyboardEvent_1 = require("../keyboardEvent");
15
-
16
- const mouseEvent_1 = require("../mouseEvent");
17
-
18
- const lifecycle_1 = require("../../common/lifecycle");
19
-
20
- const touch_1 = require("../touch");
21
-
22
- class Widget extends lifecycle_1.Disposable {
23
- onclick(domNode, listener) {
24
- this._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, e => listener(new mouseEvent_1.StandardMouseEvent(e))));
25
- }
26
-
27
- onmousedown(domNode, listener) {
28
- this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, e => listener(new mouseEvent_1.StandardMouseEvent(e))));
29
- }
30
-
31
- onmouseover(domNode, listener) {
32
- this._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, e => listener(new mouseEvent_1.StandardMouseEvent(e))));
33
- }
34
-
35
- onnonbubblingmouseout(domNode, listener) {
36
- this._register(dom.addDisposableNonBubblingMouseOutListener(domNode, e => listener(new mouseEvent_1.StandardMouseEvent(e))));
37
- }
38
-
39
- onkeydown(domNode, listener) {
40
- this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, e => listener(new keyboardEvent_1.StandardKeyboardEvent(e))));
41
- }
42
-
43
- onkeyup(domNode, listener) {
44
- this._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, e => listener(new keyboardEvent_1.StandardKeyboardEvent(e))));
45
- }
46
-
47
- oninput(domNode, listener) {
48
- this._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener));
49
- }
50
-
51
- onblur(domNode, listener) {
52
- this._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener));
53
- }
54
-
55
- onfocus(domNode, listener) {
56
- this._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener));
57
- }
58
-
59
- onchange(domNode, listener) {
60
- this._register(dom.addDisposableListener(domNode, dom.EventType.CHANGE, listener));
61
- }
62
-
63
- ignoreGesture(domNode) {
64
- touch_1.Gesture.ignoreTarget(domNode);
65
- }
66
-
67
- }
68
-
69
- exports.Widget = Widget;
@@ -1,224 +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.SubmenuAction = exports.Separator = exports.RadioGroup = exports.ActionRunner = exports.Action = void 0;
11
-
12
- const lifecycle_1 = require("./lifecycle");
13
-
14
- const event_1 = require("./event");
15
-
16
- class Action extends lifecycle_1.Disposable {
17
- constructor(id, label = '', cssClass = '', enabled = true, actionCallback) {
18
- super();
19
- this._onDidChange = this._register(new event_1.Emitter());
20
- this.onDidChange = this._onDidChange.event;
21
- this._enabled = true;
22
- this._checked = false;
23
- this._id = id;
24
- this._label = label;
25
- this._cssClass = cssClass;
26
- this._enabled = enabled;
27
- this._actionCallback = actionCallback;
28
- }
29
-
30
- get id() {
31
- return this._id;
32
- }
33
-
34
- get label() {
35
- return this._label;
36
- }
37
-
38
- set label(value) {
39
- this._setLabel(value);
40
- }
41
-
42
- _setLabel(value) {
43
- if (this._label !== value) {
44
- this._label = value;
45
-
46
- this._onDidChange.fire({
47
- label: value
48
- });
49
- }
50
- }
51
-
52
- get tooltip() {
53
- return this._tooltip || '';
54
- }
55
-
56
- set tooltip(value) {
57
- this._setTooltip(value);
58
- }
59
-
60
- _setTooltip(value) {
61
- if (this._tooltip !== value) {
62
- this._tooltip = value;
63
-
64
- this._onDidChange.fire({
65
- tooltip: value
66
- });
67
- }
68
- }
69
-
70
- get class() {
71
- return this._cssClass;
72
- }
73
-
74
- set class(value) {
75
- this._setClass(value);
76
- }
77
-
78
- _setClass(value) {
79
- if (this._cssClass !== value) {
80
- this._cssClass = value;
81
-
82
- this._onDidChange.fire({
83
- class: value
84
- });
85
- }
86
- }
87
-
88
- get enabled() {
89
- return this._enabled;
90
- }
91
-
92
- set enabled(value) {
93
- this._setEnabled(value);
94
- }
95
-
96
- _setEnabled(value) {
97
- if (this._enabled !== value) {
98
- this._enabled = value;
99
-
100
- this._onDidChange.fire({
101
- enabled: value
102
- });
103
- }
104
- }
105
-
106
- get checked() {
107
- return this._checked;
108
- }
109
-
110
- set checked(value) {
111
- this._setChecked(value);
112
- }
113
-
114
- _setChecked(value) {
115
- if (this._checked !== value) {
116
- this._checked = value;
117
-
118
- this._onDidChange.fire({
119
- checked: value
120
- });
121
- }
122
- }
123
-
124
- run(event, _data) {
125
- if (this._actionCallback) {
126
- return this._actionCallback(event);
127
- }
128
-
129
- return Promise.resolve(true);
130
- }
131
-
132
- }
133
-
134
- exports.Action = Action;
135
-
136
- class ActionRunner extends lifecycle_1.Disposable {
137
- constructor() {
138
- super(...arguments);
139
- this._onDidBeforeRun = this._register(new event_1.Emitter());
140
- this.onDidBeforeRun = this._onDidBeforeRun.event;
141
- this._onDidRun = this._register(new event_1.Emitter());
142
- this.onDidRun = this._onDidRun.event;
143
- }
144
-
145
- async run(action, context) {
146
- if (!action.enabled) {
147
- return Promise.resolve(null);
148
- }
149
-
150
- this._onDidBeforeRun.fire({
151
- action: action
152
- });
153
-
154
- try {
155
- const result = await this.runAction(action, context);
156
-
157
- this._onDidRun.fire({
158
- action: action,
159
- result: result
160
- });
161
- } catch (error) {
162
- this._onDidRun.fire({
163
- action: action,
164
- error: error
165
- });
166
- }
167
- }
168
-
169
- runAction(action, context) {
170
- const res = context ? action.run(context) : action.run();
171
- return Promise.resolve(res);
172
- }
173
-
174
- }
175
-
176
- exports.ActionRunner = ActionRunner;
177
-
178
- class RadioGroup extends lifecycle_1.Disposable {
179
- constructor(actions) {
180
- super();
181
- this.actions = actions;
182
-
183
- for (const action of actions) {
184
- this._register(action.onDidChange(e => {
185
- if (e.checked && action.checked) {
186
- for (const candidate of actions) {
187
- if (candidate !== action) {
188
- candidate.checked = false;
189
- }
190
- }
191
- }
192
- }));
193
- }
194
- }
195
-
196
- }
197
-
198
- exports.RadioGroup = RadioGroup;
199
-
200
- class Separator extends Action {
201
- constructor(label) {
202
- super(Separator.ID, label, label ? 'separator text' : 'separator');
203
- this.checked = false;
204
- this.enabled = false;
205
- }
206
-
207
- }
208
-
209
- exports.Separator = Separator;
210
- Separator.ID = 'vs.actions.separator';
211
-
212
- class SubmenuAction extends Action {
213
- constructor(id, label, _actions, cssClass) {
214
- super(id, label, cssClass, true);
215
- this._actions = _actions;
216
- }
217
-
218
- get actions() {
219
- return this._actions;
220
- }
221
-
222
- }
223
-
224
- exports.SubmenuAction = SubmenuAction;
@@ -1,31 +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.getUriFromAmdModule = exports.getPathFromAmdModule = void 0;
11
-
12
- const uri_1 = require("./uri");
13
- /**
14
- * @deprecated use `FileAccess.asFileUri(relativePath, requireFn).fsPath`
15
- */
16
-
17
-
18
- function getPathFromAmdModule(requirefn, relativePath) {
19
- return getUriFromAmdModule(requirefn, relativePath).fsPath;
20
- }
21
-
22
- exports.getPathFromAmdModule = getPathFromAmdModule;
23
- /**
24
- * @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
25
- */
26
-
27
- function getUriFromAmdModule(requirefn, relativePath) {
28
- return uri_1.URI.parse(requirefn.toUrl(relativePath));
29
- }
30
-
31
- exports.getUriFromAmdModule = getUriFromAmdModule;