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,1210 +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.SET_CONTEXT_COMMAND_ID = exports.IContextKeyService = exports.RawContextKey = exports.ContextKeyOrExpr = exports.ContextKeyAndExpr = exports.ContextKeyNotRegexExpr = exports.ContextKeyRegexExpr = exports.ContextKeyNotExpr = exports.ContextKeyNotEqualsExpr = exports.ContextKeyNotInExpr = exports.ContextKeyInExpr = exports.ContextKeyEqualsExpr = exports.ContextKeyDefinedExpr = exports.ContextKeyTrueExpr = exports.ContextKeyFalseExpr = exports.ContextKeyExpr = void 0;
11
-
12
- const strings_1 = require("../../../base/common/strings");
13
-
14
- const instantiation_1 = require("../../instantiation/common/instantiation");
15
-
16
- const platform_1 = require("../../../base/common/platform");
17
-
18
- const STATIC_VALUES = new Map();
19
- STATIC_VALUES.set('false', false);
20
- STATIC_VALUES.set('true', true);
21
- STATIC_VALUES.set('isMac', platform_1.isMacintosh);
22
- STATIC_VALUES.set('isLinux', platform_1.isLinux);
23
- STATIC_VALUES.set('isWindows', platform_1.isWindows);
24
- STATIC_VALUES.set('isWeb', platform_1.isWeb);
25
- STATIC_VALUES.set('isMacNative', platform_1.isMacintosh && !platform_1.isWeb);
26
- const hasOwnProperty = Object.prototype.hasOwnProperty;
27
-
28
- class ContextKeyExpr {
29
- static false() {
30
- return ContextKeyFalseExpr.INSTANCE;
31
- }
32
-
33
- static true() {
34
- return ContextKeyTrueExpr.INSTANCE;
35
- }
36
-
37
- static has(key) {
38
- return ContextKeyDefinedExpr.create(key);
39
- }
40
-
41
- static equals(key, value) {
42
- return ContextKeyEqualsExpr.create(key, value);
43
- }
44
-
45
- static notEquals(key, value) {
46
- return ContextKeyNotEqualsExpr.create(key, value);
47
- }
48
-
49
- static regex(key, value) {
50
- return ContextKeyRegexExpr.create(key, value);
51
- }
52
-
53
- static in(key, value) {
54
- return ContextKeyInExpr.create(key, value);
55
- }
56
-
57
- static not(key) {
58
- return ContextKeyNotExpr.create(key);
59
- }
60
-
61
- static and(...expr) {
62
- return ContextKeyAndExpr.create(expr);
63
- }
64
-
65
- static or(...expr) {
66
- return ContextKeyOrExpr.create(expr);
67
- }
68
-
69
- static deserialize(serialized, strict = false) {
70
- if (!serialized) {
71
- return undefined;
72
- }
73
-
74
- return this._deserializeOrExpression(serialized, strict);
75
- }
76
-
77
- static _deserializeOrExpression(serialized, strict) {
78
- let pieces = serialized.split('||');
79
- return ContextKeyOrExpr.create(pieces.map(p => this._deserializeAndExpression(p, strict)));
80
- }
81
-
82
- static _deserializeAndExpression(serialized, strict) {
83
- let pieces = serialized.split('&&');
84
- return ContextKeyAndExpr.create(pieces.map(p => this._deserializeOne(p, strict)));
85
- }
86
-
87
- static _deserializeOne(serializedOne, strict) {
88
- serializedOne = serializedOne.trim();
89
-
90
- if (serializedOne.indexOf('!=') >= 0) {
91
- let pieces = serializedOne.split('!=');
92
- return ContextKeyNotEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1], strict));
93
- }
94
-
95
- if (serializedOne.indexOf('==') >= 0) {
96
- let pieces = serializedOne.split('==');
97
- return ContextKeyEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1], strict));
98
- }
99
-
100
- if (serializedOne.indexOf('=~') >= 0) {
101
- let pieces = serializedOne.split('=~');
102
- return ContextKeyRegexExpr.create(pieces[0].trim(), this._deserializeRegexValue(pieces[1], strict));
103
- }
104
-
105
- if (serializedOne.indexOf(' in ') >= 0) {
106
- let pieces = serializedOne.split(' in ');
107
- return ContextKeyInExpr.create(pieces[0].trim(), pieces[1].trim());
108
- }
109
-
110
- if (/^\!\s*/.test(serializedOne)) {
111
- return ContextKeyNotExpr.create(serializedOne.substr(1).trim());
112
- }
113
-
114
- return ContextKeyDefinedExpr.create(serializedOne);
115
- }
116
-
117
- static _deserializeValue(serializedValue, strict) {
118
- serializedValue = serializedValue.trim();
119
-
120
- if (serializedValue === 'true') {
121
- return true;
122
- }
123
-
124
- if (serializedValue === 'false') {
125
- return false;
126
- }
127
-
128
- let m = /^'([^']*)'$/.exec(serializedValue);
129
-
130
- if (m) {
131
- return m[1].trim();
132
- }
133
-
134
- return serializedValue;
135
- }
136
-
137
- static _deserializeRegexValue(serializedValue, strict) {
138
- if (strings_1.isFalsyOrWhitespace(serializedValue)) {
139
- if (strict) {
140
- throw new Error('missing regexp-value for =~-expression');
141
- } else {
142
- console.warn('missing regexp-value for =~-expression');
143
- }
144
-
145
- return null;
146
- }
147
-
148
- let start = serializedValue.indexOf('/');
149
- let end = serializedValue.lastIndexOf('/');
150
-
151
- if (start === end || start < 0
152
- /* || to < 0 */
153
- ) {
154
- if (strict) {
155
- throw new Error(`bad regexp-value '${serializedValue}', missing /-enclosure`);
156
- } else {
157
- console.warn(`bad regexp-value '${serializedValue}', missing /-enclosure`);
158
- }
159
-
160
- return null;
161
- }
162
-
163
- let value = serializedValue.slice(start + 1, end);
164
- let caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';
165
-
166
- try {
167
- return new RegExp(value, caseIgnoreFlag);
168
- } catch (e) {
169
- if (strict) {
170
- throw new Error(`bad regexp-value '${serializedValue}', parse error: ${e}`);
171
- } else {
172
- console.warn(`bad regexp-value '${serializedValue}', parse error: ${e}`);
173
- }
174
-
175
- return null;
176
- }
177
- }
178
-
179
- }
180
-
181
- exports.ContextKeyExpr = ContextKeyExpr;
182
-
183
- function cmp(a, b) {
184
- return a.cmp(b);
185
- }
186
-
187
- class ContextKeyFalseExpr {
188
- constructor() {
189
- this.type = 0
190
- /* False */
191
- ;
192
- }
193
-
194
- cmp(other) {
195
- return this.type - other.type;
196
- }
197
-
198
- equals(other) {
199
- return other.type === this.type;
200
- }
201
-
202
- evaluate(context) {
203
- return false;
204
- }
205
-
206
- serialize() {
207
- return 'false';
208
- }
209
-
210
- keys() {
211
- return [];
212
- }
213
-
214
- map(mapFnc) {
215
- return this;
216
- }
217
-
218
- negate() {
219
- return ContextKeyTrueExpr.INSTANCE;
220
- }
221
-
222
- }
223
-
224
- exports.ContextKeyFalseExpr = ContextKeyFalseExpr;
225
- ContextKeyFalseExpr.INSTANCE = new ContextKeyFalseExpr();
226
-
227
- class ContextKeyTrueExpr {
228
- constructor() {
229
- this.type = 1
230
- /* True */
231
- ;
232
- }
233
-
234
- cmp(other) {
235
- return this.type - other.type;
236
- }
237
-
238
- equals(other) {
239
- return other.type === this.type;
240
- }
241
-
242
- evaluate(context) {
243
- return true;
244
- }
245
-
246
- serialize() {
247
- return 'true';
248
- }
249
-
250
- keys() {
251
- return [];
252
- }
253
-
254
- map(mapFnc) {
255
- return this;
256
- }
257
-
258
- negate() {
259
- return ContextKeyFalseExpr.INSTANCE;
260
- }
261
-
262
- }
263
-
264
- exports.ContextKeyTrueExpr = ContextKeyTrueExpr;
265
- ContextKeyTrueExpr.INSTANCE = new ContextKeyTrueExpr();
266
-
267
- class ContextKeyDefinedExpr {
268
- constructor(key) {
269
- this.key = key;
270
- this.type = 2
271
- /* Defined */
272
- ;
273
- }
274
-
275
- static create(key) {
276
- const staticValue = STATIC_VALUES.get(key);
277
-
278
- if (typeof staticValue === 'boolean') {
279
- return staticValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
280
- }
281
-
282
- return new ContextKeyDefinedExpr(key);
283
- }
284
-
285
- cmp(other) {
286
- if (other.type !== this.type) {
287
- return this.type - other.type;
288
- }
289
-
290
- if (this.key < other.key) {
291
- return -1;
292
- }
293
-
294
- if (this.key > other.key) {
295
- return 1;
296
- }
297
-
298
- return 0;
299
- }
300
-
301
- equals(other) {
302
- if (other.type === this.type) {
303
- return this.key === other.key;
304
- }
305
-
306
- return false;
307
- }
308
-
309
- evaluate(context) {
310
- return !!context.getValue(this.key);
311
- }
312
-
313
- serialize() {
314
- return this.key;
315
- }
316
-
317
- keys() {
318
- return [this.key];
319
- }
320
-
321
- map(mapFnc) {
322
- return mapFnc.mapDefined(this.key);
323
- }
324
-
325
- negate() {
326
- return ContextKeyNotExpr.create(this.key);
327
- }
328
-
329
- }
330
-
331
- exports.ContextKeyDefinedExpr = ContextKeyDefinedExpr;
332
-
333
- class ContextKeyEqualsExpr {
334
- constructor(key, value) {
335
- this.key = key;
336
- this.value = value;
337
- this.type = 4
338
- /* Equals */
339
- ;
340
- }
341
-
342
- static create(key, value) {
343
- if (typeof value === 'boolean') {
344
- return value ? ContextKeyDefinedExpr.create(key) : ContextKeyNotExpr.create(key);
345
- }
346
-
347
- const staticValue = STATIC_VALUES.get(key);
348
-
349
- if (typeof staticValue === 'boolean') {
350
- const trueValue = staticValue ? 'true' : 'false';
351
- return value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
352
- }
353
-
354
- return new ContextKeyEqualsExpr(key, value);
355
- }
356
-
357
- cmp(other) {
358
- if (other.type !== this.type) {
359
- return this.type - other.type;
360
- }
361
-
362
- if (this.key < other.key) {
363
- return -1;
364
- }
365
-
366
- if (this.key > other.key) {
367
- return 1;
368
- }
369
-
370
- if (this.value < other.value) {
371
- return -1;
372
- }
373
-
374
- if (this.value > other.value) {
375
- return 1;
376
- }
377
-
378
- return 0;
379
- }
380
-
381
- equals(other) {
382
- if (other.type === this.type) {
383
- return this.key === other.key && this.value === other.value;
384
- }
385
-
386
- return false;
387
- }
388
-
389
- evaluate(context) {
390
- // Intentional ==
391
- // eslint-disable-next-line eqeqeq
392
- return context.getValue(this.key) == this.value;
393
- }
394
-
395
- serialize() {
396
- return this.key + ' == \'' + this.value + '\'';
397
- }
398
-
399
- keys() {
400
- return [this.key];
401
- }
402
-
403
- map(mapFnc) {
404
- return mapFnc.mapEquals(this.key, this.value);
405
- }
406
-
407
- negate() {
408
- return ContextKeyNotEqualsExpr.create(this.key, this.value);
409
- }
410
-
411
- }
412
-
413
- exports.ContextKeyEqualsExpr = ContextKeyEqualsExpr;
414
-
415
- class ContextKeyInExpr {
416
- constructor(key, valueKey) {
417
- this.key = key;
418
- this.valueKey = valueKey;
419
- this.type = 10
420
- /* In */
421
- ;
422
- }
423
-
424
- static create(key, valueKey) {
425
- return new ContextKeyInExpr(key, valueKey);
426
- }
427
-
428
- cmp(other) {
429
- if (other.type !== this.type) {
430
- return this.type - other.type;
431
- }
432
-
433
- if (this.key < other.key) {
434
- return -1;
435
- }
436
-
437
- if (this.key > other.key) {
438
- return 1;
439
- }
440
-
441
- if (this.valueKey < other.valueKey) {
442
- return -1;
443
- }
444
-
445
- if (this.valueKey > other.valueKey) {
446
- return 1;
447
- }
448
-
449
- return 0;
450
- }
451
-
452
- equals(other) {
453
- if (other.type === this.type) {
454
- return this.key === other.key && this.valueKey === other.valueKey;
455
- }
456
-
457
- return false;
458
- }
459
-
460
- evaluate(context) {
461
- const source = context.getValue(this.valueKey);
462
- const item = context.getValue(this.key);
463
-
464
- if (Array.isArray(source)) {
465
- return source.indexOf(item) >= 0;
466
- }
467
-
468
- if (typeof item === 'string' && typeof source === 'object' && source !== null) {
469
- return hasOwnProperty.call(source, item);
470
- }
471
-
472
- return false;
473
- }
474
-
475
- serialize() {
476
- return this.key + ' in \'' + this.valueKey + '\'';
477
- }
478
-
479
- keys() {
480
- return [this.key, this.valueKey];
481
- }
482
-
483
- map(mapFnc) {
484
- return mapFnc.mapIn(this.key, this.valueKey);
485
- }
486
-
487
- negate() {
488
- return ContextKeyNotInExpr.create(this);
489
- }
490
-
491
- }
492
-
493
- exports.ContextKeyInExpr = ContextKeyInExpr;
494
-
495
- class ContextKeyNotInExpr {
496
- constructor(_actual) {
497
- this._actual = _actual;
498
- this.type = 11
499
- /* NotIn */
500
- ; //
501
- }
502
-
503
- static create(actual) {
504
- return new ContextKeyNotInExpr(actual);
505
- }
506
-
507
- cmp(other) {
508
- if (other.type !== this.type) {
509
- return this.type - other.type;
510
- }
511
-
512
- return this._actual.cmp(other._actual);
513
- }
514
-
515
- equals(other) {
516
- if (other.type === this.type) {
517
- return this._actual.equals(other._actual);
518
- }
519
-
520
- return false;
521
- }
522
-
523
- evaluate(context) {
524
- return !this._actual.evaluate(context);
525
- }
526
-
527
- serialize() {
528
- throw new Error('Method not implemented.');
529
- }
530
-
531
- keys() {
532
- return this._actual.keys();
533
- }
534
-
535
- map(mapFnc) {
536
- return new ContextKeyNotInExpr(this._actual.map(mapFnc));
537
- }
538
-
539
- negate() {
540
- return this._actual;
541
- }
542
-
543
- }
544
-
545
- exports.ContextKeyNotInExpr = ContextKeyNotInExpr;
546
-
547
- class ContextKeyNotEqualsExpr {
548
- constructor(key, value) {
549
- this.key = key;
550
- this.value = value;
551
- this.type = 5
552
- /* NotEquals */
553
- ;
554
- }
555
-
556
- static create(key, value) {
557
- if (typeof value === 'boolean') {
558
- if (value) {
559
- return ContextKeyNotExpr.create(key);
560
- }
561
-
562
- return ContextKeyDefinedExpr.create(key);
563
- }
564
-
565
- const staticValue = STATIC_VALUES.get(key);
566
-
567
- if (typeof staticValue === 'boolean') {
568
- const falseValue = staticValue ? 'true' : 'false';
569
- return value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE;
570
- }
571
-
572
- return new ContextKeyNotEqualsExpr(key, value);
573
- }
574
-
575
- cmp(other) {
576
- if (other.type !== this.type) {
577
- return this.type - other.type;
578
- }
579
-
580
- if (this.key < other.key) {
581
- return -1;
582
- }
583
-
584
- if (this.key > other.key) {
585
- return 1;
586
- }
587
-
588
- if (this.value < other.value) {
589
- return -1;
590
- }
591
-
592
- if (this.value > other.value) {
593
- return 1;
594
- }
595
-
596
- return 0;
597
- }
598
-
599
- equals(other) {
600
- if (other.type === this.type) {
601
- return this.key === other.key && this.value === other.value;
602
- }
603
-
604
- return false;
605
- }
606
-
607
- evaluate(context) {
608
- // Intentional !=
609
- // eslint-disable-next-line eqeqeq
610
- return context.getValue(this.key) != this.value;
611
- }
612
-
613
- serialize() {
614
- return this.key + ' != \'' + this.value + '\'';
615
- }
616
-
617
- keys() {
618
- return [this.key];
619
- }
620
-
621
- map(mapFnc) {
622
- return mapFnc.mapNotEquals(this.key, this.value);
623
- }
624
-
625
- negate() {
626
- return ContextKeyEqualsExpr.create(this.key, this.value);
627
- }
628
-
629
- }
630
-
631
- exports.ContextKeyNotEqualsExpr = ContextKeyNotEqualsExpr;
632
-
633
- class ContextKeyNotExpr {
634
- constructor(key) {
635
- this.key = key;
636
- this.type = 3
637
- /* Not */
638
- ;
639
- }
640
-
641
- static create(key) {
642
- const staticValue = STATIC_VALUES.get(key);
643
-
644
- if (typeof staticValue === 'boolean') {
645
- return staticValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE;
646
- }
647
-
648
- return new ContextKeyNotExpr(key);
649
- }
650
-
651
- cmp(other) {
652
- if (other.type !== this.type) {
653
- return this.type - other.type;
654
- }
655
-
656
- if (this.key < other.key) {
657
- return -1;
658
- }
659
-
660
- if (this.key > other.key) {
661
- return 1;
662
- }
663
-
664
- return 0;
665
- }
666
-
667
- equals(other) {
668
- if (other.type === this.type) {
669
- return this.key === other.key;
670
- }
671
-
672
- return false;
673
- }
674
-
675
- evaluate(context) {
676
- return !context.getValue(this.key);
677
- }
678
-
679
- serialize() {
680
- return '!' + this.key;
681
- }
682
-
683
- keys() {
684
- return [this.key];
685
- }
686
-
687
- map(mapFnc) {
688
- return mapFnc.mapNot(this.key);
689
- }
690
-
691
- negate() {
692
- return ContextKeyDefinedExpr.create(this.key);
693
- }
694
-
695
- }
696
-
697
- exports.ContextKeyNotExpr = ContextKeyNotExpr;
698
-
699
- class ContextKeyRegexExpr {
700
- constructor(key, regexp) {
701
- this.key = key;
702
- this.regexp = regexp;
703
- this.type = 7
704
- /* Regex */
705
- ; //
706
- }
707
-
708
- static create(key, regexp) {
709
- return new ContextKeyRegexExpr(key, regexp);
710
- }
711
-
712
- cmp(other) {
713
- if (other.type !== this.type) {
714
- return this.type - other.type;
715
- }
716
-
717
- if (this.key < other.key) {
718
- return -1;
719
- }
720
-
721
- if (this.key > other.key) {
722
- return 1;
723
- }
724
-
725
- const thisSource = this.regexp ? this.regexp.source : '';
726
- const otherSource = other.regexp ? other.regexp.source : '';
727
-
728
- if (thisSource < otherSource) {
729
- return -1;
730
- }
731
-
732
- if (thisSource > otherSource) {
733
- return 1;
734
- }
735
-
736
- return 0;
737
- }
738
-
739
- equals(other) {
740
- if (other.type === this.type) {
741
- const thisSource = this.regexp ? this.regexp.source : '';
742
- const otherSource = other.regexp ? other.regexp.source : '';
743
- return this.key === other.key && thisSource === otherSource;
744
- }
745
-
746
- return false;
747
- }
748
-
749
- evaluate(context) {
750
- let value = context.getValue(this.key);
751
- return this.regexp ? this.regexp.test(value) : false;
752
- }
753
-
754
- serialize() {
755
- const value = this.regexp ? `/${this.regexp.source}/${this.regexp.ignoreCase ? 'i' : ''}` : '/invalid/';
756
- return `${this.key} =~ ${value}`;
757
- }
758
-
759
- keys() {
760
- return [this.key];
761
- }
762
-
763
- map(mapFnc) {
764
- return mapFnc.mapRegex(this.key, this.regexp);
765
- }
766
-
767
- negate() {
768
- return ContextKeyNotRegexExpr.create(this);
769
- }
770
-
771
- }
772
-
773
- exports.ContextKeyRegexExpr = ContextKeyRegexExpr;
774
-
775
- class ContextKeyNotRegexExpr {
776
- constructor(_actual) {
777
- this._actual = _actual;
778
- this.type = 8
779
- /* NotRegex */
780
- ; //
781
- }
782
-
783
- static create(actual) {
784
- return new ContextKeyNotRegexExpr(actual);
785
- }
786
-
787
- cmp(other) {
788
- if (other.type !== this.type) {
789
- return this.type - other.type;
790
- }
791
-
792
- return this._actual.cmp(other._actual);
793
- }
794
-
795
- equals(other) {
796
- if (other.type === this.type) {
797
- return this._actual.equals(other._actual);
798
- }
799
-
800
- return false;
801
- }
802
-
803
- evaluate(context) {
804
- return !this._actual.evaluate(context);
805
- }
806
-
807
- serialize() {
808
- throw new Error('Method not implemented.');
809
- }
810
-
811
- keys() {
812
- return this._actual.keys();
813
- }
814
-
815
- map(mapFnc) {
816
- return new ContextKeyNotRegexExpr(this._actual.map(mapFnc));
817
- }
818
-
819
- negate() {
820
- return this._actual;
821
- }
822
-
823
- }
824
-
825
- exports.ContextKeyNotRegexExpr = ContextKeyNotRegexExpr;
826
-
827
- class ContextKeyAndExpr {
828
- constructor(expr) {
829
- this.expr = expr;
830
- this.type = 6
831
- /* And */
832
- ;
833
- }
834
-
835
- static create(_expr) {
836
- return ContextKeyAndExpr._normalizeArr(_expr);
837
- }
838
-
839
- cmp(other) {
840
- if (other.type !== this.type) {
841
- return this.type - other.type;
842
- }
843
-
844
- if (this.expr.length < other.expr.length) {
845
- return -1;
846
- }
847
-
848
- if (this.expr.length > other.expr.length) {
849
- return 1;
850
- }
851
-
852
- for (let i = 0, len = this.expr.length; i < len; i++) {
853
- const r = cmp(this.expr[i], other.expr[i]);
854
-
855
- if (r !== 0) {
856
- return r;
857
- }
858
- }
859
-
860
- return 0;
861
- }
862
-
863
- equals(other) {
864
- if (other.type === this.type) {
865
- if (this.expr.length !== other.expr.length) {
866
- return false;
867
- }
868
-
869
- for (let i = 0, len = this.expr.length; i < len; i++) {
870
- if (!this.expr[i].equals(other.expr[i])) {
871
- return false;
872
- }
873
- }
874
-
875
- return true;
876
- }
877
-
878
- return false;
879
- }
880
-
881
- evaluate(context) {
882
- for (let i = 0, len = this.expr.length; i < len; i++) {
883
- if (!this.expr[i].evaluate(context)) {
884
- return false;
885
- }
886
- }
887
-
888
- return true;
889
- }
890
-
891
- static _normalizeArr(arr) {
892
- const expr = [];
893
- let hasTrue = false;
894
-
895
- for (const e of arr) {
896
- if (!e) {
897
- continue;
898
- }
899
-
900
- if (e.type === 1
901
- /* True */
902
- ) {
903
- // anything && true ==> anything
904
- hasTrue = true;
905
- continue;
906
- }
907
-
908
- if (e.type === 0
909
- /* False */
910
- ) {
911
- // anything && false ==> false
912
- return ContextKeyFalseExpr.INSTANCE;
913
- }
914
-
915
- if (e.type === 6
916
- /* And */
917
- ) {
918
- expr.push(...e.expr);
919
- continue;
920
- }
921
-
922
- expr.push(e);
923
- }
924
-
925
- if (expr.length === 0 && hasTrue) {
926
- return ContextKeyTrueExpr.INSTANCE;
927
- }
928
-
929
- if (expr.length === 0) {
930
- return undefined;
931
- }
932
-
933
- if (expr.length === 1) {
934
- return expr[0];
935
- }
936
-
937
- expr.sort(cmp); // We must distribute any OR expression because we don't support parens
938
- // OR extensions will be at the end (due to sorting rules)
939
-
940
- while (expr.length > 1) {
941
- const lastElement = expr[expr.length - 1];
942
-
943
- if (lastElement.type !== 9
944
- /* Or */
945
- ) {
946
- break;
947
- } // pop the last element
948
-
949
-
950
- expr.pop(); // pop the second to last element
951
-
952
- const secondToLastElement = expr.pop(); // distribute `lastElement` over `secondToLastElement`
953
-
954
- const resultElement = ContextKeyOrExpr.create(lastElement.expr.map(el => ContextKeyAndExpr.create([el, secondToLastElement])));
955
-
956
- if (resultElement) {
957
- expr.push(resultElement);
958
- expr.sort(cmp);
959
- }
960
- }
961
-
962
- if (expr.length === 1) {
963
- return expr[0];
964
- }
965
-
966
- return new ContextKeyAndExpr(expr);
967
- }
968
-
969
- serialize() {
970
- return this.expr.map(e => e.serialize()).join(' && ');
971
- }
972
-
973
- keys() {
974
- const result = [];
975
-
976
- for (let expr of this.expr) {
977
- result.push(...expr.keys());
978
- }
979
-
980
- return result;
981
- }
982
-
983
- map(mapFnc) {
984
- return new ContextKeyAndExpr(this.expr.map(expr => expr.map(mapFnc)));
985
- }
986
-
987
- negate() {
988
- let result = [];
989
-
990
- for (let expr of this.expr) {
991
- result.push(expr.negate());
992
- }
993
-
994
- return ContextKeyOrExpr.create(result);
995
- }
996
-
997
- }
998
-
999
- exports.ContextKeyAndExpr = ContextKeyAndExpr;
1000
-
1001
- class ContextKeyOrExpr {
1002
- constructor(expr) {
1003
- this.expr = expr;
1004
- this.type = 9
1005
- /* Or */
1006
- ;
1007
- }
1008
-
1009
- static create(_expr) {
1010
- const expr = ContextKeyOrExpr._normalizeArr(_expr);
1011
-
1012
- if (expr.length === 0) {
1013
- return undefined;
1014
- }
1015
-
1016
- if (expr.length === 1) {
1017
- return expr[0];
1018
- }
1019
-
1020
- return new ContextKeyOrExpr(expr);
1021
- }
1022
-
1023
- cmp(other) {
1024
- if (other.type !== this.type) {
1025
- return this.type - other.type;
1026
- }
1027
-
1028
- if (this.expr.length < other.expr.length) {
1029
- return -1;
1030
- }
1031
-
1032
- if (this.expr.length > other.expr.length) {
1033
- return 1;
1034
- }
1035
-
1036
- for (let i = 0, len = this.expr.length; i < len; i++) {
1037
- const r = cmp(this.expr[i], other.expr[i]);
1038
-
1039
- if (r !== 0) {
1040
- return r;
1041
- }
1042
- }
1043
-
1044
- return 0;
1045
- }
1046
-
1047
- equals(other) {
1048
- if (other.type === this.type) {
1049
- if (this.expr.length !== other.expr.length) {
1050
- return false;
1051
- }
1052
-
1053
- for (let i = 0, len = this.expr.length; i < len; i++) {
1054
- if (!this.expr[i].equals(other.expr[i])) {
1055
- return false;
1056
- }
1057
- }
1058
-
1059
- return true;
1060
- }
1061
-
1062
- return false;
1063
- }
1064
-
1065
- evaluate(context) {
1066
- for (let i = 0, len = this.expr.length; i < len; i++) {
1067
- if (this.expr[i].evaluate(context)) {
1068
- return true;
1069
- }
1070
- }
1071
-
1072
- return false;
1073
- }
1074
-
1075
- static _normalizeArr(arr) {
1076
- let expr = [];
1077
- let hasFalse = false;
1078
-
1079
- if (arr) {
1080
- for (let i = 0, len = arr.length; i < len; i++) {
1081
- const e = arr[i];
1082
-
1083
- if (!e) {
1084
- continue;
1085
- }
1086
-
1087
- if (e.type === 0
1088
- /* False */
1089
- ) {
1090
- // anything || false ==> anything
1091
- hasFalse = true;
1092
- continue;
1093
- }
1094
-
1095
- if (e.type === 1
1096
- /* True */
1097
- ) {
1098
- // anything || true ==> true
1099
- return [ContextKeyTrueExpr.INSTANCE];
1100
- }
1101
-
1102
- if (e.type === 9
1103
- /* Or */
1104
- ) {
1105
- expr = expr.concat(e.expr);
1106
- continue;
1107
- }
1108
-
1109
- expr.push(e);
1110
- }
1111
-
1112
- if (expr.length === 0 && hasFalse) {
1113
- return [ContextKeyFalseExpr.INSTANCE];
1114
- }
1115
-
1116
- expr.sort(cmp);
1117
- }
1118
-
1119
- return expr;
1120
- }
1121
-
1122
- serialize() {
1123
- return this.expr.map(e => e.serialize()).join(' || ');
1124
- }
1125
-
1126
- keys() {
1127
- const result = [];
1128
-
1129
- for (let expr of this.expr) {
1130
- result.push(...expr.keys());
1131
- }
1132
-
1133
- return result;
1134
- }
1135
-
1136
- map(mapFnc) {
1137
- return new ContextKeyOrExpr(this.expr.map(expr => expr.map(mapFnc)));
1138
- }
1139
-
1140
- negate() {
1141
- let result = [];
1142
-
1143
- for (let expr of this.expr) {
1144
- result.push(expr.negate());
1145
- }
1146
-
1147
- const terminals = node => {
1148
- if (node.type === 9
1149
- /* Or */
1150
- ) {
1151
- return node.expr;
1152
- }
1153
-
1154
- return [node];
1155
- }; // We don't support parens, so here we distribute the AND over the OR terminals
1156
- // We always take the first 2 AND pairs and distribute them
1157
-
1158
-
1159
- while (result.length > 1) {
1160
- const LEFT = result.shift();
1161
- const RIGHT = result.shift();
1162
- const all = [];
1163
-
1164
- for (const left of terminals(LEFT)) {
1165
- for (const right of terminals(RIGHT)) {
1166
- all.push(ContextKeyExpr.and(left, right));
1167
- }
1168
- }
1169
-
1170
- result.unshift(ContextKeyExpr.or(...all));
1171
- }
1172
-
1173
- return result[0];
1174
- }
1175
-
1176
- }
1177
-
1178
- exports.ContextKeyOrExpr = ContextKeyOrExpr;
1179
-
1180
- class RawContextKey extends ContextKeyDefinedExpr {
1181
- constructor(key, defaultValue) {
1182
- super(key);
1183
- this._defaultValue = defaultValue;
1184
- }
1185
-
1186
- bindTo(target) {
1187
- return target.createKey(this.key, this._defaultValue);
1188
- }
1189
-
1190
- getValue(target) {
1191
- return target.getContextKeyValue(this.key);
1192
- }
1193
-
1194
- toNegated() {
1195
- return ContextKeyExpr.not(this.key);
1196
- }
1197
-
1198
- isEqualTo(value) {
1199
- return ContextKeyExpr.equals(this.key, value);
1200
- }
1201
-
1202
- notEqualsTo(value) {
1203
- return ContextKeyExpr.notEquals(this.key, value);
1204
- }
1205
-
1206
- }
1207
-
1208
- exports.RawContextKey = RawContextKey;
1209
- exports.IContextKeyService = instantiation_1.createDecorator('contextKeyService');
1210
- exports.SET_CONTEXT_COMMAND_ID = 'setContext';