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.
Files changed (239) hide show
  1. package/.github/FUNDING.yml +1 -0
  2. package/README.md +15 -24
  3. package/_config.yml +1 -0
  4. package/{lib → build}/browser/browser.d.ts +0 -0
  5. package/{lib → build}/browser/browser.js +0 -0
  6. package/{lib → build}/browser/browser.js.map +0 -0
  7. package/{lib → build}/browser/event.d.ts +0 -0
  8. package/{lib → build}/browser/event.js +2 -1
  9. package/{lib → build}/browser/event.js.map +1 -1
  10. package/{lib → build}/browser/iframe.d.ts +0 -0
  11. package/{lib → build}/browser/iframe.js +0 -0
  12. package/{lib → build}/browser/iframe.js.map +0 -0
  13. package/{lib → build}/browser/keyboardEvent.d.ts +0 -0
  14. package/{lib → build}/browser/keyboardEvent.js +0 -0
  15. package/{lib → build}/browser/keyboardEvent.js.map +0 -0
  16. package/{lib → build}/browser/mouseEvent.d.ts +0 -0
  17. package/{lib → build}/browser/mouseEvent.js +0 -0
  18. package/{lib → build}/browser/mouseEvent.js.map +0 -0
  19. package/{lib → build}/common/arrays.d.ts +0 -0
  20. package/{lib → build}/common/arrays.js +0 -0
  21. package/{lib → build}/common/arrays.js.map +0 -0
  22. package/{lib → build}/common/async.d.ts +0 -0
  23. package/{lib → build}/common/async.js +0 -0
  24. package/{lib → build}/common/async.js.map +0 -0
  25. package/{lib → build}/common/charCode.d.ts +0 -0
  26. package/{lib → build}/common/charCode.js +0 -0
  27. package/{lib → build}/common/charCode.js.map +0 -0
  28. package/{lib → build}/common/color.d.ts +0 -0
  29. package/{lib → build}/common/color.js +0 -0
  30. package/{lib → build}/common/color.js.map +0 -0
  31. package/{lib → build}/common/dom.d.ts +0 -0
  32. package/{lib → build}/common/dom.js +16 -14
  33. package/build/common/dom.js.map +1 -0
  34. package/{lib → build}/common/event.d.ts +0 -0
  35. package/{lib → build}/common/event.js +1 -1
  36. package/build/common/event.js.map +1 -0
  37. package/{lib → build}/common/iterator.d.ts +0 -0
  38. package/{lib → build}/common/iterator.js +0 -0
  39. package/{lib → build}/common/iterator.js.map +0 -0
  40. package/{lib → build}/common/keyCodes.d.ts +0 -0
  41. package/{lib → build}/common/keyCodes.js +0 -0
  42. package/{lib → build}/common/keyCodes.js.map +0 -0
  43. package/{lib → build}/common/lifecycle.d.ts +0 -0
  44. package/{lib → build}/common/lifecycle.js +0 -0
  45. package/{lib → build}/common/lifecycle.js.map +0 -0
  46. package/{lib → build}/common/linkedList.d.ts +0 -0
  47. package/{lib → build}/common/linkedList.js +0 -0
  48. package/{lib → build}/common/linkedList.js.map +0 -0
  49. package/{lib → build}/common/platform.d.ts +0 -0
  50. package/{lib → build}/common/platform.js +0 -0
  51. package/{lib → build}/common/platform.js.map +0 -0
  52. package/{lib → build}/index.d.ts +0 -0
  53. package/{lib → build}/index.js +0 -0
  54. package/{lib → build}/index.js.map +0 -0
  55. package/{lib → build}/menu/menu.d.ts +0 -0
  56. package/{lib → build}/menu/menu.js +38 -38
  57. package/build/menu/menu.js.map +1 -0
  58. package/{lib → build}/menu/menuitem.d.ts +10 -2
  59. package/{lib → build}/menu/menuitem.js +70 -34
  60. package/build/menu/menuitem.js.map +1 -0
  61. package/{lib → build}/menubar.d.ts +0 -0
  62. package/{lib → build}/menubar.js +29 -30
  63. package/build/menubar.js.map +1 -0
  64. package/{lib → build}/themebar.d.ts +0 -0
  65. package/{lib → build}/themebar.js +2 -2
  66. package/build/themebar.js.map +1 -0
  67. package/{lib → build}/titlebar.d.ts +0 -0
  68. package/{lib → build}/titlebar.js +61 -58
  69. package/build/titlebar.js.map +1 -0
  70. package/package.json +13 -7
  71. package/lib/common/dom.js.map +0 -1
  72. package/lib/common/enableNativeMenuCommands.d.ts +0 -1
  73. package/lib/common/enableNativeMenuCommands.js +0 -32
  74. package/lib/common/enableNativeMenuCommands.js.map +0 -1
  75. package/lib/common/event.js.map +0 -1
  76. package/lib/main.d.ts +0 -1
  77. package/lib/main.js +0 -14
  78. package/lib/main.js.map +0 -1
  79. package/lib/menu/menu.js.map +0 -1
  80. package/lib/menu/menuitem.js.map +0 -1
  81. package/lib/menubar.js.map +0 -1
  82. package/lib/themebar.js.map +0 -1
  83. package/lib/titlebar.js.map +0 -1
  84. package/lib/vs/base/browser/browser.js +0 -150
  85. package/lib/vs/base/browser/canIUse.js +0 -58
  86. package/lib/vs/base/browser/codicons.js +0 -37
  87. package/lib/vs/base/browser/contextmenu.js +0 -9
  88. package/lib/vs/base/browser/dnd.js +0 -113
  89. package/lib/vs/base/browser/dom.js +0 -1417
  90. package/lib/vs/base/browser/event.js +0 -36
  91. package/lib/vs/base/browser/fastDomNode.js +0 -265
  92. package/lib/vs/base/browser/formattedTextRenderer.js +0 -248
  93. package/lib/vs/base/browser/globalMouseMoveMonitor.js +0 -137
  94. package/lib/vs/base/browser/history.js +0 -9
  95. package/lib/vs/base/browser/iframe.js +0 -126
  96. package/lib/vs/base/browser/keyboardEvent.js +0 -599
  97. package/lib/vs/base/browser/mouseEvent.js +0 -155
  98. package/lib/vs/base/browser/touch.js +0 -315
  99. package/lib/vs/base/browser/ui/actionbar/actionViewItems.js +0 -397
  100. package/lib/vs/base/browser/ui/actionbar/actionbar.js +0 -583
  101. package/lib/vs/base/browser/ui/checkbox/checkbox.js +0 -251
  102. package/lib/vs/base/browser/ui/codicons/codiconLabel.js +0 -31
  103. package/lib/vs/base/browser/ui/codicons/codiconStyles.js +0 -47
  104. package/lib/vs/base/browser/ui/contextview/contextview.js +0 -367
  105. package/lib/vs/base/browser/ui/dropdown/dropdown.js +0 -256
  106. package/lib/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +0 -120
  107. package/lib/vs/base/browser/ui/keybindingLabel/keybindingLabel.js +0 -118
  108. package/lib/vs/base/browser/ui/list/list.js +0 -54
  109. package/lib/vs/base/browser/ui/list/listPaging.js +0 -322
  110. package/lib/vs/base/browser/ui/list/listView.js +0 -1388
  111. package/lib/vs/base/browser/ui/list/listWidget.js +0 -1709
  112. package/lib/vs/base/browser/ui/list/rangeMap.js +0 -223
  113. package/lib/vs/base/browser/ui/list/rowCache.js +0 -113
  114. package/lib/vs/base/browser/ui/list/splice.js +0 -23
  115. package/lib/vs/base/browser/ui/menu/menu.js +0 -1371
  116. package/lib/vs/base/browser/ui/menu/menubar.js +0 -1139
  117. package/lib/vs/base/browser/ui/scrollbar/abstractScrollbar.js +0 -278
  118. package/lib/vs/base/browser/ui/scrollbar/horizontalScrollbar.js +0 -115
  119. package/lib/vs/base/browser/ui/scrollbar/scrollableElement.js +0 -646
  120. package/lib/vs/base/browser/ui/scrollbar/scrollableElementOptions.js +0 -9
  121. package/lib/vs/base/browser/ui/scrollbar/scrollbarArrow.js +0 -106
  122. package/lib/vs/base/browser/ui/scrollbar/scrollbarState.js +0 -184
  123. package/lib/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js +0 -116
  124. package/lib/vs/base/browser/ui/scrollbar/verticalScrollbar.js +0 -114
  125. package/lib/vs/base/browser/ui/selectBox/selectBox.js +0 -85
  126. package/lib/vs/base/browser/ui/selectBox/selectBoxCustom.js +0 -985
  127. package/lib/vs/base/browser/ui/selectBox/selectBoxNative.js +0 -188
  128. package/lib/vs/base/browser/ui/toolbar/toolbar.js +0 -206
  129. package/lib/vs/base/browser/ui/widget.js +0 -69
  130. package/lib/vs/base/common/actions.js +0 -224
  131. package/lib/vs/base/common/amd.js +0 -31
  132. package/lib/vs/base/common/arrays.js +0 -641
  133. package/lib/vs/base/common/assert.js +0 -21
  134. package/lib/vs/base/common/async.js +0 -966
  135. package/lib/vs/base/common/buffer.js +0 -250
  136. package/lib/vs/base/common/cache.js +0 -40
  137. package/lib/vs/base/common/cancellation.js +0 -146
  138. package/lib/vs/base/common/charCode.js +0 -9
  139. package/lib/vs/base/common/codicon.js +0 -136
  140. package/lib/vs/base/common/codicons.js +0 -1378
  141. package/lib/vs/base/common/collections.js +0 -133
  142. package/lib/vs/base/common/color.js +0 -716
  143. package/lib/vs/base/common/comparers.js +0 -280
  144. package/lib/vs/base/common/console.js +0 -142
  145. package/lib/vs/base/common/date.js +0 -113
  146. package/lib/vs/base/common/decorators.js +0 -169
  147. package/lib/vs/base/common/errorMessage.js +0 -93
  148. package/lib/vs/base/common/errors.js +0 -213
  149. package/lib/vs/base/common/errorsWithActions.js +0 -28
  150. package/lib/vs/base/common/event.js +0 -873
  151. package/lib/vs/base/common/extpath.js +0 -401
  152. package/lib/vs/base/common/filters.js +0 -948
  153. package/lib/vs/base/common/functional.js +0 -28
  154. package/lib/vs/base/common/fuzzyScorer.js +0 -811
  155. package/lib/vs/base/common/glob.js +0 -696
  156. package/lib/vs/base/common/hash.js +0 -359
  157. package/lib/vs/base/common/history.js +0 -116
  158. package/lib/vs/base/common/htmlContent.js +0 -162
  159. package/lib/vs/base/common/idGenerator.js +0 -25
  160. package/lib/vs/base/common/iterator.js +0 -118
  161. package/lib/vs/base/common/json.js +0 -1624
  162. package/lib/vs/base/common/jsonEdit.js +0 -272
  163. package/lib/vs/base/common/jsonErrorMessages.js +0 -69
  164. package/lib/vs/base/common/jsonFormatter.js +0 -316
  165. package/lib/vs/base/common/jsonSchema.js +0 -9
  166. package/lib/vs/base/common/keyCodes.js +0 -591
  167. package/lib/vs/base/common/keybindingLabels.js +0 -231
  168. package/lib/vs/base/common/keybindingParser.js +0 -142
  169. package/lib/vs/base/common/labels.js +0 -430
  170. package/lib/vs/base/common/lazy.js +0 -71
  171. package/lib/vs/base/common/lifecycle.js +0 -308
  172. package/lib/vs/base/common/linkedList.js +0 -152
  173. package/lib/vs/base/common/linkedText.js +0 -73
  174. package/lib/vs/base/common/map.js +0 -1108
  175. package/lib/vs/base/common/marshalling.js +0 -80
  176. package/lib/vs/base/common/mime.js +0 -321
  177. package/lib/vs/base/common/navigator.js +0 -50
  178. package/lib/vs/base/common/network.js +0 -160
  179. package/lib/vs/base/common/normalization.js +0 -78
  180. package/lib/vs/base/common/numbers.js +0 -55
  181. package/lib/vs/base/common/objects.js +0 -268
  182. package/lib/vs/base/common/paging.js +0 -190
  183. package/lib/vs/base/common/parsers.js +0 -78
  184. package/lib/vs/base/common/path.js +0 -1550
  185. package/lib/vs/base/common/platform.js +0 -245
  186. package/lib/vs/base/common/process.js +0 -52
  187. package/lib/vs/base/common/processes.js +0 -32
  188. package/lib/vs/base/common/range.js +0 -79
  189. package/lib/vs/base/common/resourceTree.js +0 -185
  190. package/lib/vs/base/common/resources.js +0 -421
  191. package/lib/vs/base/common/scanCode.js +0 -1472
  192. package/lib/vs/base/common/scrollable.js +0 -397
  193. package/lib/vs/base/common/search.js +0 -55
  194. package/lib/vs/base/common/sequence.js +0 -64
  195. package/lib/vs/base/common/severity.js +0 -55
  196. package/lib/vs/base/common/skipList.js +0 -234
  197. package/lib/vs/base/common/stopwatch.js +0 -45
  198. package/lib/vs/base/common/stream.js +0 -418
  199. package/lib/vs/base/common/strings.js +0 -1283
  200. package/lib/vs/base/common/styler.js +0 -9
  201. package/lib/vs/base/common/types.js +0 -296
  202. package/lib/vs/base/common/uint.js +0 -46
  203. package/lib/vs/base/common/uri.js +0 -756
  204. package/lib/vs/base/common/uriIpc.js +0 -154
  205. package/lib/vs/base/common/uuid.js +0 -70
  206. package/lib/vs/nls.mock.js +0 -31
  207. package/lib/vs/platform/actions/browser/menuEntryActionViewItem.js +0 -342
  208. package/lib/vs/platform/actions/common/actions.js +0 -456
  209. package/lib/vs/platform/actions/common/menuService.js +0 -194
  210. package/lib/vs/platform/clipboard/browser/clipboardService.js +0 -99
  211. package/lib/vs/platform/clipboard/common/clipboardService.js +0 -14
  212. package/lib/vs/platform/contextkey/common/contextkey.js +0 -1210
  213. package/lib/vs/platform/contextkey/common/contextkeys.js +0 -23
  214. package/lib/vs/platform/contextview/browser/contextView.js +0 -15
  215. package/lib/vs/platform/contextview/browser/contextViewService.js +0 -96
  216. package/lib/vs/platform/environment/common/argv.js +0 -9
  217. package/lib/vs/platform/environment/common/environment.js +0 -15
  218. package/lib/vs/platform/instantiation/common/descriptors.js +0 -25
  219. package/lib/vs/platform/instantiation/common/extensions.js +0 -26
  220. package/lib/vs/platform/instantiation/common/graph.js +0 -93
  221. package/lib/vs/platform/instantiation/common/instantiation.js +0 -84
  222. package/lib/vs/platform/instantiation/common/instantiationService.js +0 -361
  223. package/lib/vs/platform/instantiation/common/serviceCollection.js +0 -39
  224. package/lib/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -73
  225. package/lib/vs/platform/keybinding/common/keybinding.js +0 -14
  226. package/lib/vs/platform/keybinding/common/keybindingResolver.js +0 -391
  227. package/lib/vs/platform/keybinding/common/keybindingsRegistry.js +0 -229
  228. package/lib/vs/platform/keybinding/common/resolvedKeybindingItem.js +0 -47
  229. package/lib/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js +0 -160
  230. package/lib/vs/platform/layout/browser/layoutService.js +0 -14
  231. package/lib/vs/platform/menubar/common/menubar.js +0 -34
  232. package/lib/vs/platform/registry/common/platform.js +0 -38
  233. package/lib/vs/platform/theme/browser/checkbox.js +0 -32
  234. package/lib/vs/platform/theme/common/colorRegistry.js +0 -1154
  235. package/lib/vs/platform/theme/common/styler.js +0 -290
  236. package/lib/vs/platform/theme/common/theme.js +0 -21
  237. package/lib/vs/platform/theme/common/themeService.js +0 -176
  238. package/lib/vs/platform/theme/common/tokenClassificationRegistry.js +0 -540
  239. 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
- }();