@theia/core 1.18.0 → 1.21.0-next.12

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 (294) hide show
  1. package/README.md +3 -2
  2. package/lib/browser/about-dialog.d.ts.map +1 -1
  3. package/lib/browser/about-dialog.js +1 -1
  4. package/lib/browser/about-dialog.js.map +1 -1
  5. package/lib/browser/authentication-service.d.ts.map +1 -1
  6. package/lib/browser/authentication-service.js +1 -1
  7. package/lib/browser/authentication-service.js.map +1 -1
  8. package/lib/browser/color-registry.d.ts +3 -69
  9. package/lib/browser/color-registry.d.ts.map +1 -1
  10. package/lib/browser/color-registry.js +13 -27
  11. package/lib/browser/color-registry.js.map +1 -1
  12. package/lib/browser/common-frontend-contribution.d.ts +7 -13
  13. package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
  14. package/lib/browser/common-frontend-contribution.js +213 -250
  15. package/lib/browser/common-frontend-contribution.js.map +1 -1
  16. package/lib/browser/core-preferences.d.ts +1 -0
  17. package/lib/browser/core-preferences.d.ts.map +1 -1
  18. package/lib/browser/core-preferences.js +29 -19
  19. package/lib/browser/core-preferences.js.map +1 -1
  20. package/lib/browser/dialogs.d.ts +6 -0
  21. package/lib/browser/dialogs.d.ts.map +1 -1
  22. package/lib/browser/dialogs.js +10 -3
  23. package/lib/browser/dialogs.js.map +1 -1
  24. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  25. package/lib/browser/frontend-application-module.js +9 -5
  26. package/lib/browser/frontend-application-module.js.map +1 -1
  27. package/lib/browser/frontend-application.d.ts +6 -0
  28. package/lib/browser/frontend-application.d.ts.map +1 -1
  29. package/lib/browser/frontend-application.js +13 -0
  30. package/lib/browser/frontend-application.js.map +1 -1
  31. package/lib/browser/index.d.ts +1 -0
  32. package/lib/browser/index.d.ts.map +1 -1
  33. package/lib/browser/index.js +1 -0
  34. package/lib/browser/index.js.map +1 -1
  35. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.d.ts.map +1 -1
  36. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js +16 -11
  37. package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js.map +1 -1
  38. package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts +1 -1
  39. package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts.map +1 -1
  40. package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js +6 -4
  41. package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js.map +1 -1
  42. package/lib/browser/keyboard/keys.d.ts +2 -251
  43. package/lib/browser/keyboard/keys.d.ts.map +1 -1
  44. package/lib/browser/keyboard/keys.js +12 -614
  45. package/lib/browser/keyboard/keys.js.map +1 -1
  46. package/lib/browser/menu/browser-context-menu-renderer.d.ts +1 -1
  47. package/lib/browser/menu/browser-context-menu-renderer.d.ts.map +1 -1
  48. package/lib/browser/menu/browser-menu-plugin.d.ts +3 -0
  49. package/lib/browser/menu/browser-menu-plugin.d.ts.map +1 -1
  50. package/lib/browser/menu/browser-menu-plugin.js +24 -4
  51. package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
  52. package/lib/browser/messaging/ws-connection-provider.d.ts +3 -3
  53. package/lib/browser/messaging/ws-connection-provider.d.ts.map +1 -1
  54. package/lib/browser/messaging/ws-connection-provider.js +14 -4
  55. package/lib/browser/messaging/ws-connection-provider.js.map +1 -1
  56. package/lib/browser/{nls.d.ts → nls-loader.d.ts} +1 -6
  57. package/lib/browser/nls-loader.d.ts.map +1 -0
  58. package/lib/browser/nls-loader.js +29 -0
  59. package/lib/browser/nls-loader.js.map +1 -0
  60. package/lib/browser/preferences/preference-provider.d.ts +0 -2
  61. package/lib/browser/preferences/preference-provider.d.ts.map +1 -1
  62. package/lib/browser/preferences/preference-provider.js +1 -5
  63. package/lib/browser/preferences/preference-provider.js.map +1 -1
  64. package/lib/browser/preferences/preference-service.spec.js +0 -3
  65. package/lib/browser/preferences/preference-service.spec.js.map +1 -1
  66. package/lib/browser/progress-status-bar-item.d.ts +1 -2
  67. package/lib/browser/progress-status-bar-item.d.ts.map +1 -1
  68. package/lib/browser/progress-status-bar-item.js.map +1 -1
  69. package/lib/browser/quick-input/quick-command-frontend-contribution.d.ts.map +1 -1
  70. package/lib/browser/quick-input/quick-command-frontend-contribution.js +2 -1
  71. package/lib/browser/quick-input/quick-command-frontend-contribution.js.map +1 -1
  72. package/lib/browser/quick-input/quick-command-service.d.ts.map +1 -1
  73. package/lib/browser/quick-input/quick-command-service.js +2 -2
  74. package/lib/browser/quick-input/quick-command-service.js.map +1 -1
  75. package/lib/browser/quick-input/quick-input-service.d.ts +1 -201
  76. package/lib/browser/quick-input/quick-input-service.d.ts.map +1 -1
  77. package/lib/browser/quick-input/quick-input-service.js +11 -93
  78. package/lib/browser/quick-input/quick-input-service.js.map +1 -1
  79. package/lib/browser/quick-input/quick-view-service.d.ts +1 -2
  80. package/lib/browser/quick-input/quick-view-service.d.ts.map +1 -1
  81. package/lib/browser/quick-input/quick-view-service.js.map +1 -1
  82. package/lib/browser/shell/application-shell.d.ts +10 -8
  83. package/lib/browser/shell/application-shell.d.ts.map +1 -1
  84. package/lib/browser/shell/application-shell.js +11 -19
  85. package/lib/browser/shell/application-shell.js.map +1 -1
  86. package/lib/browser/shell/current-widget-command-adapter.d.ts +39 -0
  87. package/lib/browser/shell/current-widget-command-adapter.d.ts.map +1 -0
  88. package/lib/browser/shell/current-widget-command-adapter.js +42 -0
  89. package/lib/browser/shell/current-widget-command-adapter.js.map +1 -0
  90. package/lib/browser/shell/shell-layout-restorer.d.ts.map +1 -1
  91. package/lib/browser/shell/shell-layout-restorer.js +5 -3
  92. package/lib/browser/shell/shell-layout-restorer.js.map +1 -1
  93. package/lib/browser/shell/tab-bar-decorator.d.ts +1 -1
  94. package/lib/browser/shell/tab-bar-decorator.d.ts.map +1 -1
  95. package/lib/browser/shell/tab-bar-decorator.js.map +1 -1
  96. package/lib/browser/shell/tab-bar-toolbar.d.ts.map +1 -1
  97. package/lib/browser/shell/tab-bar-toolbar.js +2 -1
  98. package/lib/browser/shell/tab-bar-toolbar.js.map +1 -1
  99. package/lib/browser/shell/tab-bars.d.ts +22 -3
  100. package/lib/browser/shell/tab-bars.d.ts.map +1 -1
  101. package/lib/browser/shell/tab-bars.js +129 -10
  102. package/lib/browser/shell/tab-bars.js.map +1 -1
  103. package/lib/browser/storage-service.spec.js +1 -1
  104. package/lib/browser/storage-service.spec.js.map +1 -1
  105. package/lib/browser/theming.d.ts +5 -14
  106. package/lib/browser/theming.d.ts.map +1 -1
  107. package/lib/browser/theming.js +14 -0
  108. package/lib/browser/theming.js.map +1 -1
  109. package/lib/browser/tooltip-service.d.ts +52 -0
  110. package/lib/browser/tooltip-service.d.ts.map +1 -0
  111. package/lib/browser/tooltip-service.js +89 -0
  112. package/lib/browser/tooltip-service.js.map +1 -0
  113. package/lib/browser/tree/tree-model.d.ts.map +1 -1
  114. package/lib/browser/view-container.d.ts +55 -14
  115. package/lib/browser/view-container.d.ts.map +1 -1
  116. package/lib/browser/view-container.js +284 -66
  117. package/lib/browser/view-container.js.map +1 -1
  118. package/lib/browser/window/default-window-service.js +2 -2
  119. package/lib/browser/window/default-window-service.js.map +1 -1
  120. package/lib/browser/window/window-service.d.ts +1 -7
  121. package/lib/browser/window/window-service.d.ts.map +1 -1
  122. package/lib/browser/window/window-service.js +1 -5
  123. package/lib/browser/window/window-service.js.map +1 -1
  124. package/lib/browser/window-contribution.d.ts.map +1 -1
  125. package/lib/browser/window-contribution.js +2 -2
  126. package/lib/browser/window-contribution.js.map +1 -1
  127. package/lib/common/color.d.ts +84 -0
  128. package/lib/common/color.d.ts.map +1 -0
  129. package/lib/common/color.js +44 -0
  130. package/lib/common/color.js.map +1 -0
  131. package/lib/common/command.d.ts +1 -0
  132. package/lib/common/command.d.ts.map +1 -1
  133. package/lib/common/command.js +5 -2
  134. package/lib/common/command.js.map +1 -1
  135. package/lib/common/i18n/localization.d.ts +14 -0
  136. package/lib/common/i18n/localization.d.ts.map +1 -1
  137. package/lib/common/i18n/localization.js +54 -1
  138. package/lib/common/i18n/localization.js.map +1 -1
  139. package/lib/common/index.d.ts +1 -0
  140. package/lib/common/index.d.ts.map +1 -1
  141. package/lib/common/index.js +1 -0
  142. package/lib/common/index.js.map +1 -1
  143. package/lib/common/keys.d.ts +269 -0
  144. package/lib/common/keys.d.ts.map +1 -0
  145. package/lib/common/keys.js +634 -0
  146. package/lib/common/keys.js.map +1 -0
  147. package/lib/common/messaging/abstract-connection-provider.d.ts +1 -1
  148. package/lib/common/messaging/abstract-connection-provider.d.ts.map +1 -1
  149. package/lib/common/messaging/abstract-connection-provider.js +3 -1
  150. package/lib/common/messaging/abstract-connection-provider.js.map +1 -1
  151. package/lib/common/messaging/proxy-factory.js +1 -1
  152. package/lib/common/messaging/proxy-factory.js.map +1 -1
  153. package/lib/common/nls.d.ts +28 -0
  154. package/lib/common/nls.d.ts.map +1 -0
  155. package/lib/common/nls.js +91 -0
  156. package/lib/common/nls.js.map +1 -0
  157. package/lib/common/path.d.ts +6 -0
  158. package/lib/common/path.d.ts.map +1 -1
  159. package/lib/common/path.js +16 -4
  160. package/lib/common/path.js.map +1 -1
  161. package/lib/common/path.spec.js +12 -0
  162. package/lib/common/path.spec.js.map +1 -1
  163. package/lib/common/promise-util.d.ts +5 -2
  164. package/lib/common/promise-util.d.ts.map +1 -1
  165. package/lib/common/promise-util.js +16 -1
  166. package/lib/common/promise-util.js.map +1 -1
  167. package/lib/common/promise-util.spec.d.ts +2 -0
  168. package/lib/common/promise-util.spec.d.ts.map +1 -0
  169. package/lib/common/promise-util.spec.js +42 -0
  170. package/lib/common/promise-util.spec.js.map +1 -0
  171. package/lib/common/quick-pick-service.d.ts +219 -1
  172. package/lib/common/quick-pick-service.d.ts.map +1 -1
  173. package/lib/common/quick-pick-service.js +108 -1
  174. package/lib/common/quick-pick-service.js.map +1 -1
  175. package/lib/common/theme.d.ts +30 -0
  176. package/lib/common/theme.d.ts.map +1 -0
  177. package/lib/common/theme.js +18 -0
  178. package/lib/common/theme.js.map +1 -0
  179. package/lib/common/window.d.ts +29 -0
  180. package/lib/common/window.d.ts.map +1 -0
  181. package/lib/common/window.js +23 -0
  182. package/lib/common/window.js.map +1 -0
  183. package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts +9 -5
  184. package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts.map +1 -1
  185. package/lib/electron-browser/menu/electron-context-menu-renderer.js +40 -15
  186. package/lib/electron-browser/menu/electron-context-menu-renderer.js.map +1 -1
  187. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +5 -8
  188. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
  189. package/lib/electron-browser/menu/electron-main-menu-factory.js +10 -17
  190. package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
  191. package/lib/electron-browser/menu/electron-menu-contribution.d.ts +15 -7
  192. package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
  193. package/lib/electron-browser/menu/electron-menu-contribution.js +112 -42
  194. package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
  195. package/lib/electron-browser/window/electron-window-preferences.d.ts +1 -0
  196. package/lib/electron-browser/window/electron-window-preferences.d.ts.map +1 -1
  197. package/lib/electron-browser/window/electron-window-preferences.js +12 -1
  198. package/lib/electron-browser/window/electron-window-preferences.js.map +1 -1
  199. package/lib/electron-browser/window/electron-window-service.d.ts +1 -1
  200. package/lib/electron-browser/window/electron-window-service.d.ts.map +1 -1
  201. package/lib/electron-common/electron-main-window-service.d.ts +1 -1
  202. package/lib/electron-common/electron-main-window-service.d.ts.map +1 -1
  203. package/lib/electron-common/electron-main-window-service.js.map +1 -1
  204. package/lib/electron-common/messaging/electron-messages.d.ts +20 -0
  205. package/lib/electron-common/messaging/electron-messages.d.ts.map +1 -0
  206. package/lib/electron-common/messaging/electron-messages.js +23 -0
  207. package/lib/electron-common/messaging/electron-messages.js.map +1 -0
  208. package/lib/electron-main/electron-main-application.d.ts +16 -0
  209. package/lib/electron-main/electron-main-application.d.ts.map +1 -1
  210. package/lib/electron-main/electron-main-application.js +91 -25
  211. package/lib/electron-main/electron-main-application.js.map +1 -1
  212. package/lib/electron-main/electron-main-window-service-impl.d.ts +1 -1
  213. package/lib/electron-main/electron-main-window-service-impl.d.ts.map +1 -1
  214. package/lib/electron-main/electron-main-window-service-impl.js.map +1 -1
  215. package/lib/electron-main/messaging/electron-messaging-contribution.d.ts +1 -1
  216. package/lib/electron-main/messaging/electron-messaging-contribution.d.ts.map +1 -1
  217. package/lib/electron-main/messaging/electron-messaging-contribution.js +1 -2
  218. package/lib/electron-main/messaging/electron-messaging-contribution.js.map +1 -1
  219. package/package.json +7 -5
  220. package/shared/@theia/application-package/lib/api.d.ts +1 -0
  221. package/shared/@theia/application-package/lib/api.js +1 -0
  222. package/src/browser/about-dialog.tsx +2 -2
  223. package/src/browser/authentication-service.ts +1 -2
  224. package/src/browser/color-registry.ts +3 -85
  225. package/src/browser/common-frontend-contribution.ts +179 -232
  226. package/src/browser/core-preferences.ts +32 -19
  227. package/src/browser/dialogs.ts +10 -3
  228. package/src/browser/frontend-application-module.ts +10 -5
  229. package/src/browser/frontend-application.ts +13 -0
  230. package/src/browser/index.ts +1 -0
  231. package/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +16 -11
  232. package/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts +10 -4
  233. package/src/browser/keyboard/keys.ts +2 -675
  234. package/src/browser/menu/browser-context-menu-renderer.ts +1 -1
  235. package/src/browser/menu/browser-menu-plugin.ts +25 -5
  236. package/src/browser/messaging/ws-connection-provider.ts +13 -4
  237. package/src/browser/nls-loader.ts +26 -0
  238. package/src/browser/preferences/preference-provider.ts +1 -5
  239. package/src/browser/preferences/preference-service.spec.ts +0 -3
  240. package/src/browser/progress-status-bar-item.ts +1 -2
  241. package/src/browser/quick-input/quick-command-frontend-contribution.ts +2 -2
  242. package/src/browser/quick-input/quick-command-service.ts +2 -2
  243. package/src/browser/quick-input/quick-input-service.ts +1 -278
  244. package/src/browser/quick-input/quick-view-service.ts +1 -2
  245. package/src/browser/shell/application-shell.ts +21 -25
  246. package/src/browser/shell/current-widget-command-adapter.ts +57 -0
  247. package/src/browser/shell/shell-layout-restorer.ts +4 -3
  248. package/src/browser/shell/tab-bar-decorator.ts +1 -1
  249. package/src/browser/shell/tab-bar-toolbar.tsx +3 -1
  250. package/src/browser/shell/tab-bars.ts +133 -13
  251. package/src/browser/storage-service.spec.ts +1 -1
  252. package/src/browser/style/index.css +5 -0
  253. package/src/browser/style/sidepanel.css +8 -2
  254. package/src/browser/style/tabs.css +30 -0
  255. package/src/browser/style/tooltip.css +28 -0
  256. package/src/browser/style/view-container.css +9 -9
  257. package/src/browser/theming.ts +6 -17
  258. package/src/browser/tooltip-service.tsx +98 -0
  259. package/src/browser/tree/tree-model.ts +1 -1
  260. package/src/browser/view-container.ts +312 -80
  261. package/src/browser/window/default-window-service.ts +2 -2
  262. package/src/browser/window/window-service.ts +1 -9
  263. package/src/browser/window-contribution.ts +2 -2
  264. package/src/common/color.ts +100 -0
  265. package/src/common/command.ts +11 -2
  266. package/src/common/i18n/localization.ts +54 -0
  267. package/src/common/i18n/nls.metadata.json +20421 -0
  268. package/src/common/index.ts +1 -0
  269. package/src/common/keys.ts +693 -0
  270. package/src/common/messaging/abstract-connection-provider.ts +3 -1
  271. package/src/common/messaging/proxy-factory.ts +1 -1
  272. package/src/common/nls.ts +104 -0
  273. package/src/common/path.spec.ts +15 -0
  274. package/src/common/path.ts +16 -4
  275. package/src/common/promise-util.spec.ts +41 -0
  276. package/src/common/promise-util.ts +23 -4
  277. package/src/common/quick-pick-service.ts +299 -4
  278. package/src/common/theme.ts +32 -0
  279. package/src/common/window.ts +30 -0
  280. package/src/electron-browser/menu/electron-context-menu-renderer.ts +38 -16
  281. package/src/electron-browser/menu/electron-main-menu-factory.ts +10 -15
  282. package/src/electron-browser/menu/electron-menu-contribution.ts +129 -39
  283. package/src/electron-browser/menu/electron-menu-style.css +84 -0
  284. package/src/electron-browser/window/electron-window-preferences.ts +13 -1
  285. package/src/electron-browser/window/electron-window-service.ts +1 -1
  286. package/src/electron-common/electron-main-window-service.ts +1 -2
  287. package/src/electron-common/messaging/electron-messages.ts +20 -0
  288. package/src/electron-main/electron-main-application.ts +107 -24
  289. package/src/electron-main/electron-main-window-service-impl.ts +1 -2
  290. package/src/electron-main/messaging/electron-messaging-contribution.ts +1 -2
  291. package/lib/browser/nls.d.ts.map +0 -1
  292. package/lib/browser/nls.js +0 -64
  293. package/lib/browser/nls.js.map +0 -1
  294. package/src/browser/nls.ts +0 -65
