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,80 +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.revive = exports.parse = exports.stringify = void 0;
|
|
11
|
-
|
|
12
|
-
const buffer_1 = require("./buffer");
|
|
13
|
-
|
|
14
|
-
const strings_1 = require("./strings");
|
|
15
|
-
|
|
16
|
-
const uri_1 = require("./uri");
|
|
17
|
-
|
|
18
|
-
function stringify(obj) {
|
|
19
|
-
return JSON.stringify(obj, replacer);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.stringify = stringify;
|
|
23
|
-
|
|
24
|
-
function parse(text) {
|
|
25
|
-
let data = JSON.parse(text);
|
|
26
|
-
data = revive(data);
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
exports.parse = parse;
|
|
31
|
-
|
|
32
|
-
function replacer(key, value) {
|
|
33
|
-
// URI is done via toJSON-member
|
|
34
|
-
if (value instanceof RegExp) {
|
|
35
|
-
return {
|
|
36
|
-
$mid: 2,
|
|
37
|
-
source: value.source,
|
|
38
|
-
flags: strings_1.regExpFlags(value)
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function revive(obj, depth = 0) {
|
|
46
|
-
if (!obj || depth > 200) {
|
|
47
|
-
return obj;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (typeof obj === 'object') {
|
|
51
|
-
switch (obj.$mid) {
|
|
52
|
-
case 1:
|
|
53
|
-
return uri_1.URI.revive(obj);
|
|
54
|
-
|
|
55
|
-
case 2:
|
|
56
|
-
return new RegExp(obj.source, obj.flags);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (obj instanceof buffer_1.VSBuffer || obj instanceof Uint8Array) {
|
|
60
|
-
return obj;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (Array.isArray(obj)) {
|
|
64
|
-
for (let i = 0; i < obj.length; ++i) {
|
|
65
|
-
obj[i] = revive(obj[i], depth + 1);
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
// walk object
|
|
69
|
-
for (const key in obj) {
|
|
70
|
-
if (Object.hasOwnProperty.call(obj, key)) {
|
|
71
|
-
obj[key] = revive(obj[key], depth + 1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return obj;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
exports.revive = revive;
|
|
@@ -1,321 +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.getExtensionForMimeType = exports.getMediaMime = exports.isUnspecific = exports.guessMimeTypes = exports.clearTextMimes = exports.registerTextMime = exports.MIME_UNKNOWN = exports.MIME_BINARY = exports.MIME_TEXT = void 0;
|
|
11
|
-
|
|
12
|
-
const path_1 = require("./path");
|
|
13
|
-
|
|
14
|
-
const strings_1 = require("./strings");
|
|
15
|
-
|
|
16
|
-
const glob_1 = require("./glob");
|
|
17
|
-
|
|
18
|
-
const network_1 = require("./network");
|
|
19
|
-
|
|
20
|
-
const resources_1 = require("./resources");
|
|
21
|
-
|
|
22
|
-
exports.MIME_TEXT = 'text/plain';
|
|
23
|
-
exports.MIME_BINARY = 'application/octet-stream';
|
|
24
|
-
exports.MIME_UNKNOWN = 'application/unknown';
|
|
25
|
-
let registeredAssociations = [];
|
|
26
|
-
let nonUserRegisteredAssociations = [];
|
|
27
|
-
let userRegisteredAssociations = [];
|
|
28
|
-
/**
|
|
29
|
-
* Associate a text mime to the registry.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
function registerTextMime(association, warnOnOverwrite = false) {
|
|
33
|
-
// Register
|
|
34
|
-
const associationItem = toTextMimeAssociationItem(association);
|
|
35
|
-
registeredAssociations.push(associationItem);
|
|
36
|
-
|
|
37
|
-
if (!associationItem.userConfigured) {
|
|
38
|
-
nonUserRegisteredAssociations.push(associationItem);
|
|
39
|
-
} else {
|
|
40
|
-
userRegisteredAssociations.push(associationItem);
|
|
41
|
-
} // Check for conflicts unless this is a user configured association
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (warnOnOverwrite && !associationItem.userConfigured) {
|
|
45
|
-
registeredAssociations.forEach(a => {
|
|
46
|
-
if (a.mime === associationItem.mime || a.userConfigured) {
|
|
47
|
-
return; // same mime or userConfigured is ok
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (associationItem.extension && a.extension === associationItem.extension) {
|
|
51
|
-
console.warn(`Overwriting extension <<${associationItem.extension}>> to now point to mime <<${associationItem.mime}>>`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (associationItem.filename && a.filename === associationItem.filename) {
|
|
55
|
-
console.warn(`Overwriting filename <<${associationItem.filename}>> to now point to mime <<${associationItem.mime}>>`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (associationItem.filepattern && a.filepattern === associationItem.filepattern) {
|
|
59
|
-
console.warn(`Overwriting filepattern <<${associationItem.filepattern}>> to now point to mime <<${associationItem.mime}>>`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (associationItem.firstline && a.firstline === associationItem.firstline) {
|
|
63
|
-
console.warn(`Overwriting firstline <<${associationItem.firstline}>> to now point to mime <<${associationItem.mime}>>`);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
exports.registerTextMime = registerTextMime;
|
|
70
|
-
|
|
71
|
-
function toTextMimeAssociationItem(association) {
|
|
72
|
-
return {
|
|
73
|
-
id: association.id,
|
|
74
|
-
mime: association.mime,
|
|
75
|
-
filename: association.filename,
|
|
76
|
-
extension: association.extension,
|
|
77
|
-
filepattern: association.filepattern,
|
|
78
|
-
firstline: association.firstline,
|
|
79
|
-
userConfigured: association.userConfigured,
|
|
80
|
-
filenameLowercase: association.filename ? association.filename.toLowerCase() : undefined,
|
|
81
|
-
extensionLowercase: association.extension ? association.extension.toLowerCase() : undefined,
|
|
82
|
-
filepatternLowercase: association.filepattern ? association.filepattern.toLowerCase() : undefined,
|
|
83
|
-
filepatternOnPath: association.filepattern ? association.filepattern.indexOf(path_1.posix.sep) >= 0 : false
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Clear text mimes from the registry.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
function clearTextMimes(onlyUserConfigured) {
|
|
92
|
-
if (!onlyUserConfigured) {
|
|
93
|
-
registeredAssociations = [];
|
|
94
|
-
nonUserRegisteredAssociations = [];
|
|
95
|
-
userRegisteredAssociations = [];
|
|
96
|
-
} else {
|
|
97
|
-
registeredAssociations = registeredAssociations.filter(a => !a.userConfigured);
|
|
98
|
-
userRegisteredAssociations = [];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
exports.clearTextMimes = clearTextMimes;
|
|
103
|
-
/**
|
|
104
|
-
* Given a file, return the best matching mime type for it
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
function guessMimeTypes(resource, firstLine) {
|
|
108
|
-
let path;
|
|
109
|
-
|
|
110
|
-
if (resource) {
|
|
111
|
-
switch (resource.scheme) {
|
|
112
|
-
case network_1.Schemas.file:
|
|
113
|
-
path = resource.fsPath;
|
|
114
|
-
break;
|
|
115
|
-
|
|
116
|
-
case network_1.Schemas.data:
|
|
117
|
-
const metadata = resources_1.DataUri.parseMetaData(resource);
|
|
118
|
-
path = metadata.get(resources_1.DataUri.META_DATA_LABEL);
|
|
119
|
-
break;
|
|
120
|
-
|
|
121
|
-
default:
|
|
122
|
-
path = resource.path;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (!path) {
|
|
127
|
-
return [exports.MIME_UNKNOWN];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
path = path.toLowerCase();
|
|
131
|
-
const filename = path_1.basename(path); // 1.) User configured mappings have highest priority
|
|
132
|
-
|
|
133
|
-
const configuredMime = guessMimeTypeByPath(path, filename, userRegisteredAssociations);
|
|
134
|
-
|
|
135
|
-
if (configuredMime) {
|
|
136
|
-
return [configuredMime, exports.MIME_TEXT];
|
|
137
|
-
} // 2.) Registered mappings have middle priority
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const registeredMime = guessMimeTypeByPath(path, filename, nonUserRegisteredAssociations);
|
|
141
|
-
|
|
142
|
-
if (registeredMime) {
|
|
143
|
-
return [registeredMime, exports.MIME_TEXT];
|
|
144
|
-
} // 3.) Firstline has lowest priority
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (firstLine) {
|
|
148
|
-
const firstlineMime = guessMimeTypeByFirstline(firstLine);
|
|
149
|
-
|
|
150
|
-
if (firstlineMime) {
|
|
151
|
-
return [firstlineMime, exports.MIME_TEXT];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return [exports.MIME_UNKNOWN];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
exports.guessMimeTypes = guessMimeTypes;
|
|
159
|
-
|
|
160
|
-
function guessMimeTypeByPath(path, filename, associations) {
|
|
161
|
-
let filenameMatch = null;
|
|
162
|
-
let patternMatch = null;
|
|
163
|
-
let extensionMatch = null; // We want to prioritize associations based on the order they are registered so that the last registered
|
|
164
|
-
// association wins over all other. This is for https://github.com/microsoft/vscode/issues/20074
|
|
165
|
-
|
|
166
|
-
for (let i = associations.length - 1; i >= 0; i--) {
|
|
167
|
-
const association = associations[i]; // First exact name match
|
|
168
|
-
|
|
169
|
-
if (filename === association.filenameLowercase) {
|
|
170
|
-
filenameMatch = association;
|
|
171
|
-
break; // take it!
|
|
172
|
-
} // Longest pattern match
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (association.filepattern) {
|
|
176
|
-
if (!patternMatch || association.filepattern.length > patternMatch.filepattern.length) {
|
|
177
|
-
const target = association.filepatternOnPath ? path : filename; // match on full path if pattern contains path separator
|
|
178
|
-
|
|
179
|
-
if (glob_1.match(association.filepatternLowercase, target)) {
|
|
180
|
-
patternMatch = association;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
} // Longest extension match
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (association.extension) {
|
|
187
|
-
if (!extensionMatch || association.extension.length > extensionMatch.extension.length) {
|
|
188
|
-
if (filename.endsWith(association.extensionLowercase)) {
|
|
189
|
-
extensionMatch = association;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
} // 1.) Exact name match has second highest prio
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (filenameMatch) {
|
|
197
|
-
return filenameMatch.mime;
|
|
198
|
-
} // 2.) Match on pattern
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (patternMatch) {
|
|
202
|
-
return patternMatch.mime;
|
|
203
|
-
} // 3.) Match on extension comes next
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (extensionMatch) {
|
|
207
|
-
return extensionMatch.mime;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function guessMimeTypeByFirstline(firstLine) {
|
|
214
|
-
if (strings_1.startsWithUTF8BOM(firstLine)) {
|
|
215
|
-
firstLine = firstLine.substr(1);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (firstLine.length > 0) {
|
|
219
|
-
// We want to prioritize associations based on the order they are registered so that the last registered
|
|
220
|
-
// association wins over all other. This is for https://github.com/microsoft/vscode/issues/20074
|
|
221
|
-
for (let i = registeredAssociations.length - 1; i >= 0; i--) {
|
|
222
|
-
const association = registeredAssociations[i];
|
|
223
|
-
|
|
224
|
-
if (!association.firstline) {
|
|
225
|
-
continue;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const matches = firstLine.match(association.firstline);
|
|
229
|
-
|
|
230
|
-
if (matches && matches.length > 0) {
|
|
231
|
-
return association.mime;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function isUnspecific(mime) {
|
|
240
|
-
if (!mime) {
|
|
241
|
-
return true;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (typeof mime === 'string') {
|
|
245
|
-
return mime === exports.MIME_BINARY || mime === exports.MIME_TEXT || mime === exports.MIME_UNKNOWN;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return mime.length === 1 && isUnspecific(mime[0]);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
exports.isUnspecific = isUnspecific; // Known media mimes that we can handle
|
|
252
|
-
|
|
253
|
-
const mapExtToMediaMimes = {
|
|
254
|
-
'.aac': 'audio/x-aac',
|
|
255
|
-
'.avi': 'video/x-msvideo',
|
|
256
|
-
'.bmp': 'image/bmp',
|
|
257
|
-
'.flv': 'video/x-flv',
|
|
258
|
-
'.gif': 'image/gif',
|
|
259
|
-
'.ico': 'image/x-icon',
|
|
260
|
-
'.jpe': 'image/jpg',
|
|
261
|
-
'.jpeg': 'image/jpg',
|
|
262
|
-
'.jpg': 'image/jpg',
|
|
263
|
-
'.m1v': 'video/mpeg',
|
|
264
|
-
'.m2a': 'audio/mpeg',
|
|
265
|
-
'.m2v': 'video/mpeg',
|
|
266
|
-
'.m3a': 'audio/mpeg',
|
|
267
|
-
'.mid': 'audio/midi',
|
|
268
|
-
'.midi': 'audio/midi',
|
|
269
|
-
'.mk3d': 'video/x-matroska',
|
|
270
|
-
'.mks': 'video/x-matroska',
|
|
271
|
-
'.mkv': 'video/x-matroska',
|
|
272
|
-
'.mov': 'video/quicktime',
|
|
273
|
-
'.movie': 'video/x-sgi-movie',
|
|
274
|
-
'.mp2': 'audio/mpeg',
|
|
275
|
-
'.mp2a': 'audio/mpeg',
|
|
276
|
-
'.mp3': 'audio/mpeg',
|
|
277
|
-
'.mp4': 'video/mp4',
|
|
278
|
-
'.mp4a': 'audio/mp4',
|
|
279
|
-
'.mp4v': 'video/mp4',
|
|
280
|
-
'.mpe': 'video/mpeg',
|
|
281
|
-
'.mpeg': 'video/mpeg',
|
|
282
|
-
'.mpg': 'video/mpeg',
|
|
283
|
-
'.mpg4': 'video/mp4',
|
|
284
|
-
'.mpga': 'audio/mpeg',
|
|
285
|
-
'.oga': 'audio/ogg',
|
|
286
|
-
'.ogg': 'audio/ogg',
|
|
287
|
-
'.ogv': 'video/ogg',
|
|
288
|
-
'.png': 'image/png',
|
|
289
|
-
'.psd': 'image/vnd.adobe.photoshop',
|
|
290
|
-
'.qt': 'video/quicktime',
|
|
291
|
-
'.spx': 'audio/ogg',
|
|
292
|
-
'.svg': 'image/svg+xml',
|
|
293
|
-
'.tga': 'image/x-tga',
|
|
294
|
-
'.tif': 'image/tiff',
|
|
295
|
-
'.tiff': 'image/tiff',
|
|
296
|
-
'.wav': 'audio/x-wav',
|
|
297
|
-
'.webm': 'video/webm',
|
|
298
|
-
'.webp': 'image/webp',
|
|
299
|
-
'.wma': 'audio/x-ms-wma',
|
|
300
|
-
'.wmv': 'video/x-ms-wmv',
|
|
301
|
-
'.woff': 'application/font-woff'
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
function getMediaMime(path) {
|
|
305
|
-
const ext = path_1.extname(path);
|
|
306
|
-
return mapExtToMediaMimes[ext.toLowerCase()];
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
exports.getMediaMime = getMediaMime;
|
|
310
|
-
|
|
311
|
-
function getExtensionForMimeType(mimeType) {
|
|
312
|
-
for (const extension in mapExtToMediaMimes) {
|
|
313
|
-
if (mapExtToMediaMimes[extension] === mimeType) {
|
|
314
|
-
return extension;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
return undefined;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
exports.getExtensionForMimeType = getExtensionForMimeType;
|
|
@@ -1,50 +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.ArrayNavigator = void 0;
|
|
11
|
-
|
|
12
|
-
class ArrayNavigator {
|
|
13
|
-
constructor(items, start = 0, end = items.length, index = start - 1) {
|
|
14
|
-
this.items = items;
|
|
15
|
-
this.start = start;
|
|
16
|
-
this.end = end;
|
|
17
|
-
this.index = index;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
current() {
|
|
21
|
-
if (this.index === this.start - 1 || this.index === this.end) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return this.items[this.index];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
next() {
|
|
29
|
-
this.index = Math.min(this.index + 1, this.end);
|
|
30
|
-
return this.current();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
previous() {
|
|
34
|
-
this.index = Math.max(this.index - 1, this.start - 1);
|
|
35
|
-
return this.current();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
first() {
|
|
39
|
-
this.index = this.start;
|
|
40
|
-
return this.current();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
last() {
|
|
44
|
-
this.index = this.end - 1;
|
|
45
|
-
return this.current();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
exports.ArrayNavigator = ArrayNavigator;
|
|
@@ -1,160 +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.FileAccess = exports.RemoteAuthorities = exports.Schemas = void 0;
|
|
11
|
-
|
|
12
|
-
const uri_1 = require("./uri");
|
|
13
|
-
|
|
14
|
-
const platform = require("./platform");
|
|
15
|
-
|
|
16
|
-
var Schemas;
|
|
17
|
-
|
|
18
|
-
(function (Schemas) {
|
|
19
|
-
/**
|
|
20
|
-
* A schema that is used for models that exist in memory
|
|
21
|
-
* only and that have no correspondence on a server or such.
|
|
22
|
-
*/
|
|
23
|
-
Schemas.inMemory = 'inmemory';
|
|
24
|
-
/**
|
|
25
|
-
* A schema that is used for setting files
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
Schemas.vscode = 'vscode';
|
|
29
|
-
/**
|
|
30
|
-
* A schema that is used for internal private files
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
Schemas.internal = 'private';
|
|
34
|
-
/**
|
|
35
|
-
* A walk-through document.
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
Schemas.walkThrough = 'walkThrough';
|
|
39
|
-
/**
|
|
40
|
-
* An embedded code snippet.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
Schemas.walkThroughSnippet = 'walkThroughSnippet';
|
|
44
|
-
Schemas.http = 'http';
|
|
45
|
-
Schemas.https = 'https';
|
|
46
|
-
Schemas.file = 'file';
|
|
47
|
-
Schemas.mailto = 'mailto';
|
|
48
|
-
Schemas.untitled = 'untitled';
|
|
49
|
-
Schemas.data = 'data';
|
|
50
|
-
Schemas.command = 'command';
|
|
51
|
-
Schemas.vscodeRemote = 'vscode-remote';
|
|
52
|
-
Schemas.vscodeRemoteResource = 'vscode-remote-resource';
|
|
53
|
-
Schemas.userData = 'vscode-userdata';
|
|
54
|
-
Schemas.vscodeCustomEditor = 'vscode-custom-editor';
|
|
55
|
-
Schemas.vscodeNotebook = 'vscode-notebook';
|
|
56
|
-
Schemas.vscodeNotebookCell = 'vscode-notebook-cell';
|
|
57
|
-
Schemas.vscodeSettings = 'vscode-settings';
|
|
58
|
-
Schemas.webviewPanel = 'webview-panel';
|
|
59
|
-
/**
|
|
60
|
-
* Scheme used for loading the wrapper html and script in webviews.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
Schemas.vscodeWebview = 'vscode-webview';
|
|
64
|
-
/**
|
|
65
|
-
* Scheme used for loading resources inside of webviews.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
Schemas.vscodeWebviewResource = 'vscode-webview-resource';
|
|
69
|
-
/**
|
|
70
|
-
* Scheme used for extension pages
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
Schemas.extension = 'extension';
|
|
74
|
-
})(Schemas = exports.Schemas || (exports.Schemas = {}));
|
|
75
|
-
|
|
76
|
-
class RemoteAuthoritiesImpl {
|
|
77
|
-
constructor() {
|
|
78
|
-
this._hosts = Object.create(null);
|
|
79
|
-
this._ports = Object.create(null);
|
|
80
|
-
this._connectionTokens = Object.create(null);
|
|
81
|
-
this._preferredWebSchema = 'http';
|
|
82
|
-
this._delegate = null;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
setPreferredWebSchema(schema) {
|
|
86
|
-
this._preferredWebSchema = schema;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
setDelegate(delegate) {
|
|
90
|
-
this._delegate = delegate;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
set(authority, host, port) {
|
|
94
|
-
this._hosts[authority] = host;
|
|
95
|
-
this._ports[authority] = port;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
setConnectionToken(authority, connectionToken) {
|
|
99
|
-
this._connectionTokens[authority] = connectionToken;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
rewrite(uri) {
|
|
103
|
-
if (this._delegate) {
|
|
104
|
-
return this._delegate(uri);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const authority = uri.authority;
|
|
108
|
-
let host = this._hosts[authority];
|
|
109
|
-
|
|
110
|
-
if (host && host.indexOf(':') !== -1) {
|
|
111
|
-
host = `[${host}]`;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const port = this._ports[authority];
|
|
115
|
-
const connectionToken = this._connectionTokens[authority];
|
|
116
|
-
let query = `path=${encodeURIComponent(uri.path)}`;
|
|
117
|
-
|
|
118
|
-
if (typeof connectionToken === 'string') {
|
|
119
|
-
query += `&tkn=${encodeURIComponent(connectionToken)}`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return uri_1.URI.from({
|
|
123
|
-
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
|
|
124
|
-
authority: `${host}:${port}`,
|
|
125
|
-
path: `/vscode-remote-resource`,
|
|
126
|
-
query
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
exports.RemoteAuthorities = new RemoteAuthoritiesImpl();
|
|
133
|
-
|
|
134
|
-
class FileAccessImpl {
|
|
135
|
-
asBrowserUri(uriOrModule, moduleIdToUrl) {
|
|
136
|
-
const uri = this.toUri(uriOrModule, moduleIdToUrl);
|
|
137
|
-
|
|
138
|
-
if (uri.scheme === Schemas.vscodeRemote) {
|
|
139
|
-
return exports.RemoteAuthorities.rewrite(uri);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return uri;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
asFileUri(uriOrModule, moduleIdToUrl) {
|
|
146
|
-
const uri = this.toUri(uriOrModule, moduleIdToUrl);
|
|
147
|
-
return uri;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
toUri(uriOrModule, moduleIdToUrl) {
|
|
151
|
-
if (uri_1.URI.isUri(uriOrModule)) {
|
|
152
|
-
return uriOrModule;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return uri_1.URI.parse(moduleIdToUrl.toUrl(uriOrModule));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
exports.FileAccess = new FileAccessImpl();
|
|
@@ -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.removeAccents = exports.normalizeNFD = exports.normalizeNFC = exports.canNormalize = void 0;
|
|
11
|
-
|
|
12
|
-
const map_1 = require("./map");
|
|
13
|
-
/**
|
|
14
|
-
* The normalize() method returns the Unicode Normalization Form of a given string. The form will be
|
|
15
|
-
* the Normalization Form Canonical Composition.
|
|
16
|
-
*
|
|
17
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize}
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exports.canNormalize = typeof String.prototype
|
|
22
|
-
/* standalone editor compilation */
|
|
23
|
-
.normalize === 'function';
|
|
24
|
-
const nfcCache = new map_1.LRUCache(10000); // bounded to 10000 elements
|
|
25
|
-
|
|
26
|
-
function normalizeNFC(str) {
|
|
27
|
-
return normalize(str, 'NFC', nfcCache);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
exports.normalizeNFC = normalizeNFC;
|
|
31
|
-
const nfdCache = new map_1.LRUCache(10000); // bounded to 10000 elements
|
|
32
|
-
|
|
33
|
-
function normalizeNFD(str) {
|
|
34
|
-
return normalize(str, 'NFD', nfdCache);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
exports.normalizeNFD = normalizeNFD;
|
|
38
|
-
const nonAsciiCharactersPattern = /[^\u0000-\u0080]/;
|
|
39
|
-
|
|
40
|
-
function normalize(str, form, normalizedCache) {
|
|
41
|
-
if (!exports.canNormalize || !str) {
|
|
42
|
-
return str;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const cached = normalizedCache.get(str);
|
|
46
|
-
|
|
47
|
-
if (cached) {
|
|
48
|
-
return cached;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let res;
|
|
52
|
-
|
|
53
|
-
if (nonAsciiCharactersPattern.test(str)) {
|
|
54
|
-
res = str.normalize(form);
|
|
55
|
-
} else {
|
|
56
|
-
res = str;
|
|
57
|
-
} // Use the cache for fast lookup
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
normalizedCache.set(str, res);
|
|
61
|
-
return res;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
exports.removeAccents = function () {
|
|
65
|
-
if (!exports.canNormalize) {
|
|
66
|
-
// no ES6 features...
|
|
67
|
-
return function (str) {
|
|
68
|
-
return str;
|
|
69
|
-
};
|
|
70
|
-
} else {
|
|
71
|
-
// transform into NFD form and remove accents
|
|
72
|
-
// see: https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463
|
|
73
|
-
const regex = /[\u0300-\u036f]/g;
|
|
74
|
-
return function (str) {
|
|
75
|
-
return normalizeNFD(str).replace(regex, '');
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}();
|