@iconify/tools 2.2.4 → 2.2.5
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/lib/optimise/scale.cjs
CHANGED
|
@@ -8,13 +8,9 @@ function scaleSVG(svg, scale) {
|
|
|
8
8
|
const viewBox = svg.viewBox;
|
|
9
9
|
const width = viewBox.width * scale;
|
|
10
10
|
const height = viewBox.height * scale;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
shiftTransform = `<g transform="translate(${0 - viewBox.left} ${0 - viewBox.top})">`;
|
|
15
|
-
shiftTransformEnd = "</g>";
|
|
16
|
-
}
|
|
17
|
-
const content = `<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}"><g transform="scale(${scale})">${shiftTransform}${svg.getBody()}${shiftTransformEnd}</g></svg>`;
|
|
11
|
+
const left = viewBox.left * scale;
|
|
12
|
+
const top = viewBox.top * scale;
|
|
13
|
+
const content = `<svg width="${width}" height="${height}" viewBox="${left} ${top} ${width} ${height}"><g transform="scale(${scale})">${svg.getBody()}</g></svg>`;
|
|
18
14
|
svg.load(content);
|
|
19
15
|
optimise_svgo.runSVGO(svg, {
|
|
20
16
|
plugins: [
|
package/lib/optimise/scale.mjs
CHANGED
|
@@ -6,13 +6,9 @@ function scaleSVG(svg, scale) {
|
|
|
6
6
|
const viewBox = svg.viewBox;
|
|
7
7
|
const width = viewBox.width * scale;
|
|
8
8
|
const height = viewBox.height * scale;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
shiftTransform = `<g transform="translate(${0 - viewBox.left} ${0 - viewBox.top})">`;
|
|
13
|
-
shiftTransformEnd = "</g>";
|
|
14
|
-
}
|
|
15
|
-
const content = `<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}"><g transform="scale(${scale})">${shiftTransform}${svg.getBody()}${shiftTransformEnd}</g></svg>`;
|
|
9
|
+
const left = viewBox.left * scale;
|
|
10
|
+
const top = viewBox.top * scale;
|
|
11
|
+
const content = `<svg width="${width}" height="${height}" viewBox="${left} ${top} ${width} ${height}"><g transform="scale(${scale})">${svg.getBody()}</g></svg>`;
|
|
16
12
|
svg.load(content);
|
|
17
13
|
runSVGO(svg, {
|
|
18
14
|
plugins: [
|
package/lib/optimise/svgo.cjs
CHANGED
|
@@ -65,6 +65,11 @@ function runSVGO(svg, options = {}) {
|
|
|
65
65
|
...options,
|
|
66
66
|
animated
|
|
67
67
|
});
|
|
68
|
+
if (code.includes("filter=") && code.includes("transform=")) {
|
|
69
|
+
plugins = plugins.filter(
|
|
70
|
+
(item) => item !== "moveElemsAttrsToGroup"
|
|
71
|
+
);
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
const pluginOptions = {
|
|
70
75
|
plugins,
|
package/lib/optimise/svgo.mjs
CHANGED
|
@@ -63,6 +63,11 @@ function runSVGO(svg, options = {}) {
|
|
|
63
63
|
...options,
|
|
64
64
|
animated
|
|
65
65
|
});
|
|
66
|
+
if (code.includes("filter=") && code.includes("transform=")) {
|
|
67
|
+
plugins = plugins.filter(
|
|
68
|
+
(item) => item !== "moveElemsAttrsToGroup"
|
|
69
|
+
);
|
|
70
|
+
}
|
|
66
71
|
}
|
|
67
72
|
const pluginOptions = {
|
|
68
73
|
plugins,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Collection of functions for cleaning up and parsing SVG for Iconify project",
|
|
5
5
|
"author": "Vjacheslav Trushkin",
|
|
6
|
-
"version": "2.2.
|
|
6
|
+
"version": "2.2.5",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": "https://github.com/iconify/tools/issues",
|
|
9
9
|
"homepage": "https://github.com/iconify/tools",
|