material-icon-theme 4.22.0 → 4.23.1

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 (84) hide show
  1. package/.eslintrc.json +51 -51
  2. package/.github/workflows/build.yml +45 -45
  3. package/.github/workflows/color-check.yml +22 -22
  4. package/.github/workflows/release.yml +73 -73
  5. package/.vscodeignore +21 -21
  6. package/CHANGELOG.md +1292 -1267
  7. package/README.md +199 -199
  8. package/icons/craco.svg +45 -0
  9. package/icons/folder-changesets-open.svg +5 -0
  10. package/icons/folder-changesets.svg +2 -0
  11. package/icons/folder-decorators-open.svg +2 -2
  12. package/icons/folder-decorators.svg +5 -5
  13. package/icons/folder-supabase-open.svg +5 -5
  14. package/icons/folder-supabase.svg +2 -2
  15. package/icons/sonarcloud.svg +4 -4
  16. package/icons/stylable.svg +10 -10
  17. package/icons/supabase.svg +4 -4
  18. package/icons/vitest.svg +6 -0
  19. package/images/contributors.png +0 -0
  20. package/images/fileIcons.png +0 -0
  21. package/images/folderIcons.png +0 -0
  22. package/package.json +252 -252
  23. package/package.nls.de.json +32 -32
  24. package/package.nls.es.json +29 -29
  25. package/package.nls.fr.json +29 -29
  26. package/package.nls.ja.json +32 -32
  27. package/package.nls.json +32 -32
  28. package/package.nls.nl.json +32 -32
  29. package/package.nls.pl.json +32 -32
  30. package/package.nls.pt-BR.json +29 -29
  31. package/package.nls.pt-PT.json +29 -29
  32. package/package.nls.ru.json +29 -29
  33. package/package.nls.zh-CN.json +29 -29
  34. package/package.nls.zh-TW.json +29 -29
  35. package/src/commands/activate.ts +28 -28
  36. package/src/commands/explorerArrows.ts +55 -55
  37. package/src/commands/folderColor.ts +96 -96
  38. package/src/commands/folders.ts +55 -55
  39. package/src/commands/grayscale.ts +55 -55
  40. package/src/commands/iconPacks.ts +64 -64
  41. package/src/commands/index.ts +30 -30
  42. package/src/commands/opacity.ts +46 -46
  43. package/src/commands/saturation.ts +46 -46
  44. package/src/extension.ts +37 -37
  45. package/src/helpers/customIcons.ts +8 -8
  46. package/src/helpers/index.ts +88 -88
  47. package/src/i18n/index.ts +78 -78
  48. package/src/i18n/lang-de.ts +43 -43
  49. package/src/i18n/lang-en.ts +43 -43
  50. package/src/i18n/lang-es.ts +43 -43
  51. package/src/i18n/lang-fr.ts +43 -43
  52. package/src/i18n/lang-ja.ts +43 -43
  53. package/src/i18n/lang-nl.ts +43 -43
  54. package/src/i18n/lang-pl.ts +43 -43
  55. package/src/i18n/lang-pt-br.ts +43 -43
  56. package/src/i18n/lang-pt-pt.ts +43 -43
  57. package/src/i18n/lang-ru.ts +43 -43
  58. package/src/i18n/lang-uk.ts +43 -43
  59. package/src/i18n/lang-zh-cn.ts +43 -43
  60. package/src/i18n/lang-zh-tw.ts +43 -43
  61. package/src/icons/fileIcons.ts +2197 -2159
  62. package/src/icons/folderIcons.ts +806 -804
  63. package/src/icons/generator/folderGenerator.ts +340 -340
  64. package/src/icons/generator/iconOpacity.ts +111 -111
  65. package/src/icons/generator/iconSaturation.ts +140 -140
  66. package/src/icons/generator/jsonGenerator.ts +191 -191
  67. package/src/icons/languageIcons.ts +141 -141
  68. package/src/models/i18n/translation.ts +41 -41
  69. package/src/models/iconConfiguration.ts +37 -37
  70. package/src/models/icons/iconJsonOptions.ts +21 -21
  71. package/src/models/index.ts +3 -3
  72. package/src/scripts/contributors/index.ts +138 -138
  73. package/src/scripts/helpers/screenshots.ts +32 -32
  74. package/src/scripts/icons/checks/checkIconAvailability.ts +215 -215
  75. package/src/scripts/icons/checks/checkIconConflicts.ts +152 -152
  76. package/src/scripts/icons/checks/checkIconUsage.ts +137 -137
  77. package/src/scripts/icons/checks/index.ts +7 -7
  78. package/src/scripts/preview/index.ts +40 -40
  79. package/src/scripts/preview/preview.ts +163 -163
  80. package/src/test/runTest.ts +26 -26
  81. package/src/test/spec/i18n/i18n.spec.ts +54 -54
  82. package/src/test/spec/icons/fileIcons.spec.ts +250 -250
  83. package/src/test/spec/icons/folderIcons.spec.ts +418 -418
  84. package/src/test/spec/icons/languageIcons.spec.ts +184 -184
