@theia/core 1.30.0-next.8 → 1.30.0
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.
- package/README.md +6 -6
- package/i18n/nls.cs.json +16 -0
- package/i18n/nls.de.json +16 -0
- package/i18n/nls.es.json +16 -0
- package/i18n/nls.fr.json +16 -0
- package/i18n/nls.hu.json +16 -0
- package/i18n/nls.it.json +16 -0
- package/i18n/nls.ja.json +16 -0
- package/i18n/nls.json +16 -0
- package/i18n/nls.pl.json +16 -0
- package/i18n/nls.pt-br.json +16 -0
- package/i18n/nls.pt-pt.json +16 -0
- package/i18n/nls.ru.json +16 -0
- package/i18n/nls.zh-cn.json +20 -4
- package/lib/browser/about-dialog.d.ts +9 -0
- package/lib/browser/about-dialog.d.ts.map +1 -1
- package/lib/browser/about-dialog.js +34 -4
- package/lib/browser/about-dialog.js.map +1 -1
- package/lib/browser/core-preferences.d.ts +3 -1
- package/lib/browser/core-preferences.d.ts.map +1 -1
- package/lib/browser/core-preferences.js +38 -2
- package/lib/browser/core-preferences.js.map +1 -1
- package/lib/browser/dialogs/react-dialog.d.ts +1 -0
- package/lib/browser/dialogs/react-dialog.d.ts.map +1 -1
- package/lib/browser/dialogs/react-dialog.js +10 -2
- package/lib/browser/dialogs/react-dialog.js.map +1 -1
- package/lib/browser/frontend-application-config-provider.spec.js +1 -1
- package/lib/browser/frontend-application-config-provider.spec.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js +5 -0
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/icon-theme-service.d.ts +5 -1
- package/lib/browser/icon-theme-service.d.ts.map +1 -1
- package/lib/browser/icon-theme-service.js +21 -1
- package/lib/browser/icon-theme-service.js.map +1 -1
- package/lib/browser/label-provider.d.ts +13 -1
- package/lib/browser/label-provider.d.ts.map +1 -1
- package/lib/browser/label-provider.js +34 -28
- package/lib/browser/label-provider.js.map +1 -1
- package/lib/browser/preferences/preference-contribution.d.ts +2 -0
- package/lib/browser/preferences/preference-contribution.d.ts.map +1 -1
- package/lib/browser/preferences/preference-contribution.js +7 -0
- package/lib/browser/preferences/preference-contribution.js.map +1 -1
- package/lib/browser/preloader.d.ts.map +1 -1
- package/lib/browser/preloader.js +4 -1
- package/lib/browser/preloader.js.map +1 -1
- package/lib/browser/shell/application-shell.d.ts +1 -0
- package/lib/browser/shell/application-shell.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +8 -0
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/tab-bars.d.ts +10 -2
- package/lib/browser/shell/tab-bars.d.ts.map +1 -1
- package/lib/browser/shell/tab-bars.js +14 -5
- package/lib/browser/shell/tab-bars.js.map +1 -1
- package/lib/browser/shell/theia-dock-panel.d.ts +4 -2
- package/lib/browser/shell/theia-dock-panel.d.ts.map +1 -1
- package/lib/browser/shell/theia-dock-panel.js +5 -0
- package/lib/browser/shell/theia-dock-panel.js.map +1 -1
- package/lib/browser/theming.d.ts +5 -1
- package/lib/browser/theming.d.ts.map +1 -1
- package/lib/browser/theming.js +19 -1
- package/lib/browser/theming.js.map +1 -1
- package/lib/browser/view-container.js +1 -1
- package/lib/browser/view-container.js.map +1 -1
- package/lib/browser/window/window-title-service.d.ts +32 -0
- package/lib/browser/window/window-title-service.d.ts.map +1 -0
- package/lib/browser/window/window-title-service.js +121 -0
- package/lib/browser/window/window-title-service.js.map +1 -0
- package/lib/browser/window/window-title-updater.d.ts +19 -0
- package/lib/browser/window/window-title-updater.d.ts.map +1 -0
- package/lib/browser/window/window-title-updater.js +108 -0
- package/lib/browser/window/window-title-updater.js.map +1 -0
- package/lib/common/event.d.ts +8 -3
- package/lib/common/event.d.ts.map +1 -1
- package/lib/common/event.js +3 -1
- package/lib/common/event.js.map +1 -1
- package/lib/common/json-schema.d.ts +1 -0
- package/lib/common/json-schema.d.ts.map +1 -1
- package/lib/common/message-rpc/rpc-protocol.d.ts +0 -1
- package/lib/common/message-rpc/rpc-protocol.d.ts.map +1 -1
- package/lib/common/message-rpc/rpc-protocol.js +6 -13
- package/lib/common/message-rpc/rpc-protocol.js.map +1 -1
- package/lib/common/progress-service.d.ts +1 -1
- package/lib/common/progress-service.d.ts.map +1 -1
- package/lib/common/progress-service.js +2 -2
- package/lib/common/progress-service.js.map +1 -1
- package/lib/common/quick-pick-service.d.ts +2 -2
- package/lib/common/quick-pick-service.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.d.ts +17 -1
- package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.js +87 -1
- package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
- package/lib/electron-browser/menu/electron-menu-module.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-menu-module.js +2 -0
- package/lib/electron-browser/menu/electron-menu-module.js.map +1 -1
- package/lib/electron-main/electron-main-application-module.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application-module.js +3 -0
- package/lib/electron-main/electron-main-application-module.js.map +1 -1
- package/package.json +6 -6
- package/src/browser/about-dialog.tsx +45 -2
- package/src/browser/core-preferences.ts +43 -4
- package/src/browser/dialogs/react-dialog.tsx +10 -2
- package/src/browser/frontend-application-config-provider.spec.ts +1 -1
- package/src/browser/frontend-application-module.ts +5 -0
- package/src/browser/icon-theme-service.ts +21 -2
- package/src/browser/label-provider.ts +38 -29
- package/src/browser/preferences/preference-contribution.ts +9 -0
- package/src/browser/preloader.ts +4 -1
- package/src/browser/shell/application-shell.ts +9 -0
- package/src/browser/shell/tab-bars.ts +14 -5
- package/src/browser/shell/theia-dock-panel.ts +6 -1
- package/src/browser/style/about.css +13 -4
- package/src/browser/theming.ts +21 -3
- package/src/browser/view-container.ts +2 -2
- package/src/browser/window/window-title-service.ts +107 -0
- package/src/browser/window/window-title-updater.ts +94 -0
- package/src/common/event.ts +13 -4
- package/src/common/json-schema.ts +1 -0
- package/src/common/message-rpc/rpc-protocol.ts +8 -14
- package/src/common/progress-service.ts +2 -2
- package/src/common/quick-pick-service.ts +2 -2
- package/src/electron-browser/menu/electron-menu-contribution.ts +87 -7
- package/src/electron-browser/menu/electron-menu-module.ts +3 -1
- package/src/electron-browser/menu/electron-menu-style.css +25 -0
- package/src/electron-main/electron-main-application-module.ts +4 -0
|
@@ -57,7 +57,7 @@ export interface QuickPickItem {
|
|
|
57
57
|
iconClasses?: string[];
|
|
58
58
|
alwaysShow?: boolean;
|
|
59
59
|
highlights?: QuickPickItemHighlights;
|
|
60
|
-
buttons?: QuickInputButton[];
|
|
60
|
+
buttons?: readonly QuickInputButton[];
|
|
61
61
|
execute?: () => void;
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -93,7 +93,7 @@ export interface QuickPickValue<V> extends QuickPickItem {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export interface QuickInputButton {
|
|
96
|
-
iconPath?: URI | { light?: URI | Uri; dark: URI | Uri } | { id: string };
|
|
96
|
+
iconPath?: URI | Uri | { light?: URI | Uri; dark: URI | Uri } | { id: string };
|
|
97
97
|
iconClass?: string;
|
|
98
98
|
tooltip?: string;
|
|
99
99
|
/**
|
|
@@ -16,14 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
import * as electron from '../../../electron-shared/electron';
|
|
18
18
|
import * as electronRemote from '../../../electron-shared/@electron/remote';
|
|
19
|
-
import { inject, injectable } from 'inversify';
|
|
19
|
+
import { inject, injectable, postConstruct } from 'inversify';
|
|
20
|
+
import { Command, CommandContribution, CommandRegistry, isOSX, isWindows, MenuModelRegistry, MenuContribution, Disposable, nls } from '../../common';
|
|
20
21
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from '../../common';
|
|
24
|
-
import {
|
|
25
|
-
codicon, ConfirmDialog, KeybindingContribution, KeybindingRegistry,
|
|
26
|
-
PreferenceScope, Widget, FrontendApplication, FrontendApplicationContribution, CommonMenus, CommonCommands, Dialog,
|
|
22
|
+
codicon, ConfirmDialog, KeybindingContribution, KeybindingRegistry, PreferenceScope, Widget,
|
|
23
|
+
FrontendApplication, FrontendApplicationContribution, CommonMenus, CommonCommands, Dialog, Message, ApplicationShell,
|
|
27
24
|
} from '../../browser';
|
|
28
25
|
import { ElectronMainMenuFactory } from './electron-main-menu-factory';
|
|
29
26
|
import { FrontendApplicationStateService, FrontendApplicationState } from '../../browser/frontend-application-state';
|
|
@@ -32,6 +29,7 @@ import { RequestTitleBarStyle, Restart, TitleBarStyleAtStartup, TitleBarStyleCha
|
|
|
32
29
|
import { ZoomLevel } from '../window/electron-window-preferences';
|
|
33
30
|
import { BrowserMenuBarContribution } from '../../browser/menu/browser-menu-plugin';
|
|
34
31
|
import { WindowService } from '../../browser/window/window-service';
|
|
32
|
+
import { WindowTitleService } from '../../browser/window/window-title-service';
|
|
35
33
|
|
|
36
34
|
import '../../../src/electron-browser/menu/electron-menu-style.css';
|
|
37
35
|
|
|
@@ -80,6 +78,9 @@ export namespace ElectronMenus {
|
|
|
80
78
|
export const FILE_CLOSE = [...CommonMenus.FILE_CLOSE, 'window-close'];
|
|
81
79
|
}
|
|
82
80
|
|
|
81
|
+
export const CustomTitleWidgetFactory = Symbol('CustomTitleWidgetFactory');
|
|
82
|
+
export type CustomTitleWidgetFactory = () => Widget | undefined;
|
|
83
|
+
|
|
83
84
|
@injectable()
|
|
84
85
|
export class ElectronMenuContribution extends BrowserMenuBarContribution implements FrontendApplicationContribution, CommandContribution, MenuContribution, KeybindingContribution {
|
|
85
86
|
|
|
@@ -89,6 +90,9 @@ export class ElectronMenuContribution extends BrowserMenuBarContribution impleme
|
|
|
89
90
|
@inject(WindowService)
|
|
90
91
|
protected readonly windowService: WindowService;
|
|
91
92
|
|
|
93
|
+
@inject(CustomTitleWidgetFactory)
|
|
94
|
+
protected readonly customTitleWidgetFactory: CustomTitleWidgetFactory;
|
|
95
|
+
|
|
92
96
|
protected titleBarStyleChangeFlag = false;
|
|
93
97
|
protected titleBarStyle?: string;
|
|
94
98
|
|
|
@@ -212,6 +216,7 @@ export class ElectronMenuContribution extends BrowserMenuBarContribution impleme
|
|
|
212
216
|
dragPanel.id = 'theia-drag-panel';
|
|
213
217
|
app.shell.addWidget(dragPanel, { area: 'top' });
|
|
214
218
|
this.appendMenu(app.shell);
|
|
219
|
+
this.createCustomTitleWidget(app);
|
|
215
220
|
const controls = document.createElement('div');
|
|
216
221
|
controls.id = 'window-controls';
|
|
217
222
|
controls.append(
|
|
@@ -224,6 +229,13 @@ export class ElectronMenuContribution extends BrowserMenuBarContribution impleme
|
|
|
224
229
|
this.handleWindowControls(electronWindow);
|
|
225
230
|
}
|
|
226
231
|
|
|
232
|
+
protected createCustomTitleWidget(app: FrontendApplication): void {
|
|
233
|
+
const titleWidget = this.customTitleWidgetFactory();
|
|
234
|
+
if (titleWidget) {
|
|
235
|
+
app.shell.addWidget(titleWidget, { area: 'top' });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
227
239
|
protected handleWindowControls(electronWindow: electron.BrowserWindow): void {
|
|
228
240
|
toggleControlButtons();
|
|
229
241
|
electronWindow.on('maximize', toggleControlButtons);
|
|
@@ -414,3 +426,71 @@ export class ElectronMenuContribution extends BrowserMenuBarContribution impleme
|
|
|
414
426
|
}
|
|
415
427
|
|
|
416
428
|
}
|
|
429
|
+
|
|
430
|
+
@injectable()
|
|
431
|
+
export class CustomTitleWidget extends Widget {
|
|
432
|
+
|
|
433
|
+
@inject(ElectronMenuContribution)
|
|
434
|
+
protected readonly electronMenuContribution: ElectronMenuContribution;
|
|
435
|
+
|
|
436
|
+
@inject(WindowTitleService)
|
|
437
|
+
protected readonly windowTitleService: WindowTitleService;
|
|
438
|
+
|
|
439
|
+
@inject(ApplicationShell)
|
|
440
|
+
protected readonly applicationShell: ApplicationShell;
|
|
441
|
+
|
|
442
|
+
constructor() {
|
|
443
|
+
super();
|
|
444
|
+
this.id = 'theia-custom-title';
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
@postConstruct()
|
|
448
|
+
protected init(): void {
|
|
449
|
+
this.updateTitle(this.windowTitleService.title);
|
|
450
|
+
this.windowTitleService.onDidChangeTitle(title => {
|
|
451
|
+
this.updateTitle(title);
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
protected override onResize(msg: Widget.ResizeMessage): void {
|
|
456
|
+
this.adjustTitleToCenter();
|
|
457
|
+
super.onResize(msg);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
protected override onAfterShow(msg: Message): void {
|
|
461
|
+
this.adjustTitleToCenter();
|
|
462
|
+
super.onAfterShow(msg);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
protected updateTitle(title: string): void {
|
|
466
|
+
this.node.textContent = title;
|
|
467
|
+
this.adjustTitleToCenter();
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
protected adjustTitleToCenter(): void {
|
|
471
|
+
const menubar = this.electronMenuContribution.menuBar;
|
|
472
|
+
if (menubar) {
|
|
473
|
+
const titleWidth = this.node.clientWidth;
|
|
474
|
+
const margin = 16;
|
|
475
|
+
const leftMarker = menubar.node.offsetLeft + menubar.node.clientWidth + margin;
|
|
476
|
+
const panelWidth = this.applicationShell.topPanel.node.clientWidth;
|
|
477
|
+
const controlsWidth = 48 * 3; // Each window button has a width of 48px
|
|
478
|
+
const rightMarker = panelWidth - controlsWidth - margin;
|
|
479
|
+
|
|
480
|
+
let hidden = false;
|
|
481
|
+
let relative = false;
|
|
482
|
+
this.node.style.left = '50%';
|
|
483
|
+
// The title has not enough space between the menu and the window controls
|
|
484
|
+
// So we simply hide it
|
|
485
|
+
if (rightMarker - leftMarker < titleWidth) {
|
|
486
|
+
hidden = true;
|
|
487
|
+
} else if ((panelWidth - titleWidth) / 2 < leftMarker || (panelWidth + titleWidth) / 2 > rightMarker) {
|
|
488
|
+
// This indicates that the title has either hit the left (menu) or right (window controls) marker
|
|
489
|
+
relative = true;
|
|
490
|
+
this.node.style.left = `${leftMarker + (rightMarker - leftMarker - titleWidth) / 2}px`;
|
|
491
|
+
}
|
|
492
|
+
this.node.classList.toggle('hidden', hidden);
|
|
493
|
+
this.node.classList.toggle('relative', relative);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
@@ -19,7 +19,7 @@ import { CommandContribution, MenuContribution } from '../../common';
|
|
|
19
19
|
import { FrontendApplicationContribution, ContextMenuRenderer, KeybindingContribution, KeybindingContext } from '../../browser';
|
|
20
20
|
import { ElectronMainMenuFactory } from './electron-main-menu-factory';
|
|
21
21
|
import { ElectronContextMenuRenderer, ElectronTextInputContextMenuContribution } from './electron-context-menu-renderer';
|
|
22
|
-
import { ElectronMenuContribution } from './electron-menu-contribution';
|
|
22
|
+
import { CustomTitleWidget, CustomTitleWidgetFactory, ElectronMenuContribution } from './electron-menu-contribution';
|
|
23
23
|
|
|
24
24
|
export default new ContainerModule(bind => {
|
|
25
25
|
bind(ElectronMainMenuFactory).toSelf().inSingletonScope();
|
|
@@ -33,6 +33,8 @@ export default new ContainerModule(bind => {
|
|
|
33
33
|
for (const serviceIdentifier of [FrontendApplicationContribution, KeybindingContribution, CommandContribution, MenuContribution]) {
|
|
34
34
|
bind(serviceIdentifier).toService(ElectronMenuContribution);
|
|
35
35
|
}
|
|
36
|
+
bind(CustomTitleWidget).toSelf().inSingletonScope();
|
|
37
|
+
bind(CustomTitleWidgetFactory).toFactory(context => () => context.container.get(CustomTitleWidget));
|
|
36
38
|
bind(FrontendApplicationContribution).to(ElectronTextInputContextMenuContribution).inSingletonScope();
|
|
37
39
|
bind(MenuContribution).to(ElectronTextInputContextMenuContribution).inSingletonScope();
|
|
38
40
|
});
|
|
@@ -29,6 +29,31 @@
|
|
|
29
29
|
-webkit-app-region: no-drag;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
#theia-custom-title {
|
|
33
|
+
position: absolute;
|
|
34
|
+
left: 50%;
|
|
35
|
+
transform: translate(-50%, 0px);
|
|
36
|
+
line-height: 30px;
|
|
37
|
+
flex: 0 1 auto;
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
text-overflow: ellipsis;
|
|
42
|
+
margin-top: 2px;
|
|
43
|
+
margin-left: auto;
|
|
44
|
+
margin-right: auto;
|
|
45
|
+
zoom: 1;
|
|
46
|
+
-webkit-app-region: drag !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#theia-custom-title.relative {
|
|
50
|
+
transform: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#theia-custom-title.hidden {
|
|
54
|
+
visibility: hidden;
|
|
55
|
+
}
|
|
56
|
+
|
|
32
57
|
#window-controls {
|
|
33
58
|
display: grid;
|
|
34
59
|
grid-template-columns: repeat(3, 48px);
|
|
@@ -27,6 +27,7 @@ import { ElectronMessagingService } from './messaging/electron-messaging-service
|
|
|
27
27
|
import { ElectronConnectionHandler } from '../electron-common/messaging/electron-connection-handler';
|
|
28
28
|
import { ElectronSecurityTokenService } from './electron-security-token-service';
|
|
29
29
|
import { TheiaBrowserWindowOptions, TheiaElectronWindow, TheiaElectronWindowFactory, WindowApplicationConfig } from './theia-electron-window';
|
|
30
|
+
import { ElectronNativeKeymap } from './electron-native-keymap';
|
|
30
31
|
|
|
31
32
|
const electronSecurityToken: ElectronSecurityToken = { value: v4() };
|
|
32
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -59,4 +60,7 @@ export default new ContainerModule(bind => {
|
|
|
59
60
|
child.bind(WindowApplicationConfig).toConstantValue(config);
|
|
60
61
|
return child.get(TheiaElectronWindow);
|
|
61
62
|
});
|
|
63
|
+
|
|
64
|
+
bind(ElectronNativeKeymap).toSelf().inSingletonScope();
|
|
65
|
+
bind(ElectronMainApplicationContribution).toService(ElectronNativeKeymap);
|
|
62
66
|
});
|