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,421 +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.toLocalResource = exports.ResourceGlobMatcher = exports.DataUri = exports.distinctParents = exports.addTrailingPathSeparator = exports.removeTrailingPathSeparator = exports.hasTrailingPathSeparator = exports.isEqualAuthority = exports.isAbsolutePath = exports.resolvePath = exports.relativePath = exports.normalizePath = exports.joinPath = exports.dirname = exports.extname = exports.basename = exports.basenameOrAuthority = exports.getComparisonKey = exports.isEqualOrParent = exports.isEqual = exports.extUriIgnorePathCase = exports.extUriBiasedIgnorePathCase = exports.extUri = exports.ExtUri = exports.originalFSPath = void 0;
|
|
11
|
-
|
|
12
|
-
const extpath = require("./extpath");
|
|
13
|
-
|
|
14
|
-
const paths = require("./path");
|
|
15
|
-
|
|
16
|
-
const uri_1 = require("./uri");
|
|
17
|
-
|
|
18
|
-
const strings_1 = require("./strings");
|
|
19
|
-
|
|
20
|
-
const network_1 = require("./network");
|
|
21
|
-
|
|
22
|
-
const platform_1 = require("./platform");
|
|
23
|
-
|
|
24
|
-
const glob_1 = require("./glob");
|
|
25
|
-
|
|
26
|
-
const map_1 = require("./map");
|
|
27
|
-
|
|
28
|
-
function originalFSPath(uri) {
|
|
29
|
-
return uri_1.uriToFsPath(uri, true);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports.originalFSPath = originalFSPath;
|
|
33
|
-
|
|
34
|
-
class ExtUri {
|
|
35
|
-
constructor(_ignorePathCasing) {
|
|
36
|
-
this._ignorePathCasing = _ignorePathCasing;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
compare(uri1, uri2, ignoreFragment = false) {
|
|
40
|
-
if (uri1 === uri2) {
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return strings_1.compare(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
isEqual(uri1, uri2, ignoreFragment = false) {
|
|
48
|
-
if (uri1 === uri2) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!uri1 || !uri2) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getComparisonKey(uri, ignoreFragment = false) {
|
|
60
|
-
return uri.with({
|
|
61
|
-
path: this._ignorePathCasing(uri) ? uri.path.toLowerCase() : undefined,
|
|
62
|
-
fragment: ignoreFragment ? null : undefined
|
|
63
|
-
}).toString();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
isEqualOrParent(base, parentCandidate, ignoreFragment = false) {
|
|
67
|
-
if (base.scheme === parentCandidate.scheme) {
|
|
68
|
-
if (base.scheme === network_1.Schemas.file) {
|
|
69
|
-
return extpath.isEqualOrParent(originalFSPath(base), originalFSPath(parentCandidate), this._ignorePathCasing(base)) && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (exports.isEqualAuthority(base.authority, parentCandidate.authority)) {
|
|
73
|
-
return extpath.isEqualOrParent(base.path, parentCandidate.path, this._ignorePathCasing(base), '/') && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return false;
|
|
78
|
-
} // --- path math
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
joinPath(resource, ...pathFragment) {
|
|
82
|
-
return uri_1.URI.joinPath(resource, ...pathFragment);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
basenameOrAuthority(resource) {
|
|
86
|
-
return exports.basename(resource) || resource.authority;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
basename(resource) {
|
|
90
|
-
return paths.posix.basename(resource.path);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
extname(resource) {
|
|
94
|
-
return paths.posix.extname(resource.path);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
dirname(resource) {
|
|
98
|
-
if (resource.path.length === 0) {
|
|
99
|
-
return resource;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
let dirname;
|
|
103
|
-
|
|
104
|
-
if (resource.scheme === network_1.Schemas.file) {
|
|
105
|
-
dirname = uri_1.URI.file(paths.dirname(originalFSPath(resource))).path;
|
|
106
|
-
} else {
|
|
107
|
-
dirname = paths.posix.dirname(resource.path);
|
|
108
|
-
|
|
109
|
-
if (resource.authority && dirname.length && dirname.charCodeAt(0) !== 47
|
|
110
|
-
/* Slash */
|
|
111
|
-
) {
|
|
112
|
-
console.error(`dirname("${resource.toString})) resulted in a relative path`);
|
|
113
|
-
dirname = '/'; // If a URI contains an authority component, then the path component must either be empty or begin with a CharCode.Slash ("/") character
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return resource.with({
|
|
118
|
-
path: dirname
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
normalizePath(resource) {
|
|
123
|
-
if (!resource.path.length) {
|
|
124
|
-
return resource;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
let normalizedPath;
|
|
128
|
-
|
|
129
|
-
if (resource.scheme === network_1.Schemas.file) {
|
|
130
|
-
normalizedPath = uri_1.URI.file(paths.normalize(originalFSPath(resource))).path;
|
|
131
|
-
} else {
|
|
132
|
-
normalizedPath = paths.posix.normalize(resource.path);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return resource.with({
|
|
136
|
-
path: normalizedPath
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
relativePath(from, to) {
|
|
141
|
-
if (from.scheme !== to.scheme || !exports.isEqualAuthority(from.authority, to.authority)) {
|
|
142
|
-
return undefined;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (from.scheme === network_1.Schemas.file) {
|
|
146
|
-
const relativePath = paths.relative(originalFSPath(from), originalFSPath(to));
|
|
147
|
-
return platform_1.isWindows ? extpath.toSlashes(relativePath) : relativePath;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
let fromPath = from.path || '/',
|
|
151
|
-
toPath = to.path || '/';
|
|
152
|
-
|
|
153
|
-
if (this._ignorePathCasing(from)) {
|
|
154
|
-
// make casing of fromPath match toPath
|
|
155
|
-
let i = 0;
|
|
156
|
-
|
|
157
|
-
for (const len = Math.min(fromPath.length, toPath.length); i < len; i++) {
|
|
158
|
-
if (fromPath.charCodeAt(i) !== toPath.charCodeAt(i)) {
|
|
159
|
-
if (fromPath.charAt(i).toLowerCase() !== toPath.charAt(i).toLowerCase()) {
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
fromPath = toPath.substr(0, i) + fromPath.substr(i);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return paths.posix.relative(fromPath, toPath);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
resolvePath(base, path) {
|
|
172
|
-
if (base.scheme === network_1.Schemas.file) {
|
|
173
|
-
const newURI = uri_1.URI.file(paths.resolve(originalFSPath(base), path));
|
|
174
|
-
return base.with({
|
|
175
|
-
authority: newURI.authority,
|
|
176
|
-
path: newURI.path
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (path.indexOf('/') === -1) {
|
|
181
|
-
// no slashes? it's likely a Windows path
|
|
182
|
-
path = extpath.toSlashes(path);
|
|
183
|
-
|
|
184
|
-
if (/^[a-zA-Z]:(\/|$)/.test(path)) {
|
|
185
|
-
// starts with a drive letter
|
|
186
|
-
path = '/' + path;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return base.with({
|
|
191
|
-
path: paths.posix.resolve(base.path, path)
|
|
192
|
-
});
|
|
193
|
-
} // --- misc
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
isAbsolutePath(resource) {
|
|
197
|
-
return !!resource.path && resource.path[0] === '/';
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
isEqualAuthority(a1, a2) {
|
|
201
|
-
return a1 === a2 || strings_1.equalsIgnoreCase(a1, a2);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
hasTrailingPathSeparator(resource, sep = paths.sep) {
|
|
205
|
-
if (resource.scheme === network_1.Schemas.file) {
|
|
206
|
-
const fsp = originalFSPath(resource);
|
|
207
|
-
return fsp.length > extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep;
|
|
208
|
-
} else {
|
|
209
|
-
const p = resource.path;
|
|
210
|
-
return p.length > 1 && p.charCodeAt(p.length - 1) === 47
|
|
211
|
-
/* Slash */
|
|
212
|
-
&& !/^[a-zA-Z]:(\/$|\\$)/.test(resource.fsPath); // ignore the slash at offset 0
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
removeTrailingPathSeparator(resource, sep = paths.sep) {
|
|
217
|
-
// Make sure that the path isn't a drive letter. A trailing separator there is not removable.
|
|
218
|
-
if (exports.hasTrailingPathSeparator(resource, sep)) {
|
|
219
|
-
return resource.with({
|
|
220
|
-
path: resource.path.substr(0, resource.path.length - 1)
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return resource;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
addTrailingPathSeparator(resource, sep = paths.sep) {
|
|
228
|
-
let isRootSep = false;
|
|
229
|
-
|
|
230
|
-
if (resource.scheme === network_1.Schemas.file) {
|
|
231
|
-
const fsp = originalFSPath(resource);
|
|
232
|
-
isRootSep = fsp !== undefined && fsp.length === extpath.getRoot(fsp).length && fsp[fsp.length - 1] === sep;
|
|
233
|
-
} else {
|
|
234
|
-
sep = '/';
|
|
235
|
-
const p = resource.path;
|
|
236
|
-
isRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === 47
|
|
237
|
-
/* Slash */
|
|
238
|
-
;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (!isRootSep && !exports.hasTrailingPathSeparator(resource, sep)) {
|
|
242
|
-
return resource.with({
|
|
243
|
-
path: resource.path + '/'
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return resource;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
exports.ExtUri = ExtUri;
|
|
253
|
-
/**
|
|
254
|
-
* Unbiased utility that takes uris "as they are". This means it can be interchanged with
|
|
255
|
-
* uri#toString() usages. The following is true
|
|
256
|
-
* ```
|
|
257
|
-
* assertEqual(aUri.toString() === bUri.toString(), exturi.isEqual(aUri, bUri))
|
|
258
|
-
* ```
|
|
259
|
-
*/
|
|
260
|
-
|
|
261
|
-
exports.extUri = new ExtUri(() => false);
|
|
262
|
-
/**
|
|
263
|
-
* BIASED utility that _mostly_ ignored the case of urs paths. ONLY use this util if you
|
|
264
|
-
* understand what you are doing.
|
|
265
|
-
*
|
|
266
|
-
* This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged.
|
|
267
|
-
*
|
|
268
|
-
* When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient
|
|
269
|
-
* because those uris come from a "trustworthy source". When creating unknown uris it's always
|
|
270
|
-
* better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path
|
|
271
|
-
* casing matters.
|
|
272
|
-
*/
|
|
273
|
-
|
|
274
|
-
exports.extUriBiasedIgnorePathCase = new ExtUri(uri => {
|
|
275
|
-
// A file scheme resource is in the same platform as code, so ignore case for non linux platforms
|
|
276
|
-
// Resource can be from another platform. Lowering the case as an hack. Should come from File system provider
|
|
277
|
-
return uri.scheme === network_1.Schemas.file ? !platform_1.isLinux : true;
|
|
278
|
-
});
|
|
279
|
-
/**
|
|
280
|
-
* BIASED utility that always ignores the casing of uris paths. ONLY use this util if you
|
|
281
|
-
* understand what you are doing.
|
|
282
|
-
*
|
|
283
|
-
* This utility is INCOMPATIBLE with `uri.toString()`-usages and both CANNOT be used interchanged.
|
|
284
|
-
*
|
|
285
|
-
* When dealing with uris from files or documents, `extUri` (the unbiased friend)is sufficient
|
|
286
|
-
* because those uris come from a "trustworthy source". When creating unknown uris it's always
|
|
287
|
-
* better to use `IUriIdentityService` which exposes an `IExtUri`-instance which knows when path
|
|
288
|
-
* casing matters.
|
|
289
|
-
*/
|
|
290
|
-
|
|
291
|
-
exports.extUriIgnorePathCase = new ExtUri(_ => true);
|
|
292
|
-
exports.isEqual = exports.extUri.isEqual.bind(exports.extUri);
|
|
293
|
-
exports.isEqualOrParent = exports.extUri.isEqualOrParent.bind(exports.extUri);
|
|
294
|
-
exports.getComparisonKey = exports.extUri.getComparisonKey.bind(exports.extUri);
|
|
295
|
-
exports.basenameOrAuthority = exports.extUri.basenameOrAuthority.bind(exports.extUri);
|
|
296
|
-
exports.basename = exports.extUri.basename.bind(exports.extUri);
|
|
297
|
-
exports.extname = exports.extUri.extname.bind(exports.extUri);
|
|
298
|
-
exports.dirname = exports.extUri.dirname.bind(exports.extUri);
|
|
299
|
-
exports.joinPath = exports.extUri.joinPath.bind(exports.extUri);
|
|
300
|
-
exports.normalizePath = exports.extUri.normalizePath.bind(exports.extUri);
|
|
301
|
-
exports.relativePath = exports.extUri.relativePath.bind(exports.extUri);
|
|
302
|
-
exports.resolvePath = exports.extUri.resolvePath.bind(exports.extUri);
|
|
303
|
-
exports.isAbsolutePath = exports.extUri.isAbsolutePath.bind(exports.extUri);
|
|
304
|
-
exports.isEqualAuthority = exports.extUri.isEqualAuthority.bind(exports.extUri);
|
|
305
|
-
exports.hasTrailingPathSeparator = exports.extUri.hasTrailingPathSeparator.bind(exports.extUri);
|
|
306
|
-
exports.removeTrailingPathSeparator = exports.extUri.removeTrailingPathSeparator.bind(exports.extUri);
|
|
307
|
-
exports.addTrailingPathSeparator = exports.extUri.addTrailingPathSeparator.bind(exports.extUri); //#endregion
|
|
308
|
-
|
|
309
|
-
function distinctParents(items, resourceAccessor) {
|
|
310
|
-
const distinctParents = [];
|
|
311
|
-
|
|
312
|
-
for (let i = 0; i < items.length; i++) {
|
|
313
|
-
const candidateResource = resourceAccessor(items[i]);
|
|
314
|
-
|
|
315
|
-
if (items.some((otherItem, index) => {
|
|
316
|
-
if (index === i) {
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
return exports.isEqualOrParent(candidateResource, resourceAccessor(otherItem));
|
|
321
|
-
})) {
|
|
322
|
-
continue;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
distinctParents.push(items[i]);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return distinctParents;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
exports.distinctParents = distinctParents;
|
|
332
|
-
/**
|
|
333
|
-
* Data URI related helpers.
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
var DataUri;
|
|
337
|
-
|
|
338
|
-
(function (DataUri) {
|
|
339
|
-
DataUri.META_DATA_LABEL = 'label';
|
|
340
|
-
DataUri.META_DATA_DESCRIPTION = 'description';
|
|
341
|
-
DataUri.META_DATA_SIZE = 'size';
|
|
342
|
-
DataUri.META_DATA_MIME = 'mime';
|
|
343
|
-
|
|
344
|
-
function parseMetaData(dataUri) {
|
|
345
|
-
const metadata = new Map(); // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...
|
|
346
|
-
// the metadata is: size:2313;label:SomeLabel;description:SomeDescription
|
|
347
|
-
|
|
348
|
-
const meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';'));
|
|
349
|
-
meta.split(';').forEach(property => {
|
|
350
|
-
const [key, value] = property.split(':');
|
|
351
|
-
|
|
352
|
-
if (key && value) {
|
|
353
|
-
metadata.set(key, value);
|
|
354
|
-
}
|
|
355
|
-
}); // Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...
|
|
356
|
-
// the mime is: image/png
|
|
357
|
-
|
|
358
|
-
const mime = dataUri.path.substring(0, dataUri.path.indexOf(';'));
|
|
359
|
-
|
|
360
|
-
if (mime) {
|
|
361
|
-
metadata.set(DataUri.META_DATA_MIME, mime);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
return metadata;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
DataUri.parseMetaData = parseMetaData;
|
|
368
|
-
})(DataUri = exports.DataUri || (exports.DataUri = {}));
|
|
369
|
-
|
|
370
|
-
class ResourceGlobMatcher {
|
|
371
|
-
constructor(globalExpression, rootExpressions) {
|
|
372
|
-
this.expressionsByRoot = map_1.TernarySearchTree.forUris();
|
|
373
|
-
this.globalExpression = glob_1.parse(globalExpression);
|
|
374
|
-
|
|
375
|
-
for (const expression of rootExpressions) {
|
|
376
|
-
this.expressionsByRoot.set(expression.root, {
|
|
377
|
-
root: expression.root,
|
|
378
|
-
expression: glob_1.parse(expression.expression)
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
matches(resource) {
|
|
384
|
-
const rootExpression = this.expressionsByRoot.findSubstr(resource);
|
|
385
|
-
|
|
386
|
-
if (rootExpression) {
|
|
387
|
-
const path = exports.relativePath(rootExpression.root, resource);
|
|
388
|
-
|
|
389
|
-
if (path && !!rootExpression.expression(path)) {
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
return !!this.globalExpression(resource.path);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
exports.ResourceGlobMatcher = ResourceGlobMatcher;
|
|
400
|
-
|
|
401
|
-
function toLocalResource(resource, authority, localScheme) {
|
|
402
|
-
if (authority) {
|
|
403
|
-
let path = resource.path;
|
|
404
|
-
|
|
405
|
-
if (path && path[0] !== paths.posix.sep) {
|
|
406
|
-
path = paths.posix.sep + path;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return resource.with({
|
|
410
|
-
scheme: localScheme,
|
|
411
|
-
authority,
|
|
412
|
-
path
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
return resource.with({
|
|
417
|
-
scheme: localScheme
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
exports.toLocalResource = toLocalResource;
|