@opensumi/ide-theme 2.21.9-rc-1671176957.0 → 2.21.9

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 (92) hide show
  1. package/lib/browser/icon.service.d.ts +1 -3
  2. package/lib/browser/icon.service.d.ts.map +1 -1
  3. package/lib/browser/icon.service.js +4 -36
  4. package/lib/browser/icon.service.js.map +1 -1
  5. package/lib/common/theme.service.d.ts +0 -20
  6. package/lib/common/theme.service.d.ts.map +1 -1
  7. package/lib/common/theme.service.js.map +1 -1
  8. package/package.json +8 -9
  9. package/src/browser/default-theme.ts +0 -547
  10. package/src/browser/icon-theme-data.ts +0 -294
  11. package/src/browser/icon-theme-store.ts +0 -38
  12. package/src/browser/icon.less +0 -15
  13. package/src/browser/icon.service.ts +0 -457
  14. package/src/browser/index.ts +0 -45
  15. package/src/browser/semantic-tokens-registry.ts +0 -217
  16. package/src/browser/style.service.ts +0 -51
  17. package/src/browser/theme-data.ts +0 -719
  18. package/src/browser/theme-store.ts +0 -95
  19. package/src/browser/theme.contribution.ts +0 -343
  20. package/src/browser/workbench.theme.service.ts +0 -703
  21. package/src/common/color-registry.ts +0 -52
  22. package/src/common/color-tokens/activity-bar.ts +0 -122
  23. package/src/common/color-tokens/badge.ts +0 -31
  24. package/src/common/color-tokens/base.ts +0 -90
  25. package/src/common/color-tokens/basic-color.ts +0 -9
  26. package/src/common/color-tokens/breadcrumb.ts +0 -60
  27. package/src/common/color-tokens/button.ts +0 -69
  28. package/src/common/color-tokens/charts.ts +0 -68
  29. package/src/common/color-tokens/checkbox.ts +0 -23
  30. package/src/common/color-tokens/custom/actionbar.ts +0 -51
  31. package/src/common/color-tokens/custom/activity-bar.ts +0 -16
  32. package/src/common/color-tokens/custom/badge.ts +0 -30
  33. package/src/common/color-tokens/custom/base.ts +0 -111
  34. package/src/common/color-tokens/custom/button.ts +0 -359
  35. package/src/common/color-tokens/custom/checkbox.ts +0 -36
  36. package/src/common/color-tokens/custom/decoration.ts +0 -71
  37. package/src/common/color-tokens/custom/editor.ts +0 -27
  38. package/src/common/color-tokens/custom/extension.ts +0 -9
  39. package/src/common/color-tokens/custom/icon.ts +0 -30
  40. package/src/common/color-tokens/custom/index.ts +0 -26
  41. package/src/common/color-tokens/custom/input.ts +0 -48
  42. package/src/common/color-tokens/custom/menu.ts +0 -61
  43. package/src/common/color-tokens/custom/modal.ts +0 -57
  44. package/src/common/color-tokens/custom/notification.ts +0 -16
  45. package/src/common/color-tokens/custom/panel.ts +0 -112
  46. package/src/common/color-tokens/custom/popover.ts +0 -28
  47. package/src/common/color-tokens/custom/select.ts +0 -155
  48. package/src/common/color-tokens/custom/settings.ts +0 -32
  49. package/src/common/color-tokens/custom/statusbar.ts +0 -16
  50. package/src/common/color-tokens/custom/tab.ts +0 -31
  51. package/src/common/color-tokens/custom/tooltip.ts +0 -55
  52. package/src/common/color-tokens/custom/tree.ts +0 -106
  53. package/src/common/color-tokens/debug.ts +0 -103
  54. package/src/common/color-tokens/debugToolbar.ts +0 -134
  55. package/src/common/color-tokens/dropdown.ts +0 -27
  56. package/src/common/color-tokens/editor.ts +0 -876
  57. package/src/common/color-tokens/index.ts +0 -35
  58. package/src/common/color-tokens/input.ts +0 -105
  59. package/src/common/color-tokens/list-tree.ts +0 -205
  60. package/src/common/color-tokens/menu-bar.ts +0 -43
  61. package/src/common/color-tokens/menu.ts +0 -53
  62. package/src/common/color-tokens/merge-conflict.ts +0 -145
  63. package/src/common/color-tokens/minimap.ts +0 -99
  64. package/src/common/color-tokens/notification.ts +0 -169
  65. package/src/common/color-tokens/panel.ts +0 -177
  66. package/src/common/color-tokens/pick-view.ts +0 -96
  67. package/src/common/color-tokens/picker.ts +0 -15
  68. package/src/common/color-tokens/progress-bar.ts +0 -12
  69. package/src/common/color-tokens/quick-input.ts +0 -57
  70. package/src/common/color-tokens/scrollbar.ts +0 -42
  71. package/src/common/color-tokens/settings.ts +0 -126
  72. package/src/common/color-tokens/sidebar.ts +0 -121
  73. package/src/common/color-tokens/snippet.ts +0 -33
  74. package/src/common/color-tokens/status-bar.ts +0 -350
  75. package/src/common/color-tokens/tab.ts +0 -346
  76. package/src/common/color-tokens/testing.ts +0 -105
  77. package/src/common/color-tokens/text.ts +0 -41
  78. package/src/common/color-tokens/title-bar.ts +0 -62
  79. package/src/common/color-tokens/toolbar.ts +0 -28
  80. package/src/common/color-tokens/welcome-page.ts +0 -27
  81. package/src/common/color.ts +0 -647
  82. package/src/common/default-themes.ts +0 -273
  83. package/src/common/event.ts +0 -9
  84. package/src/common/index.ts +0 -8
  85. package/src/common/mocks/theme.service.ts +0 -55
  86. package/src/common/plistParser.ts +0 -525
  87. package/src/common/semantic-tokens-registry.ts +0 -439
  88. package/src/common/style.ts +0 -9
  89. package/src/common/theme.service.ts +0 -363
  90. package/src/common/themeCompatibility.ts +0 -95
  91. package/src/common/utils.ts +0 -195
  92. package/src/index.ts +0 -1
