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,1371 +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.cleanMnemonic = exports.Menu = exports.Direction = exports.MENU_ESCAPED_MNEMONIC_REGEX = exports.MENU_MNEMONIC_REGEX = void 0;
11
-
12
- const nls = require("../../../../nls");
13
-
14
- const strings = require("../../../common/strings");
15
-
16
- const actions_1 = require("../../../common/actions");
17
-
18
- const actionbar_1 = require("../actionbar/actionbar");
19
-
20
- const dom_1 = require("../../dom");
21
-
22
- const keyboardEvent_1 = require("../../keyboardEvent");
23
-
24
- const async_1 = require("../../../common/async");
25
-
26
- const lifecycle_1 = require("../../../common/lifecycle");
27
-
28
- const scrollableElement_1 = require("../scrollbar/scrollableElement");
29
-
30
- const contextview_1 = require("../contextview/contextview");
31
-
32
- const platform_1 = require("../../../common/platform");
33
-
34
- const codicons_1 = require("../../../common/codicons");
35
-
36
- const actionViewItems_1 = require("../actionbar/actionViewItems");
37
-
38
- const codiconStyles_1 = require("../codicons/codiconStyles");
39
-
40
- const browser_1 = require("../../browser");
41
-
42
- const mouseEvent_1 = require("../../mouseEvent");
43
-
44
- exports.MENU_MNEMONIC_REGEX = /\(&([^\s&])\)|(^|[^&])&([^\s&])/;
45
- exports.MENU_ESCAPED_MNEMONIC_REGEX = /(&)?(&)([^\s&])/g;
46
- const menuSelectionIcon = codicons_1.registerIcon('menu-selection', codicons_1.Codicon.check);
47
- const menuSubmenuIcon = codicons_1.registerIcon('menu-submenu', codicons_1.Codicon.chevronRight);
48
- var Direction;
49
-
50
- (function (Direction) {
51
- Direction[Direction["Right"] = 0] = "Right";
52
- Direction[Direction["Left"] = 1] = "Left";
53
- })(Direction = exports.Direction || (exports.Direction = {}));
54
-
55
- class Menu extends actionbar_1.ActionBar {
56
- constructor(container, actions, options = {}) {
57
- container.classList.add('monaco-menu-container');
58
- container.setAttribute('role', 'presentation');
59
- const menuElement = document.createElement('div');
60
- menuElement.classList.add('monaco-menu');
61
- menuElement.setAttribute('role', 'presentation');
62
- super(menuElement, {
63
- orientation: 2
64
- /* VERTICAL */
65
- ,
66
- actionViewItemProvider: action => this.doGetActionViewItem(action, options, parentData),
67
- context: options.context,
68
- actionRunner: options.actionRunner,
69
- ariaLabel: options.ariaLabel,
70
- triggerKeys: {
71
- keys: [3
72
- /* Enter */
73
- , ...(platform_1.isMacintosh || platform_1.isLinux ? [10
74
- /* Space */
75
- ] : [])],
76
- keyDown: true
77
- }
78
- });
79
- this.menuElement = menuElement;
80
- this.actionsList.setAttribute('role', 'menu');
81
- this.actionsList.tabIndex = 0;
82
- this.menuDisposables = this._register(new lifecycle_1.DisposableStore());
83
- this.initializeStyleSheet(container);
84
- dom_1.addDisposableListener(menuElement, dom_1.EventType.KEY_DOWN, e => {
85
- const event = new keyboardEvent_1.StandardKeyboardEvent(e); // Stop tab navigation of menus
86
-
87
- if (event.equals(2
88
- /* Tab */
89
- )) {
90
- e.preventDefault();
91
- }
92
- });
93
-
94
- if (options.enableMnemonics) {
95
- this.menuDisposables.add(dom_1.addDisposableListener(menuElement, dom_1.EventType.KEY_DOWN, e => {
96
- const key = e.key.toLocaleLowerCase();
97
-
98
- if (this.mnemonics.has(key)) {
99
- dom_1.EventHelper.stop(e, true);
100
- const actions = this.mnemonics.get(key);
101
-
102
- if (actions.length === 1) {
103
- if (actions[0] instanceof SubmenuMenuActionViewItem && actions[0].container) {
104
- this.focusItemByElement(actions[0].container);
105
- }
106
-
107
- actions[0].onClick(e);
108
- }
109
-
110
- if (actions.length > 1) {
111
- const action = actions.shift();
112
-
113
- if (action && action.container) {
114
- this.focusItemByElement(action.container);
115
- actions.push(action);
116
- }
117
-
118
- this.mnemonics.set(key, actions);
119
- }
120
- }
121
- }));
122
- }
123
-
124
- if (platform_1.isLinux) {
125
- this._register(dom_1.addDisposableListener(menuElement, dom_1.EventType.KEY_DOWN, e => {
126
- const event = new keyboardEvent_1.StandardKeyboardEvent(e);
127
-
128
- if (event.equals(14
129
- /* Home */
130
- ) || event.equals(11
131
- /* PageUp */
132
- )) {
133
- this.focusedItem = this.viewItems.length - 1;
134
- this.focusNext();
135
- dom_1.EventHelper.stop(e, true);
136
- } else if (event.equals(13
137
- /* End */
138
- ) || event.equals(12
139
- /* PageDown */
140
- )) {
141
- this.focusedItem = 0;
142
- this.focusPrevious();
143
- dom_1.EventHelper.stop(e, true);
144
- }
145
- }));
146
- }
147
-
148
- this._register(dom_1.addDisposableListener(this.domNode, dom_1.EventType.MOUSE_OUT, e => {
149
- let relatedTarget = e.relatedTarget;
150
-
151
- if (!dom_1.isAncestor(relatedTarget, this.domNode)) {
152
- this.focusedItem = undefined;
153
- this.updateFocus();
154
- e.stopPropagation();
155
- }
156
- }));
157
-
158
- this._register(dom_1.addDisposableListener(this.actionsList, dom_1.EventType.MOUSE_OVER, e => {
159
- let target = e.target;
160
-
161
- if (!target || !dom_1.isAncestor(target, this.actionsList) || target === this.actionsList) {
162
- return;
163
- }
164
-
165
- while (target.parentElement !== this.actionsList && target.parentElement !== null) {
166
- target = target.parentElement;
167
- }
168
-
169
- if (target.classList.contains('action-item')) {
170
- const lastFocusedItem = this.focusedItem;
171
- this.setFocusedItem(target);
172
-
173
- if (lastFocusedItem !== this.focusedItem) {
174
- this.updateFocus();
175
- }
176
- }
177
- }));
178
-
179
- let parentData = {
180
- parent: this
181
- };
182
- this.mnemonics = new Map(); // Scroll Logic
183
-
184
- this.scrollableElement = this._register(new scrollableElement_1.DomScrollableElement(menuElement, {
185
- alwaysConsumeMouseWheel: true,
186
- horizontal: 2
187
- /* Hidden */
188
- ,
189
- vertical: 3
190
- /* Visible */
191
- ,
192
- verticalScrollbarSize: 7,
193
- handleMouseWheel: true,
194
- useShadows: true
195
- }));
196
- const scrollElement = this.scrollableElement.getDomNode();
197
- scrollElement.style.position = '';
198
-
199
- this._register(dom_1.addDisposableListener(scrollElement, dom_1.EventType.MOUSE_UP, e => {
200
- // Absorb clicks in menu dead space https://github.com/microsoft/vscode/issues/63575
201
- // We do this on the scroll element so the scroll bar doesn't dismiss the menu either
202
- e.preventDefault();
203
- }));
204
-
205
- menuElement.style.maxHeight = `${Math.max(10, window.innerHeight - container.getBoundingClientRect().top - 35)}px`;
206
- actions = actions.filter(a => {
207
- var _a;
208
-
209
- if ((_a = options.submenuIds) === null || _a === void 0 ? void 0 : _a.has(a.id)) {
210
- console.warn(`Found submenu cycle: ${a.id}`);
211
- return false;
212
- }
213
-
214
- return true;
215
- });
216
- this.push(actions, {
217
- icon: true,
218
- label: true,
219
- isMenu: true
220
- });
221
- container.appendChild(this.scrollableElement.getDomNode());
222
- this.scrollableElement.scanDomNode();
223
- this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item, index, array) => {
224
- item.updatePositionInSet(index + 1, array.length);
225
- });
226
- }
227
-
228
- initializeStyleSheet(container) {
229
- if (dom_1.isInShadowDOM(container)) {
230
- this.styleSheet = dom_1.createStyleSheet(container);
231
- this.styleSheet.textContent = MENU_WIDGET_CSS;
232
- } else {
233
- if (!Menu.globalStyleSheet) {
234
- Menu.globalStyleSheet = dom_1.createStyleSheet();
235
- Menu.globalStyleSheet.textContent = MENU_WIDGET_CSS;
236
- }
237
-
238
- this.styleSheet = Menu.globalStyleSheet;
239
- }
240
- }
241
-
242
- style(style) {
243
- const container = this.getContainer();
244
- const fgColor = style.foregroundColor ? `${style.foregroundColor}` : '';
245
- const bgColor = style.backgroundColor ? `${style.backgroundColor}` : '';
246
- const border = style.borderColor ? `1px solid ${style.borderColor}` : '';
247
- const shadow = style.shadowColor ? `0 2px 4px ${style.shadowColor}` : '';
248
- container.style.border = border;
249
- this.domNode.style.color = fgColor;
250
- this.domNode.style.backgroundColor = bgColor;
251
- container.style.boxShadow = shadow;
252
-
253
- if (this.viewItems) {
254
- this.viewItems.forEach(item => {
255
- if (item instanceof BaseMenuActionViewItem || item instanceof MenuSeparatorActionViewItem) {
256
- item.style(style);
257
- }
258
- });
259
- }
260
- }
261
-
262
- getContainer() {
263
- return this.scrollableElement.getDomNode();
264
- }
265
-
266
- get onScroll() {
267
- return this.scrollableElement.onScroll;
268
- }
269
-
270
- get scrollOffset() {
271
- return this.menuElement.scrollTop;
272
- }
273
-
274
- trigger(index) {
275
- if (index <= this.viewItems.length && index >= 0) {
276
- const item = this.viewItems[index];
277
-
278
- if (item instanceof SubmenuMenuActionViewItem) {
279
- super.focus(index);
280
- item.open(true);
281
- } else if (item instanceof BaseMenuActionViewItem) {
282
- super.run(item._action, item._context);
283
- } else {
284
- return;
285
- }
286
- }
287
- }
288
-
289
- focusItemByElement(element) {
290
- const lastFocusedItem = this.focusedItem;
291
- this.setFocusedItem(element);
292
-
293
- if (lastFocusedItem !== this.focusedItem) {
294
- this.updateFocus();
295
- }
296
- }
297
-
298
- setFocusedItem(element) {
299
- for (let i = 0; i < this.actionsList.children.length; i++) {
300
- let elem = this.actionsList.children[i];
301
-
302
- if (element === elem) {
303
- this.focusedItem = i;
304
- break;
305
- }
306
- }
307
- }
308
-
309
- updateFocus(fromRight) {
310
- super.updateFocus(fromRight, true);
311
-
312
- if (typeof this.focusedItem !== 'undefined') {
313
- // Workaround for #80047 caused by an issue in chromium
314
- // https://bugs.chromium.org/p/chromium/issues/detail?id=414283
315
- // When that's fixed, just call this.scrollableElement.scanDomNode()
316
- this.scrollableElement.setScrollPosition({
317
- scrollTop: Math.round(this.menuElement.scrollTop)
318
- });
319
- }
320
- }
321
-
322
- doGetActionViewItem(action, options, parentData) {
323
- if (action instanceof actions_1.Separator) {
324
- return new MenuSeparatorActionViewItem(options.context, action, {
325
- icon: true
326
- });
327
- } else if (action instanceof actions_1.SubmenuAction) {
328
- const menuActionViewItem = new SubmenuMenuActionViewItem(action, action.actions, parentData, { ...options,
329
- submenuIds: new Set([...(options.submenuIds || []), action.id])
330
- });
331
-
332
- if (options.enableMnemonics) {
333
- const mnemonic = menuActionViewItem.getMnemonic();
334
-
335
- if (mnemonic && menuActionViewItem.isEnabled()) {
336
- let actionViewItems = [];
337
-
338
- if (this.mnemonics.has(mnemonic)) {
339
- actionViewItems = this.mnemonics.get(mnemonic);
340
- }
341
-
342
- actionViewItems.push(menuActionViewItem);
343
- this.mnemonics.set(mnemonic, actionViewItems);
344
- }
345
- }
346
-
347
- return menuActionViewItem;
348
- } else {
349
- const menuItemOptions = {
350
- enableMnemonics: options.enableMnemonics,
351
- useEventAsContext: options.useEventAsContext
352
- };
353
-
354
- if (options.getKeyBinding) {
355
- const keybinding = options.getKeyBinding(action);
356
-
357
- if (keybinding) {
358
- const keybindingLabel = keybinding.getLabel();
359
-
360
- if (keybindingLabel) {
361
- menuItemOptions.keybinding = keybindingLabel;
362
- }
363
- }
364
- }
365
-
366
- const menuActionViewItem = new BaseMenuActionViewItem(options.context, action, menuItemOptions);
367
-
368
- if (options.enableMnemonics) {
369
- const mnemonic = menuActionViewItem.getMnemonic();
370
-
371
- if (mnemonic && menuActionViewItem.isEnabled()) {
372
- let actionViewItems = [];
373
-
374
- if (this.mnemonics.has(mnemonic)) {
375
- actionViewItems = this.mnemonics.get(mnemonic);
376
- }
377
-
378
- actionViewItems.push(menuActionViewItem);
379
- this.mnemonics.set(mnemonic, actionViewItems);
380
- }
381
- }
382
-
383
- return menuActionViewItem;
384
- }
385
- }
386
-
387
- }
388
-
389
- exports.Menu = Menu;
390
-
391
- class BaseMenuActionViewItem extends actionViewItems_1.BaseActionViewItem {
392
- constructor(ctx, action, options = {}) {
393
- options.isMenu = true;
394
- super(action, action, options);
395
- this.options = options;
396
- this.options.icon = options.icon !== undefined ? options.icon : false;
397
- this.options.label = options.label !== undefined ? options.label : true;
398
- this.cssClass = ''; // Set mnemonic
399
-
400
- if (this.options.label && options.enableMnemonics) {
401
- let label = this.getAction().label;
402
-
403
- if (label) {
404
- let matches = exports.MENU_MNEMONIC_REGEX.exec(label);
405
-
406
- if (matches) {
407
- this.mnemonic = (!!matches[1] ? matches[1] : matches[3]).toLocaleLowerCase();
408
- }
409
- }
410
- } // Add mouse up listener later to avoid accidental clicks
411
-
412
-
413
- this.runOnceToEnableMouseUp = new async_1.RunOnceScheduler(() => {
414
- if (!this.element) {
415
- return;
416
- }
417
-
418
- this._register(dom_1.addDisposableListener(this.element, dom_1.EventType.MOUSE_UP, e => {
419
- // removed default prevention as it conflicts
420
- // with BaseActionViewItem #101537
421
- // add back if issues arise and link new issue
422
- dom_1.EventHelper.stop(e, true); // See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Interact_with_the_clipboard
423
- // > Writing to the clipboard
424
- // > You can use the "cut" and "copy" commands without any special
425
- // permission if you are using them in a short-lived event handler
426
- // for a user action (for example, a click handler).
427
- // => to get the Copy and Paste context menu actions working on Firefox,
428
- // there should be no timeout here
429
-
430
- if (browser_1.isFirefox) {
431
- const mouseEvent = new mouseEvent_1.StandardMouseEvent(e); // Allowing right click to trigger the event causes the issue described below,
432
- // but since the solution below does not work in FF, we must disable right click
433
-
434
- if (mouseEvent.rightButton) {
435
- return;
436
- }
437
-
438
- this.onClick(e);
439
- } // In all other cases, set timout to allow context menu cancellation to trigger
440
- // otherwise the action will destroy the menu and a second context menu
441
- // will still trigger for right click.
442
-
443
-
444
- setTimeout(() => {
445
- this.onClick(e);
446
- }, 0);
447
- }));
448
-
449
- this._register(dom_1.addDisposableListener(this.element, dom_1.EventType.CONTEXT_MENU, e => {
450
- dom_1.EventHelper.stop(e, true);
451
- }));
452
- }, 100);
453
-
454
- this._register(this.runOnceToEnableMouseUp);
455
- }
456
-
457
- render(container) {
458
- super.render(container);
459
-
460
- if (!this.element) {
461
- return;
462
- }
463
-
464
- this.container = container;
465
- this.item = dom_1.append(this.element, dom_1.$('a.action-menu-item'));
466
-
467
- if (this._action.id === actions_1.Separator.ID) {
468
- // A separator is a presentation item
469
- this.item.setAttribute('role', 'presentation');
470
- } else {
471
- this.item.setAttribute('role', 'menuitem');
472
-
473
- if (this.mnemonic) {
474
- this.item.setAttribute('aria-keyshortcuts', `${this.mnemonic}`);
475
- }
476
- }
477
-
478
- this.check = dom_1.append(this.item, dom_1.$('span.menu-item-check' + menuSelectionIcon.cssSelector));
479
- this.check.setAttribute('role', 'none');
480
- this.label = dom_1.append(this.item, dom_1.$('span.action-label'));
481
-
482
- if (this.options.label && this.options.keybinding) {
483
- dom_1.append(this.item, dom_1.$('span.keybinding')).textContent = this.options.keybinding;
484
- } // Adds mouse up listener to actually run the action
485
-
486
-
487
- this.runOnceToEnableMouseUp.schedule();
488
- this.updateClass();
489
- this.updateLabel();
490
- this.updateTooltip();
491
- this.updateEnabled();
492
- this.updateChecked();
493
- }
494
-
495
- blur() {
496
- super.blur();
497
- this.applyStyle();
498
- }
499
-
500
- focus() {
501
- super.focus();
502
-
503
- if (this.item) {
504
- this.item.focus();
505
- }
506
-
507
- this.applyStyle();
508
- }
509
-
510
- updatePositionInSet(pos, setSize) {
511
- if (this.item) {
512
- this.item.setAttribute('aria-posinset', `${pos}`);
513
- this.item.setAttribute('aria-setsize', `${setSize}`);
514
- }
515
- }
516
-
517
- updateLabel() {
518
- if (!this.label) {
519
- return;
520
- }
521
-
522
- if (this.options.label) {
523
- dom_1.clearNode(this.label);
524
- let label = codicons_1.stripCodicons(this.getAction().label);
525
-
526
- if (label) {
527
- const cleanLabel = cleanMnemonic(label);
528
-
529
- if (!this.options.enableMnemonics) {
530
- label = cleanLabel;
531
- }
532
-
533
- this.label.setAttribute('aria-label', cleanLabel.replace(/&&/g, '&'));
534
- const matches = exports.MENU_MNEMONIC_REGEX.exec(label);
535
-
536
- if (matches) {
537
- label = strings.escape(label); // This is global, reset it
538
-
539
- exports.MENU_ESCAPED_MNEMONIC_REGEX.lastIndex = 0;
540
- let escMatch = exports.MENU_ESCAPED_MNEMONIC_REGEX.exec(label); // We can't use negative lookbehind so if we match our negative and skip
541
-
542
- while (escMatch && escMatch[1]) {
543
- escMatch = exports.MENU_ESCAPED_MNEMONIC_REGEX.exec(label);
544
- }
545
-
546
- const replaceDoubleEscapes = str => str.replace(/&amp;&amp;/g, '&amp;');
547
-
548
- if (escMatch) {
549
- this.label.append(strings.ltrim(replaceDoubleEscapes(label.substr(0, escMatch.index)), ' '), dom_1.$('u', {
550
- 'aria-hidden': 'true'
551
- }, escMatch[3]), strings.rtrim(replaceDoubleEscapes(label.substr(escMatch.index + escMatch[0].length)), ' '));
552
- } else {
553
- this.label.innerText = replaceDoubleEscapes(label).trim();
554
- }
555
-
556
- if (this.item) {
557
- this.item.setAttribute('aria-keyshortcuts', (!!matches[1] ? matches[1] : matches[3]).toLocaleLowerCase());
558
- }
559
- } else {
560
- this.label.innerText = label.replace(/&&/g, '&').trim();
561
- }
562
- }
563
- }
564
- }
565
-
566
- updateTooltip() {
567
- let title = null;
568
-
569
- if (this.getAction().tooltip) {
570
- title = this.getAction().tooltip;
571
- } else if (!this.options.label && this.getAction().label && this.options.icon) {
572
- title = this.getAction().label;
573
-
574
- if (this.options.keybinding) {
575
- title = nls.localize({
576
- key: 'titleLabel',
577
- comment: ['action title', 'action keybinding']
578
- }, "{0} ({1})", title, this.options.keybinding);
579
- }
580
- }
581
-
582
- if (title && this.item) {
583
- this.item.title = title;
584
- }
585
- }
586
-
587
- updateClass() {
588
- if (this.cssClass && this.item) {
589
- this.item.classList.remove(...this.cssClass.split(' '));
590
- }
591
-
592
- if (this.options.icon && this.label) {
593
- this.cssClass = this.getAction().class || '';
594
- this.label.classList.add('icon');
595
-
596
- if (this.cssClass) {
597
- this.label.classList.add(...this.cssClass.split(' '));
598
- }
599
-
600
- this.updateEnabled();
601
- } else if (this.label) {
602
- this.label.classList.remove('icon');
603
- }
604
- }
605
-
606
- updateEnabled() {
607
- if (this.getAction().enabled) {
608
- if (this.element) {
609
- this.element.classList.remove('disabled');
610
- }
611
-
612
- if (this.item) {
613
- this.item.classList.remove('disabled');
614
- this.item.tabIndex = 0;
615
- }
616
- } else {
617
- if (this.element) {
618
- this.element.classList.add('disabled');
619
- }
620
-
621
- if (this.item) {
622
- this.item.classList.add('disabled');
623
- dom_1.removeTabIndexAndUpdateFocus(this.item);
624
- }
625
- }
626
- }
627
-
628
- updateChecked() {
629
- if (!this.item) {
630
- return;
631
- }
632
-
633
- if (this.getAction().checked) {
634
- this.item.classList.add('checked');
635
- this.item.setAttribute('role', 'menuitemcheckbox');
636
- this.item.setAttribute('aria-checked', 'true');
637
- } else {
638
- this.item.classList.remove('checked');
639
- this.item.setAttribute('role', 'menuitem');
640
- this.item.setAttribute('aria-checked', 'false');
641
- }
642
- }
643
-
644
- getMnemonic() {
645
- return this.mnemonic;
646
- }
647
-
648
- applyStyle() {
649
- if (!this.menuStyle) {
650
- return;
651
- }
652
-
653
- const isSelected = this.element && this.element.classList.contains('focused');
654
- const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor;
655
- const bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : undefined;
656
- const border = isSelected && this.menuStyle.selectionBorderColor ? `thin solid ${this.menuStyle.selectionBorderColor}` : '';
657
-
658
- if (this.item) {
659
- this.item.style.color = fgColor ? fgColor.toString() : '';
660
- this.item.style.backgroundColor = bgColor ? bgColor.toString() : '';
661
- }
662
-
663
- if (this.check) {
664
- this.check.style.color = fgColor ? fgColor.toString() : '';
665
- }
666
-
667
- if (this.container) {
668
- this.container.style.border = border;
669
- }
670
- }
671
-
672
- style(style) {
673
- this.menuStyle = style;
674
- this.applyStyle();
675
- }
676
-
677
- }
678
-
679
- class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
680
- constructor(action, submenuActions, parentData, submenuOptions) {
681
- super(action, action, submenuOptions);
682
- this.submenuActions = submenuActions;
683
- this.parentData = parentData;
684
- this.submenuOptions = submenuOptions;
685
- this.mysubmenu = null;
686
- this.submenuDisposables = this._register(new lifecycle_1.DisposableStore());
687
- this.mouseOver = false;
688
- this.expandDirection = submenuOptions && submenuOptions.expandDirection !== undefined ? submenuOptions.expandDirection : Direction.Right;
689
- this.showScheduler = new async_1.RunOnceScheduler(() => {
690
- if (this.mouseOver) {
691
- this.cleanupExistingSubmenu(false);
692
- this.createSubmenu(false);
693
- }
694
- }, 250);
695
- this.hideScheduler = new async_1.RunOnceScheduler(() => {
696
- if (this.element && !dom_1.isAncestor(dom_1.getActiveElement(), this.element) && this.parentData.submenu === this.mysubmenu) {
697
- this.parentData.parent.focus(false);
698
- this.cleanupExistingSubmenu(true);
699
- }
700
- }, 750);
701
- }
702
-
703
- render(container) {
704
- super.render(container);
705
-
706
- if (!this.element) {
707
- return;
708
- }
709
-
710
- if (this.item) {
711
- this.item.classList.add('monaco-submenu-item');
712
- this.item.setAttribute('aria-haspopup', 'true');
713
- this.updateAriaExpanded('false');
714
- this.submenuIndicator = dom_1.append(this.item, dom_1.$('span.submenu-indicator' + menuSubmenuIcon.cssSelector));
715
- this.submenuIndicator.setAttribute('aria-hidden', 'true');
716
- }
717
-
718
- this._register(dom_1.addDisposableListener(this.element, dom_1.EventType.KEY_UP, e => {
719
- let event = new keyboardEvent_1.StandardKeyboardEvent(e);
720
-
721
- if (event.equals(17
722
- /* RightArrow */
723
- ) || event.equals(3
724
- /* Enter */
725
- )) {
726
- dom_1.EventHelper.stop(e, true);
727
- this.createSubmenu(true);
728
- }
729
- }));
730
-
731
- this._register(dom_1.addDisposableListener(this.element, dom_1.EventType.KEY_DOWN, e => {
732
- let event = new keyboardEvent_1.StandardKeyboardEvent(e);
733
-
734
- if (dom_1.getActiveElement() === this.item) {
735
- if (event.equals(17
736
- /* RightArrow */
737
- ) || event.equals(3
738
- /* Enter */
739
- )) {
740
- dom_1.EventHelper.stop(e, true);
741
- }
742
- }
743
- }));
744
-
745
- this._register(dom_1.addDisposableListener(this.element, dom_1.EventType.MOUSE_OVER, e => {
746
- if (!this.mouseOver) {
747
- this.mouseOver = true;
748
- this.showScheduler.schedule();
749
- }
750
- }));
751
-
752
- this._register(dom_1.addDisposableListener(this.element, dom_1.EventType.MOUSE_LEAVE, e => {
753
- this.mouseOver = false;
754
- }));
755
-
756
- this._register(dom_1.addDisposableListener(this.element, dom_1.EventType.FOCUS_OUT, e => {
757
- if (this.element && !dom_1.isAncestor(dom_1.getActiveElement(), this.element)) {
758
- this.hideScheduler.schedule();
759
- }
760
- }));
761
-
762
- this._register(this.parentData.parent.onScroll(() => {
763
- this.parentData.parent.focus(false);
764
- this.cleanupExistingSubmenu(false);
765
- }));
766
- }
767
-
768
- open(selectFirst) {
769
- this.cleanupExistingSubmenu(false);
770
- this.createSubmenu(selectFirst);
771
- }
772
-
773
- onClick(e) {
774
- // stop clicking from trying to run an action
775
- dom_1.EventHelper.stop(e, true);
776
- this.cleanupExistingSubmenu(false);
777
- this.createSubmenu(true);
778
- }
779
-
780
- cleanupExistingSubmenu(force) {
781
- if (this.parentData.submenu && (force || this.parentData.submenu !== this.mysubmenu)) {
782
- // disposal may throw if the submenu has already been removed
783
- try {
784
- this.parentData.submenu.dispose();
785
- } catch {}
786
-
787
- this.parentData.submenu = undefined;
788
- this.updateAriaExpanded('false');
789
-
790
- if (this.submenuContainer) {
791
- this.submenuDisposables.clear();
792
- this.submenuContainer = undefined;
793
- }
794
- }
795
- }
796
-
797
- calculateSubmenuMenuLayout(windowDimensions, submenu, entry, expandDirection) {
798
- const ret = {
799
- top: 0,
800
- left: 0
801
- }; // Start with horizontal
802
-
803
- ret.left = contextview_1.layout(windowDimensions.width, submenu.width, {
804
- position: expandDirection === Direction.Right ? 0
805
- /* Before */
806
- : 1
807
- /* After */
808
- ,
809
- offset: entry.left,
810
- size: entry.width
811
- }); // We don't have enough room to layout the menu fully, so we are overlapping the menu
812
-
813
- if (ret.left >= entry.left && ret.left < entry.left + entry.width) {
814
- if (entry.left + 10 + submenu.width <= windowDimensions.width) {
815
- ret.left = entry.left + 10;
816
- }
817
-
818
- entry.top += 10;
819
- entry.height = 0;
820
- } // Now that we have a horizontal position, try layout vertically
821
-
822
-
823
- ret.top = contextview_1.layout(windowDimensions.height, submenu.height, {
824
- position: 0
825
- /* Before */
826
- ,
827
- offset: entry.top,
828
- size: 0
829
- }); // We didn't have enough room below, but we did above, so we shift down to align the menu
830
-
831
- if (ret.top + submenu.height === entry.top && ret.top + entry.height + submenu.height <= windowDimensions.height) {
832
- ret.top += entry.height;
833
- }
834
-
835
- return ret;
836
- }
837
-
838
- createSubmenu(selectFirstItem = true) {
839
- if (!this.element) {
840
- return;
841
- }
842
-
843
- if (!this.parentData.submenu) {
844
- this.updateAriaExpanded('true');
845
- this.submenuContainer = dom_1.append(this.element, dom_1.$('div.monaco-submenu'));
846
- this.submenuContainer.classList.add('menubar-menu-items-holder', 'context-view'); // Set the top value of the menu container before construction
847
- // This allows the menu constructor to calculate the proper max height
848
-
849
- const computedStyles = getComputedStyle(this.parentData.parent.domNode);
850
- const paddingTop = parseFloat(computedStyles.paddingTop || '0') || 0; // this.submenuContainer.style.top = `${this.element.offsetTop - this.parentData.parent.scrollOffset - paddingTop}px`;
851
-
852
- this.submenuContainer.style.zIndex = '1';
853
- this.submenuContainer.style.position = 'fixed';
854
- this.submenuContainer.style.top = '0';
855
- this.submenuContainer.style.left = '0';
856
- this.parentData.submenu = new Menu(this.submenuContainer, this.submenuActions, this.submenuOptions);
857
-
858
- if (this.menuStyle) {
859
- this.parentData.submenu.style(this.menuStyle);
860
- } // layout submenu
861
-
862
-
863
- const entryBox = this.element.getBoundingClientRect();
864
- const entryBoxUpdated = {
865
- top: entryBox.top - paddingTop,
866
- left: entryBox.left,
867
- height: entryBox.height + 2 * paddingTop,
868
- width: entryBox.width
869
- };
870
- const viewBox = this.submenuContainer.getBoundingClientRect();
871
- const {
872
- top,
873
- left
874
- } = this.calculateSubmenuMenuLayout({
875
- height: window.innerHeight,
876
- width: window.innerWidth
877
- }, viewBox, entryBoxUpdated, this.expandDirection);
878
- this.submenuContainer.style.left = `${left}px`;
879
- this.submenuContainer.style.top = `${top}px`;
880
- this.submenuDisposables.add(dom_1.addDisposableListener(this.submenuContainer, dom_1.EventType.KEY_UP, e => {
881
- let event = new keyboardEvent_1.StandardKeyboardEvent(e);
882
-
883
- if (event.equals(15
884
- /* LeftArrow */
885
- )) {
886
- dom_1.EventHelper.stop(e, true);
887
- this.parentData.parent.focus();
888
- this.cleanupExistingSubmenu(true);
889
- }
890
- }));
891
- this.submenuDisposables.add(dom_1.addDisposableListener(this.submenuContainer, dom_1.EventType.KEY_DOWN, e => {
892
- let event = new keyboardEvent_1.StandardKeyboardEvent(e);
893
-
894
- if (event.equals(15
895
- /* LeftArrow */
896
- )) {
897
- dom_1.EventHelper.stop(e, true);
898
- }
899
- }));
900
- this.submenuDisposables.add(this.parentData.submenu.onDidCancel(() => {
901
- this.parentData.parent.focus();
902
- this.cleanupExistingSubmenu(true);
903
- }));
904
- this.parentData.submenu.focus(selectFirstItem);
905
- this.mysubmenu = this.parentData.submenu;
906
- } else {
907
- this.parentData.submenu.focus(false);
908
- }
909
- }
910
-
911
- updateAriaExpanded(value) {
912
- var _a;
913
-
914
- if (this.item) {
915
- (_a = this.item) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', value);
916
- }
917
- }
918
-
919
- applyStyle() {
920
- super.applyStyle();
921
-
922
- if (!this.menuStyle) {
923
- return;
924
- }
925
-
926
- const isSelected = this.element && this.element.classList.contains('focused');
927
- const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor;
928
-
929
- if (this.submenuIndicator) {
930
- this.submenuIndicator.style.color = fgColor ? `${fgColor}` : '';
931
- }
932
-
933
- if (this.parentData.submenu) {
934
- this.parentData.submenu.style(this.menuStyle);
935
- }
936
- }
937
-
938
- dispose() {
939
- super.dispose();
940
- this.hideScheduler.dispose();
941
-
942
- if (this.mysubmenu) {
943
- this.mysubmenu.dispose();
944
- this.mysubmenu = null;
945
- }
946
-
947
- if (this.submenuContainer) {
948
- this.submenuContainer = undefined;
949
- }
950
- }
951
-
952
- }
953
-
954
- class MenuSeparatorActionViewItem extends actionViewItems_1.ActionViewItem {
955
- style(style) {
956
- if (this.label) {
957
- this.label.style.borderBottomColor = style.separatorColor ? `${style.separatorColor}` : '';
958
- }
959
- }
960
-
961
- }
962
-
963
- function cleanMnemonic(label) {
964
- const regex = exports.MENU_MNEMONIC_REGEX;
965
- const matches = regex.exec(label);
966
-
967
- if (!matches) {
968
- return label;
969
- }
970
-
971
- const mnemonicInText = !matches[1];
972
- return label.replace(regex, mnemonicInText ? '$2$3' : '').trim();
973
- }
974
-
975
- exports.cleanMnemonic = cleanMnemonic;
976
- let MENU_WIDGET_CSS = `
977
- .monaco-menu {
978
- font-size: 13px;
979
-
980
- }
981
-
982
- ${codiconStyles_1.formatRule(menuSelectionIcon)}
983
- ${codiconStyles_1.formatRule(menuSubmenuIcon)}
984
-
985
- .monaco-menu .monaco-action-bar {
986
- text-align: right;
987
- overflow: hidden;
988
- white-space: nowrap;
989
- }
990
-
991
- .monaco-menu .monaco-action-bar .actions-container {
992
- display: flex;
993
- margin: 0 auto;
994
- padding: 0;
995
- width: 100%;
996
- justify-content: flex-end;
997
- }
998
-
999
- .monaco-menu .monaco-action-bar.vertical .actions-container {
1000
- display: inline-block;
1001
- }
1002
-
1003
- .monaco-menu .monaco-action-bar.reverse .actions-container {
1004
- flex-direction: row-reverse;
1005
- }
1006
-
1007
- .monaco-menu .monaco-action-bar .action-item {
1008
- cursor: pointer;
1009
- display: inline-block;
1010
- transition: transform 50ms ease;
1011
- position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
1012
- }
1013
-
1014
- .monaco-menu .monaco-action-bar .action-item.disabled {
1015
- cursor: default;
1016
- }
1017
-
1018
- .monaco-menu .monaco-action-bar.animated .action-item.active {
1019
- transform: scale(1.272019649, 1.272019649); /* 1.272019649 = √φ */
1020
- }
1021
-
1022
- .monaco-menu .monaco-action-bar .action-item .icon,
1023
- .monaco-menu .monaco-action-bar .action-item .codicon {
1024
- display: inline-block;
1025
- }
1026
-
1027
- .monaco-menu .monaco-action-bar .action-item .codicon {
1028
- display: flex;
1029
- align-items: center;
1030
- }
1031
-
1032
- .monaco-menu .monaco-action-bar .action-label {
1033
- font-size: 11px;
1034
- margin-right: 4px;
1035
- }
1036
-
1037
- .monaco-menu .monaco-action-bar .action-item.disabled .action-label,
1038
- .monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover {
1039
- opacity: 0.4;
1040
- }
1041
-
1042
- /* Vertical actions */
1043
-
1044
- .monaco-menu .monaco-action-bar.vertical {
1045
- text-align: left;
1046
- }
1047
-
1048
- .monaco-menu .monaco-action-bar.vertical .action-item {
1049
- display: block;
1050
- }
1051
-
1052
- .monaco-menu .monaco-action-bar.vertical .action-label.separator {
1053
- display: block;
1054
- border-bottom: 1px solid #bbb;
1055
- padding-top: 1px;
1056
- margin-left: .8em;
1057
- margin-right: .8em;
1058
- }
1059
-
1060
- .monaco-menu .secondary-actions .monaco-action-bar .action-label {
1061
- margin-left: 6px;
1062
- }
1063
-
1064
- /* Action Items */
1065
- .monaco-menu .monaco-action-bar .action-item.select-container {
1066
- overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */
1067
- flex: 1;
1068
- max-width: 170px;
1069
- min-width: 60px;
1070
- display: flex;
1071
- align-items: center;
1072
- justify-content: center;
1073
- margin-right: 10px;
1074
- }
1075
-
1076
- .monaco-menu .monaco-action-bar.vertical {
1077
- margin-left: 0;
1078
- overflow: visible;
1079
- }
1080
-
1081
- .monaco-menu .monaco-action-bar.vertical .actions-container {
1082
- display: block;
1083
- }
1084
-
1085
- .monaco-menu .monaco-action-bar.vertical .action-item {
1086
- padding: 0;
1087
- transform: none;
1088
- display: flex;
1089
- }
1090
-
1091
- .monaco-menu .monaco-action-bar.vertical .action-item.active {
1092
- transform: none;
1093
- }
1094
-
1095
- .monaco-menu .monaco-action-bar.vertical .action-menu-item {
1096
- flex: 1 1 auto;
1097
- display: flex;
1098
- height: 2em;
1099
- align-items: center;
1100
- position: relative;
1101
- }
1102
-
1103
- .monaco-menu .monaco-action-bar.vertical .action-label {
1104
- flex: 1 1 auto;
1105
- text-decoration: none;
1106
- padding: 0 1em;
1107
- background: none;
1108
- font-size: 12px;
1109
- line-height: 1;
1110
- }
1111
-
1112
- .monaco-menu .monaco-action-bar.vertical .keybinding,
1113
- .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
1114
- display: inline-block;
1115
- flex: 2 1 auto;
1116
- padding: 0 1em;
1117
- text-align: right;
1118
- font-size: 12px;
1119
- line-height: 1;
1120
- }
1121
-
1122
- .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
1123
- height: 100%;
1124
- }
1125
-
1126
- .monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon {
1127
- font-size: 16px !important;
1128
- display: flex;
1129
- align-items: center;
1130
- }
1131
-
1132
- .monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before {
1133
- margin-left: auto;
1134
- margin-right: -20px;
1135
- }
1136
-
1137
- .monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding,
1138
- .monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator {
1139
- opacity: 0.4;
1140
- }
1141
-
1142
- .monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) {
1143
- display: inline-block;
1144
- box-sizing: border-box;
1145
- margin: 0;
1146
- }
1147
-
1148
- .monaco-menu .monaco-action-bar.vertical .action-item {
1149
- position: static;
1150
- overflow: visible;
1151
- }
1152
-
1153
- .monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu {
1154
- position: absolute;
1155
- }
1156
-
1157
- .monaco-menu .monaco-action-bar.vertical .action-label.separator {
1158
- padding: 0.5em 0 0 0;
1159
- margin-bottom: 0.5em;
1160
- width: 100%;
1161
- height: 0px !important;
1162
- margin-left: .8em !important;
1163
- margin-right: .8em !important;
1164
- }
1165
-
1166
- .monaco-menu .monaco-action-bar.vertical .action-label.separator.text {
1167
- padding: 0.7em 1em 0.1em 1em;
1168
- font-weight: bold;
1169
- opacity: 1;
1170
- }
1171
-
1172
- .monaco-menu .monaco-action-bar.vertical .action-label:hover {
1173
- color: inherit;
1174
- }
1175
-
1176
- .monaco-menu .monaco-action-bar.vertical .menu-item-check {
1177
- position: absolute;
1178
- visibility: hidden;
1179
- width: 1em;
1180
- height: 100%;
1181
- }
1182
-
1183
- .monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check {
1184
- visibility: visible;
1185
- display: flex;
1186
- align-items: center;
1187
- justify-content: center;
1188
- }
1189
-
1190
- /* Context Menu */
1191
-
1192
- .context-view.monaco-menu-container {
1193
- outline: 0;
1194
- border: none;
1195
- animation: fadeIn 0.083s linear;
1196
- }
1197
-
1198
- .context-view.monaco-menu-container :focus,
1199
- .context-view.monaco-menu-container .monaco-action-bar.vertical:focus,
1200
- .context-view.monaco-menu-container .monaco-action-bar.vertical :focus {
1201
- outline: 0;
1202
- }
1203
-
1204
- .monaco-menu .monaco-action-bar.vertical .action-item {
1205
- border: thin solid transparent; /* prevents jumping behaviour on hover or focus */
1206
- }
1207
-
1208
-
1209
- /* High Contrast Theming */
1210
- :host-context(.hc-black) .context-view.monaco-menu-container {
1211
- box-shadow: none;
1212
- }
1213
-
1214
- :host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused {
1215
- background: none;
1216
- }
1217
-
1218
- /* Vertical Action Bar Styles */
1219
-
1220
- .monaco-menu .monaco-action-bar.vertical {
1221
- padding: .5em 0;
1222
- }
1223
-
1224
- .monaco-menu .monaco-action-bar.vertical .action-menu-item {
1225
- height: 1.8em;
1226
- }
1227
-
1228
- .monaco-menu .monaco-action-bar.vertical .action-label:not(.separator),
1229
- .monaco-menu .monaco-action-bar.vertical .keybinding {
1230
- font-size: inherit;
1231
- padding: 0 2em;
1232
- }
1233
-
1234
- .monaco-menu .monaco-action-bar.vertical .menu-item-check {
1235
- font-size: inherit;
1236
- width: 2em;
1237
- }
1238
-
1239
- .monaco-menu .monaco-action-bar.vertical .action-label.separator {
1240
- font-size: inherit;
1241
- padding: 0.2em 0 0 0;
1242
- margin-bottom: 0.2em;
1243
- }
1244
-
1245
- :host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator {
1246
- margin-left: 0;
1247
- margin-right: 0;
1248
- }
1249
-
1250
- .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
1251
- font-size: 60%;
1252
- padding: 0 1.8em;
1253
- }
1254
-
1255
- :host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
1256
- height: 100%;
1257
- mask-size: 10px 10px;
1258
- -webkit-mask-size: 10px 10px;
1259
- }
1260
-
1261
- .monaco-menu .action-item {
1262
- cursor: default;
1263
- }
1264
-
1265
- /* Arrows */
1266
- .monaco-scrollable-element > .scrollbar > .scra {
1267
- cursor: pointer;
1268
- font-size: 11px !important;
1269
- }
1270
-
1271
- .monaco-scrollable-element > .visible {
1272
- opacity: 1;
1273
-
1274
- /* Background rule added for IE9 - to allow clicks on dom node */
1275
- background:rgba(0,0,0,0);
1276
-
1277
- transition: opacity 100ms linear;
1278
- }
1279
- .monaco-scrollable-element > .invisible {
1280
- opacity: 0;
1281
- pointer-events: none;
1282
- }
1283
- .monaco-scrollable-element > .invisible.fade {
1284
- transition: opacity 800ms linear;
1285
- }
1286
-
1287
- /* Scrollable Content Inset Shadow */
1288
- .monaco-scrollable-element > .shadow {
1289
- position: absolute;
1290
- display: none;
1291
- }
1292
- .monaco-scrollable-element > .shadow.top {
1293
- display: block;
1294
- top: 0;
1295
- left: 3px;
1296
- height: 3px;
1297
- width: 100%;
1298
- box-shadow: #DDD 0 6px 6px -6px inset;
1299
- }
1300
- .monaco-scrollable-element > .shadow.left {
1301
- display: block;
1302
- top: 3px;
1303
- left: 0;
1304
- height: 100%;
1305
- width: 3px;
1306
- box-shadow: #DDD 6px 0 6px -6px inset;
1307
- }
1308
- .monaco-scrollable-element > .shadow.top-left-corner {
1309
- display: block;
1310
- top: 0;
1311
- left: 0;
1312
- height: 3px;
1313
- width: 3px;
1314
- }
1315
- .monaco-scrollable-element > .shadow.top.left {
1316
- box-shadow: #DDD 6px 6px 6px -6px inset;
1317
- }
1318
-
1319
- /* ---------- Default Style ---------- */
1320
-
1321
- :host-context(.vs) .monaco-scrollable-element > .scrollbar > .slider {
1322
- background: rgba(100, 100, 100, .4);
1323
- }
1324
- :host-context(.vs-dark) .monaco-scrollable-element > .scrollbar > .slider {
1325
- background: rgba(121, 121, 121, .4);
1326
- }
1327
- :host-context(.hc-black) .monaco-scrollable-element > .scrollbar > .slider {
1328
- background: rgba(111, 195, 223, .6);
1329
- }
1330
-
1331
- .monaco-scrollable-element > .scrollbar > .slider:hover {
1332
- background: rgba(100, 100, 100, .7);
1333
- }
1334
- :host-context(.hc-black) .monaco-scrollable-element > .scrollbar > .slider:hover {
1335
- background: rgba(111, 195, 223, .8);
1336
- }
1337
-
1338
- .monaco-scrollable-element > .scrollbar > .slider.active {
1339
- background: rgba(0, 0, 0, .6);
1340
- }
1341
- :host-context(.vs-dark) .monaco-scrollable-element > .scrollbar > .slider.active {
1342
- background: rgba(191, 191, 191, .4);
1343
- }
1344
- :host-context(.hc-black) .monaco-scrollable-element > .scrollbar > .slider.active {
1345
- background: rgba(111, 195, 223, 1);
1346
- }
1347
-
1348
- :host-context(.vs-dark) .monaco-scrollable-element .shadow.top {
1349
- box-shadow: none;
1350
- }
1351
-
1352
- :host-context(.vs-dark) .monaco-scrollable-element .shadow.left {
1353
- box-shadow: #000 6px 0 6px -6px inset;
1354
- }
1355
-
1356
- :host-context(.vs-dark) .monaco-scrollable-element .shadow.top.left {
1357
- box-shadow: #000 6px 6px 6px -6px inset;
1358
- }
1359
-
1360
- :host-context(.hc-black) .monaco-scrollable-element .shadow.top {
1361
- box-shadow: none;
1362
- }
1363
-
1364
- :host-context(.hc-black) .monaco-scrollable-element .shadow.left {
1365
- box-shadow: none;
1366
- }
1367
-
1368
- :host-context(.hc-black) .monaco-scrollable-element .shadow.top.left {
1369
- box-shadow: none;
1370
- }
1371
- `;