@theia/core 1.45.0 → 1.46.0-next.72

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 (1591) hide show
  1. package/README.md +6 -6
  2. package/i18n/nls.cs.json +524 -520
  3. package/i18n/nls.de.json +524 -520
  4. package/i18n/nls.es.json +524 -520
  5. package/i18n/nls.fr.json +524 -520
  6. package/i18n/nls.hu.json +524 -520
  7. package/i18n/nls.it.json +524 -520
  8. package/i18n/nls.ja.json +524 -520
  9. package/i18n/nls.json +524 -520
  10. package/i18n/nls.pl.json +524 -520
  11. package/i18n/nls.pt-br.json +524 -520
  12. package/i18n/nls.pt-pt.json +524 -520
  13. package/i18n/nls.ru.json +524 -520
  14. package/i18n/nls.zh-cn.json +524 -520
  15. package/lib/browser/about-dialog.d.ts +33 -33
  16. package/lib/browser/about-dialog.js +136 -136
  17. package/lib/browser/authentication-service.d.ts +144 -144
  18. package/lib/browser/authentication-service.js +332 -332
  19. package/lib/browser/breadcrumbs/breadcrumb-popup-container.d.ts +34 -34
  20. package/lib/browser/breadcrumbs/breadcrumb-popup-container.js +114 -114
  21. package/lib/browser/breadcrumbs/breadcrumb-renderer.d.ts +12 -12
  22. package/lib/browser/breadcrumbs/breadcrumb-renderer.js +42 -42
  23. package/lib/browser/breadcrumbs/breadcrumbs-constants.d.ts +49 -49
  24. package/lib/browser/breadcrumbs/breadcrumbs-constants.js +27 -27
  25. package/lib/browser/breadcrumbs/breadcrumbs-renderer.d.ts +43 -43
  26. package/lib/browser/breadcrumbs/breadcrumbs-renderer.js +187 -187
  27. package/lib/browser/breadcrumbs/breadcrumbs-service.d.ts +32 -32
  28. package/lib/browser/breadcrumbs/breadcrumbs-service.js +119 -119
  29. package/lib/browser/breadcrumbs/index.d.ts +5 -5
  30. package/lib/browser/breadcrumbs/index.js +32 -32
  31. package/lib/browser/browser-clipboard-service.d.ts +23 -23
  32. package/lib/browser/browser-clipboard-service.js +115 -115
  33. package/lib/browser/browser.d.ts +37 -34
  34. package/lib/browser/browser.d.ts.map +1 -1
  35. package/lib/browser/browser.js +196 -192
  36. package/lib/browser/browser.js.map +1 -1
  37. package/lib/browser/clipboard-service.d.ts +6 -6
  38. package/lib/browser/clipboard-service.js +19 -19
  39. package/lib/browser/color-application-contribution.d.ts +24 -24
  40. package/lib/browser/color-application-contribution.js +108 -108
  41. package/lib/browser/color-registry.d.ts +14 -14
  42. package/lib/browser/color-registry.js +63 -63
  43. package/lib/browser/command-open-handler.d.ts +9 -9
  44. package/lib/browser/command-open-handler.js +66 -66
  45. package/lib/browser/common-frontend-contribution.d.ts +206 -206
  46. package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
  47. package/lib/browser/common-frontend-contribution.js +2307 -2307
  48. package/lib/browser/common-frontend-contribution.js.map +1 -1
  49. package/lib/browser/common-styling-participants.d.ts +27 -27
  50. package/lib/browser/common-styling-participants.js +370 -370
  51. package/lib/browser/connection-status-service.d.ts +77 -77
  52. package/lib/browser/connection-status-service.js +209 -209
  53. package/lib/browser/connection-status-service.spec.d.ts +1 -1
  54. package/lib/browser/connection-status-service.spec.js +161 -161
  55. package/lib/browser/context-key-service.d.ts +82 -83
  56. package/lib/browser/context-key-service.d.ts.map +1 -1
  57. package/lib/browser/context-key-service.js +88 -88
  58. package/lib/browser/context-key-service.js.map +1 -1
  59. package/lib/browser/context-menu-renderer.d.ts +54 -55
  60. package/lib/browser/context-menu-renderer.d.ts.map +1 -1
  61. package/lib/browser/context-menu-renderer.js +92 -96
  62. package/lib/browser/context-menu-renderer.js.map +1 -1
  63. package/lib/browser/core-preferences.d.ts +37 -36
  64. package/lib/browser/core-preferences.d.ts.map +1 -1
  65. package/lib/browser/core-preferences.js +300 -295
  66. package/lib/browser/core-preferences.js.map +1 -1
  67. package/lib/browser/credentials-service.d.ts +35 -35
  68. package/lib/browser/credentials-service.js +91 -91
  69. package/lib/browser/decoration-style.d.ts +6 -6
  70. package/lib/browser/decoration-style.js +64 -64
  71. package/lib/browser/decorations-service.d.ts +30 -30
  72. package/lib/browser/decorations-service.js +163 -163
  73. package/lib/browser/dialogs/react-dialog.d.ts +17 -17
  74. package/lib/browser/dialogs/react-dialog.js +60 -60
  75. package/lib/browser/dialogs.d.ts +135 -135
  76. package/lib/browser/dialogs.js +457 -457
  77. package/lib/browser/diff-uris.d.ts +17 -17
  78. package/lib/browser/diff-uris.js +126 -126
  79. package/lib/browser/encoding-registry.d.ts +18 -18
  80. package/lib/browser/encoding-registry.js +96 -96
  81. package/lib/browser/endpoint.d.ts +42 -42
  82. package/lib/browser/endpoint.js +120 -120
  83. package/lib/browser/endpoint.spec.d.ts +1 -1
  84. package/lib/browser/endpoint.spec.js +122 -122
  85. package/lib/browser/external-uri-service.d.ts +24 -24
  86. package/lib/browser/external-uri-service.js +77 -77
  87. package/lib/browser/frontend-application-bindings.d.ts +5 -5
  88. package/lib/browser/frontend-application-bindings.js +56 -56
  89. package/lib/browser/frontend-application-config-provider.d.ts +8 -8
  90. package/lib/browser/frontend-application-config-provider.js +46 -46
  91. package/lib/browser/frontend-application-config-provider.spec.d.ts +1 -1
  92. package/lib/browser/frontend-application-config-provider.spec.js +40 -40
  93. package/lib/browser/frontend-application-contribution.d.ts +75 -75
  94. package/lib/browser/frontend-application-contribution.js +50 -50
  95. package/lib/browser/frontend-application-module.d.ts +8 -8
  96. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  97. package/lib/browser/frontend-application-module.js +354 -353
  98. package/lib/browser/frontend-application-module.js.map +1 -1
  99. package/lib/browser/frontend-application-state.d.ts +19 -19
  100. package/lib/browser/frontend-application-state.js +79 -79
  101. package/lib/browser/frontend-application.d.ts +86 -86
  102. package/lib/browser/frontend-application.js +319 -319
  103. package/lib/browser/hover-service.d.ts +50 -50
  104. package/lib/browser/hover-service.js +207 -207
  105. package/lib/browser/http-open-handler.d.ts +14 -14
  106. package/lib/browser/http-open-handler.js +54 -54
  107. package/lib/browser/i18n/i18n-frontend-module.d.ts +3 -3
  108. package/lib/browser/i18n/i18n-frontend-module.js +25 -25
  109. package/lib/browser/i18n/language-quick-pick-service.d.ts +15 -15
  110. package/lib/browser/i18n/language-quick-pick-service.js +144 -144
  111. package/lib/browser/icon-registry.d.ts +56 -62
  112. package/lib/browser/icon-registry.d.ts.map +1 -1
  113. package/lib/browser/icon-registry.js +24 -24
  114. package/lib/browser/icon-registry.js.map +1 -1
  115. package/lib/browser/icon-theme-contribution.d.ts +23 -23
  116. package/lib/browser/icon-theme-contribution.js +72 -72
  117. package/lib/browser/icon-theme-service.d.ts +63 -63
  118. package/lib/browser/icon-theme-service.js +206 -206
  119. package/lib/browser/index.d.ts +31 -31
  120. package/lib/browser/index.js +58 -58
  121. package/lib/browser/json-schema-store.d.ts +37 -37
  122. package/lib/browser/json-schema-store.js +119 -119
  123. package/lib/browser/keybinding.d.ts +288 -288
  124. package/lib/browser/keybinding.js +682 -682
  125. package/lib/browser/keybinding.spec.d.ts +1 -1
  126. package/lib/browser/keybinding.spec.js +456 -456
  127. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.d.ts +13 -13
  128. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js +118 -118
  129. package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts +91 -91
  130. package/lib/browser/keyboard/browser-keyboard-layout-provider.js +426 -426
  131. package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.d.ts +1 -1
  132. package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js +157 -157
  133. package/lib/browser/keyboard/browser-keyboard-module.d.ts +3 -3
  134. package/lib/browser/keyboard/browser-keyboard-module.js +30 -30
  135. package/lib/browser/keyboard/index.d.ts +4 -4
  136. package/lib/browser/keyboard/index.js +31 -31
  137. package/lib/browser/keyboard/keyboard-layout-service.d.ts +49 -49
  138. package/lib/browser/keyboard/keyboard-layout-service.js +435 -435
  139. package/lib/browser/keyboard/keyboard-layout-service.spec.d.ts +1 -1
  140. package/lib/browser/keyboard/keyboard-layout-service.spec.js +115 -115
  141. package/lib/browser/keyboard/keys.d.ts +4 -4
  142. package/lib/browser/keyboard/keys.js +31 -31
  143. package/lib/browser/keyboard/keys.spec.d.ts +1 -1
  144. package/lib/browser/keyboard/keys.spec.js +205 -205
  145. package/lib/browser/keys.d.ts +2 -2
  146. package/lib/browser/keys.js +28 -28
  147. package/lib/browser/label-parser.d.ts +34 -34
  148. package/lib/browser/label-parser.js +112 -112
  149. package/lib/browser/label-parser.spec.d.ts +1 -1
  150. package/lib/browser/label-parser.spec.js +146 -146
  151. package/lib/browser/label-provider.d.ts +140 -140
  152. package/lib/browser/label-provider.js +318 -318
  153. package/lib/browser/label-provider.spec.d.ts +1 -1
  154. package/lib/browser/label-provider.spec.js +53 -53
  155. package/lib/browser/language-icon-provider.d.ts +14 -14
  156. package/lib/browser/language-icon-provider.js +73 -73
  157. package/lib/browser/language-service.d.ts +38 -38
  158. package/lib/browser/language-service.js +71 -71
  159. package/lib/browser/logger-frontend-module.d.ts +2 -2
  160. package/lib/browser/logger-frontend-module.js +63 -63
  161. package/lib/browser/markdown-rendering/markdown-renderer.d.ts +39 -39
  162. package/lib/browser/markdown-rendering/markdown-renderer.d.ts.map +1 -1
  163. package/lib/browser/markdown-rendering/markdown-renderer.js +80 -80
  164. package/lib/browser/menu/browser-context-menu-renderer.d.ts +12 -12
  165. package/lib/browser/menu/browser-context-menu-renderer.js +61 -61
  166. package/lib/browser/menu/browser-menu-module.d.ts +3 -3
  167. package/lib/browser/menu/browser-menu-module.js +28 -28
  168. package/lib/browser/menu/browser-menu-plugin.d.ts +103 -103
  169. package/lib/browser/menu/browser-menu-plugin.js +450 -450
  170. package/lib/browser/menu/context-menu-context.d.ts +7 -7
  171. package/lib/browser/menu/context-menu-context.js +50 -50
  172. package/lib/browser/messaging/connection-source.d.ts +8 -8
  173. package/lib/browser/messaging/connection-source.js +19 -19
  174. package/lib/browser/messaging/frontend-id-provider.d.ts +12 -12
  175. package/lib/browser/messaging/frontend-id-provider.js +39 -39
  176. package/lib/browser/messaging/index.d.ts +1 -1
  177. package/lib/browser/messaging/index.js +28 -28
  178. package/lib/browser/messaging/messaging-frontend-module.d.ts +2 -2
  179. package/lib/browser/messaging/messaging-frontend-module.js +41 -41
  180. package/lib/browser/messaging/service-connection-provider.d.ts +47 -47
  181. package/lib/browser/messaging/service-connection-provider.js +114 -114
  182. package/lib/browser/messaging/ws-connection-provider.d.ts +12 -12
  183. package/lib/browser/messaging/ws-connection-provider.js +57 -57
  184. package/lib/browser/messaging/ws-connection-source.d.ts +42 -40
  185. package/lib/browser/messaging/ws-connection-source.d.ts.map +1 -1
  186. package/lib/browser/messaging/ws-connection-source.js +225 -209
  187. package/lib/browser/messaging/ws-connection-source.js.map +1 -1
  188. package/lib/browser/mime-service.d.ts +7 -7
  189. package/lib/browser/mime-service.js +35 -35
  190. package/lib/browser/navigatable-types.d.ts +33 -33
  191. package/lib/browser/navigatable-types.js +63 -63
  192. package/lib/browser/navigatable.d.ts +8 -8
  193. package/lib/browser/navigatable.js +47 -47
  194. package/lib/browser/opener-service.d.ts +79 -79
  195. package/lib/browser/opener-service.js +90 -90
  196. package/lib/browser/opener-service.spec.d.ts +1 -1
  197. package/lib/browser/opener-service.spec.js +46 -46
  198. package/lib/browser/performance/frontend-stopwatch.d.ts +20 -20
  199. package/lib/browser/performance/frontend-stopwatch.js +74 -74
  200. package/lib/browser/performance/index.d.ts +2 -2
  201. package/lib/browser/performance/index.js +29 -29
  202. package/lib/browser/performance/measurement-frontend-bindings.d.ts +19 -19
  203. package/lib/browser/performance/measurement-frontend-bindings.js +32 -32
  204. package/lib/browser/preferences/index.d.ts +7 -7
  205. package/lib/browser/preferences/index.js +34 -34
  206. package/lib/browser/preferences/injectable-preference-proxy.d.ts +51 -51
  207. package/lib/browser/preferences/injectable-preference-proxy.js +284 -284
  208. package/lib/browser/preferences/preference-configurations.d.ts +22 -22
  209. package/lib/browser/preferences/preference-configurations.js +80 -80
  210. package/lib/browser/preferences/preference-contribution.d.ts +111 -111
  211. package/lib/browser/preferences/preference-contribution.js +394 -394
  212. package/lib/browser/preferences/preference-language-override-service.d.ts +39 -39
  213. package/lib/browser/preferences/preference-language-override-service.js +112 -112
  214. package/lib/browser/preferences/preference-provider.d.ts +132 -132
  215. package/lib/browser/preferences/preference-provider.js +227 -227
  216. package/lib/browser/preferences/preference-provider.spec.d.ts +1 -1
  217. package/lib/browser/preferences/preference-provider.spec.js +33 -33
  218. package/lib/browser/preferences/preference-proxy.d.ts +150 -150
  219. package/lib/browser/preferences/preference-proxy.js +229 -229
  220. package/lib/browser/preferences/preference-proxy.spec.d.ts +1 -1
  221. package/lib/browser/preferences/preference-proxy.spec.js +337 -337
  222. package/lib/browser/preferences/preference-schema-provider.spec.d.ts +1 -1
  223. package/lib/browser/preferences/preference-schema-provider.spec.js +115 -115
  224. package/lib/browser/preferences/preference-scope.d.ts +2 -2
  225. package/lib/browser/preferences/preference-scope.js +20 -20
  226. package/lib/browser/preferences/preference-service.d.ts +278 -278
  227. package/lib/browser/preferences/preference-service.js +358 -358
  228. package/lib/browser/preferences/preference-service.spec.d.ts +1 -1
  229. package/lib/browser/preferences/preference-service.spec.js +505 -505
  230. package/lib/browser/preferences/preference-validation-service.d.ts +57 -57
  231. package/lib/browser/preferences/preference-validation-service.js +354 -354
  232. package/lib/browser/preferences/preference-validation-service.spec.d.ts +1 -1
  233. package/lib/browser/preferences/preference-validation-service.spec.js +330 -330
  234. package/lib/browser/preferences/test/index.d.ts +3 -3
  235. package/lib/browser/preferences/test/index.js +30 -30
  236. package/lib/browser/preferences/test/mock-preference-provider.d.ts +16 -16
  237. package/lib/browser/preferences/test/mock-preference-provider.js +46 -46
  238. package/lib/browser/preferences/test/mock-preference-proxy.d.ts +3 -3
  239. package/lib/browser/preferences/test/mock-preference-proxy.js +49 -49
  240. package/lib/browser/preferences/test/mock-preference-service.d.ts +28 -28
  241. package/lib/browser/preferences/test/mock-preference-service.js +67 -67
  242. package/lib/browser/preload/i18n-preload-contribution.d.ts +6 -6
  243. package/lib/browser/preload/i18n-preload-contribution.js +62 -62
  244. package/lib/browser/preload/os-preload-contribution.d.ts +6 -6
  245. package/lib/browser/preload/os-preload-contribution.js +48 -48
  246. package/lib/browser/preload/preload-module.d.ts +3 -3
  247. package/lib/browser/preload/preload-module.js +38 -38
  248. package/lib/browser/preload/preloader.d.ts +11 -11
  249. package/lib/browser/preload/preloader.js +44 -44
  250. package/lib/browser/preload/theme-preload-contribution.d.ts +4 -4
  251. package/lib/browser/preload/theme-preload-contribution.js +39 -39
  252. package/lib/browser/progress-bar-factory.d.ts +11 -11
  253. package/lib/browser/progress-bar-factory.js +20 -20
  254. package/lib/browser/progress-bar.d.ts +15 -15
  255. package/lib/browser/progress-bar.js +89 -89
  256. package/lib/browser/progress-client.d.ts +12 -12
  257. package/lib/browser/progress-client.js +61 -61
  258. package/lib/browser/progress-location-service.d.ts +21 -21
  259. package/lib/browser/progress-location-service.js +96 -96
  260. package/lib/browser/progress-location-service.spec.d.ts +1 -1
  261. package/lib/browser/progress-location-service.spec.js +44 -44
  262. package/lib/browser/progress-status-bar-item.d.ts +16 -16
  263. package/lib/browser/progress-status-bar-item.js +89 -89
  264. package/lib/browser/quick-input/index.d.ts +8 -8
  265. package/lib/browser/quick-input/index.js +35 -35
  266. package/lib/browser/quick-input/quick-access.d.ts +53 -53
  267. package/lib/browser/quick-input/quick-access.js +20 -20
  268. package/lib/browser/quick-input/quick-command-frontend-contribution.d.ts +11 -11
  269. package/lib/browser/quick-input/quick-command-frontend-contribution.js +104 -104
  270. package/lib/browser/quick-input/quick-command-service.d.ts +59 -59
  271. package/lib/browser/quick-input/quick-command-service.js +233 -233
  272. package/lib/browser/quick-input/quick-help-service.d.ts +11 -11
  273. package/lib/browser/quick-input/quick-help-service.js +91 -91
  274. package/lib/browser/quick-input/quick-input-frontend-contribution.d.ts +7 -7
  275. package/lib/browser/quick-input/quick-input-frontend-contribution.js +46 -46
  276. package/lib/browser/quick-input/quick-input-service.d.ts +1 -1
  277. package/lib/browser/quick-input/quick-input-service.js +28 -28
  278. package/lib/browser/quick-input/quick-input-service.spec.d.ts +1 -1
  279. package/lib/browser/quick-input/quick-input-service.spec.js +159 -159
  280. package/lib/browser/quick-input/quick-pick-service-impl.d.ts +30 -30
  281. package/lib/browser/quick-input/quick-pick-service-impl.js +77 -77
  282. package/lib/browser/quick-input/quick-view-service.d.ts +23 -23
  283. package/lib/browser/quick-input/quick-view-service.js +86 -86
  284. package/lib/browser/request/browser-request-module.d.ts +18 -18
  285. package/lib/browser/request/browser-request-module.js +23 -23
  286. package/lib/browser/request/browser-request-service.d.ts +41 -41
  287. package/lib/browser/request/browser-request-service.js +180 -180
  288. package/lib/browser/resource-context-key.d.ts +19 -19
  289. package/lib/browser/resource-context-key.js +83 -83
  290. package/lib/browser/save-resource-service.d.ts +35 -35
  291. package/lib/browser/save-resource-service.d.ts.map +1 -1
  292. package/lib/browser/save-resource-service.js +72 -71
  293. package/lib/browser/save-resource-service.js.map +1 -1
  294. package/lib/browser/saveable.d.ts +124 -124
  295. package/lib/browser/saveable.js +274 -274
  296. package/lib/browser/secondary-window-handler.d.ts +64 -64
  297. package/lib/browser/secondary-window-handler.js +208 -208
  298. package/lib/browser/shell/additional-views-menu-widget.d.ts +19 -19
  299. package/lib/browser/shell/additional-views-menu-widget.js +81 -81
  300. package/lib/browser/shell/application-shell-mouse-tracker.d.ts +30 -30
  301. package/lib/browser/shell/application-shell-mouse-tracker.js +107 -107
  302. package/lib/browser/shell/application-shell.d.ts +572 -572
  303. package/lib/browser/shell/application-shell.d.ts.map +1 -1
  304. package/lib/browser/shell/application-shell.js +1995 -1990
  305. package/lib/browser/shell/application-shell.js.map +1 -1
  306. package/lib/browser/shell/current-widget-command-adapter.d.ts +23 -23
  307. package/lib/browser/shell/current-widget-command-adapter.js +41 -41
  308. package/lib/browser/shell/index.d.ts +7 -7
  309. package/lib/browser/shell/index.js +34 -34
  310. package/lib/browser/shell/shell-layout-restorer.d.ts +123 -123
  311. package/lib/browser/shell/shell-layout-restorer.js +347 -347
  312. package/lib/browser/shell/side-panel-handler.d.ts +286 -286
  313. package/lib/browser/shell/side-panel-handler.js +667 -667
  314. package/lib/browser/shell/side-panel-toolbar.d.ts +25 -25
  315. package/lib/browser/shell/side-panel-toolbar.js +96 -96
  316. package/lib/browser/shell/sidebar-bottom-menu-widget.d.ts +9 -9
  317. package/lib/browser/shell/sidebar-bottom-menu-widget.js +46 -46
  318. package/lib/browser/shell/sidebar-menu-widget.d.ts +38 -38
  319. package/lib/browser/shell/sidebar-menu-widget.js +121 -121
  320. package/lib/browser/shell/sidebar-top-menu-widget.d.ts +6 -6
  321. package/lib/browser/shell/sidebar-top-menu-widget.js +35 -35
  322. package/lib/browser/shell/split-panels.d.ts +42 -42
  323. package/lib/browser/shell/split-panels.js +177 -177
  324. package/lib/browser/shell/tab-bar-decorator.d.ts +40 -35
  325. package/lib/browser/shell/tab-bar-decorator.d.ts.map +1 -1
  326. package/lib/browser/shell/tab-bar-decorator.js +95 -64
  327. package/lib/browser/shell/tab-bar-decorator.js.map +1 -1
  328. package/lib/browser/shell/tab-bar-toolbar/index.d.ts +3 -3
  329. package/lib/browser/shell/tab-bar-toolbar/index.js +30 -30
  330. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.d.ts +15 -15
  331. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.js +35 -35
  332. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.d.ts +95 -95
  333. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.js +253 -253
  334. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.d.ts +136 -136
  335. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.js +88 -88
  336. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts +88 -88
  337. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js +417 -417
  338. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.d.ts +1 -1
  339. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.js +51 -51
  340. package/lib/browser/shell/tab-bars.d.ts +339 -338
  341. package/lib/browser/shell/tab-bars.d.ts.map +1 -1
  342. package/lib/browser/shell/tab-bars.js +1309 -1277
  343. package/lib/browser/shell/tab-bars.js.map +1 -1
  344. package/lib/browser/shell/tab-bars.spec.d.ts +1 -1
  345. package/lib/browser/shell/tab-bars.spec.js +56 -56
  346. package/lib/browser/shell/theia-dock-panel.d.ts +59 -59
  347. package/lib/browser/shell/theia-dock-panel.js +226 -226
  348. package/lib/browser/shell/view-contribution.d.ts +43 -43
  349. package/lib/browser/shell/view-contribution.js +167 -167
  350. package/lib/browser/source-tree/index.d.ts +3 -3
  351. package/lib/browser/source-tree/index.js +30 -30
  352. package/lib/browser/source-tree/source-tree-widget.d.ts +21 -21
  353. package/lib/browser/source-tree/source-tree-widget.js +118 -118
  354. package/lib/browser/source-tree/source-tree.d.ts +36 -36
  355. package/lib/browser/source-tree/source-tree.js +134 -134
  356. package/lib/browser/source-tree/tree-source.d.ts +35 -35
  357. package/lib/browser/source-tree/tree-source.js +64 -64
  358. package/lib/browser/status-bar/index.d.ts +5 -5
  359. package/lib/browser/status-bar/index.js +40 -40
  360. package/lib/browser/status-bar/status-bar-types.d.ts +72 -72
  361. package/lib/browser/status-bar/status-bar-types.js +25 -25
  362. package/lib/browser/status-bar/status-bar-view-model.d.ts +35 -35
  363. package/lib/browser/status-bar/status-bar-view-model.js +212 -212
  364. package/lib/browser/status-bar/status-bar.d.ts +34 -34
  365. package/lib/browser/status-bar/status-bar.js +192 -192
  366. package/lib/browser/storage-service.d.ts +35 -35
  367. package/lib/browser/storage-service.js +130 -130
  368. package/lib/browser/storage-service.spec.d.ts +1 -1
  369. package/lib/browser/storage-service.spec.js +68 -68
  370. package/lib/browser/styling-service.d.ts +28 -28
  371. package/lib/browser/styling-service.js +85 -85
  372. package/lib/browser/supported-encodings.d.ts +9 -9
  373. package/lib/browser/supported-encodings.js +263 -263
  374. package/lib/browser/test/jsdom.d.ts +8 -8
  375. package/lib/browser/test/jsdom.js +69 -69
  376. package/lib/browser/test/mock-connection-status-service.d.ts +5 -5
  377. package/lib/browser/test/mock-connection-status-service.js +32 -32
  378. package/lib/browser/test/mock-env-variables-server.d.ts +12 -12
  379. package/lib/browser/test/mock-env-variables-server.js +42 -42
  380. package/lib/browser/test/mock-opener-service.d.ts +8 -8
  381. package/lib/browser/test/mock-opener-service.js +40 -40
  382. package/lib/browser/test/mock-storage-service.d.ts +11 -11
  383. package/lib/browser/test/mock-storage-service.js +54 -54
  384. package/lib/browser/theming.d.ts +50 -50
  385. package/lib/browser/theming.js +211 -211
  386. package/lib/browser/tooltip-service.d.ts +34 -34
  387. package/lib/browser/tooltip-service.js +87 -87
  388. package/lib/browser/tooltip-service.js.map +1 -1
  389. package/lib/browser/tree/fuzzy-search.d.ts +60 -60
  390. package/lib/browser/tree/fuzzy-search.js +80 -80
  391. package/lib/browser/tree/fuzzy-search.spec.d.ts +1 -1
  392. package/lib/browser/tree/fuzzy-search.spec.js +89 -89
  393. package/lib/browser/tree/index.d.ts +13 -12
  394. package/lib/browser/tree/index.d.ts.map +1 -1
  395. package/lib/browser/tree/index.js +40 -39
  396. package/lib/browser/tree/index.js.map +1 -1
  397. package/lib/browser/tree/search-box-debounce.d.ts +33 -33
  398. package/lib/browser/tree/search-box-debounce.js +75 -75
  399. package/lib/browser/tree/search-box.d.ts +105 -105
  400. package/lib/browser/tree/search-box.js +265 -265
  401. package/lib/browser/tree/test/mock-selectable-tree-model.d.ts +15 -0
  402. package/lib/browser/tree/test/mock-selectable-tree-model.d.ts.map +1 -0
  403. package/lib/browser/tree/test/mock-selectable-tree-model.js +103 -0
  404. package/lib/browser/tree/test/mock-selectable-tree-model.js.map +1 -0
  405. package/lib/browser/tree/test/mock-tree-model.d.ts +12 -12
  406. package/lib/browser/tree/test/mock-tree-model.js +129 -129
  407. package/lib/browser/tree/test/tree-test-container.d.ts +2 -2
  408. package/lib/browser/tree/test/tree-test-container.js +52 -52
  409. package/lib/browser/tree/tree-compression/compressed-tree-expansion-service.d.ts +8 -8
  410. package/lib/browser/tree/tree-compression/compressed-tree-expansion-service.js +67 -67
  411. package/lib/browser/tree/tree-compression/compressed-tree-model.d.ts +23 -23
  412. package/lib/browser/tree/tree-compression/compressed-tree-model.js +97 -97
  413. package/lib/browser/tree/tree-compression/compressed-tree-widget.d.ts +38 -38
  414. package/lib/browser/tree/tree-compression/compressed-tree-widget.js +198 -198
  415. package/lib/browser/tree/tree-compression/index.d.ts +4 -4
  416. package/lib/browser/tree/tree-compression/index.js +31 -31
  417. package/lib/browser/tree/tree-compression/tree-compression-service.d.ts +58 -58
  418. package/lib/browser/tree/tree-compression/tree-compression-service.js +103 -103
  419. package/lib/browser/tree/tree-consistency.spec.d.ts +1 -1
  420. package/lib/browser/tree/tree-consistency.spec.js +104 -104
  421. package/lib/browser/tree/tree-container.d.ts +51 -51
  422. package/lib/browser/tree/tree-container.js +115 -115
  423. package/lib/browser/tree/tree-container.spec.d.ts +1 -1
  424. package/lib/browser/tree/tree-container.spec.js +45 -45
  425. package/lib/browser/tree/tree-decorator.d.ts +143 -143
  426. package/lib/browser/tree/tree-decorator.js +123 -123
  427. package/lib/browser/tree/tree-decorator.spec.d.ts +1 -1
  428. package/lib/browser/tree/tree-decorator.spec.js +145 -145
  429. package/lib/browser/tree/tree-expansion.d.ts +65 -65
  430. package/lib/browser/tree/tree-expansion.js +132 -132
  431. package/lib/browser/tree/tree-expansion.spec.d.ts +1 -1
  432. package/lib/browser/tree/tree-expansion.spec.js +155 -155
  433. package/lib/browser/tree/tree-focus-service.d.ts +19 -19
  434. package/lib/browser/tree/tree-focus-service.js +61 -61
  435. package/lib/browser/tree/tree-iterator.d.ts +94 -94
  436. package/lib/browser/tree/tree-iterator.js +223 -223
  437. package/lib/browser/tree/tree-iterator.spec.d.ts +1 -1
  438. package/lib/browser/tree/tree-iterator.spec.js +150 -150
  439. package/lib/browser/tree/tree-label-provider.d.ts +8 -8
  440. package/lib/browser/tree/tree-label-provider.js +44 -44
  441. package/lib/browser/tree/tree-model.d.ts +202 -178
  442. package/lib/browser/tree/tree-model.d.ts.map +1 -1
  443. package/lib/browser/tree/tree-model.js +403 -357
  444. package/lib/browser/tree/tree-model.js.map +1 -1
  445. package/lib/browser/tree/tree-navigation.d.ts +10 -10
  446. package/lib/browser/tree/tree-navigation.js +62 -62
  447. package/lib/browser/tree/tree-preference.d.ts +11 -0
  448. package/lib/browser/tree/tree-preference.d.ts.map +1 -0
  449. package/lib/browser/tree/tree-preference.js +47 -0
  450. package/lib/browser/tree/tree-preference.js.map +1 -0
  451. package/lib/browser/tree/tree-search.d.ts +36 -36
  452. package/lib/browser/tree/tree-search.js +138 -138
  453. package/lib/browser/tree/tree-selectable.spec.d.ts +2 -0
  454. package/lib/browser/tree/tree-selectable.spec.d.ts.map +1 -0
  455. package/lib/browser/tree/tree-selectable.spec.js +147 -0
  456. package/lib/browser/tree/tree-selectable.spec.js.map +1 -0
  457. package/lib/browser/tree/tree-selection-impl.d.ts +44 -44
  458. package/lib/browser/tree/tree-selection-impl.js +166 -166
  459. package/lib/browser/tree/tree-selection-state.d.ts +48 -48
  460. package/lib/browser/tree/tree-selection-state.js +227 -227
  461. package/lib/browser/tree/tree-selection-state.spec.d.ts +1 -1
  462. package/lib/browser/tree/tree-selection-state.spec.js +420 -420
  463. package/lib/browser/tree/tree-selection.d.ts +86 -86
  464. package/lib/browser/tree/tree-selection.js +86 -86
  465. package/lib/browser/tree/tree-view-welcome-widget.d.ts +45 -45
  466. package/lib/browser/tree/tree-view-welcome-widget.js +200 -200
  467. package/lib/browser/tree/tree-widget-selection.d.ts +11 -11
  468. package/lib/browser/tree/tree-widget-selection.js +46 -46
  469. package/lib/browser/tree/tree-widget.d.ts +559 -556
  470. package/lib/browser/tree/tree-widget.d.ts.map +1 -1
  471. package/lib/browser/tree/tree-widget.js +1363 -1342
  472. package/lib/browser/tree/tree-widget.js.map +1 -1
  473. package/lib/browser/tree/tree.d.ts +180 -180
  474. package/lib/browser/tree/tree.d.ts.map +1 -1
  475. package/lib/browser/tree/tree.js +296 -293
  476. package/lib/browser/tree/tree.js.map +1 -1
  477. package/lib/browser/tree/tree.spec.d.ts +1 -1
  478. package/lib/browser/tree/tree.spec.js +226 -226
  479. package/lib/browser/user-working-directory-provider.d.ts +23 -23
  480. package/lib/browser/user-working-directory-provider.js +84 -84
  481. package/lib/browser/view-container.d.ts +312 -312
  482. package/lib/browser/view-container.js +1466 -1466
  483. package/lib/browser/widget-decoration.d.ts +299 -299
  484. package/lib/browser/widget-decoration.js +140 -140
  485. package/lib/browser/widget-manager.d.ts +172 -163
  486. package/lib/browser/widget-manager.d.ts.map +1 -1
  487. package/lib/browser/widget-manager.js +230 -207
  488. package/lib/browser/widget-manager.js.map +1 -1
  489. package/lib/browser/widget-manager.spec.d.ts +1 -1
  490. package/lib/browser/widget-manager.spec.js +91 -91
  491. package/lib/browser/widget-open-handler.d.ts +88 -88
  492. package/lib/browser/widget-open-handler.js +145 -145
  493. package/lib/browser/widgets/alert-message.d.ts +23 -23
  494. package/lib/browser/widgets/alert-message.js +38 -38
  495. package/lib/browser/widgets/enhanced-preview-widget.d.ts +6 -6
  496. package/lib/browser/widgets/enhanced-preview-widget.js +26 -26
  497. package/lib/browser/widgets/extractable-widget.d.ts +13 -13
  498. package/lib/browser/widgets/extractable-widget.js +26 -26
  499. package/lib/browser/widgets/index.d.ts +4 -4
  500. package/lib/browser/widgets/index.js +31 -31
  501. package/lib/browser/widgets/previewable-widget.d.ts +8 -8
  502. package/lib/browser/widgets/previewable-widget.js +30 -30
  503. package/lib/browser/widgets/react-renderer.d.ts +14 -14
  504. package/lib/browser/widgets/react-renderer.js +59 -59
  505. package/lib/browser/widgets/react-widget.d.ts +16 -16
  506. package/lib/browser/widgets/react-widget.js +57 -57
  507. package/lib/browser/widgets/select-component.d.ts +53 -53
  508. package/lib/browser/widgets/select-component.d.ts.map +1 -1
  509. package/lib/browser/widgets/select-component.js +307 -306
  510. package/lib/browser/widgets/select-component.js.map +1 -1
  511. package/lib/browser/widgets/widget.d.ts +108 -106
  512. package/lib/browser/widgets/widget.d.ts.map +1 -1
  513. package/lib/browser/widgets/widget.js +385 -377
  514. package/lib/browser/widgets/widget.js.map +1 -1
  515. package/lib/browser/window/browser-window-module.d.ts +3 -3
  516. package/lib/browser/window/browser-window-module.js +32 -32
  517. package/lib/browser/window/default-secondary-window-service.d.ts +25 -25
  518. package/lib/browser/window/default-secondary-window-service.js +198 -198
  519. package/lib/browser/window/default-window-service.d.ts +49 -49
  520. package/lib/browser/window/default-window-service.js +172 -172
  521. package/lib/browser/window/default-window-service.spec.d.ts +1 -1
  522. package/lib/browser/window/default-window-service.spec.js +80 -80
  523. package/lib/browser/window/secondary-window-service.d.ts +20 -20
  524. package/lib/browser/window/secondary-window-service.js +19 -19
  525. package/lib/browser/window/test/mock-window-service.d.ts +10 -10
  526. package/lib/browser/window/test/mock-window-service.js +38 -38
  527. package/lib/browser/window/window-service.d.ts +45 -45
  528. package/lib/browser/window/window-service.js +22 -22
  529. package/lib/browser/window/window-title-service.d.ts +31 -31
  530. package/lib/browser/window/window-title-service.js +120 -120
  531. package/lib/browser/window/window-title-updater.d.ts +19 -19
  532. package/lib/browser/window/window-title-updater.js +107 -107
  533. package/lib/browser/window-contribution.d.ts +14 -14
  534. package/lib/browser/window-contribution.js +70 -70
  535. package/lib/browser-only/frontend-only-application-module.d.ts +5 -0
  536. package/lib/browser-only/frontend-only-application-module.d.ts.map +1 -0
  537. package/lib/browser-only/frontend-only-application-module.js +115 -0
  538. package/lib/browser-only/frontend-only-application-module.js.map +1 -0
  539. package/lib/browser-only/i18n/i18n-frontend-only-module.d.ts +4 -0
  540. package/lib/browser-only/i18n/i18n-frontend-only-module.d.ts.map +1 -0
  541. package/lib/browser-only/i18n/i18n-frontend-only-module.js +35 -0
  542. package/lib/browser-only/i18n/i18n-frontend-only-module.js.map +1 -0
  543. package/lib/browser-only/logger-frontend-only-module.d.ts +3 -0
  544. package/lib/browser-only/logger-frontend-only-module.d.ts.map +1 -0
  545. package/lib/browser-only/logger-frontend-only-module.js +61 -0
  546. package/lib/browser-only/logger-frontend-only-module.js.map +1 -0
  547. package/lib/browser-only/messaging/frontend-only-service-connection-provider.d.ts +14 -0
  548. package/lib/browser-only/messaging/frontend-only-service-connection-provider.d.ts.map +1 -0
  549. package/lib/browser-only/messaging/frontend-only-service-connection-provider.js +57 -0
  550. package/lib/browser-only/messaging/frontend-only-service-connection-provider.js.map +1 -0
  551. package/lib/browser-only/messaging/messaging-frontend-only-module.d.ts +3 -0
  552. package/lib/browser-only/messaging/messaging-frontend-only-module.d.ts.map +1 -0
  553. package/lib/browser-only/messaging/messaging-frontend-only-module.js +48 -0
  554. package/lib/browser-only/messaging/messaging-frontend-only-module.js.map +1 -0
  555. package/lib/browser-only/preload/frontend-only-preload-module.d.ts +4 -0
  556. package/lib/browser-only/preload/frontend-only-preload-module.d.ts.map +1 -0
  557. package/lib/browser-only/preload/frontend-only-preload-module.js +52 -0
  558. package/lib/browser-only/preload/frontend-only-preload-module.js.map +1 -0
  559. package/lib/common/accessibility.d.ts +16 -16
  560. package/lib/common/accessibility.js +17 -17
  561. package/lib/common/application-error.d.ts +20 -20
  562. package/lib/common/application-error.js +62 -62
  563. package/lib/common/application-error.spec.d.ts +1 -1
  564. package/lib/common/application-error.spec.js +26 -26
  565. package/lib/common/application-protocol.d.ts +20 -19
  566. package/lib/common/application-protocol.d.ts.map +1 -1
  567. package/lib/common/application-protocol.js +20 -20
  568. package/lib/common/array-utils.d.ts +55 -55
  569. package/lib/common/array-utils.js +118 -118
  570. package/lib/common/buffer.d.ts +43 -43
  571. package/lib/common/buffer.js +205 -205
  572. package/lib/common/cancellation.d.ts +24 -24
  573. package/lib/common/cancellation.js +142 -142
  574. package/lib/common/char-code.d.ts +401 -401
  575. package/lib/common/char-code.js +22 -22
  576. package/lib/common/collections.d.ts +29 -29
  577. package/lib/common/collections.js +121 -121
  578. package/lib/common/color.d.ts +71 -71
  579. package/lib/common/color.js +43 -43
  580. package/lib/common/command.d.ts +232 -232
  581. package/lib/common/command.js +364 -364
  582. package/lib/common/command.spec.d.ts +1 -1
  583. package/lib/common/command.spec.js +173 -173
  584. package/lib/common/contribution-filter/contribution-filter-registry.d.ts +17 -17
  585. package/lib/common/contribution-filter/contribution-filter-registry.js +88 -88
  586. package/lib/common/contribution-filter/contribution-filter.d.ts +41 -41
  587. package/lib/common/contribution-filter/contribution-filter.js +20 -20
  588. package/lib/common/contribution-filter/filter.d.ts +6 -6
  589. package/lib/common/contribution-filter/filter.js +19 -19
  590. package/lib/common/contribution-filter/index.d.ts +3 -3
  591. package/lib/common/contribution-filter/index.js +30 -30
  592. package/lib/common/contribution-provider.d.ts +20 -20
  593. package/lib/common/contribution-provider.js +82 -82
  594. package/lib/common/disposable.d.ts +80 -43
  595. package/lib/common/disposable.d.ts.map +1 -1
  596. package/lib/common/disposable.js +173 -120
  597. package/lib/common/disposable.js.map +1 -1
  598. package/lib/common/disposable.spec.d.ts +1 -1
  599. package/lib/common/disposable.spec.js +80 -29
  600. package/lib/common/disposable.spec.js.map +1 -1
  601. package/lib/common/encoding-service.d.ts +38 -38
  602. package/lib/common/encoding-service.js +307 -307
  603. package/lib/common/encodings.d.ts +7 -7
  604. package/lib/common/encodings.js +25 -25
  605. package/lib/common/env-variables/env-variables-protocol.d.ts +20 -20
  606. package/lib/common/env-variables/env-variables-protocol.js +20 -20
  607. package/lib/common/env-variables/index.d.ts +1 -1
  608. package/lib/common/env-variables/index.js +28 -28
  609. package/lib/common/event.d.ts +115 -115
  610. package/lib/common/event.js +385 -385
  611. package/lib/common/event.spec.d.ts +1 -1
  612. package/lib/common/event.spec.js +29 -29
  613. package/lib/{node → common}/file-uri.d.ts +14 -14
  614. package/lib/common/file-uri.d.ts.map +1 -0
  615. package/lib/{node → common}/file-uri.js +62 -62
  616. package/lib/common/file-uri.js.map +1 -0
  617. package/lib/common/frontend-application-state.d.ts +15 -15
  618. package/lib/common/frontend-application-state.js +33 -33
  619. package/lib/common/glob.d.ts +50 -50
  620. package/lib/common/glob.js +591 -591
  621. package/lib/common/hash.d.ts +7 -7
  622. package/lib/common/hash.js +84 -84
  623. package/lib/common/i18n/localization-server.d.ts +6 -6
  624. package/lib/common/i18n/localization-server.js +20 -20
  625. package/lib/common/i18n/localization.d.ts +34 -34
  626. package/lib/common/i18n/localization.js +59 -59
  627. package/lib/common/index.d.ts +35 -34
  628. package/lib/common/index.d.ts.map +1 -1
  629. package/lib/common/index.js +65 -64
  630. package/lib/common/index.js.map +1 -1
  631. package/lib/common/json-schema.d.ts +72 -72
  632. package/lib/common/json-schema.js +17 -17
  633. package/lib/common/key-store.d.ts +12 -12
  634. package/lib/common/key-store.js +20 -20
  635. package/lib/common/keybinding.d.ts +75 -75
  636. package/lib/common/keybinding.js +113 -113
  637. package/lib/common/keyboard/keyboard-layout-provider.d.ts +26 -26
  638. package/lib/common/keyboard/keyboard-layout-provider.js +22 -22
  639. package/lib/common/keys.d.ts +253 -253
  640. package/lib/common/keys.js +634 -634
  641. package/lib/common/label-protocol.d.ts +13 -13
  642. package/lib/common/label-protocol.js +17 -17
  643. package/lib/common/logger-protocol.d.ts +41 -41
  644. package/lib/common/logger-protocol.js +105 -105
  645. package/lib/common/logger-watcher.d.ts +9 -9
  646. package/lib/common/logger-watcher.js +54 -54
  647. package/lib/common/logger.d.ts +207 -207
  648. package/lib/common/logger.js +212 -212
  649. package/lib/common/logger.spec.d.ts +1 -1
  650. package/lib/common/logger.spec.js +41 -41
  651. package/lib/common/lsp-types.d.ts +9 -9
  652. package/lib/common/lsp-types.js +30 -30
  653. package/lib/common/markdown-rendering/icon-utilities.d.ts +7 -7
  654. package/lib/common/markdown-rendering/icon-utilities.js +32 -32
  655. package/lib/common/markdown-rendering/index.d.ts +2 -2
  656. package/lib/common/markdown-rendering/index.js +29 -29
  657. package/lib/common/markdown-rendering/markdown-string.d.ts +46 -43
  658. package/lib/common/markdown-rendering/markdown-string.d.ts.map +1 -1
  659. package/lib/common/markdown-rendering/markdown-string.js +126 -126
  660. package/lib/common/markdown-rendering/markdown-string.js.map +1 -1
  661. package/lib/common/menu/action-menu-node.d.ts +19 -19
  662. package/lib/common/menu/action-menu-node.js +56 -56
  663. package/lib/common/menu/composite-menu-node.d.ts +46 -46
  664. package/lib/common/menu/composite-menu-node.js +93 -93
  665. package/lib/common/menu/index.d.ts +5 -5
  666. package/lib/common/menu/index.js +32 -32
  667. package/lib/common/menu/menu-adapter.d.ts +35 -35
  668. package/lib/common/menu/menu-adapter.js +100 -100
  669. package/lib/common/menu/menu-model-registry.d.ts +145 -145
  670. package/lib/common/menu/menu-model-registry.d.ts.map +1 -1
  671. package/lib/common/menu/menu-model-registry.js +286 -272
  672. package/lib/common/menu/menu-model-registry.js.map +1 -1
  673. package/lib/common/menu/menu-types.d.ts +148 -148
  674. package/lib/common/menu/menu-types.js +93 -93
  675. package/lib/common/menu/menu.spec.d.ts +1 -1
  676. package/lib/common/menu/menu.spec.js +96 -69
  677. package/lib/common/menu/menu.spec.js.map +1 -1
  678. package/lib/common/message-rpc/channel.d.ts +123 -123
  679. package/lib/common/message-rpc/channel.js +230 -230
  680. package/lib/common/message-rpc/channel.spec.d.ts +8 -8
  681. package/lib/common/message-rpc/channel.spec.js +79 -79
  682. package/lib/common/message-rpc/index.d.ts +3 -3
  683. package/lib/common/message-rpc/index.js +24 -24
  684. package/lib/common/message-rpc/message-buffer.d.ts +51 -51
  685. package/lib/common/message-rpc/message-buffer.js +59 -59
  686. package/lib/common/message-rpc/msg-pack-extension-manager.d.ts +22 -22
  687. package/lib/common/message-rpc/msg-pack-extension-manager.js +57 -57
  688. package/lib/common/message-rpc/rpc-message-encoder.d.ts +103 -103
  689. package/lib/common/message-rpc/rpc-message-encoder.js +113 -113
  690. package/lib/common/message-rpc/rpc-message-encoder.spec.d.ts +1 -1
  691. package/lib/common/message-rpc/rpc-message-encoder.spec.js +58 -58
  692. package/lib/common/message-rpc/rpc-protocol.d.ts +67 -65
  693. package/lib/common/message-rpc/rpc-protocol.d.ts.map +1 -1
  694. package/lib/common/message-rpc/rpc-protocol.js +209 -191
  695. package/lib/common/message-rpc/rpc-protocol.js.map +1 -1
  696. package/lib/common/message-rpc/uint8-array-message-buffer.d.ts +52 -52
  697. package/lib/common/message-rpc/uint8-array-message-buffer.js +174 -174
  698. package/lib/common/message-rpc/uint8-array-message-buffer.spec.d.ts +1 -1
  699. package/lib/common/message-rpc/uint8-array-message-buffer.spec.js +38 -38
  700. package/lib/common/message-service-protocol.d.ts +110 -110
  701. package/lib/common/message-service-protocol.js +78 -78
  702. package/lib/common/message-service.d.ts +134 -134
  703. package/lib/common/message-service.js +162 -162
  704. package/lib/common/messaging/connection-error-handler.d.ts +28 -28
  705. package/lib/common/messaging/connection-error-handler.js +47 -47
  706. package/lib/common/messaging/connection-management.d.ts +24 -24
  707. package/lib/common/messaging/connection-management.js +37 -37
  708. package/lib/common/messaging/handler.d.ts +7 -7
  709. package/lib/common/messaging/handler.js +20 -20
  710. package/lib/common/messaging/index.d.ts +3 -3
  711. package/lib/common/messaging/index.js +30 -30
  712. package/lib/common/messaging/proxy-factory.d.ts +180 -180
  713. package/lib/common/messaging/proxy-factory.d.ts.map +1 -1
  714. package/lib/common/messaging/proxy-factory.js +280 -287
  715. package/lib/common/messaging/proxy-factory.js.map +1 -1
  716. package/lib/common/messaging/proxy-factory.spec.d.ts +1 -1
  717. package/lib/common/messaging/proxy-factory.spec.js +99 -99
  718. package/lib/common/messaging/socket-write-buffer.d.ts +10 -10
  719. package/lib/common/messaging/socket-write-buffer.js +49 -49
  720. package/lib/common/messaging/web-socket-channel.d.ts +19 -19
  721. package/lib/common/messaging/web-socket-channel.js +64 -64
  722. package/lib/common/nls.d.ts +15 -15
  723. package/lib/common/nls.js +133 -133
  724. package/lib/common/numbers.d.ts +5 -5
  725. package/lib/common/numbers.js +23 -23
  726. package/lib/common/objects.d.ts +8 -8
  727. package/lib/common/objects.js +118 -118
  728. package/lib/common/objects.spec.d.ts +1 -1
  729. package/lib/common/objects.spec.js +101 -101
  730. package/lib/common/os.d.ts +31 -31
  731. package/lib/common/os.js +73 -73
  732. package/lib/common/path.d.ts +93 -93
  733. package/lib/common/path.js +307 -307
  734. package/lib/common/path.spec.d.ts +1 -1
  735. package/lib/common/path.spec.js +350 -350
  736. package/lib/common/paths.d.ts +24 -24
  737. package/lib/common/paths.js +226 -226
  738. package/lib/common/performance/index.d.ts +3 -3
  739. package/lib/common/performance/index.js +30 -30
  740. package/lib/common/performance/measurement-protocol.d.ts +64 -64
  741. package/lib/common/performance/measurement-protocol.js +78 -78
  742. package/lib/common/performance/measurement.d.ts +111 -111
  743. package/lib/common/performance/measurement.js +17 -17
  744. package/lib/common/performance/stopwatch.d.ts +75 -75
  745. package/lib/common/performance/stopwatch.js +156 -156
  746. package/lib/common/preferences/preference-schema.d.ts +52 -52
  747. package/lib/common/preferences/preference-schema.js +58 -58
  748. package/lib/common/preferences/preference-scope.d.ts +19 -19
  749. package/lib/common/preferences/preference-scope.js +71 -71
  750. package/lib/common/preferences/preference-scope.spec.d.ts +1 -1
  751. package/lib/common/preferences/preference-scope.spec.js +44 -44
  752. package/lib/common/prioritizeable.d.ts +16 -16
  753. package/lib/common/prioritizeable.js +55 -55
  754. package/lib/common/progress-service-protocol.d.ts +13 -13
  755. package/lib/common/progress-service-protocol.js +19 -19
  756. package/lib/common/progress-service.d.ts +13 -13
  757. package/lib/common/progress-service.js +96 -96
  758. package/lib/common/promise-util.d.ts +51 -51
  759. package/lib/common/promise-util.js +132 -132
  760. package/lib/common/promise-util.spec.d.ts +1 -1
  761. package/lib/common/promise-util.spec.js +55 -55
  762. package/lib/common/quick-pick-service.d.ts +269 -280
  763. package/lib/common/quick-pick-service.d.ts.map +1 -1
  764. package/lib/common/quick-pick-service.js +133 -158
  765. package/lib/common/quick-pick-service.js.map +1 -1
  766. package/lib/common/reference.d.ts +95 -40
  767. package/lib/common/reference.d.ts.map +1 -1
  768. package/lib/common/reference.js +207 -152
  769. package/lib/common/reference.js.map +1 -1
  770. package/lib/common/reference.spec.d.ts +1 -1
  771. package/lib/common/reference.spec.js +125 -125
  772. package/lib/common/resource.d.ts +207 -205
  773. package/lib/common/resource.d.ts.map +1 -1
  774. package/lib/common/resource.js +333 -333
  775. package/lib/common/resource.js.map +1 -1
  776. package/lib/common/selection-command-handler.d.ts +24 -24
  777. package/lib/common/selection-command-handler.js +83 -83
  778. package/lib/common/selection-service.d.ts +18 -18
  779. package/lib/common/selection-service.js +48 -48
  780. package/lib/common/selection-service.spec.d.ts +1 -1
  781. package/lib/common/selection-service.spec.js +38 -38
  782. package/lib/common/selection.d.ts +9 -9
  783. package/lib/common/selection.js +47 -47
  784. package/lib/common/severity.d.ts +15 -15
  785. package/lib/common/severity.js +113 -113
  786. package/lib/common/stream.d.ts +176 -176
  787. package/lib/common/stream.js +474 -474
  788. package/lib/common/strings.d.ts +24 -24
  789. package/lib/common/strings.js +215 -215
  790. package/lib/common/telemetry.d.ts +19 -19
  791. package/lib/common/telemetry.js +24 -24
  792. package/lib/common/ternary-search-tree.d.ts +50 -50
  793. package/lib/common/ternary-search-tree.js +381 -381
  794. package/lib/common/test/expect.d.ts +2 -2
  795. package/lib/common/test/expect.js +34 -34
  796. package/lib/common/test/mock-logger.d.ts +27 -27
  797. package/lib/common/test/mock-logger.js +104 -104
  798. package/lib/common/test/mock-menu.d.ts +7 -7
  799. package/lib/common/test/mock-menu.js +34 -34
  800. package/lib/common/test/mock-resource-provider.d.ts +6 -6
  801. package/lib/common/test/mock-resource-provider.js +44 -44
  802. package/lib/common/theme.d.ts +40 -15
  803. package/lib/common/theme.d.ts.map +1 -1
  804. package/lib/common/theme.js +22 -22
  805. package/lib/common/theme.js.map +1 -1
  806. package/lib/common/types.d.ts +58 -58
  807. package/lib/common/types.js +126 -126
  808. package/lib/common/types.spec.d.ts +1 -1
  809. package/lib/common/types.spec.js +73 -73
  810. package/lib/common/uri-command-handler.d.ts +53 -53
  811. package/lib/common/uri-command-handler.js +99 -99
  812. package/lib/common/uri-command-handler.spec.d.ts +1 -1
  813. package/lib/common/uri-command-handler.spec.js +80 -80
  814. package/lib/common/uri.d.ts +87 -86
  815. package/lib/common/uri.d.ts.map +1 -1
  816. package/lib/common/uri.js +236 -236
  817. package/lib/common/uri.js.map +1 -1
  818. package/lib/common/uri.spec.d.ts +1 -1
  819. package/lib/common/uri.spec.js +230 -230
  820. package/lib/common/uuid.d.ts +8 -2
  821. package/lib/common/uuid.d.ts.map +1 -1
  822. package/lib/common/uuid.js +44 -85
  823. package/lib/common/uuid.js.map +1 -1
  824. package/lib/common/version.d.ts +1 -1
  825. package/lib/common/version.js +19 -19
  826. package/lib/common/view-column.d.ts +17 -17
  827. package/lib/common/view-column.js +36 -36
  828. package/lib/common/window.d.ts +16 -16
  829. package/lib/common/window.js +22 -22
  830. package/lib/electron-browser/electron-clipboard-service.d.ts +5 -5
  831. package/lib/electron-browser/electron-clipboard-service.js +38 -38
  832. package/lib/electron-browser/keyboard/electron-keyboard-layout-change-notifier.d.ts +11 -11
  833. package/lib/electron-browser/keyboard/electron-keyboard-layout-change-notifier.js +54 -54
  834. package/lib/electron-browser/keyboard/electron-keyboard-module.d.ts +3 -3
  835. package/lib/electron-browser/keyboard/electron-keyboard-module.js +26 -26
  836. package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts +30 -30
  837. package/lib/electron-browser/menu/electron-context-menu-renderer.js +137 -137
  838. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +59 -59
  839. package/lib/electron-browser/menu/electron-main-menu-factory.js +282 -282
  840. package/lib/electron-browser/menu/electron-menu-contribution.d.ts +78 -77
  841. package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
  842. package/lib/electron-browser/menu/electron-menu-contribution.js +482 -473
  843. package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
  844. package/lib/electron-browser/menu/electron-menu-module.d.ts +3 -3
  845. package/lib/electron-browser/menu/electron-menu-module.js +39 -39
  846. package/lib/electron-browser/messaging/electron-frontend-id-provider.d.ts +4 -4
  847. package/lib/electron-browser/messaging/electron-frontend-id-provider.js +34 -34
  848. package/lib/electron-browser/messaging/electron-ipc-connection-source.d.ts +23 -23
  849. package/lib/electron-browser/messaging/electron-ipc-connection-source.js +64 -64
  850. package/lib/electron-browser/messaging/electron-local-ws-connection-source.d.ts +6 -6
  851. package/lib/electron-browser/messaging/electron-local-ws-connection-source.js +54 -54
  852. package/lib/electron-browser/messaging/electron-messaging-frontend-module.d.ts +2 -2
  853. package/lib/electron-browser/messaging/electron-messaging-frontend-module.js +75 -75
  854. package/lib/electron-browser/messaging/electron-messaging-frontend-module.js.map +1 -1
  855. package/lib/electron-browser/messaging/electron-ws-connection-source.d.ts +11 -11
  856. package/lib/electron-browser/messaging/electron-ws-connection-source.js +50 -50
  857. package/lib/electron-browser/preload.d.ts +1 -1
  858. package/lib/electron-browser/preload.js +201 -201
  859. package/lib/electron-browser/request/electron-browser-request-module.d.ts +18 -18
  860. package/lib/electron-browser/request/electron-browser-request-module.js +26 -26
  861. package/lib/electron-browser/token/electron-token-frontend-module.d.ts +3 -3
  862. package/lib/electron-browser/token/electron-token-frontend-module.js +22 -22
  863. package/lib/electron-browser/window/electron-frontend-application-state.d.ts +4 -4
  864. package/lib/electron-browser/window/electron-frontend-application-state.js +36 -36
  865. package/lib/electron-browser/window/electron-secondary-window-service.d.ts +7 -7
  866. package/lib/electron-browser/window/electron-secondary-window-service.js +47 -47
  867. package/lib/electron-browser/window/electron-window-module.d.ts +3 -3
  868. package/lib/electron-browser/window/electron-window-module.js +39 -39
  869. package/lib/electron-browser/window/electron-window-preferences.d.ts +18 -18
  870. package/lib/electron-browser/window/electron-window-preferences.js +72 -72
  871. package/lib/electron-browser/window/electron-window-service.d.ts +29 -29
  872. package/lib/electron-browser/window/electron-window-service.js +114 -114
  873. package/lib/electron-common/electron-api.d.ts +104 -104
  874. package/lib/electron-common/electron-api.js +56 -56
  875. package/lib/electron-common/electron-main-window-service.d.ts +7 -7
  876. package/lib/electron-common/electron-main-window-service.js +20 -20
  877. package/lib/electron-common/electron-token.d.ts +10 -10
  878. package/lib/electron-common/electron-token.js +27 -27
  879. package/lib/electron-main/electron-api-main.d.ts +22 -22
  880. package/lib/electron-main/electron-api-main.js +294 -294
  881. package/lib/electron-main/electron-main-application-module.d.ts +3 -3
  882. package/lib/electron-main/electron-main-application-module.js +56 -56
  883. package/lib/electron-main/electron-main-application-module.js.map +1 -1
  884. package/lib/electron-main/electron-main-application.d.ts +159 -159
  885. package/lib/electron-main/electron-main-application.js +611 -611
  886. package/lib/electron-main/electron-main-application.js.map +1 -1
  887. package/lib/electron-main/electron-main-constants.d.ts +6 -6
  888. package/lib/electron-main/electron-main-constants.js +19 -19
  889. package/lib/electron-main/electron-main-window-service-impl.d.ts +8 -8
  890. package/lib/electron-main/electron-main-window-service-impl.js +54 -54
  891. package/lib/electron-main/electron-security-token-service.d.ts +5 -5
  892. package/lib/electron-main/electron-security-token-service.js +49 -49
  893. package/lib/electron-main/event-utils.d.ts +8 -8
  894. package/lib/electron-main/event-utils.js +33 -33
  895. package/lib/electron-main/messaging/electron-connection-handler.d.ts +5 -5
  896. package/lib/electron-main/messaging/electron-connection-handler.js +23 -23
  897. package/lib/electron-main/messaging/electron-messaging-contribution.d.ts +41 -41
  898. package/lib/electron-main/messaging/electron-messaging-contribution.js +150 -150
  899. package/lib/electron-main/messaging/electron-messaging-service.d.ts +17 -17
  900. package/lib/electron-main/messaging/electron-messaging-service.js +22 -22
  901. package/lib/electron-main/theia-electron-window.d.ts +53 -53
  902. package/lib/electron-main/theia-electron-window.js +194 -194
  903. package/lib/electron-main/theia-electron-window.js.map +1 -1
  904. package/lib/electron-node/hosting/electron-backend-hosting-module.d.ts +3 -3
  905. package/lib/electron-node/hosting/electron-backend-hosting-module.js +24 -24
  906. package/lib/electron-node/hosting/electron-ws-origin-validator.d.ts +8 -8
  907. package/lib/electron-node/hosting/electron-ws-origin-validator.js +48 -48
  908. package/lib/electron-node/keyboard/electron-backend-keyboard-module.d.ts +3 -3
  909. package/lib/electron-node/keyboard/electron-backend-keyboard-module.js +26 -26
  910. package/lib/electron-node/keyboard/electron-keyboard-layout-provider.d.ts +5 -5
  911. package/lib/electron-node/keyboard/electron-keyboard-layout-provider.js +41 -41
  912. package/lib/electron-node/request/electron-backend-request-module.d.ts +18 -18
  913. package/lib/electron-node/request/electron-backend-request-module.js +23 -23
  914. package/lib/electron-node/request/electron-backend-request-service.d.ts +22 -22
  915. package/lib/electron-node/request/electron-backend-request-service.js +86 -86
  916. package/lib/electron-node/token/electron-token-backend-contribution.d.ts +15 -15
  917. package/lib/electron-node/token/electron-token-backend-contribution.js +58 -58
  918. package/lib/electron-node/token/electron-token-backend-module.d.ts +3 -3
  919. package/lib/electron-node/token/electron-token-backend-module.js +28 -28
  920. package/lib/electron-node/token/electron-token-validator.d.ts +29 -29
  921. package/lib/electron-node/token/electron-token-validator.js +103 -103
  922. package/lib/node/application-server.d.ts +10 -9
  923. package/lib/node/application-server.d.ts.map +1 -1
  924. package/lib/node/application-server.js +63 -57
  925. package/lib/node/application-server.js.map +1 -1
  926. package/lib/node/backend-application-config-provider.d.ts +7 -7
  927. package/lib/node/backend-application-config-provider.js +45 -45
  928. package/lib/node/backend-application-config-provider.spec.d.ts +1 -1
  929. package/lib/node/backend-application-config-provider.spec.js +28 -28
  930. package/lib/node/backend-application-module.d.ts +2 -2
  931. package/lib/node/backend-application-module.js +108 -108
  932. package/lib/node/backend-application.d.ts +108 -108
  933. package/lib/node/backend-application.js +301 -301
  934. package/lib/node/backend-remote-service.d.ts +3 -3
  935. package/lib/node/backend-remote-service.js +34 -34
  936. package/lib/node/cli.d.ts +17 -17
  937. package/lib/node/cli.js +70 -70
  938. package/lib/node/cli.spec.d.ts +1 -1
  939. package/lib/node/cli.spec.js +89 -89
  940. package/lib/node/console-logger-server.d.ts +15 -15
  941. package/lib/node/console-logger-server.js +90 -90
  942. package/lib/node/console-logger-server.spec.d.ts +1 -1
  943. package/lib/node/console-logger-server.spec.js +69 -69
  944. package/lib/node/debug.d.ts +1 -1
  945. package/lib/node/debug.js +28 -28
  946. package/lib/node/dynamic-require.d.ts +7 -7
  947. package/lib/node/dynamic-require.js +56 -56
  948. package/lib/node/env-variables/env-variables-server.d.ts +23 -23
  949. package/lib/node/env-variables/env-variables-server.js +125 -125
  950. package/lib/node/env-variables/env-variables-server.js.map +1 -1
  951. package/lib/node/env-variables/index.d.ts +1 -1
  952. package/lib/node/env-variables/index.js +28 -28
  953. package/lib/node/environment-utils.d.ts +21 -21
  954. package/lib/node/environment-utils.js +77 -77
  955. package/lib/node/environment-utils.spec.d.ts +1 -1
  956. package/lib/node/environment-utils.spec.js +77 -77
  957. package/lib/node/file-uri.spec.d.ts +1 -1
  958. package/lib/node/file-uri.spec.js +66 -66
  959. package/lib/node/file-uri.spec.js.map +1 -1
  960. package/lib/node/filesystem-locking.d.ts +23 -23
  961. package/lib/node/filesystem-locking.js +70 -70
  962. package/lib/node/hosting/backend-application-hosts.d.ts +23 -23
  963. package/lib/node/hosting/backend-application-hosts.js +77 -77
  964. package/lib/node/hosting/backend-hosting-module.d.ts +3 -3
  965. package/lib/node/hosting/backend-hosting-module.js +26 -26
  966. package/lib/node/hosting/ws-origin-validator.d.ts +8 -8
  967. package/lib/node/hosting/ws-origin-validator.js +47 -47
  968. package/lib/node/i18n/i18n-backend-module.d.ts +3 -3
  969. package/lib/node/i18n/i18n-backend-module.js +38 -38
  970. package/lib/node/i18n/localization-contribution.d.ts +18 -18
  971. package/lib/node/i18n/localization-contribution.js +116 -116
  972. package/lib/node/i18n/localization-provider.d.ts +23 -23
  973. package/lib/node/i18n/localization-provider.js +114 -114
  974. package/lib/node/i18n/localization-server.d.ts +14 -14
  975. package/lib/node/i18n/localization-server.js +62 -62
  976. package/lib/node/i18n/theia-localization-contribution.d.ts +4 -4
  977. package/lib/node/i18n/theia-localization-contribution.js +45 -45
  978. package/lib/node/index.d.ts +6 -6
  979. package/lib/node/index.d.ts.map +1 -1
  980. package/lib/node/index.js +35 -35
  981. package/lib/node/index.js.map +1 -1
  982. package/lib/node/key-store-server.d.ts +27 -27
  983. package/lib/node/key-store-server.js +150 -150
  984. package/lib/node/logger-backend-module.d.ts +9 -9
  985. package/lib/node/logger-backend-module.js +78 -78
  986. package/lib/node/logger-cli-contribution.d.ts +33 -33
  987. package/lib/node/logger-cli-contribution.js +152 -152
  988. package/lib/node/logger-cli-contribution.spec.d.ts +1 -1
  989. package/lib/node/logger-cli-contribution.spec.js +207 -207
  990. package/lib/node/main.d.ts +7 -7
  991. package/lib/node/main.js +29 -29
  992. package/lib/node/messaging/binary-message-pipe.d.ts +44 -44
  993. package/lib/node/messaging/binary-message-pipe.js +151 -151
  994. package/lib/node/messaging/connection-container-module.d.ts +53 -53
  995. package/lib/node/messaging/connection-container-module.js +81 -81
  996. package/lib/node/messaging/default-messaging-service.d.ts +28 -28
  997. package/lib/node/messaging/default-messaging-service.js +139 -139
  998. package/lib/node/messaging/frontend-connection-service.d.ts +6 -6
  999. package/lib/node/messaging/frontend-connection-service.js +18 -18
  1000. package/lib/node/messaging/index.d.ts +3 -3
  1001. package/lib/node/messaging/index.js +30 -30
  1002. package/lib/node/messaging/ipc-bootstrap.d.ts +1 -1
  1003. package/lib/node/messaging/ipc-bootstrap.js +24 -24
  1004. package/lib/node/messaging/ipc-channel.d.ts +17 -17
  1005. package/lib/node/messaging/ipc-channel.js +69 -69
  1006. package/lib/node/messaging/ipc-connection-provider.d.ts +21 -21
  1007. package/lib/node/messaging/ipc-connection-provider.js +100 -100
  1008. package/lib/node/messaging/ipc-protocol.d.ts +19 -19
  1009. package/lib/node/messaging/ipc-protocol.js +68 -68
  1010. package/lib/node/messaging/messaging-backend-module.d.ts +2 -2
  1011. package/lib/node/messaging/messaging-backend-module.js +52 -52
  1012. package/lib/node/messaging/messaging-listeners.d.ts +27 -27
  1013. package/lib/node/messaging/messaging-listeners.js +53 -53
  1014. package/lib/node/messaging/messaging-service.d.ts +28 -28
  1015. package/lib/node/messaging/messaging-service.js +24 -24
  1016. package/lib/node/messaging/test/test-web-socket-channel.d.ts +12 -12
  1017. package/lib/node/messaging/test/test-web-socket-channel.js +62 -62
  1018. package/lib/node/messaging/websocket-endpoint.d.ts +20 -20
  1019. package/lib/node/messaging/websocket-endpoint.js +88 -88
  1020. package/lib/node/messaging/websocket-frontend-connection-service.d.ts +30 -29
  1021. package/lib/node/messaging/websocket-frontend-connection-service.d.ts.map +1 -1
  1022. package/lib/node/messaging/websocket-frontend-connection-service.js +177 -172
  1023. package/lib/node/messaging/websocket-frontend-connection-service.js.map +1 -1
  1024. package/lib/node/os-backend-provider.d.ts +4 -4
  1025. package/lib/node/os-backend-provider.js +35 -35
  1026. package/lib/node/performance/index.d.ts +2 -2
  1027. package/lib/node/performance/index.js +29 -29
  1028. package/lib/node/performance/measurement-backend-bindings.d.ts +19 -19
  1029. package/lib/node/performance/measurement-backend-bindings.js +30 -30
  1030. package/lib/node/performance/node-stopwatch.d.ts +20 -20
  1031. package/lib/node/performance/node-stopwatch.js +51 -51
  1032. package/lib/node/process-utils.d.ts +13 -13
  1033. package/lib/node/process-utils.js +110 -110
  1034. package/lib/node/process-utils.spec.d.ts +1 -1
  1035. package/lib/node/process-utils.spec.js +44 -44
  1036. package/lib/node/request/backend-request-facade.d.ts +22 -22
  1037. package/lib/node/request/backend-request-facade.js +49 -49
  1038. package/lib/node/request/backend-request-module.d.ts +18 -18
  1039. package/lib/node/request/backend-request-module.js +24 -24
  1040. package/lib/node/request/proxy-cli-contribution.d.ts +27 -27
  1041. package/lib/node/request/proxy-cli-contribution.js +72 -72
  1042. package/lib/node/ws-request-validators.d.ts +25 -25
  1043. package/lib/node/ws-request-validators.js +60 -60
  1044. package/package.json +13 -8
  1045. package/shared/ajv/index.d.ts +2 -2
  1046. package/shared/markdown-it.d.ts +2 -2
  1047. package/shared/markdown-it.js +1 -1
  1048. package/shared/reflect-metadata/index.d.ts +1 -1
  1049. package/shared/reflect-metadata/index.js +1 -1
  1050. package/shared/vscode-languageserver-types/index.d.ts +1 -1
  1051. package/src/browser/about-dialog.tsx +137 -137
  1052. package/src/browser/authentication-service.ts +456 -456
  1053. package/src/browser/breadcrumbs/breadcrumb-popup-container.ts +101 -101
  1054. package/src/browser/breadcrumbs/breadcrumb-renderer.tsx +41 -41
  1055. package/src/browser/breadcrumbs/breadcrumbs-constants.ts +79 -79
  1056. package/src/browser/breadcrumbs/breadcrumbs-renderer.tsx +185 -185
  1057. package/src/browser/breadcrumbs/breadcrumbs-service.ts +108 -108
  1058. package/src/browser/breadcrumbs/index.ts +21 -21
  1059. package/src/browser/browser-clipboard-service.ts +122 -122
  1060. package/src/browser/browser.ts +225 -220
  1061. package/src/browser/clipboard-service.ts +23 -23
  1062. package/src/browser/color-application-contribution.ts +101 -101
  1063. package/src/browser/color-registry.ts +60 -60
  1064. package/src/browser/command-open-handler.ts +54 -54
  1065. package/src/browser/common-frontend-contribution.ts +2526 -2526
  1066. package/src/browser/common-styling-participants.ts +361 -361
  1067. package/src/browser/connection-status-service.spec.ts +200 -200
  1068. package/src/browser/connection-status-service.ts +216 -216
  1069. package/src/browser/context-key-service.ts +142 -143
  1070. package/src/browser/context-menu-renderer.ts +124 -128
  1071. package/src/browser/core-preferences.ts +334 -328
  1072. package/src/browser/credentials-service.ts +106 -106
  1073. package/src/browser/decoration-style.ts +65 -65
  1074. package/src/browser/decorations-service.ts +209 -209
  1075. package/src/browser/dialogs/react-dialog.tsx +56 -56
  1076. package/src/browser/dialogs.ts +534 -534
  1077. package/src/browser/diff-uris.ts +117 -117
  1078. package/src/browser/encoding-registry.ts +97 -97
  1079. package/src/browser/endpoint.spec.ts +148 -148
  1080. package/src/browser/endpoint.ts +136 -136
  1081. package/src/browser/external-uri-service.ts +79 -79
  1082. package/src/browser/file-icons-js.d.ts +20 -20
  1083. package/src/browser/frontend-application-bindings.ts +62 -62
  1084. package/src/browser/frontend-application-config-provider.spec.ts +45 -45
  1085. package/src/browser/frontend-application-config-provider.ts +50 -50
  1086. package/src/browser/frontend-application-contribution.ts +110 -110
  1087. package/src/browser/frontend-application-module.ts +458 -457
  1088. package/src/browser/frontend-application-state.ts +74 -74
  1089. package/src/browser/frontend-application.ts +326 -326
  1090. package/src/browser/hover-service.ts +218 -218
  1091. package/src/browser/http-open-handler.ts +47 -47
  1092. package/src/browser/i18n/i18n-frontend-module.ts +27 -27
  1093. package/src/browser/i18n/language-quick-pick-service.ts +130 -130
  1094. package/src/browser/icon-registry.ts +87 -96
  1095. package/src/browser/icon-theme-contribution.ts +64 -64
  1096. package/src/browser/icon-theme-service.ts +217 -217
  1097. package/src/browser/icons/CollapseAll.svg +7 -7
  1098. package/src/browser/icons/CollapseAll_inverse.svg +7 -7
  1099. package/src/browser/icons/Refresh.svg +7 -7
  1100. package/src/browser/icons/Refresh_inverse.svg +7 -7
  1101. package/src/browser/icons/add-inverse.svg +4 -4
  1102. package/src/browser/icons/add.svg +4 -4
  1103. package/src/browser/icons/arrow-down-bright.svg +6 -6
  1104. package/src/browser/icons/arrow-down-dark.svg +6 -6
  1105. package/src/browser/icons/arrow-up-bright.svg +6 -6
  1106. package/src/browser/icons/arrow-up-dark.svg +6 -6
  1107. package/src/browser/icons/case-sensitive-dark.svg +16 -16
  1108. package/src/browser/icons/case-sensitive.svg +16 -16
  1109. package/src/browser/icons/chevron-right-dark.svg +5 -5
  1110. package/src/browser/icons/chevron-right-light.svg +6 -6
  1111. package/src/browser/icons/circle-bright.svg +7 -7
  1112. package/src/browser/icons/circle-dark.svg +7 -7
  1113. package/src/browser/icons/clear-search-results-dark.svg +7 -7
  1114. package/src/browser/icons/clear-search-results.svg +7 -7
  1115. package/src/browser/icons/close-all-bright.svg +7 -7
  1116. package/src/browser/icons/close-all-dark.svg +7 -7
  1117. package/src/browser/icons/close-bright.svg +7 -7
  1118. package/src/browser/icons/close-dark.svg +7 -7
  1119. package/src/browser/icons/collapse.svg +4 -4
  1120. package/src/browser/icons/edit-json-dark.svg +6 -6
  1121. package/src/browser/icons/edit-json.svg +6 -6
  1122. package/src/browser/icons/expand.svg +4 -4
  1123. package/src/browser/icons/loading-dark.svg +6 -6
  1124. package/src/browser/icons/loading-light.svg +6 -6
  1125. package/src/browser/icons/open-change-bright.svg +3 -3
  1126. package/src/browser/icons/open-change-dark.svg +4 -4
  1127. package/src/browser/icons/open-file-bright.svg +4 -4
  1128. package/src/browser/icons/open-file-dark.svg +4 -4
  1129. package/src/browser/icons/preview-bright.svg +3 -3
  1130. package/src/browser/icons/preview-dark.svg +3 -3
  1131. package/src/browser/icons/regex-dark.svg +10 -10
  1132. package/src/browser/icons/regex.svg +10 -10
  1133. package/src/browser/icons/remove-all-inverse.svg +4 -4
  1134. package/src/browser/icons/remove-all.svg +4 -4
  1135. package/src/browser/icons/replace-all-inverse.svg +13 -13
  1136. package/src/browser/icons/replace-all.svg +13 -13
  1137. package/src/browser/icons/replace-inverse.svg +15 -15
  1138. package/src/browser/icons/replace.svg +15 -15
  1139. package/src/browser/icons/whole-word-dark.svg +19 -19
  1140. package/src/browser/icons/whole-word.svg +19 -19
  1141. package/src/browser/index.ts +47 -47
  1142. package/src/browser/json-schema-store.ts +127 -127
  1143. package/src/browser/keybinding.spec.ts +553 -553
  1144. package/src/browser/keybinding.ts +756 -756
  1145. package/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +108 -108
  1146. package/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts +171 -171
  1147. package/src/browser/keyboard/browser-keyboard-layout-provider.ts +469 -469
  1148. package/src/browser/keyboard/browser-keyboard-module.ts +30 -30
  1149. package/src/browser/keyboard/index.ts +20 -20
  1150. package/src/browser/keyboard/keyboard-layout-service.spec.ts +121 -121
  1151. package/src/browser/keyboard/keyboard-layout-service.ts +455 -455
  1152. package/src/browser/keyboard/keys.spec.ts +258 -258
  1153. package/src/browser/keyboard/keys.ts +20 -20
  1154. package/src/browser/keys.ts +21 -21
  1155. package/src/browser/label-parser.spec.ts +165 -165
  1156. package/src/browser/label-parser.ts +108 -108
  1157. package/src/browser/label-provider.spec.ts +62 -62
  1158. package/src/browser/label-provider.ts +385 -385
  1159. package/src/browser/language-icon-provider.ts +55 -55
  1160. package/src/browser/language-service.ts +77 -77
  1161. package/src/browser/logger-frontend-module.ts +65 -65
  1162. package/src/browser/markdown-rendering/markdown-renderer.ts +98 -98
  1163. package/src/browser/menu/browser-context-menu-renderer.ts +47 -47
  1164. package/src/browser/menu/browser-menu-module.ts +28 -28
  1165. package/src/browser/menu/browser-menu-plugin.ts +484 -484
  1166. package/src/browser/menu/context-menu-context.ts +41 -41
  1167. package/src/browser/messaging/connection-source.ts +26 -26
  1168. package/src/browser/messaging/frontend-id-provider.ts +37 -37
  1169. package/src/browser/messaging/index.ts +17 -17
  1170. package/src/browser/messaging/messaging-frontend-module.ts +41 -41
  1171. package/src/browser/messaging/service-connection-provider.ts +126 -126
  1172. package/src/browser/messaging/ws-connection-provider.ts +48 -48
  1173. package/src/browser/messaging/ws-connection-source.ts +230 -210
  1174. package/src/browser/mime-service.ts +30 -30
  1175. package/src/browser/navigatable-types.ts +81 -81
  1176. package/src/browser/navigatable.ts +39 -39
  1177. package/src/browser/opener-service.spec.ts +49 -49
  1178. package/src/browser/opener-service.ts +146 -146
  1179. package/src/browser/performance/frontend-stopwatch.ts +65 -65
  1180. package/src/browser/performance/index.ts +18 -18
  1181. package/src/browser/performance/measurement-frontend-bindings.ts +31 -31
  1182. package/src/browser/preferences/index.ts +23 -23
  1183. package/src/browser/preferences/injectable-preference-proxy.ts +283 -283
  1184. package/src/browser/preferences/preference-configurations.ts +82 -82
  1185. package/src/browser/preferences/preference-contribution.ts +436 -436
  1186. package/src/browser/preferences/preference-language-override-service.ts +111 -111
  1187. package/src/browser/preferences/preference-provider.spec.ts +36 -36
  1188. package/src/browser/preferences/preference-provider.ts +277 -277
  1189. package/src/browser/preferences/preference-proxy.spec.ts +367 -367
  1190. package/src/browser/preferences/preference-proxy.ts +367 -367
  1191. package/src/browser/preferences/preference-schema-provider.spec.ts +130 -130
  1192. package/src/browser/preferences/preference-scope.ts +18 -18
  1193. package/src/browser/preferences/preference-service.spec.ts +613 -613
  1194. package/src/browser/preferences/preference-service.ts +594 -594
  1195. package/src/browser/preferences/preference-validation-service.spec.ts +334 -334
  1196. package/src/browser/preferences/preference-validation-service.ts +358 -358
  1197. package/src/browser/preferences/test/index.ts +19 -19
  1198. package/src/browser/preferences/test/mock-preference-provider.ts +50 -50
  1199. package/src/browser/preferences/test/mock-preference-proxy.ts +48 -48
  1200. package/src/browser/preferences/test/mock-preference-service.ts +63 -63
  1201. package/src/browser/preload/i18n-preload-contribution.ts +50 -50
  1202. package/src/browser/preload/os-preload-contribution.ts +37 -37
  1203. package/src/browser/preload/preload-module.ts +45 -45
  1204. package/src/browser/preload/preloader.ts +37 -37
  1205. package/src/browser/preload/theme-preload-contribution.ts +31 -31
  1206. package/src/browser/progress-bar-factory.ts +29 -29
  1207. package/src/browser/progress-bar.ts +76 -76
  1208. package/src/browser/progress-client.ts +53 -53
  1209. package/src/browser/progress-location-service.spec.ts +50 -50
  1210. package/src/browser/progress-location-service.ts +96 -96
  1211. package/src/browser/progress-status-bar-item.ts +83 -83
  1212. package/src/browser/quick-input/index.ts +23 -23
  1213. package/src/browser/quick-input/quick-access.ts +75 -75
  1214. package/src/browser/quick-input/quick-command-frontend-contribution.ts +89 -89
  1215. package/src/browser/quick-input/quick-command-service.ts +246 -246
  1216. package/src/browser/quick-input/quick-help-service.ts +87 -87
  1217. package/src/browser/quick-input/quick-input-frontend-contribution.ts +33 -33
  1218. package/src/browser/quick-input/quick-input-service.spec.ts +176 -176
  1219. package/src/browser/quick-input/quick-input-service.ts +17 -17
  1220. package/src/browser/quick-input/quick-pick-service-impl.ts +69 -69
  1221. package/src/browser/quick-input/quick-view-service.ts +83 -83
  1222. package/src/browser/request/browser-request-module.ts +23 -23
  1223. package/src/browser/request/browser-request-service.ts +172 -172
  1224. package/src/browser/resource-context-key.ts +77 -77
  1225. package/src/browser/save-resource-service.ts +60 -59
  1226. package/src/browser/saveable.ts +365 -365
  1227. package/src/browser/secondary-window-handler.ts +212 -212
  1228. package/src/browser/shell/additional-views-menu-widget.tsx +71 -71
  1229. package/src/browser/shell/application-shell-mouse-tracker.ts +103 -103
  1230. package/src/browser/shell/application-shell.ts +2254 -2249
  1231. package/src/browser/shell/current-widget-command-adapter.ts +57 -57
  1232. package/src/browser/shell/index.ts +23 -23
  1233. package/src/browser/shell/shell-layout-restorer.ts +399 -399
  1234. package/src/browser/shell/side-panel-handler.ts +793 -793
  1235. package/src/browser/shell/side-panel-toolbar.ts +111 -111
  1236. package/src/browser/shell/sidebar-bottom-menu-widget.tsx +39 -39
  1237. package/src/browser/shell/sidebar-menu-widget.tsx +140 -140
  1238. package/src/browser/shell/sidebar-top-menu-widget.tsx +26 -26
  1239. package/src/browser/shell/split-panels.ts +190 -190
  1240. package/src/browser/shell/tab-bar-decorator.ts +106 -76
  1241. package/src/browser/shell/tab-bar-toolbar/index.ts +19 -19
  1242. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.ts +31 -31
  1243. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts +256 -256
  1244. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.ts +207 -207
  1245. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.ts +62 -62
  1246. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx +423 -423
  1247. package/src/browser/shell/tab-bars.spec.ts +63 -63
  1248. package/src/browser/shell/tab-bars.ts +1481 -1449
  1249. package/src/browser/shell/theia-dock-panel.ts +255 -255
  1250. package/src/browser/shell/view-contribution.ts +177 -177
  1251. package/src/browser/source-tree/index.ts +19 -19
  1252. package/src/browser/source-tree/source-tree-widget.tsx +107 -107
  1253. package/src/browser/source-tree/source-tree.ts +146 -146
  1254. package/src/browser/source-tree/tree-source.ts +73 -73
  1255. package/src/browser/status-bar/index.ts +29 -29
  1256. package/src/browser/status-bar/status-bar-types.ts +97 -97
  1257. package/src/browser/status-bar/status-bar-view-model.ts +209 -209
  1258. package/src/browser/status-bar/status-bar.tsx +189 -189
  1259. package/src/browser/storage-service.spec.ts +76 -76
  1260. package/src/browser/storage-service.ts +129 -129
  1261. package/src/browser/style/about.css +36 -36
  1262. package/src/browser/style/alert-messages.css +62 -62
  1263. package/src/browser/style/ansi.css +88 -88
  1264. package/src/browser/style/breadcrumbs.css +130 -130
  1265. package/src/browser/style/dialog.css +126 -126
  1266. package/src/browser/style/dockpanel.css +76 -76
  1267. package/src/browser/style/hover-service.css +101 -101
  1268. package/src/browser/style/icons.css +61 -61
  1269. package/src/browser/style/index.css +351 -346
  1270. package/src/browser/style/materialcolors.css +278 -278
  1271. package/src/browser/style/menus.css +230 -230
  1272. package/src/browser/style/notification.css +39 -39
  1273. package/src/browser/style/os.css +87 -87
  1274. package/src/browser/style/progress-bar.css +43 -43
  1275. package/src/browser/style/quick-title-bar.css +45 -45
  1276. package/src/browser/style/scrollbars.css +172 -172
  1277. package/src/browser/style/search-box.css +123 -123
  1278. package/src/browser/style/select-component.css +107 -108
  1279. package/src/browser/style/sidepanel.css +364 -364
  1280. package/src/browser/style/status-bar.css +127 -127
  1281. package/src/browser/style/tabs.css +647 -641
  1282. package/src/browser/style/tooltip.css +28 -28
  1283. package/src/browser/style/tree-decorators.css +81 -81
  1284. package/src/browser/style/tree.css +232 -232
  1285. package/src/browser/style/view-container.css +194 -194
  1286. package/src/browser/style/widget.css +19 -19
  1287. package/src/browser/styling-service.ts +87 -87
  1288. package/src/browser/supported-encodings.ts +262 -262
  1289. package/src/browser/test/jsdom.ts +69 -69
  1290. package/src/browser/test/mock-connection-status-service.ts +33 -33
  1291. package/src/browser/test/mock-env-variables-server.ts +47 -47
  1292. package/src/browser/test/mock-opener-service.ts +34 -34
  1293. package/src/browser/test/mock-storage-service.ts +49 -49
  1294. package/src/browser/theming.ts +206 -206
  1295. package/src/browser/tooltip-service.tsx +96 -96
  1296. package/src/browser/tree/fuzzy-search.spec.ts +99 -99
  1297. package/src/browser/tree/fuzzy-search.ts +136 -136
  1298. package/src/browser/tree/index.ts +29 -28
  1299. package/src/browser/tree/search-box-debounce.ts +96 -96
  1300. package/src/browser/tree/search-box.ts +355 -355
  1301. package/src/browser/tree/test/mock-selectable-tree-model.ts +109 -0
  1302. package/src/browser/tree/test/mock-tree-model.ts +136 -136
  1303. package/src/browser/tree/test/tree-test-container.ts +50 -50
  1304. package/src/browser/tree/tree-compression/compressed-tree-expansion-service.ts +46 -46
  1305. package/src/browser/tree/tree-compression/compressed-tree-model.ts +88 -88
  1306. package/src/browser/tree/tree-compression/compressed-tree-widget.tsx +203 -203
  1307. package/src/browser/tree/tree-compression/index.ts +20 -20
  1308. package/src/browser/tree/tree-compression/tree-compression-service.ts +125 -125
  1309. package/src/browser/tree/tree-compression/tree-compression.css +28 -28
  1310. package/src/browser/tree/tree-consistency.spec.ts +105 -105
  1311. package/src/browser/tree/tree-container.spec.ts +45 -45
  1312. package/src/browser/tree/tree-container.ts +155 -155
  1313. package/src/browser/tree/tree-decorator.spec.ts +162 -162
  1314. package/src/browser/tree/tree-decorator.ts +238 -238
  1315. package/src/browser/tree/tree-expansion.spec.ts +173 -173
  1316. package/src/browser/tree/tree-expansion.ts +165 -165
  1317. package/src/browser/tree/tree-focus-service.ts +55 -55
  1318. package/src/browser/tree/tree-iterator.spec.ts +170 -170
  1319. package/src/browser/tree/tree-iterator.ts +256 -256
  1320. package/src/browser/tree/tree-label-provider.ts +40 -40
  1321. package/src/browser/tree/tree-model.ts +562 -488
  1322. package/src/browser/tree/tree-navigation.ts +58 -58
  1323. package/src/browser/tree/tree-preference.ts +50 -0
  1324. package/src/browser/tree/tree-search.ts +128 -128
  1325. package/src/browser/tree/tree-selectable.spec.ts +152 -0
  1326. package/src/browser/tree/tree-selection-impl.ts +176 -176
  1327. package/src/browser/tree/tree-selection-state.spec.ts +462 -462
  1328. package/src/browser/tree/tree-selection-state.ts +245 -245
  1329. package/src/browser/tree/tree-selection.ts +159 -159
  1330. package/src/browser/tree/tree-view-welcome-widget.tsx +263 -263
  1331. package/src/browser/tree/tree-widget-selection.ts +45 -45
  1332. package/src/browser/tree/tree-widget.tsx +1585 -1566
  1333. package/src/browser/tree/tree.spec.ts +241 -241
  1334. package/src/browser/tree/tree.ts +425 -424
  1335. package/src/browser/user-working-directory-provider.ts +77 -77
  1336. package/src/browser/view-container.ts +1640 -1640
  1337. package/src/browser/widget-decoration.ts +358 -358
  1338. package/src/browser/widget-manager.spec.ts +102 -102
  1339. package/src/browser/widget-manager.ts +310 -285
  1340. package/src/browser/widget-open-handler.ts +165 -165
  1341. package/src/browser/widgets/alert-message.tsx +56 -56
  1342. package/src/browser/widgets/enhanced-preview-widget.ts +27 -27
  1343. package/src/browser/widgets/extractable-widget.ts +33 -33
  1344. package/src/browser/widgets/index.ts +20 -20
  1345. package/src/browser/widgets/previewable-widget.ts +31 -31
  1346. package/src/browser/widgets/react-renderer.tsx +50 -50
  1347. package/src/browser/widgets/react-widget.tsx +51 -51
  1348. package/src/browser/widgets/select-component.tsx +367 -366
  1349. package/src/browser/widgets/widget.ts +406 -398
  1350. package/src/browser/window/browser-window-module.ts +32 -32
  1351. package/src/browser/window/default-secondary-window-service.ts +187 -187
  1352. package/src/browser/window/default-window-service.spec.ts +78 -78
  1353. package/src/browser/window/default-window-service.ts +167 -167
  1354. package/src/browser/window/secondary-window-service.ts +39 -39
  1355. package/src/browser/window/test/mock-window-service.ts +28 -28
  1356. package/src/browser/window/window-service.ts +68 -68
  1357. package/src/browser/window/window-title-service.ts +107 -107
  1358. package/src/browser/window/window-title-updater.ts +95 -95
  1359. package/src/browser/window-contribution.ts +64 -64
  1360. package/src/browser-only/frontend-only-application-module.ts +115 -0
  1361. package/src/browser-only/i18n/i18n-frontend-only-module.ts +37 -0
  1362. package/src/browser-only/logger-frontend-only-module.ts +63 -0
  1363. package/src/browser-only/messaging/frontend-only-service-connection-provider.ts +39 -0
  1364. package/src/browser-only/messaging/messaging-frontend-only-module.ts +42 -0
  1365. package/src/browser-only/preload/frontend-only-preload-module.ts +49 -0
  1366. package/src/common/accessibility.ts +33 -33
  1367. package/src/common/application-error.spec.ts +27 -27
  1368. package/src/common/application-error.ts +76 -76
  1369. package/src/common/application-protocol.ts +41 -40
  1370. package/src/common/array-utils.ts +129 -129
  1371. package/src/common/buffer.ts +228 -228
  1372. package/src/common/cancellation.ts +163 -163
  1373. package/src/common/char-code.ts +438 -438
  1374. package/src/common/collections.ts +125 -125
  1375. package/src/common/color.ts +103 -103
  1376. package/src/common/command.spec.ts +208 -208
  1377. package/src/common/command.ts +485 -485
  1378. package/src/common/contribution-filter/contribution-filter-registry.ts +79 -79
  1379. package/src/common/contribution-filter/contribution-filter.ts +64 -64
  1380. package/src/common/contribution-filter/filter.ts +23 -23
  1381. package/src/common/contribution-filter/index.ts +19 -19
  1382. package/src/common/contribution-provider.ts +96 -96
  1383. package/src/common/disposable.spec.ts +94 -29
  1384. package/src/common/disposable.ts +188 -135
  1385. package/src/common/encoding-service.ts +380 -380
  1386. package/src/common/encodings.ts +24 -24
  1387. package/src/common/env-variables/env-variables-protocol.ts +38 -38
  1388. package/src/common/env-variables/index.ts +17 -17
  1389. package/src/common/event.spec.ts +32 -32
  1390. package/src/common/event.ts +469 -469
  1391. package/src/{node → common}/file-uri.ts +61 -61
  1392. package/src/common/frontend-application-state.ts +38 -38
  1393. package/src/common/glob.ts +741 -741
  1394. package/src/common/hash.ts +85 -85
  1395. package/src/common/i18n/localization-server.ts +25 -25
  1396. package/src/common/i18n/localization.ts +80 -80
  1397. package/src/common/i18n/nls.metadata.json +31314 -31314
  1398. package/src/common/index.ts +51 -50
  1399. package/src/common/json-schema.ts +106 -106
  1400. package/src/common/key-store.ts +26 -26
  1401. package/src/common/keybinding.ts +152 -152
  1402. package/src/common/keyboard/keyboard-layout-provider.ts +51 -51
  1403. package/src/common/keys.ts +694 -694
  1404. package/src/common/label-protocol.ts +35 -35
  1405. package/src/common/logger-protocol.ts +119 -119
  1406. package/src/common/logger-watcher.ts +48 -48
  1407. package/src/common/logger.spec.ts +46 -46
  1408. package/src/common/logger.ts +389 -389
  1409. package/src/common/lsp-types.ts +34 -34
  1410. package/src/common/markdown-rendering/icon-utilities.ts +30 -30
  1411. package/src/common/markdown-rendering/index.ts +18 -18
  1412. package/src/common/markdown-rendering/markdown-string.ts +152 -149
  1413. package/src/common/menu/action-menu-node.ts +65 -65
  1414. package/src/common/menu/composite-menu-node.ts +114 -114
  1415. package/src/common/menu/index.ts +21 -21
  1416. package/src/common/menu/menu-adapter.ts +103 -103
  1417. package/src/common/menu/menu-model-registry.ts +343 -326
  1418. package/src/common/menu/menu-types.ts +219 -219
  1419. package/src/common/menu/menu.spec.ts +101 -73
  1420. package/src/common/message-rpc/channel.spec.ts +88 -88
  1421. package/src/common/message-rpc/channel.ts +300 -300
  1422. package/src/common/message-rpc/index.ts +22 -22
  1423. package/src/common/message-rpc/message-buffer.ts +105 -105
  1424. package/src/common/message-rpc/msg-pack-extension-manager.ts +70 -70
  1425. package/src/common/message-rpc/rpc-message-encoder.spec.ts +65 -65
  1426. package/src/common/message-rpc/rpc-message-encoder.ts +190 -190
  1427. package/src/common/message-rpc/rpc-protocol.ts +255 -235
  1428. package/src/common/message-rpc/uint8-array-message-buffer.spec.ts +41 -41
  1429. package/src/common/message-rpc/uint8-array-message-buffer.ts +213 -213
  1430. package/src/common/message-service-protocol.ts +148 -148
  1431. package/src/common/message-service.ts +226 -226
  1432. package/src/common/messaging/connection-error-handler.ts +73 -73
  1433. package/src/common/messaging/connection-management.ts +43 -43
  1434. package/src/common/messaging/handler.ts +26 -26
  1435. package/src/common/messaging/index.ts +19 -19
  1436. package/src/common/messaging/proxy-factory.spec.ts +108 -108
  1437. package/src/common/messaging/proxy-factory.ts +336 -343
  1438. package/src/common/messaging/socket-write-buffer.ts +52 -52
  1439. package/src/common/messaging/web-socket-channel.ts +76 -76
  1440. package/src/common/nls.ts +149 -149
  1441. package/src/common/numbers.ts +21 -21
  1442. package/src/common/objects.spec.ts +112 -112
  1443. package/src/common/objects.ts +123 -123
  1444. package/src/common/os.ts +82 -82
  1445. package/src/common/path.spec.ts +415 -415
  1446. package/src/common/path.ts +334 -334
  1447. package/src/common/paths.ts +250 -250
  1448. package/src/common/performance/index.ts +19 -19
  1449. package/src/common/performance/measurement-protocol.ts +104 -104
  1450. package/src/common/performance/measurement.ts +130 -130
  1451. package/src/common/performance/stopwatch.ts +183 -183
  1452. package/src/common/preferences/preference-schema.ts +95 -95
  1453. package/src/common/preferences/preference-scope.spec.ts +48 -48
  1454. package/src/common/preferences/preference-scope.ts +68 -68
  1455. package/src/common/prioritizeable.ts +58 -58
  1456. package/src/common/progress-service-protocol.ts +35 -35
  1457. package/src/common/progress-service.ts +82 -82
  1458. package/src/common/promise-util.spec.ts +72 -72
  1459. package/src/common/promise-util.ts +143 -143
  1460. package/src/common/quick-pick-service.ts +355 -377
  1461. package/src/common/reference.spec.ts +145 -145
  1462. package/src/common/reference.ts +230 -175
  1463. package/src/common/resource.ts +430 -426
  1464. package/src/common/selection-command-handler.ts +101 -101
  1465. package/src/common/selection-service.spec.ts +43 -43
  1466. package/src/common/selection-service.ts +49 -49
  1467. package/src/common/selection.ts +50 -50
  1468. package/src/common/severity.ts +111 -111
  1469. package/src/common/stream.ts +718 -718
  1470. package/src/common/strings.ts +231 -231
  1471. package/src/common/telemetry.ts +45 -45
  1472. package/src/common/ternary-search-tree.ts +417 -417
  1473. package/src/common/test/expect.ts +34 -34
  1474. package/src/common/test/mock-logger.ts +118 -118
  1475. package/src/common/test/mock-menu.ts +35 -35
  1476. package/src/common/test/mock-resource-provider.ts +33 -33
  1477. package/src/common/theme.ts +68 -36
  1478. package/src/common/types.spec.ts +86 -86
  1479. package/src/common/types.ts +140 -140
  1480. package/src/common/uri-command-handler.spec.ts +90 -90
  1481. package/src/common/uri-command-handler.ts +148 -148
  1482. package/src/common/uri.spec.ts +278 -278
  1483. package/src/common/uri.ts +279 -277
  1484. package/src/common/uuid.ts +45 -99
  1485. package/src/common/version.ts +17 -17
  1486. package/src/common/view-column.ts +33 -33
  1487. package/src/common/window.ts +34 -34
  1488. package/src/electron-browser/electron-clipboard-service.ts +32 -32
  1489. package/src/electron-browser/keyboard/electron-keyboard-layout-change-notifier.ts +39 -39
  1490. package/src/electron-browser/keyboard/electron-keyboard-module.ts +28 -28
  1491. package/src/electron-browser/menu/electron-context-menu-renderer.ts +120 -120
  1492. package/src/electron-browser/menu/electron-main-menu-factory.ts +335 -335
  1493. package/src/electron-browser/menu/electron-menu-contribution.ts +506 -498
  1494. package/src/electron-browser/menu/electron-menu-module.ts +40 -40
  1495. package/src/electron-browser/menu/electron-menu-style.css +110 -110
  1496. package/src/electron-browser/messaging/electron-frontend-id-provider.ts +25 -25
  1497. package/src/electron-browser/messaging/electron-ipc-connection-source.ts +65 -65
  1498. package/src/electron-browser/messaging/electron-local-ws-connection-source.ts +45 -45
  1499. package/src/electron-browser/messaging/electron-messaging-frontend-module.ts +78 -78
  1500. package/src/electron-browser/messaging/electron-ws-connection-source.ts +38 -38
  1501. package/src/electron-browser/preload.ts +246 -246
  1502. package/src/electron-browser/request/electron-browser-request-module.ts +26 -26
  1503. package/src/electron-browser/token/electron-token-frontend-module.ts +22 -22
  1504. package/src/electron-browser/window/electron-frontend-application-state.ts +26 -26
  1505. package/src/electron-browser/window/electron-secondary-window-service.ts +39 -39
  1506. package/src/electron-browser/window/electron-window-module.ts +41 -41
  1507. package/src/electron-browser/window/electron-window-preferences.ts +76 -76
  1508. package/src/electron-browser/window/electron-window-service.ts +97 -97
  1509. package/src/electron-common/electron-api.ts +148 -148
  1510. package/src/electron-common/electron-main-window-service.ts +24 -24
  1511. package/src/electron-common/electron-token.ts +27 -27
  1512. package/src/electron-main/electron-api-main.ts +333 -333
  1513. package/src/electron-main/electron-main-application-module.ts +65 -65
  1514. package/src/electron-main/electron-main-application.ts +685 -685
  1515. package/src/electron-main/electron-main-constants.ts +22 -22
  1516. package/src/electron-main/electron-main-window-service-impl.ts +44 -44
  1517. package/src/electron-main/electron-security-token-service.ts +36 -36
  1518. package/src/electron-main/event-utils.ts +36 -36
  1519. package/src/electron-main/messaging/electron-connection-handler.ts +21 -21
  1520. package/src/electron-main/messaging/electron-messaging-contribution.ts +143 -143
  1521. package/src/electron-main/messaging/electron-messaging-service.ts +35 -35
  1522. package/src/electron-main/theia-electron-window.ts +202 -202
  1523. package/src/electron-node/hosting/electron-backend-hosting-module.ts +24 -24
  1524. package/src/electron-node/hosting/electron-ws-origin-validator.ts +37 -37
  1525. package/src/electron-node/keyboard/electron-backend-keyboard-module.ts +30 -30
  1526. package/src/electron-node/keyboard/electron-keyboard-layout-provider.ts +35 -35
  1527. package/src/electron-node/request/electron-backend-request-module.ts +23 -23
  1528. package/src/electron-node/request/electron-backend-request-service.ts +78 -78
  1529. package/src/electron-node/token/electron-token-backend-contribution.ts +48 -48
  1530. package/src/electron-node/token/electron-token-backend-module.ts +28 -28
  1531. package/src/electron-node/token/electron-token-validator.ts +93 -93
  1532. package/src/node/application-server.ts +55 -48
  1533. package/src/node/backend-application-config-provider.spec.ts +29 -29
  1534. package/src/node/backend-application-config-provider.ts +48 -48
  1535. package/src/node/backend-application-module.ts +140 -140
  1536. package/src/node/backend-application.ts +382 -382
  1537. package/src/node/backend-remote-service.ts +25 -25
  1538. package/src/node/cli.spec.ts +94 -94
  1539. package/src/node/cli.ts +63 -63
  1540. package/src/node/console-logger-server.spec.ts +59 -59
  1541. package/src/node/console-logger-server.ts +76 -76
  1542. package/src/node/debug.ts +30 -30
  1543. package/src/node/dynamic-require.ts +56 -56
  1544. package/src/node/env-variables/env-variables-server.ts +120 -120
  1545. package/src/node/env-variables/index.ts +17 -17
  1546. package/src/node/environment-utils.spec.ts +92 -92
  1547. package/src/node/environment-utils.ts +66 -66
  1548. package/src/node/file-uri.spec.ts +76 -76
  1549. package/src/node/filesystem-locking.ts +77 -77
  1550. package/src/node/hosting/backend-application-hosts.ts +60 -60
  1551. package/src/node/hosting/backend-hosting-module.ts +26 -26
  1552. package/src/node/hosting/ws-origin-validator.ts +36 -36
  1553. package/src/node/i18n/i18n-backend-module.ts +42 -42
  1554. package/src/node/i18n/localization-contribution.ts +112 -112
  1555. package/src/node/i18n/localization-provider.ts +125 -125
  1556. package/src/node/i18n/localization-server.ts +52 -52
  1557. package/src/node/i18n/theia-localization-contribution.ts +36 -36
  1558. package/src/node/index.ts +22 -22
  1559. package/src/node/key-store-server.ts +162 -162
  1560. package/src/node/logger-backend-module.ts +88 -88
  1561. package/src/node/logger-cli-contribution.spec.ts +245 -245
  1562. package/src/node/logger-cli-contribution.ts +168 -168
  1563. package/src/node/main.ts +33 -33
  1564. package/src/node/messaging/binary-message-pipe.ts +168 -168
  1565. package/src/node/messaging/connection-container-module.ts +96 -96
  1566. package/src/node/messaging/default-messaging-service.ts +129 -129
  1567. package/src/node/messaging/frontend-connection-service.ts +24 -24
  1568. package/src/node/messaging/index.ts +19 -19
  1569. package/src/node/messaging/ipc-bootstrap.ts +27 -27
  1570. package/src/node/messaging/ipc-channel.ts +77 -77
  1571. package/src/node/messaging/ipc-connection-provider.ts +107 -107
  1572. package/src/node/messaging/ipc-protocol.ts +76 -76
  1573. package/src/node/messaging/messaging-backend-module.ts +52 -52
  1574. package/src/node/messaging/messaging-listeners.ts +52 -52
  1575. package/src/node/messaging/messaging-service.ts +46 -46
  1576. package/src/node/messaging/test/test-web-socket-channel.ts +61 -61
  1577. package/src/node/messaging/websocket-endpoint.ts +79 -79
  1578. package/src/node/messaging/websocket-frontend-connection-service.ts +176 -171
  1579. package/src/node/os-backend-provider.ts +25 -25
  1580. package/src/node/performance/index.ts +18 -18
  1581. package/src/node/performance/measurement-backend-bindings.ts +35 -35
  1582. package/src/node/performance/node-stopwatch.ts +40 -40
  1583. package/src/node/process-utils.spec.ts +48 -48
  1584. package/src/node/process-utils.ts +102 -102
  1585. package/src/node/request/backend-request-facade.ts +39 -39
  1586. package/src/node/request/backend-request-module.ts +25 -25
  1587. package/src/node/request/proxy-cli-contribution.ts +65 -65
  1588. package/src/node/ws-request-validators.ts +56 -56
  1589. package/src/typings/native-keymap.d.ts +108 -108
  1590. package/lib/node/file-uri.d.ts.map +0 -1
  1591. package/lib/node/file-uri.js.map +0 -1
