@theia/core 1.66.0-next.67 → 1.66.0-next.73

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.
@@ -0,0 +1,258 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2025 TypeFox 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
+ /*
18
+ We need to explicitly select the specific panels
19
+ Otherwise, the codicon styles are applied to all codicons in the application.
20
+ This leads to issues in the side panels, where the codicons are supposed to use the foreground color.
21
+ */
22
+
23
+
24
+ :is(#theia-main-content-panel,
25
+ #theia-left-side-panel,
26
+ #theia-right-side-panel,
27
+ #theia-bottom-content-panel) .codicon.codicon-symbol-array {
28
+ color: var(--theia-symbolIcon-arrayForeground);
29
+ }
30
+
31
+ :is(#theia-main-content-panel,
32
+ #theia-left-side-panel,
33
+ #theia-right-side-panel,
34
+ #theia-bottom-content-panel) .codicon.codicon-symbol-boolean {
35
+ color: var(--theia-symbolIcon-booleanForeground);
36
+ }
37
+
38
+ :is(#theia-main-content-panel,
39
+ #theia-left-side-panel,
40
+ #theia-right-side-panel,
41
+ #theia-bottom-content-panel) .codicon.codicon-symbol-class {
42
+ color: var(--theia-symbolIcon-classForeground);
43
+ }
44
+
45
+ :is(#theia-main-content-panel,
46
+ #theia-left-side-panel,
47
+ #theia-right-side-panel,
48
+ #theia-bottom-content-panel) .codicon.codicon-symbol-method {
49
+ color: var(--theia-symbolIcon-methodForeground);
50
+ }
51
+
52
+ :is(#theia-main-content-panel,
53
+ #theia-left-side-panel,
54
+ #theia-right-side-panel,
55
+ #theia-bottom-content-panel) .codicon.codicon-symbol-color {
56
+ color: var(--theia-symbolIcon-colorForeground);
57
+ }
58
+
59
+ :is(#theia-main-content-panel,
60
+ #theia-left-side-panel,
61
+ #theia-right-side-panel,
62
+ #theia-bottom-content-panel) .codicon.codicon-symbol-constant {
63
+ color: var(--theia-symbolIcon-constantForeground);
64
+ }
65
+
66
+ :is(#theia-main-content-panel,
67
+ #theia-left-side-panel,
68
+ #theia-right-side-panel,
69
+ #theia-bottom-content-panel) .codicon.codicon-symbol-constructor {
70
+ color: var(--theia-symbolIcon-constructorForeground);
71
+ }
72
+
73
+ :is(#theia-main-content-panel,
74
+ #theia-left-side-panel,
75
+ #theia-right-side-panel,
76
+ #theia-bottom-content-panel) .codicon.codicon-symbol-value,
77
+ :is(#theia-main-content-panel,
78
+ #theia-left-side-panel,
79
+ #theia-right-side-panel,
80
+ #theia-bottom-content-panel) .codicon.codicon-symbol-enum {
81
+ color: var(--theia-symbolIcon-enumeratorForeground);
82
+ }
83
+
84
+ :is(#theia-main-content-panel,
85
+ #theia-left-side-panel,
86
+ #theia-right-side-panel,
87
+ #theia-bottom-content-panel) .codicon.codicon-symbol-enum-member {
88
+ color: var(--theia-symbolIcon-enumeratorMemberForeground);
89
+ }
90
+
91
+ :is(#theia-main-content-panel,
92
+ #theia-left-side-panel,
93
+ #theia-right-side-panel,
94
+ #theia-bottom-content-panel) .codicon.codicon-symbol-event {
95
+ color: var(--theia-symbolIcon-eventForeground);
96
+ }
97
+
98
+ :is(#theia-main-content-panel,
99
+ #theia-left-side-panel,
100
+ #theia-right-side-panel,
101
+ #theia-bottom-content-panel) .codicon.codicon-symbol-field {
102
+ color: var(--theia-symbolIcon-fieldForeground);
103
+ }
104
+
105
+ :is(#theia-main-content-panel,
106
+ #theia-left-side-panel,
107
+ #theia-right-side-panel,
108
+ #theia-bottom-content-panel) .codicon.codicon-symbol-file {
109
+ color: var(--theia-symbolIcon-fileForeground);
110
+ }
111
+
112
+ :is(#theia-main-content-panel,
113
+ #theia-left-side-panel,
114
+ #theia-right-side-panel,
115
+ #theia-bottom-content-panel) .codicon.codicon-symbol-folder {
116
+ color: var(--theia-symbolIcon-folderForeground);
117
+ }
118
+
119
+ :is(#theia-main-content-panel,
120
+ #theia-left-side-panel,
121
+ #theia-right-side-panel,
122
+ #theia-bottom-content-panel) .codicon.codicon-symbol-function {
123
+ color: var(--theia-symbolIcon-functionForeground);
124
+ }
125
+
126
+ :is(#theia-main-content-panel,
127
+ #theia-left-side-panel,
128
+ #theia-right-side-panel,
129
+ #theia-bottom-content-panel) .codicon.codicon-symbol-interface {
130
+ color: var(--theia-symbolIcon-interfaceForeground);
131
+ }
132
+
133
+ :is(#theia-main-content-panel,
134
+ #theia-left-side-panel,
135
+ #theia-right-side-panel,
136
+ #theia-bottom-content-panel) .codicon.codicon-symbol-key {
137
+ color: var(--theia-symbolIcon-keyForeground);
138
+ }
139
+
140
+ :is(#theia-main-content-panel,
141
+ #theia-left-side-panel,
142
+ #theia-right-side-panel,
143
+ #theia-bottom-content-panel) .codicon.codicon-symbol-keyword {
144
+ color: var(--theia-symbolIcon-keywordForeground);
145
+ }
146
+
147
+ :is(#theia-main-content-panel,
148
+ #theia-left-side-panel,
149
+ #theia-right-side-panel,
150
+ #theia-bottom-content-panel) .codicon.codicon-symbol-module {
151
+ color: var(--theia-symbolIcon-moduleForeground);
152
+ }
153
+
154
+ :is(#theia-main-content-panel,
155
+ #theia-left-side-panel,
156
+ #theia-right-side-panel,
157
+ #theia-bottom-content-panel) .codicon.codicon-symbol-namespace {
158
+ color: var(--theia-symbolIcon-namespaceForeground);
159
+ }
160
+
161
+ :is(#theia-main-content-panel,
162
+ #theia-left-side-panel,
163
+ #theia-right-side-panel,
164
+ #theia-bottom-content-panel) .codicon.codicon-symbol-null {
165
+ color: var(--theia-symbolIcon-nullForeground);
166
+ }
167
+
168
+ :is(#theia-main-content-panel,
169
+ #theia-left-side-panel,
170
+ #theia-right-side-panel,
171
+ #theia-bottom-content-panel) .codicon.codicon-symbol-number {
172
+ color: var(--theia-symbolIcon-numberForeground);
173
+ }
174
+
175
+ :is(#theia-main-content-panel,
176
+ #theia-left-side-panel,
177
+ #theia-right-side-panel,
178
+ #theia-bottom-content-panel) .codicon.codicon-symbol-object {
179
+ color: var(--theia-symbolIcon-objectForeground);
180
+ }
181
+
182
+ :is(#theia-main-content-panel,
183
+ #theia-left-side-panel,
184
+ #theia-right-side-panel,
185
+ #theia-bottom-content-panel) .codicon.codicon-symbol-operator {
186
+ color: var(--theia-symbolIcon-operatorForeground);
187
+ }
188
+
189
+ :is(#theia-main-content-panel,
190
+ #theia-left-side-panel,
191
+ #theia-right-side-panel,
192
+ #theia-bottom-content-panel) .codicon.codicon-symbol-package {
193
+ color: var(--theia-symbolIcon-packageForeground);
194
+ }
195
+
196
+ :is(#theia-main-content-panel,
197
+ #theia-left-side-panel,
198
+ #theia-right-side-panel,
199
+ #theia-bottom-content-panel) .codicon.codicon-symbol-property {
200
+ color: var(--theia-symbolIcon-propertyForeground);
201
+ }
202
+
203
+ :is(#theia-main-content-panel,
204
+ #theia-left-side-panel,
205
+ #theia-right-side-panel,
206
+ #theia-bottom-content-panel) .codicon.codicon-symbol-reference {
207
+ color: var(--theia-symbolIcon-referenceForeground);
208
+ }
209
+
210
+ :is(#theia-main-content-panel,
211
+ #theia-left-side-panel,
212
+ #theia-right-side-panel,
213
+ #theia-bottom-content-panel) .codicon.codicon-symbol-snippet {
214
+ color: var(--theia-symbolIcon-snippetForeground);
215
+ }
216
+
217
+ :is(#theia-main-content-panel,
218
+ #theia-left-side-panel,
219
+ #theia-right-side-panel,
220
+ #theia-bottom-content-panel) .codicon.codicon-symbol-string {
221
+ color: var(--theia-symbolIcon-stringForeground);
222
+ }
223
+
224
+
225
+ :is(#theia-main-content-panel,
226
+ #theia-left-side-panel,
227
+ #theia-right-side-panel,
228
+ #theia-bottom-content-panel) .codicon.codicon-symbol-struct {
229
+ color: var(--theia-symbolIcon-structForeground);
230
+ }
231
+
232
+ :is(#theia-main-content-panel,
233
+ #theia-left-side-panel,
234
+ #theia-right-side-panel,
235
+ #theia-bottom-content-panel) .codicon.codicon-symbol-text {
236
+ color: var(--theia-symbolIcon-textForeground);
237
+ }
238
+
239
+ :is(#theia-main-content-panel,
240
+ #theia-left-side-panel,
241
+ #theia-right-side-panel,
242
+ #theia-bottom-content-panel) .codicon.codicon-symbol-type-parameter {
243
+ color: var(--theia-symbolIcon-typeParameterForeground);
244
+ }
245
+
246
+ :is(#theia-main-content-panel,
247
+ #theia-left-side-panel,
248
+ #theia-right-side-panel,
249
+ #theia-bottom-content-panel) .codicon.codicon-symbol-unit {
250
+ color: var(--theia-symbolIcon-unitForeground);
251
+ }
252
+
253
+ :is(#theia-main-content-panel,
254
+ #theia-left-side-panel,
255
+ #theia-right-side-panel,
256
+ #theia-bottom-content-panel) .codicon.codicon-symbol-variable {
257
+ color: var(--theia-symbolIcon-variableForeground);
258
+ }
@@ -0,0 +1,242 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 TypeFox 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
+ import { injectable } from 'inversify';
18
+ import { ColorContribution } from './color-application-contribution';
19
+ import { ColorRegistry } from './color-registry';
20
+
21
+ @injectable()
22
+ export class SymbolIconColorContribution implements ColorContribution {
23
+ registerColors(colors: ColorRegistry): void {
24
+ colors.register(
25
+ {
26
+ id: 'symbolIcon.arrayForeground',
27
+ defaults: 'editor.foreground',
28
+ description: 'The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
29
+ },
30
+ {
31
+ id: 'symbolIcon.booleanForeground',
32
+ defaults: 'editor.foreground',
33
+ description: 'The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
34
+ },
35
+ {
36
+ id: 'symbolIcon.classForeground',
37
+ defaults: {
38
+ dark: '#EE9D28',
39
+ light: '#D67E00',
40
+ hcDark: '#EE9D28',
41
+ hcLight: '#D67E00'
42
+ },
43
+ description: 'The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
44
+ },
45
+ {
46
+ id: 'symbolIcon.colorForeground',
47
+ defaults: 'editor.foreground',
48
+ description: 'The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
49
+ },
50
+ {
51
+ id: 'symbolIcon.constantForeground',
52
+ defaults: 'editor.foreground',
53
+ description: 'The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
54
+ },
55
+ {
56
+ id: 'symbolIcon.constructorForeground',
57
+ defaults: {
58
+ dark: '#B180D7',
59
+ light: '#652D90',
60
+ hcDark: '#B180D7',
61
+ hcLight: '#652D90'
62
+ },
63
+ description: 'The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
64
+ },
65
+ {
66
+ id: 'symbolIcon.enumeratorForeground',
67
+ defaults: {
68
+ dark: '#EE9D28',
69
+ light: '#D67E00',
70
+ hcDark: '#EE9D28',
71
+ hcLight: '#D67E00'
72
+ },
73
+ description: 'The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
74
+ },
75
+ {
76
+ id: 'symbolIcon.enumeratorMemberForeground',
77
+ defaults: {
78
+ dark: '#75BEFF',
79
+ light: '#007ACC',
80
+ hcDark: '#75BEFF',
81
+ hcLight: '#007ACC'
82
+ },
83
+ description: 'The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
84
+ },
85
+ {
86
+ id: 'symbolIcon.eventForeground',
87
+ defaults: {
88
+ dark: '#EE9D28',
89
+ light: '#D67E00',
90
+ hcDark: '#EE9D28',
91
+ hcLight: '#D67E00'
92
+ },
93
+ description: 'The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
94
+ },
95
+ {
96
+ id: 'symbolIcon.fieldForeground',
97
+ defaults: {
98
+ dark: '#75BEFF',
99
+ light: '#007ACC',
100
+ hcDark: '#75BEFF',
101
+ hcLight: '#007ACC'
102
+ },
103
+ description: 'The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
104
+ },
105
+ {
106
+ id: 'symbolIcon.fileForeground',
107
+ defaults: 'editor.foreground',
108
+ description: 'The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
109
+ },
110
+ {
111
+ id: 'symbolIcon.folderForeground',
112
+ defaults: 'editor.foreground',
113
+ description: 'The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
114
+ },
115
+ {
116
+ id: 'symbolIcon.functionForeground',
117
+ defaults: {
118
+ dark: '#B180D7',
119
+ light: '#652D90',
120
+ hcDark: '#B180D7',
121
+ hcLight: '#652D90'
122
+ },
123
+ description: 'The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
124
+ },
125
+ {
126
+ id: 'symbolIcon.interfaceForeground',
127
+ defaults: {
128
+ dark: '#75BEFF',
129
+ light: '#007ACC',
130
+ hcDark: '#75BEFF',
131
+ hcLight: '#007ACC'
132
+ },
133
+ description: 'The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
134
+ },
135
+ {
136
+ id: 'symbolIcon.keyForeground',
137
+ defaults: 'editor.foreground',
138
+ description: 'The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
139
+ },
140
+ {
141
+ id: 'symbolIcon.keywordForeground',
142
+ defaults: 'editor.foreground',
143
+ description: 'The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
144
+ },
145
+ {
146
+ id: 'symbolIcon.methodForeground',
147
+ defaults: {
148
+ dark: '#B180D7',
149
+ light: '#652D90',
150
+ hcDark: '#B180D7',
151
+ hcLight: '#652D90'
152
+ },
153
+ description: 'The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
154
+ },
155
+ {
156
+ id: 'symbolIcon.moduleForeground',
157
+ defaults: 'editor.foreground',
158
+ description: 'The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
159
+ },
160
+ {
161
+ id: 'symbolIcon.namespaceForeground',
162
+ defaults: 'editor.foreground',
163
+ description: 'The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
164
+ },
165
+ {
166
+ id: 'symbolIcon.nullForeground',
167
+ defaults: 'editor.foreground',
168
+ description: 'The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
169
+ },
170
+ {
171
+ id: 'symbolIcon.numberForeground',
172
+ defaults: 'editor.foreground',
173
+ description: 'The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
174
+ },
175
+ {
176
+ id: 'symbolIcon.objectForeground',
177
+ defaults: 'editor.foreground',
178
+ description: 'The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
179
+ },
180
+ {
181
+ id: 'symbolIcon.operatorForeground',
182
+ defaults: 'editor.foreground',
183
+ description: 'The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
184
+ },
185
+ {
186
+ id: 'symbolIcon.packageForeground',
187
+ defaults: 'editor.foreground',
188
+ description: 'The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
189
+ },
190
+ {
191
+ id: 'symbolIcon.propertyForeground',
192
+ defaults: 'editor.foreground',
193
+ description: 'The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
194
+ },
195
+ {
196
+ id: 'symbolIcon.referenceForeground',
197
+ defaults: 'editor.foreground',
198
+ description: 'The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
199
+ },
200
+ {
201
+ id: 'symbolIcon.snippetForeground',
202
+ defaults: 'editor.foreground',
203
+ description: 'The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
204
+ },
205
+ {
206
+ id: 'symbolIcon.stringForeground',
207
+ defaults: 'editor.foreground',
208
+ description: 'The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
209
+ },
210
+ {
211
+ id: 'symbolIcon.structForeground',
212
+ defaults: 'editor.foreground',
213
+ description: 'The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
214
+ },
215
+ {
216
+ id: 'symbolIcon.textForeground',
217
+ defaults: 'editor.foreground',
218
+ description: 'The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
219
+ },
220
+ {
221
+ id: 'symbolIcon.typeParameterForeground',
222
+ defaults: 'editor.foreground',
223
+ description: 'The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
224
+ },
225
+ {
226
+ id: 'symbolIcon.unitForeground',
227
+ defaults: 'editor.foreground',
228
+ description: 'The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
229
+ },
230
+ {
231
+ id: 'symbolIcon.variableForeground',
232
+ defaults: {
233
+ dark: '#75BEFF',
234
+ light: '#007ACC',
235
+ hcDark: '#75BEFF',
236
+ hcLight: '#007ACC'
237
+ },
238
+ description: 'The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget.'
239
+ }
240
+ );
241
+ }
242
+ }
@@ -391,6 +391,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
391
391
  }
