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,256 +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.DropdownMenu = exports.Dropdown = exports.BaseDropdown = void 0;
|
|
11
|
-
|
|
12
|
-
require("../../../../css!./dropdown");
|
|
13
|
-
|
|
14
|
-
const touch_1 = require("../../touch");
|
|
15
|
-
|
|
16
|
-
const actions_1 = require("../../../common/actions");
|
|
17
|
-
|
|
18
|
-
const dom_1 = require("../../dom");
|
|
19
|
-
|
|
20
|
-
const keyboardEvent_1 = require("../../keyboardEvent");
|
|
21
|
-
|
|
22
|
-
const event_1 = require("../../../common/event");
|
|
23
|
-
|
|
24
|
-
class BaseDropdown extends actions_1.ActionRunner {
|
|
25
|
-
constructor(container, options) {
|
|
26
|
-
super();
|
|
27
|
-
this._onDidChangeVisibility = new event_1.Emitter();
|
|
28
|
-
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
29
|
-
this._element = dom_1.append(container, dom_1.$('.monaco-dropdown'));
|
|
30
|
-
this._label = dom_1.append(this._element, dom_1.$('.dropdown-label'));
|
|
31
|
-
let labelRenderer = options.labelRenderer;
|
|
32
|
-
|
|
33
|
-
if (!labelRenderer) {
|
|
34
|
-
labelRenderer = container => {
|
|
35
|
-
container.textContent = options.label || '';
|
|
36
|
-
return null;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for (const event of [dom_1.EventType.CLICK, dom_1.EventType.MOUSE_DOWN, touch_1.EventType.Tap]) {
|
|
41
|
-
this._register(dom_1.addDisposableListener(this.element, event, e => dom_1.EventHelper.stop(e, true))); // prevent default click behaviour to trigger
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
for (const event of [dom_1.EventType.MOUSE_DOWN, touch_1.EventType.Tap]) {
|
|
46
|
-
this._register(dom_1.addDisposableListener(this._label, event, e => {
|
|
47
|
-
if (e instanceof MouseEvent && e.detail > 1) {
|
|
48
|
-
return; // prevent multiple clicks to open multiple context menus (https://github.com/microsoft/vscode/issues/41363)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (this.visible) {
|
|
52
|
-
this.hide();
|
|
53
|
-
} else {
|
|
54
|
-
this.show();
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
this._register(dom_1.addDisposableListener(this._label, dom_1.EventType.KEY_UP, e => {
|
|
60
|
-
const event = new keyboardEvent_1.StandardKeyboardEvent(e);
|
|
61
|
-
|
|
62
|
-
if (event.equals(3
|
|
63
|
-
/* Enter */
|
|
64
|
-
) || event.equals(10
|
|
65
|
-
/* Space */
|
|
66
|
-
)) {
|
|
67
|
-
dom_1.EventHelper.stop(e, true); // https://github.com/microsoft/vscode/issues/57997
|
|
68
|
-
|
|
69
|
-
if (this.visible) {
|
|
70
|
-
this.hide();
|
|
71
|
-
} else {
|
|
72
|
-
this.show();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}));
|
|
76
|
-
|
|
77
|
-
const cleanupFn = labelRenderer(this._label);
|
|
78
|
-
|
|
79
|
-
if (cleanupFn) {
|
|
80
|
-
this._register(cleanupFn);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
this._register(touch_1.Gesture.addTarget(this._label));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get element() {
|
|
87
|
-
return this._element;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
get label() {
|
|
91
|
-
return this._label;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
set tooltip(tooltip) {
|
|
95
|
-
if (this._label) {
|
|
96
|
-
this._label.title = tooltip;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
show() {
|
|
101
|
-
if (!this.visible) {
|
|
102
|
-
this.visible = true;
|
|
103
|
-
|
|
104
|
-
this._onDidChangeVisibility.fire(true);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
hide() {
|
|
109
|
-
if (this.visible) {
|
|
110
|
-
this.visible = false;
|
|
111
|
-
|
|
112
|
-
this._onDidChangeVisibility.fire(false);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
isVisible() {
|
|
117
|
-
return !!this.visible;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
onEvent(e, activeElement) {
|
|
121
|
-
this.hide();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
dispose() {
|
|
125
|
-
super.dispose();
|
|
126
|
-
this.hide();
|
|
127
|
-
|
|
128
|
-
if (this.boxContainer) {
|
|
129
|
-
this.boxContainer.remove();
|
|
130
|
-
this.boxContainer = undefined;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (this.contents) {
|
|
134
|
-
this.contents.remove();
|
|
135
|
-
this.contents = undefined;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (this._label) {
|
|
139
|
-
this._label.remove();
|
|
140
|
-
|
|
141
|
-
this._label = undefined;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
exports.BaseDropdown = BaseDropdown;
|
|
148
|
-
|
|
149
|
-
class Dropdown extends BaseDropdown {
|
|
150
|
-
constructor(container, options) {
|
|
151
|
-
super(container, options);
|
|
152
|
-
this.contextViewProvider = options.contextViewProvider;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
show() {
|
|
156
|
-
super.show();
|
|
157
|
-
this.element.classList.add('active');
|
|
158
|
-
this.contextViewProvider.showContextView({
|
|
159
|
-
getAnchor: () => this.getAnchor(),
|
|
160
|
-
render: container => {
|
|
161
|
-
return this.renderContents(container);
|
|
162
|
-
},
|
|
163
|
-
onDOMEvent: (e, activeElement) => {
|
|
164
|
-
this.onEvent(e, activeElement);
|
|
165
|
-
},
|
|
166
|
-
onHide: () => this.onHide()
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
getAnchor() {
|
|
171
|
-
return this.element;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
onHide() {
|
|
175
|
-
this.element.classList.remove('active');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
hide() {
|
|
179
|
-
super.hide();
|
|
180
|
-
|
|
181
|
-
if (this.contextViewProvider) {
|
|
182
|
-
this.contextViewProvider.hideContextView();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
renderContents(container) {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
exports.Dropdown = Dropdown;
|
|
193
|
-
|
|
194
|
-
class DropdownMenu extends BaseDropdown {
|
|
195
|
-
constructor(container, options) {
|
|
196
|
-
super(container, options);
|
|
197
|
-
this._actions = [];
|
|
198
|
-
this._contextMenuProvider = options.contextMenuProvider;
|
|
199
|
-
this.actions = options.actions || [];
|
|
200
|
-
this.actionProvider = options.actionProvider;
|
|
201
|
-
this.menuClassName = options.menuClassName || '';
|
|
202
|
-
this.menuAsChild = !!options.menuAsChild;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
set menuOptions(options) {
|
|
206
|
-
this._menuOptions = options;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
get menuOptions() {
|
|
210
|
-
return this._menuOptions;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
get actions() {
|
|
214
|
-
if (this.actionProvider) {
|
|
215
|
-
return this.actionProvider.getActions();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return this._actions;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
set actions(actions) {
|
|
222
|
-
this._actions = actions;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
show() {
|
|
226
|
-
super.show();
|
|
227
|
-
this.element.classList.add('active');
|
|
228
|
-
|
|
229
|
-
this._contextMenuProvider.showContextMenu({
|
|
230
|
-
getAnchor: () => this.element,
|
|
231
|
-
getActions: () => this.actions,
|
|
232
|
-
getActionsContext: () => this.menuOptions ? this.menuOptions.context : null,
|
|
233
|
-
getActionViewItem: action => this.menuOptions && this.menuOptions.actionViewItemProvider ? this.menuOptions.actionViewItemProvider(action) : undefined,
|
|
234
|
-
getKeyBinding: action => this.menuOptions && this.menuOptions.getKeyBinding ? this.menuOptions.getKeyBinding(action) : undefined,
|
|
235
|
-
getMenuClassName: () => this.menuClassName,
|
|
236
|
-
onHide: () => this.onHide(),
|
|
237
|
-
actionRunner: this.menuOptions ? this.menuOptions.actionRunner : undefined,
|
|
238
|
-
anchorAlignment: this.menuOptions ? this.menuOptions.anchorAlignment : 0
|
|
239
|
-
/* LEFT */
|
|
240
|
-
,
|
|
241
|
-
domForShadowRoot: this.menuAsChild ? this.element : undefined
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
hide() {
|
|
246
|
-
super.hide();
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
onHide() {
|
|
250
|
-
this.hide();
|
|
251
|
-
this.element.classList.remove('active');
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
exports.DropdownMenu = DropdownMenu;
|
|
@@ -1,120 +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.DropdownMenuActionViewItem = void 0;
|
|
11
|
-
|
|
12
|
-
require("../../../../css!./dropdown");
|
|
13
|
-
|
|
14
|
-
const dom_1 = require("../../dom");
|
|
15
|
-
|
|
16
|
-
const event_1 = require("../../../common/event");
|
|
17
|
-
|
|
18
|
-
const actionViewItems_1 = require("../actionbar/actionViewItems");
|
|
19
|
-
|
|
20
|
-
const dropdown_1 = require("./dropdown");
|
|
21
|
-
|
|
22
|
-
class DropdownMenuActionViewItem extends actionViewItems_1.BaseActionViewItem {
|
|
23
|
-
constructor(action, menuActionsOrProvider, contextMenuProvider, options = {}) {
|
|
24
|
-
super(null, action, options);
|
|
25
|
-
this.options = options;
|
|
26
|
-
this._onDidChangeVisibility = this._register(new event_1.Emitter());
|
|
27
|
-
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
28
|
-
this.menuActionsOrProvider = menuActionsOrProvider;
|
|
29
|
-
this.contextMenuProvider = contextMenuProvider;
|
|
30
|
-
|
|
31
|
-
if (this.options.actionRunner) {
|
|
32
|
-
this.actionRunner = this.options.actionRunner;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
render(container) {
|
|
37
|
-
const labelRenderer = el => {
|
|
38
|
-
this.element = dom_1.append(el, dom_1.$('a.action-label'));
|
|
39
|
-
let classNames = [];
|
|
40
|
-
|
|
41
|
-
if (typeof this.options.classNames === 'string') {
|
|
42
|
-
classNames = this.options.classNames.split(/\s+/g).filter(s => !!s);
|
|
43
|
-
} else if (this.options.classNames) {
|
|
44
|
-
classNames = this.options.classNames;
|
|
45
|
-
} // todo@aeschli: remove codicon, should come through `this.options.classNames`
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (!classNames.find(c => c === 'icon')) {
|
|
49
|
-
classNames.push('codicon');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.element.classList.add(...classNames);
|
|
53
|
-
this.element.tabIndex = 0;
|
|
54
|
-
this.element.setAttribute('role', 'button');
|
|
55
|
-
this.element.setAttribute('aria-haspopup', 'true');
|
|
56
|
-
this.element.setAttribute('aria-expanded', 'false');
|
|
57
|
-
this.element.title = this._action.label || '';
|
|
58
|
-
return null;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const isActionsArray = Array.isArray(this.menuActionsOrProvider);
|
|
62
|
-
const options = {
|
|
63
|
-
contextMenuProvider: this.contextMenuProvider,
|
|
64
|
-
labelRenderer: labelRenderer,
|
|
65
|
-
menuAsChild: this.options.menuAsChild,
|
|
66
|
-
actions: isActionsArray ? this.menuActionsOrProvider : undefined,
|
|
67
|
-
actionProvider: isActionsArray ? undefined : this.menuActionsOrProvider
|
|
68
|
-
};
|
|
69
|
-
this.dropdownMenu = this._register(new dropdown_1.DropdownMenu(container, options));
|
|
70
|
-
|
|
71
|
-
this._register(this.dropdownMenu.onDidChangeVisibility(visible => {
|
|
72
|
-
var _a;
|
|
73
|
-
|
|
74
|
-
(_a = this.element) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', `${visible}`);
|
|
75
|
-
|
|
76
|
-
this._onDidChangeVisibility.fire(visible);
|
|
77
|
-
}));
|
|
78
|
-
|
|
79
|
-
this.dropdownMenu.menuOptions = {
|
|
80
|
-
actionViewItemProvider: this.options.actionViewItemProvider,
|
|
81
|
-
actionRunner: this.actionRunner,
|
|
82
|
-
getKeyBinding: this.options.keybindingProvider,
|
|
83
|
-
context: this._context
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
if (this.options.anchorAlignmentProvider) {
|
|
87
|
-
const that = this;
|
|
88
|
-
this.dropdownMenu.menuOptions = { ...this.dropdownMenu.menuOptions,
|
|
89
|
-
|
|
90
|
-
get anchorAlignment() {
|
|
91
|
-
return that.options.anchorAlignmentProvider();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
setActionContext(newContext) {
|
|
99
|
-
super.setActionContext(newContext);
|
|
100
|
-
|
|
101
|
-
if (this.dropdownMenu) {
|
|
102
|
-
if (this.dropdownMenu.menuOptions) {
|
|
103
|
-
this.dropdownMenu.menuOptions.context = newContext;
|
|
104
|
-
} else {
|
|
105
|
-
this.dropdownMenu.menuOptions = {
|
|
106
|
-
context: newContext
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
show() {
|
|
113
|
-
if (this.dropdownMenu) {
|
|
114
|
-
this.dropdownMenu.show();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
exports.DropdownMenuActionViewItem = DropdownMenuActionViewItem;
|
|
@@ -1,118 +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.KeybindingLabel = void 0;
|
|
11
|
-
|
|
12
|
-
require("../../../../css!./keybindingLabel");
|
|
13
|
-
|
|
14
|
-
const objects_1 = require("../../../common/objects");
|
|
15
|
-
|
|
16
|
-
const keybindingLabels_1 = require("../../../common/keybindingLabels");
|
|
17
|
-
|
|
18
|
-
const dom = require("../../dom");
|
|
19
|
-
|
|
20
|
-
const nls_1 = require("../../../../nls");
|
|
21
|
-
|
|
22
|
-
const $ = dom.$;
|
|
23
|
-
|
|
24
|
-
class KeybindingLabel {
|
|
25
|
-
constructor(container, os, options) {
|
|
26
|
-
this.os = os;
|
|
27
|
-
this.options = options;
|
|
28
|
-
this.domNode = dom.append(container, $('.monaco-keybinding'));
|
|
29
|
-
this.didEverRender = false;
|
|
30
|
-
container.appendChild(this.domNode);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get element() {
|
|
34
|
-
return this.domNode;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
set(keybinding, matches) {
|
|
38
|
-
if (this.didEverRender && this.keybinding === keybinding && KeybindingLabel.areSame(this.matches, matches)) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.keybinding = keybinding;
|
|
43
|
-
this.matches = matches;
|
|
44
|
-
this.render();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
render() {
|
|
48
|
-
dom.clearNode(this.domNode);
|
|
49
|
-
|
|
50
|
-
if (this.keybinding) {
|
|
51
|
-
let [firstPart, chordPart] = this.keybinding.getParts();
|
|
52
|
-
|
|
53
|
-
if (firstPart) {
|
|
54
|
-
this.renderPart(this.domNode, firstPart, this.matches ? this.matches.firstPart : null);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (chordPart) {
|
|
58
|
-
dom.append(this.domNode, $('span.monaco-keybinding-key-chord-separator', undefined, ' '));
|
|
59
|
-
this.renderPart(this.domNode, chordPart, this.matches ? this.matches.chordPart : null);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
this.domNode.title = this.keybinding.getAriaLabel() || '';
|
|
63
|
-
} else if (this.options && this.options.renderUnboundKeybindings) {
|
|
64
|
-
this.renderUnbound(this.domNode);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
this.didEverRender = true;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
renderPart(parent, part, match) {
|
|
71
|
-
const modifierLabels = keybindingLabels_1.UILabelProvider.modifierLabels[this.os];
|
|
72
|
-
|
|
73
|
-
if (part.ctrlKey) {
|
|
74
|
-
this.renderKey(parent, modifierLabels.ctrlKey, Boolean(match === null || match === void 0 ? void 0 : match.ctrlKey), modifierLabels.separator);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (part.shiftKey) {
|
|
78
|
-
this.renderKey(parent, modifierLabels.shiftKey, Boolean(match === null || match === void 0 ? void 0 : match.shiftKey), modifierLabels.separator);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (part.altKey) {
|
|
82
|
-
this.renderKey(parent, modifierLabels.altKey, Boolean(match === null || match === void 0 ? void 0 : match.altKey), modifierLabels.separator);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (part.metaKey) {
|
|
86
|
-
this.renderKey(parent, modifierLabels.metaKey, Boolean(match === null || match === void 0 ? void 0 : match.metaKey), modifierLabels.separator);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const keyLabel = part.keyLabel;
|
|
90
|
-
|
|
91
|
-
if (keyLabel) {
|
|
92
|
-
this.renderKey(parent, keyLabel, Boolean(match === null || match === void 0 ? void 0 : match.keyCode), '');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
renderKey(parent, label, highlight, separator) {
|
|
97
|
-
dom.append(parent, $('span.monaco-keybinding-key' + (highlight ? '.highlight' : ''), undefined, label));
|
|
98
|
-
|
|
99
|
-
if (separator) {
|
|
100
|
-
dom.append(parent, $('span.monaco-keybinding-key-separator', undefined, separator));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
renderUnbound(parent) {
|
|
105
|
-
dom.append(parent, $('span.monaco-keybinding-key', undefined, nls_1.localize('unbound', "Unbound")));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static areSame(a, b) {
|
|
109
|
-
if (a === b || !a && !b) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return !!a && !!b && objects_1.equals(a.firstPart, b.firstPart) && objects_1.equals(a.chordPart, b.chordPart);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
exports.KeybindingLabel = KeybindingLabel;
|
|
@@ -1,54 +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.CachedListVirtualDelegate = exports.ListError = exports.ListDragOverReactions = void 0;
|
|
11
|
-
exports.ListDragOverReactions = {
|
|
12
|
-
reject() {
|
|
13
|
-
return {
|
|
14
|
-
accept: false
|
|
15
|
-
};
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
accept() {
|
|
19
|
-
return {
|
|
20
|
-
accept: true
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
class ListError extends Error {
|
|
27
|
-
constructor(user, message) {
|
|
28
|
-
super(`ListError [${user}] ${message}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
exports.ListError = ListError;
|
|
34
|
-
|
|
35
|
-
class CachedListVirtualDelegate {
|
|
36
|
-
constructor() {
|
|
37
|
-
this.cache = new WeakMap();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getHeight(element) {
|
|
41
|
-
var _a;
|
|
42
|
-
|
|
43
|
-
return (_a = this.cache.get(element)) !== null && _a !== void 0 ? _a : this.estimateHeight(element);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setDynamicHeight(element, height) {
|
|
47
|
-
if (height > 0) {
|
|
48
|
-
this.cache.set(element, height);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
exports.CachedListVirtualDelegate = CachedListVirtualDelegate;
|