@iconify/tools 2.2.2 → 2.2.4
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/export/json-package.cjs +3 -1
- package/lib/export/json-package.mjs +3 -1
- package/lib/import/figma/nodes.cjs +2 -1
- package/lib/import/figma/nodes.mjs +2 -1
- package/lib/import/figma/types/nodes.d.ts +1 -1
- package/lib/optimise/scale.cjs +7 -3
- package/lib/optimise/scale.mjs +7 -3
- package/package.json +1 -1
|
@@ -96,7 +96,9 @@ async function exportJSONPackage(iconSet, options) {
|
|
|
96
96
|
if (data !== void 0) {
|
|
97
97
|
await misc_writeJson.writeJSONFile(`${dir}/${jsonFilename}`, data);
|
|
98
98
|
cjsImports.push(`const ${attr} = require('${relativeFile}');`);
|
|
99
|
-
mjsImports.push(
|
|
99
|
+
mjsImports.push(
|
|
100
|
+
`import ${attr} from '${relativeFile}' assert { type: 'json' };`
|
|
101
|
+
);
|
|
100
102
|
packageJSONIconSet[attr] = attr + ".json";
|
|
101
103
|
packageJSONExports[relativeFile] = relativeFile;
|
|
102
104
|
} else {
|
|
@@ -94,7 +94,9 @@ async function exportJSONPackage(iconSet, options) {
|
|
|
94
94
|
if (data !== void 0) {
|
|
95
95
|
await writeJSONFile(`${dir}/${jsonFilename}`, data);
|
|
96
96
|
cjsImports.push(`const ${attr} = require('${relativeFile}');`);
|
|
97
|
-
mjsImports.push(
|
|
97
|
+
mjsImports.push(
|
|
98
|
+
`import ${attr} from '${relativeFile}' assert { type: 'json' };`
|
|
99
|
+
);
|
|
98
100
|
packageJSONIconSet[attr] = attr + ".json";
|
|
99
101
|
packageJSONExports[relativeFile] = relativeFile;
|
|
100
102
|
} else {
|
|
@@ -7,7 +7,7 @@ import '../../../icon-set/types.js';
|
|
|
7
7
|
import '../../../svg/index.js';
|
|
8
8
|
import '@iconify/utils/lib/icon-set/tree';
|
|
9
9
|
|
|
10
|
-
type FigmaImportParentNodeType = 'CANVAS' | 'FRAME' | 'GROUP';
|
|
10
|
+
type FigmaImportParentNodeType = 'CANVAS' | 'FRAME' | 'GROUP' | 'SECTION';
|
|
11
11
|
type FigmaImportIconNodeType = IconFigmaNode['type'];
|
|
12
12
|
/**
|
|
13
13
|
* Node information passed to callback
|
package/lib/optimise/scale.cjs
CHANGED
|
@@ -8,9 +8,13 @@ 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
|
-
|
|
11
|
+
let shiftTransform = "";
|
|
12
|
+
let shiftTransformEnd = "";
|
|
13
|
+
if (viewBox.left !== 0 || viewBox.top !== 0) {
|
|
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>`;
|
|
14
18
|
svg.load(content);
|
|
15
19
|
optimise_svgo.runSVGO(svg, {
|
|
16
20
|
plugins: [
|
package/lib/optimise/scale.mjs
CHANGED
|
@@ -6,9 +6,13 @@ 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
|
-
|
|
9
|
+
let shiftTransform = "";
|
|
10
|
+
let shiftTransformEnd = "";
|
|
11
|
+
if (viewBox.left !== 0 || viewBox.top !== 0) {
|
|
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>`;
|
|
12
16
|
svg.load(content);
|
|
13
17
|
runSVGO(svg, {
|
|
14
18
|
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.4",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": "https://github.com/iconify/tools/issues",
|
|
9
9
|
"homepage": "https://github.com/iconify/tools",
|