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.SmoothScrollingOperation = exports.SmoothScrollingUpdate = exports.Scrollable = exports.ScrollState = void 0;
|
|
11
|
-
|
|
12
|
-
const event_1 = require("./event");
|
|
13
|
-
|
|
14
|
-
const lifecycle_1 = require("./lifecycle");
|
|
15
|
-
|
|
16
|
-
class ScrollState {
|
|
17
|
-
constructor(width, scrollWidth, scrollLeft, height, scrollHeight, scrollTop) {
|
|
18
|
-
width = width | 0;
|
|
19
|
-
scrollWidth = scrollWidth | 0;
|
|
20
|
-
scrollLeft = scrollLeft | 0;
|
|
21
|
-
height = height | 0;
|
|
22
|
-
scrollHeight = scrollHeight | 0;
|
|
23
|
-
scrollTop = scrollTop | 0;
|
|
24
|
-
this.rawScrollLeft = scrollLeft; // before validation
|
|
25
|
-
|
|
26
|
-
this.rawScrollTop = scrollTop; // before validation
|
|
27
|
-
|
|
28
|
-
if (width < 0) {
|
|
29
|
-
width = 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (scrollLeft + width > scrollWidth) {
|
|
33
|
-
scrollLeft = scrollWidth - width;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (scrollLeft < 0) {
|
|
37
|
-
scrollLeft = 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (height < 0) {
|
|
41
|
-
height = 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (scrollTop + height > scrollHeight) {
|
|
45
|
-
scrollTop = scrollHeight - height;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (scrollTop < 0) {
|
|
49
|
-
scrollTop = 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.width = width;
|
|
53
|
-
this.scrollWidth = scrollWidth;
|
|
54
|
-
this.scrollLeft = scrollLeft;
|
|
55
|
-
this.height = height;
|
|
56
|
-
this.scrollHeight = scrollHeight;
|
|
57
|
-
this.scrollTop = scrollTop;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
equals(other) {
|
|
61
|
-
return this.rawScrollLeft === other.rawScrollLeft && this.rawScrollTop === other.rawScrollTop && this.width === other.width && this.scrollWidth === other.scrollWidth && this.scrollLeft === other.scrollLeft && this.height === other.height && this.scrollHeight === other.scrollHeight && this.scrollTop === other.scrollTop;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
withScrollDimensions(update, useRawScrollPositions) {
|
|
65
|
-
return new ScrollState(typeof update.width !== 'undefined' ? update.width : this.width, typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth, useRawScrollPositions ? this.rawScrollLeft : this.scrollLeft, typeof update.height !== 'undefined' ? update.height : this.height, typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight, useRawScrollPositions ? this.rawScrollTop : this.scrollTop);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
withScrollPosition(update) {
|
|
69
|
-
return new ScrollState(this.width, this.scrollWidth, typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft, this.height, this.scrollHeight, typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
createScrollEvent(previous) {
|
|
73
|
-
const widthChanged = this.width !== previous.width;
|
|
74
|
-
const scrollWidthChanged = this.scrollWidth !== previous.scrollWidth;
|
|
75
|
-
const scrollLeftChanged = this.scrollLeft !== previous.scrollLeft;
|
|
76
|
-
const heightChanged = this.height !== previous.height;
|
|
77
|
-
const scrollHeightChanged = this.scrollHeight !== previous.scrollHeight;
|
|
78
|
-
const scrollTopChanged = this.scrollTop !== previous.scrollTop;
|
|
79
|
-
return {
|
|
80
|
-
oldWidth: previous.width,
|
|
81
|
-
oldScrollWidth: previous.scrollWidth,
|
|
82
|
-
oldScrollLeft: previous.scrollLeft,
|
|
83
|
-
width: this.width,
|
|
84
|
-
scrollWidth: this.scrollWidth,
|
|
85
|
-
scrollLeft: this.scrollLeft,
|
|
86
|
-
oldHeight: previous.height,
|
|
87
|
-
oldScrollHeight: previous.scrollHeight,
|
|
88
|
-
oldScrollTop: previous.scrollTop,
|
|
89
|
-
height: this.height,
|
|
90
|
-
scrollHeight: this.scrollHeight,
|
|
91
|
-
scrollTop: this.scrollTop,
|
|
92
|
-
widthChanged: widthChanged,
|
|
93
|
-
scrollWidthChanged: scrollWidthChanged,
|
|
94
|
-
scrollLeftChanged: scrollLeftChanged,
|
|
95
|
-
heightChanged: heightChanged,
|
|
96
|
-
scrollHeightChanged: scrollHeightChanged,
|
|
97
|
-
scrollTopChanged: scrollTopChanged
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
exports.ScrollState = ScrollState;
|
|
104
|
-
|
|
105
|
-
class Scrollable extends lifecycle_1.Disposable {
|
|
106
|
-
constructor(smoothScrollDuration, scheduleAtNextAnimationFrame) {
|
|
107
|
-
super();
|
|
108
|
-
this._onScroll = this._register(new event_1.Emitter());
|
|
109
|
-
this.onScroll = this._onScroll.event;
|
|
110
|
-
this._smoothScrollDuration = smoothScrollDuration;
|
|
111
|
-
this._scheduleAtNextAnimationFrame = scheduleAtNextAnimationFrame;
|
|
112
|
-
this._state = new ScrollState(0, 0, 0, 0, 0, 0);
|
|
113
|
-
this._smoothScrolling = null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
dispose() {
|
|
117
|
-
if (this._smoothScrolling) {
|
|
118
|
-
this._smoothScrolling.dispose();
|
|
119
|
-
|
|
120
|
-
this._smoothScrolling = null;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
super.dispose();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
setSmoothScrollDuration(smoothScrollDuration) {
|
|
127
|
-
this._smoothScrollDuration = smoothScrollDuration;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
validateScrollPosition(scrollPosition) {
|
|
131
|
-
return this._state.withScrollPosition(scrollPosition);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
getScrollDimensions() {
|
|
135
|
-
return this._state;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
setScrollDimensions(dimensions, useRawScrollPositions) {
|
|
139
|
-
const newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);
|
|
140
|
-
|
|
141
|
-
this._setState(newState); // Validate outstanding animated scroll position target
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (this._smoothScrolling) {
|
|
145
|
-
this._smoothScrolling.acceptScrollDimensions(this._state);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Returns the final scroll position that the instance will have once the smooth scroll animation concludes.
|
|
150
|
-
* If no scroll animation is occurring, it will return the current scroll position instead.
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
getFutureScrollPosition() {
|
|
155
|
-
if (this._smoothScrolling) {
|
|
156
|
-
return this._smoothScrolling.to;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return this._state;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Returns the current scroll position.
|
|
163
|
-
* Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
getCurrentScrollPosition() {
|
|
168
|
-
return this._state;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
setScrollPositionNow(update) {
|
|
172
|
-
// no smooth scrolling requested
|
|
173
|
-
const newState = this._state.withScrollPosition(update); // Terminate any outstanding smooth scrolling
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (this._smoothScrolling) {
|
|
177
|
-
this._smoothScrolling.dispose();
|
|
178
|
-
|
|
179
|
-
this._smoothScrolling = null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
this._setState(newState);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
setScrollPositionSmooth(update) {
|
|
186
|
-
if (this._smoothScrollDuration === 0) {
|
|
187
|
-
// Smooth scrolling not supported.
|
|
188
|
-
return this.setScrollPositionNow(update);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (this._smoothScrolling) {
|
|
192
|
-
// Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop
|
|
193
|
-
update = {
|
|
194
|
-
scrollLeft: typeof update.scrollLeft === 'undefined' ? this._smoothScrolling.to.scrollLeft : update.scrollLeft,
|
|
195
|
-
scrollTop: typeof update.scrollTop === 'undefined' ? this._smoothScrolling.to.scrollTop : update.scrollTop
|
|
196
|
-
}; // Validate `update`
|
|
197
|
-
|
|
198
|
-
const validTarget = this._state.withScrollPosition(update);
|
|
199
|
-
|
|
200
|
-
if (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) {
|
|
201
|
-
// No need to interrupt or extend the current animation since we're going to the same place
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const newSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration);
|
|
206
|
-
|
|
207
|
-
this._smoothScrolling.dispose();
|
|
208
|
-
|
|
209
|
-
this._smoothScrolling = newSmoothScrolling;
|
|
210
|
-
} else {
|
|
211
|
-
// Validate `update`
|
|
212
|
-
const validTarget = this._state.withScrollPosition(update);
|
|
213
|
-
|
|
214
|
-
this._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration);
|
|
215
|
-
} // Begin smooth scrolling animation
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
|
|
219
|
-
if (!this._smoothScrolling) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
this._smoothScrolling.animationFrameDisposable = null;
|
|
224
|
-
|
|
225
|
-
this._performSmoothScrolling();
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
_performSmoothScrolling() {
|
|
230
|
-
if (!this._smoothScrolling) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
const update = this._smoothScrolling.tick();
|
|
235
|
-
|
|
236
|
-
const newState = this._state.withScrollPosition(update);
|
|
237
|
-
|
|
238
|
-
this._setState(newState);
|
|
239
|
-
|
|
240
|
-
if (!this._smoothScrolling) {
|
|
241
|
-
// Looks like someone canceled the smooth scrolling
|
|
242
|
-
// from the scroll event handler
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (update.isDone) {
|
|
247
|
-
this._smoothScrolling.dispose();
|
|
248
|
-
|
|
249
|
-
this._smoothScrolling = null;
|
|
250
|
-
return;
|
|
251
|
-
} // Continue smooth scrolling animation
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
|
|
255
|
-
if (!this._smoothScrolling) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
this._smoothScrolling.animationFrameDisposable = null;
|
|
260
|
-
|
|
261
|
-
this._performSmoothScrolling();
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
_setState(newState) {
|
|
266
|
-
const oldState = this._state;
|
|
267
|
-
|
|
268
|
-
if (oldState.equals(newState)) {
|
|
269
|
-
// no change
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
this._state = newState;
|
|
274
|
-
|
|
275
|
-
this._onScroll.fire(this._state.createScrollEvent(oldState));
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
exports.Scrollable = Scrollable;
|
|
281
|
-
|
|
282
|
-
class SmoothScrollingUpdate {
|
|
283
|
-
constructor(scrollLeft, scrollTop, isDone) {
|
|
284
|
-
this.scrollLeft = scrollLeft;
|
|
285
|
-
this.scrollTop = scrollTop;
|
|
286
|
-
this.isDone = isDone;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
exports.SmoothScrollingUpdate = SmoothScrollingUpdate;
|
|
292
|
-
|
|
293
|
-
function createEaseOutCubic(from, to) {
|
|
294
|
-
const delta = to - from;
|
|
295
|
-
return function (completion) {
|
|
296
|
-
return from + delta * easeOutCubic(completion);
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function createComposed(a, b, cut) {
|
|
301
|
-
return function (completion) {
|
|
302
|
-
if (completion < cut) {
|
|
303
|
-
return a(completion / cut);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return b((completion - cut) / (1 - cut));
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
class SmoothScrollingOperation {
|
|
311
|
-
constructor(from, to, startTime, duration) {
|
|
312
|
-
this.from = from;
|
|
313
|
-
this.to = to;
|
|
314
|
-
this.duration = duration;
|
|
315
|
-
this._startTime = startTime;
|
|
316
|
-
this.animationFrameDisposable = null;
|
|
317
|
-
|
|
318
|
-
this._initAnimations();
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
_initAnimations() {
|
|
322
|
-
this.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);
|
|
323
|
-
this.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
_initAnimation(from, to, viewportSize) {
|
|
327
|
-
const delta = Math.abs(from - to);
|
|
328
|
-
|
|
329
|
-
if (delta > 2.5 * viewportSize) {
|
|
330
|
-
let stop1, stop2;
|
|
331
|
-
|
|
332
|
-
if (from < to) {
|
|
333
|
-
// scroll to 75% of the viewportSize
|
|
334
|
-
stop1 = from + 0.75 * viewportSize;
|
|
335
|
-
stop2 = to - 0.75 * viewportSize;
|
|
336
|
-
} else {
|
|
337
|
-
stop1 = from - 0.75 * viewportSize;
|
|
338
|
-
stop2 = to + 0.75 * viewportSize;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
return createEaseOutCubic(from, to);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
dispose() {
|
|
348
|
-
if (this.animationFrameDisposable !== null) {
|
|
349
|
-
this.animationFrameDisposable.dispose();
|
|
350
|
-
this.animationFrameDisposable = null;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
acceptScrollDimensions(state) {
|
|
355
|
-
this.to = state.withScrollPosition(this.to);
|
|
356
|
-
|
|
357
|
-
this._initAnimations();
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
tick() {
|
|
361
|
-
return this._tick(Date.now());
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
_tick(now) {
|
|
365
|
-
const completion = (now - this._startTime) / this.duration;
|
|
366
|
-
|
|
367
|
-
if (completion < 1) {
|
|
368
|
-
const newScrollLeft = this.scrollLeft(completion);
|
|
369
|
-
const newScrollTop = this.scrollTop(completion);
|
|
370
|
-
return new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
return new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
combine(from, to, duration) {
|
|
377
|
-
return SmoothScrollingOperation.start(from, to, duration);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
static start(from, to, duration) {
|
|
381
|
-
// +10 / -10 : pretend the animation already started for a quicker response to a scroll request
|
|
382
|
-
duration = duration + 10;
|
|
383
|
-
const startTime = Date.now() - 10;
|
|
384
|
-
return new SmoothScrollingOperation(from, to, startTime, duration);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
exports.SmoothScrollingOperation = SmoothScrollingOperation;
|
|
390
|
-
|
|
391
|
-
function easeInCubic(t) {
|
|
392
|
-
return Math.pow(t, 3);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
function easeOutCubic(t) {
|
|
396
|
-
return 1 - easeInCubic(1 - t);
|
|
397
|
-
}
|
|
@@ -1,55 +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.buildReplaceStringWithCasePreserved = void 0;
|
|
11
|
-
|
|
12
|
-
const strings = require("./strings");
|
|
13
|
-
|
|
14
|
-
function buildReplaceStringWithCasePreserved(matches, pattern) {
|
|
15
|
-
if (matches && matches[0] !== '') {
|
|
16
|
-
const containsHyphens = validateSpecificSpecialCharacter(matches, pattern, '-');
|
|
17
|
-
const containsUnderscores = validateSpecificSpecialCharacter(matches, pattern, '_');
|
|
18
|
-
|
|
19
|
-
if (containsHyphens && !containsUnderscores) {
|
|
20
|
-
return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '-');
|
|
21
|
-
} else if (!containsHyphens && containsUnderscores) {
|
|
22
|
-
return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '_');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (matches[0].toUpperCase() === matches[0]) {
|
|
26
|
-
return pattern.toUpperCase();
|
|
27
|
-
} else if (matches[0].toLowerCase() === matches[0]) {
|
|
28
|
-
return pattern.toLowerCase();
|
|
29
|
-
} else if (strings.containsUppercaseCharacter(matches[0][0]) && pattern.length > 0) {
|
|
30
|
-
return pattern[0].toUpperCase() + pattern.substr(1);
|
|
31
|
-
} else {
|
|
32
|
-
// we don't understand its pattern yet.
|
|
33
|
-
return pattern;
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
return pattern;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
exports.buildReplaceStringWithCasePreserved = buildReplaceStringWithCasePreserved;
|
|
41
|
-
|
|
42
|
-
function validateSpecificSpecialCharacter(matches, pattern, specialCharacter) {
|
|
43
|
-
const doesContainSpecialCharacter = matches[0].indexOf(specialCharacter) !== -1 && pattern.indexOf(specialCharacter) !== -1;
|
|
44
|
-
return doesContainSpecialCharacter && matches[0].split(specialCharacter).length === pattern.split(specialCharacter).length;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function buildReplaceStringForSpecificSpecialCharacter(matches, pattern, specialCharacter) {
|
|
48
|
-
const splitPatternAtSpecialCharacter = pattern.split(specialCharacter);
|
|
49
|
-
const splitMatchAtSpecialCharacter = matches[0].split(specialCharacter);
|
|
50
|
-
let replaceString = '';
|
|
51
|
-
splitPatternAtSpecialCharacter.forEach((splitValue, index) => {
|
|
52
|
-
replaceString += buildReplaceStringWithCasePreserved([splitMatchAtSpecialCharacter[index]], splitValue) + specialCharacter;
|
|
53
|
-
});
|
|
54
|
-
return replaceString.slice(0, -1);
|
|
55
|
-
}
|
|
@@ -1,64 +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.SimpleSequence = exports.Sequence = void 0;
|
|
11
|
-
|
|
12
|
-
const event_1 = require("./event");
|
|
13
|
-
|
|
14
|
-
class Sequence {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.elements = [];
|
|
17
|
-
this._onDidSplice = new event_1.Emitter();
|
|
18
|
-
this.onDidSplice = this._onDidSplice.event;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
splice(start, deleteCount, toInsert = []) {
|
|
22
|
-
this.elements.splice(start, deleteCount, ...toInsert);
|
|
23
|
-
|
|
24
|
-
this._onDidSplice.fire({
|
|
25
|
-
start,
|
|
26
|
-
deleteCount,
|
|
27
|
-
toInsert
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
exports.Sequence = Sequence;
|
|
34
|
-
|
|
35
|
-
class SimpleSequence {
|
|
36
|
-
constructor(elements, onDidAdd, onDidRemove) {
|
|
37
|
-
this._elements = [...elements];
|
|
38
|
-
this.onDidSplice = event_1.Event.any(event_1.Event.map(onDidAdd, e => ({
|
|
39
|
-
start: this.elements.length,
|
|
40
|
-
deleteCount: 0,
|
|
41
|
-
toInsert: [e]
|
|
42
|
-
})), event_1.Event.map(event_1.Event.filter(event_1.Event.map(onDidRemove, e => this.elements.indexOf(e)), i => i > -1), i => ({
|
|
43
|
-
start: i,
|
|
44
|
-
deleteCount: 1,
|
|
45
|
-
toInsert: []
|
|
46
|
-
})));
|
|
47
|
-
this.disposable = this.onDidSplice(({
|
|
48
|
-
start,
|
|
49
|
-
deleteCount,
|
|
50
|
-
toInsert
|
|
51
|
-
}) => this._elements.splice(start, deleteCount, ...toInsert));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
get elements() {
|
|
55
|
-
return this._elements;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
dispose() {
|
|
59
|
-
this.disposable.dispose();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
exports.SimpleSequence = SimpleSequence;
|
|
@@ -1,55 +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
|
-
|
|
11
|
-
const strings = require("./strings");
|
|
12
|
-
|
|
13
|
-
var Severity;
|
|
14
|
-
|
|
15
|
-
(function (Severity) {
|
|
16
|
-
Severity[Severity["Ignore"] = 0] = "Ignore";
|
|
17
|
-
Severity[Severity["Info"] = 1] = "Info";
|
|
18
|
-
Severity[Severity["Warning"] = 2] = "Warning";
|
|
19
|
-
Severity[Severity["Error"] = 3] = "Error";
|
|
20
|
-
})(Severity || (Severity = {}));
|
|
21
|
-
|
|
22
|
-
(function (Severity) {
|
|
23
|
-
const _error = 'error';
|
|
24
|
-
const _warning = 'warning';
|
|
25
|
-
const _warn = 'warn';
|
|
26
|
-
const _info = 'info';
|
|
27
|
-
/**
|
|
28
|
-
* Parses 'error', 'warning', 'warn', 'info' in call casings
|
|
29
|
-
* and falls back to ignore.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
function fromValue(value) {
|
|
33
|
-
if (!value) {
|
|
34
|
-
return Severity.Ignore;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (strings.equalsIgnoreCase(_error, value)) {
|
|
38
|
-
return Severity.Error;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (strings.equalsIgnoreCase(_warning, value) || strings.equalsIgnoreCase(_warn, value)) {
|
|
42
|
-
return Severity.Warning;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (strings.equalsIgnoreCase(_info, value)) {
|
|
46
|
-
return Severity.Info;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return Severity.Ignore;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
Severity.fromValue = fromValue;
|
|
53
|
-
})(Severity || (Severity = {}));
|
|
54
|
-
|
|
55
|
-
exports.default = Severity;
|