@theia/core 1.62.1 → 1.62.2

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 (58) hide show
  1. package/README.md +6 -6
  2. package/lib/browser/catalog.json +20 -7
  3. package/lib/browser/context-menu-renderer.d.ts.map +1 -1
  4. package/lib/browser/context-menu-renderer.js +4 -1
  5. package/lib/browser/context-menu-renderer.js.map +1 -1
  6. package/lib/browser/menu/browser-menu-plugin.d.ts.map +1 -1
  7. package/lib/browser/menu/browser-menu-plugin.js +0 -7
  8. package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
  9. package/lib/browser/secondary-window-handler.d.ts +1 -0
  10. package/lib/browser/secondary-window-handler.d.ts.map +1 -1
  11. package/lib/browser/secondary-window-handler.js +5 -3
  12. package/lib/browser/secondary-window-handler.js.map +1 -1
  13. package/lib/browser/shell/application-shell.d.ts +1 -0
  14. package/lib/browser/shell/application-shell.d.ts.map +1 -1
  15. package/lib/browser/shell/application-shell.js +9 -2
  16. package/lib/browser/shell/application-shell.js.map +1 -1
  17. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.d.ts +3 -3
  18. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.d.ts.map +1 -1
  19. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.js +3 -2
  20. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.js.map +1 -1
  21. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.d.ts.map +1 -1
  22. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.js +11 -9
  23. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.js.map +1 -1
  24. package/lib/browser/shell/tab-bar-toolbar/tab-toolbar-item.d.ts +1 -1
  25. package/lib/browser/shell/tab-bar-toolbar/tab-toolbar-item.d.ts.map +1 -1
  26. package/lib/browser/shell/tab-bars.js +1 -1
  27. package/lib/browser/shell/tab-bars.js.map +1 -1
  28. package/lib/browser/window/default-secondary-window-service.d.ts +1 -0
  29. package/lib/browser/window/default-secondary-window-service.d.ts.map +1 -1
  30. package/lib/browser/window/default-secondary-window-service.js +3 -0
  31. package/lib/browser/window/default-secondary-window-service.js.map +1 -1
  32. package/lib/browser/window/secondary-window-service.d.ts +1 -0
  33. package/lib/browser/window/secondary-window-service.d.ts.map +1 -1
  34. package/lib/common/index.d.ts +1 -0
  35. package/lib/common/index.d.ts.map +1 -1
  36. package/lib/common/index.js +1 -0
  37. package/lib/common/index.js.map +1 -1
  38. package/lib/common/menu/menu-model-registry.d.ts +1 -1
  39. package/lib/common/menu/menu-model-registry.d.ts.map +1 -1
  40. package/lib/common/menu/menu-model-registry.js +3 -0
  41. package/lib/common/menu/menu-model-registry.js.map +1 -1
  42. package/lib/common/menu/menu-types.d.ts +2 -2
  43. package/lib/common/menu/menu-types.d.ts.map +1 -1
  44. package/lib/common/menu/menu-types.js.map +1 -1
  45. package/package.json +6 -6
  46. package/src/browser/context-menu-renderer.ts +5 -2
  47. package/src/browser/menu/browser-menu-plugin.ts +0 -7
  48. package/src/browser/secondary-window-handler.ts +6 -3
  49. package/src/browser/shell/application-shell.ts +10 -2
  50. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.tsx +5 -5
  51. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts +14 -11
  52. package/src/browser/shell/tab-bar-toolbar/tab-toolbar-item.tsx +1 -1
  53. package/src/browser/shell/tab-bars.ts +1 -1
  54. package/src/browser/window/default-secondary-window-service.ts +4 -0
  55. package/src/browser/window/secondary-window-service.ts +1 -0
  56. package/src/common/index.ts +1 -0
  57. package/src/common/menu/menu-model-registry.ts +4 -1
  58. package/src/common/menu/menu-types.ts +2 -2
@@ -38,7 +38,7 @@ abstract class AbstractToolbarMenuWrapper {
38
38
  }
39
39
 
