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,126 +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.IframeUtils = void 0;
|
|
11
|
-
let hasDifferentOriginAncestorFlag = false;
|
|
12
|
-
let sameOriginWindowChainCache = null;
|
|
13
|
-
|
|
14
|
-
function getParentWindowIfSameOrigin(w) {
|
|
15
|
-
if (!w.parent || w.parent === w) {
|
|
16
|
-
return null;
|
|
17
|
-
} // Cannot really tell if we have access to the parent window unless we try to access something in it
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
let location = w.location;
|
|
22
|
-
let parentLocation = w.parent.location;
|
|
23
|
-
|
|
24
|
-
if (location.origin !== 'null' && parentLocation.origin !== 'null') {
|
|
25
|
-
if (location.protocol !== parentLocation.protocol || location.hostname !== parentLocation.hostname || location.port !== parentLocation.port) {
|
|
26
|
-
hasDifferentOriginAncestorFlag = true;
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
} catch (e) {
|
|
31
|
-
hasDifferentOriginAncestorFlag = true;
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return w.parent;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
class IframeUtils {
|
|
39
|
-
/**
|
|
40
|
-
* Returns a chain of embedded windows with the same origin (which can be accessed programmatically).
|
|
41
|
-
* Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.
|
|
42
|
-
* To distinguish if at one point the current execution environment is running inside a window with a different origin, see hasDifferentOriginAncestor()
|
|
43
|
-
*/
|
|
44
|
-
static getSameOriginWindowChain() {
|
|
45
|
-
if (!sameOriginWindowChainCache) {
|
|
46
|
-
sameOriginWindowChainCache = [];
|
|
47
|
-
let w = window;
|
|
48
|
-
let parent;
|
|
49
|
-
|
|
50
|
-
do {
|
|
51
|
-
parent = getParentWindowIfSameOrigin(w);
|
|
52
|
-
|
|
53
|
-
if (parent) {
|
|
54
|
-
sameOriginWindowChainCache.push({
|
|
55
|
-
window: w,
|
|
56
|
-
iframeElement: w.frameElement || null
|
|
57
|
-
});
|
|
58
|
-
} else {
|
|
59
|
-
sameOriginWindowChainCache.push({
|
|
60
|
-
window: w,
|
|
61
|
-
iframeElement: null
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
w = parent;
|
|
66
|
-
} while (w);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return sameOriginWindowChainCache.slice(0);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Returns true if the current execution environment is chained in a list of iframes which at one point ends in a window with a different origin.
|
|
73
|
-
* Returns false if the current execution environment is not running inside an iframe or if the entire chain of iframes have the same origin.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
static hasDifferentOriginAncestor() {
|
|
78
|
-
if (!sameOriginWindowChainCache) {
|
|
79
|
-
this.getSameOriginWindowChain();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return hasDifferentOriginAncestorFlag;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Returns the position of `childWindow` relative to `ancestorWindow`
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {
|
|
90
|
-
if (!ancestorWindow || childWindow === ancestorWindow) {
|
|
91
|
-
return {
|
|
92
|
-
top: 0,
|
|
93
|
-
left: 0
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
let top = 0,
|
|
98
|
-
left = 0;
|
|
99
|
-
let windowChain = this.getSameOriginWindowChain();
|
|
100
|
-
|
|
101
|
-
for (const windowChainEl of windowChain) {
|
|
102
|
-
top += windowChainEl.window.scrollY;
|
|
103
|
-
left += windowChainEl.window.scrollX;
|
|
104
|
-
|
|
105
|
-
if (windowChainEl.window === ancestorWindow) {
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (!windowChainEl.iframeElement) {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let boundingRect = windowChainEl.iframeElement.getBoundingClientRect();
|
|
114
|
-
top += boundingRect.top;
|
|
115
|
-
left += boundingRect.left;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return {
|
|
119
|
-
top: top,
|
|
120
|
-
left: left
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
exports.IframeUtils = IframeUtils;
|
|
@@ -1,599 +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.StandardKeyboardEvent = exports.printStandardKeyboardEvent = exports.printKeyboardEvent = exports.getCodeForKeyCode = void 0;
|
|
11
|
-
|
|
12
|
-
const browser = require("./browser");
|
|
13
|
-
|
|
14
|
-
const keyCodes_1 = require("../common/keyCodes");
|
|
15
|
-
|
|
16
|
-
const platform = require("../common/platform");
|
|
17
|
-
|
|
18
|
-
let KEY_CODE_MAP = new Array(230);
|
|
19
|
-
let INVERSE_KEY_CODE_MAP = new Array(112
|
|
20
|
-
/* MAX_VALUE */
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
(function () {
|
|
24
|
-
for (let i = 0; i < INVERSE_KEY_CODE_MAP.length; i++) {
|
|
25
|
-
INVERSE_KEY_CODE_MAP[i] = -1;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function define(code, keyCode) {
|
|
29
|
-
KEY_CODE_MAP[code] = keyCode;
|
|
30
|
-
INVERSE_KEY_CODE_MAP[keyCode] = code;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
define(3, 7
|
|
34
|
-
/* PauseBreak */
|
|
35
|
-
); // VK_CANCEL 0x03 Control-break processing
|
|
36
|
-
|
|
37
|
-
define(8, 1
|
|
38
|
-
/* Backspace */
|
|
39
|
-
);
|
|
40
|
-
define(9, 2
|
|
41
|
-
/* Tab */
|
|
42
|
-
);
|
|
43
|
-
define(13, 3
|
|
44
|
-
/* Enter */
|
|
45
|
-
);
|
|
46
|
-
define(16, 4
|
|
47
|
-
/* Shift */
|
|
48
|
-
);
|
|
49
|
-
define(17, 5
|
|
50
|
-
/* Ctrl */
|
|
51
|
-
);
|
|
52
|
-
define(18, 6
|
|
53
|
-
/* Alt */
|
|
54
|
-
);
|
|
55
|
-
define(19, 7
|
|
56
|
-
/* PauseBreak */
|
|
57
|
-
);
|
|
58
|
-
define(20, 8
|
|
59
|
-
/* CapsLock */
|
|
60
|
-
);
|
|
61
|
-
define(27, 9
|
|
62
|
-
/* Escape */
|
|
63
|
-
);
|
|
64
|
-
define(32, 10
|
|
65
|
-
/* Space */
|
|
66
|
-
);
|
|
67
|
-
define(33, 11
|
|
68
|
-
/* PageUp */
|
|
69
|
-
);
|
|
70
|
-
define(34, 12
|
|
71
|
-
/* PageDown */
|
|
72
|
-
);
|
|
73
|
-
define(35, 13
|
|
74
|
-
/* End */
|
|
75
|
-
);
|
|
76
|
-
define(36, 14
|
|
77
|
-
/* Home */
|
|
78
|
-
);
|
|
79
|
-
define(37, 15
|
|
80
|
-
/* LeftArrow */
|
|
81
|
-
);
|
|
82
|
-
define(38, 16
|
|
83
|
-
/* UpArrow */
|
|
84
|
-
);
|
|
85
|
-
define(39, 17
|
|
86
|
-
/* RightArrow */
|
|
87
|
-
);
|
|
88
|
-
define(40, 18
|
|
89
|
-
/* DownArrow */
|
|
90
|
-
);
|
|
91
|
-
define(45, 19
|
|
92
|
-
/* Insert */
|
|
93
|
-
);
|
|
94
|
-
define(46, 20
|
|
95
|
-
/* Delete */
|
|
96
|
-
);
|
|
97
|
-
define(48, 21
|
|
98
|
-
/* KEY_0 */
|
|
99
|
-
);
|
|
100
|
-
define(49, 22
|
|
101
|
-
/* KEY_1 */
|
|
102
|
-
);
|
|
103
|
-
define(50, 23
|
|
104
|
-
/* KEY_2 */
|
|
105
|
-
);
|
|
106
|
-
define(51, 24
|
|
107
|
-
/* KEY_3 */
|
|
108
|
-
);
|
|
109
|
-
define(52, 25
|
|
110
|
-
/* KEY_4 */
|
|
111
|
-
);
|
|
112
|
-
define(53, 26
|
|
113
|
-
/* KEY_5 */
|
|
114
|
-
);
|
|
115
|
-
define(54, 27
|
|
116
|
-
/* KEY_6 */
|
|
117
|
-
);
|
|
118
|
-
define(55, 28
|
|
119
|
-
/* KEY_7 */
|
|
120
|
-
);
|
|
121
|
-
define(56, 29
|
|
122
|
-
/* KEY_8 */
|
|
123
|
-
);
|
|
124
|
-
define(57, 30
|
|
125
|
-
/* KEY_9 */
|
|
126
|
-
);
|
|
127
|
-
define(65, 31
|
|
128
|
-
/* KEY_A */
|
|
129
|
-
);
|
|
130
|
-
define(66, 32
|
|
131
|
-
/* KEY_B */
|
|
132
|
-
);
|
|
133
|
-
define(67, 33
|
|
134
|
-
/* KEY_C */
|
|
135
|
-
);
|
|
136
|
-
define(68, 34
|
|
137
|
-
/* KEY_D */
|
|
138
|
-
);
|
|
139
|
-
define(69, 35
|
|
140
|
-
/* KEY_E */
|
|
141
|
-
);
|
|
142
|
-
define(70, 36
|
|
143
|
-
/* KEY_F */
|
|
144
|
-
);
|
|
145
|
-
define(71, 37
|
|
146
|
-
/* KEY_G */
|
|
147
|
-
);
|
|
148
|
-
define(72, 38
|
|
149
|
-
/* KEY_H */
|
|
150
|
-
);
|
|
151
|
-
define(73, 39
|
|
152
|
-
/* KEY_I */
|
|
153
|
-
);
|
|
154
|
-
define(74, 40
|
|
155
|
-
/* KEY_J */
|
|
156
|
-
);
|
|
157
|
-
define(75, 41
|
|
158
|
-
/* KEY_K */
|
|
159
|
-
);
|
|
160
|
-
define(76, 42
|
|
161
|
-
/* KEY_L */
|
|
162
|
-
);
|
|
163
|
-
define(77, 43
|
|
164
|
-
/* KEY_M */
|
|
165
|
-
);
|
|
166
|
-
define(78, 44
|
|
167
|
-
/* KEY_N */
|
|
168
|
-
);
|
|
169
|
-
define(79, 45
|
|
170
|
-
/* KEY_O */
|
|
171
|
-
);
|
|
172
|
-
define(80, 46
|
|
173
|
-
/* KEY_P */
|
|
174
|
-
);
|
|
175
|
-
define(81, 47
|
|
176
|
-
/* KEY_Q */
|
|
177
|
-
);
|
|
178
|
-
define(82, 48
|
|
179
|
-
/* KEY_R */
|
|
180
|
-
);
|
|
181
|
-
define(83, 49
|
|
182
|
-
/* KEY_S */
|
|
183
|
-
);
|
|
184
|
-
define(84, 50
|
|
185
|
-
/* KEY_T */
|
|
186
|
-
);
|
|
187
|
-
define(85, 51
|
|
188
|
-
/* KEY_U */
|
|
189
|
-
);
|
|
190
|
-
define(86, 52
|
|
191
|
-
/* KEY_V */
|
|
192
|
-
);
|
|
193
|
-
define(87, 53
|
|
194
|
-
/* KEY_W */
|
|
195
|
-
);
|
|
196
|
-
define(88, 54
|
|
197
|
-
/* KEY_X */
|
|
198
|
-
);
|
|
199
|
-
define(89, 55
|
|
200
|
-
/* KEY_Y */
|
|
201
|
-
);
|
|
202
|
-
define(90, 56
|
|
203
|
-
/* KEY_Z */
|
|
204
|
-
);
|
|
205
|
-
define(93, 58
|
|
206
|
-
/* ContextMenu */
|
|
207
|
-
);
|
|
208
|
-
define(96, 93
|
|
209
|
-
/* NUMPAD_0 */
|
|
210
|
-
);
|
|
211
|
-
define(97, 94
|
|
212
|
-
/* NUMPAD_1 */
|
|
213
|
-
);
|
|
214
|
-
define(98, 95
|
|
215
|
-
/* NUMPAD_2 */
|
|
216
|
-
);
|
|
217
|
-
define(99, 96
|
|
218
|
-
/* NUMPAD_3 */
|
|
219
|
-
);
|
|
220
|
-
define(100, 97
|
|
221
|
-
/* NUMPAD_4 */
|
|
222
|
-
);
|
|
223
|
-
define(101, 98
|
|
224
|
-
/* NUMPAD_5 */
|
|
225
|
-
);
|
|
226
|
-
define(102, 99
|
|
227
|
-
/* NUMPAD_6 */
|
|
228
|
-
);
|
|
229
|
-
define(103, 100
|
|
230
|
-
/* NUMPAD_7 */
|
|
231
|
-
);
|
|
232
|
-
define(104, 101
|
|
233
|
-
/* NUMPAD_8 */
|
|
234
|
-
);
|
|
235
|
-
define(105, 102
|
|
236
|
-
/* NUMPAD_9 */
|
|
237
|
-
);
|
|
238
|
-
define(106, 103
|
|
239
|
-
/* NUMPAD_MULTIPLY */
|
|
240
|
-
);
|
|
241
|
-
define(107, 104
|
|
242
|
-
/* NUMPAD_ADD */
|
|
243
|
-
);
|
|
244
|
-
define(108, 105
|
|
245
|
-
/* NUMPAD_SEPARATOR */
|
|
246
|
-
);
|
|
247
|
-
define(109, 106
|
|
248
|
-
/* NUMPAD_SUBTRACT */
|
|
249
|
-
);
|
|
250
|
-
define(110, 107
|
|
251
|
-
/* NUMPAD_DECIMAL */
|
|
252
|
-
);
|
|
253
|
-
define(111, 108
|
|
254
|
-
/* NUMPAD_DIVIDE */
|
|
255
|
-
);
|
|
256
|
-
define(112, 59
|
|
257
|
-
/* F1 */
|
|
258
|
-
);
|
|
259
|
-
define(113, 60
|
|
260
|
-
/* F2 */
|
|
261
|
-
);
|
|
262
|
-
define(114, 61
|
|
263
|
-
/* F3 */
|
|
264
|
-
);
|
|
265
|
-
define(115, 62
|
|
266
|
-
/* F4 */
|
|
267
|
-
);
|
|
268
|
-
define(116, 63
|
|
269
|
-
/* F5 */
|
|
270
|
-
);
|
|
271
|
-
define(117, 64
|
|
272
|
-
/* F6 */
|
|
273
|
-
);
|
|
274
|
-
define(118, 65
|
|
275
|
-
/* F7 */
|
|
276
|
-
);
|
|
277
|
-
define(119, 66
|
|
278
|
-
/* F8 */
|
|
279
|
-
);
|
|
280
|
-
define(120, 67
|
|
281
|
-
/* F9 */
|
|
282
|
-
);
|
|
283
|
-
define(121, 68
|
|
284
|
-
/* F10 */
|
|
285
|
-
);
|
|
286
|
-
define(122, 69
|
|
287
|
-
/* F11 */
|
|
288
|
-
);
|
|
289
|
-
define(123, 70
|
|
290
|
-
/* F12 */
|
|
291
|
-
);
|
|
292
|
-
define(124, 71
|
|
293
|
-
/* F13 */
|
|
294
|
-
);
|
|
295
|
-
define(125, 72
|
|
296
|
-
/* F14 */
|
|
297
|
-
);
|
|
298
|
-
define(126, 73
|
|
299
|
-
/* F15 */
|
|
300
|
-
);
|
|
301
|
-
define(127, 74
|
|
302
|
-
/* F16 */
|
|
303
|
-
);
|
|
304
|
-
define(128, 75
|
|
305
|
-
/* F17 */
|
|
306
|
-
);
|
|
307
|
-
define(129, 76
|
|
308
|
-
/* F18 */
|
|
309
|
-
);
|
|
310
|
-
define(130, 77
|
|
311
|
-
/* F19 */
|
|
312
|
-
);
|
|
313
|
-
define(144, 78
|
|
314
|
-
/* NumLock */
|
|
315
|
-
);
|
|
316
|
-
define(145, 79
|
|
317
|
-
/* ScrollLock */
|
|
318
|
-
);
|
|
319
|
-
define(186, 80
|
|
320
|
-
/* US_SEMICOLON */
|
|
321
|
-
);
|
|
322
|
-
define(187, 81
|
|
323
|
-
/* US_EQUAL */
|
|
324
|
-
);
|
|
325
|
-
define(188, 82
|
|
326
|
-
/* US_COMMA */
|
|
327
|
-
);
|
|
328
|
-
define(189, 83
|
|
329
|
-
/* US_MINUS */
|
|
330
|
-
);
|
|
331
|
-
define(190, 84
|
|
332
|
-
/* US_DOT */
|
|
333
|
-
);
|
|
334
|
-
define(191, 85
|
|
335
|
-
/* US_SLASH */
|
|
336
|
-
);
|
|
337
|
-
define(192, 86
|
|
338
|
-
/* US_BACKTICK */
|
|
339
|
-
);
|
|
340
|
-
define(193, 110
|
|
341
|
-
/* ABNT_C1 */
|
|
342
|
-
);
|
|
343
|
-
define(194, 111
|
|
344
|
-
/* ABNT_C2 */
|
|
345
|
-
);
|
|
346
|
-
define(219, 87
|
|
347
|
-
/* US_OPEN_SQUARE_BRACKET */
|
|
348
|
-
);
|
|
349
|
-
define(220, 88
|
|
350
|
-
/* US_BACKSLASH */
|
|
351
|
-
);
|
|
352
|
-
define(221, 89
|
|
353
|
-
/* US_CLOSE_SQUARE_BRACKET */
|
|
354
|
-
);
|
|
355
|
-
define(222, 90
|
|
356
|
-
/* US_QUOTE */
|
|
357
|
-
);
|
|
358
|
-
define(223, 91
|
|
359
|
-
/* OEM_8 */
|
|
360
|
-
);
|
|
361
|
-
define(226, 92
|
|
362
|
-
/* OEM_102 */
|
|
363
|
-
);
|
|
364
|
-
/**
|
|
365
|
-
* https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
|
|
366
|
-
* If an Input Method Editor is processing key input and the event is keydown, return 229.
|
|
367
|
-
*/
|
|
368
|
-
|
|
369
|
-
define(229, 109
|
|
370
|
-
/* KEY_IN_COMPOSITION */
|
|
371
|
-
);
|
|
372
|
-
|
|
373
|
-
if (browser.isFirefox) {
|
|
374
|
-
define(59, 80
|
|
375
|
-
/* US_SEMICOLON */
|
|
376
|
-
);
|
|
377
|
-
define(107, 81
|
|
378
|
-
/* US_EQUAL */
|
|
379
|
-
);
|
|
380
|
-
define(109, 83
|
|
381
|
-
/* US_MINUS */
|
|
382
|
-
);
|
|
383
|
-
|
|
384
|
-
if (platform.isMacintosh) {
|
|
385
|
-
define(224, 57
|
|
386
|
-
/* Meta */
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
} else if (browser.isWebKit) {
|
|
390
|
-
define(91, 57
|
|
391
|
-
/* Meta */
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
if (platform.isMacintosh) {
|
|
395
|
-
// the two meta keys in the Mac have different key codes (91 and 93)
|
|
396
|
-
define(93, 57
|
|
397
|
-
/* Meta */
|
|
398
|
-
);
|
|
399
|
-
} else {
|
|
400
|
-
define(92, 57
|
|
401
|
-
/* Meta */
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
})();
|
|
406
|
-
|
|
407
|
-
function extractKeyCode(e) {
|
|
408
|
-
if (e.charCode) {
|
|
409
|
-
// "keypress" events mostly
|
|
410
|
-
let char = String.fromCharCode(e.charCode).toUpperCase();
|
|
411
|
-
return keyCodes_1.KeyCodeUtils.fromString(char);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
return KEY_CODE_MAP[e.keyCode] || 0
|
|
415
|
-
/* Unknown */
|
|
416
|
-
;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function getCodeForKeyCode(keyCode) {
|
|
420
|
-
return INVERSE_KEY_CODE_MAP[keyCode];
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
exports.getCodeForKeyCode = getCodeForKeyCode;
|
|
424
|
-
const ctrlKeyMod = platform.isMacintosh ? 256
|
|
425
|
-
/* WinCtrl */
|
|
426
|
-
: 2048
|
|
427
|
-
/* CtrlCmd */
|
|
428
|
-
;
|
|
429
|
-
const altKeyMod = 512
|
|
430
|
-
/* Alt */
|
|
431
|
-
;
|
|
432
|
-
const shiftKeyMod = 1024
|
|
433
|
-
/* Shift */
|
|
434
|
-
;
|
|
435
|
-
const metaKeyMod = platform.isMacintosh ? 2048
|
|
436
|
-
/* CtrlCmd */
|
|
437
|
-
: 256
|
|
438
|
-
/* WinCtrl */
|
|
439
|
-
;
|
|
440
|
-
|
|
441
|
-
function printKeyboardEvent(e) {
|
|
442
|
-
let modifiers = [];
|
|
443
|
-
|
|
444
|
-
if (e.ctrlKey) {
|
|
445
|
-
modifiers.push(`ctrl`);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
if (e.shiftKey) {
|
|
449
|
-
modifiers.push(`shift`);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (e.altKey) {
|
|
453
|
-
modifiers.push(`alt`);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (e.metaKey) {
|
|
457
|
-
modifiers.push(`meta`);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
exports.printKeyboardEvent = printKeyboardEvent;
|
|
464
|
-
|
|
465
|
-
function printStandardKeyboardEvent(e) {
|
|
466
|
-
let modifiers = [];
|
|
467
|
-
|
|
468
|
-
if (e.ctrlKey) {
|
|
469
|
-
modifiers.push(`ctrl`);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (e.shiftKey) {
|
|
473
|
-
modifiers.push(`shift`);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
if (e.altKey) {
|
|
477
|
-
modifiers.push(`alt`);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
if (e.metaKey) {
|
|
481
|
-
modifiers.push(`meta`);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${keyCodes_1.KeyCodeUtils.toString(e.keyCode)}')`;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
exports.printStandardKeyboardEvent = printStandardKeyboardEvent;
|
|
488
|
-
|
|
489
|
-
class StandardKeyboardEvent {
|
|
490
|
-
constructor(source) {
|
|
491
|
-
this._standardKeyboardEventBrand = true;
|
|
492
|
-
let e = source;
|
|
493
|
-
this.browserEvent = e;
|
|
494
|
-
this.target = e.target;
|
|
495
|
-
this.ctrlKey = e.ctrlKey;
|
|
496
|
-
this.shiftKey = e.shiftKey;
|
|
497
|
-
this.altKey = e.altKey;
|
|
498
|
-
this.metaKey = e.metaKey;
|
|
499
|
-
this.keyCode = extractKeyCode(e);
|
|
500
|
-
this.code = e.code; // console.info(e.type + ": keyCode: " + e.keyCode + ", which: " + e.which + ", charCode: " + e.charCode + ", detail: " + e.detail + " ====> " + this.keyCode + ' -- ' + KeyCode[this.keyCode]);
|
|
501
|
-
|
|
502
|
-
this.ctrlKey = this.ctrlKey || this.keyCode === 5
|
|
503
|
-
/* Ctrl */
|
|
504
|
-
;
|
|
505
|
-
this.altKey = this.altKey || this.keyCode === 6
|
|
506
|
-
/* Alt */
|
|
507
|
-
;
|
|
508
|
-
this.shiftKey = this.shiftKey || this.keyCode === 4
|
|
509
|
-
/* Shift */
|
|
510
|
-
;
|
|
511
|
-
this.metaKey = this.metaKey || this.keyCode === 57
|
|
512
|
-
/* Meta */
|
|
513
|
-
;
|
|
514
|
-
this._asKeybinding = this._computeKeybinding();
|
|
515
|
-
this._asRuntimeKeybinding = this._computeRuntimeKeybinding(); // console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
preventDefault() {
|
|
519
|
-
if (this.browserEvent && this.browserEvent.preventDefault) {
|
|
520
|
-
this.browserEvent.preventDefault();
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
stopPropagation() {
|
|
525
|
-
if (this.browserEvent && this.browserEvent.stopPropagation) {
|
|
526
|
-
this.browserEvent.stopPropagation();
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
toKeybinding() {
|
|
531
|
-
return this._asRuntimeKeybinding;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
equals(other) {
|
|
535
|
-
return this._asKeybinding === other;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
_computeKeybinding() {
|
|
539
|
-
let key = 0
|
|
540
|
-
/* Unknown */
|
|
541
|
-
;
|
|
542
|
-
|
|
543
|
-
if (this.keyCode !== 5
|
|
544
|
-
/* Ctrl */
|
|
545
|
-
&& this.keyCode !== 4
|
|
546
|
-
/* Shift */
|
|
547
|
-
&& this.keyCode !== 6
|
|
548
|
-
/* Alt */
|
|
549
|
-
&& this.keyCode !== 57
|
|
550
|
-
/* Meta */
|
|
551
|
-
) {
|
|
552
|
-
key = this.keyCode;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
let result = 0;
|
|
556
|
-
|
|
557
|
-
if (this.ctrlKey) {
|
|
558
|
-
result |= ctrlKeyMod;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
if (this.altKey) {
|
|
562
|
-
result |= altKeyMod;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
if (this.shiftKey) {
|
|
566
|
-
result |= shiftKeyMod;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (this.metaKey) {
|
|
570
|
-
result |= metaKeyMod;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
result |= key;
|
|
574
|
-
return result;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
_computeRuntimeKeybinding() {
|
|
578
|
-
let key = 0
|
|
579
|
-
/* Unknown */
|
|
580
|
-
;
|
|
581
|
-
|
|
582
|
-
if (this.keyCode !== 5
|
|
583
|
-
/* Ctrl */
|
|
584
|
-
&& this.keyCode !== 4
|
|
585
|
-
/* Shift */
|
|
586
|
-
&& this.keyCode !== 6
|
|
587
|
-
/* Alt */
|
|
588
|
-
&& this.keyCode !== 57
|
|
589
|
-
/* Meta */
|
|
590
|
-
) {
|
|
591
|
-
key = this.keyCode;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
return new keyCodes_1.SimpleKeybinding(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
exports.StandardKeyboardEvent = StandardKeyboardEvent;
|