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,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.MovingAverage = exports.Counter = exports.rot = exports.clamp = void 0;
|
|
11
|
-
|
|
12
|
-
function clamp(value, min, max) {
|
|
13
|
-
return Math.min(Math.max(value, min), max);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
exports.clamp = clamp;
|
|
17
|
-
|
|
18
|
-
function rot(index, modulo) {
|
|
19
|
-
return (modulo + index % modulo) % modulo;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.rot = rot;
|
|
23
|
-
|
|
24
|
-
class Counter {
|
|
25
|
-
constructor() {
|
|
26
|
-
this._next = 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getNext() {
|
|
30
|
-
return this._next++;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
exports.Counter = Counter;
|
|
36
|
-
|
|
37
|
-
class MovingAverage {
|
|
38
|
-
constructor() {
|
|
39
|
-
this._n = 1;
|
|
40
|
-
this._val = 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
update(value) {
|
|
44
|
-
this._val = this._val + (value - this._val) / this._n;
|
|
45
|
-
this._n += 1;
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get value() {
|
|
50
|
-
return this._val;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
exports.MovingAverage = MovingAverage;
|
|
@@ -1,268 +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.distinct = exports.getOrDefault = exports.safeStringify = exports.equals = exports.mixin = exports.cloneAndChange = exports.deepFreeze = exports.deepClone = void 0;
|
|
11
|
-
|
|
12
|
-
const types_1 = require("./types");
|
|
13
|
-
|
|
14
|
-
function deepClone(obj) {
|
|
15
|
-
if (!obj || typeof obj !== 'object') {
|
|
16
|
-
return obj;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (obj instanceof RegExp) {
|
|
20
|
-
// See https://github.com/microsoft/TypeScript/issues/10990
|
|
21
|
-
return obj;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const result = Array.isArray(obj) ? [] : {};
|
|
25
|
-
Object.keys(obj).forEach(key => {
|
|
26
|
-
if (obj[key] && typeof obj[key] === 'object') {
|
|
27
|
-
result[key] = deepClone(obj[key]);
|
|
28
|
-
} else {
|
|
29
|
-
result[key] = obj[key];
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
exports.deepClone = deepClone;
|
|
36
|
-
|
|
37
|
-
function deepFreeze(obj) {
|
|
38
|
-
if (!obj || typeof obj !== 'object') {
|
|
39
|
-
return obj;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const stack = [obj];
|
|
43
|
-
|
|
44
|
-
while (stack.length > 0) {
|
|
45
|
-
const obj = stack.shift();
|
|
46
|
-
Object.freeze(obj);
|
|
47
|
-
|
|
48
|
-
for (const key in obj) {
|
|
49
|
-
if (_hasOwnProperty.call(obj, key)) {
|
|
50
|
-
const prop = obj[key];
|
|
51
|
-
|
|
52
|
-
if (typeof prop === 'object' && !Object.isFrozen(prop)) {
|
|
53
|
-
stack.push(prop);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return obj;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
exports.deepFreeze = deepFreeze;
|
|
63
|
-
const _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
64
|
-
|
|
65
|
-
function cloneAndChange(obj, changer) {
|
|
66
|
-
return _cloneAndChange(obj, changer, new Set());
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
exports.cloneAndChange = cloneAndChange;
|
|
70
|
-
|
|
71
|
-
function _cloneAndChange(obj, changer, seen) {
|
|
72
|
-
if (types_1.isUndefinedOrNull(obj)) {
|
|
73
|
-
return obj;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const changed = changer(obj);
|
|
77
|
-
|
|
78
|
-
if (typeof changed !== 'undefined') {
|
|
79
|
-
return changed;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (types_1.isArray(obj)) {
|
|
83
|
-
const r1 = [];
|
|
84
|
-
|
|
85
|
-
for (const e of obj) {
|
|
86
|
-
r1.push(_cloneAndChange(e, changer, seen));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return r1;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (types_1.isObject(obj)) {
|
|
93
|
-
if (seen.has(obj)) {
|
|
94
|
-
throw new Error('Cannot clone recursive data-structure');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
seen.add(obj);
|
|
98
|
-
const r2 = {};
|
|
99
|
-
|
|
100
|
-
for (let i2 in obj) {
|
|
101
|
-
if (_hasOwnProperty.call(obj, i2)) {
|
|
102
|
-
r2[i2] = _cloneAndChange(obj[i2], changer, seen);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
seen.delete(obj);
|
|
107
|
-
return r2;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return obj;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Copies all properties of source into destination. The optional parameter "overwrite" allows to control
|
|
114
|
-
* if existing properties on the destination should be overwritten or not. Defaults to true (overwrite).
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
function mixin(destination, source, overwrite = true) {
|
|
119
|
-
if (!types_1.isObject(destination)) {
|
|
120
|
-
return source;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (types_1.isObject(source)) {
|
|
124
|
-
Object.keys(source).forEach(key => {
|
|
125
|
-
if (key in destination) {
|
|
126
|
-
if (overwrite) {
|
|
127
|
-
if (types_1.isObject(destination[key]) && types_1.isObject(source[key])) {
|
|
128
|
-
mixin(destination[key], source[key], overwrite);
|
|
129
|
-
} else {
|
|
130
|
-
destination[key] = source[key];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
destination[key] = source[key];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return destination;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
exports.mixin = mixin;
|
|
143
|
-
|
|
144
|
-
function equals(one, other) {
|
|
145
|
-
if (one === other) {
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (one === null || one === undefined || other === null || other === undefined) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (typeof one !== typeof other) {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (typeof one !== 'object') {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (Array.isArray(one) !== Array.isArray(other)) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
let i;
|
|
166
|
-
let key;
|
|
167
|
-
|
|
168
|
-
if (Array.isArray(one)) {
|
|
169
|
-
if (one.length !== other.length) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
for (i = 0; i < one.length; i++) {
|
|
174
|
-
if (!equals(one[i], other[i])) {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
} else {
|
|
179
|
-
const oneKeys = [];
|
|
180
|
-
|
|
181
|
-
for (key in one) {
|
|
182
|
-
oneKeys.push(key);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
oneKeys.sort();
|
|
186
|
-
const otherKeys = [];
|
|
187
|
-
|
|
188
|
-
for (key in other) {
|
|
189
|
-
otherKeys.push(key);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
otherKeys.sort();
|
|
193
|
-
|
|
194
|
-
if (!equals(oneKeys, otherKeys)) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
for (i = 0; i < oneKeys.length; i++) {
|
|
199
|
-
if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
exports.equals = equals;
|
|
209
|
-
/**
|
|
210
|
-
* Calls `JSON.Stringify` with a replacer to break apart any circular references.
|
|
211
|
-
* This prevents `JSON`.stringify` from throwing the exception
|
|
212
|
-
* "Uncaught TypeError: Converting circular structure to JSON"
|
|
213
|
-
*/
|
|
214
|
-
|
|
215
|
-
function safeStringify(obj) {
|
|
216
|
-
const seen = new Set();
|
|
217
|
-
return JSON.stringify(obj, (key, value) => {
|
|
218
|
-
if (types_1.isObject(value) || Array.isArray(value)) {
|
|
219
|
-
if (seen.has(value)) {
|
|
220
|
-
return '[Circular]';
|
|
221
|
-
} else {
|
|
222
|
-
seen.add(value);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return value;
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
exports.safeStringify = safeStringify;
|
|
231
|
-
|
|
232
|
-
function getOrDefault(obj, fn, defaultValue) {
|
|
233
|
-
const result = fn(obj);
|
|
234
|
-
return typeof result === 'undefined' ? defaultValue : result;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
exports.getOrDefault = getOrDefault;
|
|
238
|
-
/**
|
|
239
|
-
* Returns an object that has keys for each value that is different in the base object. Keys
|
|
240
|
-
* that do not exist in the target but in the base object are not considered.
|
|
241
|
-
*
|
|
242
|
-
* Note: This is not a deep-diffing method, so the values are strictly taken into the resulting
|
|
243
|
-
* object if they differ.
|
|
244
|
-
*
|
|
245
|
-
* @param base the object to diff against
|
|
246
|
-
* @param obj the object to use for diffing
|
|
247
|
-
*/
|
|
248
|
-
|
|
249
|
-
function distinct(base, target) {
|
|
250
|
-
const result = Object.create(null);
|
|
251
|
-
|
|
252
|
-
if (!base || !target) {
|
|
253
|
-
return result;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const targetKeys = Object.keys(target);
|
|
257
|
-
targetKeys.forEach(k => {
|
|
258
|
-
const baseValue = base[k];
|
|
259
|
-
const targetValue = target[k];
|
|
260
|
-
|
|
261
|
-
if (!equals(baseValue, targetValue)) {
|
|
262
|
-
result[k] = targetValue;
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
return result;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
exports.distinct = distinct;
|
|
@@ -1,190 +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.mergePagers = exports.mapPager = exports.DelayedPagedModel = exports.PagedModel = exports.singlePagePager = void 0;
|
|
11
|
-
|
|
12
|
-
const types_1 = require("./types");
|
|
13
|
-
|
|
14
|
-
const cancellation_1 = require("./cancellation");
|
|
15
|
-
|
|
16
|
-
const errors_1 = require("./errors");
|
|
17
|
-
|
|
18
|
-
const arrays_1 = require("./arrays");
|
|
19
|
-
|
|
20
|
-
function createPage(elements) {
|
|
21
|
-
return {
|
|
22
|
-
isResolved: !!elements,
|
|
23
|
-
promise: null,
|
|
24
|
-
cts: null,
|
|
25
|
-
promiseIndexes: new Set(),
|
|
26
|
-
elements: elements || []
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function singlePagePager(elements) {
|
|
31
|
-
return {
|
|
32
|
-
firstPage: elements,
|
|
33
|
-
total: elements.length,
|
|
34
|
-
pageSize: elements.length,
|
|
35
|
-
getPage: (pageIndex, cancellationToken) => {
|
|
36
|
-
return Promise.resolve(elements);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
exports.singlePagePager = singlePagePager;
|
|
42
|
-
|
|
43
|
-
class PagedModel {
|
|
44
|
-
constructor(arg) {
|
|
45
|
-
this.pages = [];
|
|
46
|
-
this.pager = types_1.isArray(arg) ? singlePagePager(arg) : arg;
|
|
47
|
-
const totalPages = Math.ceil(this.pager.total / this.pager.pageSize);
|
|
48
|
-
this.pages = [createPage(this.pager.firstPage.slice()), ...arrays_1.range(totalPages - 1).map(() => createPage())];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get length() {
|
|
52
|
-
return this.pager.total;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
isResolved(index) {
|
|
56
|
-
const pageIndex = Math.floor(index / this.pager.pageSize);
|
|
57
|
-
const page = this.pages[pageIndex];
|
|
58
|
-
return !!page.isResolved;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get(index) {
|
|
62
|
-
const pageIndex = Math.floor(index / this.pager.pageSize);
|
|
63
|
-
const indexInPage = index % this.pager.pageSize;
|
|
64
|
-
const page = this.pages[pageIndex];
|
|
65
|
-
return page.elements[indexInPage];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
resolve(index, cancellationToken) {
|
|
69
|
-
if (cancellationToken.isCancellationRequested) {
|
|
70
|
-
return Promise.reject(errors_1.canceled());
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const pageIndex = Math.floor(index / this.pager.pageSize);
|
|
74
|
-
const indexInPage = index % this.pager.pageSize;
|
|
75
|
-
const page = this.pages[pageIndex];
|
|
76
|
-
|
|
77
|
-
if (page.isResolved) {
|
|
78
|
-
return Promise.resolve(page.elements[indexInPage]);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (!page.promise) {
|
|
82
|
-
page.cts = new cancellation_1.CancellationTokenSource();
|
|
83
|
-
page.promise = this.pager.getPage(pageIndex, page.cts.token).then(elements => {
|
|
84
|
-
page.elements = elements;
|
|
85
|
-
page.isResolved = true;
|
|
86
|
-
page.promise = null;
|
|
87
|
-
page.cts = null;
|
|
88
|
-
}, err => {
|
|
89
|
-
page.isResolved = false;
|
|
90
|
-
page.promise = null;
|
|
91
|
-
page.cts = null;
|
|
92
|
-
return Promise.reject(err);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
cancellationToken.onCancellationRequested(() => {
|
|
97
|
-
if (!page.cts) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
page.promiseIndexes.delete(index);
|
|
102
|
-
|
|
103
|
-
if (page.promiseIndexes.size === 0) {
|
|
104
|
-
page.cts.cancel();
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
page.promiseIndexes.add(index);
|
|
108
|
-
return page.promise.then(() => page.elements[indexInPage]);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
exports.PagedModel = PagedModel;
|
|
114
|
-
|
|
115
|
-
class DelayedPagedModel {
|
|
116
|
-
constructor(model, timeout = 500) {
|
|
117
|
-
this.model = model;
|
|
118
|
-
this.timeout = timeout;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
get length() {
|
|
122
|
-
return this.model.length;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
isResolved(index) {
|
|
126
|
-
return this.model.isResolved(index);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
get(index) {
|
|
130
|
-
return this.model.get(index);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
resolve(index, cancellationToken) {
|
|
134
|
-
return new Promise((c, e) => {
|
|
135
|
-
if (cancellationToken.isCancellationRequested) {
|
|
136
|
-
return e(errors_1.canceled());
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const timer = setTimeout(() => {
|
|
140
|
-
if (cancellationToken.isCancellationRequested) {
|
|
141
|
-
return e(errors_1.canceled());
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
timeoutCancellation.dispose();
|
|
145
|
-
this.model.resolve(index, cancellationToken).then(c, e);
|
|
146
|
-
}, this.timeout);
|
|
147
|
-
const timeoutCancellation = cancellationToken.onCancellationRequested(() => {
|
|
148
|
-
clearTimeout(timer);
|
|
149
|
-
timeoutCancellation.dispose();
|
|
150
|
-
e(errors_1.canceled());
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
exports.DelayedPagedModel = DelayedPagedModel;
|
|
158
|
-
/**
|
|
159
|
-
* Similar to array.map, `mapPager` lets you map the elements of an
|
|
160
|
-
* abstract paged collection to another type.
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
function mapPager(pager, fn) {
|
|
164
|
-
return {
|
|
165
|
-
firstPage: pager.firstPage.map(fn),
|
|
166
|
-
total: pager.total,
|
|
167
|
-
pageSize: pager.pageSize,
|
|
168
|
-
getPage: (pageIndex, token) => pager.getPage(pageIndex, token).then(r => r.map(fn))
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
exports.mapPager = mapPager;
|
|
173
|
-
/**
|
|
174
|
-
* Merges two pagers.
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
|
-
function mergePagers(one, other) {
|
|
178
|
-
return {
|
|
179
|
-
firstPage: [...one.firstPage, ...other.firstPage],
|
|
180
|
-
total: one.total + other.total,
|
|
181
|
-
pageSize: one.pageSize + other.pageSize,
|
|
182
|
-
|
|
183
|
-
getPage(pageIndex, token) {
|
|
184
|
-
return Promise.all([one.getPage(pageIndex, token), other.getPage(pageIndex, token)]).then(([onePage, otherPage]) => [...onePage, ...otherPage]);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
exports.mergePagers = mergePagers;
|
|
@@ -1,78 +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.Parser = exports.ValidationStatus = void 0;
|
|
11
|
-
|
|
12
|
-
class ValidationStatus {
|
|
13
|
-
constructor() {
|
|
14
|
-
this._state = 0
|
|
15
|
-
/* OK */
|
|
16
|
-
;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get state() {
|
|
20
|
-
return this._state;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set state(value) {
|
|
24
|
-
if (value > this._state) {
|
|
25
|
-
this._state = value;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
isOK() {
|
|
30
|
-
return this._state === 0
|
|
31
|
-
/* OK */
|
|
32
|
-
;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
isFatal() {
|
|
36
|
-
return this._state === 4
|
|
37
|
-
/* Fatal */
|
|
38
|
-
;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
exports.ValidationStatus = ValidationStatus;
|
|
44
|
-
|
|
45
|
-
class Parser {
|
|
46
|
-
constructor(problemReporter) {
|
|
47
|
-
this._problemReporter = problemReporter;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
reset() {
|
|
51
|
-
this._problemReporter.status.state = 0
|
|
52
|
-
/* OK */
|
|
53
|
-
;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
get problemReporter() {
|
|
57
|
-
return this._problemReporter;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
info(message) {
|
|
61
|
-
this._problemReporter.info(message);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
warn(message) {
|
|
65
|
-
this._problemReporter.warn(message);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
error(message) {
|
|
69
|
-
this._problemReporter.error(message);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
fatal(message) {
|
|
73
|
-
this._problemReporter.fatal(message);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
exports.Parser = Parser;
|