@codingame/monaco-vscode-theme-service-override 26.2.2 → 28.0.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.
@@ -16,7 +16,7 @@ function registerColorThemeExtensionPoint() {
16
16
  return ExtensionsRegistry.registerExtensionPoint({
17
17
  extensionPoint: "themes",
18
18
  jsonSchema: {
19
- description: ( localize(15054, "Contributes textmate color themes.")),
19
+ description: ( localize(16179, "Contributes textmate color themes.")),
20
20
  type: "array",
21
21
  items: {
22
22
  type: "object",
@@ -30,16 +30,16 @@ function registerColorThemeExtensionPoint() {
30
30
  }],
31
31
  properties: {
32
32
  id: {
33
- description: ( localize(15055, "Id of the color theme as used in the user settings.")),
33
+ description: ( localize(16180, "Id of the color theme as used in the user settings.")),
34
34
  type: "string"
35
35
  },
36
36
  label: {
37
- description: ( localize(15056, "Label of the color theme as shown in the UI.")),
37
+ description: ( localize(16181, "Label of the color theme as shown in the UI.")),
38
38
  type: "string"
39
39
  },
40
40
  uiTheme: {
41
41
  description: ( localize(
42
- 15057,
42
+ 16182,
43
43
  "Base theme defining the colors around the editor: 'vs' is the light color theme, 'vs-dark' is the dark color theme. 'hc-black' is the dark high contrast theme, 'hc-light' is the light high contrast theme."
44
44
  )),
45
45
  enum: [
@@ -51,7 +51,7 @@ function registerColorThemeExtensionPoint() {
51
51
  },
52
52
  path: {
53
53
  description: ( localize(
54
- 15058,
54
+ 16183,
55
55
  "Path of the tmTheme file. The path is relative to the extension folder and is typically './colorthemes/awesome-color-theme.json'."
56
56
  )),
57
57
  type: "string"
@@ -66,7 +66,7 @@ function registerFileIconThemeExtensionPoint() {
66
66
  return ExtensionsRegistry.registerExtensionPoint({
67
67
  extensionPoint: "iconThemes",
68
68
  jsonSchema: {
69
- description: ( localize(15059, "Contributes file icon themes.")),
69
+ description: ( localize(16184, "Contributes file icon themes.")),
70
70
  type: "array",
71
71
  items: {
72
72
  type: "object",
@@ -79,16 +79,16 @@ function registerFileIconThemeExtensionPoint() {
79
79
  }],
80
80
  properties: {
81
81
  id: {
82
- description: ( localize(15060, "Id of the file icon theme as used in the user settings.")),
82
+ description: ( localize(16185, "Id of the file icon theme as used in the user settings.")),
83
83
  type: "string"
84
84
  },
85
85
  label: {
86
- description: ( localize(15061, "Label of the file icon theme as shown in the UI.")),
86
+ description: ( localize(16186, "Label of the file icon theme as shown in the UI.")),
87
87
  type: "string"
88
88
  },
89
89
  path: {
90
90
  description: ( localize(
91
- 15062,
91
+ 16187,
92
92
  "Path of the file icon theme definition file. The path is relative to the extension folder and is typically './fileicons/awesome-icon-theme.json'."
93
93
  )),
94
94
  type: "string"
@@ -103,7 +103,7 @@ function registerProductIconThemeExtensionPoint() {
103
103
  return ExtensionsRegistry.registerExtensionPoint({
104
104
  extensionPoint: "productIconThemes",
105
105
  jsonSchema: {
106
- description: ( localize(15063, "Contributes product icon themes.")),
106
+ description: ( localize(16188, "Contributes product icon themes.")),
107
107
  type: "array",
108
108
  items: {
109
109
  type: "object",
@@ -116,16 +116,16 @@ function registerProductIconThemeExtensionPoint() {
116
116
  }],
117
117
  properties: {
118
118
  id: {
119
- description: ( localize(15064, "Id of the product icon theme as used in the user settings.")),
119
+ description: ( localize(16189, "Id of the product icon theme as used in the user settings.")),
120
120
  type: "string"
121
121
  },
122
122
  label: {
123
- description: ( localize(15065, "Label of the product icon theme as shown in the UI.")),
123
+ description: ( localize(16190, "Label of the product icon theme as shown in the UI.")),
124
124
  type: "string"
125
125
  },
126
126
  path: {
127
127
  description: ( localize(
128
- 15066,
128
+ 16191,
129
129
  "Path of the product icon theme definition file. The path is relative to the extension folder and is typically './producticons/awesome-product-icon-theme.json'."
130
130
  )),
131
131
  type: "string"
@@ -147,19 +147,19 @@ class ThemeDataRenderer extends Disposable {
147
147
  render(manifest) {
148
148
  const markdown = ( new MarkdownString());
149
149
  if (manifest.contributes?.themes) {
150
- markdown.appendMarkdown(`### ${( localize(15067, "Color Themes"))}\n\n`);
150
+ markdown.appendMarkdown(`### ${( localize(16192, "Color Themes"))}\n\n`);
151
151
  for (const theme of manifest.contributes.themes) {
152
152
  markdown.appendMarkdown(`- ${theme.label}\n`);
153
153
  }
154
154
  }
155
155
  if (manifest.contributes?.iconThemes) {
156
- markdown.appendMarkdown(`### ${( localize(15068, "File Icon Themes"))}\n\n`);
156
+ markdown.appendMarkdown(`### ${( localize(16193, "File Icon Themes"))}\n\n`);
157
157
  for (const theme of manifest.contributes.iconThemes) {
158
158
  markdown.appendMarkdown(`- ${theme.label}\n`);
159
159
  }
160
160
  }
161
161
  if (manifest.contributes?.productIconThemes) {
162
- markdown.appendMarkdown(`### ${( localize(15069, "Product Icon Themes"))}\n\n`);
162
+ markdown.appendMarkdown(`### ${( localize(16194, "Product Icon Themes"))}\n\n`);
163
163
  for (const theme of manifest.contributes.productIconThemes) {
164
164
  markdown.appendMarkdown(`- ${theme.label}\n`);
165
165
  }
@@ -172,7 +172,7 @@ class ThemeDataRenderer extends Disposable {
172
172
  }
173
173
  ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
174
174
  id: "themes",
175
- label: ( localize(15070, "Themes")),
175
+ label: ( localize(16195, "Themes")),
176
176
  access: {
177
177
  canToggle: false
178
178
  },
@@ -191,6 +191,7 @@ class ThemeRegistry {
191
191
  }
192
192
  dispose() {
193
193
  this.themesExtPoint.setHandler(() => {});
194
+ this.onDidChangeEmitter.dispose();
194
195
  }
195
196
  initialize() {
196
197
  this.themesExtPoint.setHandler((extensions, delta) => {
@@ -233,13 +234,13 @@ class ThemeRegistry {
233
234
  log
234
235
  ) {
235
236
  if (!Array.isArray(themeContributions)) {
236
- log?.error(( localize(15071, "Extension point `{0}` must be an array.", this.themesExtPoint.name)));
237
+ log?.error(( localize(16196, "Extension point `{0}` must be an array.", this.themesExtPoint.name)));
237
238
  return resultingThemes;
238
239
  }
239
240
  themeContributions.forEach(theme => {
240
241
  if (!theme.path || !isString(theme.path)) {
241
242
  log?.error(( localize(
242
- 15072,
243
+ 16197,
243
244
  "Expected string in `contributes.{0}.path`. Provided value: {1}",
244
245
  this.themesExtPoint.name,
245
246
  String(theme.path)
@@ -248,7 +249,7 @@ class ThemeRegistry {
248
249
  }
249
250
  if (this.idRequired && (!theme.id || !isString(theme.id))) {
250
251
  log?.error(( localize(
251
- 15073,
252
+ 16198,
252
253
  "Expected string in `contributes.{0}.id`. Provided value: {1}",
253
254
  this.themesExtPoint.name,
254
255
  String(theme.id)
@@ -258,7 +259,7 @@ class ThemeRegistry {
258
259
  const themeLocation = joinPath(extensionLocation, theme.path);
259
260
  if (!isEqualOrParent(themeLocation, extensionLocation)) {
260
261
  log?.warn(( localize(
261
- 15074,
262
+ 16199,
262
263
  "Expected `contributes.{0}.path` ({1}) to be included inside extension's folder ({2}). This might make the extension non-portable.",
263
264
  this.themesExtPoint.name,
264
265
  themeLocation.path,
@@ -1,90 +0,0 @@
1
- import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
2
- import { IJSONSchema } from "@codingame/monaco-vscode-api/vscode/vs/base/common/jsonSchema";
3
- import { IColorTheme } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService";
4
- export type SizeIdentifier = string;
5
- /**
6
- * Size value unit types supported by the registry
7
- */
8
- export type SizeUnit = "px" | "rem" | "em" | "%";
9
- /**
10
- * A size value with a numeric amount and unit
11
- */
12
- export interface SizeValue {
13
- readonly value: number;
14
- readonly unit: SizeUnit;
15
- }
16
- export interface SizeContribution {
17
- readonly id: SizeIdentifier;
18
- readonly description: string;
19
- readonly defaults: SizeDefaults | SizeValue | null;
20
- readonly deprecationMessage: string | undefined;
21
- }
22
- /**
23
- * Returns the css variable name for the given size identifier. Dots (`.`) are replaced with hyphens (`-`) and
24
- * everything is prefixed with `--vscode-`.
25
- *
26
- * @sample `editor.fontSize` is `--vscode-editor-fontSize`.
27
- */
28
- export declare function asCssVariableName(sizeIdent: SizeIdentifier): string;
29
- export declare function asCssVariable(size: SizeIdentifier): string;
30
- export declare function asCssVariableWithDefault(size: SizeIdentifier, defaultCssValue: string): string;
31
- export interface SizeDefaults {
32
- light: SizeValue | null;
33
- dark: SizeValue | null;
34
- hcDark: SizeValue | null;
35
- hcLight: SizeValue | null;
36
- }
37
- export declare function isSizeDefaults(value: unknown): value is SizeDefaults;
38
- /**
39
- * Helper function to create a size value
40
- */
41
- export declare function size(value: number, unit?: SizeUnit): SizeValue;
42
- /**
43
- * Helper function to create size defaults that use the same value for all themes
44
- */
45
- export declare function sizeForAllThemes(value: number, unit?: SizeUnit): SizeDefaults;
46
- /**
47
- * Convert a size value to a CSS string
48
- */
49
- export declare function sizeValueToCss(sizeValue: SizeValue): string;
50
- export declare const Extensions: {
51
- SizeContribution: string;
52
- };
53
- export declare const DEFAULT_SIZE_CONFIG_VALUE = "default";
54
- export interface ISizeRegistry {
55
- readonly onDidChangeSchema: Event<void>;
56
- /**
57
- * Register a size to the registry.
58
- * @param id The size id as used in theme description files
59
- * @param defaults The default values
60
- * @param description the description
61
- */
62
- registerSize(id: string, defaults: SizeDefaults | SizeValue | null, description: string): SizeIdentifier;
63
- /**
64
- * Deregister a size from the registry.
65
- */
66
- deregisterSize(id: string): void;
67
- /**
68
- * Get all size contributions
69
- */
70
- getSizes(): SizeContribution[];
71
- /**
72
- * Gets the default size of the given id
73
- */
74
- resolveDefaultSize(id: SizeIdentifier, theme: IColorTheme): SizeValue | undefined;
75
- /**
76
- * JSON schema for an object to assign size values to one of the size contributions.
77
- */
78
- getSizeSchema(): IJSONSchema;
79
- /**
80
- * JSON schema for a reference to a size contribution.
81
- */
82
- getSizeReferenceSchema(): IJSONSchema;
83
- /**
84
- * Notify when the color theme or settings change.
85
- */
86
- notifyThemeUpdate(theme: IColorTheme): void;
87
- }
88
- export declare function registerSize(id: string, defaults: SizeDefaults | SizeValue | null, description: string, deprecationMessage?: string): SizeIdentifier;
89
- export declare function getSizeRegistry(): ISizeRegistry;
90
- export declare const workbenchSizesSchemaId = "vscode://schemas/workbench-sizes";
@@ -1,142 +0,0 @@
1
-
2
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
3
- import { Extensions as Extensions$1 } from '@codingame/monaco-vscode-api/vscode/vs/platform/jsonschemas/common/jsonContributionRegistry';
4
- import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
5
- import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
- import { RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
7
-
8
- function asCssVariableName(sizeIdent) {
9
- return `--vscode-${sizeIdent.replace(/\./g, "-")}`;
10
- }
11
- function isSizeDefaults(value) {
12
- return value !== null && typeof value === "object" && "light" in value && "dark" in value;
13
- }
14
- function size(value, unit = "px") {
15
- return {
16
- value,
17
- unit
18
- };
19
- }
20
- function sizeForAllThemes(value, unit = "px") {
21
- const sizeValue = size(value, unit);
22
- return {
23
- light: sizeValue,
24
- dark: sizeValue,
25
- hcDark: sizeValue,
26
- hcLight: sizeValue
27
- };
28
- }
29
- function sizeValueToCss(sizeValue) {
30
- return `${sizeValue.value}${sizeValue.unit}`;
31
- }
32
- const Extensions = {
33
- SizeContribution: "base.contributions.sizes"
34
- };
35
- class SizeRegistry extends Disposable {
36
- constructor() {
37
- super();
38
- this._onDidChangeSchema = this._register(( new Emitter()));
39
- this.onDidChangeSchema = this._onDidChangeSchema.event;
40
- this.sizeSchema = {
41
- type: "object",
42
- properties: {}
43
- };
44
- this.sizeReferenceSchema = {
45
- type: "string",
46
- enum: [],
47
- enumDescriptions: []
48
- };
49
- this.sizesById = {};
50
- }
51
- notifyThemeUpdate(theme) {
52
- for (const key of ( Object.keys(this.sizesById))) {
53
- const sizeVal = this.resolveDefaultSize(key, theme);
54
- if (sizeVal) {
55
- this.sizeSchema.properties[key].default = sizeValueToCss(sizeVal);
56
- }
57
- }
58
- this._onDidChangeSchema.fire();
59
- }
60
- registerSize(id, defaults, description, deprecationMessage) {
61
- const sizeContribution = {
62
- id,
63
- description,
64
- defaults,
65
- deprecationMessage
66
- };
67
- this.sizesById[id] = sizeContribution;
68
- const propertySchema = {
69
- type: "string",
70
- pattern: "^(\\d+(\\.\\d+)?(px|rem|em|%))|default$",
71
- patternErrorMessage: "Size must be a number followed by px, rem, em, or % (e.g., \"12px\", \"1.5rem\") or \"default\""
72
- };
73
- if (deprecationMessage) {
74
- propertySchema.deprecationMessage = deprecationMessage;
75
- }
76
- this.sizeSchema.properties[id] = {
77
- description,
78
- ...propertySchema
79
- };
80
- this.sizeReferenceSchema.enum.push(id);
81
- this.sizeReferenceSchema.enumDescriptions.push(description);
82
- this._onDidChangeSchema.fire();
83
- return id;
84
- }
85
- deregisterSize(id) {
86
- delete this.sizesById[id];
87
- delete this.sizeSchema.properties[id];
88
- const index = this.sizeReferenceSchema.enum.indexOf(id);
89
- if (index !== -1) {
90
- this.sizeReferenceSchema.enum.splice(index, 1);
91
- this.sizeReferenceSchema.enumDescriptions.splice(index, 1);
92
- }
93
- this._onDidChangeSchema.fire();
94
- }
95
- getSizes() {
96
- return ( ( Object.keys(this.sizesById)).map(id => this.sizesById[id]));
97
- }
98
- resolveDefaultSize(id, theme) {
99
- const sizeDesc = this.sizesById[id];
100
- if (sizeDesc?.defaults) {
101
- const sizeValue = isSizeDefaults(sizeDesc.defaults) ? sizeDesc.defaults[theme.type] : sizeDesc.defaults;
102
- return sizeValue ?? undefined;
103
- }
104
- return undefined;
105
- }
106
- getSizeSchema() {
107
- return this.sizeSchema;
108
- }
109
- getSizeReferenceSchema() {
110
- return this.sizeReferenceSchema;
111
- }
112
- toString() {
113
- const sorter = (a, b) => {
114
- const cat1 = a.indexOf(".") === -1 ? 0 : 1;
115
- const cat2 = b.indexOf(".") === -1 ? 0 : 1;
116
- if (cat1 !== cat2) {
117
- return cat1 - cat2;
118
- }
119
- return a.localeCompare(b);
120
- };
121
- return ( ( Object.keys(this.sizesById)).sort(sorter).map(k => `- \`${k}\`: ${this.sizesById[k].description}`)).join("\n");
122
- }
123
- }
124
- const sizeRegistry = ( new SizeRegistry());
125
- Registry.add(Extensions.SizeContribution, sizeRegistry);
126
- function registerSize(id, defaults, description, deprecationMessage) {
127
- return sizeRegistry.registerSize(id, defaults, description, deprecationMessage);
128
- }
129
- function getSizeRegistry() {
130
- return sizeRegistry;
131
- }
132
- const workbenchSizesSchemaId = "vscode://schemas/workbench-sizes";
133
- const schemaRegistry = Registry.as(Extensions$1.JSONContribution);
134
- schemaRegistry.registerSchema(workbenchSizesSchemaId, sizeRegistry.getSizeSchema());
135
- const delayer = ( new RunOnceScheduler(() => schemaRegistry.notifySchemaChanged(workbenchSizesSchemaId), 200));
136
- sizeRegistry.onDidChangeSchema(() => {
137
- if (!delayer.isScheduled()) {
138
- delayer.schedule();
139
- }
140
- });
141
-
142
- export { Extensions, asCssVariableName, getSizeRegistry, isSizeDefaults, registerSize, size, sizeForAllThemes, sizeValueToCss, workbenchSizesSchemaId };
@@ -1,11 +0,0 @@
1
- export declare const bodyFontSize: string;
2
- export declare const bodyFontSizeSmall: string;
3
- export declare const bodyFontSizeXSmall: string;
4
- export declare const codiconFontSize: string;
5
- export declare const cornerRadiusMedium: string;
6
- export declare const cornerRadiusXSmall: string;
7
- export declare const cornerRadiusSmall: string;
8
- export declare const cornerRadiusLarge: string;
9
- export declare const cornerRadiusXLarge: string;
10
- export declare const cornerRadiusCircle: string;
11
- export declare const strokeThickness: string;
@@ -1,18 +0,0 @@
1
-
2
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
3
- import { registerSize, sizeForAllThemes } from '../sizeUtils.js';
4
-
5
- registerSize("bodyFontSize", sizeForAllThemes(13, "px"), ( localize(
6
- 2375,
7
- "Base font size. This size is used if not overridden by a component."
8
- )));
9
- registerSize("bodyFontSize.small", sizeForAllThemes(12, "px"), ( localize(2376, "Small font size for secondary content.")));
10
- registerSize("bodyFontSize.xSmall", sizeForAllThemes(11, "px"), ( localize(2377, "Extra small font size for less prominent content.")));
11
- registerSize("codiconFontSize", sizeForAllThemes(16, "px"), ( localize(2378, "Base font size for codicons.")));
12
- registerSize("cornerRadius.medium", sizeForAllThemes(6, "px"), ( localize(2379, "Base corner radius for UI elements.")));
13
- registerSize("cornerRadius.xSmall", sizeForAllThemes(2, "px"), ( localize(2380, "Extra small corner radius for very compact UI elements.")));
14
- registerSize("cornerRadius.small", sizeForAllThemes(4, "px"), ( localize(2381, "Small corner radius for compact UI elements.")));
15
- registerSize("cornerRadius.large", sizeForAllThemes(8, "px"), ( localize(2382, "Large corner radius for prominent UI elements.")));
16
- registerSize("cornerRadius.xLarge", sizeForAllThemes(12, "px"), ( localize(2383, "Extra large corner radius for very prominent UI elements.")));
17
- registerSize("cornerRadius.circle", sizeForAllThemes(9999, "px"), ( localize(2384, "Circular corner radius for fully rounded UI elements.")));
18
- registerSize("strokeThickness", sizeForAllThemes(1, "px"), ( localize(2385, "Base stroke thickness for borders and outlines.")));