@@ -1,215 +1,215 @@
1
- import { readdir } from 'fs';
2
- import { join, parse } from 'path';
3
- import {
4
- DefaultIcon,
5
- FileIcon,
6
- FolderIcon,
7
- FolderTheme,
8
- } from '../../../models/index';
9
- import { green, red } from '../../helpers/painter';
10
- import { similarity } from '../../helpers/similarity';
11
- import {
12
- fileIcons,
13
- folderIcons,
14
- highContrastColorFileEnding,
15
- languageIcons,
16
- lightColorFileEnding,
17
- openedFolder,
18
- } from './../../../icons';
19
-
20
- /**
21
- * Defines the folder where all icon files are located.
22
- */
23
- const folderPath = join('icons');
24
-
25
- /**
26
- * Defines an array with all icons that can be found in the file system.
27
- */
28
- const availableIcons: Record<string, string> = {};
29
-
30
- /**
31
- * Save the misconfigured icons.
32
- */
33
- const wrongIconNames: Record<string, string[]> = {
34
- fileIcons: [],
35
- folderIcons: [],
36
- languageIcons: [],
37
- };
38
-
39
- /**
40
- * Get all icon file names from the file system.
41
- */
42
- const fsReadAllIconFiles = (
43
- err: NodeJS.ErrnoException | null,
44
- files: string[]
45
- ) => {
46
- if (err) {
47
- throw Error(err.message);
48
- }
49
-
50
- files.forEach((file) => {
51
- const fileName = file;
52
- const iconName = parse(file).name;
53
- availableIcons[iconName] = fileName;
54
- });
55
-
56
- // check icon configurations
57
- checkFileIcons();
58
- checkFolderIcons();
59
- checkLanguageIcons();
60
-
61
- // show error messages
62
- handleErrors();
63
- };
64
-
65
- // read from the file system
66
- export const check = () => readdir(folderPath, fsReadAllIconFiles);
67
-
68
- /**
69
- * Check if the file icons from the configuration are available on the file system.
70
- */
71
- const checkFileIcons = () => {
72
- [...fileIcons.icons, fileIcons.defaultIcon].forEach((icon) => {
73
- isIconAvailable(icon, IconType.fileIcons, IconColor.default);
74
- isIconAvailable(icon, IconType.fileIcons, IconColor.light);
75
- isIconAvailable(icon, IconType.fileIcons, IconColor.highContrast);
76
- });
77
- };
78
-
79
- const isIconAvailable = (
80
- icon: FileIcon | FolderIcon | DefaultIcon,
81
- iconType: IconType,
82
- iconColor: IconColor,
83
- hasOpenedFolder?: boolean
84
- ) => {
85
- let iconName = `${icon.name}${hasOpenedFolder ? openedFolder : ''}`;
86
- if (icon.light && iconColor === IconColor.light) {
87
- iconName += lightColorFileEnding;
88
- }
89
- if (icon.highContrast && iconColor === IconColor.highContrast) {
90
- iconName += highContrastColorFileEnding;
91
- }
92
-
93
- if (
94
- !availableIcons[iconName] &&
95
- wrongIconNames[iconType].indexOf(iconName) === -1
96
- ) {
97
- wrongIconNames[iconType].push(iconName);
98
- }
99
- };
100
-
101
- /**
102
- * Check if the folder icons from the configuration are available on the file system.
103
- */
104
- const checkFolderIcons = () => {
105
- folderIcons
106
- .map((theme) => (theme.name === 'none' ? [] : getAllFolderIcons(theme)))
107
- .reduce((a, b) => a.concat(b))
108
- .forEach((icon) => {
109
- if (icon) {
110
- isIconAvailable(icon, IconType.folderIcons, IconColor.default);
111
- isIconAvailable(icon, IconType.folderIcons, IconColor.default, true);
112
- isIconAvailable(icon, IconType.folderIcons, IconColor.light);
113
- isIconAvailable(icon, IconType.folderIcons, IconColor.light, true);
114
- isIconAvailable(icon, IconType.folderIcons, IconColor.highContrast);
115
- isIconAvailable(
116
- icon,
117
- IconType.folderIcons,
118
- IconColor.highContrast,
119
- true
120
- );
121
- }
122
- });
123
- };
124
-
125
- const getAllFolderIcons = (theme: FolderTheme) => {
126
- const icons = theme.icons ? theme.icons : [];
127
- return [theme.defaultIcon, theme.rootFolder, ...icons].filter(
128
- (icon) => icon !== undefined
129
- ); // filter undefined root folder icons
130
- };
131
-
132
- /**
133
- * Check if the language icons from the configuration are available on the file system.
134
- */
135
- const checkLanguageIcons = () => {
136
- languageIcons.forEach((lang) => {
137
- const icon = lang.icon;
138
- isIconAvailable(icon, IconType.languageIcons, IconColor.default);
139
- isIconAvailable(icon, IconType.languageIcons, IconColor.light);
140
- isIconAvailable(icon, IconType.languageIcons, IconColor.highContrast);
141
- });
142
- };
143
-
144
- /**
145
- * Show error messages in the terminal.
146
- */
147
- const handleErrors = () => {
148
- const amountOfErrors =
149
- wrongIconNames.fileIcons.length +
150
- wrongIconNames.folderIcons.length +
151
- wrongIconNames.languageIcons.length;
152
- if (amountOfErrors > 0) {
153
- console.log(
154
- '> Material Icon Theme:',
155
- red(`Found ${amountOfErrors} error(s) in the icon configuration!`)
156
- );
157
- } else {
158
- console.log(
159
- '> Material Icon Theme:',
160
- green('Passed icon availability checks!')
161
- );
162
- }
163
- logIconInformation(wrongIconNames.fileIcons, 'File icons');
164
- logIconInformation(wrongIconNames.folderIcons, 'Folder icons');
165
- logIconInformation(wrongIconNames.languageIcons, 'Language icons');
166
-
167
- if (amountOfErrors > 0) {
168
- throw new Error(
169
- 'Found some wrong file definitions in the icon configuration.'
170
- );
171
- }
172
- };
173
-
174
- const logIconInformation = (wrongIcons: string[], title: string) => {
175
- if (wrongIcons.length === 0) return;
176
- console.log(`\n${title}:\n--------------------------------`);
177
- wrongIcons.forEach((icon) => {
178
- const suggestion = Object.keys(availableIcons).find((i) => {
179
- return similarity(icon, i) > 0.75;
180
- });
181
- const suggestionString = suggestion
182
- ? ` (Did you mean ${green(suggestion)}?)`
183
- : '';
184
- const isWrongLightVersion = icon.endsWith(lightColorFileEnding);
185
- const isWrongLightVersionString = isWrongLightVersion
186
- ? ` (There is no light icon for ${green(
187
- icon.slice(0, -6)
188
- )}! Set the light option to false!)`
189
- : '';
190
- const isWrongHighContrastVersion = icon.endsWith(
191
- highContrastColorFileEnding
192
- );
193
- const isWrongHighContrastVersionString = isWrongHighContrastVersion
194
- ? ` (There is no high contrast icon for ${green(
195
- icon.slice(0, -13)
196
- )}! Set the highContrast option to false!)`
197
- : '';
198
- console.log(
199
- red(`Icon not found: ${icon}.svg`) +
200
- `${suggestionString}${isWrongLightVersionString}${isWrongHighContrastVersionString}`
201
- );
202
- });
203
- };
204
-
205
- enum IconType {
206
- fileIcons = 'fileIcons',
207
- folderIcons = 'folderIcons',
208
- languageIcons = 'languageIcons',
209
- }
210
-
211
- enum IconColor {
212
- default = 'default',
213
- light = 'light',
214
- highContrast = 'highContrast',
215
- }
1
+ import { readdir } from 'fs';
2
+ import { join, parse } from 'path';
3
+ import {
4
+ DefaultIcon,
5
+ FileIcon,
6
+ FolderIcon,
7
+ FolderTheme,
8
+ } from '../../../models/index';
9
+ import { green, red } from '../../helpers/painter';
10
+ import { similarity } from '../../helpers/similarity';
11
+ import {
12
+ fileIcons,
13
+ folderIcons,
14
+ highContrastColorFileEnding,
15
+ languageIcons,
16
+ lightColorFileEnding,
17
+ openedFolder,
18
+ } from './../../../icons';
19
+
20
+ /**
21
+ * Defines the folder where all icon files are located.
22
+ */
23
+ const folderPath = join('icons');
24
+
25
+ /**
26
+ * Defines an array with all icons that can be found in the file system.
27
+ */
28
+ const availableIcons: Record<string, string> = {};
29
+
30
+ /**
31
+ * Save the misconfigured icons.
32
+ */
33
+ const wrongIconNames: Record<string, string[]> = {
34
+ fileIcons: [],
35
+ folderIcons: [],
36
+ languageIcons: [],
37
+ };
38
+
39
+ /**
40
+ * Get all icon file names from the file system.
41
+ */
42
+ const fsReadAllIconFiles = (
43
+ err: NodeJS.ErrnoException | null,
44
+ files: string[]
45
+ ) => {
46
+ if (err) {
47
+ throw Error(err.message);
48
+ }
49
+
50
+ files.forEach((file) => {
51
+ const fileName = file;
52
+ const iconName = parse(file).name;
53
+ availableIcons[iconName] = fileName;
54
+ });
55
+
56
+ // check icon configurations
57
+ checkFileIcons();
58
+ checkFolderIcons();
59
+ checkLanguageIcons();
60
+
61
+ // show error messages
62
+ handleErrors();
63
+ };
64
+
65
+ // read from the file system
66
+ export const check = () => readdir(folderPath, fsReadAllIconFiles);
67
+
68
+ /**
69
+ * Check if the file icons from the configuration are available on the file system.
70
+ */
71
+ const checkFileIcons = () => {
72
+ [...fileIcons.icons, fileIcons.defaultIcon].forEach((icon) => {
73
+ isIconAvailable(icon, IconType.fileIcons, IconColor.default);
74
+ isIconAvailable(icon, IconType.fileIcons, IconColor.light);
75
+ isIconAvailable(icon, IconType.fileIcons, IconColor.highContrast);
76
+ });
77
+ };
78
+
79
+ const isIconAvailable = (
80
+ icon: FileIcon | FolderIcon | DefaultIcon,
81
+ iconType: IconType,
82
+ iconColor: IconColor,
83
+ hasOpenedFolder?: boolean
84
+ ) => {
85
+ let iconName = `${icon.name}${hasOpenedFolder ? openedFolder : ''}`;
86
+ if (icon.light && iconColor === IconColor.light) {
87
+ iconName += lightColorFileEnding;
88
+ }
89
+ if (icon.highContrast && iconColor === IconColor.highContrast) {
90
+ iconName += highContrastColorFileEnding;
91
+ }
92
+
93
+ if (
94
+ !availableIcons[iconName] &&
95
+ wrongIconNames[iconType].indexOf(iconName) === -1
96
+ ) {
97
+ wrongIconNames[iconType].push(iconName);
98
+ }
99
+ };
100
+
101
+ /**
102
+ * Check if the folder icons from the configuration are available on the file system.
103
+ */
104
+ const checkFolderIcons = () => {
105
+ folderIcons
106
+ .map((theme) => (theme.name === 'none' ? [] : getAllFolderIcons(theme)))
107
+ .reduce((a, b) => a.concat(b))
108
+ .forEach((icon) => {
109
+ if (icon) {
110
+ isIconAvailable(icon, IconType.folderIcons, IconColor.default);
111
+ isIconAvailable(icon, IconType.folderIcons, IconColor.default, true);
112
+ isIconAvailable(icon, IconType.folderIcons, IconColor.light);
113
+ isIconAvailable(icon, IconType.folderIcons, IconColor.light, true);
114
+ isIconAvailable(icon, IconType.folderIcons, IconColor.highContrast);
115
+ isIconAvailable(
116
+ icon,
117
+ IconType.folderIcons,
118
+ IconColor.highContrast,
119
+ true
120
+ );
121
+ }
122
+ });
123
+ };
124
+
125
+ const getAllFolderIcons = (theme: FolderTheme) => {
126
+ const icons = theme.icons ? theme.icons : [];
127
+ return [theme.defaultIcon, theme.rootFolder, ...icons].filter(
128
+ (icon) => icon !== undefined
129
+ ); // filter undefined root folder icons
130
+ };
131
+
132
+ /**
133
+ * Check if the language icons from the configuration are available on the file system.
134
+ */
135
+ const checkLanguageIcons = () => {
136
+ languageIcons.forEach((lang) => {
137
+ const icon = lang.icon;
138
+ isIconAvailable(icon, IconType.languageIcons, IconColor.default);
139
+ isIconAvailable(icon, IconType.languageIcons, IconColor.light);
140
+ isIconAvailable(icon, IconType.languageIcons, IconColor.highContrast);
141
+ });
142
+ };
143
+
144
+ /**
145
+ * Show error messages in the terminal.
146
+ */
147
+ const handleErrors = () => {
148
+ const amountOfErrors =
149
+ wrongIconNames.fileIcons.length +
150
+ wrongIconNames.folderIcons.length +
151
+ wrongIconNames.languageIcons.length;
152
+ if (amountOfErrors > 0) {
153
+ console.log(
154
+ '> Material Icon Theme:',
155
+ red(`Found ${amountOfErrors} error(s) in the icon configuration!`)
156
+ );
157
+ } else {
158
+ console.log(
159
+ '> Material Icon Theme:',
160
+ green('Passed icon availability checks!')
161
+ );
162
+ }
163
+ logIconInformation(wrongIconNames.fileIcons, 'File icons');
164
+ logIconInformation(wrongIconNames.folderIcons, 'Folder icons');
165
+ logIconInformation(wrongIconNames.languageIcons, 'Language icons');
166
+
167
+ if (amountOfErrors > 0) {
168
+ throw new Error(
169
+ 'Found some wrong file definitions in the icon configuration.'
170
+ );
171
+ }
172
+ };
173
+
174
+ const logIconInformation = (wrongIcons: string[], title: string) => {
175
+ if (wrongIcons.length === 0) return;
176
+ console.log(`\n${title}:\n--------------------------------`);
177
+ wrongIcons.forEach((icon) => {
178
+ const suggestion = Object.keys(availableIcons).find((i) => {
179
+ return similarity(icon, i) > 0.75;
180
+ });
181
+ const suggestionString = suggestion
182
+ ? ` (Did you mean ${green(suggestion)}?)`
183
+ : '';
184
+ const isWrongLightVersion = icon.endsWith(lightColorFileEnding);
185
+ const isWrongLightVersionString = isWrongLightVersion
186
+ ? ` (There is no light icon for ${green(
187
+ icon.slice(0, -6)
188
+ )}! Set the light option to false!)`
189
+ : '';
190
+ const isWrongHighContrastVersion = icon.endsWith(
191
+ highContrastColorFileEnding
192
+ );
193
+ const isWrongHighContrastVersionString = isWrongHighContrastVersion
194
+ ? ` (There is no high contrast icon for ${green(
195
+ icon.slice(0, -13)
196
+ )}! Set the highContrast option to false!)`
197
+ : '';
198
+ console.log(
199
+ red(`Icon not found: ${icon}.svg`) +
200
+ `${suggestionString}${isWrongLightVersionString}${isWrongHighContrastVersionString}`
201
+ );
202
+ });
203
+ };
204
+
205
+ enum IconType {
206
+ fileIcons = 'fileIcons',
207
+ folderIcons = 'folderIcons',
208
+ languageIcons = 'languageIcons',
209
+ }
210
+
211
+ enum IconColor {
212
+ default = 'default',
213
+ light = 'light',
214
+ highContrast = 'highContrast',
215
+ }