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.
- package/.github/FUNDING.yml +1 -0
- package/README.md +15 -24
- package/_config.yml +1 -0
- package/{lib → build}/browser/browser.d.ts +0 -0
- package/{lib → build}/browser/browser.js +0 -0
- package/{lib → build}/browser/browser.js.map +0 -0
- package/{lib → build}/browser/event.d.ts +0 -0
- package/{lib → build}/browser/event.js +2 -1
- package/{lib → build}/browser/event.js.map +1 -1
- package/{lib → build}/browser/iframe.d.ts +0 -0
- package/{lib → build}/browser/iframe.js +0 -0
- package/{lib → build}/browser/iframe.js.map +0 -0
- package/{lib → build}/browser/keyboardEvent.d.ts +0 -0
- package/{lib → build}/browser/keyboardEvent.js +0 -0
- package/{lib → build}/browser/keyboardEvent.js.map +0 -0
- package/{lib → build}/browser/mouseEvent.d.ts +0 -0
- package/{lib → build}/browser/mouseEvent.js +0 -0
- package/{lib → build}/browser/mouseEvent.js.map +0 -0
- package/{lib → build}/common/arrays.d.ts +0 -0
- package/{lib → build}/common/arrays.js +0 -0
- package/{lib → build}/common/arrays.js.map +0 -0
- package/{lib → build}/common/async.d.ts +0 -0
- package/{lib → build}/common/async.js +0 -0
- package/{lib → build}/common/async.js.map +0 -0
- package/{lib → build}/common/charCode.d.ts +0 -0
- package/{lib → build}/common/charCode.js +0 -0
- package/{lib → build}/common/charCode.js.map +0 -0
- package/{lib → build}/common/color.d.ts +0 -0
- package/{lib → build}/common/color.js +0 -0
- package/{lib → build}/common/color.js.map +0 -0
- package/{lib → build}/common/dom.d.ts +0 -0
- package/{lib → build}/common/dom.js +16 -14
- package/build/common/dom.js.map +1 -0
- package/{lib → build}/common/event.d.ts +0 -0
- package/{lib → build}/common/event.js +1 -1
- package/build/common/event.js.map +1 -0
- package/{lib → build}/common/iterator.d.ts +0 -0
- package/{lib → build}/common/iterator.js +0 -0
- package/{lib → build}/common/iterator.js.map +0 -0
- package/{lib → build}/common/keyCodes.d.ts +0 -0
- package/{lib → build}/common/keyCodes.js +0 -0
- package/{lib → build}/common/keyCodes.js.map +0 -0
- package/{lib → build}/common/lifecycle.d.ts +0 -0
- package/{lib → build}/common/lifecycle.js +0 -0
- package/{lib → build}/common/lifecycle.js.map +0 -0
- package/{lib → build}/common/linkedList.d.ts +0 -0
- package/{lib → build}/common/linkedList.js +0 -0
- package/{lib → build}/common/linkedList.js.map +0 -0
- package/{lib → build}/common/platform.d.ts +0 -0
- package/{lib → build}/common/platform.js +0 -0
- package/{lib → build}/common/platform.js.map +0 -0
- package/{lib → build}/index.d.ts +0 -0
- package/{lib → build}/index.js +0 -0
- package/{lib → build}/index.js.map +0 -0
- package/{lib → build}/menu/menu.d.ts +0 -0
- package/{lib → build}/menu/menu.js +38 -38
- package/build/menu/menu.js.map +1 -0
- package/{lib → build}/menu/menuitem.d.ts +10 -2
- package/{lib → build}/menu/menuitem.js +70 -34
- package/build/menu/menuitem.js.map +1 -0
- package/{lib → build}/menubar.d.ts +0 -0
- package/{lib → build}/menubar.js +29 -30
- package/build/menubar.js.map +1 -0
- package/{lib → build}/themebar.d.ts +0 -0
- package/{lib → build}/themebar.js +2 -2
- package/build/themebar.js.map +1 -0
- package/{lib → build}/titlebar.d.ts +0 -0
- package/{lib → build}/titlebar.js +61 -58
- package/build/titlebar.js.map +1 -0
- package/package.json +13 -7
- package/lib/common/dom.js.map +0 -1
- package/lib/common/enableNativeMenuCommands.d.ts +0 -1
- package/lib/common/enableNativeMenuCommands.js +0 -32
- package/lib/common/enableNativeMenuCommands.js.map +0 -1
- package/lib/common/event.js.map +0 -1
- package/lib/main.d.ts +0 -1
- package/lib/main.js +0 -14
- package/lib/main.js.map +0 -1
- package/lib/menu/menu.js.map +0 -1
- package/lib/menu/menuitem.js.map +0 -1
- package/lib/menubar.js.map +0 -1
- package/lib/themebar.js.map +0 -1
- package/lib/titlebar.js.map +0 -1
- package/lib/vs/base/browser/browser.js +0 -150
- package/lib/vs/base/browser/canIUse.js +0 -58
- package/lib/vs/base/browser/codicons.js +0 -37
- package/lib/vs/base/browser/contextmenu.js +0 -9
- package/lib/vs/base/browser/dnd.js +0 -113
- package/lib/vs/base/browser/dom.js +0 -1417
- package/lib/vs/base/browser/event.js +0 -36
- package/lib/vs/base/browser/fastDomNode.js +0 -265
- package/lib/vs/base/browser/formattedTextRenderer.js +0 -248
- package/lib/vs/base/browser/globalMouseMoveMonitor.js +0 -137
- package/lib/vs/base/browser/history.js +0 -9
- package/lib/vs/base/browser/iframe.js +0 -126
- package/lib/vs/base/browser/keyboardEvent.js +0 -599
- package/lib/vs/base/browser/mouseEvent.js +0 -155
- package/lib/vs/base/browser/touch.js +0 -315
- package/lib/vs/base/browser/ui/actionbar/actionViewItems.js +0 -397
- package/lib/vs/base/browser/ui/actionbar/actionbar.js +0 -583
- package/lib/vs/base/browser/ui/checkbox/checkbox.js +0 -251
- package/lib/vs/base/browser/ui/codicons/codiconLabel.js +0 -31
- package/lib/vs/base/browser/ui/codicons/codiconStyles.js +0 -47
- package/lib/vs/base/browser/ui/contextview/contextview.js +0 -367
- package/lib/vs/base/browser/ui/dropdown/dropdown.js +0 -256
- package/lib/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +0 -120
- package/lib/vs/base/browser/ui/keybindingLabel/keybindingLabel.js +0 -118
- package/lib/vs/base/browser/ui/list/list.js +0 -54
- package/lib/vs/base/browser/ui/list/listPaging.js +0 -322
- package/lib/vs/base/browser/ui/list/listView.js +0 -1388
- package/lib/vs/base/browser/ui/list/listWidget.js +0 -1709
- package/lib/vs/base/browser/ui/list/rangeMap.js +0 -223
- package/lib/vs/base/browser/ui/list/rowCache.js +0 -113
- package/lib/vs/base/browser/ui/list/splice.js +0 -23
- package/lib/vs/base/browser/ui/menu/menu.js +0 -1371
- package/lib/vs/base/browser/ui/menu/menubar.js +0 -1139
- package/lib/vs/base/browser/ui/scrollbar/abstractScrollbar.js +0 -278
- package/lib/vs/base/browser/ui/scrollbar/horizontalScrollbar.js +0 -115
- package/lib/vs/base/browser/ui/scrollbar/scrollableElement.js +0 -646
- package/lib/vs/base/browser/ui/scrollbar/scrollableElementOptions.js +0 -9
- package/lib/vs/base/browser/ui/scrollbar/scrollbarArrow.js +0 -106
- package/lib/vs/base/browser/ui/scrollbar/scrollbarState.js +0 -184
- package/lib/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js +0 -116
- package/lib/vs/base/browser/ui/scrollbar/verticalScrollbar.js +0 -114
- package/lib/vs/base/browser/ui/selectBox/selectBox.js +0 -85
- package/lib/vs/base/browser/ui/selectBox/selectBoxCustom.js +0 -985
- package/lib/vs/base/browser/ui/selectBox/selectBoxNative.js +0 -188
- package/lib/vs/base/browser/ui/toolbar/toolbar.js +0 -206
- package/lib/vs/base/browser/ui/widget.js +0 -69
- package/lib/vs/base/common/actions.js +0 -224
- package/lib/vs/base/common/amd.js +0 -31
- package/lib/vs/base/common/arrays.js +0 -641
- package/lib/vs/base/common/assert.js +0 -21
- package/lib/vs/base/common/async.js +0 -966
- package/lib/vs/base/common/buffer.js +0 -250
- package/lib/vs/base/common/cache.js +0 -40
- package/lib/vs/base/common/cancellation.js +0 -146
- package/lib/vs/base/common/charCode.js +0 -9
- package/lib/vs/base/common/codicon.js +0 -136
- package/lib/vs/base/common/codicons.js +0 -1378
- package/lib/vs/base/common/collections.js +0 -133
- package/lib/vs/base/common/color.js +0 -716
- package/lib/vs/base/common/comparers.js +0 -280
- package/lib/vs/base/common/console.js +0 -142
- package/lib/vs/base/common/date.js +0 -113
- package/lib/vs/base/common/decorators.js +0 -169
- package/lib/vs/base/common/errorMessage.js +0 -93
- package/lib/vs/base/common/errors.js +0 -213
- package/lib/vs/base/common/errorsWithActions.js +0 -28
- package/lib/vs/base/common/event.js +0 -873
- package/lib/vs/base/common/extpath.js +0 -401
- package/lib/vs/base/common/filters.js +0 -948
- package/lib/vs/base/common/functional.js +0 -28
- package/lib/vs/base/common/fuzzyScorer.js +0 -811
- package/lib/vs/base/common/glob.js +0 -696
- package/lib/vs/base/common/hash.js +0 -359
- package/lib/vs/base/common/history.js +0 -116
- package/lib/vs/base/common/htmlContent.js +0 -162
- package/lib/vs/base/common/idGenerator.js +0 -25
- package/lib/vs/base/common/iterator.js +0 -118
- package/lib/vs/base/common/json.js +0 -1624
- package/lib/vs/base/common/jsonEdit.js +0 -272
- package/lib/vs/base/common/jsonErrorMessages.js +0 -69
- package/lib/vs/base/common/jsonFormatter.js +0 -316
- package/lib/vs/base/common/jsonSchema.js +0 -9
- package/lib/vs/base/common/keyCodes.js +0 -591
- package/lib/vs/base/common/keybindingLabels.js +0 -231
- package/lib/vs/base/common/keybindingParser.js +0 -142
- package/lib/vs/base/common/labels.js +0 -430
- package/lib/vs/base/common/lazy.js +0 -71
- package/lib/vs/base/common/lifecycle.js +0 -308
- package/lib/vs/base/common/linkedList.js +0 -152
- package/lib/vs/base/common/linkedText.js +0 -73
- package/lib/vs/base/common/map.js +0 -1108
- package/lib/vs/base/common/marshalling.js +0 -80
- package/lib/vs/base/common/mime.js +0 -321
- package/lib/vs/base/common/navigator.js +0 -50
- package/lib/vs/base/common/network.js +0 -160
- package/lib/vs/base/common/normalization.js +0 -78
- package/lib/vs/base/common/numbers.js +0 -55
- package/lib/vs/base/common/objects.js +0 -268
- package/lib/vs/base/common/paging.js +0 -190
- package/lib/vs/base/common/parsers.js +0 -78
- package/lib/vs/base/common/path.js +0 -1550
- package/lib/vs/base/common/platform.js +0 -245
- package/lib/vs/base/common/process.js +0 -52
- package/lib/vs/base/common/processes.js +0 -32
- package/lib/vs/base/common/range.js +0 -79
- package/lib/vs/base/common/resourceTree.js +0 -185
- package/lib/vs/base/common/resources.js +0 -421
- package/lib/vs/base/common/scanCode.js +0 -1472
- package/lib/vs/base/common/scrollable.js +0 -397
- package/lib/vs/base/common/search.js +0 -55
- package/lib/vs/base/common/sequence.js +0 -64
- package/lib/vs/base/common/severity.js +0 -55
- package/lib/vs/base/common/skipList.js +0 -234
- package/lib/vs/base/common/stopwatch.js +0 -45
- package/lib/vs/base/common/stream.js +0 -418
- package/lib/vs/base/common/strings.js +0 -1283
- package/lib/vs/base/common/styler.js +0 -9
- package/lib/vs/base/common/types.js +0 -296
- package/lib/vs/base/common/uint.js +0 -46
- package/lib/vs/base/common/uri.js +0 -756
- package/lib/vs/base/common/uriIpc.js +0 -154
- package/lib/vs/base/common/uuid.js +0 -70
- package/lib/vs/nls.mock.js +0 -31
- package/lib/vs/platform/actions/browser/menuEntryActionViewItem.js +0 -342
- package/lib/vs/platform/actions/common/actions.js +0 -456
- package/lib/vs/platform/actions/common/menuService.js +0 -194
- package/lib/vs/platform/clipboard/browser/clipboardService.js +0 -99
- package/lib/vs/platform/clipboard/common/clipboardService.js +0 -14
- package/lib/vs/platform/contextkey/common/contextkey.js +0 -1210
- package/lib/vs/platform/contextkey/common/contextkeys.js +0 -23
- package/lib/vs/platform/contextview/browser/contextView.js +0 -15
- package/lib/vs/platform/contextview/browser/contextViewService.js +0 -96
- package/lib/vs/platform/environment/common/argv.js +0 -9
- package/lib/vs/platform/environment/common/environment.js +0 -15
- package/lib/vs/platform/instantiation/common/descriptors.js +0 -25
- package/lib/vs/platform/instantiation/common/extensions.js +0 -26
- package/lib/vs/platform/instantiation/common/graph.js +0 -93
- package/lib/vs/platform/instantiation/common/instantiation.js +0 -84
- package/lib/vs/platform/instantiation/common/instantiationService.js +0 -361
- package/lib/vs/platform/instantiation/common/serviceCollection.js +0 -39
- package/lib/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -73
- package/lib/vs/platform/keybinding/common/keybinding.js +0 -14
- package/lib/vs/platform/keybinding/common/keybindingResolver.js +0 -391
- package/lib/vs/platform/keybinding/common/keybindingsRegistry.js +0 -229
- package/lib/vs/platform/keybinding/common/resolvedKeybindingItem.js +0 -47
- package/lib/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js +0 -160
- package/lib/vs/platform/layout/browser/layoutService.js +0 -14
- package/lib/vs/platform/menubar/common/menubar.js +0 -34
- package/lib/vs/platform/registry/common/platform.js +0 -38
- package/lib/vs/platform/theme/browser/checkbox.js +0 -32
- package/lib/vs/platform/theme/common/colorRegistry.js +0 -1154
- package/lib/vs/platform/theme/common/styler.js +0 -290
- package/lib/vs/platform/theme/common/theme.js +0 -21
- package/lib/vs/platform/theme/common/themeService.js +0 -176
- package/lib/vs/platform/theme/common/tokenClassificationRegistry.js +0 -540
- package/lib/vs/platform/theme/test/common/testThemeService.js +0 -98
|
@@ -1,391 +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.KeybindingResolver = void 0;
|
|
11
|
-
|
|
12
|
-
class KeybindingResolver {
|
|
13
|
-
constructor(defaultKeybindings, overrides, log) {
|
|
14
|
-
this._log = log;
|
|
15
|
-
this._defaultKeybindings = defaultKeybindings;
|
|
16
|
-
this._defaultBoundCommands = new Map();
|
|
17
|
-
|
|
18
|
-
for (let i = 0, len = defaultKeybindings.length; i < len; i++) {
|
|
19
|
-
const command = defaultKeybindings[i].command;
|
|
20
|
-
|
|
21
|
-
if (command) {
|
|
22
|
-
this._defaultBoundCommands.set(command, true);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
this._map = new Map();
|
|
27
|
-
this._lookupMap = new Map();
|
|
28
|
-
this._keybindings = KeybindingResolver.combine(defaultKeybindings, overrides);
|
|
29
|
-
|
|
30
|
-
for (let i = 0, len = this._keybindings.length; i < len; i++) {
|
|
31
|
-
let k = this._keybindings[i];
|
|
32
|
-
|
|
33
|
-
if (k.keypressParts.length === 0) {
|
|
34
|
-
// unbound
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (k.when && k.when.type === 0
|
|
39
|
-
/* False */
|
|
40
|
-
) {
|
|
41
|
-
// when condition is false
|
|
42
|
-
continue;
|
|
43
|
-
} // TODO@chords
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this._addKeyPress(k.keypressParts[0], k);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
static _isTargetedForRemoval(defaultKb, keypressFirstPart, keypressChordPart, command, when) {
|
|
51
|
-
if (defaultKb.command !== command) {
|
|
52
|
-
return false;
|
|
53
|
-
} // TODO@chords
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (keypressFirstPart && defaultKb.keypressParts[0] !== keypressFirstPart) {
|
|
57
|
-
return false;
|
|
58
|
-
} // TODO@chords
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (keypressChordPart && defaultKb.keypressParts[1] !== keypressChordPart) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (when) {
|
|
66
|
-
if (!defaultKb.when) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (!when.equals(defaultKb.when)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Looks for rules containing -command in `overrides` and removes them directly from `defaults`.
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
static combine(defaults, rawOverrides) {
|
|
83
|
-
defaults = defaults.slice(0);
|
|
84
|
-
let overrides = [];
|
|
85
|
-
|
|
86
|
-
for (const override of rawOverrides) {
|
|
87
|
-
if (!override.command || override.command.length === 0 || override.command.charAt(0) !== '-') {
|
|
88
|
-
overrides.push(override);
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const command = override.command.substr(1); // TODO@chords
|
|
93
|
-
|
|
94
|
-
const keypressFirstPart = override.keypressParts[0];
|
|
95
|
-
const keypressChordPart = override.keypressParts[1];
|
|
96
|
-
const when = override.when;
|
|
97
|
-
|
|
98
|
-
for (let j = defaults.length - 1; j >= 0; j--) {
|
|
99
|
-
if (this._isTargetedForRemoval(defaults[j], keypressFirstPart, keypressChordPart, command, when)) {
|
|
100
|
-
defaults.splice(j, 1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return defaults.concat(overrides);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
_addKeyPress(keypress, item) {
|
|
109
|
-
const conflicts = this._map.get(keypress);
|
|
110
|
-
|
|
111
|
-
if (typeof conflicts === 'undefined') {
|
|
112
|
-
// There is no conflict so far
|
|
113
|
-
this._map.set(keypress, [item]);
|
|
114
|
-
|
|
115
|
-
this._addToLookupMap(item);
|
|
116
|
-
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
for (let i = conflicts.length - 1; i >= 0; i--) {
|
|
121
|
-
let conflict = conflicts[i];
|
|
122
|
-
|
|
123
|
-
if (conflict.command === item.command) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const conflictIsChord = conflict.keypressParts.length > 1;
|
|
128
|
-
const itemIsChord = item.keypressParts.length > 1; // TODO@chords
|
|
129
|
-
|
|
130
|
-
if (conflictIsChord && itemIsChord && conflict.keypressParts[1] !== item.keypressParts[1]) {
|
|
131
|
-
// The conflict only shares the chord start with this command
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (KeybindingResolver.whenIsEntirelyIncluded(conflict.when, item.when)) {
|
|
136
|
-
// `item` completely overwrites `conflict`
|
|
137
|
-
// Remove conflict from the lookupMap
|
|
138
|
-
this._removeFromLookupMap(conflict);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
conflicts.push(item);
|
|
143
|
-
|
|
144
|
-
this._addToLookupMap(item);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
_addToLookupMap(item) {
|
|
148
|
-
if (!item.command) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
let arr = this._lookupMap.get(item.command);
|
|
153
|
-
|
|
154
|
-
if (typeof arr === 'undefined') {
|
|
155
|
-
arr = [item];
|
|
156
|
-
|
|
157
|
-
this._lookupMap.set(item.command, arr);
|
|
158
|
-
} else {
|
|
159
|
-
arr.push(item);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
_removeFromLookupMap(item) {
|
|
164
|
-
if (!item.command) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
let arr = this._lookupMap.get(item.command);
|
|
169
|
-
|
|
170
|
-
if (typeof arr === 'undefined') {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
for (let i = 0, len = arr.length; i < len; i++) {
|
|
175
|
-
if (arr[i] === item) {
|
|
176
|
-
arr.splice(i, 1);
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Returns true if it is provable `a` implies `b`.
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
static whenIsEntirelyIncluded(a, b) {
|
|
187
|
-
if (!b) {
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (!a) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return this._implies(a, b);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Returns true if it is provable `p` implies `q`.
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
static _implies(p, q) {
|
|
203
|
-
const notP = p.negate();
|
|
204
|
-
|
|
205
|
-
const terminals = node => {
|
|
206
|
-
if (node.type === 9
|
|
207
|
-
/* Or */
|
|
208
|
-
) {
|
|
209
|
-
return node.expr;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return [node];
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
let expr = terminals(notP).concat(terminals(q));
|
|
216
|
-
|
|
217
|
-
for (let i = 0; i < expr.length; i++) {
|
|
218
|
-
const a = expr[i];
|
|
219
|
-
const notA = a.negate();
|
|
220
|
-
|
|
221
|
-
for (let j = i + 1; j < expr.length; j++) {
|
|
222
|
-
const b = expr[j];
|
|
223
|
-
|
|
224
|
-
if (notA.equals(b)) {
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
getDefaultBoundCommands() {
|
|
234
|
-
return this._defaultBoundCommands;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
getDefaultKeybindings() {
|
|
238
|
-
return this._defaultKeybindings;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
getKeybindings() {
|
|
242
|
-
return this._keybindings;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
lookupKeybindings(commandId) {
|
|
246
|
-
let items = this._lookupMap.get(commandId);
|
|
247
|
-
|
|
248
|
-
if (typeof items === 'undefined' || items.length === 0) {
|
|
249
|
-
return [];
|
|
250
|
-
} // Reverse to get the most specific item first
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
let result = [],
|
|
254
|
-
resultLen = 0;
|
|
255
|
-
|
|
256
|
-
for (let i = items.length - 1; i >= 0; i--) {
|
|
257
|
-
result[resultLen++] = items[i];
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return result;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
lookupPrimaryKeybinding(commandId) {
|
|
264
|
-
let items = this._lookupMap.get(commandId);
|
|
265
|
-
|
|
266
|
-
if (typeof items === 'undefined' || items.length === 0) {
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return items[items.length - 1];
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
resolve(context, currentChord, keypress) {
|
|
274
|
-
this._log(`| Resolving ${keypress}${currentChord ? ` chorded from ${currentChord}` : ``}`);
|
|
275
|
-
|
|
276
|
-
let lookupMap = null;
|
|
277
|
-
|
|
278
|
-
if (currentChord !== null) {
|
|
279
|
-
// Fetch all chord bindings for `currentChord`
|
|
280
|
-
const candidates = this._map.get(currentChord);
|
|
281
|
-
|
|
282
|
-
if (typeof candidates === 'undefined') {
|
|
283
|
-
// No chords starting with `currentChord`
|
|
284
|
-
this._log(`\\ No keybinding entries.`);
|
|
285
|
-
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
lookupMap = [];
|
|
290
|
-
|
|
291
|
-
for (let i = 0, len = candidates.length; i < len; i++) {
|
|
292
|
-
let candidate = candidates[i]; // TODO@chords
|
|
293
|
-
|
|
294
|
-
if (candidate.keypressParts[1] === keypress) {
|
|
295
|
-
lookupMap.push(candidate);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
} else {
|
|
299
|
-
const candidates = this._map.get(keypress);
|
|
300
|
-
|
|
301
|
-
if (typeof candidates === 'undefined') {
|
|
302
|
-
// No bindings with `keypress`
|
|
303
|
-
this._log(`\\ No keybinding entries.`);
|
|
304
|
-
|
|
305
|
-
return null;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
lookupMap = candidates;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
let result = this._findCommand(context, lookupMap);
|
|
312
|
-
|
|
313
|
-
if (!result) {
|
|
314
|
-
this._log(`\\ From ${lookupMap.length} keybinding entries, no when clauses matched the context.`);
|
|
315
|
-
|
|
316
|
-
return null;
|
|
317
|
-
} // TODO@chords
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (currentChord === null && result.keypressParts.length > 1 && result.keypressParts[1] !== null) {
|
|
321
|
-
this._log(`\\ From ${lookupMap.length} keybinding entries, matched chord, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`);
|
|
322
|
-
|
|
323
|
-
return {
|
|
324
|
-
enterChord: true,
|
|
325
|
-
leaveChord: false,
|
|
326
|
-
commandId: null,
|
|
327
|
-
commandArgs: null,
|
|
328
|
-
bubble: false
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
this._log(`\\ From ${lookupMap.length} keybinding entries, matched ${result.command}, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`);
|
|
333
|
-
|
|
334
|
-
return {
|
|
335
|
-
enterChord: false,
|
|
336
|
-
leaveChord: result.keypressParts.length > 1,
|
|
337
|
-
commandId: result.command,
|
|
338
|
-
commandArgs: result.commandArgs,
|
|
339
|
-
bubble: result.bubble
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
_findCommand(context, matches) {
|
|
344
|
-
for (let i = matches.length - 1; i >= 0; i--) {
|
|
345
|
-
let k = matches[i];
|
|
346
|
-
|
|
347
|
-
if (!KeybindingResolver.contextMatchesRules(context, k.when)) {
|
|
348
|
-
continue;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return k;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
return null;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
static contextMatchesRules(context, rules) {
|
|
358
|
-
if (!rules) {
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
return rules.evaluate(context);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
exports.KeybindingResolver = KeybindingResolver;
|
|
368
|
-
|
|
369
|
-
function printWhenExplanation(when) {
|
|
370
|
-
if (!when) {
|
|
371
|
-
return `no when condition`;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return `${when.serialize()}`;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function printSourceExplanation(kb) {
|
|
378
|
-
if (kb.isDefault) {
|
|
379
|
-
if (kb.extensionId) {
|
|
380
|
-
return `built-in extension ${kb.extensionId}`;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return `built-in`;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (kb.extensionId) {
|
|
387
|
-
return `user extension ${kb.extensionId}`;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return `user`;
|
|
391
|
-
}
|
|
@@ -1,229 +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.KeybindingsRegistry = void 0;
|
|
11
|
-
|
|
12
|
-
const keyCodes_1 = require("../../../base/common/keyCodes");
|
|
13
|
-
|
|
14
|
-
const platform_1 = require("../../../base/common/platform");
|
|
15
|
-
|
|
16
|
-
class KeybindingsRegistryImpl {
|
|
17
|
-
constructor() {
|
|
18
|
-
this._coreKeybindings = [];
|
|
19
|
-
this._extensionKeybindings = [];
|
|
20
|
-
this._cachedMergedKeybindings = null;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Take current platform into account and reduce to primary & secondary.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
static bindToCurrentPlatform(kb) {
|
|
28
|
-
if (platform_1.OS === 1
|
|
29
|
-
/* Windows */
|
|
30
|
-
) {
|
|
31
|
-
if (kb && kb.win) {
|
|
32
|
-
return kb.win;
|
|
33
|
-
}
|
|
34
|
-
} else if (platform_1.OS === 2
|
|
35
|
-
/* Macintosh */
|
|
36
|
-
) {
|
|
37
|
-
if (kb && kb.mac) {
|
|
38
|
-
return kb.mac;
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
if (kb && kb.linux) {
|
|
42
|
-
return kb.linux;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return kb;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Take current platform into account and reduce to primary & secondary.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
static bindToCurrentPlatform2(kb) {
|
|
54
|
-
if (platform_1.OS === 1
|
|
55
|
-
/* Windows */
|
|
56
|
-
) {
|
|
57
|
-
if (kb && kb.win) {
|
|
58
|
-
return kb.win;
|
|
59
|
-
}
|
|
60
|
-
} else if (platform_1.OS === 2
|
|
61
|
-
/* Macintosh */
|
|
62
|
-
) {
|
|
63
|
-
if (kb && kb.mac) {
|
|
64
|
-
return kb.mac;
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
if (kb && kb.linux) {
|
|
68
|
-
return kb.linux;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return kb;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
registerKeybindingRule(rule) {
|
|
76
|
-
const actualKb = KeybindingsRegistryImpl.bindToCurrentPlatform(rule);
|
|
77
|
-
|
|
78
|
-
if (actualKb && actualKb.primary) {
|
|
79
|
-
const kk = keyCodes_1.createKeybinding(actualKb.primary, platform_1.OS);
|
|
80
|
-
|
|
81
|
-
if (kk) {
|
|
82
|
-
this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, 0, rule.when);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (actualKb && Array.isArray(actualKb.secondary)) {
|
|
87
|
-
for (let i = 0, len = actualKb.secondary.length; i < len; i++) {
|
|
88
|
-
const k = actualKb.secondary[i];
|
|
89
|
-
const kk = keyCodes_1.createKeybinding(k, platform_1.OS);
|
|
90
|
-
|
|
91
|
-
if (kk) {
|
|
92
|
-
this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, -i - 1, rule.when);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
setExtensionKeybindings(rules) {
|
|
99
|
-
let result = [],
|
|
100
|
-
keybindingsLen = 0;
|
|
101
|
-
|
|
102
|
-
for (let i = 0, len = rules.length; i < len; i++) {
|
|
103
|
-
const rule = rules[i];
|
|
104
|
-
let actualKb = KeybindingsRegistryImpl.bindToCurrentPlatform2(rule);
|
|
105
|
-
|
|
106
|
-
if (actualKb && actualKb.primary) {
|
|
107
|
-
result[keybindingsLen++] = {
|
|
108
|
-
keybinding: actualKb.primary,
|
|
109
|
-
command: rule.id,
|
|
110
|
-
commandArgs: rule.args,
|
|
111
|
-
when: rule.when,
|
|
112
|
-
weight1: rule.weight,
|
|
113
|
-
weight2: 0,
|
|
114
|
-
extensionId: rule.extensionId || null
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
this._extensionKeybindings = result;
|
|
120
|
-
this._cachedMergedKeybindings = null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
static _mightProduceChar(keyCode) {
|
|
124
|
-
if (keyCode >= 21
|
|
125
|
-
/* KEY_0 */
|
|
126
|
-
&& keyCode <= 30
|
|
127
|
-
/* KEY_9 */
|
|
128
|
-
) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (keyCode >= 31
|
|
133
|
-
/* KEY_A */
|
|
134
|
-
&& keyCode <= 56
|
|
135
|
-
/* KEY_Z */
|
|
136
|
-
) {
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return keyCode === 80
|
|
141
|
-
/* US_SEMICOLON */
|
|
142
|
-
|| keyCode === 81
|
|
143
|
-
/* US_EQUAL */
|
|
144
|
-
|| keyCode === 82
|
|
145
|
-
/* US_COMMA */
|
|
146
|
-
|| keyCode === 83
|
|
147
|
-
/* US_MINUS */
|
|
148
|
-
|| keyCode === 84
|
|
149
|
-
/* US_DOT */
|
|
150
|
-
|| keyCode === 85
|
|
151
|
-
/* US_SLASH */
|
|
152
|
-
|| keyCode === 86
|
|
153
|
-
/* US_BACKTICK */
|
|
154
|
-
|| keyCode === 110
|
|
155
|
-
/* ABNT_C1 */
|
|
156
|
-
|| keyCode === 111
|
|
157
|
-
/* ABNT_C2 */
|
|
158
|
-
|| keyCode === 87
|
|
159
|
-
/* US_OPEN_SQUARE_BRACKET */
|
|
160
|
-
|| keyCode === 88
|
|
161
|
-
/* US_BACKSLASH */
|
|
162
|
-
|| keyCode === 89
|
|
163
|
-
/* US_CLOSE_SQUARE_BRACKET */
|
|
164
|
-
|| keyCode === 90
|
|
165
|
-
/* US_QUOTE */
|
|
166
|
-
|| keyCode === 91
|
|
167
|
-
/* OEM_8 */
|
|
168
|
-
|| keyCode === 92
|
|
169
|
-
/* OEM_102 */
|
|
170
|
-
;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
_assertNoCtrlAlt(keybinding, commandId) {
|
|
174
|
-
if (keybinding.ctrlKey && keybinding.altKey && !keybinding.metaKey) {
|
|
175
|
-
if (KeybindingsRegistryImpl._mightProduceChar(keybinding.keyCode)) {
|
|
176
|
-
console.warn('Ctrl+Alt+ keybindings should not be used by default under Windows. Offender: ', keybinding, ' for ', commandId);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
_registerDefaultKeybinding(keybinding, commandId, commandArgs, weight1, weight2, when) {
|
|
182
|
-
if (platform_1.OS === 1
|
|
183
|
-
/* Windows */
|
|
184
|
-
) {
|
|
185
|
-
this._assertNoCtrlAlt(keybinding.parts[0], commandId);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
this._coreKeybindings.push({
|
|
189
|
-
keybinding: keybinding,
|
|
190
|
-
command: commandId,
|
|
191
|
-
commandArgs: commandArgs,
|
|
192
|
-
when: when,
|
|
193
|
-
weight1: weight1,
|
|
194
|
-
weight2: weight2,
|
|
195
|
-
extensionId: null
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
this._cachedMergedKeybindings = null;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
getDefaultKeybindings() {
|
|
202
|
-
if (!this._cachedMergedKeybindings) {
|
|
203
|
-
this._cachedMergedKeybindings = [].concat(this._coreKeybindings).concat(this._extensionKeybindings);
|
|
204
|
-
|
|
205
|
-
this._cachedMergedKeybindings.sort(sorter);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return this._cachedMergedKeybindings.slice(0);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
exports.KeybindingsRegistry = new KeybindingsRegistryImpl();
|
|
214
|
-
|
|
215
|
-
function sorter(a, b) {
|
|
216
|
-
if (a.weight1 !== b.weight1) {
|
|
217
|
-
return a.weight1 - b.weight1;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (a.command < b.command) {
|
|
221
|
-
return -1;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (a.command > b.command) {
|
|
225
|
-
return 1;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return a.weight2 - b.weight2;
|
|
229
|
-
}
|
|
@@ -1,47 +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.removeElementsAfterNulls = exports.ResolvedKeybindingItem = void 0;
|
|
11
|
-
|
|
12
|
-
class ResolvedKeybindingItem {
|
|
13
|
-
constructor(resolvedKeybinding, command, commandArgs, when, isDefault, extensionId) {
|
|
14
|
-
this.resolvedKeybinding = resolvedKeybinding;
|
|
15
|
-
this.keypressParts = resolvedKeybinding ? removeElementsAfterNulls(resolvedKeybinding.getDispatchParts()) : [];
|
|
16
|
-
this.bubble = command ? command.charCodeAt(0) === 94
|
|
17
|
-
/* Caret */
|
|
18
|
-
: false;
|
|
19
|
-
this.command = this.bubble ? command.substr(1) : command;
|
|
20
|
-
this.commandArgs = commandArgs;
|
|
21
|
-
this.when = when;
|
|
22
|
-
this.isDefault = isDefault;
|
|
23
|
-
this.extensionId = extensionId;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
exports.ResolvedKeybindingItem = ResolvedKeybindingItem;
|
|
29
|
-
|
|
30
|
-
function removeElementsAfterNulls(arr) {
|
|
31
|
-
let result = [];
|
|
32
|
-
|
|
33
|
-
for (let i = 0, len = arr.length; i < len; i++) {
|
|
34
|
-
const element = arr[i];
|
|
35
|
-
|
|
36
|
-
if (!element) {
|
|
37
|
-
// stop processing at first encountered null
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
result.push(element);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.removeElementsAfterNulls = removeElementsAfterNulls;
|