@cyberalien/svg-utils 1.2.1 → 1.2.3
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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FactoryGeneratedComponent } from "../types/component.js";
|
|
2
|
+
/**
|
|
3
|
+
* Add component dependencies to set
|
|
4
|
+
*/
|
|
5
|
+
declare function addComponentDependencies(component: FactoryGeneratedComponent, dependencies: Set<string>): void;
|
|
6
|
+
/**
|
|
7
|
+
* Create dependencies list for package.json
|
|
8
|
+
*/
|
|
9
|
+
declare function createDependenciesForPackage(dependencies: Set<string>): Record<string, string> | undefined;
|
|
10
|
+
export { addComponentDependencies, createDependenciesForPackage };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const latestVersions = {};
|
|
2
|
+
/**
|
|
3
|
+
* Add component dependencies to set
|
|
4
|
+
*/
|
|
5
|
+
function addComponentDependencies(component, dependencies) {
|
|
6
|
+
if (component.dependencies) for (const dependency of component.dependencies) dependencies.add(dependency);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create dependencies list for package.json
|
|
10
|
+
*/
|
|
11
|
+
function createDependenciesForPackage(dependencies) {
|
|
12
|
+
if (dependencies.size) {
|
|
13
|
+
const result = Object.create(null);
|
|
14
|
+
for (const dependency of dependencies) result[dependency] = latestVersions[dependency] || "latest";
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { addComponentDependencies, createDependenciesForPackage };
|
|
@@ -74,7 +74,7 @@ function minifySVGCSSIconSet(iconSet) {
|
|
|
74
74
|
const viewBoxValue = icon.viewBox;
|
|
75
75
|
if (typeof viewBoxValue !== "number") compactItem(viewBoxes, viewBoxKey(viewBoxValue), icon, "viewBox", viewBoxValue);
|
|
76
76
|
const statesValue = icon.states;
|
|
77
|
-
if (typeof statesValue !== "number") compactItem(statesList, JSON.stringify(statesValue), icon, "states", statesValue);
|
|
77
|
+
if (typeof statesValue !== "number" && statesValue?.length) compactItem(statesList, JSON.stringify(statesValue), icon, "states", statesValue);
|
|
78
78
|
}
|
|
79
79
|
if (iconSet.classes) for (const className in iconSet.classes) {
|
|
80
80
|
const classContent = iconSet.classes[className];
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Common functions for working with SVG used by various packages.",
|
|
5
5
|
"author": "Vjacheslav Trushkin",
|
|
6
|
-
"version": "1.2.
|
|
6
|
+
"version": "1.2.3",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": "https://github.com/cyberalien/svg-utils/issues",
|
|
9
9
|
"homepage": "https://cyberalien.dev/",
|