chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -36,13 +36,13 @@ class ColorService {
|
||||
@named(ColorContribution)
|
||||
colorContributions: ContributionProvider<ColorContribution>;
|
||||
|
||||
/** 颜色表 */
|
||||
/** Color chart */
|
||||
private colors: Record<string, ColorDefinition> = {};
|
||||
|
||||
/** 颜色的 schema */
|
||||
/** Color schema */
|
||||
private schema: ColorSchemaType = { type: 'object', properties: {} };
|
||||
|
||||
/** 颜色偏好设置的 schema */
|
||||
/** Color preference schema */
|
||||
// private referenceSchema = { type: 'string', enum: [], enumDescriptions: [] };
|
||||
|
||||
init() {
|
||||
@@ -52,7 +52,7 @@ class ColorService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量注册 color
|
||||
* Bulk registration color
|
||||
*/
|
||||
register(...colors: ColorDefinition[]): Disposable[] {
|
||||
return colors.map(definition => {
|
||||
@@ -67,7 +67,7 @@ class ColorService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销 color
|
||||
* Logout color
|
||||
*/
|
||||
deregisterColor(id: string): void {
|
||||
delete this.colors[id];
|
||||
@@ -75,7 +75,7 @@ class ColorService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的 color definition
|
||||
* Get all color definitions
|
||||
*/
|
||||
getColors(): ColorDefinition[] {
|
||||
return Object.keys(this.colors).map(id => this.colors[id]);
|
||||
@@ -86,12 +86,12 @@ class ColorService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定 theme 的 color value
|
||||
* Gets the color value of the specified theme
|
||||
*/
|
||||
getThemeColor(id: string, themeType: ThemeType) {
|
||||
const color = this.getColor(id);
|
||||
let value = color.defaults?.[themeType];
|
||||
// 色值可以从其他色值继承
|
||||
// Color values can be inherited from other color values
|
||||
if (
|
||||
value &&
|
||||
typeof value === 'string' &&
|
||||
@@ -105,14 +105,14 @@ class ColorService {
|
||||
}
|
||||
|
||||
toCssColor(id: string, themeType: ThemeType) {
|
||||
// 转换为变量名
|
||||
// Convert to variable name
|
||||
const variableName = `--${id.replace(/\./g, '-')}`;
|
||||
const value = this.getThemeColor(id, themeType);
|
||||
return `${variableName}: ${value};`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有色值转化为 css 变量
|
||||
* All color values are converted to CSS variables
|
||||
*/
|
||||
toCss(themeType: ThemeType) {
|
||||
return `body {\n${this.getColors()
|
||||
|
||||
@@ -45,14 +45,14 @@ class StylingService {
|
||||
static readonly PREFIX = 'flowide';
|
||||
|
||||
/**
|
||||
* 后面移到 map 里面,现在暂时没想好
|
||||
* Move it to the map later, I haven't thought about it for the time being.
|
||||
*/
|
||||
private cssElement: HTMLStyleElement | undefined;
|
||||
|
||||
private css = new Map<string, HTMLStyleElement>();
|
||||
|
||||
/**
|
||||
* 收集所有 css 挂载到 <head> 上
|
||||
* Collect all css mounts to < head >
|
||||
*/
|
||||
apply(theme: Theme) {
|
||||
const rules: string[] = [];
|
||||
|
||||
@@ -41,13 +41,13 @@ class ThemeService {
|
||||
@inject(PreferencesManager)
|
||||
protected readonly preferencesManager: PreferencesManager;
|
||||
|
||||
/** 所有注册的 theme */
|
||||
/** All registered themes */
|
||||
private themes: Map<string, Theme> = new Map([
|
||||
[DEFAULT_THEME.type, DEFAULT_THEME],
|
||||
[DEFAULT_LIGHT_THEME.type, DEFAULT_LIGHT_THEME],
|
||||
]);
|
||||
|
||||
/** 当前 theme */
|
||||
/** Current theme */
|
||||
private current: Theme = DEFAULT_THEME;
|
||||
|
||||
private readonly themeChange = new Emitter<ThemeDidChangeEvent>();
|
||||
@@ -57,7 +57,7 @@ class ThemeService {
|
||||
|
||||
init() {
|
||||
this.changeWithPreferences();
|
||||
// 先手动触发一次 change 模拟从 preference 读取配置
|
||||
// First manually trigger a change simulation to read the configuration from preference
|
||||
this.preferencesManager.onDidPreferencesChange(() => {
|
||||
this.changeWithPreferences();
|
||||
});
|
||||
@@ -76,7 +76,7 @@ class ThemeService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册 theme
|
||||
* Register theme
|
||||
*/
|
||||
register(...themes: Theme[]) {
|
||||
themes.forEach(theme => this.themes.set(theme.id, theme));
|
||||
|
||||
Reference in New Issue
Block a user