material-icon-theme 4.26.0 → 4.28.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.
- package/dist/material-icons.json +5742 -0
- package/icons/file.svg +1 -0
- package/icons/folder-mojo-open.svg +2 -0
- package/icons/folder-mojo.svg +2 -0
- package/icons/folder-open.svg +1 -0
- package/icons/folder-root-open.svg +1 -0
- package/icons/folder-root.svg +1 -0
- package/icons/folder.svg +1 -0
- package/icons/ifanr-cloud.svg +10 -0
- package/icons/mermaid.svg +4 -0
- package/icons/mojo.svg +2 -0
- package/icons/qwik.svg +2 -0
- package/icons/unocss.svg +12 -0
- package/package.json +7 -1
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -51
- package/.github/FUNDING.yml +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
- package/.github/ISSUE_TEMPLATE/icon_request.md +0 -27
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -7
- package/.github/workflows/build.yml +0 -45
- package/.github/workflows/color-check.yml +0 -22
- package/.github/workflows/release.yml +0 -73
- package/.prettierrc +0 -7
- package/.vscode/extensions.json +0 -3
- package/.vscode/launch.json +0 -43
- package/.vscode/settings.json +0 -14
- package/.vscode/tasks.json +0 -32
- package/.vscodeignore +0 -22
- package/CHANGELOG.md +0 -1343
- package/CONTRIBUTING.md +0 -232
- package/build/web-extension.webpack.config.js +0 -62
- package/build/webpack.config.js +0 -39
- package/changelog.config.json +0 -4
- package/images/commandPalette.png +0 -0
- package/images/contributors.png +0 -0
- package/images/fileIcons.png +0 -0
- package/images/folderIcons.png +0 -0
- package/images/how-tos/folder-icon-parts.png +0 -0
- package/images/how-tos/pick-folder-colors.png +0 -0
- package/images/how-tos/pick-folder-colors.svg +0 -301
- package/images/how-tos/svg-folder-icon-with-correct-colors.png +0 -0
- package/images/how-tos/svg-folder-icon-with-wrong-colors.png +0 -0
- package/images/how-tos/svg-with-light-color.png +0 -0
- package/images/how-tos/svg-with-spacing.png +0 -0
- package/images/how-tos/svg-with-too-dark-color.png +0 -0
- package/images/how-tos/svg-with-wrong-color.png +0 -0
- package/images/how-tos/svg-without-spacing.png +0 -0
- package/images/set-folder-color.gif +0 -0
- package/images/set-folder-theme.gif +0 -0
- package/logo.png +0 -0
- package/logo.svg +0 -21
- package/material-colors.yml +0 -257
- package/package.nls.de.json +0 -34
- package/package.nls.es.json +0 -29
- package/package.nls.fr.json +0 -29
- package/package.nls.ja.json +0 -32
- package/package.nls.json +0 -34
- package/package.nls.nl.json +0 -32
- package/package.nls.pl.json +0 -32
- package/package.nls.pt-BR.json +0 -29
- package/package.nls.pt-PT.json +0 -29
- package/package.nls.ru.json +0 -29
- package/package.nls.zh-CN.json +0 -29
- package/package.nls.zh-TW.json +0 -29
- package/src/commands/activate.ts +0 -28
- package/src/commands/explorerArrows.ts +0 -55
- package/src/commands/fileColor.ts +0 -96
- package/src/commands/folderColor.ts +0 -96
- package/src/commands/folders.ts +0 -55
- package/src/commands/grayscale.ts +0 -55
- package/src/commands/iconPacks.ts +0 -64
- package/src/commands/index.ts +0 -32
- package/src/commands/opacity.ts +0 -46
- package/src/commands/restoreConfig.ts +0 -15
- package/src/commands/saturation.ts +0 -46
- package/src/extension.ts +0 -37
- package/src/helpers/changeDetection.ts +0 -109
- package/src/helpers/customIcons.ts +0 -8
- package/src/helpers/fileConfig.ts +0 -38
- package/src/helpers/index.ts +0 -88
- package/src/helpers/objects.ts +0 -58
- package/src/helpers/types.ts +0 -7
- package/src/i18n/index.ts +0 -78
- package/src/i18n/lang-de.ts +0 -45
- package/src/i18n/lang-en.ts +0 -45
- package/src/i18n/lang-es.ts +0 -45
- package/src/i18n/lang-fr.ts +0 -45
- package/src/i18n/lang-ja.ts +0 -45
- package/src/i18n/lang-nl.ts +0 -45
- package/src/i18n/lang-pl.ts +0 -45
- package/src/i18n/lang-pt-br.ts +0 -45
- package/src/i18n/lang-pt-pt.ts +0 -45
- package/src/i18n/lang-ru.ts +0 -45
- package/src/i18n/lang-uk.ts +0 -45
- package/src/i18n/lang-zh-cn.ts +0 -45
- package/src/i18n/lang-zh-tw.ts +0 -45
- package/src/icons/fileIcons.ts +0 -2294
- package/src/icons/folderIcons.ts +0 -835
- package/src/icons/generator/constants.ts +0 -29
- package/src/icons/generator/fileGenerator.ts +0 -233
- package/src/icons/generator/folderGenerator.ts +0 -340
- package/src/icons/generator/iconOpacity.ts +0 -111
- package/src/icons/generator/iconSaturation.ts +0 -140
- package/src/icons/generator/index.ts +0 -7
- package/src/icons/generator/jsonGenerator.ts +0 -207
- package/src/icons/generator/languageGenerator.ts +0 -127
- package/src/icons/index.ts +0 -4
- package/src/icons/languageIcons.ts +0 -144
- package/src/models/i18n/index.ts +0 -1
- package/src/models/i18n/translation.ts +0 -43
- package/src/models/iconConfiguration.ts +0 -37
- package/src/models/icons/defaultIcon.ts +0 -16
- package/src/models/icons/files/fileIcon.ts +0 -49
- package/src/models/icons/files/fileTypes.ts +0 -14
- package/src/models/icons/files/index.ts +0 -2
- package/src/models/icons/folders/folderIcon.ts +0 -34
- package/src/models/icons/folders/folderTheme.ts +0 -23
- package/src/models/icons/folders/index.ts +0 -2
- package/src/models/icons/iconJsonOptions.ts +0 -22
- package/src/models/icons/iconPack.ts +0 -12
- package/src/models/icons/index.ts +0 -6
- package/src/models/icons/languages/index.ts +0 -1
- package/src/models/icons/languages/languageIdentifier.ts +0 -26
- package/src/models/index.ts +0 -3
- package/src/models/scripts/contributors/contributor.ts +0 -22
- package/src/models/scripts/contributors/contributorsConfig.ts +0 -10
- package/src/scripts/contributors/contributors.css +0 -24
- package/src/scripts/contributors/index.ts +0 -138
- package/src/scripts/helpers/painter.ts +0 -5
- package/src/scripts/helpers/screenshots.ts +0 -32
- package/src/scripts/helpers/similarity.ts +0 -47
- package/src/scripts/helpers/titleCase.ts +0 -7
- package/src/scripts/icons/checks/checkIconAvailability.ts +0 -215
- package/src/scripts/icons/checks/checkIconConflicts.ts +0 -152
- package/src/scripts/icons/checks/checkIconUsage.ts +0 -137
- package/src/scripts/icons/checks/index.ts +0 -7
- package/src/scripts/icons/generateJson.ts +0 -11
- package/src/scripts/preview/index.ts +0 -40
- package/src/scripts/preview/preview.ts +0 -163
- package/src/scripts/preview/style.css +0 -48
- package/src/test/runTest.ts +0 -26
- package/src/test/spec/i18n/i18n.spec.ts +0 -54
- package/src/test/spec/icons/fileIcons.spec.ts +0 -250
- package/src/test/spec/icons/folderIcons.spec.ts +0 -418
- package/src/test/spec/icons/languageIcons.spec.ts +0 -184
- package/src/test/spec/index.ts +0 -36
- package/src/web/extension.ts +0 -10
- package/svgo.config.js +0 -12
- package/tsconfig.json +0 -23
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { readdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import { basename, join } from 'path';
|
|
3
|
-
import { getCustomIconPaths } from '../../helpers/customIcons';
|
|
4
|
-
import { IconJsonOptions } from '../../models';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Changes saturation of all icons in the set.
|
|
8
|
-
* @param options Icon JSON options which include the saturation value.
|
|
9
|
-
* @param fileNames Only change the saturation of certain file names.
|
|
10
|
-
*/
|
|
11
|
-
export const setIconSaturation = (
|
|
12
|
-
options: IconJsonOptions,
|
|
13
|
-
fileNames?: string[]
|
|
14
|
-
) => {
|
|
15
|
-
if (!validateSaturationValue(options.saturation)) {
|
|
16
|
-
return console.error(
|
|
17
|
-
'Invalid saturation value! Saturation must be a decimal number between 0 and 1!'
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let iconsPath = '';
|
|
22
|
-
if (basename(__dirname) === 'dist') {
|
|
23
|
-
iconsPath = join(__dirname, '..', 'icons');
|
|
24
|
-
} else {
|
|
25
|
-
// executed via script
|
|
26
|
-
iconsPath = join(__dirname, '..', '..', '..', 'icons');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const customIconPaths = getCustomIconPaths(options);
|
|
30
|
-
const iconFiles = readdirSync(iconsPath);
|
|
31
|
-
|
|
32
|
-
// read all icon files from the icons folder
|
|
33
|
-
try {
|
|
34
|
-
(fileNames || iconFiles).forEach(adjustSaturation(iconsPath, options));
|
|
35
|
-
|
|
36
|
-
customIconPaths.forEach((iconPath) => {
|
|
37
|
-
const customIcons = readdirSync(iconPath);
|
|
38
|
-
customIcons.forEach(adjustSaturation(iconPath, options));
|
|
39
|
-
});
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error(error);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Get the SVG root element.
|
|
47
|
-
* @param svg SVG file as string.
|
|
48
|
-
*/
|
|
49
|
-
const getSVGRootElement = (svg: string) => {
|
|
50
|
-
const result = new RegExp(/<svg[^>]*>/).exec(svg);
|
|
51
|
-
return result?.[0];
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Add an filter attribute to the SVG icon.
|
|
56
|
-
* @param svgRoot Root element of the SVG icon.
|
|
57
|
-
*/
|
|
58
|
-
const addFilterAttribute = (svgRoot: string) => {
|
|
59
|
-
const pattern = new RegExp(/\sfilter="[^"]+?"/);
|
|
60
|
-
// if the filter attribute already exists
|
|
61
|
-
if (pattern.test(svgRoot)) {
|
|
62
|
-
return svgRoot.replace(pattern, ' filter="url(#saturation)"');
|
|
63
|
-
} else {
|
|
64
|
-
return svgRoot.replace(/^<svg/, '<svg filter="url(#saturation)"');
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Remove the filter attribute of the SVG icon.
|
|
70
|
-
* @param svgRoot Root element of the SVG icon.
|
|
71
|
-
*/
|
|
72
|
-
const removeFilterAttribute = (svgRoot: string) => {
|
|
73
|
-
const pattern = new RegExp(/\sfilter="[^"]+?"/);
|
|
74
|
-
return svgRoot.replace(pattern, '');
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Add filter element to the SVG icon.
|
|
79
|
-
* @param svg SVG file as string.
|
|
80
|
-
*/
|
|
81
|
-
const addFilterElement = (svg: string, value: number) => {
|
|
82
|
-
const pattern = new RegExp(/<filter id="saturation".+<\/filter>(.*<\/svg>)/);
|
|
83
|
-
const filterElement = `<filter id="saturation"><feColorMatrix type="saturate" values="${value}"/></filter>`;
|
|
84
|
-
if (pattern.test(svg)) {
|
|
85
|
-
return svg.replace(pattern, `${filterElement}$1`);
|
|
86
|
-
} else {
|
|
87
|
-
return svg.replace(/<\/svg>/, `${filterElement}</svg>`);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Remove filter element from the SVG icon.
|
|
93
|
-
* @param svg SVG file as string.
|
|
94
|
-
*/
|
|
95
|
-
const removeFilterElement = (svg: string) => {
|
|
96
|
-
const pattern = new RegExp(/<filter id="saturation".+<\/filter>(.*<\/svg>)/);
|
|
97
|
-
return svg.replace(pattern, '$1');
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Validate the saturation value.
|
|
102
|
-
* @param saturation Saturation value
|
|
103
|
-
*/
|
|
104
|
-
export const validateSaturationValue = (saturation: number | undefined) => {
|
|
105
|
-
return saturation !== undefined && saturation <= 1 && saturation >= 0;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const adjustSaturation = (
|
|
109
|
-
iconsPath: any,
|
|
110
|
-
options: IconJsonOptions
|
|
111
|
-
): ((value: string, index: number, array: string[]) => void) => {
|
|
112
|
-
return (iconFileName) => {
|
|
113
|
-
const svgFilePath = join(iconsPath, iconFileName);
|
|
114
|
-
|
|
115
|
-
// Read SVG file
|
|
116
|
-
const svg = readFileSync(svgFilePath, 'utf-8');
|
|
117
|
-
|
|
118
|
-
// Get the root element of the SVG file
|
|
119
|
-
const svgRootElement = getSVGRootElement(svg);
|
|
120
|
-
if (!svgRootElement) return;
|
|
121
|
-
|
|
122
|
-
let updatedRootElement: string;
|
|
123
|
-
|
|
124
|
-
if (options.saturation !== undefined && options.saturation < 1) {
|
|
125
|
-
updatedRootElement = addFilterAttribute(svgRootElement);
|
|
126
|
-
} else {
|
|
127
|
-
updatedRootElement = removeFilterAttribute(svgRootElement);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
let updatedSVG = svg.replace(/<svg[^>]*>/, updatedRootElement);
|
|
131
|
-
|
|
132
|
-
if (options.saturation !== undefined && options.saturation < 1) {
|
|
133
|
-
updatedSVG = addFilterElement(updatedSVG, options.saturation);
|
|
134
|
-
} else {
|
|
135
|
-
updatedSVG = removeFilterElement(updatedSVG);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
writeFileSync(svgFilePath, updatedSVG);
|
|
139
|
-
};
|
|
140
|
-
};
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
existsSync,
|
|
3
|
-
readdirSync,
|
|
4
|
-
renameSync,
|
|
5
|
-
unlinkSync,
|
|
6
|
-
writeFileSync,
|
|
7
|
-
} from 'fs';
|
|
8
|
-
import merge from 'lodash.merge';
|
|
9
|
-
import { basename, join } from 'path';
|
|
10
|
-
import { getCustomIconPaths } from '../../helpers/customIcons';
|
|
11
|
-
import { getFileConfigHash } from '../../helpers/fileConfig';
|
|
12
|
-
import { IconConfiguration, IconJsonOptions } from '../../models/index';
|
|
13
|
-
import { fileIcons } from '../fileIcons';
|
|
14
|
-
import { folderIcons } from '../folderIcons';
|
|
15
|
-
import { languageIcons } from '../languageIcons';
|
|
16
|
-
import { iconJsonName } from './constants';
|
|
17
|
-
import {
|
|
18
|
-
generateFileIcons,
|
|
19
|
-
generateFolderIcons,
|
|
20
|
-
loadFileIconDefinitions,
|
|
21
|
-
loadFolderIconDefinitions,
|
|
22
|
-
loadLanguageIconDefinitions,
|
|
23
|
-
setIconOpacity,
|
|
24
|
-
setIconSaturation,
|
|
25
|
-
validateHEXColorCode,
|
|
26
|
-
validateOpacityValue,
|
|
27
|
-
validateSaturationValue,
|
|
28
|
-
} from './index';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Generate the complete icon configuration object that can be written as JSON file.
|
|
32
|
-
*/
|
|
33
|
-
export const generateIconConfigurationObject = (
|
|
34
|
-
options: IconJsonOptions
|
|
35
|
-
): IconConfiguration => {
|
|
36
|
-
const iconConfig = merge({}, new IconConfiguration(), { options });
|
|
37
|
-
const languageIconDefinitions = loadLanguageIconDefinitions(
|
|
38
|
-
languageIcons,
|
|
39
|
-
iconConfig,
|
|
40
|
-
options
|
|
41
|
-
);
|
|
42
|
-
const fileIconDefinitions = loadFileIconDefinitions(
|
|
43
|
-
fileIcons,
|
|
44
|
-
iconConfig,
|
|
45
|
-
options
|
|
46
|
-
);
|
|
47
|
-
const folderIconDefinitions = loadFolderIconDefinitions(
|
|
48
|
-
folderIcons,
|
|
49
|
-
iconConfig,
|
|
50
|
-
options
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
return merge(
|
|
54
|
-
{},
|
|
55
|
-
languageIconDefinitions,
|
|
56
|
-
fileIconDefinitions,
|
|
57
|
-
folderIconDefinitions
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Create the JSON file that is responsible for the icons in the editor.
|
|
63
|
-
* @param updatedConfigs Options that have been changed.
|
|
64
|
-
* @param updatedJSONConfig New JSON options that already include the updatedConfigs.
|
|
65
|
-
*/
|
|
66
|
-
export const createIconFile = (
|
|
67
|
-
updatedConfigs?: IconJsonOptions,
|
|
68
|
-
updatedJSONConfig: IconJsonOptions = {}
|
|
69
|
-
) => {
|
|
70
|
-
// override the default options with the new options
|
|
71
|
-
const options: IconJsonOptions = merge(
|
|
72
|
-
{},
|
|
73
|
-
getDefaultIconOptions(),
|
|
74
|
-
updatedJSONConfig
|
|
75
|
-
);
|
|
76
|
-
const json = generateIconConfigurationObject(options);
|
|
77
|
-
|
|
78
|
-
// make sure that the folder color, opacity and saturation values are entered correctly
|
|
79
|
-
if (
|
|
80
|
-
updatedConfigs?.opacity &&
|
|
81
|
-
!validateOpacityValue(updatedConfigs?.opacity)
|
|
82
|
-
) {
|
|
83
|
-
throw Error('Material Icons: Invalid opacity value!');
|
|
84
|
-
}
|
|
85
|
-
if (
|
|
86
|
-
updatedConfigs?.saturation &&
|
|
87
|
-
!validateSaturationValue(updatedConfigs?.saturation)
|
|
88
|
-
) {
|
|
89
|
-
throw Error('Material Icons: Invalid saturation value!');
|
|
90
|
-
}
|
|
91
|
-
if (
|
|
92
|
-
updatedConfigs?.folders?.color &&
|
|
93
|
-
!validateHEXColorCode(updatedConfigs?.folders?.color)
|
|
94
|
-
) {
|
|
95
|
-
throw Error('Material Icons: Invalid folder color value!');
|
|
96
|
-
}
|
|
97
|
-
if (
|
|
98
|
-
updatedConfigs?.files?.color &&
|
|
99
|
-
!validateHEXColorCode(updatedConfigs?.files?.color)
|
|
100
|
-
) {
|
|
101
|
-
throw Error('Material Icons: Invalid file color value!');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
try {
|
|
105
|
-
let iconJsonPath = __dirname;
|
|
106
|
-
// if executed via script
|
|
107
|
-
if (basename(__dirname) !== 'dist') {
|
|
108
|
-
iconJsonPath = join(__dirname, '..', '..', '..', 'dist');
|
|
109
|
-
}
|
|
110
|
-
if (!updatedConfigs || (updatedConfigs.files || {}).color) {
|
|
111
|
-
// if updatedConfigs do not exist (because of initial setup)
|
|
112
|
-
// or new config value was detected by the change detection
|
|
113
|
-
generateFileIcons(options.files?.color);
|
|
114
|
-
setIconOpacity(options, ['file.svg']);
|
|
115
|
-
}
|
|
116
|
-
if (!updatedConfigs || (updatedConfigs.folders || {}).color) {
|
|
117
|
-
// if updatedConfigs do not exist (because of initial setup)
|
|
118
|
-
// or new config value was detected by the change detection
|
|
119
|
-
generateFolderIcons(options.folders?.color);
|
|
120
|
-
setIconOpacity(options, [
|
|
121
|
-
'folder.svg',
|
|
122
|
-
'folder-open.svg',
|
|
123
|
-
'folder-root.svg',
|
|
124
|
-
'folder-root-open.svg',
|
|
125
|
-
]);
|
|
126
|
-
}
|
|
127
|
-
if (!updatedConfigs || updatedConfigs.opacity !== undefined) {
|
|
128
|
-
setIconOpacity(options);
|
|
129
|
-
}
|
|
130
|
-
if (!updatedConfigs || updatedConfigs.saturation !== undefined) {
|
|
131
|
-
setIconSaturation(options);
|
|
132
|
-
}
|
|
133
|
-
renameIconFiles(iconJsonPath, options);
|
|
134
|
-
} catch (error) {
|
|
135
|
-
throw new Error('Failed to update icons: ' + error);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
let iconJsonPath = __dirname;
|
|
140
|
-
// if executed via script
|
|
141
|
-
if (basename(__dirname) !== 'dist') {
|
|
142
|
-
iconJsonPath = join(__dirname, '..', '..', '..', 'dist');
|
|
143
|
-
}
|
|
144
|
-
writeFileSync(
|
|
145
|
-
join(iconJsonPath, iconJsonName),
|
|
146
|
-
JSON.stringify(json, undefined, 2),
|
|
147
|
-
'utf-8'
|
|
148
|
-
);
|
|
149
|
-
} catch (error) {
|
|
150
|
-
throw new Error('Failed to create icon file: ' + error);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return iconJsonName;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* The options control the generator and decide which icons are disabled or not.
|
|
158
|
-
*/
|
|
159
|
-
export const getDefaultIconOptions = (): Required<IconJsonOptions> => ({
|
|
160
|
-
folders: {
|
|
161
|
-
theme: 'specific',
|
|
162
|
-
color: '#90a4ae',
|
|
163
|
-
associations: {},
|
|
164
|
-
},
|
|
165
|
-
activeIconPack: 'angular',
|
|
166
|
-
hidesExplorerArrows: false,
|
|
167
|
-
opacity: 1,
|
|
168
|
-
saturation: 1,
|
|
169
|
-
files: {
|
|
170
|
-
color: '#90a4ae',
|
|
171
|
-
associations: {},
|
|
172
|
-
},
|
|
173
|
-
languages: { associations: {} },
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Rename all icon files according their respective config
|
|
178
|
-
* @param iconJsonPath Path of icon json folder
|
|
179
|
-
* @param options Icon Json Options
|
|
180
|
-
*/
|
|
181
|
-
const renameIconFiles = (iconJsonPath: string, options: IconJsonOptions) => {
|
|
182
|
-
const customPaths = getCustomIconPaths(options);
|
|
183
|
-
const defaultIconPath = join(iconJsonPath, '..', 'icons');
|
|
184
|
-
const iconPaths = [defaultIconPath, ...customPaths];
|
|
185
|
-
|
|
186
|
-
iconPaths.forEach((iconPath) => {
|
|
187
|
-
readdirSync(iconPath)
|
|
188
|
-
.filter((f) => f.match(/\.svg/gi))
|
|
189
|
-
.forEach((f) => {
|
|
190
|
-
const filePath = join(iconPath, f);
|
|
191
|
-
const fileConfigHash = getFileConfigHash(options);
|
|
192
|
-
|
|
193
|
-
// append file config to file name
|
|
194
|
-
const newFilePath = join(
|
|
195
|
-
iconPath,
|
|
196
|
-
f.replace(/(^[^\.~]+)(.*)\.svg/, `$1${fileConfigHash}.svg`)
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
// if generated files are already in place, do not overwrite them
|
|
200
|
-
if (filePath !== newFilePath && existsSync(newFilePath)) {
|
|
201
|
-
unlinkSync(filePath);
|
|
202
|
-
} else {
|
|
203
|
-
renameSync(filePath, newFilePath);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
};
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash.merge';
|
|
2
|
-
import { getFileConfigHash } from '../../helpers/fileConfig';
|
|
3
|
-
import {
|
|
4
|
-
DefaultIcon,
|
|
5
|
-
IconAssociations,
|
|
6
|
-
IconConfiguration,
|
|
7
|
-
IconJsonOptions,
|
|
8
|
-
LanguageIcon,
|
|
9
|
-
} from '../../models/index';
|
|
10
|
-
import {
|
|
11
|
-
highContrastColorFileEnding,
|
|
12
|
-
iconFolderPath,
|
|
13
|
-
lightColorFileEnding,
|
|
14
|
-
} from './constants';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get all file icons that can be used in this theme.
|
|
18
|
-
*/
|
|
19
|
-
export const loadLanguageIconDefinitions = (
|
|
20
|
-
languages: LanguageIcon[],
|
|
21
|
-
config: IconConfiguration,
|
|
22
|
-
options: IconJsonOptions
|
|
23
|
-
): IconConfiguration => {
|
|
24
|
-
config = merge({}, config);
|
|
25
|
-
const enabledLanguages = disableLanguagesByPack(
|
|
26
|
-
languages,
|
|
27
|
-
options.activeIconPack
|
|
28
|
-
);
|
|
29
|
-
const customIcons = getCustomIcons(options.languages?.associations);
|
|
30
|
-
const allLanguageIcons = [...enabledLanguages, ...customIcons];
|
|
31
|
-
|
|
32
|
-
allLanguageIcons.forEach((lang) => {
|
|
33
|
-
if (lang.disabled) return;
|
|
34
|
-
config = setIconDefinitions(config, lang.icon);
|
|
35
|
-
config = merge(
|
|
36
|
-
{},
|
|
37
|
-
config,
|
|
38
|
-
setLanguageIdentifiers(lang.icon.name, lang.ids)
|
|
39
|
-
);
|
|
40
|
-
config.light = lang.icon.light
|
|
41
|
-
? merge(
|
|
42
|
-
{},
|
|
43
|
-
config.light,
|
|
44
|
-
setLanguageIdentifiers(
|
|
45
|
-
lang.icon.name + lightColorFileEnding,
|
|
46
|
-
lang.ids
|
|
47
|
-
)
|
|
48
|
-
)
|
|
49
|
-
: config.light;
|
|
50
|
-
config.highContrast = lang.icon.highContrast
|
|
51
|
-
? merge(
|
|
52
|
-
{},
|
|
53
|
-
config.highContrast,
|
|
54
|
-
setLanguageIdentifiers(
|
|
55
|
-
lang.icon.name + highContrastColorFileEnding,
|
|
56
|
-
lang.ids
|
|
57
|
-
)
|
|
58
|
-
)
|
|
59
|
-
: config.highContrast;
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return config;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const setIconDefinitions = (config: IconConfiguration, icon: DefaultIcon) => {
|
|
66
|
-
config = merge({}, config);
|
|
67
|
-
config = createIconDefinitions(config, icon.name);
|
|
68
|
-
config = merge(
|
|
69
|
-
{},
|
|
70
|
-
config,
|
|
71
|
-
icon.light
|
|
72
|
-
? createIconDefinitions(config, icon.name + lightColorFileEnding)
|
|
73
|
-
: config.light
|
|
74
|
-
);
|
|
75
|
-
config = merge(
|
|
76
|
-
{},
|
|
77
|
-
config,
|
|
78
|
-
icon.highContrast
|
|
79
|
-
? createIconDefinitions(config, icon.name + highContrastColorFileEnding)
|
|
80
|
-
: config.highContrast
|
|
81
|
-
);
|
|
82
|
-
return config;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const createIconDefinitions = (config: IconConfiguration, iconName: string) => {
|
|
86
|
-
config = merge({}, config);
|
|
87
|
-
const fileConfigHash = getFileConfigHash(config.options ?? {});
|
|
88
|
-
if (config.iconDefinitions) {
|
|
89
|
-
config.iconDefinitions[iconName] = {
|
|
90
|
-
iconPath: `${iconFolderPath}${iconName}${fileConfigHash}.svg`,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return config;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const setLanguageIdentifiers = (iconName: string, languageIds: string[]) => {
|
|
97
|
-
const obj: Partial<IconConfiguration> = { languageIds: {} };
|
|
98
|
-
languageIds.forEach((id) => {
|
|
99
|
-
obj.languageIds![id as keyof IconConfiguration] = iconName;
|
|
100
|
-
});
|
|
101
|
-
return obj;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const getCustomIcons = (languageAssociations: IconAssociations | undefined) => {
|
|
105
|
-
if (!languageAssociations) return [];
|
|
106
|
-
|
|
107
|
-
const icons: LanguageIcon[] = Object.keys(languageAssociations).map((fa) => ({
|
|
108
|
-
icon: { name: languageAssociations[fa].toLowerCase() },
|
|
109
|
-
ids: [fa.toLowerCase()],
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
return icons;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Disable all file icons that are in a pack which is disabled.
|
|
117
|
-
*/
|
|
118
|
-
const disableLanguagesByPack = (
|
|
119
|
-
languageIcons: LanguageIcon[],
|
|
120
|
-
activatedIconPack: string | undefined
|
|
121
|
-
) => {
|
|
122
|
-
return languageIcons.filter((language) => {
|
|
123
|
-
return !language.enabledFor
|
|
124
|
-
? true
|
|
125
|
-
: language.enabledFor.some((p) => p === activatedIconPack);
|
|
126
|
-
});
|
|
127
|
-
};
|
package/src/icons/index.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { LanguageIcon } from '../models';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Defines icons for language ids
|
|
5
|
-
*/
|
|
6
|
-
export const languageIcons: LanguageIcon[] = [
|
|
7
|
-
{ icon: { name: 'git' }, ids: ['git', 'git-commit', 'git-rebase', 'ignore'] },
|
|
8
|
-
{ icon: { name: 'yaml' }, ids: ['yaml'] },
|
|
9
|
-
{ icon: { name: 'xml' }, ids: ['xml', 'xquery', 'xsl'] },
|
|
10
|
-
{ icon: { name: 'matlab' }, ids: ['matlab'] },
|
|
11
|
-
{
|
|
12
|
-
icon: { name: 'settings' },
|
|
13
|
-
ids: ['makefile', 'toml', 'ini', 'properties'],
|
|
14
|
-
},
|
|
15
|
-
{ icon: { name: 'shaderlab' }, ids: ['shaderlab'] },
|
|
16
|
-
{ icon: { name: 'diff' }, ids: ['diff'] },
|
|
17
|
-
{ icon: { name: 'json' }, ids: ['json', 'jsonc', 'json5'] },
|
|
18
|
-
{ icon: { name: 'blink' }, ids: ['blink'] },
|
|
19
|
-
{ icon: { name: 'java' }, ids: ['java'] },
|
|
20
|
-
{ icon: { name: 'razor' }, ids: ['razor', 'aspnetcorerazor'] },
|
|
21
|
-
{ icon: { name: 'python' }, ids: ['python'] },
|
|
22
|
-
{ icon: { name: 'javascript' }, ids: ['javascript'] },
|
|
23
|
-
{ icon: { name: 'typescript' }, ids: ['typescript'] },
|
|
24
|
-
{ icon: { name: 'scala' }, ids: ['scala'] },
|
|
25
|
-
{ icon: { name: 'handlebars' }, ids: ['handlebars'] },
|
|
26
|
-
{ icon: { name: 'perl' }, ids: ['perl', 'perl6'] },
|
|
27
|
-
{ icon: { name: 'haxe' }, ids: ['haxe', 'hxml'] },
|
|
28
|
-
{ icon: { name: 'puppet' }, ids: ['puppet'] },
|
|
29
|
-
{ icon: { name: 'elixir' }, ids: ['elixir'] },
|
|
30
|
-
{ icon: { name: 'livescript' }, ids: ['livescript'] },
|
|
31
|
-
{ icon: { name: 'erlang' }, ids: ['erlang'] },
|
|
32
|
-
{ icon: { name: 'twig' }, ids: ['twig'] },
|
|
33
|
-
{ icon: { name: 'julia' }, ids: ['julia'] },
|
|
34
|
-
{ icon: { name: 'elm' }, ids: ['elm'] },
|
|
35
|
-
{ icon: { name: 'purescript' }, ids: ['purescript'] },
|
|
36
|
-
{ icon: { name: 'stylus' }, ids: ['stylus'] },
|
|
37
|
-
{ icon: { name: 'nunjucks' }, ids: ['nunjucks'] },
|
|
38
|
-
{ icon: { name: 'pug' }, ids: ['pug'] },
|
|
39
|
-
{ icon: { name: 'robot' }, ids: ['robotframework'] },
|
|
40
|
-
{ icon: { name: 'sass' }, ids: ['sass', 'scss'] },
|
|
41
|
-
{ icon: { name: 'less' }, ids: ['less'] },
|
|
42
|
-
{ icon: { name: 'css' }, ids: ['css'] },
|
|
43
|
-
{ icon: { name: 'visualstudio' }, ids: ['testOutput', 'vb'] },
|
|
44
|
-
{ icon: { name: 'angular' }, ids: ['ng-template'] },
|
|
45
|
-
{ icon: { name: 'graphql' }, ids: ['graphql'] },
|
|
46
|
-
{ icon: { name: 'solidity' }, ids: ['solidity'] },
|
|
47
|
-
{ icon: { name: 'autoit' }, ids: ['autoit'] },
|
|
48
|
-
{ icon: { name: 'haml' }, ids: ['haml'] },
|
|
49
|
-
{ icon: { name: 'yang' }, ids: ['yang'] },
|
|
50
|
-
{ icon: { name: 'terraform' }, ids: ['terraform'] },
|
|
51
|
-
{ icon: { name: 'applescript' }, ids: ['applescript'] },
|
|
52
|
-
{ icon: { name: 'cake' }, ids: ['cake'] },
|
|
53
|
-
{ icon: { name: 'cucumber' }, ids: ['cucumber'] },
|
|
54
|
-
{ icon: { name: 'nim' }, ids: ['nim', 'nimble'] },
|
|
55
|
-
{ icon: { name: 'apiblueprint' }, ids: ['apiblueprint'] },
|
|
56
|
-
{ icon: { name: 'riot' }, ids: ['riot'] },
|
|
57
|
-
{ icon: { name: 'postcss' }, ids: ['postcss'] },
|
|
58
|
-
{ icon: { name: 'coldfusion' }, ids: ['lang-cfml'] },
|
|
59
|
-
{ icon: { name: 'haskell' }, ids: ['haskell'] },
|
|
60
|
-
{ icon: { name: 'dhall' }, ids: ['dhall'] },
|
|
61
|
-
{ icon: { name: 'cabal' }, ids: ['cabal'] },
|
|
62
|
-
{ icon: { name: 'nix' }, ids: ['nix'] },
|
|
63
|
-
{ icon: { name: 'ruby' }, ids: ['ruby'] },
|
|
64
|
-
{ icon: { name: 'slim' }, ids: ['slim'] },
|
|
65
|
-
{ icon: { name: 'php' }, ids: ['php'] },
|
|
66
|
-
{ icon: { name: 'php_elephant' }, ids: [] },
|
|
67
|
-
{ icon: { name: 'php_elephant_pink' }, ids: [] },
|
|
68
|
-
{ icon: { name: 'hack' }, ids: ['hack'] },
|
|
69
|
-
{ icon: { name: 'react' }, ids: ['javascriptreact'] },
|
|
70
|
-
{ icon: { name: 'mjml' }, ids: ['mjml'] },
|
|
71
|
-
{ icon: { name: 'processing' }, ids: ['processing'] },
|
|
72
|
-
{ icon: { name: 'hcl' }, ids: ['hcl'] },
|
|
73
|
-
{ icon: { name: 'go' }, ids: ['go'] },
|
|
74
|
-
{ icon: { name: 'go_gopher' }, ids: [] },
|
|
75
|
-
{ icon: { name: 'nodejs_alt' }, ids: [] },
|
|
76
|
-
{ icon: { name: 'django' }, ids: ['django-html', 'django-txt'] },
|
|
77
|
-
{ icon: { name: 'html' }, ids: ['html'] },
|
|
78
|
-
{ icon: { name: 'godot' }, ids: ['gdscript'] },
|
|
79
|
-
{ icon: { name: 'godot-assets' }, ids: ['gdresource', 'gdshader'] },
|
|
80
|
-
{ icon: { name: 'vim' }, ids: ['viml'] },
|
|
81
|
-
{ icon: { name: 'silverstripe' }, ids: [] },
|
|
82
|
-
{ icon: { name: 'prolog' }, ids: ['prolog'] },
|
|
83
|
-
{ icon: { name: 'pawn' }, ids: ['pawn'] },
|
|
84
|
-
{ icon: { name: 'reason' }, ids: ['reason', 'reason_lisp'] },
|
|
85
|
-
{ icon: { name: 'sml' }, ids: ['sml'] },
|
|
86
|
-
{ icon: { name: 'tex' }, ids: ['tex', 'doctex', 'latex', 'latex-expl3'] },
|
|
87
|
-
{ icon: { name: 'salesforce' }, ids: ['apex'] },
|
|
88
|
-
{ icon: { name: 'sas' }, ids: ['sas'] },
|
|
89
|
-
{ icon: { name: 'docker' }, ids: ['dockerfile'] },
|
|
90
|
-
{ icon: { name: 'table' }, ids: ['csv', 'tsv', 'psv'] },
|
|
91
|
-
{ icon: { name: 'csharp' }, ids: ['csharp'] },
|
|
92
|
-
{ icon: { name: 'console' }, ids: ['bat', 'awk', 'shellscript'] },
|
|
93
|
-
{ icon: { name: 'c' }, ids: ['c'] },
|
|
94
|
-
{ icon: { name: 'cpp' }, ids: ['cpp'] },
|
|
95
|
-
{ icon: { name: 'objective-c' }, ids: ['objective-c'] },
|
|
96
|
-
{ icon: { name: 'objective-cpp' }, ids: ['objective-cpp'] },
|
|
97
|
-
{ icon: { name: 'coffee' }, ids: ['coffeescript'] },
|
|
98
|
-
{ icon: { name: 'fsharp' }, ids: ['fsharp'] },
|
|
99
|
-
{ icon: { name: 'editorconfig' }, ids: ['editorconfig'] },
|
|
100
|
-
{ icon: { name: 'clojure' }, ids: ['clojure'] },
|
|
101
|
-
{ icon: { name: 'groovy' }, ids: ['groovy'] },
|
|
102
|
-
{ icon: { name: 'markdown' }, ids: ['markdown'] },
|
|
103
|
-
{ icon: { name: 'jinja' }, ids: ['jinja'] },
|
|
104
|
-
{ icon: { name: 'proto' }, ids: ['proto'] },
|
|
105
|
-
{ icon: { name: 'python-misc' }, ids: ['pip-requirements'] },
|
|
106
|
-
{ icon: { name: 'vue' }, ids: ['vue', 'vue-postcss', 'vue-html'] },
|
|
107
|
-
{ icon: { name: 'lua' }, ids: ['lua'] },
|
|
108
|
-
{ icon: { name: 'lib' }, ids: ['bibtex', 'bibtex-style'] },
|
|
109
|
-
{ icon: { name: 'log' }, ids: ['log'] },
|
|
110
|
-
{ icon: { name: 'jupyter' }, ids: ['jupyter'] },
|
|
111
|
-
{ icon: { name: 'document' }, ids: ['plaintext'] },
|
|
112
|
-
{ icon: { name: 'pdf' }, ids: ['pdf'] },
|
|
113
|
-
{ icon: { name: 'powershell' }, ids: ['powershell'] },
|
|
114
|
-
{ icon: { name: 'pug' }, ids: ['jade'] },
|
|
115
|
-
{ icon: { name: 'r' }, ids: ['r', 'rsweave'] },
|
|
116
|
-
{ icon: { name: 'rust' }, ids: ['rust'] },
|
|
117
|
-
{ icon: { name: 'database' }, ids: ['sql'] },
|
|
118
|
-
{ icon: { name: 'kusto' }, ids: ['kql'] },
|
|
119
|
-
{ icon: { name: 'lock' }, ids: ['ssh_config'] },
|
|
120
|
-
{ icon: { name: 'svg' }, ids: ['svg'] },
|
|
121
|
-
{ icon: { name: 'swift' }, ids: ['swift'] },
|
|
122
|
-
{ icon: { name: 'react_ts' }, ids: ['typescriptreact'] },
|
|
123
|
-
{ icon: { name: 'search' }, ids: ['search-result'] },
|
|
124
|
-
{ icon: { name: 'minecraft' }, ids: ['mcfunction'] },
|
|
125
|
-
{ icon: { name: 'rescript' }, ids: ['rescript'] },
|
|
126
|
-
{ icon: { name: 'otne' }, ids: ['otne'] },
|
|
127
|
-
{
|
|
128
|
-
icon: { name: 'twine' },
|
|
129
|
-
ids: ['twee3', 'twee3-harlowe-3', 'twee3-chapbook-1', 'twee3-sugarcube-2'],
|
|
130
|
-
},
|
|
131
|
-
{ icon: { name: 'grain' }, ids: ['grain'] },
|
|
132
|
-
{ icon: { name: 'lolcode' }, ids: ['lolcode'] },
|
|
133
|
-
{ icon: { name: 'idris' }, ids: ['idris'] },
|
|
134
|
-
{ icon: { name: 'chess' }, ids: ['pgn'] },
|
|
135
|
-
{ icon: { name: 'gemini' }, ids: ['gemini', 'text-gemini'] },
|
|
136
|
-
{ icon: { name: 'vlang' }, ids: ['v'] },
|
|
137
|
-
{ icon: { name: 'wolframlanguage' }, ids: ['wolfram'] },
|
|
138
|
-
{ icon: { name: 'shader' }, ids: ['hlsl', 'glsl', 'wgsl'] },
|
|
139
|
-
{ icon: { name: 'tree' }, ids: ['tree'] },
|
|
140
|
-
{ icon: { name: 'svelte' }, ids: ['svelte'] },
|
|
141
|
-
{ icon: { name: 'dart' }, ids: ['dart'] },
|
|
142
|
-
{ icon: { name: 'cadence' }, ids: ['cadence'] },
|
|
143
|
-
{ icon: { name: 'stylable' }, ids: ['stylable'] },
|
|
144
|
-
];
|
package/src/models/i18n/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './translation';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export interface Translation {
|
|
2
|
-
activate: string;
|
|
3
|
-
activated: string;
|
|
4
|
-
iconPacks: {
|
|
5
|
-
selectPack: string;
|
|
6
|
-
description: string;
|
|
7
|
-
disabled: string;
|
|
8
|
-
};
|
|
9
|
-
folders: {
|
|
10
|
-
toggleIcons: string;
|
|
11
|
-
disabled: string;
|
|
12
|
-
theme: {
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
colorSelect: {
|
|
17
|
-
color: string;
|
|
18
|
-
hexCode: string;
|
|
19
|
-
wrongHexCode: string;
|
|
20
|
-
};
|
|
21
|
-
opacity: {
|
|
22
|
-
inputPlaceholder: string;
|
|
23
|
-
wrongValue: string;
|
|
24
|
-
};
|
|
25
|
-
toggleSwitch: {
|
|
26
|
-
on: string;
|
|
27
|
-
off: string;
|
|
28
|
-
};
|
|
29
|
-
explorerArrows: {
|
|
30
|
-
toggle: string;
|
|
31
|
-
enable: string;
|
|
32
|
-
disable: string;
|
|
33
|
-
};
|
|
34
|
-
grayscale: {
|
|
35
|
-
toggle: string;
|
|
36
|
-
enable: string;
|
|
37
|
-
disable: string;
|
|
38
|
-
};
|
|
39
|
-
saturation: {
|
|
40
|
-
inputPlaceholder: string;
|
|
41
|
-
wrongValue: string;
|
|
42
|
-
};
|
|
43
|
-
}
|