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
package/src/extension.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { ExtensionContext, window as codeWindow, workspace } from 'vscode';
|
|
4
|
-
import { registered } from './commands';
|
|
5
|
-
import { detectConfigChanges } from './helpers/changeDetection';
|
|
6
|
-
import { initTranslations } from './i18n';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This method is called when the extension is activated.
|
|
10
|
-
* It initializes the core functionality of the extension.
|
|
11
|
-
*/
|
|
12
|
-
export const activate = async (context: ExtensionContext) => {
|
|
13
|
-
try {
|
|
14
|
-
await initTranslations();
|
|
15
|
-
|
|
16
|
-
// Subscribe to the extension commands
|
|
17
|
-
context.subscriptions.push(...registered);
|
|
18
|
-
|
|
19
|
-
// Initially trigger the config change detection
|
|
20
|
-
detectConfigChanges();
|
|
21
|
-
|
|
22
|
-
// Observe changes in the config
|
|
23
|
-
workspace.onDidChangeConfiguration(detectConfigChanges);
|
|
24
|
-
|
|
25
|
-
// Observe if the window got focused to trigger config changes
|
|
26
|
-
codeWindow.onDidChangeWindowState((state) => {
|
|
27
|
-
if (state.focused) {
|
|
28
|
-
detectConfigChanges();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error(error);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/** This method is called when the extension is deactivated */
|
|
37
|
-
export const deactivate = () => {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash.merge';
|
|
2
|
-
import { getConfigProperties, getMaterialIconsJSON, getThemeConfig } from '.';
|
|
3
|
-
import { createIconFile } from '../icons/index';
|
|
4
|
-
import { IconJsonOptions } from '../models';
|
|
5
|
-
import { getObjectPropertyValue, setObjectPropertyValue } from './objects';
|
|
6
|
-
|
|
7
|
-
/** Compare the workspace and the user configurations with the current setup of the icons. */
|
|
8
|
-
export const detectConfigChanges = () => {
|
|
9
|
-
const changes = compareConfigs();
|
|
10
|
-
|
|
11
|
-
// if there's nothing to update
|
|
12
|
-
if (Object.keys(changes.updatedConfigs).length === 0) return;
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
// update icon json file with new options
|
|
16
|
-
createIconFile(changes.updatedConfigs, changes.updatedJSONConfig);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error(error);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Compares a specific configuration in the settings with a current configuration state.
|
|
24
|
-
* The current configuration state is read from the icons json file.
|
|
25
|
-
* @returns List of configurations that needs to be updated.
|
|
26
|
-
*/
|
|
27
|
-
const compareConfigs = (): {
|
|
28
|
-
updatedConfigs: IconJsonOptions;
|
|
29
|
-
updatedJSONConfig: IconJsonOptions;
|
|
30
|
-
} => {
|
|
31
|
-
const configPropertyNames = Object.keys(getConfigProperties())
|
|
32
|
-
.map((c) => c.split('.').slice(1).join('.'))
|
|
33
|
-
// remove configurable notification messages
|
|
34
|
-
.filter((c) => !/show(Welcome|Update|Reload)Message/g.test(c));
|
|
35
|
-
|
|
36
|
-
const json = getMaterialIconsJSON();
|
|
37
|
-
return configPropertyNames.reduce(
|
|
38
|
-
(result, configName) => {
|
|
39
|
-
try {
|
|
40
|
-
const themeConfig = getThemeConfig(configName) ?? {
|
|
41
|
-
globalValue: '',
|
|
42
|
-
workspaceValue: '',
|
|
43
|
-
defaultValue: '',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const configValue = getConfigValue(
|
|
47
|
-
themeConfig as {
|
|
48
|
-
globalValue: unknown;
|
|
49
|
-
workspaceValue: unknown;
|
|
50
|
-
defaultValue: unknown;
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const currentState = getObjectPropertyValue(
|
|
55
|
-
json.options ?? {},
|
|
56
|
-
configName
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
if (JSON.stringify(configValue) !== JSON.stringify(currentState)) {
|
|
60
|
-
setObjectPropertyValue(json.options as {}, configName, configValue);
|
|
61
|
-
setObjectPropertyValue(
|
|
62
|
-
result.updatedConfigs,
|
|
63
|
-
configName,
|
|
64
|
-
configValue
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error(error);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return result;
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
updatedConfigs: {} as IconJsonOptions,
|
|
75
|
-
updatedJSONConfig: json.options as IconJsonOptions,
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Returns the value of a specific configuration by checking the workspace and the user configuration and fallback to the default value.
|
|
82
|
-
*
|
|
83
|
-
* @param themeConfig Theme configuration
|
|
84
|
-
* @returns Actual theme configuration value
|
|
85
|
-
*/
|
|
86
|
-
const getConfigValue = (themeConfig: {
|
|
87
|
-
globalValue: unknown;
|
|
88
|
-
workspaceValue: unknown;
|
|
89
|
-
defaultValue: unknown;
|
|
90
|
-
}) => {
|
|
91
|
-
let configValue;
|
|
92
|
-
if (
|
|
93
|
-
typeof themeConfig.workspaceValue === 'object' &&
|
|
94
|
-
themeConfig.workspaceValue &&
|
|
95
|
-
themeConfig.globalValue
|
|
96
|
-
) {
|
|
97
|
-
configValue = merge(
|
|
98
|
-
{},
|
|
99
|
-
themeConfig.workspaceValue,
|
|
100
|
-
themeConfig.globalValue
|
|
101
|
-
);
|
|
102
|
-
} else {
|
|
103
|
-
configValue =
|
|
104
|
-
themeConfig.workspaceValue ??
|
|
105
|
-
themeConfig.globalValue ??
|
|
106
|
-
themeConfig.defaultValue;
|
|
107
|
-
}
|
|
108
|
-
return configValue;
|
|
109
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { dirname, join } from 'path';
|
|
2
|
-
import { IconJsonOptions } from '../models';
|
|
3
|
-
|
|
4
|
-
export const getCustomIconPaths = (options: IconJsonOptions) => {
|
|
5
|
-
return Object.values(options?.files?.associations ?? {})
|
|
6
|
-
.filter((v) => v.match(/^[.\/]+/)) // <- custom dirs have a relative path to the dist folder
|
|
7
|
-
.map((v) => dirname(join(__dirname, v)));
|
|
8
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { getDefaultIconOptions } from '../icons';
|
|
2
|
-
import { IconJsonOptions } from '../models';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Generate a config hashed string that is appended to each icon file name.
|
|
6
|
-
* @param config Icon Configuration object
|
|
7
|
-
*/
|
|
8
|
-
export const getFileConfigHash = (options: IconJsonOptions): string => {
|
|
9
|
-
try {
|
|
10
|
-
const defaults = getDefaultIconOptions();
|
|
11
|
-
let fileConfigString = '';
|
|
12
|
-
if (
|
|
13
|
-
options.saturation !== defaults.saturation ||
|
|
14
|
-
options.opacity !== defaults.opacity ||
|
|
15
|
-
options.folders?.color !== defaults.folders.color ||
|
|
16
|
-
options.files?.color !== defaults.files.color
|
|
17
|
-
) {
|
|
18
|
-
fileConfigString += `~${getHash(JSON.stringify(options))}`;
|
|
19
|
-
}
|
|
20
|
-
return fileConfigString;
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.error(error);
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const getHash = (value: string) => {
|
|
28
|
-
let hash = 0;
|
|
29
|
-
let chr = 0;
|
|
30
|
-
|
|
31
|
-
if (value.length === 0) return hash;
|
|
32
|
-
for (let i = 0; i < value.length; i++) {
|
|
33
|
-
chr = value.charCodeAt(i);
|
|
34
|
-
hash = (hash << 5) - hash + chr;
|
|
35
|
-
hash |= 0; // Convert to 32bit integer
|
|
36
|
-
}
|
|
37
|
-
return hash;
|
|
38
|
-
};
|
package/src/helpers/index.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { extensions, workspace } from 'vscode';
|
|
4
|
-
import { iconJsonName } from '../icons/index';
|
|
5
|
-
import { IconConfiguration } from '../models/index';
|
|
6
|
-
|
|
7
|
-
/** Get configuration of vs code. */
|
|
8
|
-
export const getConfig = (section?: string) => {
|
|
9
|
-
return workspace.getConfiguration(section);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/** Get list of configuration entries of package.json */
|
|
13
|
-
export const getConfigProperties = (): { [config: string]: unknown } => {
|
|
14
|
-
return extensions.getExtension('PKief.material-icon-theme')?.packageJSON
|
|
15
|
-
?.contributes?.configuration?.properties;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/** Update configuration of vs code. */
|
|
19
|
-
export const setConfig = (
|
|
20
|
-
section: string,
|
|
21
|
-
value: any,
|
|
22
|
-
global: boolean = false
|
|
23
|
-
) => {
|
|
24
|
-
return getConfig().update(section, value, global);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const getThemeConfig = (section: string) => {
|
|
28
|
-
return getConfig('material-icon-theme').inspect(section);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/** Set the config of the theme. */
|
|
32
|
-
export const setThemeConfig = (
|
|
33
|
-
section: string,
|
|
34
|
-
value: any,
|
|
35
|
-
global: boolean = false
|
|
36
|
-
) => {
|
|
37
|
-
return getConfig('material-icon-theme').update(section, value, global);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Checks if the theme is the active icon theme
|
|
42
|
-
* @param{boolean} global false by default
|
|
43
|
-
*/
|
|
44
|
-
export const isThemeActivated = (global: boolean = false): boolean => {
|
|
45
|
-
return global
|
|
46
|
-
? getConfig().inspect('workbench.iconTheme')?.globalValue ===
|
|
47
|
-
'material-icon-theme'
|
|
48
|
-
: getConfig().inspect('workbench.iconTheme')?.workspaceValue ===
|
|
49
|
-
'material-icon-theme';
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/** Checks if the theme is not the active icon theme */
|
|
53
|
-
export const isThemeNotVisible = (): boolean => {
|
|
54
|
-
const config = getConfig().inspect('workbench.iconTheme');
|
|
55
|
-
return (
|
|
56
|
-
(!isThemeActivated(true) && !config?.workspaceValue) || // no workspace and not global
|
|
57
|
-
(!isThemeActivated() && !!config?.workspaceValue)
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/** Return the path of the extension in the file system. */
|
|
62
|
-
const getExtensionPath = () =>
|
|
63
|
-
extensions.getExtension('PKief.material-icon-theme')?.extensionPath ?? '';
|
|
64
|
-
|
|
65
|
-
/** Get the configuration of the icons as JSON Object */
|
|
66
|
-
export const getMaterialIconsJSON = (): IconConfiguration => {
|
|
67
|
-
const iconJSONPath = join(getExtensionPath(), 'dist', iconJsonName);
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
const data = readFileSync(iconJSONPath, 'utf8');
|
|
71
|
-
return JSON.parse(data);
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error(error);
|
|
74
|
-
return {};
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/** Capitalize the first letter of a string */
|
|
79
|
-
export const capitalizeFirstLetter = (name: string): string =>
|
|
80
|
-
name.charAt(0).toUpperCase() + name.slice(1);
|
|
81
|
-
|
|
82
|
-
/** TitleCase all words in a string */
|
|
83
|
-
export const toTitleCase = (value: string) => {
|
|
84
|
-
return value.replace(
|
|
85
|
-
/\w\S*/g,
|
|
86
|
-
(text) => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase()
|
|
87
|
-
);
|
|
88
|
-
};
|
package/src/helpers/objects.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the nested properties of an object.
|
|
3
|
-
* This solution is lighter than the lodash get-version.
|
|
4
|
-
* Source: http://stackoverflow.com/a/6491621/6942210
|
|
5
|
-
*/
|
|
6
|
-
export const getObjectPropertyValue = (obj: Object, path: string) => {
|
|
7
|
-
const pathArray = path
|
|
8
|
-
.replace(/\[(\w+)\]/g, '.$1') // convert indexes to properties
|
|
9
|
-
.replace(/^\./, '') // strip a leading dot
|
|
10
|
-
.split('.'); // separate paths in array
|
|
11
|
-
|
|
12
|
-
/** Avoid errors in the getValue function. */
|
|
13
|
-
const isObject = (object: unknown) => {
|
|
14
|
-
return object === Object(object);
|
|
15
|
-
};
|
|
16
|
-
let result = JSON.parse(JSON.stringify(obj));
|
|
17
|
-
|
|
18
|
-
for (let i = 0; i < pathArray.length; ++i) {
|
|
19
|
-
const k = pathArray[i];
|
|
20
|
-
if (isObject(result) && k in result) {
|
|
21
|
-
result = result[k];
|
|
22
|
-
} else {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Set a value for a nested object property.
|
|
31
|
-
* @param obj Object
|
|
32
|
-
* @param path Properties as string e.g. `'a.b.c'`
|
|
33
|
-
* @param value Value to be set for the given property
|
|
34
|
-
* Source: https://stackoverflow.com/a/13719799/6942210
|
|
35
|
-
*/
|
|
36
|
-
export const setObjectPropertyValue = (
|
|
37
|
-
obj: { [key: string]: any },
|
|
38
|
-
path: string | string[],
|
|
39
|
-
value: any
|
|
40
|
-
) => {
|
|
41
|
-
if (typeof path === 'string') {
|
|
42
|
-
path = path.split('.');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (path.length > 1) {
|
|
46
|
-
const e = path.shift() ?? '';
|
|
47
|
-
setObjectPropertyValue(
|
|
48
|
-
(obj[e] =
|
|
49
|
-
Object.prototype.toString.call(obj[e]) === '[object Object]'
|
|
50
|
-
? obj[e]
|
|
51
|
-
: {}),
|
|
52
|
-
path,
|
|
53
|
-
value
|
|
54
|
-
);
|
|
55
|
-
} else {
|
|
56
|
-
obj[path[0]] = value;
|
|
57
|
-
}
|
|
58
|
-
};
|
package/src/helpers/types.ts
DELETED
package/src/i18n/index.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { env } from 'vscode';
|
|
2
|
-
import { getObjectPropertyValue } from '../helpers/objects';
|
|
3
|
-
import { Translation } from '../models';
|
|
4
|
-
|
|
5
|
-
// Get current language of the vs code workspace
|
|
6
|
-
export const getCurrentLanguage = (): string => env.language;
|
|
7
|
-
|
|
8
|
-
let currentTranslation: Translation;
|
|
9
|
-
let fallbackTranslation: Translation;
|
|
10
|
-
|
|
11
|
-
const placeholder = '%';
|
|
12
|
-
|
|
13
|
-
/** Initialize the translations */
|
|
14
|
-
export const initTranslations = async () => {
|
|
15
|
-
try {
|
|
16
|
-
currentTranslation = await loadTranslation(getCurrentLanguage());
|
|
17
|
-
fallbackTranslation = await loadTranslation('en');
|
|
18
|
-
} catch (error) {
|
|
19
|
-
console.error(error);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/** Load the required translation */
|
|
24
|
-
const loadTranslation = async (language: string) => {
|
|
25
|
-
try {
|
|
26
|
-
return await getTranslationObject(language);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
return await getTranslationObject('en');
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/** Get the translation object of the separated translation files */
|
|
33
|
-
const getTranslationObject = async (language: string): Promise<Translation> => {
|
|
34
|
-
const lang = await import(/* webpackMode: "eager" */ `./lang-${language}`);
|
|
35
|
-
return lang.translation as Translation;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* We look up the matching translation in the translation files.
|
|
40
|
-
* If we cannot find a matching key in the file we use the fallback.
|
|
41
|
-
* With optional parameters you can configure both the translations
|
|
42
|
-
* and the fallback (required for testing purposes).
|
|
43
|
-
* */
|
|
44
|
-
export const getTranslationValue = (
|
|
45
|
-
key: string,
|
|
46
|
-
translations = currentTranslation,
|
|
47
|
-
fallback = fallbackTranslation
|
|
48
|
-
): string | undefined => {
|
|
49
|
-
return (
|
|
50
|
-
getObjectPropertyValue(translations, key) ??
|
|
51
|
-
getObjectPropertyValue(fallback, key)
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The instant method is required for the translate pipe.
|
|
57
|
-
* It helps to translate a word instantly.
|
|
58
|
-
*/
|
|
59
|
-
export const translate = (key: string, ...variables: string[]): string => {
|
|
60
|
-
const translation = getTranslationValue(key);
|
|
61
|
-
|
|
62
|
-
if (variables.length === 0) return translation ?? key;
|
|
63
|
-
return replace(translation, ...variables);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The replace function will replace the current placeholder with the
|
|
68
|
-
* data parameter from the translation. You can give it one or more optional
|
|
69
|
-
* parameters ('variables').
|
|
70
|
-
*/
|
|
71
|
-
export const replace = (value: string = '', ...variables: string[]) => {
|
|
72
|
-
let translation: string = value;
|
|
73
|
-
variables.forEach((variable, i) => {
|
|
74
|
-
translation = translation.replace(`${placeholder}${i}`, variable);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
return translation;
|
|
78
|
-
};
|
package/src/i18n/lang-de.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Translation } from '../models';
|
|
2
|
-
|
|
3
|
-
export const translation: Translation = {
|
|
4
|
-
activate: 'Aktivieren',
|
|
5
|
-
activated: 'Material Icon Theme ist jetzt aktiviert.',
|
|
6
|
-
iconPacks: {
|
|
7
|
-
selectPack: 'Icon Pack auswählen',
|
|
8
|
-
description: "Das '%0' Icon Pack auswählen",
|
|
9
|
-
disabled: 'Icon Packs deaktivieren',
|
|
10
|
-
},
|
|
11
|
-
folders: {
|
|
12
|
-
toggleIcons: 'Wähle ein Ordner Design',
|
|
13
|
-
disabled: 'Keine Ordner Icons',
|
|
14
|
-
theme: {
|
|
15
|
-
description: "Wähle das '%0' Design",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
colorSelect: {
|
|
19
|
-
color: 'Wähle eine Farbe',
|
|
20
|
-
hexCode: 'Gebe einen HEX Farbcode ein',
|
|
21
|
-
wrongHexCode: 'Ungültiger HEX Farbcode',
|
|
22
|
-
},
|
|
23
|
-
opacity: {
|
|
24
|
-
inputPlaceholder: 'Wert der Deckkraft (zwischen 0 und 1)',
|
|
25
|
-
wrongValue: 'Der Wert muss zwischen 0 und 1 liegen!',
|
|
26
|
-
},
|
|
27
|
-
toggleSwitch: {
|
|
28
|
-
on: 'EIN',
|
|
29
|
-
off: 'AUS',
|
|
30
|
-
},
|
|
31
|
-
explorerArrows: {
|
|
32
|
-
toggle: 'Pfeile im Explorer anpassen',
|
|
33
|
-
enable: 'Explorer Pfeile anzeigen',
|
|
34
|
-
disable: 'Explorer Pfeile ausblenden',
|
|
35
|
-
},
|
|
36
|
-
grayscale: {
|
|
37
|
-
toggle: 'Schaltet graustufige Icons um',
|
|
38
|
-
enable: 'Aktiviert graustufige Icons',
|
|
39
|
-
disable: 'Deaktiviert graustufige Icons',
|
|
40
|
-
},
|
|
41
|
-
saturation: {
|
|
42
|
-
inputPlaceholder: 'Wert der Sättigung (zwischen 0 und 1)',
|
|
43
|
-
wrongValue: 'Der Wert muss zwischen 0 und 1 liegen!',
|
|
44
|
-
},
|
|
45
|
-
};
|
package/src/i18n/lang-en.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Translation } from '../models';
|
|
2
|
-
|
|
3
|
-
export const translation: Translation = {
|
|
4
|
-
activate: 'Activate',
|
|
5
|
-
activated: 'Material Icon Theme is active.',
|
|
6
|
-
iconPacks: {
|
|
7
|
-
selectPack: 'Select an icon pack',
|
|
8
|
-
description: "Select the '%0' icon pack",
|
|
9
|
-
disabled: 'Disable icon packs',
|
|
10
|
-
},
|
|
11
|
-
folders: {
|
|
12
|
-
toggleIcons: 'Pick a folder theme',
|
|
13
|
-
disabled: 'No folder icons',
|
|
14
|
-
theme: {
|
|
15
|
-
description: "Select the '%0' folder theme",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
colorSelect: {
|
|
19
|
-
color: 'Choose a color',
|
|
20
|
-
hexCode: 'Insert a HEX color code',
|
|
21
|
-
wrongHexCode: 'Invalid HEX color code!',
|
|
22
|
-
},
|
|
23
|
-
opacity: {
|
|
24
|
-
inputPlaceholder: 'Opacity value (between 0 and 1)',
|
|
25
|
-
wrongValue: 'Please enter a floating-point number between 0 and 1.',
|
|
26
|
-
},
|
|
27
|
-
toggleSwitch: {
|
|
28
|
-
on: 'ON',
|
|
29
|
-
off: 'OFF',
|
|
30
|
-
},
|
|
31
|
-
explorerArrows: {
|
|
32
|
-
toggle: 'Toggle folder arrows in Explorer',
|
|
33
|
-
enable: 'Show folder arrows in Explorer',
|
|
34
|
-
disable: 'Hide folder arrows in Explorer',
|
|
35
|
-
},
|
|
36
|
-
grayscale: {
|
|
37
|
-
toggle: 'Toggle grayscale icons',
|
|
38
|
-
enable: 'Enable grayscale icons',
|
|
39
|
-
disable: 'Disable grayscale icons',
|
|
40
|
-
},
|
|
41
|
-
saturation: {
|
|
42
|
-
inputPlaceholder: 'Saturation value (between 0 and 1)',
|
|
43
|
-
wrongValue: 'Please enter a floating-point number between 0 and 1.',
|
|
44
|
-
},
|
|
45
|
-
};
|
package/src/i18n/lang-es.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Translation } from '../models';
|
|
2
|
-
|
|
3
|
-
export const translation: Translation = {
|
|
4
|
-
activate: 'Activar',
|
|
5
|
-
activated: 'Material Icon Theme está activado.',
|
|
6
|
-
iconPacks: {
|
|
7
|
-
selectPack: 'Seleccione un paquete de iconos',
|
|
8
|
-
description: "Seleccione el paquete de iconos '%0'",
|
|
9
|
-
disabled: 'Desactivar paquetes de iconos',
|
|
10
|
-
},
|
|
11
|
-
folders: {
|
|
12
|
-
toggleIcons: 'Cambiar activación de iconos de carpetas',
|
|
13
|
-
disabled: 'Sin iconos de carpeta',
|
|
14
|
-
theme: {
|
|
15
|
-
description: "Iconos de carpeta '%0'",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
colorSelect: {
|
|
19
|
-
color: 'Elija un color',
|
|
20
|
-
hexCode: 'Insertar un código de color HEX',
|
|
21
|
-
wrongHexCode: '¡Código de color HEX inválido!',
|
|
22
|
-
},
|
|
23
|
-
opacity: {
|
|
24
|
-
inputPlaceholder: 'Valor de opacidad (entre 0 y 1)',
|
|
25
|
-
wrongValue: '¡El valor debe estar entre 0 y 1!',
|
|
26
|
-
},
|
|
27
|
-
toggleSwitch: {
|
|
28
|
-
on: 'ON',
|
|
29
|
-
off: 'OFF',
|
|
30
|
-
},
|
|
31
|
-
explorerArrows: {
|
|
32
|
-
toggle: 'Conmutar las flechas de carpetas',
|
|
33
|
-
enable: 'Mostrar flechas de carpeta',
|
|
34
|
-
disable: 'Ocultar las flechas de carpetas',
|
|
35
|
-
},
|
|
36
|
-
grayscale: {
|
|
37
|
-
toggle: 'Alternar los iconos en escala de grises',
|
|
38
|
-
enable: 'Activar los iconos en escala de grises',
|
|
39
|
-
disable: 'Desactivar los iconos en escala de grises',
|
|
40
|
-
},
|
|
41
|
-
saturation: {
|
|
42
|
-
inputPlaceholder: 'Valor de saturación (entre 0 y 1)',
|
|
43
|
-
wrongValue: 'El valor debe estar entre 0 y 1.',
|
|
44
|
-
},
|
|
45
|
-
};
|
package/src/i18n/lang-fr.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Translation } from '../models';
|
|
2
|
-
|
|
3
|
-
export const translation: Translation = {
|
|
4
|
-
activate: 'Activer',
|
|
5
|
-
activated: 'Material Icon Theme est actif.',
|
|
6
|
-
iconPacks: {
|
|
7
|
-
selectPack: "Sélectionnez un pack d'icônes",
|
|
8
|
-
description: "Sélectionner le pack d'icônes '%0'",
|
|
9
|
-
disabled: "Désactiver les paquets d'icônes",
|
|
10
|
-
},
|
|
11
|
-
folders: {
|
|
12
|
-
toggleIcons: 'Basculer les icônes de dossiers',
|
|
13
|
-
disabled: 'Aucune icônes de dossiers',
|
|
14
|
-
theme: {
|
|
15
|
-
description: "Icônes de dossiers '%0'",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
colorSelect: {
|
|
19
|
-
color: 'Choisissez une couleur',
|
|
20
|
-
hexCode: 'Insérer un code couleur HEX',
|
|
21
|
-
wrongHexCode: 'Code couleur HEX non valide!',
|
|
22
|
-
},
|
|
23
|
-
opacity: {
|
|
24
|
-
inputPlaceholder: "Valeur d'opacité (entre 0 et 1)",
|
|
25
|
-
wrongValue: 'La valeur doit être comprise entre 0 et 1!',
|
|
26
|
-
},
|
|
27
|
-
toggleSwitch: {
|
|
28
|
-
on: 'ON',
|
|
29
|
-
off: 'OFF',
|
|
30
|
-
},
|
|
31
|
-
explorerArrows: {
|
|
32
|
-
toggle: 'Basculer les flèches du dossier',
|
|
33
|
-
enable: 'Afficher les flèches du dossier',
|
|
34
|
-
disable: 'Cacher les flèches de dossier',
|
|
35
|
-
},
|
|
36
|
-
grayscale: {
|
|
37
|
-
toggle: 'Basculer les icônes en niveaux de gris',
|
|
38
|
-
enable: 'Activer les icônes en niveaux de gris',
|
|
39
|
-
disable: 'Désactiver les icônes en niveaux de gris',
|
|
40
|
-
},
|
|
41
|
-
saturation: {
|
|
42
|
-
inputPlaceholder: 'Valeur de saturation (entre 0 et 1)',
|
|
43
|
-
wrongValue: 'La valeur doit être comprise entre 0 et 1 !',
|
|
44
|
-
},
|
|
45
|
-
};
|
package/src/i18n/lang-ja.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Translation } from '../models';
|
|
2
|
-
|
|
3
|
-
export const translation: Translation = {
|
|
4
|
-
activate: '有効化',
|
|
5
|
-
activated: 'Material Icon Theme は有効です。',
|
|
6
|
-
iconPacks: {
|
|
7
|
-
selectPack: 'アイコンパックを選択する',
|
|
8
|
-
description: "アイコンパック '%0' を選択する",
|
|
9
|
-
disabled: 'アイコンパックを無効化する',
|
|
10
|
-
},
|
|
11
|
-
folders: {
|
|
12
|
-
toggleIcons: 'フォルダーアイコンを切り替える',
|
|
13
|
-
disabled: 'フォルダーアイコンを表示しない',
|
|
14
|
-
theme: {
|
|
15
|
-
description: "フォルダーテーマ '%0' を選択する",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
colorSelect: {
|
|
19
|
-
color: '色を変える',
|
|
20
|
-
hexCode: 'HEX カラーコードを入力する',
|
|
21
|
-
wrongHexCode: '無効な HEX カラーコードです!',
|
|
22
|
-
},
|
|
23
|
-
opacity: {
|
|
24
|
-
inputPlaceholder: '不透明度(0〜1)',
|
|
25
|
-
wrongValue: '値は0から1の間にしてください!',
|
|
26
|
-
},
|
|
27
|
-
toggleSwitch: {
|
|
28
|
-
on: 'ON',
|
|
29
|
-
off: 'OFF',
|
|
30
|
-
},
|
|
31
|
-
explorerArrows: {
|
|
32
|
-
toggle: 'フォルダーの矢印を切り替える',
|
|
33
|
-
enable: 'フォルダーの矢印を表示する',
|
|
34
|
-
disable: 'フォルダーの矢印を隠す',
|
|
35
|
-
},
|
|
36
|
-
grayscale: {
|
|
37
|
-
toggle: 'グレースケールアイコンを切り替える',
|
|
38
|
-
enable: 'グレースケールアイコンを有効にする',
|
|
39
|
-
disable: 'グレースケールアイコンを無効にする',
|
|
40
|
-
},
|
|
41
|
-
saturation: {
|
|
42
|
-
inputPlaceholder: '彩度(0〜1)',
|
|
43
|
-
wrongValue: '値は0から1の間にしてください!',
|
|
44
|
-
},
|
|
45
|
-
};
|