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,154 +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.transformAndReviveIncomingURIs = exports.transformIncomingURIs = exports.transformOutgoingURIs = exports.DefaultURITransformer = exports.URITransformer = void 0;
11
-
12
- const uri_1 = require("./uri");
13
-
14
- function toJSON(uri) {
15
- return uri.toJSON();
16
- }
17
-
18
- class URITransformer {
19
- constructor(uriTransformer) {
20
- this._uriTransformer = uriTransformer;
21
- }
22
-
23
- transformIncoming(uri) {
24
- const result = this._uriTransformer.transformIncoming(uri);
25
-
26
- return result === uri ? uri : toJSON(uri_1.URI.from(result));
27
- }
28
-
29
- transformOutgoing(uri) {
30
- const result = this._uriTransformer.transformOutgoing(uri);
31
-
32
- return result === uri ? uri : toJSON(uri_1.URI.from(result));
33
- }
34
-
35
- transformOutgoingURI(uri) {
36
- const result = this._uriTransformer.transformOutgoing(uri);
37
-
38
- return result === uri ? uri : uri_1.URI.from(result);
39
- }
40
-
41
- transformOutgoingScheme(scheme) {
42
- return this._uriTransformer.transformOutgoingScheme(scheme);
43
- }
44
-
45
- }
46
-
47
- exports.URITransformer = URITransformer;
48
- exports.DefaultURITransformer = new class {
49
- transformIncoming(uri) {
50
- return uri;
51
- }
52
-
53
- transformOutgoing(uri) {
54
- return uri;
55
- }
56
-
57
- transformOutgoingURI(uri) {
58
- return uri;
59
- }
60
-
61
- transformOutgoingScheme(scheme) {
62
- return scheme;
63
- }
64
-
65
- }();
66
-
67
- function _transformOutgoingURIs(obj, transformer, depth) {
68
- if (!obj || depth > 200) {
69
- return null;
70
- }
71
-
72
- if (typeof obj === 'object') {
73
- if (obj instanceof uri_1.URI) {
74
- return transformer.transformOutgoing(obj);
75
- } // walk object (or array)
76
-
77
-
78
- for (let key in obj) {
79
- if (Object.hasOwnProperty.call(obj, key)) {
80
- const r = _transformOutgoingURIs(obj[key], transformer, depth + 1);
81
-
82
- if (r !== null) {
83
- obj[key] = r;
84
- }
85
- }
86
- }
87
- }
88
-
89
- return null;
90
- }
91
-
92
- function transformOutgoingURIs(obj, transformer) {
93
- const result = _transformOutgoingURIs(obj, transformer, 0);
94
-
95
- if (result === null) {
96
- // no change
97
- return obj;
98
- }
99
-
100
- return result;
101
- }
102
-
103
- exports.transformOutgoingURIs = transformOutgoingURIs;
104
-
105
- function _transformIncomingURIs(obj, transformer, revive, depth) {
106
- if (!obj || depth > 200) {
107
- return null;
108
- }
109
-
110
- if (typeof obj === 'object') {
111
- if (obj.$mid === 1) {
112
- return revive ? uri_1.URI.revive(transformer.transformIncoming(obj)) : transformer.transformIncoming(obj);
113
- } // walk object (or array)
114
-
115
-
116
- for (let key in obj) {
117
- if (Object.hasOwnProperty.call(obj, key)) {
118
- const r = _transformIncomingURIs(obj[key], transformer, revive, depth + 1);
119
-
120
- if (r !== null) {
121
- obj[key] = r;
122
- }
123
- }
124
- }
125
- }
126
-
127
- return null;
128
- }
129
-
130
- function transformIncomingURIs(obj, transformer) {
131
- const result = _transformIncomingURIs(obj, transformer, false, 0);
132
-
133
- if (result === null) {
134
- // no change
135
- return obj;
136
- }
137
-
138
- return result;
139
- }
140
-
141
- exports.transformIncomingURIs = transformIncomingURIs;
142
-
143
- function transformAndReviveIncomingURIs(obj, transformer) {
144
- const result = _transformIncomingURIs(obj, transformer, true, 0);
145
-
146
- if (result === null) {
147
- // no change
148
- return obj;
149
- }
150
-
151
- return result;
152
- }
153
-
154
- exports.transformAndReviveIncomingURIs = transformAndReviveIncomingURIs;
@@ -1,70 +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.generateUuid = exports.isUUID = void 0;
11
- const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
12
-
13
- function isUUID(value) {
14
- return _UUIDPattern.test(value);
15
- }
16
-
17
- exports.isUUID = isUUID; // prep-work
18
-
19
- const _data = new Uint8Array(16);
20
-
21
- const _hex = [];
22
-
23
- for (let i = 0; i < 256; i++) {
24
- _hex.push(i.toString(16).padStart(2, '0'));
25
- } // todo@joh node nodejs use `crypto#randomBytes`, see: https://nodejs.org/docs/latest/api/crypto.html#crypto_crypto_randombytes_size_callback
26
- // todo@joh use browser-crypto
27
-
28
-
29
- const _fillRandomValues = function (bucket) {
30
- for (let i = 0; i < bucket.length; i++) {
31
- bucket[i] = Math.floor(Math.random() * 256);
32
- }
33
-
34
- return bucket;
35
- };
36
-
37
- function generateUuid() {
38
- // get data
39
- _fillRandomValues(_data); // set version bits
40
-
41
-
42
- _data[6] = _data[6] & 0x0f | 0x40;
43
- _data[8] = _data[8] & 0x3f | 0x80; // print as string
44
-
45
- let i = 0;
46
- let result = '';
47
- result += _hex[_data[i++]];
48
- result += _hex[_data[i++]];
49
- result += _hex[_data[i++]];
50
- result += _hex[_data[i++]];
51
- result += '-';
52
- result += _hex[_data[i++]];
53
- result += _hex[_data[i++]];
54
- result += '-';
55
- result += _hex[_data[i++]];
56
- result += _hex[_data[i++]];
57
- result += '-';
58
- result += _hex[_data[i++]];
59
- result += _hex[_data[i++]];
60
- result += '-';
61
- result += _hex[_data[i++]];
62
- result += _hex[_data[i++]];
63
- result += _hex[_data[i++]];
64
- result += _hex[_data[i++]];
65
- result += _hex[_data[i++]];
66
- result += _hex[_data[i++]];
67
- return result;
68
- }
69
-
70
- exports.generateUuid = generateUuid;
@@ -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.localize = void 0;
11
-
12
- function _format(message, args) {
13
- let result;
14
-
15
- if (args.length === 0) {
16
- result = message;
17
- } else {
18
- result = message.replace(/\{(\d+)\}/g, function (match, rest) {
19
- const index = rest[0];
20
- return typeof args[index] !== 'undefined' ? args[index] : match;
21
- });
22
- }
23
-
24
- return result;
25
- }
26
-
27
- function localize(data, message, ...args) {
28
- return _format(message, args);
29
- }
30
-
31
- exports.localize = localize;
@@ -1,342 +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
- var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
8
- var c = arguments.length,
9
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
10
- d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12
- return c > 3 && r && Object.defineProperty(target, key, r), r;
13
- };
14
-
15
- var __param = this && this.__param || function (paramIndex, decorator) {
16
- return function (target, key) {
17
- decorator(target, key, paramIndex);
18
- };
19
- };
20
-
21
- Object.defineProperty(exports, "__esModule", {
22
- value: true
23
- });
24
- exports.SubmenuEntryActionViewItem = exports.MenuEntryActionViewItem = exports.createAndFillInActionBarActions = exports.createAndFillInContextMenuActions = void 0;
25
-
26
- const dom_1 = require("../../../base/browser/dom");
27
-
28
- const event_1 = require("../../../base/browser/event");
29
-
30
- const actions_1 = require("../../../base/common/actions");
31
-
32
- const event_2 = require("../../../base/common/event");
33
-
34
- const idGenerator_1 = require("../../../base/common/idGenerator");
35
-
36
- const lifecycle_1 = require("../../../base/common/lifecycle");
37
-
38
- const platform_1 = require("../../../base/common/platform");
39
-
40
- const nls_1 = require("../../../nls");
41
-
42
- const actions_2 = require("../common/actions");
43
-
44
- const contextView_1 = require("../../contextview/browser/contextView");
45
-
46
- const keybinding_1 = require("../../keybinding/common/keybinding");
47
-
48
- const themeService_1 = require("../../theme/common/themeService");
49
-
50
- const actionViewItems_1 = require("../../../base/browser/ui/actionbar/actionViewItems");
51
-
52
- const dropdownActionViewItem_1 = require("../../../base/browser/ui/dropdown/dropdownActionViewItem"); // The alternative key on all platforms is alt. On windows we also support shift as an alternative key #44136
53
-
54
-
55
- class AlternativeKeyEmitter extends event_2.Emitter {
56
- constructor(contextMenuService) {
57
- super();
58
- this._subscriptions = new lifecycle_1.DisposableStore();
59
- this._isPressed = false;
60
- this._suppressAltKeyUp = false;
61
-
62
- this._subscriptions.add(event_1.domEvent(document.body, 'keydown')(e => {
63
- this.isPressed = e.altKey || (platform_1.isWindows || platform_1.isLinux) && e.shiftKey;
64
- }));
65
-
66
- this._subscriptions.add(event_1.domEvent(document.body, 'keyup')(e => {
67
- if (this.isPressed) {
68
- if (this._suppressAltKeyUp) {
69
- e.preventDefault();
70
- }
71
- }
72
-
73
- this._suppressAltKeyUp = false;
74
- this.isPressed = false;
75
- }));
76
-
77
- this._subscriptions.add(event_1.domEvent(document.body, 'mouseleave')(e => this.isPressed = false));
78
-
79
- this._subscriptions.add(event_1.domEvent(document.body, 'blur')(e => this.isPressed = false)); // Workaround since we do not get any events while a context menu is shown
80
-
81
-
82
- this._subscriptions.add(contextMenuService.onDidContextMenu(() => this.isPressed = false));
83
- }
84
-
85
- get isPressed() {
86
- return this._isPressed;
87
- }
88
-
89
- set isPressed(value) {
90
- this._isPressed = value;
91
- this.fire(this._isPressed);
92
- }
93
-
94
- suppressAltKeyUp() {
95
- // Sometimes the native alt behavior needs to be suppresed since the alt was already used as an alternative key
96
- // Example: windows behavior to toggle tha top level menu #44396
97
- this._suppressAltKeyUp = true;
98
- }
99
-
100
- static getInstance(contextMenuService) {
101
- if (!AlternativeKeyEmitter.instance) {
102
- AlternativeKeyEmitter.instance = new AlternativeKeyEmitter(contextMenuService);
103
- }
104
-
105
- return AlternativeKeyEmitter.instance;
106
- }
107
-
108
- dispose() {
109
- super.dispose();
110
-
111
- this._subscriptions.dispose();
112
- }
113
-
114
- }
115
-
116
- function createAndFillInContextMenuActions(menu, options, target, contextMenuService, isPrimaryGroup) {
117
- const groups = menu.getActions(options);
118
- const useAlternativeActions = AlternativeKeyEmitter.getInstance(contextMenuService).isPressed;
119
- fillInActions(groups, target, useAlternativeActions, isPrimaryGroup);
120
- return asDisposable(groups);
121
- }
122
-
123
- exports.createAndFillInContextMenuActions = createAndFillInContextMenuActions;
124
-
125
- function createAndFillInActionBarActions(menu, options, target, isPrimaryGroup) {
126
- const groups = menu.getActions(options); // Action bars handle alternative actions on their own so the alternative actions should be ignored
127
-
128
- fillInActions(groups, target, false, isPrimaryGroup);
129
- return asDisposable(groups);
130
- }
131
-
132
- exports.createAndFillInActionBarActions = createAndFillInActionBarActions;
133
-
134
- function asDisposable(groups) {
135
- const disposables = new lifecycle_1.DisposableStore();
136
-
137
- for (const [, actions] of groups) {
138
- for (const action of actions) {
139
- disposables.add(action);
140
- }
141
- }
142
-
143
- return disposables;
144
- }
145
-
146
- function fillInActions(groups, target, useAlternativeActions, isPrimaryGroup = group => group === 'navigation') {
147
- for (let tuple of groups) {
148
- let [group, actions] = tuple;
149
-
150
- if (useAlternativeActions) {
151
- actions = actions.map(a => a instanceof actions_2.MenuItemAction && !!a.alt ? a.alt : a);
152
- }
153
-
154
- if (isPrimaryGroup(group)) {
155
- const to = Array.isArray(target) ? target : target.primary;
156
- to.unshift(...actions);
157
- } else {
158
- const to = Array.isArray(target) ? target : target.secondary;
159
-
160
- if (to.length > 0) {
161
- to.push(new actions_1.Separator());
162
- }
163
-
164
- to.push(...actions);
165
- }
166
- }
167
- }
168
-
169
- const ids = new idGenerator_1.IdGenerator('menu-item-action-item-icon-');
170
- const ICON_PATH_TO_CSS_RULES = new Map();
171
- let MenuEntryActionViewItem = class MenuEntryActionViewItem extends actionViewItems_1.ActionViewItem {
172
- constructor(_action, _keybindingService, _contextMenuService) {
173
- super(undefined, _action, {
174
- icon: !!(_action.class || _action.item.icon),
175
- label: !_action.class && !_action.item.icon
176
- });
177
- this._action = _action;
178
- this._keybindingService = _keybindingService;
179
- this._wantsAltCommand = false;
180
- this._itemClassDispose = this._register(new lifecycle_1.MutableDisposable());
181
- this._altKey = AlternativeKeyEmitter.getInstance(_contextMenuService);
182
- }
183
-
184
- get _commandAction() {
185
- return this._wantsAltCommand && this._action.alt || this._action;
186
- }
187
-
188
- onClick(event) {
189
- event.preventDefault();
190
- event.stopPropagation();
191
-
192
- if (this._altKey.isPressed) {
193
- this._altKey.suppressAltKeyUp();
194
- }
195
- }
196
-
197
- render(container) {
198
- super.render(container);
199
-
200
- this._updateItemClass(this._action.item);
201
-
202
- let mouseOver = false;
203
- let alternativeKeyDown = this._altKey.isPressed;
204
-
205
- const updateAltState = () => {
206
- const wantsAltCommand = mouseOver && alternativeKeyDown;
207
-
208
- if (wantsAltCommand !== this._wantsAltCommand) {
209
- this._wantsAltCommand = wantsAltCommand;
210
- this.updateLabel();
211
- this.updateTooltip();
212
- this.updateClass();
213
- }
214
- };
215
-
216
- if (this._action.alt) {
217
- this._register(this._altKey.event(value => {
218
- alternativeKeyDown = value;
219
- updateAltState();
220
- }));
221
- }
222
-
223
- this._register(event_1.domEvent(container, 'mouseleave')(_ => {
224
- mouseOver = false;
225
- updateAltState();
226
- }));
227
-
228
- this._register(event_1.domEvent(container, 'mouseenter')(e => {
229
- mouseOver = true;
230
- updateAltState();
231
- }));
232
- }
233
-
234
- updateLabel() {
235
- if (this.options.label && this.label) {
236
- this.label.textContent = this._commandAction.label;
237
- }
238
- }
239
-
240
- updateTooltip() {
241
- if (this.label) {
242
- const keybinding = this._keybindingService.lookupKeybinding(this._commandAction.id);
243
-
244
- const keybindingLabel = keybinding && keybinding.getLabel();
245
- const tooltip = this._commandAction.tooltip || this._commandAction.label;
246
- this.label.title = keybindingLabel ? nls_1.localize('titleAndKb', "{0} ({1})", tooltip, keybindingLabel) : tooltip;
247
- }
248
- }
249
-
250
- updateClass() {
251
- if (this.options.icon) {
252
- if (this._commandAction !== this._action) {
253
- if (this._action.alt) {
254
- this._updateItemClass(this._action.alt.item);
255
- }
256
- } else if (this._action.alt) {
257
- this._updateItemClass(this._action.item);
258
- }
259
- }
260
- }
261
-
262
- _updateItemClass(item) {
263
- var _a, _b;
264
-
265
- this._itemClassDispose.value = undefined;
266
- const icon = this._commandAction.checked && ((_a = item.toggled) === null || _a === void 0 ? void 0 : _a.icon) ? item.toggled.icon : item.icon;
267
-
268
- if (themeService_1.ThemeIcon.isThemeIcon(icon)) {
269
- // theme icons
270
- const iconClass = themeService_1.ThemeIcon.asClassName(icon);
271
-
272
- if (this.label && iconClass) {
273
- this.label.classList.add(...iconClass.split(' '));
274
- this._itemClassDispose.value = lifecycle_1.toDisposable(() => {
275
- if (this.label) {
276
- this.label.classList.remove(...iconClass.split(' '));
277
- }
278
- });
279
- }
280
- } else if (icon) {
281
- // icon path
282
- let iconClass;
283
-
284
- if ((_b = icon.dark) === null || _b === void 0 ? void 0 : _b.scheme) {
285
- const iconPathMapKey = icon.dark.toString();
286
-
287
- if (ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
288
- iconClass = ICON_PATH_TO_CSS_RULES.get(iconPathMapKey);
289
- } else {
290
- iconClass = ids.nextId();
291
- dom_1.createCSSRule(`.icon.${iconClass}`, `background-image: ${dom_1.asCSSUrl(icon.light || icon.dark)}`);
292
- dom_1.createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: ${dom_1.asCSSUrl(icon.dark)}`);
293
- ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, iconClass);
294
- }
295
-
296
- if (this.label) {
297
- this.label.classList.add('icon', ...iconClass.split(' '));
298
- this._itemClassDispose.value = lifecycle_1.toDisposable(() => {
299
- if (this.label) {
300
- this.label.classList.remove('icon', ...iconClass.split(' '));
301
- }
302
- });
303
- }
304
- }
305
- }
306
- }
307
-
308
- };
309
- MenuEntryActionViewItem = __decorate([__param(1, keybinding_1.IKeybindingService), __param(2, contextView_1.IContextMenuService)], MenuEntryActionViewItem);
310
- exports.MenuEntryActionViewItem = MenuEntryActionViewItem;
311
- let SubmenuEntryActionViewItem = class SubmenuEntryActionViewItem extends dropdownActionViewItem_1.DropdownMenuActionViewItem {
312
- constructor(action, _contextMenuService) {
313
- var _a;
314
-
315
- let classNames;
316
-
317
- if (action.item.icon) {
318
- if (themeService_1.ThemeIcon.isThemeIcon(action.item.icon)) {
319
- classNames = themeService_1.ThemeIcon.asClassName(action.item.icon);
320
- } else if ((_a = action.item.icon.dark) === null || _a === void 0 ? void 0 : _a.scheme) {
321
- const iconPathMapKey = action.item.icon.dark.toString();
322
-
323
- if (ICON_PATH_TO_CSS_RULES.has(iconPathMapKey)) {
324
- classNames = ['icon', ICON_PATH_TO_CSS_RULES.get(iconPathMapKey)];
325
- } else {
326
- const className = ids.nextId();
327
- classNames = ['icon', className];
328
- dom_1.createCSSRule(`.icon.${className}`, `background-image: ${dom_1.asCSSUrl(action.item.icon.light || action.item.icon.dark)}`);
329
- dom_1.createCSSRule(`.vs-dark .icon.${className}, .hc-black .icon.${className}`, `background-image: ${dom_1.asCSSUrl(action.item.icon.dark)}`);
330
- ICON_PATH_TO_CSS_RULES.set(iconPathMapKey, className);
331
- }
332
- }
333
- }
334
-
335
- super(action, action.actions, _contextMenuService, {
336
- classNames: classNames
337
- });
338
- }
339
-
340
- };
341
- SubmenuEntryActionViewItem = __decorate([__param(1, contextView_1.IContextMenuService)], SubmenuEntryActionViewItem);
342
- exports.SubmenuEntryActionViewItem = SubmenuEntryActionViewItem;