/var/www/flurhymez/node_modules/svgo/plugins
NameSizeModeActions
addAttributesToSVGElement.js20660644editdlrm
addClassesToSVGElement.js18330644editdlrm
cleanupAttrs.js14570644editdlrm
cleanupEnableBackground.js20140644editdlrm
cleanupIDs.js71450644editdlrm
cleanupListOfValues.js39960644editdlrm
cleanupNumericValues.js29560644editdlrm
collapseGroups.js39260644editdlrm
convertColors.js42220644editdlrm
convertEllipseToCircle.js9380644editdlrm
convertPathData.js283890644editdlrm
convertShapeToPath.js59830644editdlrm
convertStyleToAttrs.js38280644editdlrm
convertTransform.js116960644editdlrm
inlineStyles.js121820644editdlrm
mergePaths.js29940644editdlrm
mergeStyles.js23800644editdlrm
minifyStyles.js43890644editdlrm
moveElemsAttrsToGroup.js37410644editdlrm
moveGroupAttrsToElems.js17120644editdlrm
plugins.js32240644editdlrm
prefixIds.js65850644editdlrm
preset-default.js29900644editdlrm
removeAttributesBySelector.js24430644editdlrm
removeAttrs.js41910644editdlrm
removeComments.js6340644editdlrm
removeDesc.js10750644editdlrm
removeDimensions.js12270644editdlrm
removeDoctype.js11330644editdlrm
removeEditorsNSData.js20220644editdlrm
removeElementsByAttr.js21390644editdlrm
removeEmptyAttrs.js7770644editdlrm
removeEmptyContainers.js14910644editdlrm
removeEmptyText.js13890644editdlrm
removeHiddenElems.js92890644editdlrm
removeMetadata.js5660644editdlrm
removeNonInheritableGroupAttrs.js9250644editdlrm
removeOffCanvasPaths.js39670644editdlrm
removeRasterImages.js7750644editdlrm
removeScriptElement.js6010644editdlrm
removeStyleElement.js6040644editdlrm
removeTitle.js5790644editdlrm
removeUnknownsAndDefaults.js63460644editdlrm
removeUnusedNS.js18480644editdlrm
removeUselessDefs.js17240644editdlrm
removeUselessStrokeAndFill.js43590644editdlrm
removeViewBox.js14020644editdlrm
removeXMLNS.js6660644editdlrm
removeXMLProcInst.js6100644editdlrm
reusePaths.js33790644editdlrm
sortAttrs.js27220644editdlrm
sortDefsChildren.js18330644editdlrm
_applyTransforms.js98240644editdlrm
_collections.js444760644editdlrm
_path.js213580644editdlrm
_transforms.js107690644editdlrm
Edit: /var/www/flurhymez/node_modules/svgo/plugins/mergePaths.js (2994B)
'use strict'; const { detachNodeFromParent } = require('../lib/xast.js'); const { collectStylesheet, computeStyle } = require('../lib/style.js'); const { path2js, js2path, intersects } = require('./_path.js'); exports.type = 'visitor'; exports.name = 'mergePaths'; exports.active = true; exports.description = 'merges multiple paths in one if possible'; /** * Merge multiple Paths into one. * * @author Kir Belevich, Lev Solntsev * * @type {import('../lib/types').Plugin<{ * force?: boolean, * floatPrecision?: number, * noSpaceAfterFlags?: boolean * }>} */ exports.fn = (root, params) => { const { force = false, floatPrecision, noSpaceAfterFlags = false, // a20 60 45 0 1 30 20 → a20 60 45 0130 20 } = params; const stylesheet = collectStylesheet(root); return { element: { enter: (node) => { let prevChild = null; for (const child of node.children) { // skip if previous element is not path or contains animation elements if ( prevChild == null || prevChild.type !== 'element' || prevChild.name !== 'path' || prevChild.children.length !== 0 || prevChild.attributes.d == null ) { prevChild = child; continue; } // skip if element is not path or contains animation elements if ( child.type !== 'element' || child.name !== 'path' || child.children.length !== 0 || child.attributes.d == null ) { prevChild = child; continue; } // preserve paths with markers const computedStyle = computeStyle(stylesheet, child); if ( computedStyle['marker-start'] || computedStyle['marker-mid'] || computedStyle['marker-end'] ) { prevChild = child; continue; } const prevChildAttrs = Object.keys(prevChild.attributes); const childAttrs = Object.keys(child.attributes); let attributesAreEqual = prevChildAttrs.length === childAttrs.length; for (const name of childAttrs) { if (name !== 'd') { if ( prevChild.attributes[name] == null || prevChild.attributes[name] !== child.attributes[name] ) { attributesAreEqual = false; } } } const prevPathJS = path2js(prevChild); const curPathJS = path2js(child); if ( attributesAreEqual && (force || !intersects(prevPathJS, curPathJS)) ) { js2path(prevChild, prevPathJS.concat(curPathJS), { floatPrecision, noSpaceAfterFlags, }); detachNodeFromParent(child, node); continue; } prevChild = child; } }, }, }; };