392
392
  this.rows = new Map(rowsToUpdate);
393
393
  this.update();
394
+ this.scheduleUpdateScrollToRow();
394
395
  }
395
396
 
396
397
  protected getDepthForNode(node: TreeNode, depths: Map<CompositeTreeNode | undefined, number>): number {
@@ -1661,18 +1662,36 @@ export namespace TreeWidget {
1661
1662
  export class View extends React.Component<ViewProps> {
1662
1663
  list: VirtuosoHandle | undefined;
1663
1664
  private lastScrollState: TreeScrollState = { scrollTop: 0, isAtBottom: true, scrollHeight: 0, clientHeight: 0 };
1665
+ /**
1666
+ * Ensure the selected row is scrolled into view when virtualization finishes updating.
1667
+ */
1668
+ protected readonly scrollIntoViewIfNeeded = () => {
1669
+ const { scrollToRow } = this.props;
1670
+ if (this.list && scrollToRow !== undefined) {
1671
+ this.list.scrollToIndex({
1672
+ index: scrollToRow,
1673
+ align: 'center',
1674
+ behavior: 'smooth'
1675
+ });
1676
+ }
1677
+ };
1678
+
1679
+ override componentDidMount(): void {
1680
+ this.scrollIntoViewIfNeeded();
1681
+ }
1682
+
1683
+ override componentDidUpdate(prevProps: ViewProps): void {
1684
+ if (this.props.scrollToRow !== prevProps.scrollToRow || this.props.rows !== prevProps.rows) {
1685
+ this.scrollIntoViewIfNeeded();
1686
+ }
1687
+ }
1664
1688
 
1665
1689
  override render(): React.ReactNode {
1666
1690
  const { rows, width, height, scrollToRow, renderNodeRow, onScrollEmitter, ...other } = this.props;
1667
1691
  return <Virtuoso
1668
1692
  ref={list => {
1669
1693
  this.list = (list || undefined);
1670
- if (this.list && scrollToRow !== undefined) {
1671
- this.list.scrollIntoView({
1672
- index: scrollToRow,
1673
- align: 'center'
1674
- });
1675
- }
1694
+ this.scrollIntoViewIfNeeded();
1676
1695
  }}
1677
1696
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1678
1697
  onScroll={(e: any) => {
@@ -14,6 +14,8 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
+ import { isObject } from './types';
18
+
17
19
  /**
18
20
  * Either be a reference to an existing color or a color value as a hex string, rgba, or hsla.
19
21
  */
@@ -36,12 +38,23 @@ export namespace Color {
36
38
  export function darken(v: string, f: number): ColorTransformation {
37
39
  return { v, f, kind: 'darken' };
38
40
  }
41
+ export function is(value: unknown): value is Color {
42
+ return typeof value === 'string' || (ColorTransformation.is(value) || RGBA.is(value) || HSLA.is(value));
43
+ }
39
44
  }
40
45
  export interface ColorTransformation {
41
46
  kind: 'transparent' | 'lighten' | 'darken'
42
47
  v: string
43
48
  f: number
44
49
  }
50
+ export namespace ColorTransformation {
51
+ export function is(value: unknown): value is ColorTransformation {
52
+ return isObject(value)
53
+ && (value.kind === 'transparent' || value.kind === 'lighten' || value.kind === 'darken')
54
+ && typeof value.v === 'string'
55
+ && typeof value.f === 'number';
56
+ }
57
+ }
45
58
  export interface RGBA {
46
59
  /**
47
60
  * Red: integer in [0-255]
@@ -63,6 +76,11 @@ export interface RGBA {
63
76
  */
64
77
  readonly a: number;
65
78
  }
79
+ export namespace RGBA {
80
+ export function is(value: unknown): value is RGBA {
81
+ return isObject(value) && typeof value.r === 'number' && typeof value.g === 'number' && typeof value.b === 'number' && typeof value.a === 'number';
82
+ }
83
+ }
66
84
  export interface HSLA {
67
85
  /**
68
86
  * Hue: integer in [0, 360]
@@ -81,6 +99,11 @@ export interface HSLA {
81
99
  */
82
100
  readonly a: number;
83
101
  }
102
+ export namespace HSLA {
103
+ export function is(value: unknown): value is HSLA {
104
+ return isObject(value) && typeof value.h === 'number' && typeof value.s === 'number' && typeof value.l === 'number' && typeof value.a === 'number';
105
+ }
106
+ }
84
107
 
85
108
  export interface ColorDefaults {
86
109
  light?: Color
@@ -91,9 +114,36 @@ export interface ColorDefaults {
91
114
  hcLight?: Color;
92
115
  }
93
116
 
117
+ export namespace ColorDefaults {
118
+ export function getLight(defaults: ColorDefaults | Color | undefined): Color | undefined {
119
+ if (Color.is(defaults)) {
120
+ return defaults;
121
+ }
122
+ return defaults?.light;
123
+ }
124
+ export function getDark(defaults: ColorDefaults | Color | undefined): Color | undefined {
125
+ if (Color.is(defaults)) {
126
+ return defaults;
127
+ }
128
+ return defaults?.dark;
129
+ }
130
+ export function getHCDark(defaults: ColorDefaults | Color | undefined): Color | undefined {
131
+ if (Color.is(defaults)) {
132
+ return defaults;
133
+ }
134
+ return defaults?.hcDark ?? defaults?.hc;
135
+ }
136
+ export function getHCLight(defaults: ColorDefaults | Color | undefined): Color | undefined {
137
+ if (Color.is(defaults)) {
138
+ return defaults;
139
+ }
140
+ return defaults?.hcLight;
141
+ }
142
+ }
143
+
94
144
  export interface ColorDefinition {
95
145
  id: string
96
- defaults?: ColorDefaults
146
+ defaults?: ColorDefaults | Color;
97
147
  description: string
98
148
  }
99
149
 
@@ -335,7 +335,7 @@ export class ElectronMenuContribution extends BrowserMenuBarContribution impleme
335
335
  registry.registerKeybindings(
336
336
  {
337
337
  command: ElectronCommands.TOGGLE_DEVELOPER_TOOLS.id,
338
- keybinding: 'ctrlcmd+alt+i'
338
+ keybinding: 'alt+f12'
339
339
  },
340
340
  {
341
341
  command: ElectronCommands.RELOAD.id,