@@ -25,6 +25,7 @@ import { ThemeService } from '../theming';
25
25
  import { ContributionProvider } from '../../common/contribution-provider';
26
26
  import { MaybePromise } from '../../common/types';
27
27
  import { ApplicationShell, applicationShellLayoutVersion, ApplicationShellLayoutVersion } from './application-shell';
28
+ import { CommonCommands } from '../common-frontend-contribution';
28
29
 
29
30
  /**
30
31
  * A contract for widgets that want to store and restore their inner state, between sessions.
@@ -109,11 +110,11 @@ export interface ApplicationShellLayoutMigration {
109
110
  onWillInflateWidget?(desc: WidgetDescription, context: ApplicationShellLayoutMigrationContext): MaybePromise<WidgetDescription | undefined>;
110
111
  }
111
112
 
112
- export const RESET_LAYOUT: Command = {
113
+ export const RESET_LAYOUT = Command.toLocalizedCommand({
113
114
  id: 'reset.layout',
114
- category: 'View',
115
+ category: CommonCommands.VIEW_CATEGORY,
115
116
  label: 'Reset Workbench Layout'
116
- };
117
+ }, 'theia/core/resetWorkbenchLayout', CommonCommands.VIEW_CATEGORY_KEY);
117
118
 
118
119
  @injectable()
119
120
  export class ShellLayoutRestorer implements CommandContribution {
@@ -57,7 +57,7 @@ export class TabBarDecoratorService implements FrontendApplicationContribution {
57
57
  this.contributions.getContributions().map(decorator => decorator.onDidChangeDecorations(this.fireDidChangeDecorations));
58
58
  }
59
59
 
60
- protected fireDidChangeDecorations = debounce(() => this.onDidChangeDecorationsEmitter.fire(undefined), 150);
60
+ fireDidChangeDecorations = debounce(() => this.onDidChangeDecorationsEmitter.fire(undefined), 150);
61
61
 
62
62
  /**
63
63
  * Assign tabs the decorators provided by all the contributions.
@@ -27,6 +27,7 @@ import { ContextKeyService } from '../context-key-service';
27
27
  import { Event, Emitter } from '../../common/event';
28
28
  import { ContextMenuRenderer, Anchor } from '../context-menu-renderer';
29
29
  import { MenuModelRegistry } from '../../common/menu';
30
+ import { nls } from '../../common/nls';
30
31
 
31
32
  /**
32
33
  * Clients should implement this interface if they want to contribute to the tab-bar toolbar.
@@ -403,7 +404,8 @@ export class TabBarToolbar extends ReactWidget {
403
404
 
404
405
  protected renderMore(): React.ReactNode {
405
406
  return !!this.more.size && <div key='__more__' className={TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM + ' enabled'}>
406
- <div id='__more__' className={codicon('ellipsis', true)} onClick={this.showMoreContextMenu} title='More Actions...' />
407
+ <div id='__more__' className={codicon('ellipsis', true)} onClick={this.showMoreContextMenu}
408
+ title={nls.localizeByDefault('More Actions...')} />
407
409
  </div>;
408
410
  }
409
411
 
@@ -17,7 +17,7 @@
17
17
  import PerfectScrollbar from 'perfect-scrollbar';
18
18
  import { TabBar, Title, Widget } from '@phosphor/widgets';
19
19
  import { VirtualElement, h, VirtualDOM, ElementInlineStyle } from '@phosphor/virtualdom';
20
- import { Disposable, DisposableCollection, MenuPath, notEmpty } from '../../common';
20
+ import { Disposable, DisposableCollection, MenuPath, notEmpty, SelectionService } from '../../common';
21
21
  import { ContextMenuRenderer } from '../context-menu-renderer';
22
22
  import { Signal, Slot } from '@phosphor/signaling';
23
23
  import { Message, MessageLoop } from '@phosphor/messaging';
@@ -30,14 +30,21 @@ import { TabBarDecoratorService } from './tab-bar-decorator';
30
30
  import { IconThemeService } from '../icon-theme-service';
31
31
  import { BreadcrumbsRenderer, BreadcrumbsRendererFactory } from '../breadcrumbs/breadcrumbs-renderer';
32
32
  import { NavigatableWidget } from '../navigatable-types';
33
+ import { IDragEvent } from '@phosphor/dragdrop';
33
34
 
34
35
  /** The class name added to hidden content nodes, which are required to render vertical side bars. */
