@uxf/icons-generator 11.88.0 → 11.88.2
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/package.json +3 -2
- package/src/scripts/cli.js +1 -1
- package/src/types.d.ts +2 -2
- package/src/utils/_createDefinitionFileContent.js +1 -1
- package/src/utils/_createSpriteContent.js +1 -1
- package/src/utils/_generateSeparateIconFiles.js +1 -1
- package/src/utils/_getConfig.js +3 -4
- package/src/utils/_iconTypeResolver.d.ts +3 -3
- package/src/utils/_iconTypeResolver.js +4 -3
- package/src/utils/_validateSourceData.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/icons-generator",
|
|
3
|
-
"version": "11.88.
|
|
3
|
+
"version": "11.88.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"url": "git+https://gitlab.com/uxf-npm/icons-generator.git"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"fast-xml-parser": "5.3.1"
|
|
21
|
+
"fast-xml-parser": "5.3.1",
|
|
22
|
+
"yargs": "18.0.0"
|
|
22
23
|
},
|
|
23
24
|
"author": "",
|
|
24
25
|
"license": "ISC",
|
package/src/scripts/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ const yargs_1 = __importDefault(require("yargs"));
|
|
|
8
8
|
const _getConfig_1 = require("../utils/_getConfig");
|
|
9
9
|
const index_1 = __importDefault(require("./index"));
|
|
10
10
|
exports.default = async () => {
|
|
11
|
-
const cli = yargs_1.default
|
|
11
|
+
const cli = (0, yargs_1.default)()
|
|
12
12
|
.command("$0", "UXF icons generator")
|
|
13
13
|
.option("c", { alias: "configFile", group: "Options", default: "icons.config.js" })
|
|
14
14
|
.option("h", { alias: "help", group: "Options" })
|
package/src/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type SimpleIcon = {
|
|
|
11
11
|
};
|
|
12
12
|
export type SizedIcon = Record<number, string>;
|
|
13
13
|
type IconsByMode = {
|
|
14
|
-
icons: Record<string, SimpleIcon | SizedIcon | IconFromProviderFunction
|
|
14
|
+
icons: Partial<Record<string, SimpleIcon | SizedIcon | IconFromProviderFunction>>;
|
|
15
15
|
};
|
|
16
16
|
export type _IconsConfig = {
|
|
17
17
|
configDirectory: string;
|
|
@@ -34,7 +34,7 @@ export type IconFromProviderFunction = (config: _IconsConfig) => {
|
|
|
34
34
|
path: string;
|
|
35
35
|
};
|
|
36
36
|
export type IconProvider<T extends string> = {
|
|
37
|
-
adapter: (icons: T[]) => Record<string, IconFromProviderFunction
|
|
37
|
+
adapter: (icons: T[]) => Partial<Record<string, IconFromProviderFunction>>;
|
|
38
38
|
icon: (iconName: T) => IconFromProviderFunction;
|
|
39
39
|
};
|
|
40
40
|
export type IconsConfig = {
|
|
@@ -22,7 +22,7 @@ function _createDefinitionFileContent(config) {
|
|
|
22
22
|
iconDefinitions.push(` "${name}": { w: ${svg.width}, h: ${svg.height} },`);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
throw new Error(
|
|
25
|
+
throw new Error(`Unknown icon format for icon: "${name}".`);
|
|
26
26
|
});
|
|
27
27
|
return `// this file is generated automatically, do not change anything manually in the contents of this file
|
|
28
28
|
|
|
@@ -24,7 +24,7 @@ function _createSpriteContent(config) {
|
|
|
24
24
|
spriteTextContent += `<symbol id="icon-sprite--${name}" viewBox="0 0 ${svg.width} ${svg.height}">${svg.path}</symbol>`;
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
throw new Error(
|
|
27
|
+
throw new Error(`Unknown icon format for icon: "${name}".`);
|
|
28
28
|
});
|
|
29
29
|
spriteTextContent += `</svg>`;
|
|
30
30
|
return spriteTextContent;
|
package/src/utils/_getConfig.js
CHANGED
|
@@ -3,9 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports._getConfig = _getConfig;
|
|
4
4
|
const empty_object_1 = require("@uxf/core/constants/empty-object");
|
|
5
5
|
function _getModuleDefinition(data) {
|
|
6
|
-
if (data === false) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
6
|
return {
|
|
10
7
|
moduleName: (data === null || data === void 0 ? void 0 : data.moduleName) || "@uxf/ui/icon/theme",
|
|
11
8
|
typeName: (data === null || data === void 0 ? void 0 : data.typeName) || "IconsSet",
|
|
@@ -22,7 +19,9 @@ function _getConfig(confFile) {
|
|
|
22
19
|
typeName: loadedConfig.typeName || "IconsSet",
|
|
23
20
|
typescript: loadedConfig.typescript || true,
|
|
24
21
|
customDefinitionContent: loadedConfig.customDefinitionContent || undefined,
|
|
25
|
-
moduleDefinition:
|
|
22
|
+
moduleDefinition: typeof loadedConfig.moduleDefinition === "object" || loadedConfig.moduleDefinition === undefined
|
|
23
|
+
? _getModuleDefinition(loadedConfig.moduleDefinition)
|
|
24
|
+
: false,
|
|
26
25
|
adapters: loadedConfig.adapters || empty_object_1.EMPTY_OBJECT,
|
|
27
26
|
};
|
|
28
27
|
const ext = config.typescript ? "ts" : "js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IconFromProviderFunction, SimpleIcon, SizedIcon } from "../types";
|
|
2
2
|
export declare const _iconTypeResolver: {
|
|
3
|
-
isSimpleIcon: (icon:
|
|
4
|
-
isSizedIcon: (icon:
|
|
5
|
-
isFromAdapter: (icon:
|
|
3
|
+
isSimpleIcon: (icon: unknown) => icon is SimpleIcon;
|
|
4
|
+
isSizedIcon: (icon: unknown) => icon is SizedIcon;
|
|
5
|
+
isFromAdapter: (icon: unknown) => icon is IconFromProviderFunction;
|
|
6
6
|
};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports._iconTypeResolver = void 0;
|
|
4
4
|
exports._iconTypeResolver = {
|
|
5
|
-
isSimpleIcon: (icon) => "data" in icon,
|
|
6
|
-
isSizedIcon: (icon) => icon
|
|
7
|
-
|
|
5
|
+
isSimpleIcon: (icon) => typeof icon === "object" && icon !== null && "data" in icon,
|
|
6
|
+
isSizedIcon: (icon) => typeof icon === "object" &&
|
|
7
|
+
icon !== null &&
|
|
8
|
+
Object.keys(icon).every((key) => !isNaN(Number(key)) && key in icon && typeof icon[key] === "string"),
|
|
8
9
|
isFromAdapter: (icon) => typeof icon === "function",
|
|
9
10
|
};
|