@iconify/tools 2.0.18 → 2.1.0-beta.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.
- package/lib/colors/parse.d.ts +2 -2
- package/lib/colors/validate.d.ts +2 -2
- package/lib/download/git/branch.cjs +2 -3
- package/lib/download/git/branch.mjs +2 -3
- package/lib/download/git/hash.cjs +1 -0
- package/lib/download/git/hash.mjs +1 -0
- package/lib/download/git/index.cjs +4 -3
- package/lib/download/git/index.mjs +4 -3
- package/lib/download/git/reset.cjs +4 -3
- package/lib/download/git/reset.mjs +4 -3
- package/lib/download/index.cjs +4 -3
- package/lib/download/index.mjs +4 -3
- package/lib/download/npm/index.cjs +1 -0
- package/lib/download/npm/index.mjs +1 -0
- package/lib/download/npm/version.cjs +1 -0
- package/lib/download/npm/version.mjs +1 -0
- package/lib/export/directory.d.ts +3 -2
- package/lib/export/helpers/types-version.cjs +3 -13
- package/lib/export/helpers/types-version.mjs +3 -13
- package/lib/export/icon-package.cjs +1 -3
- package/lib/export/icon-package.d.ts +3 -2
- package/lib/export/icon-package.mjs +1 -3
- package/lib/export/json-package.cjs +3 -5
- package/lib/export/json-package.d.ts +3 -2
- package/lib/export/json-package.mjs +3 -5
- package/lib/icon-set/index.cjs +94 -103
- package/lib/icon-set/index.d.ts +22 -4
- package/lib/icon-set/index.mjs +95 -104
- package/lib/icon-set/match.cjs +5 -5
- package/lib/icon-set/match.d.ts +4 -3
- package/lib/icon-set/match.mjs +2 -2
- package/lib/icon-set/merge.cjs +10 -3
- package/lib/icon-set/merge.d.ts +3 -2
- package/lib/icon-set/merge.mjs +10 -3
- package/lib/icon-set/modified.cjs +27 -0
- package/lib/icon-set/modified.d.ts +15 -0
- package/lib/icon-set/modified.mjs +23 -0
- package/lib/icon-set/props.cjs +8 -18
- package/lib/icon-set/props.d.ts +5 -6
- package/lib/icon-set/props.mjs +9 -18
- package/lib/icon-set/types.d.ts +1 -1
- package/lib/import/directory.cjs +4 -3
- package/lib/import/directory.d.ts +3 -2
- package/lib/import/directory.mjs +4 -3
- package/lib/import/figma/index.cjs +4 -3
- package/lib/import/figma/index.d.ts +3 -2
- package/lib/import/figma/index.mjs +4 -3
- package/lib/import/figma/nodes.d.ts +3 -2
- package/lib/import/figma/query.d.ts +3 -2
- package/lib/import/figma/types/nodes.d.ts +3 -2
- package/lib/import/figma/types/options.d.ts +3 -2
- package/lib/import/figma/types/result.d.ts +3 -2
- package/lib/index.cjs +5 -4
- package/lib/index.d.ts +4 -2
- package/lib/index.mjs +5 -4
- package/lib/misc/bump-version.cjs +2 -2
- package/lib/misc/bump-version.mjs +2 -2
- package/lib/misc/cheerio.cjs +2 -0
- package/lib/misc/cheerio.d.ts +7 -0
- package/lib/misc/cheerio.mjs +1 -0
- package/lib/misc/exec.cjs +7 -2
- package/lib/misc/exec.mjs +7 -2
- package/lib/optimise/flags.cjs +8 -8
- package/lib/optimise/flags.d.ts +2 -2
- package/lib/optimise/flags.mjs +8 -8
- package/lib/optimise/global-style.d.ts +2 -2
- package/lib/optimise/scale.cjs +3 -3
- package/lib/optimise/scale.d.ts +3 -3
- package/lib/optimise/scale.mjs +3 -3
- package/lib/optimise/svgo.cjs +1 -1
- package/lib/optimise/svgo.d.ts +3 -3
- package/lib/optimise/svgo.mjs +1 -1
- package/lib/svg/analyse.d.ts +2 -2
- package/lib/svg/cleanup/attribs.d.ts +2 -2
- package/lib/svg/cleanup/bad-tags.d.ts +2 -2
- package/lib/svg/cleanup/inline-style.d.ts +2 -2
- package/lib/svg/cleanup/root-svg.d.ts +2 -2
- package/lib/svg/cleanup/svgo-style.cjs +1 -1
- package/lib/svg/cleanup/svgo-style.d.ts +2 -2
- package/lib/svg/cleanup/svgo-style.mjs +1 -1
- package/lib/svg/cleanup.d.ts +2 -2
- package/lib/svg/index.cjs +9 -9
- package/lib/svg/index.d.ts +4 -4
- package/lib/svg/index.mjs +10 -10
- package/lib/svg/parse-style.d.ts +3 -2
- package/lib/svg/parse.d.ts +4 -8
- package/lib/types-f0980297.d.ts +258 -0
- package/package.json +10 -3
|
@@ -7,14 +7,15 @@ const svg_index = require('../../svg/index.cjs');
|
|
|
7
7
|
const svg_cleanup = require('../../svg/cleanup.cjs');
|
|
8
8
|
const import_figma_nodes = require('./nodes.cjs');
|
|
9
9
|
const import_figma_query = require('./query.cjs');
|
|
10
|
-
require('@iconify/utils/lib/icon');
|
|
10
|
+
require('@iconify/utils/lib/icon/defaults');
|
|
11
11
|
require('@iconify/utils/lib/svg/build');
|
|
12
|
-
require('@iconify/utils/lib/customisations');
|
|
12
|
+
require('@iconify/utils/lib/customisations/defaults');
|
|
13
13
|
require('@iconify/utils/lib/icon-set/minify');
|
|
14
14
|
require('@iconify/utils/lib/icon-set/convert-info');
|
|
15
15
|
require('../../icon-set/props.cjs');
|
|
16
|
-
require('
|
|
16
|
+
require('@iconify/utils/lib/misc/objects');
|
|
17
17
|
require('@iconify/utils');
|
|
18
|
+
require('cheerio');
|
|
18
19
|
require('../../svg/cleanup/attribs.cjs');
|
|
19
20
|
require('../../svg/data/attributes.cjs');
|
|
20
21
|
require('../../svg/data/tags.cjs');
|
|
@@ -2,10 +2,11 @@ import { DocumentNotModified } from '../../download/types/modified.js';
|
|
|
2
2
|
import { FigmaIfModifiedSinceOption, FigmaImportOptions } from './types/options.js';
|
|
3
3
|
import { FigmaImportResult } from './types/result.js';
|
|
4
4
|
import '../../icon-set/index.js';
|
|
5
|
-
import '
|
|
6
|
-
import '@iconify/utils/lib/customisations';
|
|
5
|
+
import '../../types-f0980297.js';
|
|
6
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
7
7
|
import '../../icon-set/types.js';
|
|
8
8
|
import '../../svg/index.js';
|
|
9
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
9
10
|
import './types/nodes.js';
|
|
10
11
|
import './types/api.js';
|
|
11
12
|
|
|
@@ -3,14 +3,15 @@ import { SVG } from '../../svg/index.mjs';
|
|
|
3
3
|
import { cleanupSVG } from '../../svg/cleanup.mjs';
|
|
4
4
|
import { getFigmaIconNodes } from './nodes.mjs';
|
|
5
5
|
import { figmaFilesQuery, figmaImagesQuery, figmaDownloadImages } from './query.mjs';
|
|
6
|
-
import '@iconify/utils/lib/icon';
|
|
6
|
+
import '@iconify/utils/lib/icon/defaults';
|
|
7
7
|
import '@iconify/utils/lib/svg/build';
|
|
8
|
-
import '@iconify/utils/lib/customisations';
|
|
8
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
9
9
|
import '@iconify/utils/lib/icon-set/minify';
|
|
10
10
|
import '@iconify/utils/lib/icon-set/convert-info';
|
|
11
11
|
import '../../icon-set/props.mjs';
|
|
12
|
-
import '
|
|
12
|
+
import '@iconify/utils/lib/misc/objects';
|
|
13
13
|
import '@iconify/utils';
|
|
14
|
+
import 'cheerio';
|
|
14
15
|
import '../../svg/cleanup/attribs.mjs';
|
|
15
16
|
import '../../svg/data/attributes.mjs';
|
|
16
17
|
import '../../svg/data/tags.mjs';
|
|
@@ -2,10 +2,11 @@ import { FigmaDocument } from './types/api.js';
|
|
|
2
2
|
import { FigmaGetIconNodesOptions } from './types/options.js';
|
|
3
3
|
import { FigmaNodesImportResult } from './types/result.js';
|
|
4
4
|
import '../../icon-set/index.js';
|
|
5
|
-
import '
|
|
6
|
-
import '@iconify/utils/lib/customisations';
|
|
5
|
+
import '../../types-f0980297.js';
|
|
6
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
7
7
|
import '../../icon-set/types.js';
|
|
8
8
|
import '../../svg/index.js';
|
|
9
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
9
10
|
import './types/nodes.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -4,10 +4,11 @@ import { FigmaDocument } from './types/api.js';
|
|
|
4
4
|
import { FigmaIfModifiedSinceOption, FigmaFilesQueryOptions, FigmaImagesQueryOptions } from './types/options.js';
|
|
5
5
|
import { FigmaNodesImportResult } from './types/result.js';
|
|
6
6
|
import '../../icon-set/index.js';
|
|
7
|
-
import '
|
|
8
|
-
import '@iconify/utils/lib/customisations';
|
|
7
|
+
import '../../types-f0980297.js';
|
|
8
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
9
9
|
import '../../icon-set/types.js';
|
|
10
10
|
import '../../svg/index.js';
|
|
11
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
11
12
|
import './types/nodes.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IconFigmaNode, FigmaDocument } from './api.js';
|
|
2
2
|
import { FigmaNodesImportResult, FigmaIconNode } from './result.js';
|
|
3
3
|
import '../../../icon-set/index.js';
|
|
4
|
-
import '
|
|
5
|
-
import '@iconify/utils/lib/customisations';
|
|
4
|
+
import '../../../types-f0980297.js';
|
|
5
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
6
6
|
import '../../../icon-set/types.js';
|
|
7
7
|
import '../../../svg/index.js';
|
|
8
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
8
9
|
|
|
9
10
|
declare type FigmaImportParentNodeType = 'CANVAS' | 'FRAME' | 'GROUP';
|
|
10
11
|
declare type FigmaImportIconNodeType = IconFigmaNode['type'];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IconSet } from '../../../icon-set/index.js';
|
|
2
2
|
import { FigmaImportParentNodeFilter, FigmaImportNodeFilter } from './nodes.js';
|
|
3
3
|
import { FigmaIconNode } from './result.js';
|
|
4
|
-
import '
|
|
5
|
-
import '@iconify/utils/lib/customisations';
|
|
4
|
+
import '../../../types-f0980297.js';
|
|
5
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
6
6
|
import '../../../icon-set/types.js';
|
|
7
7
|
import '../../../svg/index.js';
|
|
8
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
8
9
|
import './api.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IconSet } from '../../../icon-set/index.js';
|
|
2
|
-
import '
|
|
3
|
-
import '@iconify/utils/lib/customisations';
|
|
2
|
+
import '../../../types-f0980297.js';
|
|
3
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
4
4
|
import '../../../icon-set/types.js';
|
|
5
5
|
import '../../../svg/index.js';
|
|
6
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Result for found icons
|
package/lib/index.cjs
CHANGED
|
@@ -49,7 +49,7 @@ const misc_bumpVersion = require('./misc/bump-version.cjs');
|
|
|
49
49
|
const download_api_index = require('./download/api/index.cjs');
|
|
50
50
|
require('cheerio');
|
|
51
51
|
require('@iconify/utils');
|
|
52
|
-
require('@iconify/utils/lib/icon');
|
|
52
|
+
require('@iconify/utils/lib/icon/defaults');
|
|
53
53
|
require('./css/parse.cjs');
|
|
54
54
|
require('./css/parser/tokens.cjs');
|
|
55
55
|
require('./css/parser/error.cjs');
|
|
@@ -62,11 +62,13 @@ require('./svg/data/tags.cjs');
|
|
|
62
62
|
require('./svg/analyse/error.cjs');
|
|
63
63
|
require('svgo');
|
|
64
64
|
require('@iconify/utils/lib/svg/build');
|
|
65
|
-
require('@iconify/utils/lib/customisations');
|
|
65
|
+
require('@iconify/utils/lib/customisations/defaults');
|
|
66
66
|
require('@iconify/utils/lib/icon-set/minify');
|
|
67
67
|
require('@iconify/utils/lib/icon-set/convert-info');
|
|
68
68
|
require('./icon-set/props.cjs');
|
|
69
|
+
require('@iconify/utils/lib/misc/objects');
|
|
69
70
|
require('./icon-set/match.cjs');
|
|
71
|
+
require('./icon-set/modified.cjs');
|
|
70
72
|
require('./import/figma/nodes.cjs');
|
|
71
73
|
require('./import/figma/query.cjs');
|
|
72
74
|
require('./download/api/cache.cjs');
|
|
@@ -74,16 +76,15 @@ require('fs');
|
|
|
74
76
|
require('crypto');
|
|
75
77
|
require('node-fetch');
|
|
76
78
|
require('pathe');
|
|
79
|
+
require('path');
|
|
77
80
|
require('child_process');
|
|
78
81
|
require('util');
|
|
79
82
|
require('stream');
|
|
80
83
|
require('extract-zip');
|
|
81
84
|
require('tar');
|
|
82
85
|
require('@iconify/utils/lib/colors');
|
|
83
|
-
require('local-pkg');
|
|
84
86
|
require('./download/gitlab/types.cjs');
|
|
85
87
|
require('./colors/attribs.cjs');
|
|
86
|
-
require('./export/helpers/types-version.cjs');
|
|
87
88
|
require('./export/helpers/custom-files.cjs');
|
|
88
89
|
|
|
89
90
|
|
package/lib/index.d.ts
CHANGED
|
@@ -43,11 +43,13 @@ export { execAsync } from './misc/exec.js';
|
|
|
43
43
|
export { cleanupIconKeyword } from './misc/keyword.js';
|
|
44
44
|
export { bumpVersion } from './misc/bump-version.js';
|
|
45
45
|
export { sendAPIQuery } from './download/api/index.js';
|
|
46
|
-
import '
|
|
47
|
-
import '@iconify/utils/lib/customisations';
|
|
46
|
+
import './types-f0980297.js';
|
|
47
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
48
|
+
import './misc/cheerio.js';
|
|
48
49
|
import './css/parser/types.js';
|
|
49
50
|
import './svg/analyse/types.js';
|
|
50
51
|
import './icon-set/types.js';
|
|
52
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
51
53
|
import './download/types/modified.js';
|
|
52
54
|
import './import/figma/types/options.js';
|
|
53
55
|
import './import/figma/types/nodes.js';
|
package/lib/index.mjs
CHANGED
|
@@ -45,7 +45,7 @@ export { bumpVersion } from './misc/bump-version.mjs';
|
|
|
45
45
|
export { sendAPIQuery } from './download/api/index.mjs';
|
|
46
46
|
import 'cheerio';
|
|
47
47
|
import '@iconify/utils';
|
|
48
|
-
import '@iconify/utils/lib/icon';
|
|
48
|
+
import '@iconify/utils/lib/icon/defaults';
|
|
49
49
|
import './css/parse.mjs';
|
|
50
50
|
import './css/parser/tokens.mjs';
|
|
51
51
|
import './css/parser/error.mjs';
|
|
@@ -58,11 +58,13 @@ import './svg/data/tags.mjs';
|
|
|
58
58
|
import './svg/analyse/error.mjs';
|
|
59
59
|
import 'svgo';
|
|
60
60
|
import '@iconify/utils/lib/svg/build';
|
|
61
|
-
import '@iconify/utils/lib/customisations';
|
|
61
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
62
62
|
import '@iconify/utils/lib/icon-set/minify';
|
|
63
63
|
import '@iconify/utils/lib/icon-set/convert-info';
|
|
64
64
|
import './icon-set/props.mjs';
|
|
65
|
+
import '@iconify/utils/lib/misc/objects';
|
|
65
66
|
import './icon-set/match.mjs';
|
|
67
|
+
import './icon-set/modified.mjs';
|
|
66
68
|
import './import/figma/nodes.mjs';
|
|
67
69
|
import './import/figma/query.mjs';
|
|
68
70
|
import './download/api/cache.mjs';
|
|
@@ -70,14 +72,13 @@ import 'fs';
|
|
|
70
72
|
import 'crypto';
|
|
71
73
|
import 'node-fetch';
|
|
72
74
|
import 'pathe';
|
|
75
|
+
import 'path';
|
|
73
76
|
import 'child_process';
|
|
74
77
|
import 'util';
|
|
75
78
|
import 'stream';
|
|
76
79
|
import 'extract-zip';
|
|
77
80
|
import 'tar';
|
|
78
81
|
import '@iconify/utils/lib/colors';
|
|
79
|
-
import 'local-pkg';
|
|
80
82
|
import './download/gitlab/types.mjs';
|
|
81
83
|
import './colors/attribs.mjs';
|
|
82
|
-
import './export/helpers/types-version.mjs';
|
|
83
84
|
import './export/helpers/custom-files.mjs';
|
|
@@ -6,10 +6,10 @@ function bumpVersion(version) {
|
|
|
6
6
|
const versionParts = version.split(".");
|
|
7
7
|
const lastPart = versionParts.pop();
|
|
8
8
|
const num = parseInt(lastPart);
|
|
9
|
-
if (isNaN(num) || num
|
|
9
|
+
if (isNaN(num) || num.toString() !== lastPart) {
|
|
10
10
|
versionParts.push(lastPart + ".1");
|
|
11
11
|
} else {
|
|
12
|
-
versionParts.push(num + 1
|
|
12
|
+
versionParts.push((num + 1).toString());
|
|
13
13
|
}
|
|
14
14
|
return versionParts.join(".");
|
|
15
15
|
}
|
|
@@ -2,10 +2,10 @@ function bumpVersion(version) {
|
|
|
2
2
|
const versionParts = version.split(".");
|
|
3
3
|
const lastPart = versionParts.pop();
|
|
4
4
|
const num = parseInt(lastPart);
|
|
5
|
-
if (isNaN(num) || num
|
|
5
|
+
if (isNaN(num) || num.toString() !== lastPart) {
|
|
6
6
|
versionParts.push(lastPart + ".1");
|
|
7
7
|
} else {
|
|
8
|
-
versionParts.push(num + 1
|
|
8
|
+
versionParts.push((num + 1).toString());
|
|
9
9
|
}
|
|
10
10
|
return versionParts.join(".");
|
|
11
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/lib/misc/exec.cjs
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const path = require('path');
|
|
5
6
|
const child_process = require('child_process');
|
|
6
7
|
|
|
7
8
|
function execAsync(cmd, options) {
|
|
8
9
|
return new Promise((fulfill, reject) => {
|
|
9
|
-
|
|
10
|
+
const fullOptions = {
|
|
10
11
|
...options,
|
|
11
12
|
encoding: "utf8"
|
|
12
|
-
}
|
|
13
|
+
};
|
|
14
|
+
if (fullOptions.cwd) {
|
|
15
|
+
fullOptions.cwd = path.resolve(fullOptions.cwd);
|
|
16
|
+
}
|
|
17
|
+
child_process.exec(cmd, fullOptions, (error, stdout, stderr) => {
|
|
13
18
|
if (error) {
|
|
14
19
|
reject(error);
|
|
15
20
|
} else {
|
package/lib/misc/exec.mjs
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
1
2
|
import { exec } from 'child_process';
|
|
2
3
|
|
|
3
4
|
function execAsync(cmd, options) {
|
|
4
5
|
return new Promise((fulfill, reject) => {
|
|
5
|
-
|
|
6
|
+
const fullOptions = {
|
|
6
7
|
...options,
|
|
7
8
|
encoding: "utf8"
|
|
8
|
-
}
|
|
9
|
+
};
|
|
10
|
+
if (fullOptions.cwd) {
|
|
11
|
+
fullOptions.cwd = resolve(fullOptions.cwd);
|
|
12
|
+
}
|
|
13
|
+
exec(cmd, fullOptions, (error, stdout, stderr) => {
|
|
9
14
|
if (error) {
|
|
10
15
|
reject(error);
|
|
11
16
|
} else {
|
package/lib/optimise/flags.cjs
CHANGED
|
@@ -62,11 +62,11 @@ function cleanPath(path) {
|
|
|
62
62
|
if (currentNumber !== "" && currentCommandType) {
|
|
63
63
|
let value = Number(currentNumber);
|
|
64
64
|
if (isNaN(value)) {
|
|
65
|
-
throw new Error(
|
|
65
|
+
throw new Error(`Invalid number "${currentNumber}" at ${i}`);
|
|
66
66
|
}
|
|
67
67
|
if (currentCommandType === ARC) {
|
|
68
68
|
if (currentArgs.length < 2 && value <= 0) {
|
|
69
|
-
throw new Error(
|
|
69
|
+
throw new Error(`Expected positive number, got "${value}" at ${i}`);
|
|
70
70
|
}
|
|
71
71
|
while (true) {
|
|
72
72
|
if (currentArgs.length < 3 || currentArgs.length > 4) {
|
|
@@ -80,14 +80,14 @@ function cleanPath(path) {
|
|
|
80
80
|
const newValue = Number(newNumber);
|
|
81
81
|
if (slice === "0" || slice === "1") {
|
|
82
82
|
if (isNaN(newValue)) {
|
|
83
|
-
throw new Error(
|
|
83
|
+
throw new Error(`Invalid number "${currentNumber}" at ${i}`);
|
|
84
84
|
}
|
|
85
85
|
currentArgs.push(slice);
|
|
86
86
|
currentNumber = newNumber;
|
|
87
87
|
value = newValue;
|
|
88
88
|
continue;
|
|
89
89
|
}
|
|
90
|
-
throw new Error(
|
|
90
|
+
throw new Error(`Expected a flag, got "${currentNumber}" at ${i}`);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
currentArgs.push(currentNumber);
|
|
@@ -137,10 +137,10 @@ function cleanPath(path) {
|
|
|
137
137
|
continue;
|
|
138
138
|
}
|
|
139
139
|
if (currentArgs.length > 0) {
|
|
140
|
-
throw new Error(
|
|
140
|
+
throw new Error(`Unexpected command at ${i}`);
|
|
141
141
|
}
|
|
142
142
|
if (!canParseCommandOrComma) {
|
|
143
|
-
throw new Error(
|
|
143
|
+
throw new Error(`Command cannot follow comma at ${i}`);
|
|
144
144
|
}
|
|
145
145
|
canParseCommandOrComma = false;
|
|
146
146
|
currentCommand = char;
|
|
@@ -192,7 +192,7 @@ function cleanPath(path) {
|
|
|
192
192
|
currentCommandType = ARC;
|
|
193
193
|
break;
|
|
194
194
|
default:
|
|
195
|
-
throw new Error(
|
|
195
|
+
throw new Error(`Unexpected character "${char}" at ${i}`);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
parseNumber();
|
|
@@ -201,7 +201,7 @@ function cleanPath(path) {
|
|
|
201
201
|
throw new Error("Empty path");
|
|
202
202
|
}
|
|
203
203
|
if (currentArgs.length !== argCount[currentCommandType]) {
|
|
204
|
-
throw new Error(
|
|
204
|
+
throw new Error(`Unexpected end of path at ${i}`);
|
|
205
205
|
}
|
|
206
206
|
finishCommand();
|
|
207
207
|
}
|
package/lib/optimise/flags.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SVG } from '../svg/index.js';
|
|
2
|
-
import '
|
|
3
|
-
import '@iconify/utils/lib/customisations';
|
|
2
|
+
import '../types-f0980297.js';
|
|
3
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* De-optimise paths. Compressed paths are still not supported by some software.
|
package/lib/optimise/flags.mjs
CHANGED
|
@@ -58,11 +58,11 @@ function cleanPath(path) {
|
|
|
58
58
|
if (currentNumber !== "" && currentCommandType) {
|
|
59
59
|
let value = Number(currentNumber);
|
|
60
60
|
if (isNaN(value)) {
|
|
61
|
-
throw new Error(
|
|
61
|
+
throw new Error(`Invalid number "${currentNumber}" at ${i}`);
|
|
62
62
|
}
|
|
63
63
|
if (currentCommandType === ARC) {
|
|
64
64
|
if (currentArgs.length < 2 && value <= 0) {
|
|
65
|
-
throw new Error(
|
|
65
|
+
throw new Error(`Expected positive number, got "${value}" at ${i}`);
|
|
66
66
|
}
|
|
67
67
|
while (true) {
|
|
68
68
|
if (currentArgs.length < 3 || currentArgs.length > 4) {
|
|
@@ -76,14 +76,14 @@ function cleanPath(path) {
|
|
|
76
76
|
const newValue = Number(newNumber);
|
|
77
77
|
if (slice === "0" || slice === "1") {
|
|
78
78
|
if (isNaN(newValue)) {
|
|
79
|
-
throw new Error(
|
|
79
|
+
throw new Error(`Invalid number "${currentNumber}" at ${i}`);
|
|
80
80
|
}
|
|
81
81
|
currentArgs.push(slice);
|
|
82
82
|
currentNumber = newNumber;
|
|
83
83
|
value = newValue;
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
86
|
-
throw new Error(
|
|
86
|
+
throw new Error(`Expected a flag, got "${currentNumber}" at ${i}`);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
currentArgs.push(currentNumber);
|
|
@@ -133,10 +133,10 @@ function cleanPath(path) {
|
|
|
133
133
|
continue;
|
|
134
134
|
}
|
|
135
135
|
if (currentArgs.length > 0) {
|
|
136
|
-
throw new Error(
|
|
136
|
+
throw new Error(`Unexpected command at ${i}`);
|
|
137
137
|
}
|
|
138
138
|
if (!canParseCommandOrComma) {
|
|
139
|
-
throw new Error(
|
|
139
|
+
throw new Error(`Command cannot follow comma at ${i}`);
|
|
140
140
|
}
|
|
141
141
|
canParseCommandOrComma = false;
|
|
142
142
|
currentCommand = char;
|
|
@@ -188,7 +188,7 @@ function cleanPath(path) {
|
|
|
188
188
|
currentCommandType = ARC;
|
|
189
189
|
break;
|
|
190
190
|
default:
|
|
191
|
-
throw new Error(
|
|
191
|
+
throw new Error(`Unexpected character "${char}" at ${i}`);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
parseNumber();
|
|
@@ -197,7 +197,7 @@ function cleanPath(path) {
|
|
|
197
197
|
throw new Error("Empty path");
|
|
198
198
|
}
|
|
199
199
|
if (currentArgs.length !== argCount[currentCommandType]) {
|
|
200
|
-
throw new Error(
|
|
200
|
+
throw new Error(`Unexpected end of path at ${i}`);
|
|
201
201
|
}
|
|
202
202
|
finishCommand();
|
|
203
203
|
}
|
package/lib/optimise/scale.cjs
CHANGED
|
@@ -5,15 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const optimise_svgo = require('./svgo.cjs');
|
|
6
6
|
require('svgo');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function scaleSVG(svg, scale) {
|
|
9
9
|
const viewBox = svg.viewBox;
|
|
10
10
|
const width = viewBox.width * scale;
|
|
11
11
|
const height = viewBox.height * scale;
|
|
12
12
|
const left = viewBox.left * scale;
|
|
13
13
|
const top = viewBox.top * scale;
|
|
14
|
-
const content =
|
|
14
|
+
const content = `<svg width="${width}" height="${height}" viewBox="${left} ${top} ${width} ${height}"><g transform="scale(${scale})">${svg.getBody()}</g></svg>`;
|
|
15
15
|
svg.load(content);
|
|
16
|
-
|
|
16
|
+
optimise_svgo.runSVGO(svg, {
|
|
17
17
|
plugins: [
|
|
18
18
|
"collapseGroups",
|
|
19
19
|
"convertTransform",
|
package/lib/optimise/scale.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SVG } from '../svg/index.js';
|
|
2
|
-
import '
|
|
3
|
-
import '@iconify/utils/lib/customisations';
|
|
2
|
+
import '../types-f0980297.js';
|
|
3
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Scale icon
|
|
7
7
|
*/
|
|
8
|
-
declare function scaleSVG(svg: SVG, scale: number):
|
|
8
|
+
declare function scaleSVG(svg: SVG, scale: number): void;
|
|
9
9
|
|
|
10
10
|
export { scaleSVG };
|
package/lib/optimise/scale.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { runSVGO } from './svgo.mjs';
|
|
2
2
|
import 'svgo';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function scaleSVG(svg, scale) {
|
|
5
5
|
const viewBox = svg.viewBox;
|
|
6
6
|
const width = viewBox.width * scale;
|
|
7
7
|
const height = viewBox.height * scale;
|
|
8
8
|
const left = viewBox.left * scale;
|
|
9
9
|
const top = viewBox.top * scale;
|
|
10
|
-
const content =
|
|
10
|
+
const content = `<svg width="${width}" height="${height}" viewBox="${left} ${top} ${width} ${height}"><g transform="scale(${scale})">${svg.getBody()}</g></svg>`;
|
|
11
11
|
svg.load(content);
|
|
12
|
-
|
|
12
|
+
runSVGO(svg, {
|
|
13
13
|
plugins: [
|
|
14
14
|
"collapseGroups",
|
|
15
15
|
"convertTransform",
|
package/lib/optimise/svgo.cjs
CHANGED
package/lib/optimise/svgo.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin } from 'svgo';
|
|
2
2
|
import { SVG } from '../svg/index.js';
|
|
3
|
-
import '
|
|
4
|
-
import '@iconify/utils/lib/customisations';
|
|
3
|
+
import '../types-f0980297.js';
|
|
4
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
5
5
|
|
|
6
6
|
interface CleanupIDsOption {
|
|
7
7
|
cleanupIDs?: string | false;
|
|
@@ -31,6 +31,6 @@ declare type SVGOOptions = SVGOOptionsWithPlugin | SVGOptionsWithoutPlugin;
|
|
|
31
31
|
/**
|
|
32
32
|
* Run SVGO on icon
|
|
33
33
|
*/
|
|
34
|
-
declare function runSVGO(svg: SVG, options?: SVGOOptions):
|
|
34
|
+
declare function runSVGO(svg: SVG, options?: SVGOOptions): void;
|
|
35
35
|
|
|
36
36
|
export { getSVGOPlugins, runSVGO };
|
package/lib/optimise/svgo.mjs
CHANGED
package/lib/svg/analyse.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SVG } from './index.js';
|
|
2
2
|
import { AnalyseSVGStructureOptions, AnalyseSVGStructureResult } from './analyse/types.js';
|
|
3
|
-
import '
|
|
4
|
-
import '@iconify/utils/lib/customisations';
|
|
3
|
+
import '../types-f0980297.js';
|
|
4
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Find all IDs, links, which elements use palette, which items aren't used
|