@theia/core 1.53.0-next.6 → 1.53.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.
Files changed (142) hide show
  1. package/README.md +7 -7
  2. package/i18n/nls.cs.json +30 -0
  3. package/i18n/nls.de.json +30 -0
  4. package/i18n/nls.es.json +30 -0
  5. package/i18n/nls.fr.json +30 -0
  6. package/i18n/nls.hu.json +30 -0
  7. package/i18n/nls.it.json +30 -0
  8. package/i18n/nls.ja.json +30 -0
  9. package/i18n/nls.json +31 -1
  10. package/i18n/nls.ko.json +582 -0
  11. package/i18n/nls.pl.json +30 -0
  12. package/i18n/nls.pt-br.json +30 -0
  13. package/i18n/nls.ru.json +30 -0
  14. package/i18n/nls.tr.json +582 -0
  15. package/i18n/nls.zh-cn.json +30 -0
  16. package/i18n/nls.zh-tw.json +582 -0
  17. package/lib/browser/catalog.json +6801 -0
  18. package/lib/browser/context-key-service.d.ts +3 -2
  19. package/lib/browser/context-key-service.d.ts.map +1 -1
  20. package/lib/browser/context-key-service.js.map +1 -1
  21. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  22. package/lib/browser/frontend-application-module.js.map +1 -1
  23. package/lib/browser/json-schema-store.d.ts +0 -3
  24. package/lib/browser/json-schema-store.d.ts.map +1 -1
  25. package/lib/browser/json-schema-store.js +2 -12
  26. package/lib/browser/json-schema-store.js.map +1 -1
  27. package/lib/browser/opener-service.d.ts +5 -0
  28. package/lib/browser/opener-service.d.ts.map +1 -1
  29. package/lib/browser/opener-service.js +5 -2
  30. package/lib/browser/opener-service.js.map +1 -1
  31. package/lib/browser/saveable-service.d.ts.map +1 -1
  32. package/lib/browser/saveable-service.js +6 -2
  33. package/lib/browser/saveable-service.js.map +1 -1
  34. package/lib/browser/saveable.d.ts +17 -1
  35. package/lib/browser/saveable.d.ts.map +1 -1
  36. package/lib/browser/saveable.js +62 -1
  37. package/lib/browser/saveable.js.map +1 -1
  38. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.d.ts +2 -2
  39. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.d.ts.map +1 -1
  40. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.js.map +1 -1
  41. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.d.ts +6 -16
  42. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.d.ts.map +1 -1
  43. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.js +11 -29
  44. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.js.map +1 -1
  45. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.d.ts +39 -78
  46. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.d.ts.map +1 -1
  47. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.js +8 -39
  48. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.js.map +1 -1
  49. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts +10 -10
  50. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts.map +1 -1
  51. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js +43 -32
  52. package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js.map +1 -1
  53. package/lib/browser/view-container.d.ts +2 -2
  54. package/lib/browser/view-container.d.ts.map +1 -1
  55. package/lib/browser/view-container.js.map +1 -1
  56. package/lib/browser/widget-open-handler.d.ts +4 -1
  57. package/lib/browser/widget-open-handler.d.ts.map +1 -1
  58. package/lib/browser/widget-open-handler.js.map +1 -1
  59. package/lib/browser/widgets/index.d.ts +1 -0
  60. package/lib/browser/widgets/index.d.ts.map +1 -1
  61. package/lib/browser/widgets/index.js +1 -0
  62. package/lib/browser/widgets/index.js.map +1 -1
  63. package/lib/browser/widgets/split-widget.d.ts +45 -0
  64. package/lib/browser/widgets/split-widget.d.ts.map +1 -0
  65. package/lib/browser/widgets/split-widget.js +126 -0
  66. package/lib/browser/widgets/split-widget.js.map +1 -0
  67. package/lib/common/event.d.ts +2 -0
  68. package/lib/common/event.d.ts.map +1 -1
  69. package/lib/common/event.js +4 -0
  70. package/lib/common/event.js.map +1 -1
  71. package/lib/common/json-schema.d.ts +2 -0
  72. package/lib/common/json-schema.d.ts.map +1 -1
  73. package/lib/common/menu/menu-types.d.ts.map +1 -1
  74. package/lib/common/menu/menu-types.js.map +1 -1
  75. package/lib/electron-browser/electron-uri-handler.d.ts +6 -0
  76. package/lib/electron-browser/electron-uri-handler.d.ts.map +1 -0
  77. package/lib/electron-browser/electron-uri-handler.js +49 -0
  78. package/lib/electron-browser/electron-uri-handler.js.map +1 -0
  79. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +1 -1
  80. package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
  81. package/lib/electron-browser/menu/electron-main-menu-factory.js +6 -6
  82. package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
  83. package/lib/electron-browser/preload.d.ts.map +1 -1
  84. package/lib/electron-browser/preload.js +12 -0
  85. package/lib/electron-browser/preload.js.map +1 -1
  86. package/lib/electron-browser/window/electron-window-module.d.ts.map +1 -1
  87. package/lib/electron-browser/window/electron-window-module.js +3 -0
  88. package/lib/electron-browser/window/electron-window-module.js.map +1 -1
  89. package/lib/electron-browser/window/external-app-open-handler.js +1 -1
  90. package/lib/electron-browser/window/external-app-open-handler.js.map +1 -1
  91. package/lib/electron-common/electron-api.d.ts +2 -0
  92. package/lib/electron-common/electron-api.d.ts.map +1 -1
  93. package/lib/electron-common/electron-api.js +2 -1
  94. package/lib/electron-common/electron-api.js.map +1 -1
  95. package/lib/electron-main/electron-api-main.d.ts +2 -0
  96. package/lib/electron-main/electron-api-main.d.ts.map +1 -1
  97. package/lib/electron-main/electron-api-main.js +27 -3
  98. package/lib/electron-main/electron-api-main.js.map +1 -1
  99. package/lib/electron-main/electron-main-application.d.ts +5 -3
  100. package/lib/electron-main/electron-main-application.d.ts.map +1 -1
  101. package/lib/electron-main/electron-main-application.js +57 -14
  102. package/lib/electron-main/electron-main-application.js.map +1 -1
  103. package/lib/electron-main/theia-electron-window.d.ts +1 -0
  104. package/lib/electron-main/theia-electron-window.d.ts.map +1 -1
  105. package/lib/electron-main/theia-electron-window.js +3 -0
  106. package/lib/electron-main/theia-electron-window.js.map +1 -1
  107. package/lib/node/i18n/theia-localization-contribution.d.ts.map +1 -1
  108. package/lib/node/i18n/theia-localization-contribution.js +12 -8
  109. package/lib/node/i18n/theia-localization-contribution.js.map +1 -1
  110. package/package.json +10 -8
  111. package/src/browser/context-key-service.ts +3 -3
  112. package/src/browser/frontend-application-module.ts +0 -1
  113. package/src/browser/json-schema-store.ts +2 -11
  114. package/src/browser/opener-service.ts +12 -2
  115. package/src/browser/saveable-service.ts +6 -2
  116. package/src/browser/saveable.ts +69 -1
  117. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.ts +2 -2
  118. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts +18 -33
  119. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.ts +62 -124
  120. package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx +40 -25
  121. package/src/browser/style/index.css +1 -0
  122. package/src/browser/style/split-widget.css +38 -0
  123. package/src/browser/style/tabs.css +13 -24
  124. package/src/browser/style/view-container.css +0 -7
  125. package/src/browser/view-container.ts +2 -2
  126. package/src/browser/widget-open-handler.ts +4 -1
  127. package/src/browser/widgets/index.ts +1 -0
  128. package/src/browser/widgets/split-widget.ts +163 -0
  129. package/src/common/event.ts +6 -0
  130. package/src/common/json-schema.ts +2 -0
  131. package/src/common/menu/menu-types.ts +1 -0
  132. package/src/electron-browser/electron-uri-handler.ts +42 -0
  133. package/src/electron-browser/menu/electron-main-menu-factory.ts +7 -6
  134. package/src/electron-browser/preload.ts +16 -1
  135. package/src/electron-browser/window/electron-window-module.ts +3 -0
  136. package/src/electron-browser/window/external-app-open-handler.ts +1 -1
  137. package/src/electron-common/electron-api.ts +3 -0
  138. package/src/electron-main/electron-api-main.ts +31 -5
  139. package/src/electron-main/electron-main-application.ts +62 -20
  140. package/src/electron-main/theia-electron-window.ts +5 -0
  141. package/src/node/i18n/theia-localization-contribution.ts +12 -8
  142. package/i18n/nls.pt-pt.json +0 -552
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as React from 'react';
18
- import { ArrayUtils, Event, isFunction, isObject, isString, MenuPath } from '../../../common';
18
+ import { ArrayUtils, Event, isFunction, isObject, MenuPath } from '../../../common';
19
19
  import { Widget } from '../../widgets';