40
40
  protected abstract menuPath?: MenuPath;
41
- protected abstract menuNode: MenuNode;
41
+ protected abstract menuNode?: MenuNode;
42
42
  protected abstract id: string;
43
43
  protected abstract icon: string | undefined;
44
44
  protected abstract tooltip: string | undefined;
@@ -61,7 +61,7 @@ abstract class AbstractToolbarMenuWrapper {
61
61
  return this.renderMenuItem(widget);
62
62
  }
63
63
 
64
- toMenuNode?(): MenuNode {
64
+ toMenuNode?(): MenuNode | undefined {
65
65
  return this.menuNode;
66
66
  }
67
67
 
@@ -194,7 +194,7 @@ export class ToolbarSubmenuWrapper extends AbstractToolbarMenuWrapper implements
194
194
  if (this.toolbarItem.isVisible && !this.toolbarItem.isVisible(widget)) {
195
195
  return false;
196
196
  }
197
- if (!menuNode.isVisible(this.effectiveMenuPath, this.contextKeyService, widget.node, widget)) {
197
+ if (!menuNode?.isVisible(this.effectiveMenuPath, this.contextKeyService, widget.node, widget)) {
198
198
  return false;
199
199
  }
200
200
  if (this.toolbarItem.command) {
@@ -225,14 +225,14 @@ export class ToolbarSubmenuWrapper extends AbstractToolbarMenuWrapper implements
225
225
  get tooltip(): string | undefined { return this.toolbarItem.tooltip; }
226
226
  get text(): string | undefined { return (this.toolbarItem.group === NAVIGATION || this.toolbarItem.group === undefined) ? undefined : this.toolbarItem.text; }
227
227
  get onDidChange(): Event<void> | undefined {
228
- return this.menuNode.onDidChange;
228
+ return this.menuNode?.onDidChange;
229
229
  }
230
230
 
231
231
  get menuPath(): MenuPath {
232
232
  return this.toolbarItem.menuPath!;
233
233
  }
234
234
 
235
- get menuNode(): MenuNode {
235
+ get menuNode(): MenuNode | undefined {
236
236
  return this.menuRegistry.getMenu(this.menuPath);
237
237
  }
238
238
  }
@@ -138,19 +138,22 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
138
138
 
139
139
  for (const delegate of this.menuDelegates.values()) {
140
140
  if (delegate.isVisible(widget)) {
141
- const menu = this.menuRegistry.getMenu(delegate.menuPath)!;
142
- for (const child of menu.children) {
143
- if (child.isVisible([...delegate.menuPath, child.id], this.contextKeyService, widget.node)) {
144
- if (CompoundMenuNode.is(child)) {
145
- for (const grandchild of child.children) {
146
- if (grandchild.isVisible([...delegate.menuPath, child.id, grandchild.id], this.contextKeyService, widget.node) && RenderedMenuNode.is(grandchild)) {
147
- result.push(new ToolbarMenuNodeWrapper([...delegate.menuPath, child.id, grandchild.id], this.commandRegistry, this.menuRegistry,
148
- this.contextKeyService, this.contextMenuRenderer, grandchild, child.id, delegate.menuPath));
141
+ const menu = this.menuRegistry.getMenu(delegate.menuPath);
142
+ if (menu) {
143
+ for (const child of menu.children) {
144
+ if (child.isVisible([...delegate.menuPath, child.id], this.contextKeyService, widget.node)) {
145
+ if (CompoundMenuNode.is(child)) {
146
+ for (const grandchild of child.children) {
147
+ if (grandchild.isVisible([...delegate.menuPath, child.id, grandchild.id],
148
+ this.contextKeyService, widget.node) && RenderedMenuNode.is(grandchild)) {
149
+ result.push(new ToolbarMenuNodeWrapper([...delegate.menuPath, child.id, grandchild.id], this.commandRegistry, this.menuRegistry,
150
+ this.contextKeyService, this.contextMenuRenderer, grandchild, child.id, delegate.menuPath));
151
+ }
149
152
  }
153
+ } else if (CommandMenu.is(child)) {
154
+ result.push(new ToolbarMenuNodeWrapper([...delegate.menuPath, child.id], this.commandRegistry, this.menuRegistry,
155
+ this.contextKeyService, this.contextMenuRenderer, child, undefined, delegate.menuPath));
150
156
  }
151
- } else if (CommandMenu.is(child)) {
152
- result.push(new ToolbarMenuNodeWrapper([...delegate.menuPath, child.id], this.commandRegistry, this.menuRegistry,
153
- this.contextKeyService, this.contextMenuRenderer, child, undefined, delegate.menuPath));
154
157
  }
155
158
  }
156
159
  }
@@ -34,7 +34,7 @@ export interface TabBarToolbarItem {
34
34
  onDidChange?: Event<void>;
35
35
  group?: string;
36
36
  priority?: number;
37
- toMenuNode?(): MenuNode;
37
+ toMenuNode?(): MenuNode | undefined;
38
38
  }
39
39
 
40
40
  /**
@@ -871,7 +871,7 @@ export class ScrollableTabBar extends TabBar<Widget> {
871
871
  window.requestAnimationFrame(() => {
872
872
  const tab = this.contentNode.children[index] as HTMLElement;
873
873
  if (tab && this.isVisible) {
874
- const parent = this.contentNode;
874
+ const parent = this.contentContainer;
875
875
  if (this.orientation === 'horizontal') {
876
876
  const scroll = parent.scrollLeft;
877
877
  const left = tab.offsetLeft;
@@ -189,6 +189,10 @@ export class DefaultSecondaryWindowService implements SecondaryWindowService {
189
189
  return [height, width, left, top];
190
190
  }
191
191
 
192
+ getWindows(): Window[] {
193
+ return this.secondaryWindows;
194
+ }
195
+
192
196
  focus(win: Window): void {
193
197
  win.focus();
194
198
  }
@@ -39,4 +39,5 @@ export interface SecondaryWindowService {
39
39
 
40
40
  /** Handles focussing the given secondary window in the browser and on Electron. */
41
41
  focus(win: Window): void;
42
+ getWindows(): Window[];
42
43
  }
@@ -22,6 +22,7 @@ export * from './contribution-filter';
22
22
  export * from './contribution-provider';
23
23
  export * from './disposable';
24
24
  export * from './event';
25
+ export * from './listener';
25
26
  export * from './logger';
26
27
  export * from './lsp-types';
27
28
  export * from './menu';
@@ -326,8 +326,11 @@ export class MenuModelRegistry {
326
326
  return this.findInNode(this.root, menuPath, 0);
327
327
  }
328
328
 
329
- getMenu(menuPath: MenuPath): CompoundMenuNode {
329
+ getMenu(menuPath: MenuPath): CompoundMenuNode | undefined {
330
330
  const node = this.getMenuNode(menuPath);
331
+ if (!node) {
332
+ return undefined;
333
+ }
331
334
  if (!CompoundMenuNode.is(node)) {
332
335
  throw new Error(`not a compound menu node: ${JSON.stringify(menuPath)}`);
333
336
  }
@@ -97,7 +97,7 @@ export interface RenderedMenuNode extends MenuNode {
97
97
  }
98
98
 
99
99
  export namespace RenderedMenuNode {
100
- export function is(node: object): node is RenderedMenuNode {
100
+ export function is(node: unknown): node is RenderedMenuNode {
101
101
  return isObject<RenderedMenuNode>(node) && typeof node.label === 'string';
102
102
  }
103
103
  }
@@ -105,7 +105,7 @@ export namespace RenderedMenuNode {
105
105
  export type CommandMenu = MenuNode & RenderedMenuNode & Action;
106
106
 
107
107
  export namespace CommandMenu {
108
- export function is(node: MenuNode): node is CommandMenu {
108
+ export function is(node: MenuNode | undefined): node is CommandMenu {
109
109
  return RenderedMenuNode.is(node) && Action.is(node);
110
110
  }
111
111
  }