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

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 (31) hide show
  1. package/README.md +1 -1
  2. package/lib/browser/frontend-application-module.d.ts.map +1 -1
  3. package/lib/browser/frontend-application-module.js +3 -0
  4. package/lib/browser/frontend-application-module.js.map +1 -1
  5. package/lib/browser/symbol-icon-color-contribution.d.ts +6 -0
  6. package/lib/browser/symbol-icon-color-contribution.d.ts.map +1 -0
  7. package/lib/browser/symbol-icon-color-contribution.js +212 -0
  8. package/lib/browser/symbol-icon-color-contribution.js.map +1 -0
  9. package/lib/browser/tree/tree-widget.d.ts +6 -0
  10. package/lib/browser/tree/tree-widget.d.ts.map +1 -1
  11. package/lib/browser/tree/tree-widget.js +23 -6
  12. package/lib/browser/tree/tree-widget.js.map +1 -1
  13. package/lib/common/color.d.ts +17 -1
  14. package/lib/common/color.d.ts.map +1 -1
  15. package/lib/common/color.js +62 -1
  16. package/lib/common/color.js.map +1 -1
  17. package/lib/common/preferences/preference-schema-service.d.ts +5 -3
  18. package/lib/common/preferences/preference-schema-service.d.ts.map +1 -1
  19. package/lib/common/preferences/preference-schema-service.js +13 -12
  20. package/lib/common/preferences/preference-schema-service.js.map +1 -1
  21. package/lib/electron-browser/menu/electron-menu-contribution.js +1 -1
  22. package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
  23. package/package.json +4 -4
  24. package/src/browser/frontend-application-module.ts +3 -0
  25. package/src/browser/style/index.css +1 -0
  26. package/src/browser/style/symbol-icon.css +258 -0
  27. package/src/browser/symbol-icon-color-contribution.ts +242 -0
  28. package/src/browser/tree/tree-widget.tsx +25 -6
  29. package/src/common/color.ts +51 -1
  30. package/src/common/preferences/preference-schema-service.ts +7 -6
  31. package/src/electron-browser/menu/electron-menu-contribution.ts +1 -1
@@ -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
 
@@ -25,8 +25,8 @@ import { PreferenceUtils } from './preference-provider';
25
25
  import { ContributionProvider } from '../contribution-provider';
26
26
  import { Deferred } from '../promise-util';
27
27
 
28
- const NO_OVERRIDE = {};
29
- const OVERRIDE_PROPERTY = '\\[(.*)\\]$';
28
+ export const NO_OVERRIDE = {};
29
+ export const OVERRIDE_PROPERTY = '\\[(.*)\\]$';
30
30
 
31
31
  @injectable()
32
32
  export class PreferenceSchemaServiceImpl implements PreferenceSchemaService {
@@ -125,7 +125,8 @@ export class PreferenceSchemaServiceImpl implements PreferenceSchemaService {
125
125
 
126
126
  for (const [key, property] of Object.entries(schema.properties)) {
127
127
  if (this.properties.has(key)) {
128
- throw new Error(`Property with id '${key}' already exists`);
128
+ console.warn(`Property with id '${key}' already exists`);
129
+ continue;
129
130
  }
130
131
 
131
132
  if (property.scope === undefined) {
@@ -344,14 +345,14 @@ export class PreferenceSchemaServiceImpl implements PreferenceSchemaService {
344
345
  return this.jsonSchemas[scope];
345
346
  }
346
347
 
347
- private setJSONSchemasProperty(key: string, property: PreferenceDataProperty): void {
348
+ protected setJSONSchemasProperty(key: string, property: PreferenceDataProperty): void {
348
349
  for (const scope of this.validScopes) {
349
350
  if (this.isValidInScope(key, scope)) {
350
351
  this.setJSONSchemaProperty(this.jsonSchemas[scope], key, property);
351
352
  }
352
353
  }
353
354
  }
354
- private deleteFromJSONSchemas(key: string, property: PreferenceDataProperty): void {
355
+ protected deleteFromJSONSchemas(key: string, property: PreferenceDataProperty): void {
355
356
  for (const scope of this.validScopes) {
356
357
  if (this.isValidInScope(key, scope)) {
357
358
  const schema = this.jsonSchemas[scope];
@@ -367,7 +368,7 @@ export class PreferenceSchemaServiceImpl implements PreferenceSchemaService {
367
368
  }
368
369
  }
369
370
 
370
- private setJSONSchemaProperty(schema: IJSONSchema, key: string, property: PreferenceDataProperty): void {
371
+ protected setJSONSchemaProperty(schema: IJSONSchema, key: string, property: PreferenceDataProperty): void {
371
372
  // Add property to the schema
372
373
  const prop = { ...property, default: this.getDefaultValue(key, undefined) };
373
374
  schema.properties![key] = prop;
@@ -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,