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,231 +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.UserSettingsLabelProvider = exports.ElectronAcceleratorLabelProvider = exports.AriaLabelProvider = exports.UILabelProvider = exports.ModifierLabelProvider = void 0;
|
|
11
|
-
|
|
12
|
-
const nls = require("../../nls");
|
|
13
|
-
|
|
14
|
-
class ModifierLabelProvider {
|
|
15
|
-
constructor(mac, windows, linux = windows) {
|
|
16
|
-
this.modifierLabels = [null]; // index 0 will never me accessed.
|
|
17
|
-
|
|
18
|
-
this.modifierLabels[2
|
|
19
|
-
/* Macintosh */
|
|
20
|
-
] = mac;
|
|
21
|
-
this.modifierLabels[1
|
|
22
|
-
/* Windows */
|
|
23
|
-
] = windows;
|
|
24
|
-
this.modifierLabels[3
|
|
25
|
-
/* Linux */
|
|
26
|
-
] = linux;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
toLabel(OS, parts, keyLabelProvider) {
|
|
30
|
-
if (parts.length === 0) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const result = [];
|
|
35
|
-
|
|
36
|
-
for (let i = 0, len = parts.length; i < len; i++) {
|
|
37
|
-
const part = parts[i];
|
|
38
|
-
const keyLabel = keyLabelProvider(part);
|
|
39
|
-
|
|
40
|
-
if (keyLabel === null) {
|
|
41
|
-
// this keybinding cannot be expressed...
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
result[i] = _simpleAsString(part, keyLabel, this.modifierLabels[OS]);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return result.join(' ');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
exports.ModifierLabelProvider = ModifierLabelProvider;
|
|
54
|
-
/**
|
|
55
|
-
* A label provider that prints modifiers in a suitable format for displaying in the UI.
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
exports.UILabelProvider = new ModifierLabelProvider({
|
|
59
|
-
ctrlKey: '⌃',
|
|
60
|
-
shiftKey: '⇧',
|
|
61
|
-
altKey: '⌥',
|
|
62
|
-
metaKey: '⌘',
|
|
63
|
-
separator: ''
|
|
64
|
-
}, {
|
|
65
|
-
ctrlKey: nls.localize({
|
|
66
|
-
key: 'ctrlKey',
|
|
67
|
-
comment: ['This is the short form for the Control key on the keyboard']
|
|
68
|
-
}, "Ctrl"),
|
|
69
|
-
shiftKey: nls.localize({
|
|
70
|
-
key: 'shiftKey',
|
|
71
|
-
comment: ['This is the short form for the Shift key on the keyboard']
|
|
72
|
-
}, "Shift"),
|
|
73
|
-
altKey: nls.localize({
|
|
74
|
-
key: 'altKey',
|
|
75
|
-
comment: ['This is the short form for the Alt key on the keyboard']
|
|
76
|
-
}, "Alt"),
|
|
77
|
-
metaKey: nls.localize({
|
|
78
|
-
key: 'windowsKey',
|
|
79
|
-
comment: ['This is the short form for the Windows key on the keyboard']
|
|
80
|
-
}, "Windows"),
|
|
81
|
-
separator: '+'
|
|
82
|
-
}, {
|
|
83
|
-
ctrlKey: nls.localize({
|
|
84
|
-
key: 'ctrlKey',
|
|
85
|
-
comment: ['This is the short form for the Control key on the keyboard']
|
|
86
|
-
}, "Ctrl"),
|
|
87
|
-
shiftKey: nls.localize({
|
|
88
|
-
key: 'shiftKey',
|
|
89
|
-
comment: ['This is the short form for the Shift key on the keyboard']
|
|
90
|
-
}, "Shift"),
|
|
91
|
-
altKey: nls.localize({
|
|
92
|
-
key: 'altKey',
|
|
93
|
-
comment: ['This is the short form for the Alt key on the keyboard']
|
|
94
|
-
}, "Alt"),
|
|
95
|
-
metaKey: nls.localize({
|
|
96
|
-
key: 'superKey',
|
|
97
|
-
comment: ['This is the short form for the Super key on the keyboard']
|
|
98
|
-
}, "Super"),
|
|
99
|
-
separator: '+'
|
|
100
|
-
});
|
|
101
|
-
/**
|
|
102
|
-
* A label provider that prints modifiers in a suitable format for ARIA.
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
exports.AriaLabelProvider = new ModifierLabelProvider({
|
|
106
|
-
ctrlKey: nls.localize({
|
|
107
|
-
key: 'ctrlKey.long',
|
|
108
|
-
comment: ['This is the long form for the Control key on the keyboard']
|
|
109
|
-
}, "Control"),
|
|
110
|
-
shiftKey: nls.localize({
|
|
111
|
-
key: 'shiftKey.long',
|
|
112
|
-
comment: ['This is the long form for the Shift key on the keyboard']
|
|
113
|
-
}, "Shift"),
|
|
114
|
-
altKey: nls.localize({
|
|
115
|
-
key: 'altKey.long',
|
|
116
|
-
comment: ['This is the long form for the Alt key on the keyboard']
|
|
117
|
-
}, "Alt"),
|
|
118
|
-
metaKey: nls.localize({
|
|
119
|
-
key: 'cmdKey.long',
|
|
120
|
-
comment: ['This is the long form for the Command key on the keyboard']
|
|
121
|
-
}, "Command"),
|
|
122
|
-
separator: '+'
|
|
123
|
-
}, {
|
|
124
|
-
ctrlKey: nls.localize({
|
|
125
|
-
key: 'ctrlKey.long',
|
|
126
|
-
comment: ['This is the long form for the Control key on the keyboard']
|
|
127
|
-
}, "Control"),
|
|
128
|
-
shiftKey: nls.localize({
|
|
129
|
-
key: 'shiftKey.long',
|
|
130
|
-
comment: ['This is the long form for the Shift key on the keyboard']
|
|
131
|
-
}, "Shift"),
|
|
132
|
-
altKey: nls.localize({
|
|
133
|
-
key: 'altKey.long',
|
|
134
|
-
comment: ['This is the long form for the Alt key on the keyboard']
|
|
135
|
-
}, "Alt"),
|
|
136
|
-
metaKey: nls.localize({
|
|
137
|
-
key: 'windowsKey.long',
|
|
138
|
-
comment: ['This is the long form for the Windows key on the keyboard']
|
|
139
|
-
}, "Windows"),
|
|
140
|
-
separator: '+'
|
|
141
|
-
}, {
|
|
142
|
-
ctrlKey: nls.localize({
|
|
143
|
-
key: 'ctrlKey.long',
|
|
144
|
-
comment: ['This is the long form for the Control key on the keyboard']
|
|
145
|
-
}, "Control"),
|
|
146
|
-
shiftKey: nls.localize({
|
|
147
|
-
key: 'shiftKey.long',
|
|
148
|
-
comment: ['This is the long form for the Shift key on the keyboard']
|
|
149
|
-
}, "Shift"),
|
|
150
|
-
altKey: nls.localize({
|
|
151
|
-
key: 'altKey.long',
|
|
152
|
-
comment: ['This is the long form for the Alt key on the keyboard']
|
|
153
|
-
}, "Alt"),
|
|
154
|
-
metaKey: nls.localize({
|
|
155
|
-
key: 'superKey.long',
|
|
156
|
-
comment: ['This is the long form for the Super key on the keyboard']
|
|
157
|
-
}, "Super"),
|
|
158
|
-
separator: '+'
|
|
159
|
-
});
|
|
160
|
-
/**
|
|
161
|
-
* A label provider that prints modifiers in a suitable format for Electron Accelerators.
|
|
162
|
-
* See https://github.com/electron/electron/blob/master/docs/api/accelerator.md
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
exports.ElectronAcceleratorLabelProvider = new ModifierLabelProvider({
|
|
166
|
-
ctrlKey: 'Ctrl',
|
|
167
|
-
shiftKey: 'Shift',
|
|
168
|
-
altKey: 'Alt',
|
|
169
|
-
metaKey: 'Cmd',
|
|
170
|
-
separator: '+'
|
|
171
|
-
}, {
|
|
172
|
-
ctrlKey: 'Ctrl',
|
|
173
|
-
shiftKey: 'Shift',
|
|
174
|
-
altKey: 'Alt',
|
|
175
|
-
metaKey: 'Super',
|
|
176
|
-
separator: '+'
|
|
177
|
-
});
|
|
178
|
-
/**
|
|
179
|
-
* A label provider that prints modifiers in a suitable format for user settings.
|
|
180
|
-
*/
|
|
181
|
-
|
|
182
|
-
exports.UserSettingsLabelProvider = new ModifierLabelProvider({
|
|
183
|
-
ctrlKey: 'ctrl',
|
|
184
|
-
shiftKey: 'shift',
|
|
185
|
-
altKey: 'alt',
|
|
186
|
-
metaKey: 'cmd',
|
|
187
|
-
separator: '+'
|
|
188
|
-
}, {
|
|
189
|
-
ctrlKey: 'ctrl',
|
|
190
|
-
shiftKey: 'shift',
|
|
191
|
-
altKey: 'alt',
|
|
192
|
-
metaKey: 'win',
|
|
193
|
-
separator: '+'
|
|
194
|
-
}, {
|
|
195
|
-
ctrlKey: 'ctrl',
|
|
196
|
-
shiftKey: 'shift',
|
|
197
|
-
altKey: 'alt',
|
|
198
|
-
metaKey: 'meta',
|
|
199
|
-
separator: '+'
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
function _simpleAsString(modifiers, key, labels) {
|
|
203
|
-
if (key === null) {
|
|
204
|
-
return '';
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const result = []; // translate modifier keys: Ctrl-Shift-Alt-Meta
|
|
208
|
-
|
|
209
|
-
if (modifiers.ctrlKey) {
|
|
210
|
-
result.push(labels.ctrlKey);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (modifiers.shiftKey) {
|
|
214
|
-
result.push(labels.shiftKey);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (modifiers.altKey) {
|
|
218
|
-
result.push(labels.altKey);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (modifiers.metaKey) {
|
|
222
|
-
result.push(labels.metaKey);
|
|
223
|
-
} // the actual key
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (key !== '') {
|
|
227
|
-
result.push(key);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return result.join(labels.separator);
|
|
231
|
-
}
|
|
@@ -1,142 +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.KeybindingParser = void 0;
|
|
11
|
-
|
|
12
|
-
const keyCodes_1 = require("./keyCodes");
|
|
13
|
-
|
|
14
|
-
const scanCode_1 = require("./scanCode");
|
|
15
|
-
|
|
16
|
-
class KeybindingParser {
|
|
17
|
-
static _readModifiers(input) {
|
|
18
|
-
input = input.toLowerCase().trim();
|
|
19
|
-
let ctrl = false;
|
|
20
|
-
let shift = false;
|
|
21
|
-
let alt = false;
|
|
22
|
-
let meta = false;
|
|
23
|
-
let matchedModifier;
|
|
24
|
-
|
|
25
|
-
do {
|
|
26
|
-
matchedModifier = false;
|
|
27
|
-
|
|
28
|
-
if (/^ctrl(\+|\-)/.test(input)) {
|
|
29
|
-
ctrl = true;
|
|
30
|
-
input = input.substr('ctrl-'.length);
|
|
31
|
-
matchedModifier = true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (/^shift(\+|\-)/.test(input)) {
|
|
35
|
-
shift = true;
|
|
36
|
-
input = input.substr('shift-'.length);
|
|
37
|
-
matchedModifier = true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (/^alt(\+|\-)/.test(input)) {
|
|
41
|
-
alt = true;
|
|
42
|
-
input = input.substr('alt-'.length);
|
|
43
|
-
matchedModifier = true;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (/^meta(\+|\-)/.test(input)) {
|
|
47
|
-
meta = true;
|
|
48
|
-
input = input.substr('meta-'.length);
|
|
49
|
-
matchedModifier = true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (/^win(\+|\-)/.test(input)) {
|
|
53
|
-
meta = true;
|
|
54
|
-
input = input.substr('win-'.length);
|
|
55
|
-
matchedModifier = true;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (/^cmd(\+|\-)/.test(input)) {
|
|
59
|
-
meta = true;
|
|
60
|
-
input = input.substr('cmd-'.length);
|
|
61
|
-
matchedModifier = true;
|
|
62
|
-
}
|
|
63
|
-
} while (matchedModifier);
|
|
64
|
-
|
|
65
|
-
let key;
|
|
66
|
-
const firstSpaceIdx = input.indexOf(' ');
|
|
67
|
-
|
|
68
|
-
if (firstSpaceIdx > 0) {
|
|
69
|
-
key = input.substring(0, firstSpaceIdx);
|
|
70
|
-
input = input.substring(firstSpaceIdx);
|
|
71
|
-
} else {
|
|
72
|
-
key = input;
|
|
73
|
-
input = '';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
remains: input,
|
|
78
|
-
ctrl,
|
|
79
|
-
shift,
|
|
80
|
-
alt,
|
|
81
|
-
meta,
|
|
82
|
-
key
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static parseSimpleKeybinding(input) {
|
|
87
|
-
const mods = this._readModifiers(input);
|
|
88
|
-
|
|
89
|
-
const keyCode = keyCodes_1.KeyCodeUtils.fromUserSettings(mods.key);
|
|
90
|
-
return [new keyCodes_1.SimpleKeybinding(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode), mods.remains];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
static parseKeybinding(input, OS) {
|
|
94
|
-
if (!input) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const parts = [];
|
|
99
|
-
let part;
|
|
100
|
-
|
|
101
|
-
do {
|
|
102
|
-
[part, input] = this.parseSimpleKeybinding(input);
|
|
103
|
-
parts.push(part);
|
|
104
|
-
} while (input.length > 0);
|
|
105
|
-
|
|
106
|
-
return new keyCodes_1.ChordKeybinding(parts);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
static parseSimpleUserBinding(input) {
|
|
110
|
-
const mods = this._readModifiers(input);
|
|
111
|
-
|
|
112
|
-
const scanCodeMatch = mods.key.match(/^\[([^\]]+)\]$/);
|
|
113
|
-
|
|
114
|
-
if (scanCodeMatch) {
|
|
115
|
-
const strScanCode = scanCodeMatch[1];
|
|
116
|
-
const scanCode = scanCode_1.ScanCodeUtils.lowerCaseToEnum(strScanCode);
|
|
117
|
-
return [new scanCode_1.ScanCodeBinding(mods.ctrl, mods.shift, mods.alt, mods.meta, scanCode), mods.remains];
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const keyCode = keyCodes_1.KeyCodeUtils.fromUserSettings(mods.key);
|
|
121
|
-
return [new keyCodes_1.SimpleKeybinding(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode), mods.remains];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
static parseUserBinding(input) {
|
|
125
|
-
if (!input) {
|
|
126
|
-
return [];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const parts = [];
|
|
130
|
-
let part;
|
|
131
|
-
|
|
132
|
-
while (input.length > 0) {
|
|
133
|
-
[part, input] = this.parseSimpleUserBinding(input);
|
|
134
|
-
parts.push(part);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return parts;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
exports.KeybindingParser = KeybindingParser;
|