35
36
  const HIDDEN_CONTENT_CLASS = 'theia-TabBar-hidden-content';
36
37
 
37
38
  /** Menu path for tab bars used throughout the application shell. */
38
39
  export const SHELL_TABBAR_CONTEXT_MENU: MenuPath = ['shell-tabbar-context-menu'];
40
+ export const SHELL_TABBAR_CONTEXT_CLOSE: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '0_close'];
41
+ export const SHELL_TABBAR_CONTEXT_COPY: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '1_copy'];
42
+ // Kept here in anticipation of tab pinning behavior implemented in tab-bars.ts
43
+ export const SHELL_TABBAR_CONTEXT_PIN: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '4_pin'];
44
+ export const SHELL_TABBAR_CONTEXT_SPLIT: MenuPath = [...SHELL_TABBAR_CONTEXT_MENU, '5_split'];
39
45
 
40
46
  export const TabBarRendererFactory = Symbol('TabBarRendererFactory');
47
+ export type TabBarRendererFactory = () => TabBarRenderer;
41
48
 
42
49
  /**
43
50
  * Size information of DOM elements used for rendering tabs in side bars.
@@ -65,7 +72,6 @@ export interface SideBarRenderData extends TabBar.IRenderData<Widget> {
65
72
  * automatically.
66
73
  */