@@ -1,1991 +1,1996 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- var __param = (this && this.__param) || function (paramIndex, decorator) {
27
- return function (target, key) { decorator(target, key, paramIndex); }
28
- };
29
- var ApplicationShell_1;
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.ApplicationShell = exports.DockPanelRenderer = exports.DockPanelRendererFactory = exports.ApplicationShellOptions = exports.applicationShellLayoutVersion = void 0;
32
- const inversify_1 = require("inversify");
33
- const algorithm_1 = require("@phosphor/algorithm");
34
- const widgets_1 = require("@phosphor/widgets");
35
- const common_1 = require("../../common");
36
- const browser_1 = require("../browser");
37
- const saveable_1 = require("../saveable");
38
- const status_bar_1 = require("../status-bar/status-bar");
39
- const theia_dock_panel_1 = require("./theia-dock-panel");
40
- const side_panel_handler_1 = require("./side-panel-handler");
41
- const tab_bars_1 = require("./tab-bars");
42
- const split_panels_1 = require("./split-panels");
43
- const frontend_application_state_1 = require("../frontend-application-state");
44
- const tab_bar_toolbar_1 = require("./tab-bar-toolbar");
45
- const context_key_service_1 = require("../context-key-service");
46
- const event_1 = require("../../common/event");
47
- const widgets_2 = require("../widgets");
48
- const core_preferences_1 = require("../core-preferences");
49
- const breadcrumbs_renderer_1 = require("../breadcrumbs/breadcrumbs-renderer");
50
- const promise_util_1 = require("../../common/promise-util");
51
- const save_resource_service_1 = require("../save-resource-service");
52
- const nls_1 = require("../../common/nls");
53
- const secondary_window_handler_1 = require("../secondary-window-handler");
54
- const uri_1 = require("../../common/uri");
55
- const opener_service_1 = require("../opener-service");
56
- const previewable_widget_1 = require("../widgets/previewable-widget");
57
- /** The class name added to ApplicationShell instances. */
58
- const APPLICATION_SHELL_CLASS = 'theia-ApplicationShell';
59
- /** The class name added to the main and bottom area panels. */
60
- const MAIN_BOTTOM_AREA_CLASS = 'theia-app-centers';
61
- /** Status bar entry identifier for the bottom panel toggle button. */
62
- const BOTTOM_PANEL_TOGGLE_ID = 'bottom-panel-toggle';
63
- /** The class name added to the main area panel. */
64
- const MAIN_AREA_CLASS = 'theia-app-main';
65
- /** The class name added to the bottom area panel. */
66
- const BOTTOM_AREA_CLASS = 'theia-app-bottom';
67
- /**
68
- * When a version is increased, make sure to introduce a migration (ApplicationShellLayoutMigration) to this version.
69
- */
70
- exports.applicationShellLayoutVersion = 5.0;
71
- exports.ApplicationShellOptions = Symbol('ApplicationShellOptions');
72
- exports.DockPanelRendererFactory = Symbol('DockPanelRendererFactory');
73
- /**
74
- * A renderer for dock panels that supports context menus on tabs.
75
- */
76
- let DockPanelRenderer = class DockPanelRenderer {
77
- constructor(tabBarRendererFactory, tabBarToolbarRegistry, tabBarToolbarFactory, breadcrumbsRendererFactory, corePreferences) {
78
- this.tabBarRendererFactory = tabBarRendererFactory;
79
- this.tabBarToolbarRegistry = tabBarToolbarRegistry;
80
- this.tabBarToolbarFactory = tabBarToolbarFactory;
81
- this.breadcrumbsRendererFactory = breadcrumbsRendererFactory;
82
- this.corePreferences = corePreferences;
83
- this.tabBarClasses = [];
84
- this.onDidCreateTabBarEmitter = new event_1.Emitter();
85
- }
86
- get onDidCreateTabBar() {
87
- return this.onDidCreateTabBarEmitter.event;
88
- }
89
- createTabBar() {
90
- const getDynamicTabOptions = () => {
91
- if (this.corePreferences.get('workbench.tab.shrinkToFit.enabled')) {
92
- return {
93
- minimumTabSize: this.corePreferences.get('workbench.tab.shrinkToFit.minimumSize'),
94
- defaultTabSize: this.corePreferences.get('workbench.tab.shrinkToFit.defaultSize')
95
- };
96
- }
97
- else {
98
- return undefined;
99
- }
100
- };
101
- const renderer = this.tabBarRendererFactory();
102
- const tabBar = new tab_bars_1.ToolbarAwareTabBar(this.tabBarToolbarRegistry, this.tabBarToolbarFactory, this.breadcrumbsRendererFactory, {
103
- renderer,
104
- // Scroll bar options
105
- handlers: ['drag-thumb', 'keyboard', 'wheel', 'touch'],
106
- useBothWheelAxes: true,
107
- scrollXMarginOffset: 4,
108
- suppressScrollY: true
109
- }, getDynamicTabOptions());
110
- this.tabBarClasses.forEach(c => tabBar.addClass(c));
111
- renderer.tabBar = tabBar;
112
- tabBar.disposed.connect(() => renderer.dispose());
113
- renderer.contextMenuPath = tab_bars_1.SHELL_TABBAR_CONTEXT_MENU;
114
- tabBar.currentChanged.connect(this.onCurrentTabChanged, this);
115
- this.corePreferences.onPreferenceChanged(change => {
116
- if (change.preferenceName === 'workbench.tab.shrinkToFit.enabled' ||
117
- change.preferenceName === 'workbench.tab.shrinkToFit.minimumSize' ||
118
- change.preferenceName === 'workbench.tab.shrinkToFit.defaultSize') {
119
- tabBar.dynamicTabOptions = getDynamicTabOptions();
120
- }
121
- });
122
- this.onDidCreateTabBarEmitter.fire(tabBar);
123
- return tabBar;
124
- }
125
- createHandle() {
126
- return widgets_1.DockPanel.defaultRenderer.createHandle();
127
- }
128
- onCurrentTabChanged(sender, { currentIndex }) {
129
- if (currentIndex >= 0) {
130
- sender.revealTab(currentIndex);
131
- }
132
- }
133
- };
134
- __decorate([
135
- (0, inversify_1.inject)(theia_dock_panel_1.TheiaDockPanel.Factory),
136
- __metadata("design:type", Function)
137
- ], DockPanelRenderer.prototype, "dockPanelFactory", void 0);
138
- DockPanelRenderer = __decorate([
139
- (0, inversify_1.injectable)(),
140
- __param(0, (0, inversify_1.inject)(tab_bars_1.TabBarRendererFactory)),
141
- __param(1, (0, inversify_1.inject)(tab_bar_toolbar_1.TabBarToolbarRegistry)),
142
- __param(2, (0, inversify_1.inject)(tab_bar_toolbar_1.TabBarToolbarFactory)),
143
- __param(3, (0, inversify_1.inject)(breadcrumbs_renderer_1.BreadcrumbsRendererFactory)),
144
- __param(4, (0, inversify_1.inject)(core_preferences_1.CorePreferences)),
145
- __metadata("design:paramtypes", [Function, tab_bar_toolbar_1.TabBarToolbarRegistry, Function, Function, Object])
146
- ], DockPanelRenderer);
147
- exports.DockPanelRenderer = DockPanelRenderer;
148
- /**
149
- * The application shell manages the top-level widgets of the application. Use this class to
150
- * add, remove, or activate a widget.
151
- */
152
- let ApplicationShell = ApplicationShell_1 = class ApplicationShell extends widgets_1.Widget {
153
- /**
154
- * Construct a new application shell.
155
- */
156
- constructor(dockPanelRendererFactory, statusBar, sidePanelHandlerFactory, splitPositionHandler, applicationStateService, options = {}, corePreferences, saveResourceService, secondaryWindowHandler) {
157
- super(options);
158
- this.dockPanelRendererFactory = dockPanelRendererFactory;
159
- this.statusBar = statusBar;
160
- this.sidePanelHandlerFactory = sidePanelHandlerFactory;
161
- this.splitPositionHandler = splitPositionHandler;
162
- this.applicationStateService = applicationStateService;
163
- this.corePreferences = corePreferences;
164
- this.saveResourceService = saveResourceService;
165
- this.secondaryWindowHandler = secondaryWindowHandler;
166
- /**
167
- * The current state of the bottom panel.
168
- */
169
- this.bottomPanelState = {
170
- empty: true,
171
- expansion: side_panel_handler_1.SidePanel.ExpansionState.collapsed,
172
- pendingUpdate: Promise.resolve()
173
- };
174
- this.tracker = new widgets_1.FocusTracker();
175
- this.onDidAddWidgetEmitter = new event_1.Emitter();
176
- this.onDidAddWidget = this.onDidAddWidgetEmitter.event;
177
- this.onDidRemoveWidgetEmitter = new event_1.Emitter();
178
- this.onDidRemoveWidget = this.onDidRemoveWidgetEmitter.event;
179
- this.onDidChangeActiveWidgetEmitter = new event_1.Emitter();
180
- this.onDidChangeActiveWidget = this.onDidChangeActiveWidgetEmitter.event;
181
- this.onDidChangeCurrentWidgetEmitter = new event_1.Emitter();
182
- this.onDidChangeCurrentWidget = this.onDidChangeCurrentWidgetEmitter.event;
183
- this.onDidDoubleClickMainAreaEmitter = new event_1.Emitter();
184
- this.onDidDoubleClickMainArea = this.onDidDoubleClickMainAreaEmitter.event;
185
- this.toDisposeOnActiveChanged = new common_1.DisposableCollection();
186
- this.activationTimeout = 2000;
187
- this.toDisposeOnActivationCheck = new common_1.DisposableCollection();
188
- // Merge the user-defined application options with the default options
189
- this.options = {
190
- bottomPanel: {
191
- ...ApplicationShell_1.DEFAULT_OPTIONS.bottomPanel,
192
- ...(options === null || options === void 0 ? void 0 : options.bottomPanel) || {}
193
- },
194
- leftPanel: {
195
- ...ApplicationShell_1.DEFAULT_OPTIONS.leftPanel,
196
- ...(options === null || options === void 0 ? void 0 : options.leftPanel) || {}
197
- },
198
- rightPanel: {
199
- ...ApplicationShell_1.DEFAULT_OPTIONS.rightPanel,
200
- ...(options === null || options === void 0 ? void 0 : options.rightPanel) || {}
201
- }
202
- };
203
- }
204
- fireDidAddWidget(widget) {
205
- this.onDidAddWidgetEmitter.fire(widget);
206
- }
207
- fireDidRemoveWidget(widget) {
208
- this.onDidRemoveWidgetEmitter.fire(widget);
209
- }
210
- get mainPanelRenderer() {
211
- return this._mainPanelRenderer;
212
- }
213
- init() {
214
- this.initializeShell();
215
- this.initSidebarVisibleKeyContext();
216
- this.initFocusKeyContexts();
217
- if (!common_1.environment.electron.is()) {
218
- this.corePreferences.ready.then(() => {
219
- this.setTopPanelVisibility(this.corePreferences['window.menuBarVisibility']);
220
- });
221
- this.corePreferences.onPreferenceChanged(preference => {
222
- if (preference.preferenceName === 'window.menuBarVisibility') {
223
- this.setTopPanelVisibility(preference.newValue);
224
- }
225
- });
226
- }
227
- this.corePreferences.onPreferenceChanged(preference => {
228
- if (preference.preferenceName === 'window.tabbar.enhancedPreview') {
229
- this.allTabBars.forEach(tabBar => {
230
- tabBar.update();
231
- });
232
- }
233
- });
234
- }
235
- initializeShell() {
236
- this.addClass(APPLICATION_SHELL_CLASS);
237
- this.id = 'theia-app-shell';
238
- this.mainPanel = this.createMainPanel();
239
- this.topPanel = this.createTopPanel();
240
- this.bottomPanel = this.createBottomPanel();
241
- this.leftPanelHandler = this.sidePanelHandlerFactory();
242
- this.leftPanelHandler.create('left', this.options.leftPanel);
243
- this.leftPanelHandler.dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
244
- this.leftPanelHandler.dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
245
- this.rightPanelHandler = this.sidePanelHandlerFactory();
246
- this.rightPanelHandler.create('right', this.options.rightPanel);
247
- this.rightPanelHandler.dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
248
- this.rightPanelHandler.dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
249
- this.secondaryWindowHandler.init(this);
250
- this.secondaryWindowHandler.onDidAddWidget(widget => this.fireDidAddWidget(widget));
251
- this.secondaryWindowHandler.onDidRemoveWidget(widget => this.fireDidRemoveWidget(widget));
252
- this.layout = this.createLayout();
253
- this.tracker.currentChanged.connect(this.onCurrentChanged, this);
254
- this.tracker.activeChanged.connect(this.onActiveChanged, this);
255
- }
256
- initSidebarVisibleKeyContext() {
257
- const leftSideBarPanel = this.leftPanelHandler.dockPanel;
258
- const sidebarVisibleKey = this.contextKeyService.createKey('sidebarVisible', leftSideBarPanel.isVisible);
259
- const onAfterShow = leftSideBarPanel['onAfterShow'].bind(leftSideBarPanel);
260
- leftSideBarPanel['onAfterShow'] = (msg) => {
261
- onAfterShow(msg);
262
- sidebarVisibleKey.set(true);
263
- };
264
- const onAfterHide = leftSideBarPanel['onAfterHide'].bind(leftSideBarPanel);
265
- leftSideBarPanel['onAfterHide'] = (msg) => {
266
- onAfterHide(msg);
267
- sidebarVisibleKey.set(false);
268
- };
269
- }
270
- initFocusKeyContexts() {
271
- const sideBarFocus = this.contextKeyService.createKey('sideBarFocus', false);
272
- const panelFocus = this.contextKeyService.createKey('panelFocus', false);
273
- const updateFocusContextKeys = () => {
274
- const area = this.activeWidget && this.getAreaFor(this.activeWidget);
275
- sideBarFocus.set(area === 'left');
276
- panelFocus.set(area === 'main');
277
- };
278
- updateFocusContextKeys();
279
- this.onDidChangeActiveWidget(updateFocusContextKeys);
280
- }
281
- setTopPanelVisibility(preference) {
282
- const hiddenPreferences = ['compact', 'hidden'];
283
- this.topPanel.setHidden(hiddenPreferences.includes(preference));
284
- }
285
- onBeforeAttach(msg) {
286
- document.addEventListener('p-dragenter', this, true);
287
- document.addEventListener('p-dragover', this, true);
288
- document.addEventListener('p-dragleave', this, true);
289
- document.addEventListener('p-drop', this, true);
290
- }
291
- onAfterDetach(msg) {
292
- document.removeEventListener('p-dragenter', this, true);
293
- document.removeEventListener('p-dragover', this, true);
294
- document.removeEventListener('p-dragleave', this, true);
295
- document.removeEventListener('p-drop', this, true);
296
- }
297
- handleEvent(event) {
298
- switch (event.type) {
299
- case 'p-dragenter':
300
- this.onDragEnter(event);
301
- break;
302
- case 'p-dragover':
303
- this.onDragOver(event);
304
- break;
305
- case 'p-drop':
306
- this.onDrop(event);
307
- break;
308
- case 'p-dragleave':
309
- this.onDragLeave(event);
310
- break;
311
- }
312
- }
313
- onDragEnter({ mimeData }) {
314
- if (!this.dragState) {
315
- if (mimeData && mimeData.hasData('application/vnd.phosphor.widget-factory')) {
316
- // The drag contains a widget, so we'll track it and expand side panels as needed
317
- this.dragState = {
318
- startTime: performance.now(),
319
- leftExpanded: false,
320
- rightExpanded: false,
321
- bottomExpanded: false
322
- };
323
- }
324
- }
325
- }
326
- onDragOver(event) {
327
- const state = this.dragState;
328
- if (state) {
329
- state.lastDragOver = event;
330
- if (state.leaveTimeout) {
331
- window.clearTimeout(state.leaveTimeout);
332
- state.leaveTimeout = undefined;
333
- }
334
- const { clientX, clientY } = event;
335
- const { offsetLeft, offsetTop, clientWidth, clientHeight } = this.node;
336
- // Don't expand any side panels right after the drag has started
337
- const allowExpansion = performance.now() - state.startTime >= 500;
338
- const expLeft = allowExpansion && clientX >= offsetLeft
339
- && clientX <= offsetLeft + this.options.leftPanel.expandThreshold;
340
- const expRight = allowExpansion && clientX <= offsetLeft + clientWidth
341
- && clientX >= offsetLeft + clientWidth - this.options.rightPanel.expandThreshold;
342
- const expBottom = allowExpansion && !expLeft && !expRight && clientY <= offsetTop + clientHeight
343
- && clientY >= offsetTop + clientHeight - this.options.bottomPanel.expandThreshold;
344
- // eslint-disable-next-line no-null/no-null
345
- if (expLeft && !state.leftExpanded && this.leftPanelHandler.tabBar.currentTitle === null) {
346
- // The mouse cursor is moved close to the left border
347
- this.leftPanelHandler.expand();
348
- this.leftPanelHandler.state.pendingUpdate.then(() => this.dispatchMouseMove());
349
- state.leftExpanded = true;
350
- }
351
- else if (!expLeft && state.leftExpanded) {
352
- // The mouse cursor is moved away from the left border
353
- this.leftPanelHandler.collapse();
354
- state.leftExpanded = false;
355
- }
356
- // eslint-disable-next-line no-null/no-null
357
- if (expRight && !state.rightExpanded && this.rightPanelHandler.tabBar.currentTitle === null) {
358
- // The mouse cursor is moved close to the right border
359
- this.rightPanelHandler.expand();
360
- this.rightPanelHandler.state.pendingUpdate.then(() => this.dispatchMouseMove());
361
- state.rightExpanded = true;
362
- }
363
- else if (!expRight && state.rightExpanded) {
364
- // The mouse cursor is moved away from the right border
365
- this.rightPanelHandler.collapse();
366
- state.rightExpanded = false;
367
- }
368
- if (expBottom && !state.bottomExpanded && this.bottomPanel.isHidden) {
369
- // The mouse cursor is moved close to the bottom border
370
- this.expandBottomPanel();
371
- this.bottomPanelState.pendingUpdate.then(() => this.dispatchMouseMove());
372
- state.bottomExpanded = true;
373
- }
374
- else if (!expBottom && state.bottomExpanded) {
375
- // The mouse cursor is moved away from the bottom border
376
- this.collapseBottomPanel();
377
- state.bottomExpanded = false;
378
- }
379
- }
380
- }
381
- /**
382
- * This method is called after a side panel has been expanded while dragging a widget. It fires
383
- * a `mousemove` event so that the drag overlay markers are updated correctly in all dock panels.
384
- */
385
- dispatchMouseMove() {
386
- if (this.dragState && this.dragState.lastDragOver) {
387
- const { clientX, clientY } = this.dragState.lastDragOver;
388
- const event = document.createEvent('MouseEvent');
389
- event.initMouseEvent('mousemove', true, true, window, 0, 0, 0,
390
- // eslint-disable-next-line no-null/no-null
391
- clientX, clientY, false, false, false, false, 0, null);
392
- document.dispatchEvent(event);
393
- }
394
- }
395
- onDrop(event) {
396
- const state = this.dragState;
397
- if (state) {
398
- if (state.leaveTimeout) {
399
- window.clearTimeout(state.leaveTimeout);
400
- }
401
- this.dragState = undefined;
402
- window.requestAnimationFrame(() => {
403
- // Clean up the side panel state in the next frame
404
- if (this.leftPanelHandler.dockPanel.isEmpty) {
405
- this.leftPanelHandler.collapse();
406
- }
407
- if (this.rightPanelHandler.dockPanel.isEmpty) {
408
- this.rightPanelHandler.collapse();
409
- }
410
- if (this.bottomPanel.isEmpty) {
411
- this.collapseBottomPanel();
412
- }
413
- });
414
- }
415
- }
416
- onDragLeave(event) {
417
- const state = this.dragState;
418
- if (state) {
419
- state.lastDragOver = undefined;
420
- if (state.leaveTimeout) {
421
- window.clearTimeout(state.leaveTimeout);
422
- }
423
- state.leaveTimeout = window.setTimeout(() => {
424
- this.dragState = undefined;
425
- if (state.leftExpanded || this.leftPanelHandler.dockPanel.isEmpty) {
426
- this.leftPanelHandler.collapse();
427
- }
428
- if (state.rightExpanded || this.rightPanelHandler.dockPanel.isEmpty) {
429
- this.rightPanelHandler.collapse();
430
- }
431
- if (state.bottomExpanded || this.bottomPanel.isEmpty) {
432
- this.collapseBottomPanel();
433
- }
434
- }, 100);
435
- }
436
- }
437
- /**
438
- * Create the dock panel in the main shell area.
439
- */
440
- createMainPanel() {
441
- const renderer = this.dockPanelRendererFactory();
442
- renderer.tabBarClasses.push(MAIN_BOTTOM_AREA_CLASS);
443
- renderer.tabBarClasses.push(MAIN_AREA_CLASS);
444
- this._mainPanelRenderer = renderer;
445
- const dockPanel = this.dockPanelFactory({
446
- mode: 'multiple-document',
447
- renderer,
448
- spacing: 0
449
- });
450
- dockPanel.id = theia_dock_panel_1.MAIN_AREA_ID;
451
- dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
452
- dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
453
- const openUri = async (fileUri) => {
454
- try {
455
- const opener = await this.openerService.getOpener(fileUri);
456
- opener.open(fileUri);
457
- }
458
- catch (e) {
459
- console.info(`no opener found for '${fileUri}'`);
460
- }
461
- };
462
- dockPanel.node.addEventListener('drop', event => {
463
- var _a;
464
- if (event.dataTransfer) {
465
- const uris = this.additionalDraggedUris || ApplicationShell_1.getDraggedEditorUris(event.dataTransfer);
466
- if (uris.length > 0) {
467
- uris.forEach(openUri);
468
- }
469
- else if (((_a = event.dataTransfer.files) === null || _a === void 0 ? void 0 : _a.length) > 0) {
470
- // the files were dragged from the outside the workspace
471
- Array.from(event.dataTransfer.files).forEach(file => {
472
- if (file.path) {
473
- const fileUri = uri_1.default.fromComponents({
474
- scheme: 'file',
475
- path: file.path,
476
- authority: '',
477
- query: '',
478
- fragment: ''
479
- });
480
- openUri(fileUri);
481
- }
482
- });
483
- }
484
- }
485
- });
486
- dockPanel.node.addEventListener('dblclick', event => {
487
- const el = event.target;
488
- if (el.id === theia_dock_panel_1.MAIN_AREA_ID || el.classList.contains('p-TabBar-content')) {
489
- this.onDidDoubleClickMainAreaEmitter.fire();
490
- }
491
- });
492
- const handler = (e) => {
493
- if (e.dataTransfer) {
494
- e.dataTransfer.dropEffect = 'link';
495
- e.preventDefault();
496
- e.stopPropagation();
497
- }
498
- };
499
- dockPanel.node.addEventListener('dragover', handler);
500
- dockPanel.node.addEventListener('dragenter', handler);
501
- return dockPanel;
502
- }
503
- addAdditionalDraggedEditorUris(uris) {
504
- this.additionalDraggedUris = uris;
505
- }
506
- clearAdditionalDraggedEditorUris() {
507
- this.additionalDraggedUris = undefined;
508
- }
509
- static getDraggedEditorUris(dataTransfer) {
510
- const data = dataTransfer.getData('theia-editor-dnd');
511
- return data ? data.split('\n').map(entry => new uri_1.default(entry)) : [];
512
- }
513
- static setDraggedEditorUris(dataTransfer, uris) {
514
- dataTransfer.setData('theia-editor-dnd', uris.map(uri => uri.toString()).join('\n'));
515
- }
516
- /**
517
- * Create the dock panel in the bottom shell area.
518
- */
519
- createBottomPanel() {
520
- const renderer = this.dockPanelRendererFactory();
521
- renderer.tabBarClasses.push(MAIN_BOTTOM_AREA_CLASS);
522
- renderer.tabBarClasses.push(BOTTOM_AREA_CLASS);
523
- const dockPanel = this.dockPanelFactory({
524
- mode: 'multiple-document',
525
- renderer,
526
- spacing: 0
527
- });
528
- dockPanel.id = theia_dock_panel_1.BOTTOM_AREA_ID;
529
- dockPanel.widgetAdded.connect((sender, widget) => {
530
- this.refreshBottomPanelToggleButton();
531
- });
532
- dockPanel.widgetRemoved.connect((sender, widget) => {
533
- if (sender.isEmpty) {
534
- this.collapseBottomPanel();
535
- }
536
- this.refreshBottomPanelToggleButton();
537
- }, this);
538
- dockPanel.node.addEventListener('p-dragenter', event => {
539
- // Make sure that the main panel hides its overlay when the bottom panel is expanded
540
- this.mainPanel.overlay.hide(0);
541
- });
542
- dockPanel.hide();
543
- dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
544
- dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
545
- return dockPanel;
546
- }
547
- /**
548
- * Create the top panel, which is used to hold the main menu.
549
- */
550
- createTopPanel() {
551
- const topPanel = new widgets_1.Panel();
552
- topPanel.id = 'theia-top-panel';
553
- topPanel.hide();
554
- return topPanel;
555
- }
556
- /**
557
- * Create a box layout to assemble the application shell layout.
558
- */
559
- createBoxLayout(widgets, stretch, options) {
560
- const boxLayout = new widgets_1.BoxLayout(options);
561
- for (let i = 0; i < widgets.length; i++) {
562
- if (stretch !== undefined && i < stretch.length) {
563
- widgets_1.BoxPanel.setStretch(widgets[i], stretch[i]);
564
- }
565
- boxLayout.addWidget(widgets[i]);
566
- }
567
- return boxLayout;
568
- }
569
- /**
570
- * Create a split layout to assemble the application shell layout.
571
- */
572
- createSplitLayout(widgets, stretch, options) {
573
- let optParam = { renderer: widgets_1.SplitPanel.defaultRenderer, };
574
- if (options) {
575
- optParam = { ...optParam, ...options };
576
- }
577
- const splitLayout = new widgets_1.SplitLayout(optParam);
578
- for (let i = 0; i < widgets.length; i++) {
579
- if (stretch !== undefined && i < stretch.length) {
580
- widgets_1.SplitPanel.setStretch(widgets[i], stretch[i]);
581
- }
582
- splitLayout.addWidget(widgets[i]);
583
- }
584
- return splitLayout;
585
- }
586
- /**
587
- * Assemble the application shell layout. Override this method in order to change the arrangement
588
- * of the main area and the side panels.
589
- */
590
- createLayout() {
591
- const bottomSplitLayout = this.createSplitLayout([this.mainPanel, this.bottomPanel], [1, 0], { orientation: 'vertical', spacing: 0 });
592
- const panelForBottomArea = new widgets_1.SplitPanel({ layout: bottomSplitLayout });
593
- panelForBottomArea.id = 'theia-bottom-split-panel';
594
- const leftRightSplitLayout = this.createSplitLayout([this.leftPanelHandler.container, panelForBottomArea, this.rightPanelHandler.container], [0, 1, 0], { orientation: 'horizontal', spacing: 0 });
595
- const panelForSideAreas = new widgets_1.SplitPanel({ layout: leftRightSplitLayout });
596
- panelForSideAreas.id = 'theia-left-right-split-panel';
597
- return this.createBoxLayout([this.topPanel, panelForSideAreas, this.statusBar], [0, 1, 0], { direction: 'top-to-bottom', spacing: 0 });
598
- }
599
- /**
600
- * Create an object that describes the current shell layout. This object may contain references
601
- * to widgets; these need to be transformed before the layout can be serialized.
602
- */
603
- getLayoutData() {
604
- return {
605
- version: exports.applicationShellLayoutVersion,
606
- mainPanel: this.mainPanel.saveLayout(),
607
- mainPanelPinned: this.getPinnedMainWidgets(),
608
- bottomPanel: {
609
- config: this.bottomPanel.saveLayout(),
610
- pinned: this.getPinnedBottomWidgets(),
611
- size: this.bottomPanel.isVisible ? this.getBottomPanelSize() : this.bottomPanelState.lastPanelSize,
612
- expanded: this.isExpanded('bottom')
613
- },
614
- leftPanel: this.leftPanelHandler.getLayoutData(),
615
- rightPanel: this.rightPanelHandler.getLayoutData(),
616
- activeWidgetId: this.activeWidget ? this.activeWidget.id : undefined
617
- };
618
- }
619
- // Get an array corresponding to main panel widgets' pinned state.
620
- getPinnedMainWidgets() {
621
- const pinned = [];
622
- (0, algorithm_1.toArray)(this.mainPanel.widgets()).forEach((a, i) => {
623
- pinned[i] = a.title.className.includes(widgets_2.PINNED_CLASS);
624
- });
625
- return pinned;
626
- }
627
- // Get an array corresponding to bottom panel widgets' pinned state.
628
- getPinnedBottomWidgets() {
629
- const pinned = [];
630
- (0, algorithm_1.toArray)(this.bottomPanel.widgets()).forEach((a, i) => {
631
- pinned[i] = a.title.className.includes(widgets_2.PINNED_CLASS);
632
- });
633
- return pinned;
634
- }
635
- /**
636
- * Compute the current height of the bottom panel. This implementation assumes that the container
637
- * of the bottom panel is a `SplitPanel`.
638
- */
639
- getBottomPanelSize() {
640
- const parent = this.bottomPanel.parent;
641
- if (parent instanceof widgets_1.SplitPanel && parent.isVisible) {
642
- const index = parent.widgets.indexOf(this.bottomPanel) - 1;
643
- if (index >= 0) {
644
- const handle = parent.handles[index];
645
- if (!handle.classList.contains('p-mod-hidden')) {
646
- const parentHeight = parent.node.clientHeight;
647
- return parentHeight - handle.offsetTop;
648
- }
649
- }
650
- }
651
- }
652
- /**
653
- * Determine the default size to apply when the bottom panel is expanded for the first time.
654
- */
655
- getDefaultBottomPanelSize() {
656
- const parent = this.bottomPanel.parent;
657
- if (parent && parent.isVisible) {
658
- return parent.node.clientHeight * this.options.bottomPanel.initialSizeRatio;
659
- }
660
- }
661
- /**
662
- * Apply a shell layout that has been previously created with `getLayoutData`.
663
- */
664
- async setLayoutData(layoutData) {
665
- var _a, _b;
666
- const { mainPanel, mainPanelPinned, bottomPanel, leftPanel, rightPanel, activeWidgetId } = layoutData;
667
- if (leftPanel) {
668
- this.leftPanelHandler.setLayoutData(leftPanel);
669
- this.registerWithFocusTracker(leftPanel);
670
- }
671
- if (rightPanel) {
672
- this.rightPanelHandler.setLayoutData(rightPanel);
673
- this.registerWithFocusTracker(rightPanel);
674
- }
675
- // Proceed with the bottom panel once the side panels are set up
676
- await Promise.all([this.leftPanelHandler.state.pendingUpdate, this.rightPanelHandler.state.pendingUpdate]);
677
- if (bottomPanel) {
678
- if (bottomPanel.config) {
679
- this.bottomPanel.restoreLayout(bottomPanel.config);
680
- this.registerWithFocusTracker(bottomPanel.config.main);
681
- }
682
- if (bottomPanel.size) {
683
- this.bottomPanelState.lastPanelSize = bottomPanel.size;
684
- }
685
- if (bottomPanel.expanded) {
686
- this.expandBottomPanel();
687
- }
688
- else {
689
- this.collapseBottomPanel();
690
- }
691
- const widgets = (0, algorithm_1.toArray)(this.bottomPanel.widgets());
692
- this.bottomPanel.markActiveTabBar((_a = widgets[0]) === null || _a === void 0 ? void 0 : _a.title);
693
- if (bottomPanel.pinned && bottomPanel.pinned.length === widgets.length) {
694
- widgets.forEach((a, i) => {
695
- if (bottomPanel.pinned[i]) {
696
- a.title.className += ` ${widgets_2.PINNED_CLASS}`;
697
- a.title.closable = false;
698
- }
699
- });
700
- }
701
- this.refreshBottomPanelToggleButton();
702
- }
703
- // Proceed with the main panel once all others are set up
704
- await this.bottomPanelState.pendingUpdate;
705
- if (mainPanel) {
706
- this.mainPanel.restoreLayout(mainPanel);
707
- this.registerWithFocusTracker(mainPanel.main);
708
- const widgets = (0, algorithm_1.toArray)(this.mainPanel.widgets());
709
- // We don't store information about the last active tabbar
710
- // So we simply mark the first as being active
711
- this.mainPanel.markActiveTabBar((_b = widgets[0]) === null || _b === void 0 ? void 0 : _b.title);
712
- if (mainPanelPinned && mainPanelPinned.length === widgets.length) {
713
- widgets.forEach((a, i) => {
714
- if (mainPanelPinned[i]) {
715
- a.title.className += ` ${widgets_2.PINNED_CLASS}`;
716
- a.title.closable = false;
717
- }
718
- });
719
- }
720
- }
721
- if (activeWidgetId) {
722
- this.activateWidget(activeWidgetId);
723
- }
724
- }
725
- /**
726
- * Modify the height of the bottom panel. This implementation assumes that the container of the
727
- * bottom panel is a `SplitPanel`.
728
- */
729
- setBottomPanelSize(size) {
730
- const enableAnimation = this.applicationStateService.state === 'ready';
731
- const options = {
732
- side: 'bottom',
733
- duration: enableAnimation ? this.options.bottomPanel.expandDuration : 0,
734
- referenceWidget: this.bottomPanel
735
- };
736
- const promise = this.splitPositionHandler.setSidePanelSize(this.bottomPanel, size, options);
737
- const result = new Promise(resolve => {
738
- // Resolve the resulting promise in any case, regardless of whether resizing was successful
739
- promise.then(() => resolve(), () => resolve());
740
- });
741
- this.bottomPanelState.pendingUpdate = this.bottomPanelState.pendingUpdate.then(() => result);
742
- return result;
743
- }
744
- /**
745
- * A promise that is resolved when all currently pending updates are done.
746
- */
747
- get pendingUpdates() {
748
- return Promise.all([
749
- this.bottomPanelState.pendingUpdate,
750
- this.leftPanelHandler.state.pendingUpdate,
751
- this.rightPanelHandler.state.pendingUpdate
752
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
753
- ]);
754
- }
755
- /**
756
- * Track all widgets that are referenced by the given layout data.
757
- */
758
- registerWithFocusTracker(data) {
759
- if (data) {
760
- if (data.type === 'tab-area') {
761
- for (const widget of data.widgets) {
762
- if (widget) {
763
- this.track(widget);
764
- }
765
- }
766
- }
767
- else if (data.type === 'split-area') {
768
- for (const child of data.children) {
769
- this.registerWithFocusTracker(child);
770
- }
771
- }
772
- else if (data.type === 'sidepanel' && data.items) {
773
- for (const item of data.items) {
774
- if (item.widget) {
775
- this.track(item.widget);
776
- }
777
- }
778
- }
779
- }
780
- }
781
- /**
782
- * Add a widget to the application shell. The given widget must have a unique `id` property,
783
- * which will be used as the DOM id.
784
- *
785
- * Widgets are removed from the shell by calling their `close` or `dispose` methods.
786
- *
787
- * Widgets added to the top area are not tracked regarding the _current_ and _active_ states.
788
- */
789
- async addWidget(widget, options) {
790
- if (!widget.id) {
791
- console.error('Widgets added to the application shell must have a unique id property.');
792
- return;
793
- }
794
- const { area, addOptions } = this.getInsertionOptions(options);
795
- const sidePanelOptions = { rank: options === null || options === void 0 ? void 0 : options.rank };
796
- switch (area) {
797
- case 'main':
798
- this.mainPanel.addWidget(widget, addOptions);
799
- break;
800
- case 'top':
801
- this.topPanel.addWidget(widget);
802
- break;
803
- case 'bottom':
804
- this.bottomPanel.addWidget(widget, addOptions);
805
- break;
806
- case 'left':
807
- this.leftPanelHandler.addWidget(widget, sidePanelOptions);
808
- break;
809
- case 'right':
810
- this.rightPanelHandler.addWidget(widget, sidePanelOptions);
811
- break;
812
- case 'secondaryWindow':
813
- /** At the moment, widgets are only moved to this area (i.e. a secondary window) by moving them from one of the other areas. */
814
- throw new Error('Widgets cannot be added directly to a secondary window');
815
- default:
816
- throw new Error('Unexpected area: ' + (options === null || options === void 0 ? void 0 : options.area));
817
- }
818
- if (area !== 'top') {
819
- this.track(widget);
820
- }
821
- }
822
- getInsertionOptions(options) {
823
- let ref = options === null || options === void 0 ? void 0 : options.ref;
824
- let area = (options === null || options === void 0 ? void 0 : options.area) || 'main';
825
- if (!ref && (area === 'main' || area === 'bottom')) {
826
- const tabBar = this.getTabBarFor(area);
827
- ref = tabBar && tabBar.currentTitle && tabBar.currentTitle.owner || undefined;
828
- }
829
- // make sure that ref belongs to area
830
- area = ref && this.getAreaFor(ref) || area;
831
- const addOptions = {};
832
- if (ApplicationShell_1.isOpenToSideMode(options === null || options === void 0 ? void 0 : options.mode)) {
833
- const areaPanel = area === 'main' ? this.mainPanel : area === 'bottom' ? this.bottomPanel : undefined;
834
- const sideRef = areaPanel && ref && ((options === null || options === void 0 ? void 0 : options.mode) === 'open-to-left' ?
835
- areaPanel.previousTabBarWidget(ref) :
836
- areaPanel.nextTabBarWidget(ref));
837
- if (sideRef) {
838
- addOptions.ref = sideRef;
839
- }
840
- else {
841
- addOptions.ref = ref;
842
- addOptions.mode = (options === null || options === void 0 ? void 0 : options.mode) === 'open-to-left' ? 'split-left' : 'split-right';
843
- }
844
- }
845
- else {
846
- addOptions.ref = ref;
847
- addOptions.mode = options === null || options === void 0 ? void 0 : options.mode;
848
- }
849
- return { area, addOptions };
850
- }
851
- /**
852
- * The widgets contained in the given shell area.
853
- */
854
- getWidgets(area) {
855
- switch (area) {
856
- case 'main':
857
- return (0, algorithm_1.toArray)(this.mainPanel.widgets());
858
- case 'top':
859
- return (0, algorithm_1.toArray)(this.topPanel.widgets);
860
- case 'bottom':
861
- return (0, algorithm_1.toArray)(this.bottomPanel.widgets());
862
- case 'left':
863
- return (0, algorithm_1.toArray)(this.leftPanelHandler.dockPanel.widgets());
864
- case 'right':
865
- return (0, algorithm_1.toArray)(this.rightPanelHandler.dockPanel.widgets());
866
- case 'secondaryWindow':
867
- return (0, algorithm_1.toArray)(this.secondaryWindowHandler.widgets);
868
- default:
869
- throw new Error('Illegal argument: ' + area);
870
- }
871
- }
872
- /**
873
- * Find the widget that contains the given HTML element. The returned widget may be one
874
- * that is managed by the application shell, or one that is embedded in another widget and
875
- * not directly managed by the shell, or a tab bar.
876
- */
877
- findWidgetForElement(element) {
878
- let widgetNode = element;
879
- while (widgetNode && !widgetNode.classList.contains('p-Widget')) {
880
- widgetNode = widgetNode.parentElement;
881
- }
882
- if (widgetNode) {
883
- return this.findWidgetForNode(widgetNode, this);
884
- }
885
- return undefined;
886
- }
887
- findWidgetForNode(widgetNode, widget) {
888
- if (widget.node === widgetNode) {
889
- return widget;
890
- }
891
- let result;
892
- (0, algorithm_1.each)(widget.children(), child => {
893
- result = this.findWidgetForNode(widgetNode, child);
894
- return !result;
895
- });
896
- return result;
897
- }
898
- /**
899
- * Finds the title widget from the tab-bar.
900
- * @param tabBar used for providing an array of titles.
901
- * @returns the selected title widget, else returns the currentTitle or undefined.
902
- */
903
- findTitle(tabBar, event) {
904
- if ((event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement) {
905
- const tabNode = event.target;
906
- const titleIndex = Array.from(tabBar.contentNode.getElementsByClassName('p-TabBar-tab'))
907
- .findIndex(node => node.contains(tabNode));
908
- if (titleIndex !== -1) {
909
- return tabBar.titles[titleIndex];
910
- }
911
- }
912
- return tabBar.currentTitle || undefined;
913
- }
914
- /**
915
- * Finds the tab-bar widget.
916
- * @returns the selected tab-bar, else returns the currentTabBar.
917
- */
918
- findTabBar(event) {
919
- if ((event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement) {
920
- const tabBar = this.findWidgetForElement(event.target);
921
- if (tabBar instanceof widgets_1.TabBar) {
922
- return tabBar;
923
- }
924
- }
925
- return this.currentTabBar;
926
- }
927
- /**
928
- * @returns the widget whose title has been targeted by a DOM event on a tabbar, or undefined if none can be found.
929
- */
930
- findTargetedWidget(event) {
931
- if (event) {
932
- const tab = this.findTabBar(event);
933
- const title = tab && this.findTitle(tab, event);
934
- return title && title.owner;
935
- }
936
- }
937
- /**
938
- * The current widget in the application shell. The current widget is the last widget that
939
- * was active and not yet closed. See the remarks to `activeWidget` on what _active_ means.
940
- */
941
- get currentWidget() {
942
- return this.tracker.currentWidget || undefined;
943
- }
944
- /**
945
- * The active widget in the application shell. The active widget is the one that has focus
946
- * (either the widget itself or any of its contents).
947
- *
948
- * _Note:_ Focus is taken by a widget through the `onActivateRequest` method. It is up to the
949
- * widget implementation which DOM element will get the focus. The default implementation
950
- * does not take any focus; in that case the widget is never returned by this property.
951
- */
952
- get activeWidget() {
953
- return this.tracker.activeWidget || undefined;
954
- }
955
- /**
956
- * Returns the last active widget in the given shell area.
957
- */
958
- getCurrentWidget(area) {
959
- let title;
960
- switch (area) {
961
- case 'main':
962
- title = this.mainPanel.currentTitle;
963
- break;
964
- case 'bottom':
965
- title = this.bottomPanel.currentTitle;
966
- break;
967
- case 'left':
968
- title = this.leftPanelHandler.tabBar.currentTitle;
969
- break;
970
- case 'right':
971
- title = this.rightPanelHandler.tabBar.currentTitle;
972
- break;
973
- case 'secondaryWindow':
974
- // The current widget in a secondary window is not tracked.
975
- return undefined;
976
- default:
977
- throw new Error('Illegal argument: ' + area);
978
- }
979
- return title ? title.owner : undefined;
980
- }
981
- /**
982
- * Handle a change to the current widget.
983
- */
984
- onCurrentChanged(sender, args) {
985
- this.onDidChangeCurrentWidgetEmitter.fire(args);
986
- }
987
- /**
988
- * Handle a change to the active widget.
989
- */
990
- onActiveChanged(sender, args) {
991
- this.toDisposeOnActiveChanged.dispose();
992
- const { newValue, oldValue } = args;
993
- if (oldValue) {
994
- let w = oldValue;
995
- while (w) {
996
- // Remove the mark of the previously active widget
997
- w.title.className = w.title.className.replace(' theia-mod-active', '');
998
- w = w.parent;
999
- }
1000
- // Reset the z-index to the default
1001
- // eslint-disable-next-line no-null/no-null
1002
- this.setZIndex(oldValue.node, null);
1003
- }
1004
- if (newValue) {
1005
- let w = newValue;
1006
- while (w) {
1007
- // Mark the tab of the active widget
1008
- w.title.className += ' theia-mod-active';
1009
- w = w.parent;
1010
- }
1011
- // Reveal the title of the active widget in its tab bar
1012
- const tabBar = this.getTabBarFor(newValue);
1013
- if (tabBar instanceof tab_bars_1.ScrollableTabBar) {
1014
- const index = tabBar.titles.indexOf(newValue.title);
1015
- if (index >= 0) {
1016
- tabBar.revealTab(index);
1017
- }
1018
- }
1019
- const widget = this.toTrackedStack(newValue.id).pop();
1020
- const panel = this.findPanel(widget);
1021
- if (panel) {
1022
- // if widget was undefined, we wouldn't have gotten a panel back before
1023
- panel.markAsCurrent(widget.title);
1024
- }
1025
- // Add checks to ensure that the 'sash' for left panel is displayed correctly
1026
- if (newValue.node.className === 'p-Widget theia-view-container p-DockPanel-widget') {
1027
- // Set the z-index so elements with `position: fixed` contained in the active widget are displayed correctly
1028
- this.setZIndex(newValue.node, '1');
1029
- }
1030
- // activate another widget if an active widget will be closed
1031
- const onCloseRequest = newValue['onCloseRequest'];
1032
- newValue['onCloseRequest'] = msg => {
1033
- const currentTabBar = this.currentTabBar;
1034
- if (currentTabBar) {
1035
- const recentlyUsedInTabBar = currentTabBar['_previousTitle'];
1036
- if (recentlyUsedInTabBar && recentlyUsedInTabBar.owner !== newValue) {
1037
- currentTabBar.currentIndex = algorithm_1.ArrayExt.firstIndexOf(currentTabBar.titles, recentlyUsedInTabBar);
1038
- if (currentTabBar.currentTitle) {
1039
- this.activateWidget(currentTabBar.currentTitle.owner.id);
1040
- }
1041
- }
1042
- else if (!this.activateNextTabInTabBar(currentTabBar)) {
1043
- if (!this.activatePreviousTabBar(currentTabBar)) {
1044
- this.activateNextTabBar(currentTabBar);
1045
- }
1046
- }
1047
- }
1048
- newValue['onCloseRequest'] = onCloseRequest;
1049
- newValue['onCloseRequest'](msg);
1050
- };
1051
- this.toDisposeOnActiveChanged.push(common_1.Disposable.create(() => newValue['onCloseRequest'] = onCloseRequest));
1052
- if (previewable_widget_1.PreviewableWidget.is(newValue)) {
1053
- newValue.loaded = true;
1054
- }
1055
- }
1056
- this.onDidChangeActiveWidgetEmitter.fire(args);
1057
- }
1058
- /**
1059
- * Set the z-index of the given element and its ancestors to the value `z`.
1060
- */
1061
- setZIndex(element, z) {
1062
- element.style.zIndex = z || '';
1063
- const parent = element.parentElement;
1064
- if (parent && parent !== this.node) {
1065
- this.setZIndex(parent, z);
1066
- }
1067
- }
1068
- /**
1069
- * Track the given widget so it is considered in the `current` and `active` state of the shell.
1070
- */
1071
- track(widget) {
1072
- if (this.tracker.widgets.indexOf(widget) !== -1) {
1073
- return;
1074
- }
1075
- this.tracker.add(widget);
1076
- this.checkActivation(widget);
1077
- saveable_1.Saveable.apply(widget, () => this.widgets.filter((maybeSaveable) => !!saveable_1.Saveable.get(maybeSaveable)), (toSave, options) => this.saveResourceService.save(toSave, options));
1078
- if (ApplicationShell_1.TrackableWidgetProvider.is(widget)) {
1079
- for (const toTrack of widget.getTrackableWidgets()) {
1080
- this.track(toTrack);
1081
- }
1082
- if (widget.onDidChangeTrackableWidgets) {
1083
- widget.onDidChangeTrackableWidgets(widgets => widgets.forEach(w => this.track(w)));
1084
- }
1085
- }
1086
- }
1087
- /**
1088
- * @returns an array of Widgets, all of which are tracked by the focus tracker
1089
- * The first member of the array is the widget whose id is passed in, and the other widgets
1090
- * are its tracked parents in ascending order
1091
- */
1092
- toTrackedStack(id) {
1093
- const tracked = new Map(this.tracker.widgets.map(w => [w.id, w]));
1094
- let current = tracked.get(id);
1095
- const stack = [];
1096
- while (current) {
1097
- if (tracked.has(current.id)) {
1098
- stack.push(current);
1099
- }
1100
- current = current.parent || undefined;
1101
- }
1102
- return stack;
1103
- }
1104
- /**
1105
- * Activate a widget in the application shell. This makes the widget visible and usually
1106
- * also assigns focus to it.
1107
- *
1108
- * _Note:_ Focus is taken by a widget through the `onActivateRequest` method. It is up to the
1109
- * widget implementation which DOM element will get the focus. The default implementation
1110
- * does not take any focus.
1111
- *
1112
- * @returns the activated widget if it was found
1113
- */
1114
- async activateWidget(id) {
1115
- const stack = this.toTrackedStack(id);
1116
- let current = stack.pop();
1117
- if (current && !this.doActivateWidget(current.id)) {
1118
- return undefined;
1119
- }
1120
- while (current && stack.length) {
1121
- const child = stack.pop();
1122
- if (ApplicationShell_1.TrackableWidgetProvider.is(current) && current.activateWidget) {
1123
- current = current.activateWidget(child.id);
1124
- }
1125
- else {
1126
- child.activate();
1127
- current = child;
1128
- }
1129
- }
1130
- if (!current) {
1131
- return undefined;
1132
- }
1133
- return Promise.all([
1134
- this.waitForActivation(current.id),
1135
- (0, widgets_2.waitForRevealed)(current),
1136
- this.pendingUpdates
1137
- ]).then(() => current, () => undefined);
1138
- }
1139
- waitForActivation(id) {
1140
- if (this.activeWidget && this.activeWidget.id === id) {
1141
- return Promise.resolve();
1142
- }
1143
- const activation = new promise_util_1.Deferred();
1144
- const success = this.onDidChangeActiveWidget(() => {
1145
- if (this.activeWidget && this.activeWidget.id === id) {
1146
- activation.resolve();
1147
- }
1148
- });
1149
- const failure = setTimeout(() => activation.reject(new Error(`Widget with id '${id}' failed to activate.`)), this.activationTimeout + 250);
1150
- return activation.promise.finally(() => {
1151
- success.dispose();
1152
- clearTimeout(failure);
1153
- });
1154
- }
1155
- /**
1156
- * Activate top-level area widget.
1157
- */
1158
- doActivateWidget(id) {
1159
- let widget = (0, algorithm_1.find)(this.mainPanel.widgets(), w => w.id === id);
1160
- if (widget) {
1161
- this.mainPanel.activateWidget(widget);
1162
- return widget;
1163
- }
1164
- widget = (0, algorithm_1.find)(this.bottomPanel.widgets(), w => w.id === id);
1165
- if (widget) {
1166
- this.expandBottomPanel();
1167
- this.bottomPanel.activateWidget(widget);
1168
- return widget;
1169
- }
1170
- widget = this.leftPanelHandler.activate(id);
1171
- if (widget) {
1172
- return widget;
1173
- }
1174
- widget = this.rightPanelHandler.activate(id);
1175
- if (widget) {
1176
- return widget;
1177
- }
1178
- return this.secondaryWindowHandler.activateWidget(id);
1179
- }
1180
- /**
1181
- * Focus is taken by a widget through the `onActivateRequest` method. It is up to the
1182
- * widget implementation which DOM element will get the focus. The default implementation
1183
- * of Widget does not take any focus. This method can help finding such problems by logging
1184
- * a warning in case a widget was explicitly activated, but did not trigger a change of the
1185
- * `activeWidget` property.
1186
- */
1187
- checkActivation(widget) {
1188
- const onActivateRequest = widget['onActivateRequest'].bind(widget);
1189
- widget['onActivateRequest'] = (msg) => {
1190
- onActivateRequest(msg);
1191
- this.assertActivated(widget);
1192
- };
1193
- return widget;
1194
- }
1195
- assertActivated(widget) {
1196
- this.toDisposeOnActivationCheck.dispose();
1197
- const onDispose = () => this.toDisposeOnActivationCheck.dispose();
1198
- widget.disposed.connect(onDispose);
1199
- this.toDisposeOnActivationCheck.push(common_1.Disposable.create(() => widget.disposed.disconnect(onDispose)));
1200
- let start = 0;
1201
- const step = timestamp => {
1202
- const activeElement = widget.node.ownerDocument.activeElement;
1203
- if (activeElement && widget.node.contains(activeElement)) {
1204
- return;
1205
- }
1206
- if (!start) {
1207
- start = timestamp;
1208
- }
1209
- const delta = timestamp - start;
1210
- if (delta < this.activationTimeout) {
1211
- request = window.requestAnimationFrame(step);
1212
- }
1213
- else {
1214
- console.warn(`Widget was activated, but did not accept focus after ${this.activationTimeout}ms: ${widget.id}`);
1215
- }
1216
- };
1217
- let request = window.requestAnimationFrame(step);
1218
- this.toDisposeOnActivationCheck.push(common_1.Disposable.create(() => window.cancelAnimationFrame(request)));
1219
- }
1220
- /**
1221
- * Reveal a widget in the application shell. This makes the widget visible,
1222
- * but does not activate it.
1223
- *
1224
- * @returns the revealed widget if it was found
1225
- */
1226
- async revealWidget(id) {
1227
- const stack = this.toTrackedStack(id);
1228
- let current = stack.pop();
1229
- if (current && !this.doRevealWidget(current.id)) {
1230
- return undefined;
1231
- }
1232
- while (current && stack.length) {
1233
- const child = stack.pop();
1234
- if (ApplicationShell_1.TrackableWidgetProvider.is(current) && current.revealWidget) {
1235
- current = current.revealWidget(child.id);
1236
- }
1237
- else {
1238
- current = child;
1239
- }
1240
- }
1241
- if (!current) {
1242
- return undefined;
1243
- }
1244
- await Promise.all([
1245
- (0, widgets_2.waitForRevealed)(current),
1246
- this.pendingUpdates
1247
- ]);
1248
- return current;
1249
- }
1250
- /**
1251
- * Reveal top-level area widget.
1252
- */
1253
- doRevealWidget(id) {
1254
- let widget = (0, algorithm_1.find)(this.mainPanel.widgets(), w => w.id === id);
1255
- if (!widget) {
1256
- widget = (0, algorithm_1.find)(this.bottomPanel.widgets(), w => w.id === id);
1257
- if (widget) {
1258
- this.expandBottomPanel();
1259
- }
1260
- }
1261
- if (widget) {
1262
- const tabBar = this.getTabBarFor(widget);
1263
- if (tabBar) {
1264
- tabBar.currentTitle = widget.title;
1265
- }
1266
- return widget;
1267
- }
1268
- widget = this.leftPanelHandler.expand(id);
1269
- if (widget) {
1270
- return widget;
1271
- }
1272
- widget = this.rightPanelHandler.expand(id);
1273
- if (widget) {
1274
- return widget;
1275
- }
1276
- return this.secondaryWindowHandler.revealWidget(id);
1277
- }
1278
- /**
1279
- * Expand the named side panel area. This makes sure that the panel is visible, even if there
1280
- * are no widgets in it. If the panel is already visible, nothing happens. If the panel is currently
1281
- * collapsed (see `collapsePanel`) and it contains widgets, the widgets are revealed that were
1282
- * visible before it was collapsed.
1283
- */
1284
- expandPanel(area) {
1285
- switch (area) {
1286
- case 'bottom':
1287
- this.expandBottomPanel();
1288
- break;
1289
- case 'left':
1290
- this.leftPanelHandler.expand();
1291
- break;
1292
- case 'right':
1293
- this.rightPanelHandler.expand();
1294
- break;
1295
- default:
1296
- throw new Error('Area cannot be expanded: ' + area);
1297
- }
1298
- }
1299
- /**
1300
- * Adjusts the size of the given area in the application shell.
1301
- *
1302
- * @param size the desired size of the panel in pixels.
1303
- * @param area the area to resize.
1304
- */
1305
- resize(size, area) {
1306
- switch (area) {
1307
- case 'bottom':
1308
- if (this.bottomPanel.isHidden) {
1309
- this.bottomPanelState.lastPanelSize = size;
1310
- }
1311
- else {
1312
- this.setBottomPanelSize(size);
1313
- }
1314
- break;
1315
- case 'left':
1316
- this.leftPanelHandler.resize(size);
1317
- break;
1318
- case 'right':
1319
- this.rightPanelHandler.resize(size);
1320
- break;
1321
- default:
1322
- throw new Error('Area cannot be resized: ' + area);
1323
- }
1324
- }
1325
- /**
1326
- * Expand the bottom panel. See `expandPanel` regarding the exact behavior.
1327
- */
1328
- expandBottomPanel() {
1329
- const bottomPanel = this.bottomPanel;
1330
- if (bottomPanel.isHidden) {
1331
- let relativeSizes;
1332
- const parent = bottomPanel.parent;
1333
- if (parent instanceof widgets_1.SplitPanel) {
1334
- relativeSizes = parent.relativeSizes();
1335
- }
1336
- bottomPanel.show();
1337
- if (relativeSizes && parent instanceof widgets_1.SplitPanel) {
1338
- // Make sure that the expansion animation starts at the smallest possible size
1339
- parent.setRelativeSizes(relativeSizes);
1340
- }
1341
- let size;
1342
- if (bottomPanel.isEmpty) {
1343
- bottomPanel.node.style.minHeight = '0';
1344
- size = this.options.bottomPanel.emptySize;
1345
- }
1346
- else if (this.bottomPanelState.lastPanelSize) {
1347
- size = this.bottomPanelState.lastPanelSize;
1348
- }
1349
- else {
1350
- size = this.getDefaultBottomPanelSize();
1351
- }
1352
- if (size) {
1353
- this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.expanding;
1354
- this.setBottomPanelSize(size).then(() => {
1355
- if (this.bottomPanelState.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanding) {
1356
- this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.expanded;
1357
- }
1358
- });
1359
- }
1360
- else {
1361
- this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.expanded;
1362
- }
1363
- }
1364
- }
1365
- /**
1366
- * Collapse the named side panel area. This makes sure that the panel is hidden,
1367
- * increasing the space that is available for other shell areas.
1368
- */
1369
- collapsePanel(area) {
1370
- switch (area) {
1371
- case 'bottom':
1372
- return this.collapseBottomPanel();
1373
- case 'left':
1374
- return this.leftPanelHandler.collapse();
1375
- case 'right':
1376
- return this.rightPanelHandler.collapse();
1377
- default:
1378
- throw new Error('Area cannot be collapsed: ' + area);
1379
- }
1380
- }
1381
- /**
1382
- * Collapse the bottom panel. All contained widgets are hidden, but not closed.
1383
- * They can be restored by calling `expandBottomPanel`.
1384
- */
1385
- collapseBottomPanel() {
1386
- const bottomPanel = this.bottomPanel;
1387
- if (bottomPanel.isHidden) {
1388
- return Promise.resolve();
1389
- }
1390
- if (this.bottomPanelState.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded) {
1391
- const size = this.getBottomPanelSize();
1392
- if (size) {
1393
- this.bottomPanelState.lastPanelSize = size;
1394
- }
1395
- }
1396
- this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.collapsed;
1397
- bottomPanel.hide();
1398
- return (0, browser_1.animationFrame)();
1399
- }
1400
- /**
1401
- * Refresh the toggle button for the bottom panel. This implementation creates a status bar entry
1402
- * and refers to the command `core.toggle.bottom.panel`.
1403
- */
1404
- refreshBottomPanelToggleButton() {
1405
- if (this.bottomPanel.isEmpty) {
1406
- this.statusBar.removeElement(BOTTOM_PANEL_TOGGLE_ID);
1407
- }
1408
- else {
1409
- const label = nls_1.nls.localize('theia/core/common/collapseBottomPanel', 'Toggle Bottom Panel');
1410
- const element = {
1411
- name: label,
1412
- text: '$(codicon-window)',
1413
- alignment: status_bar_1.StatusBarAlignment.RIGHT,
1414
- tooltip: label,
1415
- command: 'core.toggle.bottom.panel',
1416
- accessibilityInformation: {
1417
- label: label,
1418
- role: 'button'
1419
- },
1420
- priority: -1000
1421
- };
1422
- this.statusBar.setElement(BOTTOM_PANEL_TOGGLE_ID, element);
1423
- }
1424
- }
1425
- /**
1426
- * Check whether the named side panel area is expanded (returns `true`) or collapsed (returns `false`).
1427
- */
1428
- isExpanded(area) {
1429
- switch (area) {
1430
- case 'bottom':
1431
- return this.bottomPanelState.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded;
1432
- case 'left':
1433
- return this.leftPanelHandler.state.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded;
1434
- case 'right':
1435
- return this.rightPanelHandler.state.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded;
1436
- default:
1437
- return true;
1438
- }
1439
- }
1440
- /**
1441
- * Close all tabs or a selection of tabs in a specific part of the application shell.
1442
- *
1443
- * @param tabBarOrArea
1444
- * Either the name of a shell area or a `TabBar` that is contained in such an area.
1445
- * @param filter
1446
- * If undefined, all tabs are closed; otherwise only those tabs that match the filter are closed.
1447
- */
1448
- async closeTabs(tabBarOrArea, filter) {
1449
- const titles = this.getWidgetTitles(tabBarOrArea, filter);
1450
- if (titles.length) {
1451
- await this.closeMany(titles.map(title => title.owner));
1452
- }
1453
- }
1454
- saveTabs(tabBarOrArea, filter) {
1455
- const titles = this.getWidgetTitles(tabBarOrArea, filter);
1456
- for (let i = 0; i < titles.length; i++) {
1457
- const widget = titles[i].owner;
1458
- const saveable = saveable_1.Saveable.get(widget);
1459
- saveable === null || saveable === void 0 ? void 0 : saveable.save();
1460
- }
1461
- }
1462
- /**
1463
- * Collects all widget titles for the given tab bar or area and optionally filters them.
1464
- *
1465
- * @param tabBarOrArea The tab bar or area to retrieve the widget titles for
1466
- * @param filter The filter to apply to the result
1467
- * @returns The filtered array of widget titles or an empty array
1468
- */
1469
- getWidgetTitles(tabBarOrArea, filter) {
1470
- const titles = [];
1471
- if (tabBarOrArea === 'main') {
1472
- this.mainAreaTabBars.forEach(tabbar => titles.push(...(0, algorithm_1.toArray)(tabbar.titles)));
1473
- }
1474
- else if (tabBarOrArea === 'bottom') {
1475
- this.bottomAreaTabBars.forEach(tabbar => titles.push(...(0, algorithm_1.toArray)(tabbar.titles)));
1476
- }
1477
- else if (tabBarOrArea === 'secondaryWindow') {
1478
- titles.push(...this.secondaryWindowHandler.widgets.map(w => w.title));
1479
- }
1480
- else if (typeof tabBarOrArea === 'string') {
1481
- const tabbar = this.getTabBarFor(tabBarOrArea);
1482
- if (tabbar) {
1483
- titles.push(...(0, algorithm_1.toArray)(tabbar.titles));
1484
- }
1485
- }
1486
- else if (tabBarOrArea) {
1487
- titles.push(...(0, algorithm_1.toArray)(tabBarOrArea.titles));
1488
- }
1489
- return filter ? titles.filter(filter) : titles;
1490
- }
1491
- /**
1492
- * @param targets the widgets to be closed
1493
- * @return an array of all the widgets that were actually closed.
1494
- */
1495
- async closeMany(targets, options) {
1496
- if ((options === null || options === void 0 ? void 0 : options.save) === false || await saveable_1.Saveable.confirmSaveBeforeClose(targets, this.widgets.filter(widget => !targets.includes(widget)))) {
1497
- return (await Promise.all(targets.map(target => this.closeWidget(target.id, options)))).filter((widget) => widget !== undefined);
1498
- }
1499
- return [];
1500
- }
1501
- /**
1502
- * @returns the widget that was closed, if any, `undefined` otherwise.
1503
- *
1504
- * If your use case requires closing multiple widgets, use {@link ApplicationShell#closeMany} instead. That method handles closing saveable widgets more reliably.
1505
- */
1506
- async closeWidget(id, options) {
1507
- // TODO handle save for composite widgets, i.e. the preference widget has 2 editors
1508
- const stack = this.toTrackedStack(id);
1509
- const current = stack.pop();
1510
- if (!current) {
1511
- return undefined;
1512
- }
1513
- const saveableOptions = options && { shouldSave: () => options.save };
1514
- const pendingClose = saveable_1.SaveableWidget.is(current)
1515
- ? current.closeWithSaving(saveableOptions)
1516
- : (current.close(), (0, widgets_2.waitForClosed)(current));
1517
- await Promise.all([
1518
- pendingClose,
1519
- this.pendingUpdates
1520
- ]);
1521
- return stack[0] || current;
1522
- }
1523
- /**
1524
- * The shell area name of the currently active tab, or undefined.
1525
- */
1526
- get currentTabArea() {
1527
- const currentWidget = this.currentWidget;
1528
- if (currentWidget) {
1529
- return this.getAreaFor(currentWidget);
1530
- }
1531
- }
1532
- /**
1533
- * Determine the name of the shell area where the given widget resides. The result is
1534
- * undefined if the widget does not reside directly in the shell.
1535
- */
1536
- getAreaFor(input) {
1537
- if (input instanceof widgets_1.TabBar) {
1538
- if ((0, algorithm_1.find)(this.mainPanel.tabBars(), tb => tb === input)) {
1539
- return 'main';
1540
- }
1541
- if ((0, algorithm_1.find)(this.bottomPanel.tabBars(), tb => tb === input)) {
1542
- return 'bottom';
1543
- }
1544
- if (this.leftPanelHandler.tabBar === input) {
1545
- return 'left';
1546
- }
1547
- if (this.rightPanelHandler.tabBar === input) {
1548
- return 'right';
1549
- }
1550
- }
1551
- const widget = this.toTrackedStack(input.id).pop();
1552
- if (!widget) {
1553
- return undefined;
1554
- }
1555
- const title = widget.title;
1556
- const mainPanelTabBar = this.mainPanel.findTabBar(title);
1557
- if (mainPanelTabBar) {
1558
- return 'main';
1559
- }
1560
- const bottomPanelTabBar = this.bottomPanel.findTabBar(title);
1561
- if (bottomPanelTabBar) {
1562
- return 'bottom';
1563
- }
1564
- if (algorithm_1.ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) {
1565
- return 'left';
1566
- }
1567
- if (algorithm_1.ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) {
1568
- return 'right';
1569
- }
1570
- if (this.secondaryWindowHandler.widgets.includes(widget)) {
1571
- return 'secondaryWindow';
1572
- }
1573
- return undefined;
1574
- }
1575
- getAreaPanelFor(input) {
1576
- const widget = this.toTrackedStack(input.id).pop();
1577
- if (!widget) {
1578
- return undefined;
1579
- }
1580
- return this.findPanel(widget);
1581
- }
1582
- /**
1583
- * Find the shell panel this top-level widget is part of
1584
- */
1585
- findPanel(widget) {
1586
- if (!widget) {
1587
- return undefined;
1588
- }
1589
- const title = widget.title;
1590
- const mainPanelTabBar = this.mainPanel.findTabBar(title);
1591
- if (mainPanelTabBar) {
1592
- return this.mainPanel;
1593
- }
1594
- const bottomPanelTabBar = this.bottomPanel.findTabBar(title);
1595
- if (bottomPanelTabBar) {
1596
- return this.bottomPanel;
1597
- }
1598
- if (algorithm_1.ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) {
1599
- return this.leftPanelHandler.dockPanel;
1600
- }
1601
- if (algorithm_1.ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) {
1602
- return this.rightPanelHandler.dockPanel;
1603
- }
1604
- return undefined;
1605
- }
1606
- /**
1607
- * Return the tab bar that has the currently active widget, or undefined.
1608
- */
1609
- get currentTabBar() {
1610
- const currentWidget = this.currentWidget;
1611
- if (currentWidget) {
1612
- return this.getTabBarFor(currentWidget);
1613
- }
1614
- }
1615
- /**
1616
- * Return the tab bar in the given shell area, or the tab bar that has the given widget, or undefined.
1617
- */
1618
- getTabBarFor(widgetOrArea) {
1619
- if (typeof widgetOrArea === 'string') {
1620
- switch (widgetOrArea) {
1621
- case 'main':
1622
- return this.mainPanel.currentTabBar;
1623
- case 'bottom':
1624
- return this.bottomPanel.currentTabBar;
1625
- case 'left':
1626
- return this.leftPanelHandler.tabBar;
1627
- case 'right':
1628
- return this.rightPanelHandler.tabBar;
1629
- case 'secondaryWindow':
1630
- // Secondary windows don't have a tab bar
1631
- return undefined;
1632
- default:
1633
- throw new Error('Illegal argument: ' + widgetOrArea);
1634
- }
1635
- }
1636
- const widget = this.toTrackedStack(widgetOrArea.id).pop();
1637
- if (!widget) {
1638
- return undefined;
1639
- }
1640
- const widgetTitle = widget.title;
1641
- const mainPanelTabBar = this.mainPanel.findTabBar(widgetTitle);
1642
- if (mainPanelTabBar) {
1643
- return mainPanelTabBar;
1644
- }
1645
- const bottomPanelTabBar = this.bottomPanel.findTabBar(widgetTitle);
1646
- if (bottomPanelTabBar) {
1647
- return bottomPanelTabBar;
1648
- }
1649
- const leftPanelTabBar = this.leftPanelHandler.tabBar;
1650
- if (algorithm_1.ArrayExt.firstIndexOf(leftPanelTabBar.titles, widgetTitle) > -1) {
1651
- return leftPanelTabBar;
1652
- }
1653
- const rightPanelTabBar = this.rightPanelHandler.tabBar;
1654
- if (algorithm_1.ArrayExt.firstIndexOf(rightPanelTabBar.titles, widgetTitle) > -1) {
1655
- return rightPanelTabBar;
1656
- }
1657
- return undefined;
1658
- }
1659
- /**
1660
- * The tab bars contained in the main shell area. If there is no widget in the main area, the
1661
- * returned array is empty.
1662
- */
1663
- get mainAreaTabBars() {
1664
- return (0, algorithm_1.toArray)(this.mainPanel.tabBars());
1665
- }
1666
- /**
1667
- * The tab bars contained in the bottom shell area. If there is no widget in the bottom area,
1668
- * the returned array is empty.
1669
- */
1670
- get bottomAreaTabBars() {
1671
- return (0, algorithm_1.toArray)(this.bottomPanel.tabBars());
1672
- }
1673
- /**
1674
- * The tab bars contained in all shell areas.
1675
- */
1676
- get allTabBars() {
1677
- return [...this.mainAreaTabBars, ...this.bottomAreaTabBars, this.leftPanelHandler.tabBar, this.rightPanelHandler.tabBar];
1678
- }
1679
- /*
1680
- * Activate the next tab in the current tab bar.
1681
- */
1682
- activateNextTabInTabBar(current = this.currentTabBar) {
1683
- const index = this.nextTabIndexInTabBar(current);
1684
- if (!current || index === -1) {
1685
- return false;
1686
- }
1687
- current.currentIndex = index;
1688
- if (current.currentTitle) {
1689
- this.activateWidget(current.currentTitle.owner.id);
1690
- }
1691
- return true;
1692
- }
1693
- nextTabIndexInTabBar(current = this.currentTabBar) {
1694
- if (!current || current.titles.length <= 1) {
1695
- return -1;
1696
- }
1697
- const index = current.currentIndex;
1698
- if (index === -1) {
1699
- return -1;
1700
- }
1701
- if (index < current.titles.length - 1) {
1702
- return index + 1;
1703
- }
1704
- return 0;
1705
- }
1706
- activateNextTab() {
1707
- const current = this.currentTabBar;
1708
- if (current) {
1709
- const ci = current.currentIndex;
1710
- if (ci !== -1) {
1711
- if (ci < current.titles.length - 1) {
1712
- current.currentIndex += 1;
1713
- if (current.currentTitle) {
1714
- this.activateWidget(current.currentTitle.owner.id);
1715
- }
1716
- return true;
1717
- }
1718
- else if (ci === current.titles.length - 1) {
1719
- return this.activateNextTabBar(current);
1720
- }
1721
- }
1722
- }
1723
- return false;
1724
- }
1725
- activateNextTabBar(current = this.currentTabBar) {
1726
- const nextBar = this.nextTabBar(current);
1727
- if (nextBar) {
1728
- nextBar.currentIndex = 0;
1729
- if (nextBar.currentTitle) {
1730
- this.activateWidget(nextBar.currentTitle.owner.id);
1731
- }
1732
- return true;
1733
- }
1734
- return false;
1735
- }
1736
- /**
1737
- * Return the tab bar next to the given tab bar; return the given tab bar if there is no adjacent one.
1738
- */
1739
- nextTabBar(current = this.currentTabBar) {
1740
- let bars = (0, algorithm_1.toArray)(this.bottomPanel.tabBars());
1741
- let len = bars.length;
1742
- let ci = algorithm_1.ArrayExt.firstIndexOf(bars, current);
1743
- if (ci < 0) {
1744
- bars = (0, algorithm_1.toArray)(this.mainPanel.tabBars());
1745
- len = bars.length;
1746
- ci = algorithm_1.ArrayExt.firstIndexOf(bars, current);
1747
- }
1748
- if (ci >= 0 && ci < len - 1) {
1749
- return bars[ci + 1];
1750
- }
1751
- else if (ci >= 0 && ci === len - 1) {
1752
- return bars[0];
1753
- }
1754
- else {
1755
- return current;
1756
- }
1757
- }
1758
- /*
1759
- * Activate the previous tab in the current tab bar.
1760
- */
1761
- activatePreviousTabInTabBar(current = this.currentTabBar) {
1762
- const index = this.previousTabIndexInTabBar(current);
1763
- if (!current || index === -1) {
1764
- return false;
1765
- }
1766
- current.currentIndex = index;
1767
- if (current.currentTitle) {
1768
- this.activateWidget(current.currentTitle.owner.id);
1769
- }
1770
- return true;
1771
- }
1772
- previousTabIndexInTabBar(current = this.currentTabBar) {
1773
- if (!current || current.titles.length <= 1) {
1774
- return -1;
1775
- }
1776
- const index = current.currentIndex;
1777
- if (index === -1) {
1778
- return -1;
1779
- }
1780
- if (index > 0) {
1781
- return index - 1;
1782
- }
1783
- return current.titles.length - 1;
1784
- }
1785
- activatePreviousTab() {
1786
- const current = this.currentTabBar;
1787
- if (current) {
1788
- const ci = current.currentIndex;
1789
- if (ci !== -1) {
1790
- if (ci > 0) {
1791
- current.currentIndex -= 1;
1792
- if (current.currentTitle) {
1793
- this.activateWidget(current.currentTitle.owner.id);
1794
- }
1795
- return true;
1796
- }
1797
- else if (ci === 0) {
1798
- if (current && current.titles.length > 0) {
1799
- current.currentIndex = current.titles.length - 1;
1800
- if (current.currentTitle) {
1801
- this.activateWidget(current.currentTitle.owner.id);
1802
- }
1803
- return true;
1804
- }
1805
- return this.activatePreviousTabBar(current);
1806
- }
1807
- }
1808
- }
1809
- return false;
1810
- }
1811
- activatePreviousTabBar(current = this.currentTabBar) {
1812
- const prevBar = this.previousTabBar(current);
1813
- if (!prevBar) {
1814
- return false;
1815
- }
1816
- if (!prevBar.currentTitle) {
1817
- prevBar.currentIndex = prevBar.titles.length - 1;
1818
- }
1819
- if (prevBar.currentTitle) {
1820
- this.activateWidget(prevBar.currentTitle.owner.id);
1821
- }
1822
- return true;
1823
- }
1824
- /**
1825
- * Return the tab bar previous to the given tab bar; return the given tab bar if there is no adjacent one.
1826
- */
1827
- previousTabBar(current = this.currentTabBar) {
1828
- const bars = (0, algorithm_1.toArray)(this.mainPanel.tabBars());
1829
- const len = bars.length;
1830
- const ci = algorithm_1.ArrayExt.firstIndexOf(bars, current);
1831
- if (ci > 0) {
1832
- return bars[ci - 1];
1833
- }
1834
- else if (ci === 0) {
1835
- return bars[len - 1];
1836
- }
1837
- else {
1838
- return current;
1839
- }
1840
- }
1841
- /**
1842
- * Test whether the current widget is dirty.
1843
- */
1844
- canSave() {
1845
- return this.saveResourceService.canSave(this.currentWidget);
1846
- }
1847
- /**
1848
- * Save the current widget if it is dirty.
1849
- */
1850
- async save(options) {
1851
- await this.saveResourceService.save(this.currentWidget, options);
1852
- }
1853
- /**
1854
- * Test whether there is a dirty widget.
1855
- */
1856
- canSaveAll() {
1857
- return this.tracker.widgets.some(widget => this.saveResourceService.canSave(widget));
1858
- }
1859
- /**
1860
- * Save all dirty widgets.
1861
- */
1862
- async saveAll(options) {
1863
- for (const widget of this.widgets) {
1864
- if (this.saveResourceService.canSaveNotSaveAs(widget)) {
1865
- await this.saveResourceService.save(widget, options);
1866
- }
1867
- }
1868
- }
1869
- /**
1870
- * Returns a snapshot of all tracked widgets to allow async modifications.
1871
- */
1872
- get widgets() {
1873
- return [...this.tracker.widgets];
1874
- }
1875
- getWidgetById(id) {
1876
- for (const widget of this.tracker.widgets) {
1877
- if (widget.id === id) {
1878
- return widget;
1879
- }
1880
- }
1881
- return undefined;
1882
- }
1883
- canToggleMaximized(widget = this.currentWidget) {
1884
- const area = widget && this.getAreaFor(widget);
1885
- return area === 'main' || area === 'bottom';
1886
- }
1887
- toggleMaximized(widget = this.currentWidget) {
1888
- const area = widget && this.getAreaPanelFor(widget);
1889
- if (area instanceof theia_dock_panel_1.TheiaDockPanel && (area === this.mainPanel || area === this.bottomPanel)) {
1890
- area.toggleMaximized();
1891
- this.revealWidget(widget.id);
1892
- }
1893
- }
1894
- };
1895
- __decorate([
1896
- (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
1897
- __metadata("design:type", Object)
1898
- ], ApplicationShell.prototype, "contextKeyService", void 0);
1899
- __decorate([
1900
- (0, inversify_1.inject)(opener_service_1.OpenerService),
1901
- __metadata("design:type", Object)
1902
- ], ApplicationShell.prototype, "openerService", void 0);
1903
- __decorate([
1904
- (0, inversify_1.inject)(theia_dock_panel_1.TheiaDockPanel.Factory),
1905
- __metadata("design:type", Function)
1906
- ], ApplicationShell.prototype, "dockPanelFactory", void 0);
1907
- __decorate([
1908
- (0, inversify_1.postConstruct)(),
1909
- __metadata("design:type", Function),
1910
- __metadata("design:paramtypes", []),
1911
- __metadata("design:returntype", void 0)
1912
- ], ApplicationShell.prototype, "init", null);
1913
- ApplicationShell = ApplicationShell_1 = __decorate([
1914
- (0, inversify_1.injectable)(),
1915
- __param(0, (0, inversify_1.inject)(exports.DockPanelRendererFactory)),
1916
- __param(1, (0, inversify_1.inject)(status_bar_1.StatusBarImpl)),
1917
- __param(2, (0, inversify_1.inject)(side_panel_handler_1.SidePanelHandlerFactory)),
1918
- __param(3, (0, inversify_1.inject)(split_panels_1.SplitPositionHandler)),
1919
- __param(4, (0, inversify_1.inject)(frontend_application_state_1.FrontendApplicationStateService)),
1920
- __param(5, (0, inversify_1.inject)(exports.ApplicationShellOptions)),
1921
- __param(5, (0, inversify_1.optional)()),
1922
- __param(6, (0, inversify_1.inject)(core_preferences_1.CorePreferences)),
1923
- __param(7, (0, inversify_1.inject)(save_resource_service_1.SaveResourceService)),
1924
- __param(8, (0, inversify_1.inject)(secondary_window_handler_1.SecondaryWindowHandler)),
1925
- __metadata("design:paramtypes", [Function, status_bar_1.StatusBarImpl, Function, split_panels_1.SplitPositionHandler,
1926
- frontend_application_state_1.FrontendApplicationStateService, Object, Object, save_resource_service_1.SaveResourceService,
1927
- secondary_window_handler_1.SecondaryWindowHandler])
1928
- ], ApplicationShell);
1929
- exports.ApplicationShell = ApplicationShell;
1930
- /**
1931
- * The namespace for `ApplicationShell` class statics.
1932
- */
1933
- (function (ApplicationShell) {
1934
- ApplicationShell.areaLabels = {
1935
- main: nls_1.nls.localizeByDefault('Main'),
1936
- top: nls_1.nls.localizeByDefault('Top'),
1937
- left: nls_1.nls.localizeByDefault('Left'),
1938
- right: nls_1.nls.localizeByDefault('Right'),
1939
- bottom: nls_1.nls.localizeByDefault('Bottom'),
1940
- secondaryWindow: nls_1.nls.localize('theia/shell-area/secondary', 'Secondary Window'),
1941
- };
1942
- /**
1943
- * The _side areas_ are those shell areas that can be collapsed and expanded,
1944
- * i.e. `left`, `right`, and `bottom`.
1945
- */
1946
- function isSideArea(area) {
1947
- return area === 'left' || area === 'right' || area === 'bottom';
1948
- }
1949
- ApplicationShell.isSideArea = isSideArea;
1950
- function isValidArea(area) {
1951
- const areas = ['main', 'top', 'left', 'right', 'bottom', 'secondaryWindow'];
1952
- return typeof area === 'string' && areas.includes(area);
1953
- }
1954
- ApplicationShell.isValidArea = isValidArea;
1955
- /**
1956
- * The default values for application shell options.
1957
- */
1958
- ApplicationShell.DEFAULT_OPTIONS = Object.freeze({
1959
- bottomPanel: Object.freeze({
1960
- emptySize: 140,
1961
- expandThreshold: 160,
1962
- expandDuration: 0,
1963
- initialSizeRatio: 0.382
1964
- }),
1965
- leftPanel: Object.freeze({
1966
- emptySize: 140,
1967
- expandThreshold: 140,
1968
- expandDuration: 0,
1969
- initialSizeRatio: 0.191
1970
- }),
1971
- rightPanel: Object.freeze({
1972
- emptySize: 140,
1973
- expandThreshold: 140,
1974
- expandDuration: 0,
1975
- initialSizeRatio: 0.191
1976
- })
1977
- });
1978
- function isOpenToSideMode(mode) {
1979
- return mode === 'open-to-left' || mode === 'open-to-right';
1980
- }
1981
- ApplicationShell.isOpenToSideMode = isOpenToSideMode;
1982
- let TrackableWidgetProvider;
1983
- (function (TrackableWidgetProvider) {
1984
- function is(widget) {
1985
- return (0, common_1.isObject)(widget) && 'getTrackableWidgets' in widget;
1986
- }
1987
- TrackableWidgetProvider.is = is;
1988
- })(TrackableWidgetProvider = ApplicationShell.TrackableWidgetProvider || (ApplicationShell.TrackableWidgetProvider = {}));
1989
- })(ApplicationShell = exports.ApplicationShell || (exports.ApplicationShell = {}));
1990
- exports.ApplicationShell = ApplicationShell;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
27
+ return function (target, key) { decorator(target, key, paramIndex); }
28
+ };
29
+ var ApplicationShell_1;
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.ApplicationShell = exports.DockPanelRenderer = exports.DockPanelRendererFactory = exports.ApplicationShellOptions = exports.applicationShellLayoutVersion = void 0;
32
+ const inversify_1 = require("inversify");
33
+ const algorithm_1 = require("@phosphor/algorithm");
34
+ const widgets_1 = require("@phosphor/widgets");
35
+ const common_1 = require("../../common");
36
+ const browser_1 = require("../browser");
37
+ const saveable_1 = require("../saveable");
38
+ const status_bar_1 = require("../status-bar/status-bar");
39
+ const theia_dock_panel_1 = require("./theia-dock-panel");
40
+ const side_panel_handler_1 = require("./side-panel-handler");
41
+ const tab_bars_1 = require("./tab-bars");
42
+ const split_panels_1 = require("./split-panels");
43
+ const frontend_application_state_1 = require("../frontend-application-state");
44
+ const tab_bar_toolbar_1 = require("./tab-bar-toolbar");
45
+ const context_key_service_1 = require("../context-key-service");
46
+ const event_1 = require("../../common/event");
47
+ const widgets_2 = require("../widgets");
48
+ const core_preferences_1 = require("../core-preferences");
49
+ const breadcrumbs_renderer_1 = require("../breadcrumbs/breadcrumbs-renderer");
50
+ const promise_util_1 = require("../../common/promise-util");
51
+ const save_resource_service_1 = require("../save-resource-service");
52
+ const nls_1 = require("../../common/nls");
53
+ const secondary_window_handler_1 = require("../secondary-window-handler");
54
+ const uri_1 = require("../../common/uri");
55
+ const opener_service_1 = require("../opener-service");
56
+ const previewable_widget_1 = require("../widgets/previewable-widget");
57
+ /** The class name added to ApplicationShell instances. */
58
+ const APPLICATION_SHELL_CLASS = 'theia-ApplicationShell';
59
+ /** The class name added to the main and bottom area panels. */
60
+ const MAIN_BOTTOM_AREA_CLASS = 'theia-app-centers';
61
+ /** Status bar entry identifier for the bottom panel toggle button. */
62
+ const BOTTOM_PANEL_TOGGLE_ID = 'bottom-panel-toggle';
63
+ /** The class name added to the main area panel. */
64
+ const MAIN_AREA_CLASS = 'theia-app-main';
65
+ /** The class name added to the bottom area panel. */
66
+ const BOTTOM_AREA_CLASS = 'theia-app-bottom';
67
+ /**
68
+ * When a version is increased, make sure to introduce a migration (ApplicationShellLayoutMigration) to this version.
69
+ */
70
+ exports.applicationShellLayoutVersion = 5.0;
71
+ exports.ApplicationShellOptions = Symbol('ApplicationShellOptions');
72
+ exports.DockPanelRendererFactory = Symbol('DockPanelRendererFactory');
73
+ /**
74
+ * A renderer for dock panels that supports context menus on tabs.
75
+ */
76
+ let DockPanelRenderer = class DockPanelRenderer {
77
+ constructor(tabBarRendererFactory, tabBarToolbarRegistry, tabBarToolbarFactory, breadcrumbsRendererFactory, corePreferences) {
78
+ this.tabBarRendererFactory = tabBarRendererFactory;
79
+ this.tabBarToolbarRegistry = tabBarToolbarRegistry;
80
+ this.tabBarToolbarFactory = tabBarToolbarFactory;
81
+ this.breadcrumbsRendererFactory = breadcrumbsRendererFactory;
82
+ this.corePreferences = corePreferences;
83
+ this.tabBarClasses = [];
84
+ this.onDidCreateTabBarEmitter = new event_1.Emitter();
85
+ }
86
+ get onDidCreateTabBar() {
87
+ return this.onDidCreateTabBarEmitter.event;
88
+ }
89
+ createTabBar() {
90
+ const getDynamicTabOptions = () => {
91
+ if (this.corePreferences.get('workbench.tab.shrinkToFit.enabled')) {
92
+ return {
93
+ minimumTabSize: this.corePreferences.get('workbench.tab.shrinkToFit.minimumSize'),
94
+ defaultTabSize: this.corePreferences.get('workbench.tab.shrinkToFit.defaultSize')
95
+ };
96
+ }
97
+ else {
98
+ return undefined;
99
+ }
100
+ };
101
+ const renderer = this.tabBarRendererFactory();
102
+ const tabBar = new tab_bars_1.ToolbarAwareTabBar(this.tabBarToolbarRegistry, this.tabBarToolbarFactory, this.breadcrumbsRendererFactory, {
103
+ renderer,
104
+ // Scroll bar options
105
+ handlers: ['drag-thumb', 'keyboard', 'wheel', 'touch'],
106
+ useBothWheelAxes: true,
107
+ scrollXMarginOffset: 4,
108
+ suppressScrollY: true
109
+ }, getDynamicTabOptions());
110
+ this.tabBarClasses.forEach(c => tabBar.addClass(c));
111
+ renderer.tabBar = tabBar;
112
+ renderer.contextMenuPath = tab_bars_1.SHELL_TABBAR_CONTEXT_MENU;
113
+ tabBar.currentChanged.connect(this.onCurrentTabChanged, this);
114
+ const prefChangeDisposable = this.corePreferences.onPreferenceChanged(change => {
115
+ if (change.preferenceName === 'workbench.tab.shrinkToFit.enabled' ||
116
+ change.preferenceName === 'workbench.tab.shrinkToFit.minimumSize' ||
117
+ change.preferenceName === 'workbench.tab.shrinkToFit.defaultSize') {
118
+ tabBar.dynamicTabOptions = getDynamicTabOptions();
119
+ }
120
+ });
121
+ tabBar.disposed.connect(() => {
122
+ prefChangeDisposable.dispose();
123
+ renderer.dispose();
124
+ });
125
+ this.onDidCreateTabBarEmitter.fire(tabBar);
126
+ return tabBar;
127
+ }
128
+ createHandle() {
129
+ return widgets_1.DockPanel.defaultRenderer.createHandle();
130
+ }
131
+ onCurrentTabChanged(sender, { currentIndex }) {
132
+ if (currentIndex >= 0) {
133
+ sender.revealTab(currentIndex);
134
+ }
135
+ }
136
+ };
137
+ __decorate([
138
+ (0, inversify_1.inject)(theia_dock_panel_1.TheiaDockPanel.Factory),
139
+ __metadata("design:type", Function)
140
+ ], DockPanelRenderer.prototype, "dockPanelFactory", void 0);
141
+ DockPanelRenderer = __decorate([
142
+ (0, inversify_1.injectable)(),
143
+ __param(0, (0, inversify_1.inject)(tab_bars_1.TabBarRendererFactory)),
144
+ __param(1, (0, inversify_1.inject)(tab_bar_toolbar_1.TabBarToolbarRegistry)),
145
+ __param(2, (0, inversify_1.inject)(tab_bar_toolbar_1.TabBarToolbarFactory)),
146
+ __param(3, (0, inversify_1.inject)(breadcrumbs_renderer_1.BreadcrumbsRendererFactory)),
147
+ __param(4, (0, inversify_1.inject)(core_preferences_1.CorePreferences)),
148
+ __metadata("design:paramtypes", [Function, tab_bar_toolbar_1.TabBarToolbarRegistry, Function, Function, Object])
149
+ ], DockPanelRenderer);
150
+ exports.DockPanelRenderer = DockPanelRenderer;
151
+ /**
152
+ * The application shell manages the top-level widgets of the application. Use this class to
153
+ * add, remove, or activate a widget.
154
+ */
155
+ let ApplicationShell = ApplicationShell_1 = class ApplicationShell extends widgets_1.Widget {
156
+ /**
157
+ * Construct a new application shell.
158
+ */
159
+ constructor(dockPanelRendererFactory, statusBar, sidePanelHandlerFactory, splitPositionHandler, applicationStateService, options = {}, corePreferences, saveResourceService, secondaryWindowHandler) {
160
+ super(options);
161
+ this.dockPanelRendererFactory = dockPanelRendererFactory;
162
+ this.statusBar = statusBar;
163
+ this.sidePanelHandlerFactory = sidePanelHandlerFactory;
164
+ this.splitPositionHandler = splitPositionHandler;
165
+ this.applicationStateService = applicationStateService;
166
+ this.corePreferences = corePreferences;
167
+ this.saveResourceService = saveResourceService;
168
+ this.secondaryWindowHandler = secondaryWindowHandler;
169
+ /**
170
+ * The current state of the bottom panel.
171
+ */
172
+ this.bottomPanelState = {
173
+ empty: true,
174
+ expansion: side_panel_handler_1.SidePanel.ExpansionState.collapsed,
175
+ pendingUpdate: Promise.resolve()
176
+ };
177
+ this.tracker = new widgets_1.FocusTracker();
178
+ this.onDidAddWidgetEmitter = new event_1.Emitter();
179
+ this.onDidAddWidget = this.onDidAddWidgetEmitter.event;
180
+ this.onDidRemoveWidgetEmitter = new event_1.Emitter();
181
+ this.onDidRemoveWidget = this.onDidRemoveWidgetEmitter.event;
182
+ this.onDidChangeActiveWidgetEmitter = new event_1.Emitter();
183
+ this.onDidChangeActiveWidget = this.onDidChangeActiveWidgetEmitter.event;
184
+ this.onDidChangeCurrentWidgetEmitter = new event_1.Emitter();
185
+ this.onDidChangeCurrentWidget = this.onDidChangeCurrentWidgetEmitter.event;
186
+ this.onDidDoubleClickMainAreaEmitter = new event_1.Emitter();
187
+ this.onDidDoubleClickMainArea = this.onDidDoubleClickMainAreaEmitter.event;
188
+ this.toDisposeOnActiveChanged = new common_1.DisposableCollection();
189
+ this.activationTimeout = 2000;
190
+ this.toDisposeOnActivationCheck = new common_1.DisposableCollection();
191
+ // Merge the user-defined application options with the default options
192
+ this.options = {
193
+ bottomPanel: {
194
+ ...ApplicationShell_1.DEFAULT_OPTIONS.bottomPanel,
195
+ ...(options === null || options === void 0 ? void 0 : options.bottomPanel) || {}
196
+ },
197
+ leftPanel: {
198
+ ...ApplicationShell_1.DEFAULT_OPTIONS.leftPanel,
199
+ ...(options === null || options === void 0 ? void 0 : options.leftPanel) || {}
200
+ },
201
+ rightPanel: {
202
+ ...ApplicationShell_1.DEFAULT_OPTIONS.rightPanel,
203
+ ...(options === null || options === void 0 ? void 0 : options.rightPanel) || {}
204
+ }
205
+ };
206
+ }
207
+ fireDidAddWidget(widget) {
208
+ this.onDidAddWidgetEmitter.fire(widget);
209
+ }
210
+ fireDidRemoveWidget(widget) {
211
+ this.onDidRemoveWidgetEmitter.fire(widget);
212
+ }
213
+ get mainPanelRenderer() {
214
+ return this._mainPanelRenderer;
215
+ }
216
+ init() {
217
+ this.initializeShell();
218
+ this.initSidebarVisibleKeyContext();
219
+ this.initFocusKeyContexts();
220
+ if (!common_1.environment.electron.is()) {
221
+ this.corePreferences.ready.then(() => {
222
+ this.setTopPanelVisibility(this.corePreferences['window.menuBarVisibility']);
223
+ });
224
+ this.corePreferences.onPreferenceChanged(preference => {
225
+ if (preference.preferenceName === 'window.menuBarVisibility') {
226
+ this.setTopPanelVisibility(preference.newValue);
227
+ }
228
+ });
229
+ }
230
+ this.corePreferences.onPreferenceChanged(preference => {
231
+ if (preference.preferenceName === 'window.tabbar.enhancedPreview') {
232
+ this.allTabBars.forEach(tabBar => {
233
+ tabBar.update();
234
+ });
235
+ }
236
+ });
237
+ }
238
+ initializeShell() {
239
+ this.addClass(APPLICATION_SHELL_CLASS);
240
+ this.id = 'theia-app-shell';
241
+ this.mainPanel = this.createMainPanel();
242
+ this.topPanel = this.createTopPanel();
243
+ this.bottomPanel = this.createBottomPanel();
244
+ this.leftPanelHandler = this.sidePanelHandlerFactory();
245
+ this.leftPanelHandler.create('left', this.options.leftPanel);
246
+ this.leftPanelHandler.dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
247
+ this.leftPanelHandler.dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
248
+ this.rightPanelHandler = this.sidePanelHandlerFactory();
249
+ this.rightPanelHandler.create('right', this.options.rightPanel);
250
+ this.rightPanelHandler.dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
251
+ this.rightPanelHandler.dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
252
+ this.secondaryWindowHandler.init(this);
253
+ this.secondaryWindowHandler.onDidAddWidget(widget => this.fireDidAddWidget(widget));
254
+ this.secondaryWindowHandler.onDidRemoveWidget(widget => this.fireDidRemoveWidget(widget));
255
+ this.layout = this.createLayout();
256
+ this.tracker.currentChanged.connect(this.onCurrentChanged, this);
257
+ this.tracker.activeChanged.connect(this.onActiveChanged, this);
258
+ }
259
+ initSidebarVisibleKeyContext() {
260
+ const leftSideBarPanel = this.leftPanelHandler.dockPanel;
261
+ const sidebarVisibleKey = this.contextKeyService.createKey('sidebarVisible', leftSideBarPanel.isVisible);
262
+ const onAfterShow = leftSideBarPanel['onAfterShow'].bind(leftSideBarPanel);
263
+ leftSideBarPanel['onAfterShow'] = (msg) => {
264
+ onAfterShow(msg);
265
+ sidebarVisibleKey.set(true);
266
+ };
267
+ const onAfterHide = leftSideBarPanel['onAfterHide'].bind(leftSideBarPanel);
268
+ leftSideBarPanel['onAfterHide'] = (msg) => {
269
+ onAfterHide(msg);
270
+ sidebarVisibleKey.set(false);
271
+ };
272
+ }
273
+ initFocusKeyContexts() {
274
+ const sideBarFocus = this.contextKeyService.createKey('sideBarFocus', false);
275
+ const panelFocus = this.contextKeyService.createKey('panelFocus', false);
276
+ const updateFocusContextKeys = () => {
277
+ const area = this.activeWidget && this.getAreaFor(this.activeWidget);
278
+ sideBarFocus.set(area === 'left');
279
+ panelFocus.set(area === 'main');
280
+ };
281
+ updateFocusContextKeys();
282
+ this.onDidChangeActiveWidget(updateFocusContextKeys);
283
+ }
284
+ setTopPanelVisibility(preference) {
285
+ const hiddenPreferences = ['compact', 'hidden'];
286
+ this.topPanel.setHidden(hiddenPreferences.includes(preference));
287
+ }
288
+ onBeforeAttach(msg) {
289
+ document.addEventListener('p-dragenter', this, true);
290
+ document.addEventListener('p-dragover', this, true);
291
+ document.addEventListener('p-dragleave', this, true);
292
+ document.addEventListener('p-drop', this, true);
293
+ }
294
+ onAfterDetach(msg) {
295
+ document.removeEventListener('p-dragenter', this, true);
296
+ document.removeEventListener('p-dragover', this, true);
297
+ document.removeEventListener('p-dragleave', this, true);
298
+ document.removeEventListener('p-drop', this, true);
299
+ }
300
+ handleEvent(event) {
301
+ switch (event.type) {
302
+ case 'p-dragenter':
303
+ this.onDragEnter(event);
304
+ break;
305
+ case 'p-dragover':
306
+ this.onDragOver(event);
307
+ break;
308
+ case 'p-drop':
309
+ this.onDrop(event);
310
+ break;
311
+ case 'p-dragleave':
312
+ this.onDragLeave(event);
313
+ break;
314
+ }
315
+ }
316
+ onDragEnter({ mimeData }) {
317
+ if (!this.dragState) {
318
+ if (mimeData && mimeData.hasData('application/vnd.phosphor.widget-factory')) {
319
+ // The drag contains a widget, so we'll track it and expand side panels as needed
320
+ this.dragState = {
321
+ startTime: performance.now(),
322
+ leftExpanded: false,
323
+ rightExpanded: false,
324
+ bottomExpanded: false
325
+ };
326
+ }
327
+ }
328
+ }
329
+ onDragOver(event) {
330
+ const state = this.dragState;
331
+ if (state) {
332
+ state.lastDragOver = event;
333
+ if (state.leaveTimeout) {
334
+ window.clearTimeout(state.leaveTimeout);
335
+ state.leaveTimeout = undefined;
336
+ }
337
+ const { clientX, clientY } = event;
338
+ const { offsetLeft, offsetTop, clientWidth, clientHeight } = this.node;
339
+ // Don't expand any side panels right after the drag has started
340
+ const allowExpansion = performance.now() - state.startTime >= 500;
341
+ const expLeft = allowExpansion && clientX >= offsetLeft
342
+ && clientX <= offsetLeft + this.options.leftPanel.expandThreshold;
343
+ const expRight = allowExpansion && clientX <= offsetLeft + clientWidth
344
+ && clientX >= offsetLeft + clientWidth - this.options.rightPanel.expandThreshold;
345
+ const expBottom = allowExpansion && !expLeft && !expRight && clientY <= offsetTop + clientHeight
346
+ && clientY >= offsetTop + clientHeight - this.options.bottomPanel.expandThreshold;
347
+ // eslint-disable-next-line no-null/no-null
348
+ if (expLeft && !state.leftExpanded && this.leftPanelHandler.tabBar.currentTitle === null) {
349
+ // The mouse cursor is moved close to the left border
350
+ this.leftPanelHandler.expand();
351
+ this.leftPanelHandler.state.pendingUpdate.then(() => this.dispatchMouseMove());
352
+ state.leftExpanded = true;
353
+ }
354
+ else if (!expLeft && state.leftExpanded) {
355
+ // The mouse cursor is moved away from the left border
356
+ this.leftPanelHandler.collapse();
357
+ state.leftExpanded = false;
358
+ }
359
+ // eslint-disable-next-line no-null/no-null
360
+ if (expRight && !state.rightExpanded && this.rightPanelHandler.tabBar.currentTitle === null) {
361
+ // The mouse cursor is moved close to the right border
362
+ this.rightPanelHandler.expand();
363
+ this.rightPanelHandler.state.pendingUpdate.then(() => this.dispatchMouseMove());
364
+ state.rightExpanded = true;
365
+ }
366
+ else if (!expRight && state.rightExpanded) {
367
+ // The mouse cursor is moved away from the right border
368
+ this.rightPanelHandler.collapse();
369
+ state.rightExpanded = false;
370
+ }
371
+ if (expBottom && !state.bottomExpanded && this.bottomPanel.isHidden) {
372
+ // The mouse cursor is moved close to the bottom border
373
+ this.expandBottomPanel();
374
+ this.bottomPanelState.pendingUpdate.then(() => this.dispatchMouseMove());
375
+ state.bottomExpanded = true;
376
+ }
377
+ else if (!expBottom && state.bottomExpanded) {
378
+ // The mouse cursor is moved away from the bottom border
379
+ this.collapseBottomPanel();
380
+ state.bottomExpanded = false;
381
+ }
382
+ }
383
+ }
384
+ /**
385
+ * This method is called after a side panel has been expanded while dragging a widget. It fires
386
+ * a `mousemove` event so that the drag overlay markers are updated correctly in all dock panels.
387
+ */
388
+ dispatchMouseMove() {
389
+ if (this.dragState && this.dragState.lastDragOver) {
390
+ const { clientX, clientY } = this.dragState.lastDragOver;
391
+ const event = document.createEvent('MouseEvent');
392
+ event.initMouseEvent('mousemove', true, true, window, 0, 0, 0,
393
+ // eslint-disable-next-line no-null/no-null
394
+ clientX, clientY, false, false, false, false, 0, null);
395
+ document.dispatchEvent(event);
396
+ }
397
+ }
398
+ onDrop(event) {
399
+ const state = this.dragState;
400
+ if (state) {
401
+ if (state.leaveTimeout) {
402
+ window.clearTimeout(state.leaveTimeout);
403
+ }
404
+ this.dragState = undefined;
405
+ window.requestAnimationFrame(() => {
406
+ // Clean up the side panel state in the next frame
407
+ if (this.leftPanelHandler.dockPanel.isEmpty) {
408
+ this.leftPanelHandler.collapse();
409
+ }
410
+ if (this.rightPanelHandler.dockPanel.isEmpty) {
411
+ this.rightPanelHandler.collapse();
412
+ }
413
+ if (this.bottomPanel.isEmpty) {
414
+ this.collapseBottomPanel();
415
+ }
416
+ });
417
+ }
418
+ }
419
+ onDragLeave(event) {
420
+ const state = this.dragState;
421
+ if (state) {
422
+ state.lastDragOver = undefined;
423
+ if (state.leaveTimeout) {
424
+ window.clearTimeout(state.leaveTimeout);
425
+ }
426
+ state.leaveTimeout = window.setTimeout(() => {
427
+ this.dragState = undefined;
428
+ if (state.leftExpanded || this.leftPanelHandler.dockPanel.isEmpty) {
429
+ this.leftPanelHandler.collapse();
430
+ }
431
+ if (state.rightExpanded || this.rightPanelHandler.dockPanel.isEmpty) {
432
+ this.rightPanelHandler.collapse();
433
+ }
434
+ if (state.bottomExpanded || this.bottomPanel.isEmpty) {
435
+ this.collapseBottomPanel();
436
+ }
437
+ }, 100);
438
+ }
439
+ }
440
+ /**
441
+ * Create the dock panel in the main shell area.
442
+ */
443
+ createMainPanel() {
444
+ const renderer = this.dockPanelRendererFactory();
445
+ renderer.tabBarClasses.push(MAIN_BOTTOM_AREA_CLASS);
446
+ renderer.tabBarClasses.push(MAIN_AREA_CLASS);
447
+ this._mainPanelRenderer = renderer;
448
+ const dockPanel = this.dockPanelFactory({
449
+ mode: 'multiple-document',
450
+ renderer,
451
+ spacing: 0
452
+ });
453
+ dockPanel.id = theia_dock_panel_1.MAIN_AREA_ID;
454
+ dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
455
+ dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
456
+ const openUri = async (fileUri) => {
457
+ try {
458
+ const opener = await this.openerService.getOpener(fileUri);
459
+ opener.open(fileUri);
460
+ }
461
+ catch (e) {
462
+ console.info(`no opener found for '${fileUri}'`);
463
+ }
464
+ };
465
+ dockPanel.node.addEventListener('drop', event => {
466
+ var _a;
467
+ if (event.dataTransfer) {
468
+ const uris = this.additionalDraggedUris || ApplicationShell_1.getDraggedEditorUris(event.dataTransfer);
469
+ if (uris.length > 0) {
470
+ uris.forEach(openUri);
471
+ }
472
+ else if (((_a = event.dataTransfer.files) === null || _a === void 0 ? void 0 : _a.length) > 0) {
473
+ // the files were dragged from the outside the workspace
474
+ Array.from(event.dataTransfer.files).forEach(file => {
475
+ if (file.path) {
476
+ const fileUri = uri_1.default.fromComponents({
477
+ scheme: 'file',
478
+ path: file.path,
479
+ authority: '',
480
+ query: '',
481
+ fragment: ''
482
+ });
483
+ openUri(fileUri);
484
+ }
485
+ });
486
+ }
487
+ }
488
+ });
489
+ dockPanel.node.addEventListener('dblclick', event => {
490
+ const el = event.target;
491
+ if (el.id === theia_dock_panel_1.MAIN_AREA_ID || el.classList.contains('p-TabBar-content')) {
492
+ this.onDidDoubleClickMainAreaEmitter.fire();
493
+ }
494
+ });
495
+ const handler = (e) => {
496
+ if (e.dataTransfer) {
497
+ e.dataTransfer.dropEffect = 'link';
498
+ e.preventDefault();
499
+ e.stopPropagation();
500
+ }
501
+ };
502
+ dockPanel.node.addEventListener('dragover', handler);
503
+ dockPanel.node.addEventListener('dragenter', handler);
504
+ return dockPanel;
505
+ }
506
+ addAdditionalDraggedEditorUris(uris) {
507
+ this.additionalDraggedUris = uris;
508
+ }
509
+ clearAdditionalDraggedEditorUris() {
510
+ this.additionalDraggedUris = undefined;
511
+ }
512
+ static getDraggedEditorUris(dataTransfer) {
513
+ const data = dataTransfer.getData('theia-editor-dnd');
514
+ return data ? data.split('\n').map(entry => new uri_1.default(entry)) : [];
515
+ }
516
+ static setDraggedEditorUris(dataTransfer, uris) {
517
+ dataTransfer.setData('theia-editor-dnd', uris.map(uri => uri.toString()).join('\n'));
518
+ }
519
+ /**
520
+ * Create the dock panel in the bottom shell area.
521
+ */
522
+ createBottomPanel() {
523
+ const renderer = this.dockPanelRendererFactory();
524
+ renderer.tabBarClasses.push(MAIN_BOTTOM_AREA_CLASS);
525
+ renderer.tabBarClasses.push(BOTTOM_AREA_CLASS);
526
+ const dockPanel = this.dockPanelFactory({
527
+ mode: 'multiple-document',
528
+ renderer,
529
+ spacing: 0
530
+ });
531
+ dockPanel.id = theia_dock_panel_1.BOTTOM_AREA_ID;
532
+ dockPanel.widgetAdded.connect((sender, widget) => {
533
+ this.refreshBottomPanelToggleButton();
534
+ });
535
+ dockPanel.widgetRemoved.connect((sender, widget) => {
536
+ if (sender.isEmpty) {
537
+ this.collapseBottomPanel();
538
+ }
539
+ this.refreshBottomPanelToggleButton();
540
+ }, this);
541
+ dockPanel.node.addEventListener('p-dragenter', event => {
542
+ // Make sure that the main panel hides its overlay when the bottom panel is expanded
543
+ this.mainPanel.overlay.hide(0);
544
+ });
545
+ dockPanel.hide();
546
+ dockPanel.widgetAdded.connect((_, widget) => this.fireDidAddWidget(widget));
547
+ dockPanel.widgetRemoved.connect((_, widget) => this.fireDidRemoveWidget(widget));
548
+ return dockPanel;
549
+ }
550
+ /**
551
+ * Create the top panel, which is used to hold the main menu.
552
+ */
553
+ createTopPanel() {
554
+ const topPanel = new widgets_1.Panel();
555
+ topPanel.id = 'theia-top-panel';
556
+ topPanel.hide();
557
+ return topPanel;
558
+ }
559
+ /**
560
+ * Create a box layout to assemble the application shell layout.
561
+ */
562
+ createBoxLayout(widgets, stretch, options) {
563
+ const boxLayout = new widgets_1.BoxLayout(options);
564
+ for (let i = 0; i < widgets.length; i++) {
565
+ if (stretch !== undefined && i < stretch.length) {
566
+ widgets_1.BoxPanel.setStretch(widgets[i], stretch[i]);
567
+ }
568
+ boxLayout.addWidget(widgets[i]);
569
+ }
570
+ return boxLayout;
571
+ }
572
+ /**
573
+ * Create a split layout to assemble the application shell layout.
574
+ */
575
+ createSplitLayout(widgets, stretch, options) {
576
+ let optParam = { renderer: widgets_1.SplitPanel.defaultRenderer, };
577
+ if (options) {
578
+ optParam = { ...optParam, ...options };
579
+ }
580
+ const splitLayout = new widgets_1.SplitLayout(optParam);
581
+ for (let i = 0; i < widgets.length; i++) {
582
+ if (stretch !== undefined && i < stretch.length) {
583
+ widgets_1.SplitPanel.setStretch(widgets[i], stretch[i]);
584
+ }
585
+ splitLayout.addWidget(widgets[i]);
586
+ }
587
+ return splitLayout;
588
+ }
589
+ /**
590
+ * Assemble the application shell layout. Override this method in order to change the arrangement
591
+ * of the main area and the side panels.
592
+ */
593
+ createLayout() {
594
+ const bottomSplitLayout = this.createSplitLayout([this.mainPanel, this.bottomPanel], [1, 0], { orientation: 'vertical', spacing: 0 });
595
+ const panelForBottomArea = new widgets_1.SplitPanel({ layout: bottomSplitLayout });
596
+ panelForBottomArea.id = 'theia-bottom-split-panel';
597
+ const leftRightSplitLayout = this.createSplitLayout([this.leftPanelHandler.container, panelForBottomArea, this.rightPanelHandler.container], [0, 1, 0], { orientation: 'horizontal', spacing: 0 });
598
+ const panelForSideAreas = new widgets_1.SplitPanel({ layout: leftRightSplitLayout });
599
+ panelForSideAreas.id = 'theia-left-right-split-panel';
600
+ return this.createBoxLayout([this.topPanel, panelForSideAreas, this.statusBar], [0, 1, 0], { direction: 'top-to-bottom', spacing: 0 });
601
+ }
602
+ /**
603
+ * Create an object that describes the current shell layout. This object may contain references
604
+ * to widgets; these need to be transformed before the layout can be serialized.
605
+ */
606
+ getLayoutData() {
607
+ return {
608
+ version: exports.applicationShellLayoutVersion,
609
+ mainPanel: this.mainPanel.saveLayout(),
610
+ mainPanelPinned: this.getPinnedMainWidgets(),
611
+ bottomPanel: {
612
+ config: this.bottomPanel.saveLayout(),
613
+ pinned: this.getPinnedBottomWidgets(),
614
+ size: this.bottomPanel.isVisible ? this.getBottomPanelSize() : this.bottomPanelState.lastPanelSize,
615
+ expanded: this.isExpanded('bottom')
616
+ },
617
+ leftPanel: this.leftPanelHandler.getLayoutData(),
618
+ rightPanel: this.rightPanelHandler.getLayoutData(),
619
+ activeWidgetId: this.activeWidget ? this.activeWidget.id : undefined
620
+ };
621
+ }
622
+ // Get an array corresponding to main panel widgets' pinned state.
623
+ getPinnedMainWidgets() {
624
+ const pinned = [];
625
+ (0, algorithm_1.toArray)(this.mainPanel.widgets()).forEach((a, i) => {
626
+ pinned[i] = a.title.className.includes(widgets_2.PINNED_CLASS);
627
+ });
628
+ return pinned;
629
+ }
630
+ // Get an array corresponding to bottom panel widgets' pinned state.
631
+ getPinnedBottomWidgets() {
632
+ const pinned = [];
633
+ (0, algorithm_1.toArray)(this.bottomPanel.widgets()).forEach((a, i) => {
634
+ pinned[i] = a.title.className.includes(widgets_2.PINNED_CLASS);
635
+ });
636
+ return pinned;
637
+ }
638
+ /**
639
+ * Compute the current height of the bottom panel. This implementation assumes that the container
640
+ * of the bottom panel is a `SplitPanel`.
641
+ */
642
+ getBottomPanelSize() {
643
+ const parent = this.bottomPanel.parent;
644
+ if (parent instanceof widgets_1.SplitPanel && parent.isVisible) {
645
+ const index = parent.widgets.indexOf(this.bottomPanel) - 1;
646
+ if (index >= 0) {
647
+ const handle = parent.handles[index];
648
+ if (!handle.classList.contains('p-mod-hidden')) {
649
+ const parentHeight = parent.node.clientHeight;
650
+ return parentHeight - handle.offsetTop;
651
+ }
652
+ }
653
+ }
654
+ }
655
+ /**
656
+ * Determine the default size to apply when the bottom panel is expanded for the first time.
657
+ */
658
+ getDefaultBottomPanelSize() {
659
+ const parent = this.bottomPanel.parent;
660
+ if (parent && parent.isVisible) {
661
+ return parent.node.clientHeight * this.options.bottomPanel.initialSizeRatio;
662
+ }
663
+ }
664
+ /**
665
+ * Apply a shell layout that has been previously created with `getLayoutData`.
666
+ */
667
+ async setLayoutData(layoutData) {
668
+ var _a, _b;
669
+ const { mainPanel, mainPanelPinned, bottomPanel, leftPanel, rightPanel, activeWidgetId } = layoutData;
670
+ if (leftPanel) {
671
+ this.leftPanelHandler.setLayoutData(leftPanel);
672
+ this.registerWithFocusTracker(leftPanel);
673
+ }
674
+ if (rightPanel) {
675
+ this.rightPanelHandler.setLayoutData(rightPanel);
676
+ this.registerWithFocusTracker(rightPanel);
677
+ }
678
+ // Proceed with the bottom panel once the side panels are set up
679
+ await Promise.all([this.leftPanelHandler.state.pendingUpdate, this.rightPanelHandler.state.pendingUpdate]);
680
+ if (bottomPanel) {
681
+ if (bottomPanel.config) {
682
+ this.bottomPanel.restoreLayout(bottomPanel.config);
683
+ this.registerWithFocusTracker(bottomPanel.config.main);
684
+ }
685
+ if (bottomPanel.size) {
686
+ this.bottomPanelState.lastPanelSize = bottomPanel.size;
687
+ }
688
+ if (bottomPanel.expanded) {
689
+ this.expandBottomPanel();
690
+ }
691
+ else {
692
+ this.collapseBottomPanel();
693
+ }
694
+ const widgets = (0, algorithm_1.toArray)(this.bottomPanel.widgets());
695
+ this.bottomPanel.markActiveTabBar((_a = widgets[0]) === null || _a === void 0 ? void 0 : _a.title);
696
+ if (bottomPanel.pinned && bottomPanel.pinned.length === widgets.length) {
697
+ widgets.forEach((a, i) => {
698
+ if (bottomPanel.pinned[i]) {
699
+ a.title.className += ` ${widgets_2.PINNED_CLASS}`;
700
+ a.title.closable = false;
701
+ }
702
+ });
703
+ }
704
+ this.refreshBottomPanelToggleButton();
705
+ }
706
+ // Proceed with the main panel once all others are set up
707
+ await this.bottomPanelState.pendingUpdate;
708
+ if (mainPanel) {
709
+ this.mainPanel.restoreLayout(mainPanel);
710
+ this.registerWithFocusTracker(mainPanel.main);
711
+ const widgets = (0, algorithm_1.toArray)(this.mainPanel.widgets());
712
+ // We don't store information about the last active tabbar
713
+ // So we simply mark the first as being active
714
+ this.mainPanel.markActiveTabBar((_b = widgets[0]) === null || _b === void 0 ? void 0 : _b.title);
715
+ if (mainPanelPinned && mainPanelPinned.length === widgets.length) {
716
+ widgets.forEach((a, i) => {
717
+ if (mainPanelPinned[i]) {
718
+ a.title.className += ` ${widgets_2.PINNED_CLASS}`;
719
+ a.title.closable = false;
720
+ }
721
+ });
722
+ }
723
+ }
724
+ if (activeWidgetId) {
725
+ this.activateWidget(activeWidgetId);
726
+ }
727
+ }
728
+ /**
729
+ * Modify the height of the bottom panel. This implementation assumes that the container of the
730
+ * bottom panel is a `SplitPanel`.
731
+ */
732
+ setBottomPanelSize(size) {
733
+ const enableAnimation = this.applicationStateService.state === 'ready';
734
+ const options = {
735
+ side: 'bottom',
736
+ duration: enableAnimation ? this.options.bottomPanel.expandDuration : 0,
737
+ referenceWidget: this.bottomPanel
738
+ };
739
+ const promise = this.splitPositionHandler.setSidePanelSize(this.bottomPanel, size, options);
740
+ const result = new Promise(resolve => {
741
+ // Resolve the resulting promise in any case, regardless of whether resizing was successful
742
+ promise.then(() => resolve(), () => resolve());
743
+ });
744
+ this.bottomPanelState.pendingUpdate = this.bottomPanelState.pendingUpdate.then(() => result);
745
+ return result;
746
+ }
747
+ /**
748
+ * A promise that is resolved when all currently pending updates are done.
749
+ */
750
+ get pendingUpdates() {
751
+ return Promise.all([
752
+ this.bottomPanelState.pendingUpdate,
753
+ this.leftPanelHandler.state.pendingUpdate,
754
+ this.rightPanelHandler.state.pendingUpdate
755
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
756
+ ]);
757
+ }
758
+ /**
759
+ * Track all widgets that are referenced by the given layout data.
760
+ */
761
+ registerWithFocusTracker(data) {
762
+ if (data) {
763
+ if (data.type === 'tab-area') {
764
+ for (const widget of data.widgets) {
765
+ if (widget) {
766
+ this.track(widget);
767
+ }
768
+ }
769
+ }
770
+ else if (data.type === 'split-area') {
771
+ for (const child of data.children) {
772
+ this.registerWithFocusTracker(child);
773
+ }
774
+ }
775
+ else if (data.type === 'sidepanel' && data.items) {
776
+ for (const item of data.items) {
777
+ if (item.widget) {
778
+ this.track(item.widget);
779
+ }
780
+ }
781
+ }
782
+ }
783
+ }
784
+ /**
785
+ * Add a widget to the application shell. The given widget must have a unique `id` property,
786
+ * which will be used as the DOM id.
787
+ *
788
+ * Widgets are removed from the shell by calling their `close` or `dispose` methods.
789
+ *
790
+ * Widgets added to the top area are not tracked regarding the _current_ and _active_ states.
791
+ */
792
+ async addWidget(widget, options) {
793
+ if (!widget.id) {
794
+ console.error('Widgets added to the application shell must have a unique id property.');
795
+ return;
796
+ }
797
+ const { area, addOptions } = this.getInsertionOptions(options);
798
+ const sidePanelOptions = { rank: options === null || options === void 0 ? void 0 : options.rank };
799
+ switch (area) {
800
+ case 'main':
801
+ this.mainPanel.addWidget(widget, addOptions);
802
+ break;
803
+ case 'top':
804
+ this.topPanel.addWidget(widget);
805
+ break;
806
+ case 'bottom':
807
+ this.bottomPanel.addWidget(widget, addOptions);
808
+ break;
809
+ case 'left':
810
+ this.leftPanelHandler.addWidget(widget, sidePanelOptions);
811
+ break;
812
+ case 'right':
813
+ this.rightPanelHandler.addWidget(widget, sidePanelOptions);
814
+ break;
815
+ case 'secondaryWindow':
816
+ /** At the moment, widgets are only moved to this area (i.e. a secondary window) by moving them from one of the other areas. */
817
+ throw new Error('Widgets cannot be added directly to a secondary window');
818
+ default:
819
+ throw new Error('Unexpected area: ' + (options === null || options === void 0 ? void 0 : options.area));
820
+ }
821
+ if (area !== 'top') {
822
+ this.track(widget);
823
+ }
824
+ }
825
+ getInsertionOptions(options) {
826
+ let ref = options === null || options === void 0 ? void 0 : options.ref;
827
+ let area = (options === null || options === void 0 ? void 0 : options.area) || 'main';
828
+ if (!ref && (area === 'main' || area === 'bottom')) {
829
+ const tabBar = this.getTabBarFor(area);
830
+ ref = tabBar && tabBar.currentTitle && tabBar.currentTitle.owner || undefined;
831
+ }
832
+ // make sure that ref belongs to area
833
+ area = ref && this.getAreaFor(ref) || area;
834
+ const addOptions = {};
835
+ if (ApplicationShell_1.isOpenToSideMode(options === null || options === void 0 ? void 0 : options.mode)) {
836
+ const areaPanel = area === 'main' ? this.mainPanel : area === 'bottom' ? this.bottomPanel : undefined;
837
+ const sideRef = areaPanel && ref && ((options === null || options === void 0 ? void 0 : options.mode) === 'open-to-left' ?
838
+ areaPanel.previousTabBarWidget(ref) :
839
+ areaPanel.nextTabBarWidget(ref));
840
+ if (sideRef) {
841
+ addOptions.ref = sideRef;
842
+ }
843
+ else {
844
+ addOptions.ref = ref;
845
+ addOptions.mode = (options === null || options === void 0 ? void 0 : options.mode) === 'open-to-left' ? 'split-left' : 'split-right';
846
+ }
847
+ }
848
+ else {
849
+ addOptions.ref = ref;
850
+ addOptions.mode = options === null || options === void 0 ? void 0 : options.mode;
851
+ }
852
+ return { area, addOptions };
853
+ }
854
+ /**
855
+ * The widgets contained in the given shell area.
856
+ */
857
+ getWidgets(area) {
858
+ switch (area) {
859
+ case 'main':
860
+ return (0, algorithm_1.toArray)(this.mainPanel.widgets());
861
+ case 'top':
862
+ return (0, algorithm_1.toArray)(this.topPanel.widgets);
863
+ case 'bottom':
864
+ return (0, algorithm_1.toArray)(this.bottomPanel.widgets());
865
+ case 'left':
866
+ return (0, algorithm_1.toArray)(this.leftPanelHandler.dockPanel.widgets());
867
+ case 'right':
868
+ return (0, algorithm_1.toArray)(this.rightPanelHandler.dockPanel.widgets());
869
+ case 'secondaryWindow':
870
+ return (0, algorithm_1.toArray)(this.secondaryWindowHandler.widgets);
871
+ default:
872
+ throw new Error('Illegal argument: ' + area);
873
+ }
874
+ }
875
+ /**
876
+ * Find the widget that contains the given HTML element. The returned widget may be one
877
+ * that is managed by the application shell, or one that is embedded in another widget and
878
+ * not directly managed by the shell, or a tab bar.
879
+ */
880
+ findWidgetForElement(element) {
881
+ let widgetNode = element;
882
+ while (widgetNode && !widgetNode.classList.contains('p-Widget')) {
883
+ widgetNode = widgetNode.parentElement;
884
+ }
885
+ if (widgetNode) {
886
+ return this.findWidgetForNode(widgetNode, this);
887
+ }
888
+ return undefined;
889
+ }
890
+ findWidgetForNode(widgetNode, widget) {
891
+ if (widget.node === widgetNode) {
892
+ return widget;
893
+ }
894
+ let result;
895
+ (0, algorithm_1.each)(widget.children(), child => {
896
+ result = this.findWidgetForNode(widgetNode, child);
897
+ return !result;
898
+ });
899
+ return result;
900
+ }
901
+ /**
902
+ * Finds the title widget from the tab-bar.
903
+ * @param tabBar used for providing an array of titles.
904
+ * @returns the selected title widget, else returns the currentTitle or undefined.
905
+ */
906
+ findTitle(tabBar, event) {
907
+ if ((event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement) {
908
+ const tabNode = event.target;
909
+ const titleIndex = Array.from(tabBar.contentNode.getElementsByClassName('p-TabBar-tab'))
910
+ .findIndex(node => node.contains(tabNode));
911
+ if (titleIndex !== -1) {
912
+ return tabBar.titles[titleIndex];
913
+ }
914
+ }
915
+ return tabBar.currentTitle || undefined;
916
+ }
917
+ /**
918
+ * Finds the tab-bar widget.
919
+ * @returns the selected tab-bar, else returns the currentTabBar.
920
+ */
921
+ findTabBar(event) {
922
+ if ((event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement) {
923
+ const tabBar = this.findWidgetForElement(event.target);
924
+ if (tabBar instanceof widgets_1.TabBar) {
925
+ return tabBar;
926
+ }
927
+ }
928
+ return this.currentTabBar;
929
+ }
930
+ /**
931
+ * @returns the widget whose title has been targeted by a DOM event on a tabbar, or undefined if none can be found.
932
+ */
933
+ findTargetedWidget(event) {
934
+ if (event) {
935
+ const tab = this.findTabBar(event);
936
+ const title = tab && this.findTitle(tab, event);
937
+ return title && title.owner;
938
+ }
939
+ }
940
+ /**
941
+ * The current widget in the application shell. The current widget is the last widget that
942
+ * was active and not yet closed. See the remarks to `activeWidget` on what _active_ means.
943
+ */
944
+ get currentWidget() {
945
+ return this.tracker.currentWidget || undefined;
946
+ }
947
+ /**
948
+ * The active widget in the application shell. The active widget is the one that has focus
949
+ * (either the widget itself or any of its contents).
950
+ *
951
+ * _Note:_ Focus is taken by a widget through the `onActivateRequest` method. It is up to the
952
+ * widget implementation which DOM element will get the focus. The default implementation
953
+ * does not take any focus; in that case the widget is never returned by this property.
954
+ */
955
+ get activeWidget() {
956
+ return this.tracker.activeWidget || undefined;
957
+ }
958
+ /**
959
+ * Returns the last active widget in the given shell area.
960
+ */
961
+ getCurrentWidget(area) {
962
+ let title;
963
+ switch (area) {
964
+ case 'main':
965
+ title = this.mainPanel.currentTitle;
966
+ break;
967
+ case 'bottom':
968
+ title = this.bottomPanel.currentTitle;
969
+ break;
970
+ case 'left':
971
+ title = this.leftPanelHandler.tabBar.currentTitle;
972
+ break;
973
+ case 'right':
974
+ title = this.rightPanelHandler.tabBar.currentTitle;
975
+ break;
976
+ case 'secondaryWindow':
977
+ // The current widget in a secondary window is not tracked.
978
+ return undefined;
979
+ default:
980
+ throw new Error('Illegal argument: ' + area);
981
+ }
982
+ return title ? title.owner : undefined;
983
+ }
984
+ /**
985
+ * Handle a change to the current widget.
986
+ */
987
+ onCurrentChanged(sender, args) {
988
+ this.onDidChangeCurrentWidgetEmitter.fire(args);
989
+ }
990
+ /**
991
+ * Handle a change to the active widget.
992
+ */
993
+ onActiveChanged(sender, args) {
994
+ this.toDisposeOnActiveChanged.dispose();
995
+ const { newValue, oldValue } = args;
996
+ if (oldValue) {
997
+ let w = oldValue;
998
+ while (w) {
999
+ // Remove the mark of the previously active widget
1000
+ w.title.className = w.title.className.replace(' theia-mod-active', '');
1001
+ w = w.parent;
1002
+ }
1003
+ // Reset the z-index to the default
1004
+ // eslint-disable-next-line no-null/no-null
1005
+ this.setZIndex(oldValue.node, null);
1006
+ }
1007
+ if (newValue) {
1008
+ let w = newValue;
1009
+ while (w) {
1010
+ // Mark the tab of the active widget
1011
+ w.title.className += ' theia-mod-active';
1012
+ w = w.parent;
1013
+ }
1014
+ // Reveal the title of the active widget in its tab bar
1015
+ const tabBar = this.getTabBarFor(newValue);
1016
+ if (tabBar instanceof tab_bars_1.ScrollableTabBar) {
1017
+ const index = tabBar.titles.indexOf(newValue.title);
1018
+ if (index >= 0) {
1019
+ tabBar.revealTab(index);
1020
+ }
1021
+ }
1022
+ const widget = this.toTrackedStack(newValue.id).pop();
1023
+ const panel = this.findPanel(widget);
1024
+ if (panel) {
1025
+ // if widget was undefined, we wouldn't have gotten a panel back before
1026
+ panel.markAsCurrent(widget.title);
1027
+ }
1028
+ // Add checks to ensure that the 'sash' for left panel is displayed correctly
1029
+ if (newValue.node.className === 'p-Widget theia-view-container p-DockPanel-widget') {
1030
+ // Set the z-index so elements with `position: fixed` contained in the active widget are displayed correctly
1031
+ this.setZIndex(newValue.node, '1');
1032
+ }
1033
+ // activate another widget if an active widget will be closed
1034
+ const onCloseRequest = newValue['onCloseRequest'];
1035
+ newValue['onCloseRequest'] = msg => {
1036
+ const currentTabBar = this.currentTabBar;
1037
+ if (currentTabBar) {
1038
+ const recentlyUsedInTabBar = currentTabBar['_previousTitle'];
1039
+ if (recentlyUsedInTabBar && recentlyUsedInTabBar.owner !== newValue) {
1040
+ currentTabBar.currentIndex = algorithm_1.ArrayExt.firstIndexOf(currentTabBar.titles, recentlyUsedInTabBar);
1041
+ if (currentTabBar.currentTitle) {
1042
+ this.activateWidget(currentTabBar.currentTitle.owner.id);
1043
+ }
1044
+ }
1045
+ else if (!this.activateNextTabInTabBar(currentTabBar)) {
1046
+ if (!this.activatePreviousTabBar(currentTabBar)) {
1047
+ this.activateNextTabBar(currentTabBar);
1048
+ }
1049
+ }
1050
+ }
1051
+ newValue['onCloseRequest'] = onCloseRequest;
1052
+ newValue['onCloseRequest'](msg);
1053
+ };
1054
+ this.toDisposeOnActiveChanged.push(common_1.Disposable.create(() => newValue['onCloseRequest'] = onCloseRequest));
1055
+ if (previewable_widget_1.PreviewableWidget.is(newValue)) {
1056
+ newValue.loaded = true;
1057
+ }
1058
+ }
1059
+ this.onDidChangeActiveWidgetEmitter.fire(args);
1060
+ }
1061
+ /**
1062
+ * Set the z-index of the given element and its ancestors to the value `z`.
1063
+ */
1064
+ setZIndex(element, z) {
1065
+ element.style.zIndex = z || '';
1066
+ const parent = element.parentElement;
1067
+ if (parent && parent !== this.node) {
1068
+ this.setZIndex(parent, z);
1069
+ }
1070
+ }
1071
+ /**
1072
+ * Track the given widget so it is considered in the `current` and `active` state of the shell.
1073
+ */
1074
+ track(widget) {
1075
+ if (this.tracker.widgets.indexOf(widget) !== -1) {
1076
+ return;
1077
+ }
1078
+ this.tracker.add(widget);
1079
+ this.checkActivation(widget);
1080
+ saveable_1.Saveable.apply(widget, () => this.widgets.filter((maybeSaveable) => !!saveable_1.Saveable.get(maybeSaveable)), async (toSave, options) => {
1081
+ await this.saveResourceService.save(toSave, options);
1082
+ });
1083
+ if (ApplicationShell_1.TrackableWidgetProvider.is(widget)) {
1084
+ for (const toTrack of widget.getTrackableWidgets()) {
1085
+ this.track(toTrack);
1086
+ }
1087
+ if (widget.onDidChangeTrackableWidgets) {
1088
+ widget.onDidChangeTrackableWidgets(widgets => widgets.forEach(w => this.track(w)));
1089
+ }
1090
+ }
1091
+ }
1092
+ /**
1093
+ * @returns an array of Widgets, all of which are tracked by the focus tracker
1094
+ * The first member of the array is the widget whose id is passed in, and the other widgets
1095
+ * are its tracked parents in ascending order
1096
+ */
1097
+ toTrackedStack(id) {
1098
+ const tracked = new Map(this.tracker.widgets.map(w => [w.id, w]));
1099
+ let current = tracked.get(id);
1100
+ const stack = [];
1101
+ while (current) {
1102
+ if (tracked.has(current.id)) {
1103
+ stack.push(current);
1104
+ }
1105
+ current = current.parent || undefined;
1106
+ }
1107
+ return stack;
1108
+ }
1109
+ /**
1110
+ * Activate a widget in the application shell. This makes the widget visible and usually
1111
+ * also assigns focus to it.
1112
+ *
1113
+ * _Note:_ Focus is taken by a widget through the `onActivateRequest` method. It is up to the
1114
+ * widget implementation which DOM element will get the focus. The default implementation
1115
+ * does not take any focus.
1116
+ *
1117
+ * @returns the activated widget if it was found
1118
+ */
1119
+ async activateWidget(id) {
1120
+ const stack = this.toTrackedStack(id);
1121
+ let current = stack.pop();
1122
+ if (current && !this.doActivateWidget(current.id)) {
1123
+ return undefined;
1124
+ }
1125
+ while (current && stack.length) {
1126
+ const child = stack.pop();
1127
+ if (ApplicationShell_1.TrackableWidgetProvider.is(current) && current.activateWidget) {
1128
+ current = current.activateWidget(child.id);
1129
+ }
1130
+ else {
1131
+ child.activate();
1132
+ current = child;
1133
+ }
1134
+ }
1135
+ if (!current) {
1136
+ return undefined;
1137
+ }
1138
+ return Promise.all([
1139
+ this.waitForActivation(current.id),
1140
+ (0, widgets_2.waitForRevealed)(current),
1141
+ this.pendingUpdates
1142
+ ]).then(() => current, () => undefined);
1143
+ }
1144
+ waitForActivation(id) {
1145
+ if (this.activeWidget && this.activeWidget.id === id) {
1146
+ return Promise.resolve();
1147
+ }
1148
+ const activation = new promise_util_1.Deferred();
1149
+ const success = this.onDidChangeActiveWidget(() => {
1150
+ if (this.activeWidget && this.activeWidget.id === id) {
1151
+ activation.resolve();
1152
+ }
1153
+ });
1154
+ const failure = setTimeout(() => activation.reject(new Error(`Widget with id '${id}' failed to activate.`)), this.activationTimeout + 250);
1155
+ return activation.promise.finally(() => {
1156
+ success.dispose();
1157
+ clearTimeout(failure);
1158
+ });
1159
+ }
1160
+ /**
1161
+ * Activate top-level area widget.
1162
+ */
1163
+ doActivateWidget(id) {
1164
+ let widget = (0, algorithm_1.find)(this.mainPanel.widgets(), w => w.id === id);
1165
+ if (widget) {
1166
+ this.mainPanel.activateWidget(widget);
1167
+ return widget;
1168
+ }
1169
+ widget = (0, algorithm_1.find)(this.bottomPanel.widgets(), w => w.id === id);
1170
+ if (widget) {
1171
+ this.expandBottomPanel();
1172
+ this.bottomPanel.activateWidget(widget);
1173
+ return widget;
1174
+ }
1175
+ widget = this.leftPanelHandler.activate(id);
1176
+ if (widget) {
1177
+ return widget;
1178
+ }
1179
+ widget = this.rightPanelHandler.activate(id);
1180
+ if (widget) {
1181
+ return widget;
1182
+ }
1183
+ return this.secondaryWindowHandler.activateWidget(id);
1184
+ }
1185
+ /**
1186
+ * Focus is taken by a widget through the `onActivateRequest` method. It is up to the
1187
+ * widget implementation which DOM element will get the focus. The default implementation
1188
+ * of Widget does not take any focus. This method can help finding such problems by logging
1189
+ * a warning in case a widget was explicitly activated, but did not trigger a change of the
1190
+ * `activeWidget` property.
1191
+ */
1192
+ checkActivation(widget) {
1193
+ const onActivateRequest = widget['onActivateRequest'].bind(widget);
1194
+ widget['onActivateRequest'] = (msg) => {
1195
+ onActivateRequest(msg);
1196
+ this.assertActivated(widget);
1197
+ };
1198
+ return widget;
1199
+ }
1200
+ assertActivated(widget) {
1201
+ this.toDisposeOnActivationCheck.dispose();
1202
+ const onDispose = () => this.toDisposeOnActivationCheck.dispose();
1203
+ widget.disposed.connect(onDispose);
1204
+ this.toDisposeOnActivationCheck.push(common_1.Disposable.create(() => widget.disposed.disconnect(onDispose)));
1205
+ let start = 0;
1206
+ const step = timestamp => {
1207
+ const activeElement = widget.node.ownerDocument.activeElement;
1208
+ if (activeElement && widget.node.contains(activeElement)) {
1209
+ return;
1210
+ }
1211
+ if (!start) {
1212
+ start = timestamp;
1213
+ }
1214
+ const delta = timestamp - start;
1215
+ if (delta < this.activationTimeout) {
1216
+ request = window.requestAnimationFrame(step);
1217
+ }
1218
+ else {
1219
+ console.warn(`Widget was activated, but did not accept focus after ${this.activationTimeout}ms: ${widget.id}`);
1220
+ }
1221
+ };
1222
+ let request = window.requestAnimationFrame(step);
1223
+ this.toDisposeOnActivationCheck.push(common_1.Disposable.create(() => window.cancelAnimationFrame(request)));
1224
+ }
1225
+ /**
1226
+ * Reveal a widget in the application shell. This makes the widget visible,
1227
+ * but does not activate it.
1228
+ *
1229
+ * @returns the revealed widget if it was found
1230
+ */
1231
+ async revealWidget(id) {
1232
+ const stack = this.toTrackedStack(id);
1233
+ let current = stack.pop();
1234
+ if (current && !this.doRevealWidget(current.id)) {
1235
+ return undefined;
1236
+ }
1237
+ while (current && stack.length) {
1238
+ const child = stack.pop();
1239
+ if (ApplicationShell_1.TrackableWidgetProvider.is(current) && current.revealWidget) {
1240
+ current = current.revealWidget(child.id);
1241
+ }
1242
+ else {
1243
+ current = child;
1244
+ }
1245
+ }
1246
+ if (!current) {
1247
+ return undefined;
1248
+ }
1249
+ await Promise.all([
1250
+ (0, widgets_2.waitForRevealed)(current),
1251
+ this.pendingUpdates
1252
+ ]);
1253
+ return current;
1254
+ }
1255
+ /**
1256
+ * Reveal top-level area widget.
1257
+ */
1258
+ doRevealWidget(id) {
1259
+ let widget = (0, algorithm_1.find)(this.mainPanel.widgets(), w => w.id === id);
1260
+ if (!widget) {
1261
+ widget = (0, algorithm_1.find)(this.bottomPanel.widgets(), w => w.id === id);
1262
+ if (widget) {
1263
+ this.expandBottomPanel();
1264
+ }
1265
+ }
1266
+ if (widget) {
1267
+ const tabBar = this.getTabBarFor(widget);
1268
+ if (tabBar) {
1269
+ tabBar.currentTitle = widget.title;
1270
+ }
1271
+ return widget;
1272
+ }
1273
+ widget = this.leftPanelHandler.expand(id);
1274
+ if (widget) {
1275
+ return widget;
1276
+ }
1277
+ widget = this.rightPanelHandler.expand(id);
1278
+ if (widget) {
1279
+ return widget;
1280
+ }
1281
+ return this.secondaryWindowHandler.revealWidget(id);
1282
+ }
1283
+ /**
1284
+ * Expand the named side panel area. This makes sure that the panel is visible, even if there
1285
+ * are no widgets in it. If the panel is already visible, nothing happens. If the panel is currently
1286
+ * collapsed (see `collapsePanel`) and it contains widgets, the widgets are revealed that were
1287
+ * visible before it was collapsed.
1288
+ */
1289
+ expandPanel(area) {
1290
+ switch (area) {
1291
+ case 'bottom':
1292
+ this.expandBottomPanel();
1293
+ break;
1294
+ case 'left':
1295
+ this.leftPanelHandler.expand();
1296
+ break;
1297
+ case 'right':
1298
+ this.rightPanelHandler.expand();
1299
+ break;
1300
+ default:
1301
+ throw new Error('Area cannot be expanded: ' + area);
1302
+ }
1303
+ }
1304
+ /**
1305
+ * Adjusts the size of the given area in the application shell.
1306
+ *
1307
+ * @param size the desired size of the panel in pixels.
1308
+ * @param area the area to resize.
1309
+ */
1310
+ resize(size, area) {
1311
+ switch (area) {
1312
+ case 'bottom':
1313
+ if (this.bottomPanel.isHidden) {
1314
+ this.bottomPanelState.lastPanelSize = size;
1315
+ }
1316
+ else {
1317
+ this.setBottomPanelSize(size);
1318
+ }
1319
+ break;
1320
+ case 'left':
1321
+ this.leftPanelHandler.resize(size);
1322
+ break;
1323
+ case 'right':
1324
+ this.rightPanelHandler.resize(size);
1325
+ break;
1326
+ default:
1327
+ throw new Error('Area cannot be resized: ' + area);
1328
+ }
1329
+ }
1330
+ /**
1331
+ * Expand the bottom panel. See `expandPanel` regarding the exact behavior.
1332
+ */
1333
+ expandBottomPanel() {
1334
+ const bottomPanel = this.bottomPanel;
1335
+ if (bottomPanel.isHidden) {
1336
+ let relativeSizes;
1337
+ const parent = bottomPanel.parent;
1338
+ if (parent instanceof widgets_1.SplitPanel) {
1339
+ relativeSizes = parent.relativeSizes();
1340
+ }
1341
+ bottomPanel.show();
1342
+ if (relativeSizes && parent instanceof widgets_1.SplitPanel) {
1343
+ // Make sure that the expansion animation starts at the smallest possible size
1344
+ parent.setRelativeSizes(relativeSizes);
1345
+ }
1346
+ let size;
1347
+ if (bottomPanel.isEmpty) {
1348
+ bottomPanel.node.style.minHeight = '0';
1349
+ size = this.options.bottomPanel.emptySize;
1350
+ }
1351
+ else if (this.bottomPanelState.lastPanelSize) {
1352
+ size = this.bottomPanelState.lastPanelSize;
1353
+ }
1354
+ else {
1355
+ size = this.getDefaultBottomPanelSize();
1356
+ }
1357
+ if (size) {
1358
+ this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.expanding;
1359
+ this.setBottomPanelSize(size).then(() => {
1360
+ if (this.bottomPanelState.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanding) {
1361
+ this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.expanded;
1362
+ }
1363
+ });
1364
+ }
1365
+ else {
1366
+ this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.expanded;
1367
+ }
1368
+ }
1369
+ }
1370
+ /**
1371
+ * Collapse the named side panel area. This makes sure that the panel is hidden,
1372
+ * increasing the space that is available for other shell areas.
1373
+ */
1374
+ collapsePanel(area) {
1375
+ switch (area) {
1376
+ case 'bottom':
1377
+ return this.collapseBottomPanel();
1378
+ case 'left':
1379
+ return this.leftPanelHandler.collapse();
1380
+ case 'right':
1381
+ return this.rightPanelHandler.collapse();
1382
+ default:
1383
+ throw new Error('Area cannot be collapsed: ' + area);
1384
+ }
1385
+ }
1386
+ /**
1387
+ * Collapse the bottom panel. All contained widgets are hidden, but not closed.
1388
+ * They can be restored by calling `expandBottomPanel`.
1389
+ */
1390
+ collapseBottomPanel() {
1391
+ const bottomPanel = this.bottomPanel;
1392
+ if (bottomPanel.isHidden) {
1393
+ return Promise.resolve();
1394
+ }
1395
+ if (this.bottomPanelState.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded) {
1396
+ const size = this.getBottomPanelSize();
1397
+ if (size) {
1398
+ this.bottomPanelState.lastPanelSize = size;
1399
+ }
1400
+ }
1401
+ this.bottomPanelState.expansion = side_panel_handler_1.SidePanel.ExpansionState.collapsed;
1402
+ bottomPanel.hide();
1403
+ return (0, browser_1.animationFrame)();
1404
+ }
1405
+ /**
1406
+ * Refresh the toggle button for the bottom panel. This implementation creates a status bar entry
1407
+ * and refers to the command `core.toggle.bottom.panel`.
1408
+ */
1409
+ refreshBottomPanelToggleButton() {
1410
+ if (this.bottomPanel.isEmpty) {
1411
+ this.statusBar.removeElement(BOTTOM_PANEL_TOGGLE_ID);
1412
+ }
1413
+ else {
1414
+ const label = nls_1.nls.localize('theia/core/common/collapseBottomPanel', 'Toggle Bottom Panel');
1415
+ const element = {
1416
+ name: label,
1417
+ text: '$(codicon-window)',
1418
+ alignment: status_bar_1.StatusBarAlignment.RIGHT,
1419
+ tooltip: label,
1420
+ command: 'core.toggle.bottom.panel',
1421
+ accessibilityInformation: {
1422
+ label: label,
1423
+ role: 'button'
1424
+ },
1425
+ priority: -1000
1426
+ };
1427
+ this.statusBar.setElement(BOTTOM_PANEL_TOGGLE_ID, element);
1428
+ }
1429
+ }
1430
+ /**
1431
+ * Check whether the named side panel area is expanded (returns `true`) or collapsed (returns `false`).
1432
+ */
1433
+ isExpanded(area) {
1434
+ switch (area) {
1435
+ case 'bottom':
1436
+ return this.bottomPanelState.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded;
1437
+ case 'left':
1438
+ return this.leftPanelHandler.state.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded;
1439
+ case 'right':
1440
+ return this.rightPanelHandler.state.expansion === side_panel_handler_1.SidePanel.ExpansionState.expanded;
1441
+ default:
1442
+ return true;
1443
+ }
1444
+ }
1445
+ /**
1446
+ * Close all tabs or a selection of tabs in a specific part of the application shell.
1447
+ *
1448
+ * @param tabBarOrArea
1449
+ * Either the name of a shell area or a `TabBar` that is contained in such an area.
1450
+ * @param filter
1451
+ * If undefined, all tabs are closed; otherwise only those tabs that match the filter are closed.
1452
+ */
1453
+ async closeTabs(tabBarOrArea, filter) {
1454
+ const titles = this.getWidgetTitles(tabBarOrArea, filter);
1455
+ if (titles.length) {
1456
+ await this.closeMany(titles.map(title => title.owner));
1457
+ }
1458
+ }
1459
+ saveTabs(tabBarOrArea, filter) {
1460
+ const titles = this.getWidgetTitles(tabBarOrArea, filter);
1461
+ for (let i = 0; i < titles.length; i++) {
1462
+ const widget = titles[i].owner;
1463
+ const saveable = saveable_1.Saveable.get(widget);
1464
+ saveable === null || saveable === void 0 ? void 0 : saveable.save();
1465
+ }
1466
+ }
1467
+ /**
1468
+ * Collects all widget titles for the given tab bar or area and optionally filters them.
1469
+ *
1470
+ * @param tabBarOrArea The tab bar or area to retrieve the widget titles for
1471
+ * @param filter The filter to apply to the result
1472
+ * @returns The filtered array of widget titles or an empty array
1473
+ */
1474
+ getWidgetTitles(tabBarOrArea, filter) {
1475
+ const titles = [];
1476
+ if (tabBarOrArea === 'main') {
1477
+ this.mainAreaTabBars.forEach(tabbar => titles.push(...(0, algorithm_1.toArray)(tabbar.titles)));
1478
+ }
1479
+ else if (tabBarOrArea === 'bottom') {
1480
+ this.bottomAreaTabBars.forEach(tabbar => titles.push(...(0, algorithm_1.toArray)(tabbar.titles)));
1481
+ }
1482
+ else if (tabBarOrArea === 'secondaryWindow') {
1483
+ titles.push(...this.secondaryWindowHandler.widgets.map(w => w.title));
1484
+ }
1485
+ else if (typeof tabBarOrArea === 'string') {
1486
+ const tabbar = this.getTabBarFor(tabBarOrArea);
1487
+ if (tabbar) {
1488
+ titles.push(...(0, algorithm_1.toArray)(tabbar.titles));
1489
+ }
1490
+ }
1491
+ else if (tabBarOrArea) {
1492
+ titles.push(...(0, algorithm_1.toArray)(tabBarOrArea.titles));
1493
+ }
1494
+ return filter ? titles.filter(filter) : titles;
1495
+ }
1496
+ /**
1497
+ * @param targets the widgets to be closed
1498
+ * @return an array of all the widgets that were actually closed.
1499
+ */
1500
+ async closeMany(targets, options) {
1501
+ if ((options === null || options === void 0 ? void 0 : options.save) === false || await saveable_1.Saveable.confirmSaveBeforeClose(targets, this.widgets.filter(widget => !targets.includes(widget)))) {
1502
+ return (await Promise.all(targets.map(target => this.closeWidget(target.id, options)))).filter((widget) => widget !== undefined);
1503
+ }
1504
+ return [];
1505
+ }
1506
+ /**
1507
+ * @returns the widget that was closed, if any, `undefined` otherwise.
1508
+ *
1509
+ * If your use case requires closing multiple widgets, use {@link ApplicationShell#closeMany} instead. That method handles closing saveable widgets more reliably.
1510
+ */
1511
+ async closeWidget(id, options) {
1512
+ // TODO handle save for composite widgets, i.e. the preference widget has 2 editors
1513
+ const stack = this.toTrackedStack(id);
1514
+ const current = stack.pop();
1515
+ if (!current) {
1516
+ return undefined;
1517
+ }
1518
+ const saveableOptions = options && { shouldSave: () => options.save };
1519
+ const pendingClose = saveable_1.SaveableWidget.is(current)
1520
+ ? current.closeWithSaving(saveableOptions)
1521
+ : (current.close(), (0, widgets_2.waitForClosed)(current));
1522
+ await Promise.all([
1523
+ pendingClose,
1524
+ this.pendingUpdates
1525
+ ]);
1526
+ return stack[0] || current;
1527
+ }
1528
+ /**
1529
+ * The shell area name of the currently active tab, or undefined.
1530
+ */
1531
+ get currentTabArea() {
1532
+ const currentWidget = this.currentWidget;
1533
+ if (currentWidget) {
1534
+ return this.getAreaFor(currentWidget);
1535
+ }
1536
+ }
1537
+ /**
1538
+ * Determine the name of the shell area where the given widget resides. The result is
1539
+ * undefined if the widget does not reside directly in the shell.
1540
+ */
1541
+ getAreaFor(input) {
1542
+ if (input instanceof widgets_1.TabBar) {
1543
+ if ((0, algorithm_1.find)(this.mainPanel.tabBars(), tb => tb === input)) {
1544
+ return 'main';
1545
+ }
1546
+ if ((0, algorithm_1.find)(this.bottomPanel.tabBars(), tb => tb === input)) {
1547
+ return 'bottom';
1548
+ }
1549
+ if (this.leftPanelHandler.tabBar === input) {
1550
+ return 'left';
1551
+ }
1552
+ if (this.rightPanelHandler.tabBar === input) {
1553
+ return 'right';
1554
+ }
1555
+ }
1556
+ const widget = this.toTrackedStack(input.id).pop();
1557
+ if (!widget) {
1558
+ return undefined;
1559
+ }
1560
+ const title = widget.title;
1561
+ const mainPanelTabBar = this.mainPanel.findTabBar(title);
1562
+ if (mainPanelTabBar) {
1563
+ return 'main';
1564
+ }
1565
+ const bottomPanelTabBar = this.bottomPanel.findTabBar(title);
1566
+ if (bottomPanelTabBar) {
1567
+ return 'bottom';
1568
+ }
1569
+ if (algorithm_1.ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) {
1570
+ return 'left';
1571
+ }
1572
+ if (algorithm_1.ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) {
1573
+ return 'right';
1574
+ }
1575
+ if (this.secondaryWindowHandler.widgets.includes(widget)) {
1576
+ return 'secondaryWindow';
1577
+ }
1578
+ return undefined;
1579
+ }
1580
+ getAreaPanelFor(input) {
1581
+ const widget = this.toTrackedStack(input.id).pop();
1582
+ if (!widget) {
1583
+ return undefined;
1584
+ }
1585
+ return this.findPanel(widget);
1586
+ }
1587
+ /**
1588
+ * Find the shell panel this top-level widget is part of
1589
+ */
1590
+ findPanel(widget) {
1591
+ if (!widget) {
1592
+ return undefined;
1593
+ }
1594
+ const title = widget.title;
1595
+ const mainPanelTabBar = this.mainPanel.findTabBar(title);
1596
+ if (mainPanelTabBar) {
1597
+ return this.mainPanel;
1598
+ }
1599
+ const bottomPanelTabBar = this.bottomPanel.findTabBar(title);
1600
+ if (bottomPanelTabBar) {
1601
+ return this.bottomPanel;
1602
+ }
1603
+ if (algorithm_1.ArrayExt.firstIndexOf(this.leftPanelHandler.tabBar.titles, title) > -1) {
1604
+ return this.leftPanelHandler.dockPanel;
1605
+ }
1606
+ if (algorithm_1.ArrayExt.firstIndexOf(this.rightPanelHandler.tabBar.titles, title) > -1) {
1607
+ return this.rightPanelHandler.dockPanel;
1608
+ }
1609
+ return undefined;
1610
+ }
1611
+ /**
1612
+ * Return the tab bar that has the currently active widget, or undefined.
1613
+ */
1614
+ get currentTabBar() {
1615
+ const currentWidget = this.currentWidget;
1616
+ if (currentWidget) {
1617
+ return this.getTabBarFor(currentWidget);
1618
+ }
1619
+ }
1620
+ /**
1621
+ * Return the tab bar in the given shell area, or the tab bar that has the given widget, or undefined.
1622
+ */
1623
+ getTabBarFor(widgetOrArea) {
1624
+ if (typeof widgetOrArea === 'string') {
1625
+ switch (widgetOrArea) {
1626
+ case 'main':
1627
+ return this.mainPanel.currentTabBar;
1628
+ case 'bottom':
1629
+ return this.bottomPanel.currentTabBar;
1630
+ case 'left':
1631
+ return this.leftPanelHandler.tabBar;
1632
+ case 'right':
1633
+ return this.rightPanelHandler.tabBar;
1634
+ case 'secondaryWindow':
1635
+ // Secondary windows don't have a tab bar
1636
+ return undefined;
1637
+ default:
1638
+ throw new Error('Illegal argument: ' + widgetOrArea);
1639
+ }
1640
+ }
1641
+ const widget = this.toTrackedStack(widgetOrArea.id).pop();
1642
+ if (!widget) {
1643
+ return undefined;
1644
+ }
1645
+ const widgetTitle = widget.title;
1646
+ const mainPanelTabBar = this.mainPanel.findTabBar(widgetTitle);
1647
+ if (mainPanelTabBar) {
1648
+ return mainPanelTabBar;
1649
+ }
1650
+ const bottomPanelTabBar = this.bottomPanel.findTabBar(widgetTitle);
1651
+ if (bottomPanelTabBar) {
1652
+ return bottomPanelTabBar;
1653
+ }
1654
+ const leftPanelTabBar = this.leftPanelHandler.tabBar;
1655
+ if (algorithm_1.ArrayExt.firstIndexOf(leftPanelTabBar.titles, widgetTitle) > -1) {
1656
+ return leftPanelTabBar;
1657
+ }
1658
+ const rightPanelTabBar = this.rightPanelHandler.tabBar;
1659
+ if (algorithm_1.ArrayExt.firstIndexOf(rightPanelTabBar.titles, widgetTitle) > -1) {
1660
+ return rightPanelTabBar;
1661
+ }
1662
+ return undefined;
1663
+ }
1664
+ /**
1665
+ * The tab bars contained in the main shell area. If there is no widget in the main area, the
1666
+ * returned array is empty.
1667
+ */
1668
+ get mainAreaTabBars() {
1669
+ return (0, algorithm_1.toArray)(this.mainPanel.tabBars());
1670
+ }
1671
+ /**
1672
+ * The tab bars contained in the bottom shell area. If there is no widget in the bottom area,
1673
+ * the returned array is empty.
1674
+ */
1675
+ get bottomAreaTabBars() {
1676
+ return (0, algorithm_1.toArray)(this.bottomPanel.tabBars());
1677
+ }
1678
+ /**
1679
+ * The tab bars contained in all shell areas.
1680
+ */
1681
+ get allTabBars() {
1682
+ return [...this.mainAreaTabBars, ...this.bottomAreaTabBars, this.leftPanelHandler.tabBar, this.rightPanelHandler.tabBar];
1683
+ }
1684
+ /*
1685
+ * Activate the next tab in the current tab bar.
1686
+ */
1687
+ activateNextTabInTabBar(current = this.currentTabBar) {
1688
+ const index = this.nextTabIndexInTabBar(current);
1689
+ if (!current || index === -1) {
1690
+ return false;
1691
+ }
1692
+ current.currentIndex = index;
1693
+ if (current.currentTitle) {
1694
+ this.activateWidget(current.currentTitle.owner.id);
1695
+ }
1696
+ return true;
1697
+ }
1698
+ nextTabIndexInTabBar(current = this.currentTabBar) {
1699
+ if (!current || current.titles.length <= 1) {
1700
+ return -1;
1701
+ }
1702
+ const index = current.currentIndex;
1703
+ if (index === -1) {
1704
+ return -1;
1705
+ }
1706
+ if (index < current.titles.length - 1) {
1707
+ return index + 1;
1708
+ }
1709
+ return 0;
1710
+ }
1711
+ activateNextTab() {
1712
+ const current = this.currentTabBar;
1713
+ if (current) {
1714
+ const ci = current.currentIndex;
1715
+ if (ci !== -1) {
1716
+ if (ci < current.titles.length - 1) {
1717
+ current.currentIndex += 1;
1718
+ if (current.currentTitle) {
1719
+ this.activateWidget(current.currentTitle.owner.id);
1720
+ }
1721
+ return true;
1722
+ }
1723
+ else if (ci === current.titles.length - 1) {
1724
+ return this.activateNextTabBar(current);
1725
+ }
1726
+ }
1727
+ }
1728
+ return false;
1729
+ }
1730
+ activateNextTabBar(current = this.currentTabBar) {
1731
+ const nextBar = this.nextTabBar(current);
1732
+ if (nextBar) {
1733
+ nextBar.currentIndex = 0;
1734
+ if (nextBar.currentTitle) {
1735
+ this.activateWidget(nextBar.currentTitle.owner.id);
1736
+ }
1737
+ return true;
1738
+ }
1739
+ return false;
1740
+ }
1741
+ /**
1742
+ * Return the tab bar next to the given tab bar; return the given tab bar if there is no adjacent one.
1743
+ */
1744
+ nextTabBar(current = this.currentTabBar) {
1745
+ let bars = (0, algorithm_1.toArray)(this.bottomPanel.tabBars());
1746
+ let len = bars.length;
1747
+ let ci = algorithm_1.ArrayExt.firstIndexOf(bars, current);
1748
+ if (ci < 0) {
1749
+ bars = (0, algorithm_1.toArray)(this.mainPanel.tabBars());
1750
+ len = bars.length;
1751
+ ci = algorithm_1.ArrayExt.firstIndexOf(bars, current);
1752
+ }
1753
+ if (ci >= 0 && ci < len - 1) {
1754
+ return bars[ci + 1];
1755
+ }
1756
+ else if (ci >= 0 && ci === len - 1) {
1757
+ return bars[0];
1758
+ }
1759
+ else {
1760
+ return current;
1761
+ }
1762
+ }
1763
+ /*
1764
+ * Activate the previous tab in the current tab bar.
1765
+ */
1766
+ activatePreviousTabInTabBar(current = this.currentTabBar) {
1767
+ const index = this.previousTabIndexInTabBar(current);
1768
+ if (!current || index === -1) {
1769
+ return false;
1770
+ }
1771
+ current.currentIndex = index;
1772
+ if (current.currentTitle) {
1773
+ this.activateWidget(current.currentTitle.owner.id);
1774
+ }
1775
+ return true;
1776
+ }
1777
+ previousTabIndexInTabBar(current = this.currentTabBar) {
1778
+ if (!current || current.titles.length <= 1) {
1779
+ return -1;
1780
+ }
1781
+ const index = current.currentIndex;
1782
+ if (index === -1) {
1783
+ return -1;
1784
+ }
1785
+ if (index > 0) {
1786
+ return index - 1;
1787
+ }
1788
+ return current.titles.length - 1;
1789
+ }
1790
+ activatePreviousTab() {
1791
+ const current = this.currentTabBar;
1792
+ if (current) {
1793
+ const ci = current.currentIndex;
1794
+ if (ci !== -1) {
1795
+ if (ci > 0) {
1796
+ current.currentIndex -= 1;
1797
+ if (current.currentTitle) {
1798
+ this.activateWidget(current.currentTitle.owner.id);
1799
+ }
1800
+ return true;
1801
+ }
1802
+ else if (ci === 0) {
1803
+ if (current && current.titles.length > 0) {
1804
+ current.currentIndex = current.titles.length - 1;
1805
+ if (current.currentTitle) {
1806
+ this.activateWidget(current.currentTitle.owner.id);
1807
+ }
1808
+ return true;
1809
+ }
1810
+ return this.activatePreviousTabBar(current);
1811
+ }
1812
+ }
1813
+ }
1814
+ return false;
1815
+ }
1816
+ activatePreviousTabBar(current = this.currentTabBar) {
1817
+ const prevBar = this.previousTabBar(current);
1818
+ if (!prevBar) {
1819
+ return false;
1820
+ }
1821
+ if (!prevBar.currentTitle) {
1822
+ prevBar.currentIndex = prevBar.titles.length - 1;
1823
+ }
1824
+ if (prevBar.currentTitle) {
1825
+ this.activateWidget(prevBar.currentTitle.owner.id);
1826
+ }
1827
+ return true;
1828
+ }
1829
+ /**
1830
+ * Return the tab bar previous to the given tab bar; return the given tab bar if there is no adjacent one.
1831
+ */
1832
+ previousTabBar(current = this.currentTabBar) {
1833
+ const bars = (0, algorithm_1.toArray)(this.mainPanel.tabBars());
1834
+ const len = bars.length;
1835
+ const ci = algorithm_1.ArrayExt.firstIndexOf(bars, current);
1836
+ if (ci > 0) {
1837
+ return bars[ci - 1];
1838
+ }
1839
+ else if (ci === 0) {
1840
+ return bars[len - 1];
1841
+ }
1842
+ else {
1843
+ return current;
1844
+ }
1845
+ }
1846
+ /**
1847
+ * Test whether the current widget is dirty.
1848
+ */
1849
+ canSave() {
1850
+ return this.saveResourceService.canSave(this.currentWidget);
1851
+ }
1852
+ /**
1853
+ * Save the current widget if it is dirty.
1854
+ */
1855
+ async save(options) {
1856
+ await this.saveResourceService.save(this.currentWidget, options);
1857
+ }
1858
+ /**
1859
+ * Test whether there is a dirty widget.
1860
+ */
1861
+ canSaveAll() {
1862
+ return this.tracker.widgets.some(widget => this.saveResourceService.canSave(widget));
1863
+ }
1864
+ /**
1865
+ * Save all dirty widgets.
1866
+ */
1867
+ async saveAll(options) {
1868
+ for (const widget of this.widgets) {
1869
+ if (this.saveResourceService.canSaveNotSaveAs(widget)) {
1870
+ await this.saveResourceService.save(widget, options);
1871
+ }
1872
+ }
1873
+ }
1874
+ /**
1875
+ * Returns a snapshot of all tracked widgets to allow async modifications.
1876
+ */
1877
+ get widgets() {
1878
+ return [...this.tracker.widgets];
1879
+ }
1880
+ getWidgetById(id) {
1881
+ for (const widget of this.tracker.widgets) {
1882
+ if (widget.id === id) {
1883
+ return widget;
1884
+ }
1885
+ }
1886
+ return undefined;
1887
+ }
1888
+ canToggleMaximized(widget = this.currentWidget) {
1889
+ const area = widget && this.getAreaFor(widget);
1890
+ return area === 'main' || area === 'bottom';
1891
+ }
1892
+ toggleMaximized(widget = this.currentWidget) {
1893
+ const area = widget && this.getAreaPanelFor(widget);
1894
+ if (area instanceof theia_dock_panel_1.TheiaDockPanel && (area === this.mainPanel || area === this.bottomPanel)) {
1895
+ area.toggleMaximized();
1896
+ this.revealWidget(widget.id);
1897
+ }
1898
+ }
1899
+ };
1900
+ __decorate([
1901
+ (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
1902
+ __metadata("design:type", Object)
1903
+ ], ApplicationShell.prototype, "contextKeyService", void 0);
1904
+ __decorate([
1905
+ (0, inversify_1.inject)(opener_service_1.OpenerService),
1906
+ __metadata("design:type", Object)
1907
+ ], ApplicationShell.prototype, "openerService", void 0);
1908
+ __decorate([
1909
+ (0, inversify_1.inject)(theia_dock_panel_1.TheiaDockPanel.Factory),
1910
+ __metadata("design:type", Function)
1911
+ ], ApplicationShell.prototype, "dockPanelFactory", void 0);
1912
+ __decorate([
1913
+ (0, inversify_1.postConstruct)(),
1914
+ __metadata("design:type", Function),
1915
+ __metadata("design:paramtypes", []),
1916
+ __metadata("design:returntype", void 0)
1917
+ ], ApplicationShell.prototype, "init", null);
1918
+ ApplicationShell = ApplicationShell_1 = __decorate([
1919
+ (0, inversify_1.injectable)(),
1920
+ __param(0, (0, inversify_1.inject)(exports.DockPanelRendererFactory)),
1921
+ __param(1, (0, inversify_1.inject)(status_bar_1.StatusBarImpl)),
1922
+ __param(2, (0, inversify_1.inject)(side_panel_handler_1.SidePanelHandlerFactory)),
1923
+ __param(3, (0, inversify_1.inject)(split_panels_1.SplitPositionHandler)),
1924
+ __param(4, (0, inversify_1.inject)(frontend_application_state_1.FrontendApplicationStateService)),
1925
+ __param(5, (0, inversify_1.inject)(exports.ApplicationShellOptions)),
1926
+ __param(5, (0, inversify_1.optional)()),
1927
+ __param(6, (0, inversify_1.inject)(core_preferences_1.CorePreferences)),
1928
+ __param(7, (0, inversify_1.inject)(save_resource_service_1.SaveResourceService)),
1929
+ __param(8, (0, inversify_1.inject)(secondary_window_handler_1.SecondaryWindowHandler)),
1930
+ __metadata("design:paramtypes", [Function, status_bar_1.StatusBarImpl, Function, split_panels_1.SplitPositionHandler,
1931
+ frontend_application_state_1.FrontendApplicationStateService, Object, Object, save_resource_service_1.SaveResourceService,
1932
+ secondary_window_handler_1.SecondaryWindowHandler])
1933
+ ], ApplicationShell);
1934
+ exports.ApplicationShell = ApplicationShell;
1935
+ /**
1936
+ * The namespace for `ApplicationShell` class statics.
1937
+ */
1938
+ (function (ApplicationShell) {
1939
+ ApplicationShell.areaLabels = {
1940
+ main: nls_1.nls.localizeByDefault('Main'),
1941
+ top: nls_1.nls.localizeByDefault('Top'),
1942
+ left: nls_1.nls.localizeByDefault('Left'),
1943
+ right: nls_1.nls.localizeByDefault('Right'),
1944
+ bottom: nls_1.nls.localizeByDefault('Bottom'),
1945
+ secondaryWindow: nls_1.nls.localize('theia/shell-area/secondary', 'Secondary Window'),
1946
+ };
1947
+ /**
1948
+ * The _side areas_ are those shell areas that can be collapsed and expanded,
1949
+ * i.e. `left`, `right`, and `bottom`.
1950
+ */
1951
+ function isSideArea(area) {
1952
+ return area === 'left' || area === 'right' || area === 'bottom';
1953
+ }
1954
+ ApplicationShell.isSideArea = isSideArea;
1955
+ function isValidArea(area) {
1956
+ const areas = ['main', 'top', 'left', 'right', 'bottom', 'secondaryWindow'];
1957
+ return typeof area === 'string' && areas.includes(area);
1958
+ }
1959
+ ApplicationShell.isValidArea = isValidArea;
1960
+ /**
1961
+ * The default values for application shell options.
1962
+ */
1963
+ ApplicationShell.DEFAULT_OPTIONS = Object.freeze({
1964
+ bottomPanel: Object.freeze({
1965
+ emptySize: 140,
1966
+ expandThreshold: 160,
1967
+ expandDuration: 0,
1968
+ initialSizeRatio: 0.382
1969
+ }),
1970
+ leftPanel: Object.freeze({
1971
+ emptySize: 140,
1972
+ expandThreshold: 140,
1973
+ expandDuration: 0,
1974
+ initialSizeRatio: 0.191
1975
+ }),
1976
+ rightPanel: Object.freeze({
1977
+ emptySize: 140,
1978
+ expandThreshold: 140,
1979
+ expandDuration: 0,
1980
+ initialSizeRatio: 0.191
1981
+ })
1982
+ });
1983
+ function isOpenToSideMode(mode) {
1984
+ return mode === 'open-to-left' || mode === 'open-to-right';
1985
+ }
1986
+ ApplicationShell.isOpenToSideMode = isOpenToSideMode;
1987
+ let TrackableWidgetProvider;
1988
+ (function (TrackableWidgetProvider) {
1989
+ function is(widget) {
1990
+ return (0, common_1.isObject)(widget) && 'getTrackableWidgets' in widget;
1991
+ }
1992
+ TrackableWidgetProvider.is = is;
1993
+ })(TrackableWidgetProvider = ApplicationShell.TrackableWidgetProvider || (ApplicationShell.TrackableWidgetProvider = {}));
1994
+ })(ApplicationShell = exports.ApplicationShell || (exports.ApplicationShell = {}));
1995
+ exports.ApplicationShell = ApplicationShell;
1991
1996
  //# sourceMappingURL=application-shell.js.map