20
20
 
21
21
  /** Items whose group is exactly 'navigation' will be rendered inline. */
@@ -32,58 +32,21 @@ export namespace TabBarDelegator {
32
32
  }
33
33
  }
34
34
 
35
- interface RegisteredToolbarItem {
35
+ export type TabBarToolbarItem = RenderedToolbarItem | ReactTabBarToolbarItem;
36
+
37
+ /**
38
+ * Representation of an item in the tab
39
+ */
40
+ export interface TabBarToolbarItemBase {
36
41
  /**
37
42
  * The unique ID of the toolbar item.
38
43
  */
39
44
  id: string;
40
- }
41
-
42
- interface RenderedToolbarItem {
43
- /**
44
- * Optional icon for the item.
45
- */
46
- icon?: string | (() => string);
47
-
48
- /**
49
- * Optional text of the item.
50
- *
51
- * Strings in the format `$(iconIdentifier~animationType) will be treated as icon references.
52
- * If the iconIdentifier begins with fa-, Font Awesome icons will be used; otherwise it will be treated as Codicon name.
53
- *
54
- * You can find Codicon classnames here: https://microsoft.github.io/vscode-codicons/dist/codicon.html
55
- * You can find Font Awesome classnames here: http://fontawesome.io/icons/
56
- * The type of animation can be either `spin` or `pulse`.
57
- */
58
- text?: string;
59
-
60
- /**
61
- * Optional tooltip for the item.
62
- */
63
- tooltip?: string;
64
- }
65
-
66
- interface SelfRenderingToolbarItem {
67
- render(widget?: Widget): React.ReactNode;
68
- }
69
-
70
- interface ExecutableToolbarItem {
71
45
  /**
72
46
  * The command to execute when the item is selected.
73
47
  */
74
- command: string;
75
- }
76
-
77
- export interface MenuToolbarItem {
78
- /**
79
- * A menu path with which this item is associated.
80
- * If accompanied by a command, this data will be passed to the {@link MenuCommandExecutor}.
81
- * If no command is present, this menu will be opened.
82
- */
83
- menuPath: MenuPath;
84
- }
48
+ command?: string;
85
49
 
86
- export interface ConditionalToolbarItem {
87
50
  /**
88
51
  * https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts
89
52
  */
@@ -98,61 +61,67 @@ export interface ConditionalToolbarItem {
98
61
  * Note: currently, each item of the container toolbar will be re-rendered if any of the items have changed.
99
62
  */
100
63
  onDidChange?: Event<void>;
101
- }
102
64
 
103
- interface InlineToolbarItemMetadata {
104
65
  /**
105
66
  * Priority among the items. Can be negative. The smaller the number the left-most the item will be placed in the toolbar. It is `0` by default.
106
67
  */
107
68
  priority?: number;
108
- group: 'navigation' | undefined;
109
- }
110
-
111
- interface MenuToolbarItemMetadata {
69
+ group?: string;
112
70
  /**
113
- * Optional group for the item. Default `navigation`.
114
- * `navigation` group will be inlined, while all the others will appear in the `...` dropdown.
115
- * A group in format `submenu_group_1/submenu 1/.../submenu_group_n/ submenu n/item_group` means that the item will be located in a submenu(s) of the `...` dropdown.
116
- * The submenu's title is named by the submenu section name, e.g. `group/<submenu name>/subgroup`.
71
+ * A menu path with which this item is associated.
72
+ * If accompanied by a command, this data will be passed to the {@link MenuCommandExecutor}.
73
+ * If no command is present, this menu will be opened.
117
74
  */
118
- group: string;
75
+ menuPath?: MenuPath;
76
+ contextKeyOverlays?: Record<string, string>;
119
77
  /**
120
78
  * Optional ordering string for placing the item within its group
121
79
  */
122
80
  order?: string;
123
81
  }
124
82
 
125
- /**
126
- * Representation of an item in the tab
127
- */
128
- export interface TabBarToolbarItem extends RegisteredToolbarItem,
129
- ExecutableToolbarItem,
130
- RenderedToolbarItem,
131
- Omit<ConditionalToolbarItem, 'isVisible'>,
132
- Pick<InlineToolbarItemMetadata, 'priority'>,
133
- Partial<MenuToolbarItem>,
134
- Partial<MenuToolbarItemMetadata> { }
83
+ export interface RenderedToolbarItem extends TabBarToolbarItemBase {
84
+ /**
85
+ * Optional icon for the item.
86
+ */
87
+ icon?: string | (() => string);
88
+
89
+ /**
90
+ * Optional text of the item.
91
+ *
92
+ * Strings in the format `$(iconIdentifier~animationType) will be treated as icon references.
93
+ * If the iconIdentifier begins with fa-, Font Awesome icons will be used; otherwise it will be treated as Codicon name.
94
+ *
95
+ * You can find Codicon classnames here: https://microsoft.github.io/vscode-codicons/dist/codicon.html
96
+ * You can find Font Awesome classnames here: http://fontawesome.io/icons/
97
+ * The type of animation can be either `spin` or `pulse`.
98
+ */
99
+ text?: string;
100
+
101
+ /**
102
+ * Optional tooltip for the item.
103
+ */
104
+ tooltip?: string;
105
+ }
135
106
 
136
107
  /**
137
108
  * Tab-bar toolbar item backed by a `React.ReactNode`.
138
109
  * Unlike the `TabBarToolbarItem`, this item is not connected to the command service.
139
110
  */
140
- export interface ReactTabBarToolbarItem extends RegisteredToolbarItem,
141
- SelfRenderingToolbarItem,
142
- ConditionalToolbarItem,
143
- Pick<InlineToolbarItemMetadata, 'priority'>,
144
- Pick<Partial<MenuToolbarItemMetadata>, 'group'> { }
145
-
146
- export interface AnyToolbarItem extends RegisteredToolbarItem,
147
- Partial<ExecutableToolbarItem>,
148
- Partial<RenderedToolbarItem>,
149
- Partial<SelfRenderingToolbarItem>,
150
- Partial<ConditionalToolbarItem>,
151
- Partial<MenuToolbarItem>,
152
- Pick<InlineToolbarItemMetadata, 'priority'>,
153
- Partial<MenuToolbarItemMetadata> { }
154
-
155
- export interface MenuDelegate extends MenuToolbarItem, Required<Pick<ConditionalToolbarItem, 'isVisible'>> { }
111
+ export interface ReactTabBarToolbarItem extends TabBarToolbarItemBase {
112
+ render(widget?: Widget): React.ReactNode;
113
+ }
114
+
115
+ export namespace ReactTabBarToolbarItem {
116
+ export function is(item: TabBarToolbarItem): item is ReactTabBarToolbarItem {
117
+ return isObject<ReactTabBarToolbarItem>(item) && typeof item.render === 'function';
118
+ }
119
+ }
120
+
121
+ export interface MenuDelegate {
122
+ menuPath: MenuPath;
123
+ isVisible(widget?: Widget): boolean;
124
+ }
156
125
 
157
126
  export namespace TabBarToolbarItem {
158
127
 
@@ -160,48 +129,17 @@ export namespace TabBarToolbarItem {
160
129
  * Compares the items by `priority` in ascending. Undefined priorities will be treated as `0`.
161
130
  */
162
131
  export const PRIORITY_COMPARATOR = (left: TabBarToolbarItem, right: TabBarToolbarItem) => {
163
- const leftGroup = left.group ?? NAVIGATION;
164
- const rightGroup = right.group ?? NAVIGATION;
165
- if (leftGroup === NAVIGATION && rightGroup !== NAVIGATION) { return ArrayUtils.Sort.LeftBeforeRight; }
166
- if (rightGroup === NAVIGATION && leftGroup !== NAVIGATION) { return ArrayUtils.Sort.RightBeforeLeft; }
167
- if (leftGroup !== rightGroup) { return leftGroup.localeCompare(rightGroup); }
132
+ const leftGroup: string = left.group ?? NAVIGATION;
133
+ const rightGroup: string = right.group ?? NAVIGATION;
134
+ if (leftGroup === NAVIGATION && rightGroup !== NAVIGATION) {
135
+ return ArrayUtils.Sort.LeftBeforeRight;
136
+ }
137
+ if (rightGroup === NAVIGATION && leftGroup !== NAVIGATION) {
138
+ return ArrayUtils.Sort.RightBeforeLeft;
139
+ }
140
+ if (leftGroup !== rightGroup) {
141
+ return leftGroup.localeCompare(rightGroup);
142
+ }
168
143
  return (left.priority || 0) - (right.priority || 0);
169
144
  };
170
-
171
- export function is(arg: unknown): arg is TabBarToolbarItem {
172
- return isObject<TabBarToolbarItem>(arg) && isString(arg.command);
173
- }
174
-
175
- }
176
-
177
- export namespace MenuToolbarItem {
178
- /**
179
- * Type guard for a toolbar item that actually is a menu item, amongst
180
- * the other kinds of item that it may also be.
181
- *
182
- * @param item a toolbar item
183
- * @returns whether the `item` is a menu item
184
- */
185
- export function is<T extends AnyToolbarItem>(item: T): item is T & MenuToolbarItem {
186
- return Array.isArray(item.menuPath);
187
- }
188
-
189
- export function getMenuPath(item: AnyToolbarItem): MenuPath | undefined {
190
- return Array.isArray(item.menuPath) ? item.menuPath : undefined;
191
- }
192
- }
193
-
194
- export namespace AnyToolbarItem {
195
- /**
196
- * Type guard for a toolbar item that actually manifests any of the
197
- * features of a conditional toolbar item.
198
- *
199
- * @param item a toolbar item
200
- * @returns whether the `item` is a conditional item
201
- */
202
- export function isConditional<T extends AnyToolbarItem>(item: T): item is T & ConditionalToolbarItem {
203
- return 'isVisible' in item && typeof item.isVisible === 'function'
204
- || 'onDidChange' in item && typeof item.onDidChange === 'function'
205
- || 'when' in item && typeof item.when === 'string';
206
- }
207
145
  }
@@ -16,13 +16,13 @@
16
16
 
17
17
  import { inject, injectable, postConstruct } from 'inversify';
18
18
  import * as React from 'react';
19
- import { ContextKeyService } from '../../context-key-service';
19
+ import { ContextKeyService, ContextMatcher } from '../../context-key-service';
20
20
  import { CommandRegistry, Disposable, DisposableCollection, MenuCommandExecutor, MenuModelRegistry, MenuPath, nls } from '../../../common';
21
21
  import { Anchor, ContextMenuAccess, ContextMenuRenderer } from '../../context-menu-renderer';
22
22
  import { LabelIcon, LabelParser } from '../../label-parser';
23
23
  import { ACTION_ITEM, codicon, ReactWidget, Widget } from '../../widgets';
24
24
  import { TabBarToolbarRegistry } from './tab-bar-toolbar-registry';
25
- import { AnyToolbarItem, ReactTabBarToolbarItem, TabBarDelegator, TabBarToolbarItem, TAB_BAR_TOOLBAR_CONTEXT_MENU, MenuToolbarItem } from './tab-bar-toolbar-types';
25
+ import { ReactTabBarToolbarItem, TabBarDelegator, TabBarToolbarItem, TAB_BAR_TOOLBAR_CONTEXT_MENU, RenderedToolbarItem } from './tab-bar-toolbar-types';
26
26
  import { KeybindingRegistry } from '../..//keybinding';
27
27
 
28
28
  /**
@@ -87,7 +87,7 @@ export class TabBarToolbar extends ReactWidget {
87
87
 
88
88
  const contextKeys = new Set<string>();
89
89
  for (const item of items.sort(TabBarToolbarItem.PRIORITY_COMPARATOR).reverse()) {
90
- if ('command' in item) {
90
+ if (item.command) {
91
91
  this.commands.getAllHandlers(item.command).forEach(handler => {
92
92
  if (handler.onDidChangeEnabled) {
93
93
  this.toDisposeOnUpdateItems.push(handler.onDidChangeEnabled(() => this.maybeUpdate()));
@@ -154,9 +154,13 @@ export class TabBarToolbar extends ReactWidget {
154
154
  this.keybindingContextKeys.clear();
155
155
  return <React.Fragment>
156
156
  {this.renderMore()}
157
- {[...this.inline.values()].map(item => TabBarToolbarItem.is(item)
158
- ? (MenuToolbarItem.is(item) && !item.command ? this.renderMenuItem(item) : this.renderItem(item))
159
- : item.render(this.current))}
157
+ {[...this.inline.values()].map(item => {
158
+ if (ReactTabBarToolbarItem.is(item)) {
159
+ return item.render(this.current);
160
+ } else {
161
+ return (item.menuPath && this.toolbarRegistry.isNonEmptyMenu(item, this.current) ? this.renderMenuItem(item) : this.renderItem(item));
162
+ }
163
+ })}
160
164
  </React.Fragment>;
161
165
  }
162
166
 
@@ -180,7 +184,7 @@ export class TabBarToolbar extends ReactWidget {
180
184
  return result;
181
185
  }
182
186
 
183
- protected renderItem(item: AnyToolbarItem): React.ReactNode {
187
+ protected renderItem(item: RenderedToolbarItem): React.ReactNode {
184
188
  let innerText = '';
185
189
  const classNames = [];
186
190
  const command = item.command ? this.commands.getCommand(item.command) : undefined;
@@ -222,13 +226,13 @@ export class TabBarToolbar extends ReactWidget {
222
226
  onMouseUp={this.onMouseUpEvent}
223
227
  onMouseOut={this.onMouseUpEvent} >
224
228
  <div id={item.id} className={classNames.join(' ')}
225
- onClick={this.executeCommand}
229
+ onClick={e => this.executeCommand(e, item)}
226
230
  title={tooltip}>{innerText}
227
231
  </div>
228
232
  </div>;
229
233
  }
230
234
 
231
- protected isEnabled(item: AnyToolbarItem): boolean {
235
+ protected isEnabled(item: TabBarToolbarItem): boolean {
232
236
  if (!!item.command) {
233
237
  return this.commandIsEnabled(item.command) && this.evaluateWhenClause(item.when);
234
238
  } else {
@@ -236,7 +240,7 @@ export class TabBarToolbar extends ReactWidget {
236
240
  }
237
241
  }
238
242
 
239
- protected getToolbarItemClassNames(item: AnyToolbarItem): string[] {
243
+ protected getToolbarItemClassNames(item: TabBarToolbarItem): string[] {
240
244
  const classNames = [TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM];
241
245
  if (item.command) {
242
246
  if (this.isEnabled(item)) {
@@ -279,7 +283,7 @@ export class TabBarToolbar extends ReactWidget {
279
283
  if (subpath) {
280
284
  toDisposeOnHide.push(this.menus.linkSubmenu(TAB_BAR_TOOLBAR_CONTEXT_MENU, subpath));
281
285
  } else {
282
- for (const item of this.more.values() as IterableIterator<AnyToolbarItem>) {
286
+ for (const item of this.more.values()) {
283
287
  if (item.menuPath && !item.command) {
284
288
  toDisposeOnHide.push(this.menus.linkSubmenu(TAB_BAR_TOOLBAR_CONTEXT_MENU, item.menuPath, undefined, item.group));
285
289
  } else if (item.command) {
@@ -293,10 +297,10 @@ export class TabBarToolbar extends ReactWidget {
293
297
  }
294
298
  }
295
299
  toDisposeOnHide.push(this.menus.registerMenuAction([...TAB_BAR_TOOLBAR_CONTEXT_MENU, ...item.group!.split('/')], {
296
- label: item.tooltip,
300
+ label: (item as RenderedToolbarItem).tooltip,
297
301
  commandId: item.command,
298
302
  when: item.when,
299
- order: item.order,
303
+ order: item.order
300
304
  }));
301
305
  }
302
306
  }
@@ -318,14 +322,26 @@ export class TabBarToolbar extends ReactWidget {
318
322
  * @param item a toolbar item that is a menu item
319
323
  * @returns the rendered toolbar item
320
324
  */
321
- protected renderMenuItem(item: TabBarToolbarItem & MenuToolbarItem): React.ReactNode {
322
- const icon = typeof item.icon === 'function' ? item.icon() : item.icon ?? 'ellipsis';
325
+ protected renderMenuItem(item: RenderedToolbarItem): React.ReactNode {
326
+ const command = item.command ? this.commands.getCommand(item.command) : undefined;
327
+ const icon = (typeof item.icon === 'function' && item.icon()) || item.icon as string || (command && command.iconClass) || 'ellipsis';
328
+
329
+ let contextMatcher: ContextMatcher = this.contextKeyService;
330
+ if (item.contextKeyOverlays) {
331
+ contextMatcher = this.contextKeyService.createOverlay(Object.keys(item.contextKeyOverlays).map(key => [key, item.contextKeyOverlays![key]]));
332
+ }
333
+
323
334
  return <div key={item.id}
324
335
  className={TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM + ' enabled menu'}
325
- onClick={this.showPopupMenu.bind(this, item.menuPath)}>
326
- <div id={item.id} className={codicon(icon, true)}
327
- title={item.text} />
328
- <div className={codicon('chevron-down') + ' chevron'} />
336
+ >
337
+ <div className={codicon(icon, true)}
338
+ title={item.text}
339
+ onClick={e => this.executeCommand(e, item)}
340
+ />
341
+ <div className={ACTION_ITEM} onClick={event => this.showPopupMenu(item.menuPath!, event, contextMatcher)}>
342
+ <div className={codicon('chevron-down') + ' chevron'} />
343
+ </div>
344
+
329
345
  </div >;
330
346
  }
331
347
 
@@ -336,11 +352,11 @@ export class TabBarToolbar extends ReactWidget {
336
352
  * @param menuPath the path of the registered menu to show
337
353
  * @param event the mouse event triggering the menu
338
354
  */
339
- protected showPopupMenu = (menuPath: MenuPath, event: React.MouseEvent) => {
355
+ protected showPopupMenu = (menuPath: MenuPath, event: React.MouseEvent, contextMatcher: ContextMatcher) => {
340
356
  event.stopPropagation();
341
357
  event.preventDefault();
342
358
  const anchor = this.toAnchor(event);
343
- this.renderPopupMenu(menuPath, anchor);
359
+ this.renderPopupMenu(menuPath, anchor, contextMatcher);
344
360
  };
345
361
 
346
362
  /**
@@ -350,7 +366,7 @@ export class TabBarToolbar extends ReactWidget {
350
366
  * @param anchor a description of where to render the menu
351
367
  * @returns platform-specific access to the rendered context menu
352
368
  */
353
- protected renderPopupMenu(menuPath: MenuPath, anchor: Anchor): ContextMenuAccess {
369
+ protected renderPopupMenu(menuPath: MenuPath, anchor: Anchor, contextMatcher: ContextMatcher): ContextMenuAccess {
354
370
  const toDisposeOnHide = new DisposableCollection();
355
371
  this.addClass('menu-open');
356
372
  toDisposeOnHide.push(Disposable.create(() => this.removeClass('menu-open')));
@@ -360,6 +376,7 @@ export class TabBarToolbar extends ReactWidget {
360
376
  args: [this.current],
361
377
  anchor,
362
378
  context: this.current?.node,
379
+ contextKeyService: contextMatcher,
363
380
  onHide: () => toDisposeOnHide.dispose()
364
381
  });
365
382
  }
@@ -380,12 +397,10 @@ export class TabBarToolbar extends ReactWidget {
380
397
  return whenClause ? this.contextKeyService.match(whenClause, this.current?.node) : true;
381
398
  }
382
399
 
383
- protected executeCommand = (e: React.MouseEvent<HTMLElement>) => {
400
+ protected executeCommand(e: React.MouseEvent<HTMLElement>, item: TabBarToolbarItem): void {
384
401
  e.preventDefault();
385
402
  e.stopPropagation();
386
403
 
387
- const item: AnyToolbarItem | undefined = this.inline.get(e.currentTarget.id);
388
-
389
404
  if (!item || !this.isEnabled(item)) {
390
405
  return;
391
406
  }
@@ -350,3 +350,4 @@ button.secondary[disabled],
350
350
  @import "./progress-bar.css";
351
351
  @import "./breadcrumbs.css";
352
352
  @import "./tooltip.css";
353
+ @import "./split-widget.css";
@@ -0,0 +1,38 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2024 1C-Soft LLC 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-only WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ .theia-split-widget > .p-SplitPanel {
18
+ height: 100%;
19
+ width: 100%;
20
+ outline: none;
21
+ }
22
+
23
+ .theia-split-widget > .p-SplitPanel > .p-SplitPanel-child {
24
+ min-width: 50px;
25
+ min-height: var(--theia-content-line-height);
26
+ }
27
+
28
+ .theia-split-widget > .p-SplitPanel > .p-SplitPanel-handle {
29
+ box-sizing: border-box;
30
+ }
31
+
32
+ .theia-split-widget > .p-SplitPanel[data-orientation="horizontal"] > .p-SplitPanel-handle {
33
+ border-left: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border);
34
+ }
35
+
36
+ .theia-split-widget > .p-SplitPanel[data-orientation="vertical"] > .p-SplitPanel-handle {
37
+ border-top: var(--theia-border-width) solid var(--theia-sideBarSectionHeader-border);
38
+ }
@@ -464,11 +464,16 @@
464
464
  }
465
465
 
466
466
  .p-TabBar-toolbar .item {
467
- display: flex;
468
- align-items: center;
469
- margin-left: 4px; /* `padding` + `margin-right` from the container toolbar */
470
467
  opacity: var(--theia-mod-disabled-opacity);
471
468
  cursor: default;
469
+ display: flex;
470
+ flex-direction: row;
471
+ column-gap: 0px;
472
+ align-items: centery;
473
+ }
474
+
475
+ .p-TabBar-toolbar .item>div {
476
+ height: 100%;
472
477
  }
473
478
 
474
479
  .p-TabBar-toolbar .item.enabled {
@@ -476,10 +481,6 @@
476
481
  cursor: pointer;
477
482
  }
478
483
 
479
- .p-TabBar-toolbar .item.enabled .action-label::before {
480
- display: flex;
481
- }
482
-
483
484
  .p-TabBar-toolbar :not(.item.enabled) .action-label {
484
485
  background: transparent;
485
486
  cursor: default;
@@ -491,8 +492,8 @@
491
492
  }
492
493
 
493
494
  .p-TabBar-toolbar .item > div {
494
- height: 18px;
495
- width: 18px;
495
+ line-height: calc(var(--theia-icon-size)+2px);
496
+ height: calc(var(--theia-icon-size)+2px);
496
497
  background-repeat: no-repeat;
497
498
  line-height: 18px;
498
499
  }
@@ -522,25 +523,13 @@
522
523
  background: var(--theia-icon-close) no-repeat;
523
524
  }
524
525
 
525
- /** Configure layout of a toolbar item that shows a pop-up menu. */
526
- .p-TabBar-toolbar .item.menu {
527
- display: grid;
528
- }
529
-
530
- /** The elements of the item that shows a pop-up menu are stack atop one other. */
531
- .p-TabBar-toolbar .item.menu > div {
532
- grid-area: 1 / 1;
533
- }
534
-
535
526
  /**
536
527
  * The chevron for the pop-up menu indication is shrunk and
537
528
  * stuffed in the bottom-right corner.
538
529
  */
539
- .p-TabBar-toolbar .item.menu > .chevron {
540
- scale: 50%;
541
- align-self: end;
542
- justify-self: end;
543
- translate: 5px 3px;
530
+ .p-TabBar-toolbar .item.menu .chevron {
531
+ font-size: 8px;
532
+ vertical-align: bottom;
544
533
  }
545
534
 
546
535
  #theia-main-content-panel
@@ -168,13 +168,6 @@
168
168
  padding-right: calc(var(--theia-ui-padding) * 2 / 3);
169
169
  }
170
170
 
171
- .theia-view-container-part-title .item > div {
172
- height: var(--theia-icon-size);
173
- width: var(--theia-icon-size);
174
- background-size: var(--theia-icon-size);
175
- line-height: var(--theia-icon-size);
176
- }
177
-
178
171
  .theia-view-container-part-title {
179
172
  display: none;
180
173
  }
@@ -29,7 +29,7 @@ import { MAIN_AREA_ID, BOTTOM_AREA_ID } from './shell/theia-dock-panel';
29
29
  import { FrontendApplicationStateService } from './frontend-application-state';
30
30
  import { ContextMenuRenderer, Anchor } from './context-menu-renderer';
31
31
  import { parseCssMagnitude } from './browser';
32
- import { TabBarToolbarRegistry, TabBarToolbarFactory, TabBarToolbar, TabBarDelegator, TabBarToolbarItem } from './shell/tab-bar-toolbar';
32
+ import { TabBarToolbarRegistry, TabBarToolbarFactory, TabBarToolbar, TabBarDelegator, RenderedToolbarItem } from './shell/tab-bar-toolbar';
33
33
  import { isEmpty, isObject, nls } from '../common';
34
34
  import { WidgetManager } from './widget-manager';
35
35
  import { Key } from './keys';
@@ -324,7 +324,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica
324
324
  return 'view';
325
325
  }
326
326
 
327
- protected registerToolbarItem(commandId: string, options?: Partial<Omit<TabBarToolbarItem, 'id' | 'command'>>): void {
327
+ protected registerToolbarItem(commandId: string, options?: Partial<Omit<RenderedToolbarItem, 'id' | 'command'>>): void {
328
328
  const newId = `${this.id}-tabbar-toolbar-${commandId}`;
329
329
  const existingHandler = this.commandRegistry.getAllHandlers(commandId)[0];
330
330
  const existingCommand = this.commandRegistry.getCommand(commandId);
@@ -24,7 +24,10 @@ import { WidgetManager } from './widget-manager';
24
24
 
25
25
  export type WidgetOpenMode = 'open' | 'reveal' | 'activate';
26
26
  /**
27
- * `WidgetOpenerOptions` define serializable generic options used by the {@link WidgetOpenHandler}.
27
+ * `WidgetOpenerOptions` define generic options used by the {@link WidgetOpenHandler}.
28
+ *
29
+ * _Note:_ This object may contain references to widgets (e.g. `widgetOptions.ref`);
30
+ * these need to be transformed before it can be serialized.
28
31
  */
29
32
  export interface WidgetOpenerOptions extends OpenerOptions {
30
33
  /**
@@ -18,3 +18,4 @@ export * from './widget';
18
18
  export * from './react-renderer';
19
19
  export * from './react-widget';
20
20
  export * from './extractable-widget';
21
+ export * from './split-widget';