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,163 +1,163 @@
1
- import { writeFileSync } from 'fs';
2
- import { join } from 'path';
3
- import { green, red } from '../helpers/painter';
4
- import { createScreenshot } from '../helpers/screenshots';
5
- import { toTitleCase } from './../helpers/titleCase';
6
-
7
- const htmlDoctype = '<!DOCTYPE html>';
8
- const cssFilePath = 'style.css';
9
- const styling = `<link rel="stylesheet" href="${cssFilePath}">`;
10
-
11
- const createHTMLTableHeadRow = (amount: number) => {
12
- const pair = `
13
- <th class="icon">Icon</th>
14
- <th class="iconName">Name</th>
15
- `;
16
- const columns = [...Array(amount)].map(() => pair).join('');
17
- return `
18
- <tr>
19
- ${columns}
20
- </tr>
21
- `;
22
- };
23
-
24
- const createHTMLTableBodyRows = (items: IconDefinition[][]) => {
25
- let rows = '';
26
- items.forEach((row) => {
27
- const columns = row
28
- .map(
29
- (icon) => `
30
- <td class="icon">
31
- <img src="./../../../icons/${icon.iconName}.svg" alt="${
32
- icon.label
33
- }">
34
- </td>
35
- <td class="iconName">${toTitleCase(icon.label)}</td>
36
- `
37
- )
38
- .join('');
39
- const tableRow = `
40
- <tr>
41
- ${columns}
42
- </tr>
43
- `;
44
- rows = rows + tableRow;
45
- });
46
- return rows;
47
- };
48
-
49
- const createHTMLTable = (headRow: string, bodyRows: string) => `
50
- <table>
51
- ${headRow}
52
- ${bodyRows}
53
- </table>
54
- `;
55
-
56
- const createPreviewTable = (icons: IconDefinition[][], size: number) => {
57
- const table =
58
- htmlDoctype +
59
- styling +
60
- createHTMLTable(
61
- createHTMLTableHeadRow(size),
62
- createHTMLTableBodyRows(icons)
63
- );
64
- return table;
65
- };
66
-
67
- const savePreview = (
68
- fileName: string,
69
- size: number,
70
- icons: IconDefinition[][]
71
- ) => {
72
- const filePath = join(__dirname, fileName + '.html');
73
-
74
- // write the html file with the icon table
75
- writeFileSync(filePath, createPreviewTable(icons, size));
76
-
77
- // create the image
78
- createScreenshot(filePath, fileName)
79
- .then(() => {
80
- console.log(
81
- '> Material Icon Theme:',
82
- green(`Successfully created ${fileName} preview image!`)
83
- );
84
- })
85
- .catch(() => {
86
- throw Error(red(`Error while creating ${fileName} preview image`));
87
- });
88
- };
89
-
90
- const getIconDefinitionsMatrix = (
91
- icons: IconDefinition[],
92
- size: number,
93
- excluded: string[] = []
94
- ): IconDefinition[][] => {
95
- const iconList = icons.sort((a, b) => a.label.localeCompare(b.label));
96
- trimIconListToSize(iconList, size, excluded);
97
-
98
- // list for the columns with the icons
99
- const matrix: IconDefinition[][] = [];
100
-
101
- // calculate the amount of icons per column
102
- const itemsPerColumn = Math.floor(iconList.length / size);
103
-
104
- // create the columns with the icons
105
- let counter = 0;
106
- for (let c = 0; c < itemsPerColumn; c++) {
107
- matrix[c] = [];
108
- }
109
- for (let s = 0; s < size; s++) {
110
- for (let i = 0; i < itemsPerColumn; i++) {
111
- matrix[i][s] = iconList[counter];
112
- counter++;
113
- }
114
- }
115
-
116
- return matrix;
117
- };
118
-
119
- /**
120
- * Function that generates the preview image for specific icons.
121
- * @param name name of the preview
122
- * @param icons icons for the preview
123
- * @param size amount of table columns
124
- * @param trimmableIcons List of icons that can possibly be trimmed
125
- */
126
- export const generatePreview = (
127
- name: string,
128
- icons: IconDefinition[],
129
- size: number,
130
- trimmableIcons: string[] = []
131
- ) => {
132
- savePreview(
133
- name,
134
- size,
135
- getIconDefinitionsMatrix(icons, size, trimmableIcons)
136
- );
137
- };
138
-
139
- interface IconDefinition {
140
- iconName: string;
141
- label: string;
142
- }
143
-
144
- /**
145
- * Trim the list of icons into the matrix
146
- * @param iconList List of icons
147
- * @param size Amount of columns
148
- * @param trimmableIcons List of icons that can possibly be trimmed
149
- */
150
- const trimIconListToSize = (
151
- iconList: IconDefinition[],
152
- size: number,
153
- trimmableIcons: string[]
154
- ) => {
155
- while (iconList.length % size !== 0) {
156
- iconList.splice(
157
- iconList.findIndex(
158
- (i) => i.iconName === trimmableIcons[iconList.length % size]
159
- ),
160
- 1
161
- );
162
- }
163
- };
1
+ import { writeFileSync } from 'fs';
2
+ import { join } from 'path';
3
+ import { green, red } from '../helpers/painter';
4
+ import { createScreenshot } from '../helpers/screenshots';
5
+ import { toTitleCase } from './../helpers/titleCase';
6
+
7
+ const htmlDoctype = '<!DOCTYPE html>';
8
+ const cssFilePath = 'style.css';
9
+ const styling = `<link rel="stylesheet" href="${cssFilePath}">`;
10
+
11
+ const createHTMLTableHeadRow = (amount: number) => {
12
+ const pair = `
13
+ <th class="icon">Icon</th>
14
+ <th class="iconName">Name</th>
15
+ `;
16
+ const columns = [...Array(amount)].map(() => pair).join('');
17
+ return `
18
+ <tr>
19
+ ${columns}
20
+ </tr>
21
+ `;
22
+ };
23
+
24
+ const createHTMLTableBodyRows = (items: IconDefinition[][]) => {
25
+ let rows = '';
26
+ items.forEach((row) => {
27
+ const columns = row
28
+ .map(
29
+ (icon) => `
30
+ <td class="icon">
31
+ <img src="./../../../icons/${icon.iconName}.svg" alt="${
32
+ icon.label
33
+ }">
34
+ </td>
35
+ <td class="iconName">${toTitleCase(icon.label)}</td>
36
+ `
37
+ )
38
+ .join('');
39
+ const tableRow = `
40
+ <tr>
41
+ ${columns}
42
+ </tr>
43
+ `;
44
+ rows = rows + tableRow;
45
+ });
46
+ return rows;
47
+ };
48
+
49
+ const createHTMLTable = (headRow: string, bodyRows: string) => `
50
+ <table>
51
+ ${headRow}
52
+ ${bodyRows}
53
+ </table>
54
+ `;
55
+
56
+ const createPreviewTable = (icons: IconDefinition[][], size: number) => {
57
+ const table =
58
+ htmlDoctype +
59
+ styling +
60
+ createHTMLTable(
61
+ createHTMLTableHeadRow(size),
62
+ createHTMLTableBodyRows(icons)
63
+ );
64
+ return table;
65
+ };
66
+
67
+ const savePreview = (
68
+ fileName: string,
69
+ size: number,
70
+ icons: IconDefinition[][]
71
+ ) => {
72
+ const filePath = join(__dirname, fileName + '.html');
73
+
74
+ // write the html file with the icon table
75
+ writeFileSync(filePath, createPreviewTable(icons, size));
76
+
77
+ // create the image
78
+ createScreenshot(filePath, fileName)
79
+ .then(() => {
80
+ console.log(
81
+ '> Material Icon Theme:',
82
+ green(`Successfully created ${fileName} preview image!`)
83
+ );
84
+ })
85
+ .catch(() => {
86
+ throw Error(red(`Error while creating ${fileName} preview image`));
87
+ });
88
+ };
89
+
90
+ const getIconDefinitionsMatrix = (
91
+ icons: IconDefinition[],
92
+ size: number,
93
+ excluded: string[] = []
94
+ ): IconDefinition[][] => {
95
+ const iconList = icons.sort((a, b) => a.label.localeCompare(b.label));
96
+ trimIconListToSize(iconList, size, excluded);
97
+
98
+ // list for the columns with the icons
99
+ const matrix: IconDefinition[][] = [];
100
+
101
+ // calculate the amount of icons per column
102
+ const itemsPerColumn = Math.floor(iconList.length / size);
103
+
104
+ // create the columns with the icons
105
+ let counter = 0;
106
+ for (let c = 0; c < itemsPerColumn; c++) {
107
+ matrix[c] = [];
108
+ }
109
+ for (let s = 0; s < size; s++) {
110
+ for (let i = 0; i < itemsPerColumn; i++) {
111
+ matrix[i][s] = iconList[counter];
112
+ counter++;
113
+ }
114
+ }
115
+
116
+ return matrix;
117
+ };
118
+
119
+ /**
120
+ * Function that generates the preview image for specific icons.
121
+ * @param name name of the preview
122
+ * @param icons icons for the preview
123
+ * @param size amount of table columns
124
+ * @param trimmableIcons List of icons that can possibly be trimmed
125
+ */
126
+ export const generatePreview = (
127
+ name: string,
128
+ icons: IconDefinition[],
129
+ size: number,
130
+ trimmableIcons: string[] = []
131
+ ) => {
132
+ savePreview(
133
+ name,
134
+ size,
135
+ getIconDefinitionsMatrix(icons, size, trimmableIcons)
136
+ );
137
+ };
138
+
139
+ interface IconDefinition {
140
+ iconName: string;
141
+ label: string;
142
+ }
143
+
144
+ /**
145
+ * Trim the list of icons into the matrix
146
+ * @param iconList List of icons
147
+ * @param size Amount of columns
148
+ * @param trimmableIcons List of icons that can possibly be trimmed
149
+ */
150
+ const trimIconListToSize = (
151
+ iconList: IconDefinition[],
152
+ size: number,
153
+ trimmableIcons: string[]
154
+ ) => {
155
+ while (iconList.length % size !== 0) {
156
+ iconList.splice(
157
+ iconList.findIndex(
158
+ (i) => i.iconName === trimmableIcons[iconList.length % size]
159
+ ),
160
+ 1
161
+ );
162
+ }
163
+ };
@@ -1,26 +1,26 @@
1
- import { resolve } from 'path';
2
- import { runTests } from 'vscode-test';
3
-
4
- const main = async () => {
5
- try {
6
- // The folder containing the Extension Manifest package.json
7
- // Passed to `--extensionDevelopmentPath`
8
- const extensionDevelopmentPath = resolve(__dirname, '../../');
9
-
10
- // The path to the extension test script
11
- // Passed to --extensionTestsPath
12
- const extensionTestsPath = resolve(__dirname, './spec/index');
13
-
14
- // Download VS Code, unzip it and run the integration test
15
- await runTests({
16
- extensionDevelopmentPath,
17
- extensionTestsPath,
18
- launchArgs: ['--disable-gpu', '--disable-workspace-trust'],
19
- });
20
- } catch (err) {
21
- console.error('Failed to run tests');
22
- process.exit(1);
23
- }
24
- };
25
-
26
- main();
1
+ import { resolve } from 'path';
2
+ import { runTests } from 'vscode-test';
3
+
4
+ const main = async () => {
5
+ try {
6
+ // The folder containing the Extension Manifest package.json
7
+ // Passed to `--extensionDevelopmentPath`
8
+ const extensionDevelopmentPath = resolve(__dirname, '../../');
9
+
10
+ // The path to the extension test script
11
+ // Passed to --extensionTestsPath
12
+ const extensionTestsPath = resolve(__dirname, './spec/index');
13
+
14
+ // Download VS Code, unzip it and run the integration test
15
+ await runTests({
16
+ extensionDevelopmentPath,
17
+ extensionTestsPath,
18
+ launchArgs: ['--disable-gpu', '--disable-workspace-trust'],
19
+ });
20
+ } catch (err) {
21
+ console.error('Failed to run tests');
22
+ process.exit(1);
23
+ }
24
+ };
25
+
26
+ main();
@@ -1,54 +1,54 @@
1
- import { equal } from 'assert';
2
- import { getObjectPropertyValue } from '../../../helpers/objects';
3
- import { getTranslationValue, initTranslations, replace } from '../../../i18n';
4
- import { Translation } from '../../../models';
5
-
6
- describe('i18n', () => {
7
- it('should initialize translations', () => {
8
- return initTranslations();
9
- });
10
-
11
- it('should translate key', () => {
12
- equal(
13
- getTranslationValue('activate', { activate: 'b' } as Translation),
14
- 'b'
15
- );
16
- });
17
-
18
- it('should return undefined if translation is not defined', () => {
19
- equal(
20
- getTranslationValue('activate', {} as Translation, {} as Translation),
21
- undefined
22
- );
23
- });
24
-
25
- it('should use fallback if translation is not defined', () => {
26
- equal(
27
- getTranslationValue(
28
- 'activate',
29
- {} as Translation,
30
- { activate: 'fb' } as Translation
31
- ),
32
- 'fb'
33
- );
34
- });
35
-
36
- it('should get the correct translation value of the translation object', () => {
37
- const translation = {
38
- a: {
39
- b: {
40
- c: 'c',
41
- },
42
- },
43
- };
44
- equal(getObjectPropertyValue(translation, 'a.b.c'), 'c');
45
- });
46
-
47
- it('should use placeholder in translation', () => {
48
- equal(replace('%0 with placeholder', 'test'), 'test with placeholder');
49
- equal(
50
- replace('%0 with %1', 'test', 'placeholder'),
51
- 'test with placeholder'
52
- );
53
- });
54
- });
1
+ import { equal } from 'assert';
2
+ import { getObjectPropertyValue } from '../../../helpers/objects';
3
+ import { getTranslationValue, initTranslations, replace } from '../../../i18n';
4
+ import { Translation } from '../../../models';
5
+
6
+ describe('i18n', () => {
7
+ it('should initialize translations', () => {
8
+ return initTranslations();
9
+ });
10
+
11
+ it('should translate key', () => {
12
+ equal(
13
+ getTranslationValue('activate', { activate: 'b' } as Translation),
14
+ 'b'
15
+ );
16
+ });
17
+
18
+ it('should return undefined if translation is not defined', () => {
19
+ equal(
20
+ getTranslationValue('activate', {} as Translation, {} as Translation),
21
+ undefined
22
+ );
23
+ });
24
+
25
+ it('should use fallback if translation is not defined', () => {
26
+ equal(
27
+ getTranslationValue(
28
+ 'activate',
29
+ {} as Translation,
30
+ { activate: 'fb' } as Translation
31
+ ),
32
+ 'fb'
33
+ );
34
+ });
35
+
36
+ it('should get the correct translation value of the translation object', () => {
37
+ const translation = {
38
+ a: {
39
+ b: {
40
+ c: 'c',
41
+ },
42
+ },
43
+ };
44
+ equal(getObjectPropertyValue(translation, 'a.b.c'), 'c');
45
+ });
46
+
47
+ it('should use placeholder in translation', () => {
48
+ equal(replace('%0 with placeholder', 'test'), 'test with placeholder');
49
+ equal(
50
+ replace('%0 with %1', 'test', 'placeholder'),
51
+ 'test with placeholder'
52
+ );
53
+ });
54
+ });