@iconify/tools 2.0.0-dev.1 → 2.0.0-dev.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/lib/colors/parse.d.ts +2 -2
- package/lib/colors/parse.js +6 -19
- package/lib/colors/parse.mjs +4 -17
- package/lib/icon-set/index.d.ts +2 -1
- package/lib/icon-set/index.js +5 -3
- package/lib/icon-set/index.mjs +8 -4
- package/lib/optimise/svgo.js +4 -1
- package/lib/optimise/svgo.mjs +3 -0
- package/lib/svg/cleanup/attribs.js +9 -16
- package/lib/svg/cleanup/attribs.mjs +11 -15
- package/lib/svg/cleanup/inline-style.js +1 -1
- package/lib/svg/cleanup/inline-style.mjs +2 -2
- package/lib/svg/cleanup/root-svg.js +1 -1
- package/lib/svg/cleanup/root-svg.mjs +2 -2
- package/lib/svg/cleanup/svgo-style.js +1 -1
- package/lib/svg/cleanup/svgo-style.mjs +2 -2
- package/lib/svg/data/attributes.d.ts +1 -1
- package/lib/svg/data/attributes.js +4 -2
- package/lib/svg/data/attributes.mjs +4 -2
- package/lib/svg/index.js +2 -2
- package/lib/svg/index.mjs +2 -2
- package/package.json +1 -1
package/lib/colors/parse.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface ParseColorsOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function parseColors(svg: SVG, options?: ParseColorsOptions): Promise<FindColorsResult>;
|
|
33
33
|
/**
|
|
34
|
-
* Check if color
|
|
34
|
+
* Check if color is empty, such as 'none' or 'transparent'
|
|
35
35
|
*/
|
|
36
|
-
export declare function
|
|
36
|
+
export declare function isEmptyColor(color: Color): boolean;
|
|
37
37
|
export {};
|
package/lib/colors/parse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isEmptyColor = exports.parseColors = void 0;
|
|
4
4
|
const colors_1 = require("@iconify/utils/lib/colors");
|
|
5
5
|
const parse_1 = require("../svg/parse");
|
|
6
6
|
const tags_1 = require("../svg/data/tags");
|
|
@@ -252,23 +252,10 @@ async function parseColors(svg, options = {}) {
|
|
|
252
252
|
}
|
|
253
253
|
exports.parseColors = parseColors;
|
|
254
254
|
/**
|
|
255
|
-
* Check if color
|
|
255
|
+
* Check if color is empty, such as 'none' or 'transparent'
|
|
256
256
|
*/
|
|
257
|
-
function
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
case 'hsl':
|
|
261
|
-
case 'lab':
|
|
262
|
-
case 'lch':
|
|
263
|
-
return false;
|
|
264
|
-
case 'none':
|
|
265
|
-
case 'transparent':
|
|
266
|
-
case 'current':
|
|
267
|
-
return true;
|
|
268
|
-
default: {
|
|
269
|
-
const t = color;
|
|
270
|
-
return t;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
257
|
+
function isEmptyColor(color) {
|
|
258
|
+
const type = color.type;
|
|
259
|
+
return type === 'none' || type === 'transparent';
|
|
273
260
|
}
|
|
274
|
-
exports.
|
|
261
|
+
exports.isEmptyColor = isEmptyColor;
|
package/lib/colors/parse.mjs
CHANGED
|
@@ -202,24 +202,11 @@ async function parseColors(svg, options = {}) {
|
|
|
202
202
|
});
|
|
203
203
|
return result;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
case "hsl":
|
|
209
|
-
case "lab":
|
|
210
|
-
case "lch":
|
|
211
|
-
return false;
|
|
212
|
-
case "none":
|
|
213
|
-
case "transparent":
|
|
214
|
-
case "current":
|
|
215
|
-
return true;
|
|
216
|
-
default: {
|
|
217
|
-
const t = color;
|
|
218
|
-
return t;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
205
|
+
function isEmptyColor(color) {
|
|
206
|
+
const type = color.type;
|
|
207
|
+
return type === "none" || type === "transparent";
|
|
221
208
|
}
|
|
222
209
|
export {
|
|
223
|
-
|
|
210
|
+
isEmptyColor,
|
|
224
211
|
parseColors
|
|
225
212
|
};
|
package/lib/icon-set/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IconifyJSON, IconifyInfo } from '@iconify/types';
|
|
2
|
+
import { IconifyIconCustomisations } from '@iconify/utils/lib/customisations';
|
|
2
3
|
import type { CheckThemeResult, CommonIconProps, IconCategory, IconSetAsyncForEachCallback, IconSetIconEntry, IconSetIconType, ResolvedIconifyIcon } from './types';
|
|
3
4
|
import { SVG } from '../svg';
|
|
4
5
|
/**
|
|
@@ -49,7 +50,7 @@ export declare class IconSet {
|
|
|
49
50
|
/**
|
|
50
51
|
* Generate HTML
|
|
51
52
|
*/
|
|
52
|
-
toString(name: string): string | null;
|
|
53
|
+
toString(name: string, custommisations?: IconifyIconCustomisations): string | null;
|
|
53
54
|
/**
|
|
54
55
|
* Get SVG instance for icon
|
|
55
56
|
*/
|
package/lib/icon-set/index.js
CHANGED
|
@@ -251,15 +251,17 @@ class IconSet {
|
|
|
251
251
|
/**
|
|
252
252
|
* Generate HTML
|
|
253
253
|
*/
|
|
254
|
-
toString(name
|
|
254
|
+
toString(name, custommisations = {
|
|
255
|
+
width: 'auto',
|
|
256
|
+
height: 'auto',
|
|
257
|
+
}) {
|
|
255
258
|
const item = this.resolve(name, true);
|
|
256
259
|
if (!item) {
|
|
257
260
|
return null;
|
|
258
261
|
}
|
|
259
262
|
const result = (0, build_1.iconToSVG)(item, {
|
|
260
263
|
...customisations_1.defaults,
|
|
261
|
-
|
|
262
|
-
height: 'auto',
|
|
264
|
+
...custommisations,
|
|
263
265
|
});
|
|
264
266
|
const attributes = Object.keys(result.attributes)
|
|
265
267
|
.map((key) => ` ${key}="${result.attributes[key]}"`)
|
package/lib/icon-set/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// src/icon-set/index.ts
|
|
2
2
|
import { fullIcon } from "@iconify/utils/lib/icon";
|
|
3
3
|
import { iconToSVG } from "@iconify/utils/lib/svg/build";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
defaults
|
|
6
|
+
} from "@iconify/utils/lib/customisations";
|
|
5
7
|
import { minifyIconSet } from "@iconify/utils/lib/icon-set/minify";
|
|
6
8
|
import { convertIconSetInfo } from "@iconify/utils/lib/icon-set/convert-info";
|
|
7
9
|
import { extraDefaultProps, filterProps } from "./props.mjs";
|
|
@@ -195,15 +197,17 @@ var IconSet = class {
|
|
|
195
197
|
const result = getIcon(name, 0);
|
|
196
198
|
return result && full ? fullIcon(result) : result;
|
|
197
199
|
}
|
|
198
|
-
toString(name
|
|
200
|
+
toString(name, custommisations = {
|
|
201
|
+
width: "auto",
|
|
202
|
+
height: "auto"
|
|
203
|
+
}) {
|
|
199
204
|
const item = this.resolve(name, true);
|
|
200
205
|
if (!item) {
|
|
201
206
|
return null;
|
|
202
207
|
}
|
|
203
208
|
const result = iconToSVG(item, {
|
|
204
209
|
...defaults,
|
|
205
|
-
|
|
206
|
-
height: "auto"
|
|
210
|
+
...custommisations
|
|
207
211
|
});
|
|
208
212
|
const attributes = Object.keys(result.attributes).map((key) => ` ${key}="${result.attributes[key]}"`).join("");
|
|
209
213
|
return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"${attributes}>${result.body}</svg>`;
|
package/lib/optimise/svgo.js
CHANGED
|
@@ -78,8 +78,11 @@ async function runSVGO(svg, options = {}) {
|
|
|
78
78
|
plugins,
|
|
79
79
|
multipass,
|
|
80
80
|
};
|
|
81
|
-
// Load data
|
|
81
|
+
// Load data (changing type because SVGO types do not include error ?????)
|
|
82
82
|
const result = (0, svgo_1.optimize)(svg.toString(), pluginOptions);
|
|
83
|
+
if (typeof result.error === 'string') {
|
|
84
|
+
throw new Error(result.error);
|
|
85
|
+
}
|
|
83
86
|
svg.load(result.data);
|
|
84
87
|
}
|
|
85
88
|
exports.runSVGO = runSVGO;
|
package/lib/optimise/svgo.mjs
CHANGED
|
@@ -7,26 +7,19 @@ const parse_1 = require("../parse");
|
|
|
7
7
|
* Remove useless attributes
|
|
8
8
|
*/
|
|
9
9
|
async function removeBadAttributes(svg) {
|
|
10
|
-
(0, parse_1.parseSVG)(svg, (item) => {
|
|
10
|
+
await (0, parse_1.parseSVG)(svg, (item) => {
|
|
11
11
|
const attribs = item.element.attribs;
|
|
12
|
+
const $element = item.$element;
|
|
12
13
|
// Common tags
|
|
13
14
|
Object.keys(attribs).forEach((attr) => {
|
|
14
15
|
// Bad attributes, events
|
|
15
|
-
if (attr.slice(0, 2) === 'on' ||
|
|
16
|
-
|
|
16
|
+
if (attr.slice(0, 2) === 'on' ||
|
|
17
|
+
attributes_1.badAttributes.has(attr) ||
|
|
18
|
+
attributes_1.badSoftwareAttributes.has(attr) ||
|
|
19
|
+
attributes_1.badAttributePrefixes.has(attr.split('-').shift())) {
|
|
20
|
+
$element.removeAttr(attr);
|
|
17
21
|
return;
|
|
18
22
|
}
|
|
19
|
-
// Partial attribute matches
|
|
20
|
-
const parts = attr.split('-');
|
|
21
|
-
const firstPart = parts.shift();
|
|
22
|
-
switch (firstPart) {
|
|
23
|
-
case '': // -whatever
|
|
24
|
-
case 'aria':
|
|
25
|
-
case 'data':
|
|
26
|
-
// Remove unnecessary attributes
|
|
27
|
-
item.$element.removeAttr(attr);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
23
|
// Check for namespace
|
|
31
24
|
const nsParts = attr.split(':');
|
|
32
25
|
if (nsParts.length > 1) {
|
|
@@ -36,13 +29,13 @@ async function removeBadAttributes(svg) {
|
|
|
36
29
|
case 'xlink': {
|
|
37
30
|
// Deprecated: use without namespace
|
|
38
31
|
if (attribs[newAttr] === void 0) {
|
|
39
|
-
|
|
32
|
+
$element.attr(newAttr, attribs[attr]);
|
|
40
33
|
}
|
|
41
34
|
break;
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
37
|
// Remove all namespace attributes
|
|
45
|
-
|
|
38
|
+
$element.removeAttr(attr);
|
|
46
39
|
}
|
|
47
40
|
});
|
|
48
41
|
});
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
// src/svg/cleanup/attribs.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
badAttributes,
|
|
4
|
+
badAttributePrefixes,
|
|
5
|
+
badSoftwareAttributes
|
|
6
|
+
} from "../data/attributes.mjs";
|
|
3
7
|
import { parseSVG } from "../parse.mjs";
|
|
4
8
|
async function removeBadAttributes(svg) {
|
|
5
|
-
parseSVG(svg, (item) => {
|
|
9
|
+
await parseSVG(svg, (item) => {
|
|
6
10
|
const attribs = item.element.attribs;
|
|
11
|
+
const $element = item.$element;
|
|
7
12
|
Object.keys(attribs).forEach((attr) => {
|
|
8
|
-
if (attr.slice(0, 2) === "on" || badAttributes.has(attr)) {
|
|
9
|
-
|
|
13
|
+
if (attr.slice(0, 2) === "on" || badAttributes.has(attr) || badSoftwareAttributes.has(attr) || badAttributePrefixes.has(attr.split("-").shift())) {
|
|
14
|
+
$element.removeAttr(attr);
|
|
10
15
|
return;
|
|
11
16
|
}
|
|
12
|
-
const parts = attr.split("-");
|
|
13
|
-
const firstPart = parts.shift();
|
|
14
|
-
switch (firstPart) {
|
|
15
|
-
case "":
|
|
16
|
-
case "aria":
|
|
17
|
-
case "data":
|
|
18
|
-
item.$element.removeAttr(attr);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
17
|
const nsParts = attr.split(":");
|
|
22
18
|
if (nsParts.length > 1) {
|
|
23
19
|
const namespace = nsParts.shift();
|
|
@@ -25,12 +21,12 @@ async function removeBadAttributes(svg) {
|
|
|
25
21
|
switch (namespace) {
|
|
26
22
|
case "xlink": {
|
|
27
23
|
if (attribs[newAttr] === void 0) {
|
|
28
|
-
|
|
24
|
+
$element.attr(newAttr, attribs[attr]);
|
|
29
25
|
}
|
|
30
26
|
break;
|
|
31
27
|
}
|
|
32
28
|
}
|
|
33
|
-
|
|
29
|
+
$element.removeAttr(attr);
|
|
34
30
|
}
|
|
35
31
|
});
|
|
36
32
|
});
|
|
@@ -46,7 +46,7 @@ async function cleanupInlineStyle(svg) {
|
|
|
46
46
|
}
|
|
47
47
|
// Bad software stuff
|
|
48
48
|
if (attributes_1.badSoftwareAttributes.has(prop) ||
|
|
49
|
-
attributes_1.
|
|
49
|
+
attributes_1.badAttributePrefixes.has(prop.split('-').shift())) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
// Vendor specific junk
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { parseInlineStyle } from "../../css/parse.mjs";
|
|
3
3
|
import {
|
|
4
4
|
badAttributes,
|
|
5
|
-
|
|
5
|
+
badAttributePrefixes,
|
|
6
6
|
badSoftwareAttributes,
|
|
7
7
|
insideClipPathAttributes,
|
|
8
8
|
tagSpecificAnimatedAttributes,
|
|
@@ -39,7 +39,7 @@ async function cleanupInlineStyle(svg) {
|
|
|
39
39
|
}
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
if (badSoftwareAttributes.has(prop) ||
|
|
42
|
+
if (badSoftwareAttributes.has(prop) || badAttributePrefixes.has(prop.split("-").shift())) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
if (prop.slice(0, 1) === "-") {
|
|
@@ -25,7 +25,7 @@ async function cleanupSVGRoot(svg) {
|
|
|
25
25
|
attributes_1.badAttributes.has(attr) ||
|
|
26
26
|
attributes_1.junkSVGAttributes.has(attr) ||
|
|
27
27
|
attributes_1.badSoftwareAttributes.has(attr) ||
|
|
28
|
-
attributes_1.
|
|
28
|
+
attributes_1.badAttributePrefixes.has(attr.split('-').shift()) ||
|
|
29
29
|
attr.split(':').length > 1) {
|
|
30
30
|
$root.removeAttr(attr);
|
|
31
31
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/svg/cleanup/root-svg.ts
|
|
2
2
|
import {
|
|
3
3
|
badAttributes,
|
|
4
|
-
|
|
4
|
+
badAttributePrefixes,
|
|
5
5
|
badSoftwareAttributes,
|
|
6
6
|
commonAttributes,
|
|
7
7
|
junkSVGAttributes,
|
|
@@ -23,7 +23,7 @@ async function cleanupSVGRoot(svg) {
|
|
|
23
23
|
Object.keys(attribs).forEach((attr) => {
|
|
24
24
|
var _a, _b;
|
|
25
25
|
const value = attribs[attr];
|
|
26
|
-
if (commonAttributes.has(attr) || badAttributes.has(attr) || junkSVGAttributes.has(attr) || badSoftwareAttributes.has(attr) ||
|
|
26
|
+
if (commonAttributes.has(attr) || badAttributes.has(attr) || junkSVGAttributes.has(attr) || badSoftwareAttributes.has(attr) || badAttributePrefixes.has(attr.split("-").shift()) || attr.split(":").length > 1) {
|
|
27
27
|
$root.removeAttr(attr);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
@@ -16,7 +16,7 @@ async function convertStyleToAttrs(svg) {
|
|
|
16
16
|
// Attributes / properties now allowed
|
|
17
17
|
attributes_1.badAttributes.has(prop) ||
|
|
18
18
|
attributes_1.badSoftwareAttributes.has(prop) ||
|
|
19
|
-
attributes_1.
|
|
19
|
+
attributes_1.badAttributePrefixes.has(prop.split('-').shift())) {
|
|
20
20
|
return void 0;
|
|
21
21
|
}
|
|
22
22
|
hasStyle = true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/svg/cleanup/svgo-style.ts
|
|
2
2
|
import {
|
|
3
3
|
badAttributes,
|
|
4
|
-
|
|
4
|
+
badAttributePrefixes,
|
|
5
5
|
badSoftwareAttributes
|
|
6
6
|
} from "../data/attributes.mjs";
|
|
7
7
|
import { parseSVGStyle } from "../parse-style.mjs";
|
|
@@ -10,7 +10,7 @@ async function convertStyleToAttrs(svg) {
|
|
|
10
10
|
let hasStyle = false;
|
|
11
11
|
await parseSVGStyle(svg, (item) => {
|
|
12
12
|
const prop = item.prop;
|
|
13
|
-
if (badAttributes.has(prop) || badSoftwareAttributes.has(prop) ||
|
|
13
|
+
if (badAttributes.has(prop) || badSoftwareAttributes.has(prop) || badAttributePrefixes.has(prop.split("-").shift())) {
|
|
14
14
|
return void 0;
|
|
15
15
|
}
|
|
16
16
|
hasStyle = true;
|
|
@@ -15,7 +15,7 @@ export declare const junkSVGAttributes: Set<string>;
|
|
|
15
15
|
* Attributes and styles often added by bad software to wrong tags, such as Adobe Illustrator and Inkscape
|
|
16
16
|
*/
|
|
17
17
|
export declare const badSoftwareAttributes: Set<string>;
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const badAttributePrefixes: Set<string>;
|
|
19
19
|
/**
|
|
20
20
|
* Common attributes that can exist on any element
|
|
21
21
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Icons cannot have anything that requires external resources, anything that renders inconsistently.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.tagSpecificNonPresentationalAttributes = exports.tagSpecificPresentationalAttributes = exports.tagSpecificAnimatedAttributes = exports.feFuncAttributes = exports.commonFeAttributes = exports.commonGradientAttributes = exports.otherAnimationAttributes = exports.animationValueAttributes = exports.animationTimingAttributes = exports.otherShapeAttributes = exports.markerAttributes = exports.presentationalAttributes = exports.otherPresentationalAttributes = exports.commonColorPresentationalAttributes = exports.visibilityPresentationalAttributes = exports.urlPresentationalAttributes = exports.strokePresentationalAttributes = exports.fillPresentationalAttributes = exports.insideClipPathAttributes = exports.stylingAttributes = exports.commonAttributes = exports.
|
|
7
|
+
exports.tagSpecificNonPresentationalAttributes = exports.tagSpecificPresentationalAttributes = exports.tagSpecificAnimatedAttributes = exports.feFuncAttributes = exports.commonFeAttributes = exports.commonGradientAttributes = exports.otherAnimationAttributes = exports.animationValueAttributes = exports.animationTimingAttributes = exports.otherShapeAttributes = exports.markerAttributes = exports.presentationalAttributes = exports.otherPresentationalAttributes = exports.commonColorPresentationalAttributes = exports.visibilityPresentationalAttributes = exports.urlPresentationalAttributes = exports.strokePresentationalAttributes = exports.fillPresentationalAttributes = exports.insideClipPathAttributes = exports.stylingAttributes = exports.commonAttributes = exports.badAttributePrefixes = exports.badSoftwareAttributes = exports.junkSVGAttributes = exports.badAttributes = void 0;
|
|
8
8
|
const tags_1 = require("./tags");
|
|
9
9
|
/***** Attributes that are not part of tag specific stuff *****/
|
|
10
10
|
/**
|
|
@@ -48,10 +48,12 @@ exports.badSoftwareAttributes = new Set([
|
|
|
48
48
|
'direction',
|
|
49
49
|
]);
|
|
50
50
|
// Prefixes. First part of attribute before '-', where all possible attributes that start with prefix are invalid
|
|
51
|
-
exports.
|
|
51
|
+
exports.badAttributePrefixes = new Set([
|
|
52
52
|
'image',
|
|
53
53
|
'mix',
|
|
54
54
|
'block',
|
|
55
|
+
'data',
|
|
56
|
+
'aria',
|
|
55
57
|
// Font stuff
|
|
56
58
|
'text',
|
|
57
59
|
'font',
|
|
@@ -30,10 +30,12 @@ var badSoftwareAttributes = new Set([
|
|
|
30
30
|
"white-space",
|
|
31
31
|
"direction"
|
|
32
32
|
]);
|
|
33
|
-
var
|
|
33
|
+
var badAttributePrefixes = new Set([
|
|
34
34
|
"image",
|
|
35
35
|
"mix",
|
|
36
36
|
"block",
|
|
37
|
+
"data",
|
|
38
|
+
"aria",
|
|
37
39
|
"text",
|
|
38
40
|
"font",
|
|
39
41
|
"letter",
|
|
@@ -324,8 +326,8 @@ var tagSpecificNonPresentationalAttributes = {
|
|
|
324
326
|
export {
|
|
325
327
|
animationTimingAttributes,
|
|
326
328
|
animationValueAttributes,
|
|
329
|
+
badAttributePrefixes,
|
|
327
330
|
badAttributes,
|
|
328
|
-
badSoftwareAttributePrefixes,
|
|
329
331
|
badSoftwareAttributes,
|
|
330
332
|
commonAttributes,
|
|
331
333
|
commonColorPresentationalAttributes,
|
package/lib/svg/index.js
CHANGED
|
@@ -54,9 +54,9 @@ class SVG {
|
|
|
54
54
|
load(content) {
|
|
55
55
|
// Remove junk
|
|
56
56
|
function remove(str1, str2, append) {
|
|
57
|
-
let start = 0
|
|
57
|
+
let start = 0;
|
|
58
58
|
while ((start = content.indexOf(str1, start)) !== -1) {
|
|
59
|
-
end = content.indexOf(str2, start + str1.length);
|
|
59
|
+
const end = content.indexOf(str2, start + str1.length);
|
|
60
60
|
if (end === -1) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
package/lib/svg/index.mjs
CHANGED
|
@@ -26,9 +26,9 @@ var SVG = class {
|
|
|
26
26
|
}
|
|
27
27
|
load(content) {
|
|
28
28
|
function remove(str1, str2, append) {
|
|
29
|
-
let start = 0
|
|
29
|
+
let start = 0;
|
|
30
30
|
while ((start = content.indexOf(str1, start)) !== -1) {
|
|
31
|
-
end = content.indexOf(str2, start + str1.length);
|
|
31
|
+
const end = content.indexOf(str2, start + str1.length);
|
|
32
32
|
if (end === -1) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@iconify/tools",
|
|
3
3
|
"description": "Collection of functions for cleaning up and parsing SVG for Iconify project",
|
|
4
4
|
"author": "Vjacheslav Trushkin",
|
|
5
|
-
"version": "2.0.0-dev.
|
|
5
|
+
"version": "2.0.0-dev.2",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": "https://github.com/iconify/tools/issues",
|
|
8
8
|
"homepage": "https://github.com/iconify/tools",
|