67
74
  export class TabBarRenderer extends TabBar.Renderer {
68
-
69
75
  /**
70
76
  * The menu path used to render the context menu.
71
77
  */
@@ -79,7 +85,8 @@ export class TabBarRenderer extends TabBar.Renderer {
79
85
  constructor(
80
86
  protected readonly contextMenuRenderer?: ContextMenuRenderer,
81
87
  protected readonly decoratorService?: TabBarDecoratorService,
82
- protected readonly iconThemeService?: IconThemeService
88
+ protected readonly iconThemeService?: IconThemeService,
89
+ protected readonly selectionService?: SelectionService,
83
90
  ) {
84
91
  super();
85
92
  if (this.decoratorService) {
@@ -229,11 +236,11 @@ export class TabBarRenderer extends TabBar.Renderer {
229
236
  }
230
237
 
231
238
  renderBadge(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement {
232
- const badge: number | undefined = this.getDecorationData(data.title, 'badge')[0];
233
- if (!badge) {
239
+ const totalBadge = this.getDecorationData(data.title, 'badge').reduce((sum, badge) => sum! + badge!, 0);
240
+ if (!totalBadge) {
234
241
  return h.div({});
235
242
  }
236
- const limitedBadge = badge >= 100 ? '99+' : badge;
243
+ const limitedBadge = totalBadge >= 100 ? '99+' : totalBadge;
237
244
  return isInSidePanel
238
245
  ? h.div({ className: 'theia-badge-decorator-sidebar' }, `${limitedBadge}`)
239
246
  : h.div({ className: 'theia-badge-decorator-horizontal' }, `${limitedBadge}`);
@@ -279,7 +286,6 @@ export class TabBarRenderer extends TabBar.Renderer {
279
286
  */
280
287
  protected getDecorationData<K extends keyof WidgetDecoration.Data>(title: Title<Widget>, key: K): WidgetDecoration.Data[K][] {
281
288
  return this.getDecorations(title).filter(data => data[key] !== undefined).map(data => data[key]);
282
-
283
289
  }
284
290
 
285
291
  /**
@@ -383,8 +389,8 @@ export class TabBarRenderer extends TabBar.Renderer {
383
389
  * @param {SideBarRenderData} data Data used to render the tab icon.
384
390
  * @param {boolean} isInSidePanel An optional check which determines if the tab is in the side-panel.
385
391
  */
386
- renderIcon(data: SideBarRenderData, inSidePanel?: boolean): VirtualElement {
387
- if (!inSidePanel && this.iconThemeService && this.iconThemeService.current === 'none') {
392
+ renderIcon(data: SideBarRenderData, isInSidePanel?: boolean): VirtualElement {
393
+ if (!isInSidePanel && this.iconThemeService && this.iconThemeService.current === 'none') {
388
394
  return h.div();
389
395
  }
390
396
  let top: string | undefined;
@@ -401,13 +407,13 @@ export class TabBarRenderer extends TabBar.Renderer {
401
407
  if (decorationData.length > 0) {
402
408
  const baseIcon: VirtualElement = h.div({ className: baseClassName, style }, data.title.iconLabel);
403
409
  const wrapperClassName: string = WidgetDecoration.Styles.ICON_WRAPPER_CLASS;
404
- const decoratorSizeClassName: string = inSidePanel ? WidgetDecoration.Styles.DECORATOR_SIDEBAR_SIZE_CLASS : WidgetDecoration.Styles.DECORATOR_SIZE_CLASS;
410
+ const decoratorSizeClassName: string = isInSidePanel ? WidgetDecoration.Styles.DECORATOR_SIDEBAR_SIZE_CLASS : WidgetDecoration.Styles.DECORATOR_SIZE_CLASS;
405
411
 
406
412
  decorationData
407
413
  .filter(notEmpty)
408
414
  .map(overlay => [overlay.position, overlay] as [WidgetDecoration.IconOverlayPosition, WidgetDecoration.IconOverlay | WidgetDecoration.IconClassOverlay])
409
415
  .forEach(([position, overlay]) => {
410
- const iconAdditionalClasses: string[] = [decoratorSizeClassName, WidgetDecoration.IconOverlayPosition.getStyle(position, inSidePanel)];
416
+ const iconAdditionalClasses: string[] = [decoratorSizeClassName, WidgetDecoration.IconOverlayPosition.getStyle(position, isInSidePanel)];
411
417
  const overlayIconStyle = (color?: string) => {
412
418
  if (color === undefined) {
413
419
  return {};
@@ -437,7 +443,27 @@ export class TabBarRenderer extends TabBar.Renderer {
437
443
  if (this.contextMenuRenderer && this.contextMenuPath && event.currentTarget instanceof HTMLElement) {
438
444
  event.stopPropagation();
439
445
  event.preventDefault();
440
- this.contextMenuRenderer.render(this.contextMenuPath, event);
446
+ let widget: Widget | undefined = undefined;
447
+ if (this.tabBar) {
448
+ const titleIndex = Array.from(this.tabBar.contentNode.getElementsByClassName('p-TabBar-tab'))
449
+ .findIndex(node => node.contains(event.currentTarget as HTMLElement));
450
+ if (titleIndex !== -1) {
451
+ widget = this.tabBar.titles[titleIndex].owner;
452
+ }
453
+ }
454
+
455
+ const oldSelection = this.selectionService?.selection;
456
+ if (widget && this.selectionService) {
457
+ this.selectionService.selection = NavigatableWidget.is(widget) ? { uri: widget.getResourceUri() } : widget;
458
+ }
459
+
460
+ this.contextMenuRenderer.render({
461
+ menuPath: this.contextMenuPath!,
462
+ anchor: event,
463
+ args: [event],
464
+ // We'd like to wait until the command triggered by the context menu has been run, but this should let it get through the preamble, at least.
465
+ onHide: () => setTimeout(() => { if (this.selectionService) { this.selectionService.selection = oldSelection; } })
466
+ });
441
467
  }
442
468
  };
443
469
 
@@ -452,7 +478,6 @@ export class TabBarRenderer extends TabBar.Renderer {
452
478
  }
453
479
  }
454
480
  };
455
-
456
481
  }
457
482
 
458
483
  /**
@@ -772,6 +797,18 @@ export class SideTabBar extends ScrollableTabBar {
772
797
  protected onAfterAttach(msg: Message): void {
773
798
  super.onAfterAttach(msg);
774
799
  this.renderTabBar();
800
+ this.node.addEventListener('p-dragenter', this);
801
+ this.node.addEventListener('p-dragover', this);
802
+ this.node.addEventListener('p-dragleave', this);
803
+ document.addEventListener('p-drop', this);
804
+ }
805
+
806
+ protected onAfterDetach(msg: Message): void {
807
+ super.onAfterDetach(msg);
808
+ this.node.removeEventListener('p-dragenter', this);
809
+ this.node.removeEventListener('p-dragover', this);
810
+ this.node.removeEventListener('p-dragleave', this);
811
+ document.removeEventListener('p-drop', this);
775
812
  }
776
813
 
777
814
  protected onUpdateRequest(msg: Message): void {
@@ -869,6 +906,15 @@ export class SideTabBar extends ScrollableTabBar {
869
906
  this.onMouseMove(event as MouseEvent);
870
907
  super.handleEvent(event);
871
908
  break;
909
+ case 'p-dragenter':
910
+ this.onDragEnter(event as IDragEvent);
911
+ break;
912
+ case 'p-dragover':
913
+ this.onDragOver(event as IDragEvent);
914
+ break;
915
+ case 'p-dragleave': case 'p-drop':
916
+ this.cancelViewContainerDND();
917
+ break;
872
918
  default:
873
919
  super.handleEvent(event);
874
920
  }
@@ -934,4 +980,78 @@ export class SideTabBar extends ScrollableTabBar {
934
980
  }
935
981
  }
936
982
 
983
+ toCancelViewContainerDND = new DisposableCollection();
984
+ protected cancelViewContainerDND = () => {
985
+ this.toCancelViewContainerDND.dispose();
986
+ };
987
+
988
+ /**
989
+ * Handles `viewContainerPart` drag enter.
990
+ */
991
+ protected onDragEnter = (event: IDragEvent) => {
992
+ this.cancelViewContainerDND();
993
+ if (event.mimeData.getData('application/vnd.phosphor.view-container-factory')) {
994
+ event.preventDefault();
995
+ event.stopPropagation();
996
+ }
997
+ };
998
+
999
+ /**
1000
+ * Handle `viewContainerPart` drag over,
1001
+ * Defines the appropriate `drpAction` and opens the tab on which the mouse stands on for more than 800 ms.
1002
+ */
1003
+ protected onDragOver = (event: IDragEvent) => {
1004
+ const factory = event.mimeData.getData('application/vnd.phosphor.view-container-factory');
1005
+ const widget = factory && factory();
1006
+ if (!widget) {
1007
+ event.dropAction = 'none';
1008
+ return;
1009
+ }
1010
+ event.preventDefault();
1011
+ event.stopPropagation();
1012
+ if (!this.toCancelViewContainerDND.disposed) {
1013
+ event.dropAction = event.proposedAction;
1014
+ return;
1015
+ }
1016
+
1017
+ const { target, clientX, clientY } = event;
1018
+ if (target instanceof HTMLElement) {
1019
+ if (widget.options.disableDraggingToOtherContainers || widget.viewContainer.disableDNDBetweenContainers) {
1020
+ event.dropAction = 'none';
1021
+ target.classList.add('theia-cursor-no-drop');
1022
+ this.toCancelViewContainerDND.push(Disposable.create(() => {
1023
+ target.classList.remove('theia-cursor-no-drop');
1024
+ }));
1025
+ } else {
1026
+ event.dropAction = event.proposedAction;
1027
+ }
1028
+ const { top, bottom, left, right, height } = target.getBoundingClientRect();
1029
+ const mouseOnTop = (clientY - top) < (height / 2);
1030
+ const dropTargetClass = `drop-target-${mouseOnTop ? 'top' : 'bottom'}`;
1031
+ const tabs = this.contentNode.children;
1032
+ const targetTab = ArrayExt.findFirstValue(tabs, t => ElementExt.hitTest(t, clientX, clientY));
1033
+ if (!targetTab) {
1034
+ return;
1035
+ }
1036
+ targetTab.classList.add(dropTargetClass);
1037
+ this.toCancelViewContainerDND.push(Disposable.create(() => {
1038
+ if (targetTab) {
1039
+ targetTab.classList.remove(dropTargetClass);
1040
+ }
1041
+ }));
1042
+ const openTabTimer = setTimeout(() => {
1043
+ const title = this.titles.find(t => (this.renderer as TabBarRenderer).createTabId(t) === targetTab.id);
1044
+ if (title) {
1045
+ const mouseStillOnTab = clientX >= left && clientX <= right && clientY >= top && clientY <= bottom;
1046
+ if (mouseStillOnTab) {
1047
+ this.currentTitle = title;
1048
+ }
1049
+ }
1050
+ }, 800);
1051
+ this.toCancelViewContainerDND.push(Disposable.create(() => {
1052
+ clearTimeout(openTabTimer);
1053
+ }));
1054
+ }
1055
+ };
1056
+
937
1057
  }
@@ -34,7 +34,7 @@ before(() => {
34
34
  MockLogger since it does what we need but this is there as a demo of
35
35
  sinon for other uses-cases. We can remove this once this technique is
36
36
  more generally used. */
37
- sinon.stub(logger, 'warn').callsFake(() => { });
37
+ sinon.stub(logger, 'warn').callsFake(async () => { });
38
38
  return logger;
39
39
  });
40
40
  testContainer.bind(StorageService).to(LocalStorageService).inSingletonScope();
@@ -235,6 +235,10 @@ button.secondary[disabled], .theia-button.secondary[disabled] {
235
235
  z-index: 999;
236
236
  }
237
237
 
238
+ .theia-cursor-no-drop, .theia-cursor-no-drop:active {
239
+ cursor: no-drop;
240
+ }
241
+
238
242
  /*-----------------------------------------------------------------------------
239
243
  | Import children style files
240
244
  |----------------------------------------------------------------------------*/
@@ -259,3 +263,4 @@ button.secondary[disabled], .theia-button.secondary[disabled] {
259
263
  @import './quick-title-bar.css';
260
264
  @import './progress-bar.css';
261
265
  @import './breadcrumbs.css';
266
+ @import './tooltip.css';
@@ -128,6 +128,11 @@
128
128
  -webkit-mask-position: 50% 50%;
129
129
  }
130
130
 
131
+ /* inactive legacy/plugin icons */
132
+ .p-TabBar.theia-app-sides .p-TabBar-tabIcon:not(.codicon) {
133
+ background: var(--theia-activityBar-inactiveForeground);
134
+ }
135
+
131
136
  /* inactive file icons */
132
137
  .p-TabBar.theia-app-sides .file-icon.p-TabBar-tabIcon {
133
138
  background: inherit !important;
@@ -144,8 +149,9 @@
144
149
  color: var(--theia-activityBar-foreground);
145
150
  }
146
151
 
147
- .p-TabBar.theia-app-sides .p-TabBar-tabIcon.theia-plugin-view-container:hover,
148
- .p-TabBar.theia-app-sides .p-mod-current .p-TabBar-tabIcon.theia-plugin-view-container {
152
+ /* active legacy/plugin icons */
153
+ .p-TabBar.theia-app-sides .p-TabBar-tabIcon:not(.codicon):hover,
154
+ .p-TabBar.theia-app-sides .p-mod-current .p-TabBar-tabIcon:not(.codicon) {
149
155
  background-color: var(--theia-activityBar-foreground);
150
156
  }
151
157
 
@@ -10,6 +10,7 @@
10
10
  --theia-tabbar-toolbar-z-index: 1001;
11
11
  --theia-toolbar-active-transform-scale: 1.272019649;
12
12
  --theia-horizontal-toolbar-height: calc(var(--theia-private-horizontal-tab-height) + var(--theia-private-horizontal-tab-scrollbar-rail-height) / 2);
13
+ --theia-dragover-tab-border-width: 2px;
13
14
  }
14
15
 
15
16
  /*-----------------------------------------------------------------------------
@@ -39,6 +40,19 @@
39
40
  align-items: center;
40
41
  }
41
42
 
43
+ .p-TabBar[data-orientation='vertical'] .p-TabBar-tab {
44
+ border-top: var(--theia-dragover-tab-border-width) solid transparent !important;
45
+ border-bottom: var(--theia-dragover-tab-border-width) solid transparent !important;
46
+ }
47
+
48
+ .p-TabBar[data-orientation='vertical'] .p-TabBar-tab.drop-target-top {
49
+ border-top-color: var(--theia-activityBar-activeBorder) !important;
50
+ }
51
+
52
+ .p-TabBar[data-orientation='vertical'] .p-TabBar-tab.drop-target-bottom {
53
+ border-bottom-color: var(--theia-activityBar-activeBorder) !important;
54
+ }
55
+
42
56
  .p-TabBar[data-orientation='horizontal'] .p-TabBar-tab .theia-tab-icon-label,
43
57
  .p-TabBar-tab.p-mod-drag-image .theia-tab-icon-label {
44
58
  display: flex;
@@ -185,11 +199,13 @@ body.theia-editor-highlightModifiedTabs
185
199
  background-repeat: no-repeat;
186
200
  }
187
201
 
202
+ /* common icons */
188
203
  .p-TabBar.theia-app-centers .p-TabBar-tabIcon,
189
204
  .p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon {
190
205
  min-height: 14px;
191
206
  background-size: 13px;
192
207
  background-position-y: 3px;
208
+ background: var(--theia-icon-foreground);
193
209
  -webkit-mask-repeat: no-repeat;
194
210
  -webkit-mask-size: auto 13px;
195
211
  mask-repeat: no-repeat;
@@ -197,6 +213,20 @@ body.theia-editor-highlightModifiedTabs
197
213
  padding-right: 8px;
198
214
  }
199
215
 
216
+ /* codicons */
217
+ .p-TabBar.theia-app-centers .p-TabBar-tabIcon.codicon,
218
+ .p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon.codicon {
219
+ background: none;
220
+ }
221
+
222
+ /* file icons */
223
+ .p-TabBar[data-orientation='horizontal'] .p-TabBar-tabIcon.file-icon,
224
+ .p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon.file-icon {
225
+ background: none;
226
+ padding-bottom: 0px;
227
+ min-height: 20px;
228
+ }
229
+
200
230
  .p-TabBar[data-orientation='horizontal'] .p-TabBar-tabIcon.fa,
201
231
  .p-TabBar-tab.p-mod-drag-image .p-TabBar-tabIcon.fa {
202
232
  background: none;
@@ -0,0 +1,28 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2021 Arm and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ .theia-tooltip {
18
+ color: var(--theia-list-hoverForeground) !important;
19
+ background: var(--theia-list-hoverBackground) !important;
20
+ border: 1px solid !important;
21
+ border-color: var(--theia-list-hoverForeground) !important;
22
+ }
23
+
24
+ /* Hide tooltip arrow */
25
+ .theia-tooltip::before,
26
+ .theia-tooltip::after {
27
+ border: none !important;
28
+ }
@@ -50,7 +50,7 @@
50
50
  height: 100%;
51
51
  }
52
52
 
53
- .theia-view-container .part > .header {
53
+ .theia-view-container-part-header {
54
54
  cursor: pointer;
55
55
  display: flex;
56
56
  align-items: center;
@@ -61,26 +61,26 @@
61
61
  font-weight: 700;
62
62
  }
63
63
 
64
- .theia-view-container .part > .header .theia-ExpansionToggle {
64
+ .theia-view-container-part-header .theia-ExpansionToggle {
65
65
  padding-left: 4px;
66
66
  }
67
67
 
68
- .theia-view-container > .p-SplitPanel[data-orientation='horizontal'] .part > .header .theia-ExpansionToggle::before {
68
+ .theia-view-container > .p-SplitPanel[data-orientation='horizontal'] .part > .theia-header .theia-ExpansionToggle::before {
69
69
  display: none;
70
70
  padding-left: 0px;
71
71
  }
72
72
 
73
- .theia-view-container > .p-SplitPanel[data-orientation='horizontal'] .part > .header .theia-ExpansionToggle {
73
+ .theia-view-container > .p-SplitPanel[data-orientation='horizontal'] .part > .theia-header .theia-ExpansionToggle {
74
74
  padding-left: 0px;
75
75
  }
76
76
 
77
- .theia-view-container .part > .header .label {
77
+ .theia-view-container-part-header .label {
78
78
  flex: 0;
79
79
  white-space: nowrap;
80
80
  text-overflow: ellipsis;
81
81
  }
82
82
 
83
- .theia-view-container .part > .header .description {
83
+ .theia-view-container-part-header .description {
84
84
  flex: 1;
85
85
  overflow: hidden;
86
86
  white-space: nowrap;
@@ -107,7 +107,7 @@
107
107
  }
108
108
 
109
109
  .theia-view-container .part.drop-target {
110
- background: var(--theia-sideBar-dropBackground);
110
+ background: var(--theia-list-dropBackground);
111
111
  border: var(--theia-border-width) dashed var(--theia-contrastActiveBorder);
112
112
  transition-property: top, left, right, bottom;
113
113
  transition-duration: 150ms;
@@ -143,7 +143,7 @@
143
143
  }
144
144
 
145
145
  .theia-view-container-part-title.menu-open,
146
- .p-Widget.part:not(.collapsed):hover .header .theia-view-container-part-title,
147
- .p-Widget.part:not(.collapsed):focus-within .header .theia-view-container-part-title {
146
+ .p-Widget.part:not(.collapsed):hover .theia-view-container-part-header .theia-view-container-part-title,
147
+ .p-Widget.part:not(.collapsed):focus-within .theia-view-container-part-header .theia-view-container-part-title {
148
148
  display: flex;
149
149
  }
@@ -18,25 +18,14 @@ import { Emitter, Event } from '../common/event';
18
18
  import { Disposable } from '../common/disposable';
19
19
  import { FrontendApplicationConfigProvider } from './frontend-application-config-provider';
20
20
  import { ApplicationProps } from '@theia/application-package/lib/application-props';
21
+ import { Theme, ThemeChangeEvent } from '../common/theme';
21
22
 
22
- export const ThemeServiceSymbol = Symbol('ThemeService');
23
-
24
- export type ThemeType = 'light' | 'dark' | 'hc';
25
-
26
- export interface Theme {
27
- readonly id: string;
28
- readonly type: ThemeType;
29
- readonly label: string;
30
- readonly description?: string;
31
- readonly editorTheme?: string;
32
- activate(): void;
33
- deactivate(): void;
34
- }
23
+ /**
24
+ * @deprecated since 1.20.0. Import from `@theia/core/lib/common/theme` instead.
25
+ */
26
+ export * from '../common/theme';
35
27
 
36
- export interface ThemeChangeEvent {
37
- readonly newTheme: Theme;
38
- readonly oldTheme?: Theme;
39
- }
28
+ export const ThemeServiceSymbol = Symbol('ThemeService');
40
29
 
41
30
  export class ThemeService {
42
31
 
@@ -0,0 +1,98 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2021 Arm and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { injectable, inject, optional, postConstruct } from 'inversify';
18
+ import * as React from 'react';
19
+ import ReactTooltip from 'react-tooltip';
20
+ import { ReactRenderer, RendererHost } from './widgets/react-renderer';
21
+ import { CorePreferences } from './core-preferences';
22
+ import { DisposableCollection } from '../common/disposable';
23
+ import { v4 } from 'uuid';
24
+
25
+ export const TooltipService = Symbol('TooltipService');
26
+
27
+ export interface TooltipService {
28
+ tooltipId: string;
29
+ attachTo(host: HTMLElement): void;
30
+ update(fullRender?: boolean): void;
31
+ }
32
+
33
+ /**
34
+ * Attributes to be added to an HTML element to enable
35
+ * rich HTML tooltip rendering
36
+ */
37
+ export interface TooltipAttributes {
38
+ /**
39
+ * HTML to render in the tooltip.
40
+ */
41
+ 'data-tip': string;
42
+ /**
43
+ * The ID of the tooltip renderer. Should be TOOLTIP_ID.
44
+ */
45
+ 'data-for': string;
46
+ }
47
+
48
+ const DELAY_PREFERENCE = 'workbench.hover.delay';
49
+
50
+ @injectable()
51
+ export class TooltipServiceImpl extends ReactRenderer implements TooltipService {
52
+
53
+ @inject(CorePreferences)
54
+ protected readonly corePreferences: CorePreferences;
55
+
56
+ public readonly tooltipId: string;
57
+ protected rendered = false;
58
+ protected toDispose: DisposableCollection = new DisposableCollection();
59
+
60
+ constructor(
61
+ @inject(RendererHost) @optional() host?: RendererHost
62
+ ) {
63
+ super(host);
64
+ this.tooltipId = v4();
65
+ }
66
+
67
+ @postConstruct()
68
+ protected init(): void {
69
+ this.toDispose.push(this.corePreferences.onPreferenceChanged(preference => {
70
+ if (preference.preferenceName === DELAY_PREFERENCE) {
71
+ this.update(true);
72
+ }
73
+ }));
74
+ }
75
+
76
+ public attachTo(host: HTMLElement): void {
77
+ host.appendChild(this.host);
78
+ }
79
+
80
+ public update(fullRender = false): void {
81
+ if (fullRender || !this.rendered) {
82
+ this.render();
83
+ this.rendered = true;
84
+ }
85
+
86
+ ReactTooltip.rebuild();
87
+ }
88
+
89
+ protected doRender(): React.ReactNode {
90
+ const hoverDelay = this.corePreferences.get(DELAY_PREFERENCE);
91
+ return <ReactTooltip id={this.tooltipId} className='theia-tooltip' html={true} delayShow={hoverDelay} />;
92
+ }
93
+
94
+ public dispose(): void {
95
+ this.toDispose.dispose();
96
+ super.dispose();
97
+ }
98
+ }
@@ -19,7 +19,7 @@ import { Event, Emitter, WaitUntilEvent } from '../../common/event';
19
19
  import { DisposableCollection } from '../../common/disposable';
20
20
  import { CancellationToken } from '../../common/cancellation';
21
21
  import { ILogger } from '../../common/logger';
22
- import { SelectionProvider, } from '../../common/selection-service';
22
+ import { SelectionProvider } from '../../common/selection-service';
23
23
  import { Tree, TreeNode, CompositeTreeNode } from './tree';
24
24
  import { TreeSelectionService, SelectableTreeNode, TreeSelection } from './tree-selection';
25
25
  import { TreeExpansionService, ExpandableTreeNode } from './tree-expansion';