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,1417 +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.multibyteAwareBtoa = exports.detectFullscreen = exports.DetectedFullscreenMode = exports.triggerDownload = exports.asCSSUrl = exports.animate = exports.windowOpenNoOpener = exports.computeScreenAwareSize = exports.domContentLoaded = exports.finalHandler = exports.getElementsByTagName = exports.removeTabIndexAndUpdateFocus = exports.hide = exports.show = exports.join = exports.$ = exports.Namespace = exports.reset = exports.prepend = exports.append = exports.after = exports.trackFocus = exports.restoreParentsScrollTop = exports.saveParentsScrollTop = exports.EventHelper = exports.EventType = exports.isHTMLElement = exports.removeCSSRulesContainingSelector = exports.createCSSRule = exports.createMetaElement = exports.createStyleSheet = exports.getActiveElement = exports.getShadowRoot = exports.isInShadowDOM = exports.isShadowRoot = exports.hasParentWithClass = exports.findParentWithClass = exports.isAncestor = exports.getLargestChildWidth = exports.getTotalHeight = exports.getContentHeight = exports.getTotalScrollWidth = exports.getContentWidth = exports.getTotalWidth = exports.StandardWindow = exports.getDomNodePagePosition = exports.position = exports.size = exports.getTopLeftOffset = exports.Dimension = exports.getClientArea = exports.getComputedStyle = exports.addDisposableThrottledListener = exports.modify = exports.measure = exports.scheduleAtNextAnimationFrame = exports.runAtThisOrScheduleAtNextAnimationFrame = exports.addDisposableNonBubblingPointerOutListener = exports.addDisposableNonBubblingMouseOutListener = exports.addDisposableGenericMouseUpListner = exports.addDisposableGenericMouseMoveListner = exports.addDisposableGenericMouseDownListner = exports.addStandardDisposableGenericMouseUpListner = exports.addStandardDisposableGenericMouseDownListner = exports.addStandardDisposableListener = exports.addDisposableListener = exports.toggleClass = exports.removeClasses = exports.addClasses = exports.addClass = exports.isInDOM = exports.clearNode = void 0;
11
-
12
- const browser = require("./browser");
13
-
14
- const event_1 = require("./event");
15
-
16
- const keyboardEvent_1 = require("./keyboardEvent");
17
-
18
- const mouseEvent_1 = require("./mouseEvent");
19
-
20
- const async_1 = require("../common/async");
21
-
22
- const errors_1 = require("../common/errors");
23
-
24
- const event_2 = require("../common/event");
25
-
26
- const lifecycle_1 = require("../common/lifecycle");
27
-
28
- const platform = require("../common/platform");
29
-
30
- const uri_1 = require("../common/uri");
31
-
32
- const network_1 = require("../common/network");
33
-
34
- const canIUse_1 = require("./canIUse");
35
-
36
- function clearNode(node) {
37
- while (node.firstChild) {
38
- node.removeChild(node.firstChild);
39
- }
40
- }
41
-
42
- exports.clearNode = clearNode;
43
-
44
- function isInDOM(node) {
45
- while (node) {
46
- if (node === document.body) {
47
- return true;
48
- }
49
-
50
- node = node.parentNode || node.host;
51
- }
52
-
53
- return false;
54
- }
55
-
56
- exports.isInDOM = isInDOM;
57
-
58
- const _classList = new class {
59
- addClasses(node, ...classNames) {
60
- classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.addClass(node, name)));
61
- }
62
-
63
- addClass(node, className) {
64
- if (className && node.classList) {
65
- node.classList.add(className);
66
- }
67
- }
68
-
69
- removeClass(node, className) {
70
- if (className && node.classList) {
71
- node.classList.remove(className);
72
- }
73
- }
74
-
75
- removeClasses(node, ...classNames) {
76
- classNames.forEach(nameValue => nameValue.split(' ').forEach(name => this.removeClass(node, name)));
77
- }
78
-
79
- toggleClass(node, className, shouldHaveIt) {
80
- if (node.classList) {
81
- node.classList.toggle(className, shouldHaveIt);
82
- }
83
- }
84
-
85
- }();
86
- /** @deprecated ES6 - use classList*/
87
-
88
-
89
- function addClass(node, className) {
90
- return _classList.addClass(node, className);
91
- }
92
-
93
- exports.addClass = addClass;
94
- /** @deprecated ES6 - use classList*/
95
-
96
- function addClasses(node, ...classNames) {
97
- return _classList.addClasses(node, ...classNames);
98
- }
99
-
100
- exports.addClasses = addClasses;
101
- /** @deprecated ES6 - use classList*/
102
-
103
- function removeClasses(node, ...classNames) {
104
- return _classList.removeClasses(node, ...classNames);
105
- }
106
-
107
- exports.removeClasses = removeClasses;
108
- /** @deprecated ES6 - use classList*/
109
-
110
- function toggleClass(node, className, shouldHaveIt) {
111
- return _classList.toggleClass(node, className, shouldHaveIt);
112
- }
113
-
114
- exports.toggleClass = toggleClass;
115
-
116
- class DomListener {
117
- constructor(node, type, handler, options) {
118
- this._node = node;
119
- this._type = type;
120
- this._handler = handler;
121
- this._options = options || false;
122
-
123
- this._node.addEventListener(this._type, this._handler, this._options);
124
- }
125
-
126
- dispose() {
127
- if (!this._handler) {
128
- // Already disposed
129
- return;
130
- }
131
-
132
- this._node.removeEventListener(this._type, this._handler, this._options); // Prevent leakers from holding on to the dom or handler func
133
-
134
-
135
- this._node = null;
136
- this._handler = null;
137
- }
138
-
139
- }
140
-
141
- function addDisposableListener(node, type, handler, useCaptureOrOptions) {
142
- return new DomListener(node, type, handler, useCaptureOrOptions);
143
- }
144
-
145
- exports.addDisposableListener = addDisposableListener;
146
-
147
- function _wrapAsStandardMouseEvent(handler) {
148
- return function (e) {
149
- return handler(new mouseEvent_1.StandardMouseEvent(e));
150
- };
151
- }
152
-
153
- function _wrapAsStandardKeyboardEvent(handler) {
154
- return function (e) {
155
- return handler(new keyboardEvent_1.StandardKeyboardEvent(e));
156
- };
157
- }
158
-
159
- exports.addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {
160
- let wrapHandler = handler;
161
-
162
- if (type === 'click' || type === 'mousedown') {
163
- wrapHandler = _wrapAsStandardMouseEvent(handler);
164
- } else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {
165
- wrapHandler = _wrapAsStandardKeyboardEvent(handler);
166
- }
167
-
168
- return addDisposableListener(node, type, wrapHandler, useCapture);
169
- };
170
-
171
- exports.addStandardDisposableGenericMouseDownListner = function addStandardDisposableListener(node, handler, useCapture) {
172
- let wrapHandler = _wrapAsStandardMouseEvent(handler);
173
-
174
- return addDisposableGenericMouseDownListner(node, wrapHandler, useCapture);
175
- };
176
-
177
- exports.addStandardDisposableGenericMouseUpListner = function addStandardDisposableListener(node, handler, useCapture) {
178
- let wrapHandler = _wrapAsStandardMouseEvent(handler);
179
-
180
- return addDisposableGenericMouseUpListner(node, wrapHandler, useCapture);
181
- };
182
-
183
- function addDisposableGenericMouseDownListner(node, handler, useCapture) {
184
- return addDisposableListener(node, platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? exports.EventType.POINTER_DOWN : exports.EventType.MOUSE_DOWN, handler, useCapture);
185
- }
186
-
187
- exports.addDisposableGenericMouseDownListner = addDisposableGenericMouseDownListner;
188
-
189
- function addDisposableGenericMouseMoveListner(node, handler, useCapture) {
190
- return addDisposableListener(node, platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? exports.EventType.POINTER_MOVE : exports.EventType.MOUSE_MOVE, handler, useCapture);
191
- }
192
-
193
- exports.addDisposableGenericMouseMoveListner = addDisposableGenericMouseMoveListner;
194
-
195
- function addDisposableGenericMouseUpListner(node, handler, useCapture) {
196
- return addDisposableListener(node, platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? exports.EventType.POINTER_UP : exports.EventType.MOUSE_UP, handler, useCapture);
197
- }
198
-
199
- exports.addDisposableGenericMouseUpListner = addDisposableGenericMouseUpListner;
200
-
201
- function addDisposableNonBubblingMouseOutListener(node, handler) {
202
- return addDisposableListener(node, 'mouseout', e => {
203
- // Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements
204
- let toElement = e.relatedTarget;
205
-
206
- while (toElement && toElement !== node) {
207
- toElement = toElement.parentNode;
208
- }
209
-
210
- if (toElement === node) {
211
- return;
212
- }
213
-
214
- handler(e);
215
- });
216
- }
217
-
218
- exports.addDisposableNonBubblingMouseOutListener = addDisposableNonBubblingMouseOutListener;
219
-
220
- function addDisposableNonBubblingPointerOutListener(node, handler) {
221
- return addDisposableListener(node, 'pointerout', e => {
222
- // Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements
223
- let toElement = e.relatedTarget;
224
-
225
- while (toElement && toElement !== node) {
226
- toElement = toElement.parentNode;
227
- }
228
-
229
- if (toElement === node) {
230
- return;
231
- }
232
-
233
- handler(e);
234
- });
235
- }
236
-
237
- exports.addDisposableNonBubblingPointerOutListener = addDisposableNonBubblingPointerOutListener;
238
- let _animationFrame = null;
239
-
240
- function doRequestAnimationFrame(callback) {
241
- if (!_animationFrame) {
242
- const emulatedRequestAnimationFrame = callback => {
243
- return setTimeout(() => callback(new Date().getTime()), 0);
244
- };
245
-
246
- _animationFrame = self.requestAnimationFrame || self.msRequestAnimationFrame || self.webkitRequestAnimationFrame || self.mozRequestAnimationFrame || self.oRequestAnimationFrame || emulatedRequestAnimationFrame;
247
- }
248
-
249
- return _animationFrame.call(self, callback);
250
- }
251
-
252
- class AnimationFrameQueueItem {
253
- constructor(runner, priority = 0) {
254
- this._runner = runner;
255
- this.priority = priority;
256
- this._canceled = false;
257
- }
258
-
259
- dispose() {
260
- this._canceled = true;
261
- }
262
-
263
- execute() {
264
- if (this._canceled) {
265
- return;
266
- }
267
-
268
- try {
269
- this._runner();
270
- } catch (e) {
271
- errors_1.onUnexpectedError(e);
272
- }
273
- } // Sort by priority (largest to lowest)
274
-
275
-
276
- static sort(a, b) {
277
- return b.priority - a.priority;
278
- }
279
-
280
- }
281
-
282
- (function () {
283
- /**
284
- * The runners scheduled at the next animation frame
285
- */
286
- let NEXT_QUEUE = [];
287
- /**
288
- * The runners scheduled at the current animation frame
289
- */
290
-
291
- let CURRENT_QUEUE = null;
292
- /**
293
- * A flag to keep track if the native requestAnimationFrame was already called
294
- */
295
-
296
- let animFrameRequested = false;
297
- /**
298
- * A flag to indicate if currently handling a native requestAnimationFrame callback
299
- */
300
-
301
- let inAnimationFrameRunner = false;
302
-
303
- let animationFrameRunner = () => {
304
- animFrameRequested = false;
305
- CURRENT_QUEUE = NEXT_QUEUE;
306
- NEXT_QUEUE = [];
307
- inAnimationFrameRunner = true;
308
-
309
- while (CURRENT_QUEUE.length > 0) {
310
- CURRENT_QUEUE.sort(AnimationFrameQueueItem.sort);
311
- let top = CURRENT_QUEUE.shift();
312
- top.execute();
313
- }
314
-
315
- inAnimationFrameRunner = false;
316
- };
317
-
318
- exports.scheduleAtNextAnimationFrame = (runner, priority = 0) => {
319
- let item = new AnimationFrameQueueItem(runner, priority);
320
- NEXT_QUEUE.push(item);
321
-
322
- if (!animFrameRequested) {
323
- animFrameRequested = true;
324
- doRequestAnimationFrame(animationFrameRunner);
325
- }
326
-
327
- return item;
328
- };
329
-
330
- exports.runAtThisOrScheduleAtNextAnimationFrame = (runner, priority) => {
331
- if (inAnimationFrameRunner) {
332
- let item = new AnimationFrameQueueItem(runner, priority);
333
- CURRENT_QUEUE.push(item);
334
- return item;
335
- } else {
336
- return exports.scheduleAtNextAnimationFrame(runner, priority);
337
- }
338
- };
339
- })();
340
-
341
- function measure(callback) {
342
- return exports.scheduleAtNextAnimationFrame(callback, 10000
343
- /* must be early */
344
- );
345
- }
346
-
347
- exports.measure = measure;
348
-
349
- function modify(callback) {
350
- return exports.scheduleAtNextAnimationFrame(callback, -10000
351
- /* must be late */
352
- );
353
- }
354
-
355
- exports.modify = modify;
356
- const MINIMUM_TIME_MS = 16;
357
-
358
- const DEFAULT_EVENT_MERGER = function (lastEvent, currentEvent) {
359
- return currentEvent;
360
- };
361
-
362
- class TimeoutThrottledDomListener extends lifecycle_1.Disposable {
363
- constructor(node, type, handler, eventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs = MINIMUM_TIME_MS) {
364
- super();
365
- let lastEvent = null;
366
- let lastHandlerTime = 0;
367
-
368
- let timeout = this._register(new async_1.TimeoutTimer());
369
-
370
- let invokeHandler = () => {
371
- lastHandlerTime = new Date().getTime();
372
- handler(lastEvent);
373
- lastEvent = null;
374
- };
375
-
376
- this._register(addDisposableListener(node, type, e => {
377
- lastEvent = eventMerger(lastEvent, e);
378
- let elapsedTime = new Date().getTime() - lastHandlerTime;
379
-
380
- if (elapsedTime >= minimumTimeMs) {
381
- timeout.cancel();
382
- invokeHandler();
383
- } else {
384
- timeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);
385
- }
386
- }));
387
- }
388
-
389
- }
390
-
391
- function addDisposableThrottledListener(node, type, handler, eventMerger, minimumTimeMs) {
392
- return new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);
393
- }
394
-
395
- exports.addDisposableThrottledListener = addDisposableThrottledListener;
396
-
397
- function getComputedStyle(el) {
398
- return document.defaultView.getComputedStyle(el, null);
399
- }
400
-
401
- exports.getComputedStyle = getComputedStyle;
402
-
403
- function getClientArea(element) {
404
- // Try with DOM clientWidth / clientHeight
405
- if (element !== document.body) {
406
- return new Dimension(element.clientWidth, element.clientHeight);
407
- } // If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight
408
-
409
-
410
- if (platform.isIOS && window.visualViewport) {
411
- const width = window.visualViewport.width;
412
- const height = window.visualViewport.height - (browser.isStandalone // in PWA mode, the visual viewport always includes the safe-area-inset-bottom (which is for the home indicator)
413
- // even when you are using the onscreen monitor, the visual viewport will include the area between system statusbar and the onscreen keyboard
414
- // plus the area between onscreen keyboard and the bottom bezel, which is 20px on iOS.
415
- ? 20 + 4 : // + 4px for body margin
416
- 0);
417
- return new Dimension(width, height);
418
- } // Try innerWidth / innerHeight
419
-
420
-
421
- if (window.innerWidth && window.innerHeight) {
422
- return new Dimension(window.innerWidth, window.innerHeight);
423
- } // Try with document.body.clientWidth / document.body.clientHeight
424
-
425
-
426
- if (document.body && document.body.clientWidth && document.body.clientHeight) {
427
- return new Dimension(document.body.clientWidth, document.body.clientHeight);
428
- } // Try with document.documentElement.clientWidth / document.documentElement.clientHeight
429
-
430
-
431
- if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight) {
432
- return new Dimension(document.documentElement.clientWidth, document.documentElement.clientHeight);
433
- }
434
-
435
- throw new Error('Unable to figure out browser width and height');
436
- }
437
-
438
- exports.getClientArea = getClientArea;
439
-
440
- class SizeUtils {
441
- // Adapted from WinJS
442
- // Converts a CSS positioning string for the specified element to pixels.
443
- static convertToPixels(element, value) {
444
- return parseFloat(value) || 0;
445
- }
446
-
447
- static getDimension(element, cssPropertyName, jsPropertyName) {
448
- let computedStyle = getComputedStyle(element);
449
- let value = '0';
450
-
451
- if (computedStyle) {
452
- if (computedStyle.getPropertyValue) {
453
- value = computedStyle.getPropertyValue(cssPropertyName);
454
- } else {
455
- // IE8
456
- value = computedStyle.getAttribute(jsPropertyName);
457
- }
458
- }
459
-
460
- return SizeUtils.convertToPixels(element, value);
461
- }
462
-
463
- static getBorderLeftWidth(element) {
464
- return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');
465
- }
466
-
467
- static getBorderRightWidth(element) {
468
- return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');
469
- }
470
-
471
- static getBorderTopWidth(element) {
472
- return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');
473
- }
474
-
475
- static getBorderBottomWidth(element) {
476
- return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');
477
- }
478
-
479
- static getPaddingLeft(element) {
480
- return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');
481
- }
482
-
483
- static getPaddingRight(element) {
484
- return SizeUtils.getDimension(element, 'padding-right', 'paddingRight');
485
- }
486
-
487
- static getPaddingTop(element) {
488
- return SizeUtils.getDimension(element, 'padding-top', 'paddingTop');
489
- }
490
-
491
- static getPaddingBottom(element) {
492
- return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');
493
- }
494
-
495
- static getMarginLeft(element) {
496
- return SizeUtils.getDimension(element, 'margin-left', 'marginLeft');
497
- }
498
-
499
- static getMarginTop(element) {
500
- return SizeUtils.getDimension(element, 'margin-top', 'marginTop');
501
- }
502
-
503
- static getMarginRight(element) {
504
- return SizeUtils.getDimension(element, 'margin-right', 'marginRight');
505
- }
506
-
507
- static getMarginBottom(element) {
508
- return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');
509
- }
510
-
511
- }
512
-
513
- class Dimension {
514
- constructor(width, height) {
515
- this.width = width;
516
- this.height = height;
517
- }
518
-
519
- static equals(a, b) {
520
- if (a === b) {
521
- return true;
522
- }
523
-
524
- if (!a || !b) {
525
- return false;
526
- }
527
-
528
- return a.width === b.width && a.height === b.height;
529
- }
530
-
531
- }
532
-
533
- exports.Dimension = Dimension;
534
-
535
- function getTopLeftOffset(element) {
536
- // Adapted from WinJS.Utilities.getPosition
537
- // and added borders to the mix
538
- let offsetParent = element.offsetParent;
539
- let top = element.offsetTop;
540
- let left = element.offsetLeft;
541
-
542
- while ((element = element.parentNode) !== null && element !== document.body && element !== document.documentElement) {
543
- top -= element.scrollTop;
544
- const c = isShadowRoot(element) ? null : getComputedStyle(element);
545
-
546
- if (c) {
547
- left -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;
548
- }
549
-
550
- if (element === offsetParent) {
551
- left += SizeUtils.getBorderLeftWidth(element);
552
- top += SizeUtils.getBorderTopWidth(element);
553
- top += element.offsetTop;
554
- left += element.offsetLeft;
555
- offsetParent = element.offsetParent;
556
- }
557
- }
558
-
559
- return {
560
- left: left,
561
- top: top
562
- };
563
- }
564
-
565
- exports.getTopLeftOffset = getTopLeftOffset;
566
-
567
- function size(element, width, height) {
568
- if (typeof width === 'number') {
569
- element.style.width = `${width}px`;
570
- }
571
-
572
- if (typeof height === 'number') {
573
- element.style.height = `${height}px`;
574
- }
575
- }
576
-
577
- exports.size = size;
578
-
579
- function position(element, top, right, bottom, left, position = 'absolute') {
580
- if (typeof top === 'number') {
581
- element.style.top = `${top}px`;
582
- }
583
-
584
- if (typeof right === 'number') {
585
- element.style.right = `${right}px`;
586
- }
587
-
588
- if (typeof bottom === 'number') {
589
- element.style.bottom = `${bottom}px`;
590
- }
591
-
592
- if (typeof left === 'number') {
593
- element.style.left = `${left}px`;
594
- }
595
-
596
- element.style.position = position;
597
- }
598
-
599
- exports.position = position;
600
- /**
601
- * Returns the position of a dom node relative to the entire page.
602
- */
603
-
604
- function getDomNodePagePosition(domNode) {
605
- let bb = domNode.getBoundingClientRect();
606
- return {
607
- left: bb.left + exports.StandardWindow.scrollX,
608
- top: bb.top + exports.StandardWindow.scrollY,
609
- width: bb.width,
610
- height: bb.height
611
- };
612
- }
613
-
614
- exports.getDomNodePagePosition = getDomNodePagePosition;
615
- exports.StandardWindow = new class {
616
- get scrollX() {
617
- if (typeof window.scrollX === 'number') {
618
- // modern browsers
619
- return window.scrollX;
620
- } else {
621
- return document.body.scrollLeft + document.documentElement.scrollLeft;
622
- }
623
- }
624
-
625
- get scrollY() {
626
- if (typeof window.scrollY === 'number') {
627
- // modern browsers
628
- return window.scrollY;
629
- } else {
630
- return document.body.scrollTop + document.documentElement.scrollTop;
631
- }
632
- }
633
-
634
- }(); // Adapted from WinJS
635
- // Gets the width of the element, including margins.
636
-
637
- function getTotalWidth(element) {
638
- let margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);
639
- return element.offsetWidth + margin;
640
- }
641
-
642
- exports.getTotalWidth = getTotalWidth;
643
-
644
- function getContentWidth(element) {
645
- let border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);
646
- let padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);
647
- return element.offsetWidth - border - padding;
648
- }
649
-
650
- exports.getContentWidth = getContentWidth;
651
-
652
- function getTotalScrollWidth(element) {
653
- let margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);
654
- return element.scrollWidth + margin;
655
- }
656
-
657
- exports.getTotalScrollWidth = getTotalScrollWidth; // Adapted from WinJS
658
- // Gets the height of the content of the specified element. The content height does not include borders or padding.
659
-
660
- function getContentHeight(element) {
661
- let border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);
662
- let padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);
663
- return element.offsetHeight - border - padding;
664
- }
665
-
666
- exports.getContentHeight = getContentHeight; // Adapted from WinJS
667
- // Gets the height of the element, including its margins.
668
-
669
- function getTotalHeight(element) {
670
- let margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);
671
- return element.offsetHeight + margin;
672
- }
673
-
674
- exports.getTotalHeight = getTotalHeight; // Gets the left coordinate of the specified element relative to the specified parent.
675
-
676
- function getRelativeLeft(element, parent) {
677
- if (element === null) {
678
- return 0;
679
- }
680
-
681
- let elementPosition = getTopLeftOffset(element);
682
- let parentPosition = getTopLeftOffset(parent);
683
- return elementPosition.left - parentPosition.left;
684
- }
685
-
686
- function getLargestChildWidth(parent, children) {
687
- let childWidths = children.map(child => {
688
- return Math.max(getTotalScrollWidth(child), getTotalWidth(child)) + getRelativeLeft(child, parent) || 0;
689
- });
690
- let maxWidth = Math.max(...childWidths);
691
- return maxWidth;
692
- }
693
-
694
- exports.getLargestChildWidth = getLargestChildWidth; // ----------------------------------------------------------------------------------------
695
-
696
- function isAncestor(testChild, testAncestor) {
697
- while (testChild) {
698
- if (testChild === testAncestor) {
699
- return true;
700
- }
701
-
702
- testChild = testChild.parentNode;
703
- }
704
-
705
- return false;
706
- }
707
-
708
- exports.isAncestor = isAncestor;
709
-
710
- function findParentWithClass(node, clazz, stopAtClazzOrNode) {
711
- while (node && node.nodeType === node.ELEMENT_NODE) {
712
- if (node.classList.contains(clazz)) {
713
- return node;
714
- }
715
-
716
- if (stopAtClazzOrNode) {
717
- if (typeof stopAtClazzOrNode === 'string') {
718
- if (node.classList.contains(stopAtClazzOrNode)) {
719
- return null;
720
- }
721
- } else {
722
- if (node === stopAtClazzOrNode) {
723
- return null;
724
- }
725
- }
726
- }
727
-
728
- node = node.parentNode;
729
- }
730
-
731
- return null;
732
- }
733
-
734
- exports.findParentWithClass = findParentWithClass;
735
-
736
- function hasParentWithClass(node, clazz, stopAtClazzOrNode) {
737
- return !!findParentWithClass(node, clazz, stopAtClazzOrNode);
738
- }
739
-
740
- exports.hasParentWithClass = hasParentWithClass;
741
-
742
- function isShadowRoot(node) {
743
- return node && !!node.host && !!node.mode;
744
- }
745
-
746
- exports.isShadowRoot = isShadowRoot;
747
-
748
- function isInShadowDOM(domNode) {
749
- return !!getShadowRoot(domNode);
750
- }
751
-
752
- exports.isInShadowDOM = isInShadowDOM;
753
-
754
- function getShadowRoot(domNode) {
755
- while (domNode.parentNode) {
756
- if (domNode === document.body) {
757
- // reached the body
758
- return null;
759
- }
760
-
761
- domNode = domNode.parentNode;
762
- }
763
-
764
- return isShadowRoot(domNode) ? domNode : null;
765
- }
766
-
767
- exports.getShadowRoot = getShadowRoot;
768
-
769
- function getActiveElement() {
770
- let result = document.activeElement;
771
-
772
- while (result === null || result === void 0 ? void 0 : result.shadowRoot) {
773
- result = result.shadowRoot.activeElement;
774
- }
775
-
776
- return result;
777
- }
778
-
779
- exports.getActiveElement = getActiveElement;
780
-
781
- function createStyleSheet(container = document.getElementsByTagName('head')[0]) {
782
- let style = document.createElement('style');
783
- style.type = 'text/css';
784
- style.media = 'screen';
785
- container.appendChild(style);
786
- return style;
787
- }
788
-
789
- exports.createStyleSheet = createStyleSheet;
790
-
791
- function createMetaElement(container = document.getElementsByTagName('head')[0]) {
792
- let meta = document.createElement('meta');
793
- container.appendChild(meta);
794
- return meta;
795
- }
796
-
797
- exports.createMetaElement = createMetaElement;
798
- let _sharedStyleSheet = null;
799
-
800
- function getSharedStyleSheet() {
801
- if (!_sharedStyleSheet) {
802
- _sharedStyleSheet = createStyleSheet();
803
- }
804
-
805
- return _sharedStyleSheet;
806
- }
807
-
808
- function getDynamicStyleSheetRules(style) {
809
- var _a, _b;
810
-
811
- if ((_a = style === null || style === void 0 ? void 0 : style.sheet) === null || _a === void 0 ? void 0 : _a.rules) {
812
- // Chrome, IE
813
- return style.sheet.rules;
814
- }
815
-
816
- if ((_b = style === null || style === void 0 ? void 0 : style.sheet) === null || _b === void 0 ? void 0 : _b.cssRules) {
817
- // FF
818
- return style.sheet.cssRules;
819
- }
820
-
821
- return [];
822
- }
823
-
824
- function createCSSRule(selector, cssText, style = getSharedStyleSheet()) {
825
- if (!style || !cssText) {
826
- return;
827
- }
828
-
829
- style.sheet.insertRule(selector + '{' + cssText + '}', 0);
830
- }
831
-
832
- exports.createCSSRule = createCSSRule;
833
-
834
- function removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) {
835
- if (!style) {
836
- return;
837
- }
838
-
839
- let rules = getDynamicStyleSheetRules(style);
840
- let toDelete = [];
841
-
842
- for (let i = 0; i < rules.length; i++) {
843
- let rule = rules[i];
844
-
845
- if (rule.selectorText.indexOf(ruleName) !== -1) {
846
- toDelete.push(i);
847
- }
848
- }
849
-
850
- for (let i = toDelete.length - 1; i >= 0; i--) {
851
- style.sheet.deleteRule(toDelete[i]);
852
- }
853
- }
854
-
855
- exports.removeCSSRulesContainingSelector = removeCSSRulesContainingSelector;
856
-
857
- function isHTMLElement(o) {
858
- if (typeof HTMLElement === 'object') {
859
- return o instanceof HTMLElement;
860
- }
861
-
862
- return o && typeof o === 'object' && o.nodeType === 1 && typeof o.nodeName === 'string';
863
- }
864
-
865
- exports.isHTMLElement = isHTMLElement;
866
- exports.EventType = {
867
- // Mouse
868
- CLICK: 'click',
869
- AUXCLICK: 'auxclick',
870
- DBLCLICK: 'dblclick',
871
- MOUSE_UP: 'mouseup',
872
- MOUSE_DOWN: 'mousedown',
873
- MOUSE_OVER: 'mouseover',
874
- MOUSE_MOVE: 'mousemove',
875
- MOUSE_OUT: 'mouseout',
876
- MOUSE_ENTER: 'mouseenter',
877
- MOUSE_LEAVE: 'mouseleave',
878
- MOUSE_WHEEL: browser.isEdge ? 'mousewheel' : 'wheel',
879
- POINTER_UP: 'pointerup',
880
- POINTER_DOWN: 'pointerdown',
881
- POINTER_MOVE: 'pointermove',
882
- CONTEXT_MENU: 'contextmenu',
883
- WHEEL: 'wheel',
884
- // Keyboard
885
- KEY_DOWN: 'keydown',
886
- KEY_PRESS: 'keypress',
887
- KEY_UP: 'keyup',
888
- // HTML Document
889
- LOAD: 'load',
890
- BEFORE_UNLOAD: 'beforeunload',
891
- UNLOAD: 'unload',
892
- ABORT: 'abort',
893
- ERROR: 'error',
894
- RESIZE: 'resize',
895
- SCROLL: 'scroll',
896
- FULLSCREEN_CHANGE: 'fullscreenchange',
897
- WK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',
898
- // Form
899
- SELECT: 'select',
900
- CHANGE: 'change',
901
- SUBMIT: 'submit',
902
- RESET: 'reset',
903
- FOCUS: 'focus',
904
- FOCUS_IN: 'focusin',
905
- FOCUS_OUT: 'focusout',
906
- BLUR: 'blur',
907
- INPUT: 'input',
908
- // Local Storage
909
- STORAGE: 'storage',
910
- // Drag
911
- DRAG_START: 'dragstart',
912
- DRAG: 'drag',
913
- DRAG_ENTER: 'dragenter',
914
- DRAG_LEAVE: 'dragleave',
915
- DRAG_OVER: 'dragover',
916
- DROP: 'drop',
917
- DRAG_END: 'dragend',
918
- // Animation
919
- ANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',
920
- ANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',
921
- ANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'
922
- };
923
- exports.EventHelper = {
924
- stop: function (e, cancelBubble) {
925
- if (e.preventDefault) {
926
- e.preventDefault();
927
- } else {
928
- // IE8
929
- e.returnValue = false;
930
- }
931
-
932
- if (cancelBubble) {
933
- if (e.stopPropagation) {
934
- e.stopPropagation();
935
- } else {
936
- // IE8
937
- e.cancelBubble = true;
938
- }
939
- }
940
- }
941
- };
942
-
943
- function saveParentsScrollTop(node) {
944
- let r = [];
945
-
946
- for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
947
- r[i] = node.scrollTop;
948
- node = node.parentNode;
949
- }
950
-
951
- return r;
952
- }
953
-
954
- exports.saveParentsScrollTop = saveParentsScrollTop;
955
-
956
- function restoreParentsScrollTop(node, state) {
957
- for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
958
- if (node.scrollTop !== state[i]) {
959
- node.scrollTop = state[i];
960
- }
961
-
962
- node = node.parentNode;
963
- }
964
- }
965
-
966
- exports.restoreParentsScrollTop = restoreParentsScrollTop;
967
-
968
- class FocusTracker extends lifecycle_1.Disposable {
969
- constructor(element) {
970
- super();
971
- this._onDidFocus = this._register(new event_2.Emitter());
972
- this.onDidFocus = this._onDidFocus.event;
973
- this._onDidBlur = this._register(new event_2.Emitter());
974
- this.onDidBlur = this._onDidBlur.event;
975
- let hasFocus = isAncestor(document.activeElement, element);
976
- let loosingFocus = false;
977
-
978
- const onFocus = () => {
979
- loosingFocus = false;
980
-
981
- if (!hasFocus) {
982
- hasFocus = true;
983
-
984
- this._onDidFocus.fire();
985
- }
986
- };
987
-
988
- const onBlur = () => {
989
- if (hasFocus) {
990
- loosingFocus = true;
991
- window.setTimeout(() => {
992
- if (loosingFocus) {
993
- loosingFocus = false;
994
- hasFocus = false;
995
-
996
- this._onDidBlur.fire();
997
- }
998
- }, 0);
999
- }
1000
- };
1001
-
1002
- this._refreshStateHandler = () => {
1003
- let currentNodeHasFocus = isAncestor(document.activeElement, element);
1004
-
1005
- if (currentNodeHasFocus !== hasFocus) {
1006
- if (hasFocus) {
1007
- onBlur();
1008
- } else {
1009
- onFocus();
1010
- }
1011
- }
1012
- };
1013
-
1014
- this._register(event_1.domEvent(element, exports.EventType.FOCUS, true)(onFocus));
1015
-
1016
- this._register(event_1.domEvent(element, exports.EventType.BLUR, true)(onBlur));
1017
- }
1018
-
1019
- refreshState() {
1020
- this._refreshStateHandler();
1021
- }
1022
-
1023
- }
1024
-
1025
- function trackFocus(element) {
1026
- return new FocusTracker(element);
1027
- }
1028
-
1029
- exports.trackFocus = trackFocus;
1030
-
1031
- function after(sibling, child) {
1032
- sibling.after(child);
1033
- return child;
1034
- }
1035
-
1036
- exports.after = after;
1037
-
1038
- function append(parent, ...children) {
1039
- children.forEach(child => parent.appendChild(child));
1040
- return children[children.length - 1];
1041
- }
1042
-
1043
- exports.append = append;
1044
-
1045
- function prepend(parent, child) {
1046
- parent.insertBefore(child, parent.firstChild);
1047
- return child;
1048
- }
1049
-
1050
- exports.prepend = prepend;
1051
- /**
1052
- * Removes all children from `parent` and appends `children`
1053
- */
1054
-
1055
- function reset(parent, ...children) {
1056
- parent.innerText = '';
1057
-
1058
- for (const child of children) {
1059
- if (child instanceof Node) {
1060
- parent.appendChild(child);
1061
- } else if (typeof child === 'string') {
1062
- parent.appendChild(document.createTextNode(child));
1063
- }
1064
- }
1065
- }
1066
-
1067
- exports.reset = reset;
1068
- const SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;
1069
- var Namespace;
1070
-
1071
- (function (Namespace) {
1072
- Namespace["HTML"] = "http://www.w3.org/1999/xhtml";
1073
- Namespace["SVG"] = "http://www.w3.org/2000/svg";
1074
- })(Namespace = exports.Namespace || (exports.Namespace = {}));
1075
-
1076
- function _$(namespace, description, attrs, ...children) {
1077
- let match = SELECTOR_REGEX.exec(description);
1078
-
1079
- if (!match) {
1080
- throw new Error('Bad use of emmet');
1081
- }
1082
-
1083
- attrs = { ...(attrs || {})
1084
- };
1085
- let tagName = match[1] || 'div';
1086
- let result;
1087
-
1088
- if (namespace !== Namespace.HTML) {
1089
- result = document.createElementNS(namespace, tagName);
1090
- } else {
1091
- result = document.createElement(tagName);
1092
- }
1093
-
1094
- if (match[3]) {
1095
- result.id = match[3];
1096
- }
1097
-
1098
- if (match[4]) {
1099
- result.className = match[4].replace(/\./g, ' ').trim();
1100
- }
1101
-
1102
- Object.keys(attrs).forEach(name => {
1103
- const value = attrs[name];
1104
-
1105
- if (typeof value === 'undefined') {
1106
- return;
1107
- }
1108
-
1109
- if (/^on\w+$/.test(name)) {
1110
- result[name] = value;
1111
- } else if (name === 'selected') {
1112
- if (value) {
1113
- result.setAttribute(name, 'true');
1114
- }
1115
- } else {
1116
- result.setAttribute(name, value);
1117
- }
1118
- });
1119
-
1120
- for (const child of children) {
1121
- if (child instanceof Node) {
1122
- result.appendChild(child);
1123
- } else if (typeof child === 'string') {
1124
- result.appendChild(document.createTextNode(child));
1125
- }
1126
- }
1127
-
1128
- return result;
1129
- }
1130
-
1131
- function $(description, attrs, ...children) {
1132
- return _$(Namespace.HTML, description, attrs, ...children);
1133
- }
1134
-
1135
- exports.$ = $;
1136
-
1137
- $.SVG = function (description, attrs, ...children) {
1138
- return _$(Namespace.SVG, description, attrs, ...children);
1139
- };
1140
-
1141
- function join(nodes, separator) {
1142
- const result = [];
1143
- nodes.forEach((node, index) => {
1144
- if (index > 0) {
1145
- if (separator instanceof Node) {
1146
- result.push(separator.cloneNode());
1147
- } else {
1148
- result.push(document.createTextNode(separator));
1149
- }
1150
- }
1151
-
1152
- result.push(node);
1153
- });
1154
- return result;
1155
- }
1156
-
1157
- exports.join = join;
1158
-
1159
- function show(...elements) {
1160
- for (let element of elements) {
1161
- element.style.display = '';
1162
- element.removeAttribute('aria-hidden');
1163
- }
1164
- }
1165
-
1166
- exports.show = show;
1167
-
1168
- function hide(...elements) {
1169
- for (let element of elements) {
1170
- element.style.display = 'none';
1171
- element.setAttribute('aria-hidden', 'true');
1172
- }
1173
- }
1174
-
1175
- exports.hide = hide;
1176
-
1177
- function findParentWithAttribute(node, attribute) {
1178
- while (node && node.nodeType === node.ELEMENT_NODE) {
1179
- if (node instanceof HTMLElement && node.hasAttribute(attribute)) {
1180
- return node;
1181
- }
1182
-
1183
- node = node.parentNode;
1184
- }
1185
-
1186
- return null;
1187
- }
1188
-
1189
- function removeTabIndexAndUpdateFocus(node) {
1190
- if (!node || !node.hasAttribute('tabIndex')) {
1191
- return;
1192
- } // If we are the currently focused element and tabIndex is removed,
1193
- // standard DOM behavior is to move focus to the <body> element. We
1194
- // typically never want that, rather put focus to the closest element
1195
- // in the hierarchy of the parent DOM nodes.
1196
-
1197
-
1198
- if (document.activeElement === node) {
1199
- let parentFocusable = findParentWithAttribute(node.parentElement, 'tabIndex');
1200
-
1201
- if (parentFocusable) {
1202
- parentFocusable.focus();
1203
- }
1204
- }
1205
-
1206
- node.removeAttribute('tabindex');
1207
- }
1208
-
1209
- exports.removeTabIndexAndUpdateFocus = removeTabIndexAndUpdateFocus;
1210
-
1211
- function getElementsByTagName(tag) {
1212
- return Array.prototype.slice.call(document.getElementsByTagName(tag), 0);
1213
- }
1214
-
1215
- exports.getElementsByTagName = getElementsByTagName;
1216
-
1217
- function finalHandler(fn) {
1218
- return e => {
1219
- e.preventDefault();
1220
- e.stopPropagation();
1221
- fn(e);
1222
- };
1223
- }
1224
-
1225
- exports.finalHandler = finalHandler;
1226
-
1227
- function domContentLoaded() {
1228
- return new Promise(resolve => {
1229
- const readyState = document.readyState;
1230
-
1231
- if (readyState === 'complete' || document && document.body !== null) {
1232
- platform.setImmediate(resolve);
1233
- } else {
1234
- window.addEventListener('DOMContentLoaded', resolve, false);
1235
- }
1236
- });
1237
- }
1238
-
1239
- exports.domContentLoaded = domContentLoaded;
1240
- /**
1241
- * Find a value usable for a dom node size such that the likelihood that it would be
1242
- * displayed with constant screen pixels size is as high as possible.
1243
- *
1244
- * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio
1245
- * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/"snaps"
1246
- * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.
1247
- */
1248
-
1249
- function computeScreenAwareSize(cssPx) {
1250
- const screenPx = window.devicePixelRatio * cssPx;
1251
- return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;
1252
- }
1253
-
1254
- exports.computeScreenAwareSize = computeScreenAwareSize;
1255
- /**
1256
- * See https://github.com/microsoft/monaco-editor/issues/601
1257
- * To protect against malicious code in the linked site, particularly phishing attempts,
1258
- * the window.opener should be set to null to prevent the linked site from having access
1259
- * to change the location of the current page.
1260
- * See https://mathiasbynens.github.io/rel-noopener/
1261
- */
1262
-
1263
- function windowOpenNoOpener(url) {
1264
- if (platform.isNative || browser.isEdgeWebView) {
1265
- // In VSCode, window.open() always returns null...
1266
- // The same is true for a WebView (see https://github.com/microsoft/monaco-editor/issues/628)
1267
- window.open(url);
1268
- } else {
1269
- let newTab = window.open();
1270
-
1271
- if (newTab) {
1272
- newTab.opener = null;
1273
- newTab.location.href = url;
1274
- }
1275
- }
1276
- }
1277
-
1278
- exports.windowOpenNoOpener = windowOpenNoOpener;
1279
-
1280
- function animate(fn) {
1281
- const step = () => {
1282
- fn();
1283
- stepDisposable = exports.scheduleAtNextAnimationFrame(step);
1284
- };
1285
-
1286
- let stepDisposable = exports.scheduleAtNextAnimationFrame(step);
1287
- return lifecycle_1.toDisposable(() => stepDisposable.dispose());
1288
- }
1289
-
1290
- exports.animate = animate;
1291
- network_1.RemoteAuthorities.setPreferredWebSchema(/^https:/.test(window.location.href) ? 'https' : 'http');
1292
- /**
1293
- * returns url('...')
1294
- */
1295
-
1296
- function asCSSUrl(uri) {
1297
- if (!uri) {
1298
- return `url('')`;
1299
- }
1300
-
1301
- return `url('${network_1.FileAccess.asBrowserUri(uri).toString(true).replace(/'/g, '%27')}')`;
1302
- }
1303
-
1304
- exports.asCSSUrl = asCSSUrl;
1305
-
1306
- function triggerDownload(dataOrUri, name) {
1307
- // If the data is provided as Buffer, we create a
1308
- // blog URL out of it to produce a valid link
1309
- let url;
1310
-
1311
- if (uri_1.URI.isUri(dataOrUri)) {
1312
- url = dataOrUri.toString(true);
1313
- } else {
1314
- const blob = new Blob([dataOrUri]);
1315
- url = URL.createObjectURL(blob); // Ensure to free the data from DOM eventually
1316
-
1317
- setTimeout(() => URL.revokeObjectURL(url));
1318
- } // In order to download from the browser, the only way seems
1319
- // to be creating a <a> element with download attribute that
1320
- // points to the file to download.
1321
- // See also https://developers.google.com/web/updates/2011/08/Downloading-resources-in-HTML5-a-download
1322
-
1323
-
1324
- const anchor = document.createElement('a');
1325
- document.body.appendChild(anchor);
1326
- anchor.download = name;
1327
- anchor.href = url;
1328
- anchor.click(); // Ensure to remove the element from DOM eventually
1329
-
1330
- setTimeout(() => document.body.removeChild(anchor));
1331
- }
1332
-
1333
- exports.triggerDownload = triggerDownload;
1334
- var DetectedFullscreenMode;
1335
-
1336
- (function (DetectedFullscreenMode) {
1337
- /**
1338
- * The document is fullscreen, e.g. because an element
1339
- * in the document requested to be fullscreen.
1340
- */
1341
- DetectedFullscreenMode[DetectedFullscreenMode["DOCUMENT"] = 1] = "DOCUMENT";
1342
- /**
1343
- * The browser is fullsreen, e.g. because the user enabled
1344
- * native window fullscreen for it.
1345
- */
1346
-
1347
- DetectedFullscreenMode[DetectedFullscreenMode["BROWSER"] = 2] = "BROWSER";
1348
- })(DetectedFullscreenMode = exports.DetectedFullscreenMode || (exports.DetectedFullscreenMode = {}));
1349
-
1350
- function detectFullscreen() {
1351
- // Browser fullscreen: use DOM APIs to detect
1352
- if (document.fullscreenElement || document.webkitFullscreenElement || document.webkitIsFullScreen) {
1353
- return {
1354
- mode: DetectedFullscreenMode.DOCUMENT,
1355
- guess: false
1356
- };
1357
- } // There is no standard way to figure out if the browser
1358
- // is using native fullscreen. Via checking on screen
1359
- // height and comparing that to window height, we can guess
1360
- // it though.
1361
-
1362
-
1363
- if (window.innerHeight === screen.height) {
1364
- // if the height of the window matches the screen height, we can
1365
- // safely assume that the browser is fullscreen because no browser
1366
- // chrome is taking height away (e.g. like toolbars).
1367
- return {
1368
- mode: DetectedFullscreenMode.BROWSER,
1369
- guess: false
1370
- };
1371
- }
1372
-
1373
- if (platform.isMacintosh || platform.isLinux) {
1374
- // macOS and Linux do not properly report `innerHeight`, only Windows does
1375
- if (window.outerHeight === screen.height && window.outerWidth === screen.width) {
1376
- // if the height of the browser matches the screen height, we can
1377
- // only guess that we are in fullscreen. It is also possible that
1378
- // the user has turned off taskbars in the OS and the browser is
1379
- // simply able to span the entire size of the screen.
1380
- return {
1381
- mode: DetectedFullscreenMode.BROWSER,
1382
- guess: true
1383
- };
1384
- }
1385
- } // Not in fullscreen
1386
-
1387
-
1388
- return null;
1389
- }
1390
-
1391
- exports.detectFullscreen = detectFullscreen;
1392
- /**
1393
- * Convert a Unicode string to a string in which each 16-bit unit occupies only one byte
1394
- *
1395
- * From https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa
1396
- */
1397
-
1398
- function toBinary(str) {
1399
- const codeUnits = new Uint16Array(str.length);
1400
-
1401
- for (let i = 0; i < codeUnits.length; i++) {
1402
- codeUnits[i] = str.charCodeAt(i);
1403
- }
1404
-
1405
- return String.fromCharCode(...new Uint8Array(codeUnits.buffer));
1406
- }
1407
- /**
1408
- * Version of the global `btoa` function that handles multi-byte characters instead
1409
- * of throwing an exception.
1410
- */
1411
-
1412
-
1413
- function multibyteAwareBtoa(str) {
1414
- return btoa(toBinary(str));
1415
- }
1416
-
1417
- exports.multibyteAwareBtoa = multibyteAwareBtoa;