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,36 +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.stop = exports.domEvent = void 0;
11
-
12
- const event_1 = require("../common/event");
13
-
14
- exports.domEvent = (element, type, useCapture) => {
15
- const fn = e => emitter.fire(e);
16
-
17
- const emitter = new event_1.Emitter({
18
- onFirstListenerAdd: () => {
19
- element.addEventListener(type, fn, useCapture);
20
- },
21
- onLastListenerRemove: () => {
22
- element.removeEventListener(type, fn, useCapture);
23
- }
24
- });
25
- return emitter.event;
26
- };
27
-
28
- function stop(event) {
29
- return event_1.Event.map(event, e => {
30
- e.preventDefault();
31
- e.stopPropagation();
32
- return e;
33
- });
34
- }
35
-
36
- exports.stop = stop;
@@ -1,265 +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.createFastDomNode = exports.FastDomNode = void 0;
11
-
12
- class FastDomNode {
13
- constructor(domNode) {
14
- this.domNode = domNode;
15
- this._maxWidth = -1;
16
- this._width = -1;
17
- this._height = -1;
18
- this._top = -1;
19
- this._left = -1;
20
- this._bottom = -1;
21
- this._right = -1;
22
- this._fontFamily = '';
23
- this._fontWeight = '';
24
- this._fontSize = -1;
25
- this._fontFeatureSettings = '';
26
- this._lineHeight = -1;
27
- this._letterSpacing = -100;
28
- this._className = '';
29
- this._display = '';
30
- this._position = '';
31
- this._visibility = '';
32
- this._backgroundColor = '';
33
- this._layerHint = false;
34
- this._contain = 'none';
35
- this._boxShadow = '';
36
- }
37
-
38
- setMaxWidth(maxWidth) {
39
- if (this._maxWidth === maxWidth) {
40
- return;
41
- }
42
-
43
- this._maxWidth = maxWidth;
44
- this.domNode.style.maxWidth = this._maxWidth + 'px';
45
- }
46
-
47
- setWidth(width) {
48
- if (this._width === width) {
49
- return;
50
- }
51
-
52
- this._width = width;
53
- this.domNode.style.width = this._width + 'px';
54
- }
55
-
56
- setHeight(height) {
57
- if (this._height === height) {
58
- return;
59
- }
60
-
61
- this._height = height;
62
- this.domNode.style.height = this._height + 'px';
63
- }
64
-
65
- setTop(top) {
66
- if (this._top === top) {
67
- return;
68
- }
69
-
70
- this._top = top;
71
- this.domNode.style.top = this._top + 'px';
72
- }
73
-
74
- unsetTop() {
75
- if (this._top === -1) {
76
- return;
77
- }
78
-
79
- this._top = -1;
80
- this.domNode.style.top = '';
81
- }
82
-
83
- setLeft(left) {
84
- if (this._left === left) {
85
- return;
86
- }
87
-
88
- this._left = left;
89
- this.domNode.style.left = this._left + 'px';
90
- }
91
-
92
- setBottom(bottom) {
93
- if (this._bottom === bottom) {
94
- return;
95
- }
96
-
97
- this._bottom = bottom;
98
- this.domNode.style.bottom = this._bottom + 'px';
99
- }
100
-
101
- setRight(right) {
102
- if (this._right === right) {
103
- return;
104
- }
105
-
106
- this._right = right;
107
- this.domNode.style.right = this._right + 'px';
108
- }
109
-
110
- setFontFamily(fontFamily) {
111
- if (this._fontFamily === fontFamily) {
112
- return;
113
- }
114
-
115
- this._fontFamily = fontFamily;
116
- this.domNode.style.fontFamily = this._fontFamily;
117
- }
118
-
119
- setFontWeight(fontWeight) {
120
- if (this._fontWeight === fontWeight) {
121
- return;
122
- }
123
-
124
- this._fontWeight = fontWeight;
125
- this.domNode.style.fontWeight = this._fontWeight;
126
- }
127
-
128
- setFontSize(fontSize) {
129
- if (this._fontSize === fontSize) {
130
- return;
131
- }
132
-
133
- this._fontSize = fontSize;
134
- this.domNode.style.fontSize = this._fontSize + 'px';
135
- }
136
-
137
- setFontFeatureSettings(fontFeatureSettings) {
138
- if (this._fontFeatureSettings === fontFeatureSettings) {
139
- return;
140
- }
141
-
142
- this._fontFeatureSettings = fontFeatureSettings;
143
- this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;
144
- }
145
-
146
- setLineHeight(lineHeight) {
147
- if (this._lineHeight === lineHeight) {
148
- return;
149
- }
150
-
151
- this._lineHeight = lineHeight;
152
- this.domNode.style.lineHeight = this._lineHeight + 'px';
153
- }
154
-
155
- setLetterSpacing(letterSpacing) {
156
- if (this._letterSpacing === letterSpacing) {
157
- return;
158
- }
159
-
160
- this._letterSpacing = letterSpacing;
161
- this.domNode.style.letterSpacing = this._letterSpacing + 'px';
162
- }
163
-
164
- setClassName(className) {
165
- if (this._className === className) {
166
- return;
167
- }
168
-
169
- this._className = className;
170
- this.domNode.className = this._className;
171
- }
172
-
173
- toggleClassName(className, shouldHaveIt) {
174
- this.domNode.classList.toggle(className, shouldHaveIt);
175
- this._className = this.domNode.className;
176
- }
177
-
178
- setDisplay(display) {
179
- if (this._display === display) {
180
- return;
181
- }
182
-
183
- this._display = display;
184
- this.domNode.style.display = this._display;
185
- }
186
-
187
- setPosition(position) {
188
- if (this._position === position) {
189
- return;
190
- }
191
-
192
- this._position = position;
193
- this.domNode.style.position = this._position;
194
- }
195
-
196
- setVisibility(visibility) {
197
- if (this._visibility === visibility) {
198
- return;
199
- }
200
-
201
- this._visibility = visibility;
202
- this.domNode.style.visibility = this._visibility;
203
- }
204
-
205
- setBackgroundColor(backgroundColor) {
206
- if (this._backgroundColor === backgroundColor) {
207
- return;
208
- }
209
-
210
- this._backgroundColor = backgroundColor;
211
- this.domNode.style.backgroundColor = this._backgroundColor;
212
- }
213
-
214
- setLayerHinting(layerHint) {
215
- if (this._layerHint === layerHint) {
216
- return;
217
- }
218
-
219
- this._layerHint = layerHint;
220
- this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';
221
- }
222
-
223
- setBoxShadow(boxShadow) {
224
- if (this._boxShadow === boxShadow) {
225
- return;
226
- }
227
-
228
- this._boxShadow = boxShadow;
229
- this.domNode.style.boxShadow = boxShadow;
230
- }
231
-
232
- setContain(contain) {
233
- if (this._contain === contain) {
234
- return;
235
- }
236
-
237
- this._contain = contain;
238
- this.domNode.style.contain = this._contain;
239
- }
240
-
241
- setAttribute(name, value) {
242
- this.domNode.setAttribute(name, value);
243
- }
244
-
245
- removeAttribute(name) {
246
- this.domNode.removeAttribute(name);
247
- }
248
-
249
- appendChild(child) {
250
- this.domNode.appendChild(child.domNode);
251
- }
252
-
253
- removeChild(child) {
254
- this.domNode.removeChild(child.domNode);
255
- }
256
-
257
- }
258
-
259
- exports.FastDomNode = FastDomNode;
260
-
261
- function createFastDomNode(domNode) {
262
- return new FastDomNode(domNode);
263
- }
264
-
265
- exports.createFastDomNode = createFastDomNode;
@@ -1,248 +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.createElement = exports.renderFormattedText = exports.renderText = void 0;
11
-
12
- const DOM = require("./dom");
13
-
14
- function renderText(text, options = {}) {
15
- const element = createElement(options);
16
- element.textContent = text;
17
- return element;
18
- }
19
-
20
- exports.renderText = renderText;
21
-
22
- function renderFormattedText(formattedText, options = {}) {
23
- const element = createElement(options);
24
-
25
- _renderFormattedText(element, parseFormattedText(formattedText), options.actionHandler);
26
-
27
- return element;
28
- }
29
-
30
- exports.renderFormattedText = renderFormattedText;
31
-
32
- function createElement(options) {
33
- const tagName = options.inline ? 'span' : 'div';
34
- const element = document.createElement(tagName);
35
-
36
- if (options.className) {
37
- element.className = options.className;
38
- }
39
-
40
- return element;
41
- }
42
-
43
- exports.createElement = createElement;
44
-
45
- class StringStream {
46
- constructor(source) {
47
- this.source = source;
48
- this.index = 0;
49
- }
50
-
51
- eos() {
52
- return this.index >= this.source.length;
53
- }
54
-
55
- next() {
56
- const next = this.peek();
57
- this.advance();
58
- return next;
59
- }
60
-
61
- peek() {
62
- return this.source[this.index];
63
- }
64
-
65
- advance() {
66
- this.index++;
67
- }
68
-
69
- }
70
-
71
- function _renderFormattedText(element, treeNode, actionHandler) {
72
- let child;
73
-
74
- if (treeNode.type === 2
75
- /* Text */
76
- ) {
77
- child = document.createTextNode(treeNode.content || '');
78
- } else if (treeNode.type === 3
79
- /* Bold */
80
- ) {
81
- child = document.createElement('b');
82
- } else if (treeNode.type === 4
83
- /* Italics */
84
- ) {
85
- child = document.createElement('i');
86
- } else if (treeNode.type === 5
87
- /* Action */
88
- && actionHandler) {
89
- const a = document.createElement('a');
90
- a.href = '#';
91
- actionHandler.disposeables.add(DOM.addStandardDisposableListener(a, 'click', event => {
92
- actionHandler.callback(String(treeNode.index), event);
93
- }));
94
- child = a;
95
- } else if (treeNode.type === 7
96
- /* NewLine */
97
- ) {
98
- child = document.createElement('br');
99
- } else if (treeNode.type === 1
100
- /* Root */
101
- ) {
102
- child = element;
103
- }
104
-
105
- if (child && element !== child) {
106
- element.appendChild(child);
107
- }
108
-
109
- if (child && Array.isArray(treeNode.children)) {
110
- treeNode.children.forEach(nodeChild => {
111
- _renderFormattedText(child, nodeChild, actionHandler);
112
- });
113
- }
114
- }
115
-
116
- function parseFormattedText(content) {
117
- const root = {
118
- type: 1
119
- /* Root */
120
- ,
121
- children: []
122
- };
123
- let actionViewItemIndex = 0;
124
- let current = root;
125
- const stack = [];
126
- const stream = new StringStream(content);
127
-
128
- while (!stream.eos()) {
129
- let next = stream.next();
130
- const isEscapedFormatType = next === '\\' && formatTagType(stream.peek()) !== 0
131
- /* Invalid */
132
- ;
133
-
134
- if (isEscapedFormatType) {
135
- next = stream.next(); // unread the backslash if it escapes a format tag type
136
- }
137
-
138
- if (!isEscapedFormatType && isFormatTag(next) && next === stream.peek()) {
139
- stream.advance();
140
-
141
- if (current.type === 2
142
- /* Text */
143
- ) {
144
- current = stack.pop();
145
- }
146
-
147
- const type = formatTagType(next);
148
-
149
- if (current.type === type || current.type === 5
150
- /* Action */
151
- && type === 6
152
- /* ActionClose */
153
- ) {
154
- current = stack.pop();
155
- } else {
156
- const newCurrent = {
157
- type: type,
158
- children: []
159
- };
160
-
161
- if (type === 5
162
- /* Action */
163
- ) {
164
- newCurrent.index = actionViewItemIndex;
165
- actionViewItemIndex++;
166
- }
167
-
168
- current.children.push(newCurrent);
169
- stack.push(current);
170
- current = newCurrent;
171
- }
172
- } else if (next === '\n') {
173
- if (current.type === 2
174
- /* Text */
175
- ) {
176
- current = stack.pop();
177
- }
178
-
179
- current.children.push({
180
- type: 7
181
- /* NewLine */
182
-
183
- });
184
- } else {
185
- if (current.type !== 2
186
- /* Text */
187
- ) {
188
- const textCurrent = {
189
- type: 2
190
- /* Text */
191
- ,
192
- content: next
193
- };
194
- current.children.push(textCurrent);
195
- stack.push(current);
196
- current = textCurrent;
197
- } else {
198
- current.content += next;
199
- }
200
- }
201
- }
202
-
203
- if (current.type === 2
204
- /* Text */
205
- ) {
206
- current = stack.pop();
207
- }
208
-
209
- if (stack.length) {// incorrectly formatted string literal
210
- }
211
-
212
- return root;
213
- }
214
-
215
- function isFormatTag(char) {
216
- return formatTagType(char) !== 0
217
- /* Invalid */
218
- ;
219
- }
220
-
221
- function formatTagType(char) {
222
- switch (char) {
223
- case '*':
224
- return 3
225
- /* Bold */
226
- ;
227
-
228
- case '_':
229
- return 4
230
- /* Italics */
231
- ;
232
-
233
- case '[':
234
- return 5
235
- /* Action */
236
- ;
237
-
238
- case ']':
239
- return 6
240
- /* ActionClose */
241
- ;
242
-
243
- default:
244
- return 0
245
- /* Invalid */
246
- ;
247
- }
248
- }
@@ -1,137 +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.GlobalMouseMoveMonitor = exports.standardMouseMoveMerger = void 0;
11
-
12
- const dom = require("./dom");
13
-
14
- const platform = require("../common/platform");
15
-
16
- const iframe_1 = require("./iframe");
17
-
18
- const mouseEvent_1 = require("./mouseEvent");
19
-
20
- const lifecycle_1 = require("../common/lifecycle");
21
-
22
- const canIUse_1 = require("./canIUse");
23
-
24
- function standardMouseMoveMerger(lastEvent, currentEvent) {
25
- let ev = new mouseEvent_1.StandardMouseEvent(currentEvent);
26
- ev.preventDefault();
27
- return {
28
- leftButton: ev.leftButton,
29
- buttons: ev.buttons,
30
- posx: ev.posx,
31
- posy: ev.posy
32
- };
33
- }
34
-
35
- exports.standardMouseMoveMerger = standardMouseMoveMerger;
36
-
37
- class GlobalMouseMoveMonitor {
38
- constructor() {
39
- this._hooks = new lifecycle_1.DisposableStore();
40
- this._mouseMoveEventMerger = null;
41
- this._mouseMoveCallback = null;
42
- this._onStopCallback = null;
43
- }
44
-
45
- dispose() {
46
- this.stopMonitoring(false);
47
-
48
- this._hooks.dispose();
49
- }
50
-
51
- stopMonitoring(invokeStopCallback) {
52
- if (!this.isMonitoring()) {
53
- // Not monitoring
54
- return;
55
- } // Unhook
56
-
57
-
58
- this._hooks.clear();
59
-
60
- this._mouseMoveEventMerger = null;
61
- this._mouseMoveCallback = null;
62
- const onStopCallback = this._onStopCallback;
63
- this._onStopCallback = null;
64
-
65
- if (invokeStopCallback && onStopCallback) {
66
- onStopCallback();
67
- }
68
- }
69
-
70
- isMonitoring() {
71
- return !!this._mouseMoveEventMerger;
72
- }
73
-
74
- startMonitoring(initialElement, initialButtons, mouseMoveEventMerger, mouseMoveCallback, onStopCallback) {
75
- if (this.isMonitoring()) {
76
- // I am already hooked
77
- return;
78
- }
79
-
80
- this._mouseMoveEventMerger = mouseMoveEventMerger;
81
- this._mouseMoveCallback = mouseMoveCallback;
82
- this._onStopCallback = onStopCallback;
83
- const windowChain = iframe_1.IframeUtils.getSameOriginWindowChain();
84
- const mouseMove = platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? 'pointermove' : 'mousemove';
85
- const mouseUp = platform.isIOS && canIUse_1.BrowserFeatures.pointerEvents ? 'pointerup' : 'mouseup';
86
- const listenTo = windowChain.map(element => element.window.document);
87
- const shadowRoot = dom.getShadowRoot(initialElement);
88
-
89
- if (shadowRoot) {
90
- listenTo.unshift(shadowRoot);
91
- }
92
-
93
- for (const element of listenTo) {
94
- this._hooks.add(dom.addDisposableThrottledListener(element, mouseMove, data => {
95
- if (data.buttons !== initialButtons) {
96
- // Buttons state has changed in the meantime
97
- this.stopMonitoring(true);
98
- return;
99
- }
100
-
101
- this._mouseMoveCallback(data);
102
- }, (lastEvent, currentEvent) => this._mouseMoveEventMerger(lastEvent, currentEvent)));
103
-
104
- this._hooks.add(dom.addDisposableListener(element, mouseUp, e => this.stopMonitoring(true)));
105
- }
106
-
107
- if (iframe_1.IframeUtils.hasDifferentOriginAncestor()) {
108
- let lastSameOriginAncestor = windowChain[windowChain.length - 1]; // We might miss a mouse up if it happens outside the iframe
109
- // This one is for Chrome
110
-
111
- this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseout', browserEvent => {
112
- let e = new mouseEvent_1.StandardMouseEvent(browserEvent);
113
-
114
- if (e.target.tagName.toLowerCase() === 'html') {
115
- this.stopMonitoring(true);
116
- }
117
- })); // This one is for FF
118
-
119
-
120
- this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document, 'mouseover', browserEvent => {
121
- let e = new mouseEvent_1.StandardMouseEvent(browserEvent);
122
-
123
- if (e.target.tagName.toLowerCase() === 'html') {
124
- this.stopMonitoring(true);
125
- }
126
- })); // This one is for IE
127
-
128
-
129
- this._hooks.add(dom.addDisposableListener(lastSameOriginAncestor.window.document.body, 'mouseleave', browserEvent => {
130
- this.stopMonitoring(true);
131
- }));
132
- }
133
- }
134
-
135
- }
136
-
137
- exports.GlobalMouseMoveMonitor = GlobalMouseMoveMonitor;
@@ -1,9 +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
- });