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,397 +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.SelectActionViewItem = exports.ActionViewItem = exports.BaseActionViewItem = void 0;
|
|
11
|
-
|
|
12
|
-
require("../../../../css!./actionbar");
|
|
13
|
-
|
|
14
|
-
const platform = require("../../../common/platform");
|
|
15
|
-
|
|
16
|
-
const nls = require("../../../../nls");
|
|
17
|
-
|
|
18
|
-
const lifecycle_1 = require("../../../common/lifecycle");
|
|
19
|
-
|
|
20
|
-
const selectBox_1 = require("../selectBox/selectBox");
|
|
21
|
-
|
|
22
|
-
const actions_1 = require("../../../common/actions");
|
|
23
|
-
|
|
24
|
-
const types = require("../../../common/types");
|
|
25
|
-
|
|
26
|
-
const touch_1 = require("../../touch");
|
|
27
|
-
|
|
28
|
-
const dnd_1 = require("../../dnd");
|
|
29
|
-
|
|
30
|
-
const browser_1 = require("../../browser");
|
|
31
|
-
|
|
32
|
-
const dom_1 = require("../../dom");
|
|
33
|
-
|
|
34
|
-
class BaseActionViewItem extends lifecycle_1.Disposable {
|
|
35
|
-
constructor(context, action, options = {}) {
|
|
36
|
-
super();
|
|
37
|
-
this.options = options;
|
|
38
|
-
this._context = context || this;
|
|
39
|
-
this._action = action;
|
|
40
|
-
|
|
41
|
-
if (action instanceof actions_1.Action) {
|
|
42
|
-
this._register(action.onDidChange(event => {
|
|
43
|
-
if (!this.element) {
|
|
44
|
-
// we have not been rendered yet, so there
|
|
45
|
-
// is no point in updating the UI
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
this.handleActionChangeEvent(event);
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
handleActionChangeEvent(event) {
|
|
55
|
-
if (event.enabled !== undefined) {
|
|
56
|
-
this.updateEnabled();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (event.checked !== undefined) {
|
|
60
|
-
this.updateChecked();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (event.class !== undefined) {
|
|
64
|
-
this.updateClass();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (event.label !== undefined) {
|
|
68
|
-
this.updateLabel();
|
|
69
|
-
this.updateTooltip();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (event.tooltip !== undefined) {
|
|
73
|
-
this.updateTooltip();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
get actionRunner() {
|
|
78
|
-
if (!this._actionRunner) {
|
|
79
|
-
this._actionRunner = this._register(new actions_1.ActionRunner());
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return this._actionRunner;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
set actionRunner(actionRunner) {
|
|
86
|
-
this._actionRunner = actionRunner;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
getAction() {
|
|
90
|
-
return this._action;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
isEnabled() {
|
|
94
|
-
return this._action.enabled;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
setActionContext(newContext) {
|
|
98
|
-
this._context = newContext;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
render(container) {
|
|
102
|
-
const element = this.element = container;
|
|
103
|
-
|
|
104
|
-
this._register(touch_1.Gesture.addTarget(container));
|
|
105
|
-
|
|
106
|
-
const enableDragging = this.options && this.options.draggable;
|
|
107
|
-
|
|
108
|
-
if (enableDragging) {
|
|
109
|
-
container.draggable = true;
|
|
110
|
-
|
|
111
|
-
if (browser_1.isFirefox) {
|
|
112
|
-
// Firefox: requires to set a text data transfer to get going
|
|
113
|
-
this._register(dom_1.addDisposableListener(container, dom_1.EventType.DRAG_START, e => {
|
|
114
|
-
var _a;
|
|
115
|
-
|
|
116
|
-
return (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.setData(dnd_1.DataTransfers.TEXT, this._action.label);
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
this._register(dom_1.addDisposableListener(element, touch_1.EventType.Tap, e => this.onClick(e)));
|
|
122
|
-
|
|
123
|
-
this._register(dom_1.addDisposableListener(element, dom_1.EventType.MOUSE_DOWN, e => {
|
|
124
|
-
if (!enableDragging) {
|
|
125
|
-
dom_1.EventHelper.stop(e, true); // do not run when dragging is on because that would disable it
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (this._action.enabled && e.button === 0) {
|
|
129
|
-
element.classList.add('active');
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
|
-
|
|
133
|
-
if (platform.isMacintosh) {
|
|
134
|
-
// macOS: allow to trigger the button when holding Ctrl+key and pressing the
|
|
135
|
-
// main mouse button. This is for scenarios where e.g. some interaction forces
|
|
136
|
-
// the Ctrl+key to be pressed and hold but the user still wants to interact
|
|
137
|
-
// with the actions (for example quick access in quick navigation mode).
|
|
138
|
-
this._register(dom_1.addDisposableListener(element, dom_1.EventType.CONTEXT_MENU, e => {
|
|
139
|
-
if (e.button === 0 && e.ctrlKey === true) {
|
|
140
|
-
this.onClick(e);
|
|
141
|
-
}
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
this._register(dom_1.addDisposableListener(element, dom_1.EventType.CLICK, e => {
|
|
146
|
-
dom_1.EventHelper.stop(e, true); // menus do not use the click event
|
|
147
|
-
|
|
148
|
-
if (!(this.options && this.options.isMenu)) {
|
|
149
|
-
platform.setImmediate(() => this.onClick(e));
|
|
150
|
-
}
|
|
151
|
-
}));
|
|
152
|
-
|
|
153
|
-
this._register(dom_1.addDisposableListener(element, dom_1.EventType.DBLCLICK, e => {
|
|
154
|
-
dom_1.EventHelper.stop(e, true);
|
|
155
|
-
}));
|
|
156
|
-
|
|
157
|
-
[dom_1.EventType.MOUSE_UP, dom_1.EventType.MOUSE_OUT].forEach(event => {
|
|
158
|
-
this._register(dom_1.addDisposableListener(element, event, e => {
|
|
159
|
-
dom_1.EventHelper.stop(e);
|
|
160
|
-
element.classList.remove('active');
|
|
161
|
-
}));
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
onClick(event) {
|
|
166
|
-
var _a;
|
|
167
|
-
|
|
168
|
-
dom_1.EventHelper.stop(event, true);
|
|
169
|
-
const context = types.isUndefinedOrNull(this._context) ? ((_a = this.options) === null || _a === void 0 ? void 0 : _a.useEventAsContext) ? event : undefined : this._context;
|
|
170
|
-
this.actionRunner.run(this._action, context);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
focus() {
|
|
174
|
-
if (this.element) {
|
|
175
|
-
this.element.focus();
|
|
176
|
-
this.element.classList.add('focused');
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
blur() {
|
|
181
|
-
if (this.element) {
|
|
182
|
-
this.element.blur();
|
|
183
|
-
this.element.classList.remove('focused');
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
updateEnabled() {// implement in subclass
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
updateLabel() {// implement in subclass
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
updateTooltip() {// implement in subclass
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
updateClass() {// implement in subclass
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
updateChecked() {// implement in subclass
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
dispose() {
|
|
203
|
-
if (this.element) {
|
|
204
|
-
this.element.remove();
|
|
205
|
-
this.element = undefined;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
super.dispose();
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
exports.BaseActionViewItem = BaseActionViewItem;
|
|
214
|
-
|
|
215
|
-
class ActionViewItem extends BaseActionViewItem {
|
|
216
|
-
constructor(context, action, options = {}) {
|
|
217
|
-
super(context, action, options);
|
|
218
|
-
this.options = options;
|
|
219
|
-
this.options.icon = options.icon !== undefined ? options.icon : false;
|
|
220
|
-
this.options.label = options.label !== undefined ? options.label : true;
|
|
221
|
-
this.cssClass = '';
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
render(container) {
|
|
225
|
-
super.render(container);
|
|
226
|
-
|
|
227
|
-
if (this.element) {
|
|
228
|
-
this.label = dom_1.append(this.element, dom_1.$('a.action-label'));
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (this.label) {
|
|
232
|
-
if (this._action.id === actions_1.Separator.ID) {
|
|
233
|
-
this.label.setAttribute('role', 'presentation'); // A separator is a presentation item
|
|
234
|
-
} else {
|
|
235
|
-
if (this.options.isMenu) {
|
|
236
|
-
this.label.setAttribute('role', 'menuitem');
|
|
237
|
-
} else {
|
|
238
|
-
this.label.setAttribute('role', 'button');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (this.options.label && this.options.keybinding && this.element) {
|
|
244
|
-
dom_1.append(this.element, dom_1.$('span.keybinding')).textContent = this.options.keybinding;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
this.updateClass();
|
|
248
|
-
this.updateLabel();
|
|
249
|
-
this.updateTooltip();
|
|
250
|
-
this.updateEnabled();
|
|
251
|
-
this.updateChecked();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
focus() {
|
|
255
|
-
super.focus();
|
|
256
|
-
|
|
257
|
-
if (this.label) {
|
|
258
|
-
this.label.focus();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
updateLabel() {
|
|
263
|
-
if (this.options.label && this.label) {
|
|
264
|
-
this.label.textContent = this.getAction().label;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
updateTooltip() {
|
|
269
|
-
let title = null;
|
|
270
|
-
|
|
271
|
-
if (this.getAction().tooltip) {
|
|
272
|
-
title = this.getAction().tooltip;
|
|
273
|
-
} else if (!this.options.label && this.getAction().label && this.options.icon) {
|
|
274
|
-
title = this.getAction().label;
|
|
275
|
-
|
|
276
|
-
if (this.options.keybinding) {
|
|
277
|
-
title = nls.localize({
|
|
278
|
-
key: 'titleLabel',
|
|
279
|
-
comment: ['action title', 'action keybinding']
|
|
280
|
-
}, "{0} ({1})", title, this.options.keybinding);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (title && this.label) {
|
|
285
|
-
this.label.title = title;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
updateClass() {
|
|
290
|
-
if (this.cssClass && this.label) {
|
|
291
|
-
this.label.classList.remove(...this.cssClass.split(' '));
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (this.options.icon) {
|
|
295
|
-
this.cssClass = this.getAction().class;
|
|
296
|
-
|
|
297
|
-
if (this.label) {
|
|
298
|
-
this.label.classList.add('codicon');
|
|
299
|
-
|
|
300
|
-
if (this.cssClass) {
|
|
301
|
-
this.label.classList.add(...this.cssClass.split(' '));
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
this.updateEnabled();
|
|
306
|
-
} else {
|
|
307
|
-
if (this.label) {
|
|
308
|
-
this.label.classList.remove('codicon');
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
updateEnabled() {
|
|
314
|
-
if (this.getAction().enabled) {
|
|
315
|
-
if (this.label) {
|
|
316
|
-
this.label.removeAttribute('aria-disabled');
|
|
317
|
-
this.label.classList.remove('disabled');
|
|
318
|
-
this.label.tabIndex = 0;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (this.element) {
|
|
322
|
-
this.element.classList.remove('disabled');
|
|
323
|
-
}
|
|
324
|
-
} else {
|
|
325
|
-
if (this.label) {
|
|
326
|
-
this.label.setAttribute('aria-disabled', 'true');
|
|
327
|
-
this.label.classList.add('disabled');
|
|
328
|
-
dom_1.removeTabIndexAndUpdateFocus(this.label);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (this.element) {
|
|
332
|
-
this.element.classList.add('disabled');
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
updateChecked() {
|
|
338
|
-
if (this.label) {
|
|
339
|
-
if (this.getAction().checked) {
|
|
340
|
-
this.label.classList.add('checked');
|
|
341
|
-
} else {
|
|
342
|
-
this.label.classList.remove('checked');
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
exports.ActionViewItem = ActionViewItem;
|
|
350
|
-
|
|
351
|
-
class SelectActionViewItem extends BaseActionViewItem {
|
|
352
|
-
constructor(ctx, action, options, selected, contextViewProvider, selectBoxOptions) {
|
|
353
|
-
super(ctx, action);
|
|
354
|
-
this.selectBox = new selectBox_1.SelectBox(options, selected, contextViewProvider, undefined, selectBoxOptions);
|
|
355
|
-
|
|
356
|
-
this._register(this.selectBox);
|
|
357
|
-
|
|
358
|
-
this.registerListeners();
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
setOptions(options, selected) {
|
|
362
|
-
this.selectBox.setOptions(options, selected);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
select(index) {
|
|
366
|
-
this.selectBox.select(index);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
registerListeners() {
|
|
370
|
-
this._register(this.selectBox.onDidSelect(e => {
|
|
371
|
-
this.actionRunner.run(this._action, this.getActionContext(e.selected, e.index));
|
|
372
|
-
}));
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
getActionContext(option, index) {
|
|
376
|
-
return option;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
focus() {
|
|
380
|
-
if (this.selectBox) {
|
|
381
|
-
this.selectBox.focus();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
blur() {
|
|
386
|
-
if (this.selectBox) {
|
|
387
|
-
this.selectBox.blur();
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
render(container) {
|
|
392
|
-
this.selectBox.render(container);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
exports.SelectActionViewItem = SelectActionViewItem;
|