@@ -1,294 +0,0 @@
1
- import { Injectable, Autowired } from '@opensumi/di';
2
- import { getDebugLogger, URI, parseWithComments, formatLocalize } from '@opensumi/ide-core-browser';
3
- import { IFileServiceClient } from '@opensumi/ide-file-service';
4
- import { StaticResourceService } from '@opensumi/ide-static-resource/lib/browser';
5
-
6
- import { IIconTheme } from '../common';
7
-
8
- @Injectable({ multiple: true })
9
- export class IconThemeData implements IIconTheme {
10
- hasFileIcons: boolean;
11
- hasFolderIcons: boolean;
12
- hidesExplorerArrows: boolean;
13
- styleSheetContent: string;
14
-
15
- @Autowired(IFileServiceClient)
16
- private readonly fileServiceClient: IFileServiceClient;
17
-
18
- @Autowired()
19
- private readonly staticResourceService: StaticResourceService;
20
-
21
- async load(location: URI) {
22
- const ret = await this.fileServiceClient.readFile(location.toString());
23
- let contentValue = {} as IconThemeDocument;
24
- try {
25
- contentValue = parseWithComments<IconThemeDocument>(ret.content.toString());
26
- } catch (error) {
27
- getDebugLogger().log(formatLocalize('error.cannotparseicontheme', location.codeUri.fsPath));
28
- }
29
-
30
- const result = processIconThemeDocument(location, contentValue, this.staticResourceService);
31
- this.hasFileIcons = result.hasFileIcons;
32
- this.hasFolderIcons = result.hasFolderIcons;
33
- this.hidesExplorerArrows = result.hidesExplorerArrows;
34
- this.styleSheetContent = result.content;
35
- return result.content;
36
- }
37
- }
38
-
39
- // tslint:disable: forin
40
- interface IconDefinition {
41
- iconPath: string;
42
- fontColor: string;
43
- fontCharacter: string;
44
- fontSize: string;
45
- fontId: string;
46
- }
47
-
48
- interface FontDefinition {
49
- id: string;
50
- weight: string;
51
- style: string;
52
- size: string;
53
- src: { path: string; format: string }[];
54
- }
55
-
56
- // 图标名与图标定义的映射关系
57
- interface IconsAssociation {
58
- folder?: string;
59
- file?: string;
60
- folderExpanded?: string;
61
- rootFolder?: string;
62
- rootFolderExpanded?: string;
63
- folderNames?: { [folderName: string]: string };
64
- folderNamesExpanded?: { [folderName: string]: string };
65
- fileExtensions?: { [extension: string]: string };
66
- fileNames?: { [fileName: string]: string };
67
- languageIds?: { [languageId: string]: string };
68
- }
69
-
70
- interface IconThemeDocument extends IconsAssociation {
71
- iconDefinitions: { [key: string]: IconDefinition };
72
- fonts: FontDefinition[];
73
- light?: IconsAssociation;
74
- highContrast?: IconsAssociation;
75
- hidesExplorerArrows?: boolean;
76
- }
77
-
78
- /**
79
- * 将图标配置信息转成 CSS
80
- * @param iconThemeDocumentLocation
81
- * @param iconThemeDocument
82
- */
83
- function processIconThemeDocument(
84
- iconThemeDocumentLocation: URI,
85
- iconThemeDocument: IconThemeDocument,
86
- staticResourceService: StaticResourceService,
87
- ): { content: string; hasFileIcons: boolean; hasFolderIcons: boolean; hidesExplorerArrows: boolean } {
88
- const result = {
89
- content: '',
90
- hasFileIcons: false,
91
- hasFolderIcons: false,
92
- hidesExplorerArrows: !!iconThemeDocument.hidesExplorerArrows,
93
- };
94
-
95
- if (!iconThemeDocument.iconDefinitions) {
96
- return result;
97
- }
98
- const selectorByDefinitionId: { [def: string]: string[] } = {};
99
-
100
- function resolvePath(path: string) {
101
- const targetPath = iconThemeDocumentLocation.path.dir.join(path.replace(/^\.\//, ''));
102
- const targetLocation = iconThemeDocumentLocation.withPath(targetPath);
103
- if (iconThemeDocumentLocation.scheme === 'https') {
104
- return targetLocation.toString();
105
- }
106
- // file 协议的需要走 static-resource
107
- return staticResourceService.resolveStaticResource(targetLocation);
108
- }
109
-
110
- /**
111
- * 将图标关联关系转成css选择器数组,支持主题的light、hc传入
112
- * @param associations
113
- * @param baseThemeClassName
114
- */
115
- function collectSelectors(associations: IconsAssociation | undefined, baseThemeClassName?: string) {
116
- // 将定义的图标名插入对应的选择器列表
117
- function addSelector(selector: string, defId: string) {
118
- if (defId) {
119
- let list = selectorByDefinitionId[defId];
120
- if (!list) {
121
- list = selectorByDefinitionId[defId] = [];
122
- }
123
- list.push(selector);
124
- }
125
- }
126
- if (associations) {
127
- let qualifier = '.show-file-icons';
128
- if (baseThemeClassName) {
129
- qualifier = baseThemeClassName + ' ' + qualifier;
130
- }
131
-
132
- if (associations.folder) {
133
- addSelector(`${qualifier} .folder-icon::before`, associations.folder);
134
- result.hasFolderIcons = true;
135
- }
136
-
137
- if (associations.folderExpanded) {
138
- addSelector(`${qualifier} .folder-icon.expanded::before`, associations.folderExpanded);
139
- result.hasFolderIcons = true;
140
- }
141
-
142
- const rootFolder = associations.rootFolder || associations.folder;
143
- const rootFolderExpanded = associations.rootFolderExpanded || associations.folderExpanded;
144
-
145
- if (rootFolder) {
146
- addSelector(`${qualifier} .rootfolder-icon::before`, rootFolder);
147
- result.hasFolderIcons = true;
148
- }
149
-
150
- if (rootFolderExpanded) {
151
- addSelector(`${qualifier} .rootfolder-icon.expanded::before`, rootFolderExpanded);
152
- result.hasFolderIcons = true;
153
- }
154
-
155
- if (associations.file) {
156
- addSelector(`${qualifier} .file-icon::before`, associations.file);
157
- result.hasFileIcons = true;
158
- }
159
-
160
- const folderNames = associations.folderNames;
161
- if (folderNames) {
162
- // eslint-disable-next-line guard-for-in
163
- for (const folderName in folderNames) {
164
- addSelector(
165
- `${qualifier} .${escapeCSS(folderName.toLowerCase())}-name-folder-icon.folder-icon::before`,
166
- folderNames[folderName],
167
- );
168
- result.hasFolderIcons = true;
169
- }
170
- }
171
- const folderNamesExpanded = associations.folderNamesExpanded;
172
- if (folderNamesExpanded) {
173
- // eslint-disable-next-line guard-for-in
174
- for (const folderName in folderNamesExpanded) {
175
- addSelector(
176
- `${qualifier} .${escapeCSS(folderName.toLowerCase())}-name-folder-icon.folder-icon.expanded::before`,
177
- folderNamesExpanded[folderName],
178
- );
179
- result.hasFolderIcons = true;
180
- }
181
- }
182
-
183
- const languageIds = associations.languageIds;
184
- if (languageIds) {
185
- if (!languageIds.jsonc && languageIds.json) {
186
- languageIds.jsonc = languageIds.json;
187
- }
188
- // eslint-disable-next-line guard-for-in
189
- for (const languageId in languageIds) {
190
- addSelector(
191
- `${qualifier} .${escapeCSS(languageId)}-lang-file-icon.file-icon::before`,
192
- languageIds[languageId],
193
- );
194
- result.hasFileIcons = true;
195
- }
196
- }
197
- const fileExtensions = associations.fileExtensions;
198
- if (fileExtensions) {
199
- // eslint-disable-next-line guard-for-in
200
- for (const fileExtension in fileExtensions) {
201
- const selectors: string[] = [];
202
- const segments = fileExtension.toLowerCase().split('.');
203
- if (segments.length) {
204
- for (let i = 0; i < segments.length; i++) {
205
- selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
206
- }
207
- selectors.push('.ext-file-icon'); // extra segment to increase file-ext score
208
- }
209
- addSelector(`${qualifier} ${selectors.join('')}.file-icon::before`, fileExtensions[fileExtension]);
210
- result.hasFileIcons = true;
211
- }
212
- }
213
- const fileNames = associations.fileNames;
214
- if (fileNames) {
215
- // eslint-disable-next-line guard-for-in
216
- for (let fileName in fileNames) {
217
- const selectors: string[] = [];
218
- fileName = fileName.toLowerCase();
219
- selectors.push(`.${escapeCSS(fileName)}-name-file-icon`);
220
- const segments = fileName.split('.');
221
- if (segments.length) {
222
- for (let i = 1; i < segments.length; i++) {
223
- selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
224
- }
225
- selectors.push('.ext-file-icon'); // extra segment to increase file-ext score
226
- }
227
- addSelector(`${qualifier} ${selectors.join('')}.file-icon::before`, fileNames[fileName]);
228
- result.hasFileIcons = true;
229
- }
230
- }
231
- }
232
- }
233
- collectSelectors(iconThemeDocument);
234
- collectSelectors(iconThemeDocument.light, '.vs');
235
- collectSelectors(iconThemeDocument.highContrast, '.hc-black');
236
- collectSelectors(iconThemeDocument.highContrast, '.hc-light');
237
-
238
- if (!result.hasFileIcons && !result.hasFolderIcons) {
239
- return result;
240
- }
241
-
242
- const cssRules: string[] = [];
243
-
244
- const fonts = iconThemeDocument.fonts;
245
- if (Array.isArray(fonts)) {
246
- fonts.forEach((font) => {
247
- const src = font.src.map((l) => `url('${resolvePath(l.path)}') format('${l.format}')`).join(', ');
248
- cssRules.push(
249
- `@font-face { src: ${src}; font-family: '${font.id}'; font-weight: ${font.weight}; font-style: ${font.style}; }`,
250
- );
251
- });
252
- cssRules.push(
253
- `.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: '${
254
- fonts[0].id
255
- }'; font-size: ${fonts[0].size || '150%'}}`,
256
- );
257
- }
258
-
259
- // eslint-disable-next-line guard-for-in
260
- for (const defId in selectorByDefinitionId) {
261
- const selectors = selectorByDefinitionId[defId];
262
- const definition = iconThemeDocument.iconDefinitions[defId];
263
- if (definition) {
264
- if (definition.iconPath) {
265
- cssRules.push(
266
- `${selectors.join(', ')} { content: ' '; background-image: url("${resolvePath(definition.iconPath)}"); }`,
267
- );
268
- }
269
- if (definition.fontCharacter || definition.fontColor) {
270
- let body = '';
271
- if (definition.fontColor) {
272
- body += ` color: ${definition.fontColor};`;
273
- }
274
- if (definition.fontCharacter) {
275
- body += ` content: '${definition.fontCharacter}';`;
276
- }
277
- if (definition.fontSize) {
278
- body += ` font-size: ${definition.fontSize};`;
279
- }
280
- if (definition.fontId) {
281
- body += ` font-family: ${definition.fontId};`;
282
- }
283
- cssRules.push(`${selectors.join(', ')} { ${body} }`);
284
- }
285
- }
286
- }
287
- result.content = cssRules.join('\n');
288
- return result;
289
- }
290
-
291
- function escapeCSS(str: string) {
292
- str = str.replace(/[\11\12\14\15\40]/g, '/'); // HTML class names can not contain certain whitespace characters, use / instead, which doesn't exist in file names.
293
- return window.CSS.escape(str);
294
- }
@@ -1,38 +0,0 @@
1
- import { Injectable, Autowired, INJECTOR_TOKEN, Injector } from '@opensumi/di';
2
- import { URI } from '@opensumi/ide-core-common';
3
-
4
- import { IIconTheme, ThemeContribution, getThemeId } from '../common';
5
-
6
- import { IconThemeData } from './icon-theme-data';
7
-
8
- @Injectable()
9
- export class IconThemeStore {
10
- @Autowired(INJECTOR_TOKEN)
11
- injector: Injector;
12
-
13
- private iconThemeMap: Map<string, IIconTheme> = new Map();
14
-
15
- async getIconTheme(contribution?: ThemeContribution, basePath?: URI): Promise<IIconTheme | undefined> {
16
- if (!contribution || !basePath) {
17
- return;
18
- }
19
- const id = getThemeId(contribution);
20
- const cachedTheme = this.iconThemeMap.get(id);
21
- if (cachedTheme) {
22
- return cachedTheme;
23
- }
24
- const iconTheme = await this.initIconTheme(contribution, basePath);
25
- this.iconThemeMap.set(id, iconTheme);
26
- return iconTheme;
27
- }
28
-
29
- protected async initIconTheme(contribution: ThemeContribution, basePath: URI): Promise<IconThemeData> {
30
- const contributedPath = contribution.path.replace(/^\.\//, '');
31
- // http 的不作支持
32
- const themeLocation = basePath.resolve(contributedPath);
33
-
34
- const iconThemeData = this.injector.get(IconThemeData);
35
- await iconThemeData.load(themeLocation);
36
- return iconThemeData;
37
- }
38
- }
@@ -1,15 +0,0 @@
1
- .kaitian-icon {
2
- // 背景和 mask 模式,需要设置元素的默认宽高,否则不会显示
3
- &.background-mode,
4
- &.mask-mode {
5
- width: 16px;
6
- height: 16px;
7
- line-height: 16px;
8
- }
9
- &.mask-mode {
10
- // mask 模式下也需要指定大小
11
- -webkit-mask-size: 16px;
12
- // 默认颜色未当前前景色
13
- background: currentColor;
14
- }
15
- }