svg-sprite
Advanced tools
Comparing version 3.0.0-beta3 to 3.0.0-rc1
@@ -329,3 +329,5 @@ 'use strict'; | ||
spacing = Math.max(0, Number.parseInt(this.spacing[property] || 0, 10)); | ||
this.spacing[property] = { top: spacing, right: spacing, bottom: spacing, left: spacing }; | ||
this.spacing[property] = { | ||
top: spacing, right: spacing, bottom: spacing, left: spacing | ||
}; | ||
} else { | ||
@@ -335,3 +337,5 @@ spacing = this.spacing[property].map(n => Math.max(0, n)); | ||
case 1: { | ||
spacing = { top: spacing[0], right: spacing[0], bottom: spacing[0], left: spacing[0] }; | ||
spacing = { | ||
top: spacing[0], right: spacing[0], bottom: spacing[0], left: spacing[0] | ||
}; | ||
break; | ||
@@ -341,3 +345,5 @@ } | ||
case 2: { | ||
spacing = { top: spacing[0], right: spacing[1], bottom: spacing[0], left: spacing[1] }; | ||
spacing = { | ||
top: spacing[0], right: spacing[1], bottom: spacing[0], left: spacing[1] | ||
}; | ||
break; | ||
@@ -347,3 +353,5 @@ } | ||
case 3: { | ||
spacing = { top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[1] }; | ||
spacing = { | ||
top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[1] | ||
}; | ||
break; | ||
@@ -353,3 +361,5 @@ } | ||
default: { | ||
spacing = { top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[3] }; | ||
spacing = { | ||
top: spacing[0], right: spacing[1], bottom: spacing[2], left: spacing[3] | ||
}; | ||
break; | ||
@@ -356,0 +366,0 @@ } |
@@ -71,3 +71,3 @@ 'use strict'; | ||
return (str, render) => { | ||
const classname = render(str).replace(/\s+/g, ' ').split(' ').pop(); | ||
const classname = render(str).replaceAll(/\s+/g, ' ').split(' ').pop(); | ||
return classname.startsWith('.') ? classname.substr(1) : classname; | ||
@@ -74,0 +74,0 @@ }; |
@@ -42,3 +42,3 @@ 'use strict'; | ||
const pathname = this.separator ? name.split(path.sep).join(this.separator) : name; | ||
return format(template || '%s', path.basename(pathname.replace(/\s+/g, this.whitespace), '.svg')); | ||
return format(template || '%s', path.basename(pathname.replaceAll(/\s+/g, this.whitespace), '.svg')); | ||
}; | ||
@@ -128,3 +128,5 @@ | ||
*/ | ||
padding: { top: 0, right: 0, bottom: 0, left: 0 }, | ||
padding: { | ||
top: 0, right: 0, bottom: 0, left: 0 | ||
}, | ||
/** | ||
@@ -252,3 +254,3 @@ * Box sizing strategy | ||
for (const index of Object.keys(element.childNodes)) { | ||
for (let index = 0; index < element.childNodes.length; index++) { | ||
const child = element.childNodes.item(index); | ||
@@ -412,3 +414,3 @@ if (child.nodeType === 1) { | ||
for (const child of Object.keys(children)) { | ||
for (let child = 0; child < children.length; child++) { | ||
for (const [m, value] of Object.entries(meta)) { | ||
@@ -797,3 +799,3 @@ if (value === children.item(child).localName) { | ||
if (substIds !== null) { | ||
str = str.replace(/url\s*\(\s*["']?([^\s"')]+)["']?\s*\)/g, (match, id) => { | ||
str = str.replaceAll(/url\s*\(\s*["']?([^\s"')]+)["']?\s*\)/g, (match, id) => { | ||
return `url(${id in substIds ? `#${substIds[id]}` : id})`; | ||
@@ -834,3 +836,3 @@ }); | ||
} else if (Array.isArray(rule.cssRules)) { | ||
css += str.substring(rule.__starts, rule.cssRules[0].__starts) + this._replaceIdAndClassnameReferencesInCssSelectors(str, rule.cssRules, substIds, substClassnames) + str.substring(rule.cssRules[rule.cssRules.length - 1].__ends, rule.__ends); | ||
css += str.substring(rule.__starts, rule.cssRules[0].__starts) + this._replaceIdAndClassnameReferencesInCssSelectors(str, rule.cssRules, substIds, substClassnames) + str.substring(rule.cssRules.at(-1).__ends, rule.__ends); | ||
} | ||
@@ -837,0 +839,0 @@ |
@@ -19,3 +19,3 @@ 'use strict'; | ||
.toString() | ||
.replace(/(\s)(\s+)/g, ' '); | ||
.replaceAll(/(\s)(\s+)/g, ' '); | ||
@@ -22,0 +22,0 @@ if (!domParserError) { |
@@ -48,3 +48,3 @@ 'use strict'; | ||
* @param {string} inputString The string to trim the start of. | ||
* @param {string} [charsToTrim=' '] The characters to trim from the start of the string. Defaults to a single space. The order of the characters does not matter. | ||
* @param {string} [charsToTrim] The characters to trim from the start of the string. Defaults to a single space. The order of the characters does not matter. | ||
* @returns {string} The trimmed string. | ||
@@ -51,0 +51,0 @@ */ |
{ | ||
"name": "svg-sprite", | ||
"version": "3.0.0-beta3", | ||
"version": "3.0.0-rc1", | ||
"author": "Joschi Kuphal <joschi@kuphal.net> (https://jkphl.is)", | ||
@@ -16,3 +16,3 @@ "description": "SVG sprites & stacks galore — A low-level Node.js module that takes a bunch of SVG files, optimizes them and bakes them into SVG sprites of several types along with suitable stylesheet resources (e.g. CSS, Sass, LESS, Stylus, etc.)", | ||
"engines": { | ||
"node": ">=14.18.0" | ||
"node": ">=16" | ||
}, | ||
@@ -39,3 +39,3 @@ "main": "lib/svg-sprite.js", | ||
"@resvg/resvg-js": "^2.6.0", | ||
"@xmldom/xmldom": "0.8.8", | ||
"@xmldom/xmldom": "^0.8.10", | ||
"async": "^3.2.5", | ||
@@ -52,12 +52,12 @@ "css-selector-parser": "^1.4.1", | ||
"prettysize": "^2.0.0", | ||
"svgo": "^3.0.4", | ||
"svgo": "^3.2.0", | ||
"vinyl": "^3.0.0", | ||
"winston": "^3.11.0", | ||
"xpath": "^0.0.33", | ||
"xpath": "^0.0.34", | ||
"yargs": "^17.7.2" | ||
}, | ||
"devDependencies": { | ||
"eslint-plugin-jest": "^27.6.0", | ||
"eslint-plugin-jest": "^27.9.0", | ||
"eslint-plugin-jest-formatting": "^3.1.0", | ||
"eslint-plugin-jsdoc": "^41.1.2", | ||
"eslint-plugin-jsdoc": "^48.1.0", | ||
"jest": "^29.7.0", | ||
@@ -68,5 +68,5 @@ "less": "^4.2.0", | ||
"pngjs": "^7.0.0", | ||
"sass": "^1.69.5", | ||
"sass": "^1.71.0", | ||
"stylus": "^0.62.0", | ||
"xo": "^0.54.2" | ||
"xo": "^0.57.0" | ||
}, | ||
@@ -133,2 +133,4 @@ "keywords": [ | ||
"jsdoc/require-returns": "error", | ||
"jsdoc/tag-lines": "off", | ||
"logical-assignment-operators": "off", | ||
"max-depth": [ | ||
@@ -159,2 +161,3 @@ "warn", | ||
"unicorn/prefer-code-point": "off", | ||
"unicorn/prefer-event-target": "off", | ||
"unicorn/prefer-module": "off", | ||
@@ -175,3 +178,3 @@ "unicorn/prefer-reflect-apply": "off", | ||
"extends": [ | ||
"plugin:jest/all", | ||
"plugin:jest/recommended", | ||
"plugin:jest-formatting/strict" | ||
@@ -183,6 +186,2 @@ ], | ||
"rules": { | ||
"jest/max-expects": "off", | ||
"jest/no-hooks": "off", | ||
"jest/no-untyped-mock-factory": "off", | ||
"jest/prefer-lowercase-title": "off", | ||
"jsdoc/require-returns": "off" | ||
@@ -189,0 +188,0 @@ } |
@@ -19,3 +19,3 @@ # svg-sprite | ||
Being a low-level library with support for [Node.js streams](https://github.com/substack/stream-handbook), *svg-sprite* doesn't take on the part of accessing the file system (i.e. reading the source SVGs from and writing the sprites and CSS files to disk). If you don't want to take care of this stuff yourself, you might rather have a look at the available wrappers for **Grunt** ([grunt-svg-sprite](https://github.com/svg-sprite/svg-sprite)) and **Gulp** ([gulp-svg-sprite](https://github.com/svg-sprite/gulp-svg-sprite)). *svg-sprite* is also the foundation of the **[iconizr](https://github.com/jkphl/node-iconizr)** project, which serves high-quality SVG based **CSS icon kits with PNG fallbacks**. | ||
Being a low-level library with support for [Node.js streams](https://github.com/substack/stream-handbook), *svg-sprite* doesn't take on the part of accessing the file system (i.e. reading the source SVGs from and writing the sprites and CSS files to disk). If you don't want to take care of this stuff yourself, you might rather have a look at the available wrappers for **Grunt** ([grunt-svg-sprite](https://github.com/svg-sprite/grunt-svg-sprite)) and **Gulp** ([gulp-svg-sprite](https://github.com/svg-sprite/gulp-svg-sprite)). *svg-sprite* is also the foundation of the **[iconizr](https://github.com/jkphl/node-iconizr)** project, which serves high-quality SVG based **CSS icon kits with PNG fallbacks**. | ||
@@ -22,0 +22,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198460
3773
+ Added@xmldom/xmldom@0.8.10(transitive)
+ Addedxpath@0.0.34(transitive)
- Removed@xmldom/xmldom@0.8.8(transitive)
- Removedxpath@0.0.33(transitive)
Updated@xmldom/xmldom@^0.8.10
Updatedsvgo@^3.2.0
Updatedxpath@^0.0.34