Framework updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-03-04 23:20:19 +00:00
parent a89daf3d43
commit 3ed8517b2a
891 changed files with 11126 additions and 9600 deletions

93
node_modules/svgo/dist/svgo-node.cjs generated vendored
View File

@@ -291,10 +291,10 @@ const removeLeadingZero=value=>{const strValue=value.toString()
if(0<value&&value<1&&strValue.startsWith("0"))return strValue.slice(1)
if(-1<value&&value<0&&strValue[1]==="0")return strValue[0]+strValue.slice(2)
return strValue}
const hasScriptsEventAttrs=[...attrsGroups.animationEvent,...attrsGroups.documentEvent,...attrsGroups.documentElementEvent,...attrsGroups.globalEvent,...attrsGroups.graphicalEvent]
const hasScripts=node=>{if(node.name==="script"&&node.children.length!==0)return true
if(node.name==="a"){const hasJsLinks=Object.entries(node.attributes).some((([attrKey,attrValue])=>(attrKey==="href"||attrKey.endsWith(":href"))&&attrValue!=null&&attrValue.trimStart().startsWith("javascript:")))
if(hasJsLinks)return true}const eventAttrs=[...attrsGroups.animationEvent,...attrsGroups.documentEvent,...attrsGroups.documentElementEvent,...attrsGroups.globalEvent,...attrsGroups.graphicalEvent]
return eventAttrs.some((attr=>node.attributes[attr]!=null))}
if(hasJsLinks)return true}return hasScriptsEventAttrs.some((attr=>node.attributes[attr]!=null))}
const includesUrlReference=body=>new RegExp(regReferencesUrl).test(body)
const findReferences=(attribute,value)=>{const results=[]
if(referencesProps.has(attribute)){const matches=value.matchAll(regReferencesUrl)
@@ -384,8 +384,8 @@ const description$E='rounds numeric values to the fixed precision, removes defau
const regNumericValues$3=/^([-+]?\d*\.?\d+([eE][-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/
const absoluteLengths$1={cm:96/2.54,mm:96/25.4,in:96,pt:4/3,pc:16,px:1}
const fn$E=(_root,params)=>{const{floatPrecision:floatPrecision=3,leadingZero:leadingZero=true,defaultPx:defaultPx=true,convertToPx:convertToPx=true}=params
return{element:{enter:node=>{if(node.attributes.viewBox!=null){const nums=node.attributes.viewBox.trim().split(/(?:\s,?|,)\s*/g)
node.attributes.viewBox=nums.map((value=>{const num=Number(value)
return{element:{enter:node=>{if(node.attributes.viewBox!=null){const numbers=node.attributes.viewBox.trim().split(/(?:\s,?|,)\s*/g)
node.attributes.viewBox=numbers.map((value=>{const num=Number(value)
return Number.isNaN(num)?value:Number(num.toFixed(floatPrecision))})).join(" ")}for(const[name,value]of Object.entries(node.attributes)){if(name==="version")continue
const match=regNumericValues$3.exec(value)
if(match){let num=Number(Number(match[1]).toFixed(floatPrecision))
@@ -414,10 +414,10 @@ if(currentColor&&maskCounter===0){let matched
matched=typeof currentColor==="string"?val===currentColor:currentColor instanceof RegExp?currentColor.exec(val)!=null:val!=="none"
matched&&(val="currentColor")}if(names2hex){const colorName=val.toLowerCase()
colorsNames[colorName]!=null&&(val=colorsNames[colorName])}if(rgb2hex){const match=val.match(regRGB)
if(match!=null){const nums=match.slice(1,4).map((m=>{let n
if(match!=null){const numbers=match.slice(1,4).map((m=>{let n
n=m.indexOf("%")>-1?Math.round(parseFloat(m)*2.55):Number(m)
return Math.max(0,Math.min(n,255))}))
val=convertRgbToHex(nums)}}convertCase&&!includesUrlReference(val)&&val!=="currentColor"&&(convertCase==="lower"?val=val.toLowerCase():convertCase==="upper"&&(val=val.toUpperCase()))
val=convertRgbToHex(numbers)}}convertCase&&!includesUrlReference(val)&&val!=="currentColor"&&(convertCase==="lower"?val=val.toLowerCase():convertCase==="upper"&&(val=val.toUpperCase()))
if(shorthex){const match=regHEX.exec(val)
match!=null&&(val="#"+match[0][1]+match[0][3]+match[0][5])}if(shortname){const colorName=val.toLowerCase()
colorsShortNames[colorName]!=null&&(val=colorsShortNames[colorName])}node.attributes[name]=val}},exit:node=>{node.name==="mask"&&maskCounter--}}}}
@@ -455,7 +455,7 @@ if(keepRoleAttr&&name==="role")continue
if(name==="xmlns")continue
if(name.includes(":")){const[prefix]=name.split(":")
if(prefix!=="xml"&&prefix!=="xlink")continue}unknownAttrs&&allowedAttributes&&allowedAttributes.has(name)===false&&delete node.attributes[name]
defaultAttrs&&node.attributes.id==null&&attributesDefaults&&attributesDefaults.get(name)===value&&computedParentStyle?.[name]==null&&delete node.attributes[name]
defaultAttrs&&node.attributes.id==null&&attributesDefaults&&attributesDefaults.get(name)===value&&(computedParentStyle?.[name]!=null||stylesheet.rules.some((rule=>includesAttrSelector(rule.selector,name)))||delete node.attributes[name])
if(uselessOverrides&&node.attributes.id==null){const style=computedParentStyle?.[name]
presentationNonInheritableGroupAttrs.has(name)===false&&style!=null&&style.type==="static"&&style.value===value&&delete node.attributes[name]}}}}}}
var removeUnknownsAndDefaults=Object.freeze({__proto__:null,description:description$C,fn:fn$C,name:name$C})
@@ -608,10 +608,7 @@ const value=node.attributes[attr]
const id=value.slice(1)
let refs=referencesById.get(id)
if(!refs){refs=[]
referencesById.set(id,refs)}refs.push({node:node,parentNode:parentNode})}const computedStyle=computeStyle(stylesheet,node)
if(isHidden&&computedStyle.visibility&&computedStyle.visibility.type==="static"&&computedStyle.visibility.value==="hidden"&&querySelector(node,"[visibility=visible]")==null){removeElement(node,parentNode)
return}if(displayNone&&computedStyle.display&&computedStyle.display.type==="static"&&computedStyle.display.value==="none"&&node.name!=="marker"){removeElement(node,parentNode)
return}if(circleR0&&node.name==="circle"&&node.children.length===0&&node.attributes.r==="0"){removeElement(node,parentNode)
referencesById.set(id,refs)}refs.push({node:node,parentNode:parentNode})}if(circleR0&&node.name==="circle"&&node.children.length===0&&node.attributes.r==="0"){removeElement(node,parentNode)
return}if(ellipseRX0&&node.name==="ellipse"&&node.children.length===0&&node.attributes.rx==="0"){removeElement(node,parentNode)
return}if(ellipseRY0&&node.name==="ellipse"&&node.children.length===0&&node.attributes.ry==="0"){removeElement(node,parentNode)
return}if(rectWidth0&&node.name==="rect"&&node.children.length===0&&node.attributes.width==="0"){removeElement(node,parentNode)
@@ -620,13 +617,16 @@ return}if(patternWidth0&&node.name==="pattern"&&node.attributes.width==="0"){rem
return}if(patternHeight0&&node.name==="pattern"&&node.attributes.height==="0"){removeElement(node,parentNode)
return}if(imageWidth0&&node.name==="image"&&node.attributes.width==="0"){removeElement(node,parentNode)
return}if(imageHeight0&&node.name==="image"&&node.attributes.height==="0"){removeElement(node,parentNode)
return}if(polylineEmptyPoints&&node.name==="polyline"&&node.attributes.points==null){removeElement(node,parentNode)
return}if(polygonEmptyPoints&&node.name==="polygon"&&node.attributes.points==null){removeElement(node,parentNode)
return}const computedStyle=computeStyle(stylesheet,node)
if(isHidden&&computedStyle.visibility&&computedStyle.visibility.type==="static"&&computedStyle.visibility.value==="hidden"&&querySelector(node,"[visibility=visible]")==null){removeElement(node,parentNode)
return}if(displayNone&&computedStyle.display&&computedStyle.display.type==="static"&&computedStyle.display.value==="none"&&node.name!=="marker"){removeElement(node,parentNode)
return}if(pathEmptyD&&node.name==="path"){if(node.attributes.d==null){removeElement(node,parentNode)
return}const pathData=parsePathData(node.attributes.d)
if(pathData.length===0){removeElement(node,parentNode)
return}if(pathData.length===1&&computedStyle["marker-start"]==null&&computedStyle["marker-end"]==null){removeElement(node,parentNode)
return}}if(polylineEmptyPoints&&node.name==="polyline"&&node.attributes.points==null){removeElement(node,parentNode)
return}if(polygonEmptyPoints&&node.name==="polygon"&&node.attributes.points==null){removeElement(node,parentNode)
return}for(const[name,value]of Object.entries(node.attributes)){const ids=findReferences(name,value)
return}}for(const[name,value]of Object.entries(node.attributes)){const ids=findReferences(name,value)
for(const id of ids)allReferences.add(id)}}},root:{exit:()=>{for(const id of removedDefIds){const refs=referencesById.get(id)
if(refs)for(const{node:node,parentNode:parentNode}of refs)detachNodeFromParent(node,parentNode)}if(!deoptimized)for(const[nonRenderedNode,nonRenderedParent]of nonRenderedNodes.entries())canRemoveNonRenderingNode(nonRenderedNode)&&detachNodeFromParent(nonRenderedNode,nonRenderedParent)
for(const[node,parentNode]of allDefs.entries())node.children.length===0&&detachNodeFromParent(node,parentNode)}}}}
@@ -1260,25 +1260,25 @@ let{command:command,args:args}=pathItem
if(command==="m"){cursor[0]+=args[0]
cursor[1]+=args[1]
start[0]=cursor[0]
start[1]=cursor[1]}if(command==="M"){i!==0&&(command="m")
start[1]=cursor[1]}else if(command==="M"){i!==0&&(command="m")
args[0]-=cursor[0]
args[1]-=cursor[1]
cursor[0]+=args[0]
cursor[1]+=args[1]
start[0]=cursor[0]
start[1]=cursor[1]}if(command==="l"){cursor[0]+=args[0]
cursor[1]+=args[1]}if(command==="L"){command="l"
start[1]=cursor[1]}else if(command==="l"){cursor[0]+=args[0]
cursor[1]+=args[1]}else if(command==="L"){command="l"
args[0]-=cursor[0]
args[1]-=cursor[1]
cursor[0]+=args[0]
cursor[1]+=args[1]}command==="h"&&(cursor[0]+=args[0])
if(command==="H"){command="h"
cursor[1]+=args[1]}else if(command==="h")cursor[0]+=args[0]
else if(command==="H"){command="h"
args[0]-=cursor[0]
cursor[0]+=args[0]}command==="v"&&(cursor[1]+=args[0])
if(command==="V"){command="v"
cursor[0]+=args[0]}else if(command==="v")cursor[1]+=args[0]
else if(command==="V"){command="v"
args[0]-=cursor[1]
cursor[1]+=args[0]}if(command==="c"){cursor[0]+=args[4]
cursor[1]+=args[5]}if(command==="C"){command="c"
cursor[1]+=args[0]}else if(command==="c"){cursor[0]+=args[4]
cursor[1]+=args[5]}else if(command==="C"){command="c"
args[0]-=cursor[0]
args[1]-=cursor[1]
args[2]-=cursor[0]
@@ -1286,31 +1286,31 @@ args[3]-=cursor[1]
args[4]-=cursor[0]
args[5]-=cursor[1]
cursor[0]+=args[4]
cursor[1]+=args[5]}if(command==="s"){cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="S"){command="s"
cursor[1]+=args[5]}else if(command==="s"){cursor[0]+=args[2]
cursor[1]+=args[3]}else if(command==="S"){command="s"
args[0]-=cursor[0]
args[1]-=cursor[1]
args[2]-=cursor[0]
args[3]-=cursor[1]
cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="q"){cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="Q"){command="q"
cursor[1]+=args[3]}else if(command==="q"){cursor[0]+=args[2]
cursor[1]+=args[3]}else if(command==="Q"){command="q"
args[0]-=cursor[0]
args[1]-=cursor[1]
args[2]-=cursor[0]
args[3]-=cursor[1]
cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="t"){cursor[0]+=args[0]
cursor[1]+=args[1]}if(command==="T"){command="t"
cursor[1]+=args[3]}else if(command==="t"){cursor[0]+=args[0]
cursor[1]+=args[1]}else if(command==="T"){command="t"
args[0]-=cursor[0]
args[1]-=cursor[1]
cursor[0]+=args[0]
cursor[1]+=args[1]}if(command==="a"){cursor[0]+=args[5]
cursor[1]+=args[6]}if(command==="A"){command="a"
cursor[1]+=args[1]}else if(command==="a"){cursor[0]+=args[5]
cursor[1]+=args[6]}else if(command==="A"){command="a"
args[5]-=cursor[0]
args[6]-=cursor[1]
cursor[0]+=args[5]
cursor[1]+=args[6]}if(command==="Z"||command==="z"){cursor[0]=start[0]
cursor[1]+=args[6]}else if(command==="Z"||command==="z"){cursor[0]=start[0]
cursor[1]=start[1]}pathItem.command=command
pathItem.args=args
pathItem.base=prevCoords
@@ -1540,12 +1540,19 @@ var removeEmptyAttrs=Object.freeze({__proto__:null,description:description$p,fn:
const name$o="removeEmptyContainers"
const description$o="removes empty container elements"
const fn$o=root=>{const stylesheet=collectStylesheet(root)
return{element:{exit:(node,parentNode)=>{if(node.name==="svg"||!elemsGroups.container.has(node.name)||node.children.length!==0)return
const removedIds=new Set
const usesById=new Map
return{element:{enter:(node,parentNode)=>{if(node.name==="use")for(const[name,value]of Object.entries(node.attributes)){const ids=findReferences(name,value)
for(const id of ids){let references=usesById.get(id)
if(references===void 0){references=[]
usesById.set(id,references)}references.push({node:node,parent:parentNode})}}},exit:(node,parentNode)=>{if(node.name==="svg"||!elemsGroups.container.has(node.name)||node.children.length!==0)return
if(node.name==="pattern"&&Object.keys(node.attributes).length!==0)return
if(node.name==="mask"&&node.attributes.id!=null)return
if(parentNode.type==="element"&&parentNode.name==="switch")return
if(node.name==="g"&&(node.attributes.filter!=null||computeStyle(stylesheet,node).filter))return
detachNodeFromParent(node,parentNode)}}}}
detachNodeFromParent(node,parentNode)
node.attributes.id&&removedIds.add(node.attributes.id)}},root:{exit:()=>{for(const id of removedIds){const uses=usesById.get(id)
if(uses)for(const use of uses)detachNodeFromParent(use.node,use.parent)}}}}}
var removeEmptyContainers=Object.freeze({__proto__:null,description:description$o,fn:fn$o,name:name$o})
const name$n="mergePaths"
const description$n="merges multiple paths in one if possible"
@@ -1813,7 +1820,7 @@ delete node.attributes.width
delete node.attributes.height}}}})
var removeDimensions=Object.freeze({__proto__:null,description:description$a,fn:fn$a,name:name$a})
const name$9="removeElementsByAttr"
const description$9="removes arbitrary elements by ID or className (disabled by default)"
const description$9="removes arbitrary elements by ID or className"
const fn$9=(root,params)=>{const ids=params.id==null?[]:Array.isArray(params.id)?params.id:[params.id]
const classes=params.class==null?[]:Array.isArray(params.class)?params.class:[params.class]
return{element:{enter:(node,parentNode)=>{node.attributes.id!=null&&ids.length!==0&&ids.includes(node.attributes.id)&&detachNodeFromParent(node,parentNode)
@@ -1822,7 +1829,7 @@ for(const item of classes)if(classList.includes(item)){detachNodeFromParent(node
break}}}}}}
var removeElementsByAttr=Object.freeze({__proto__:null,description:description$9,fn:fn$9,name:name$9})
const name$8="removeOffCanvasPaths"
const description$8="removes elements that are drawn outside of the viewBox (disabled by default)"
const description$8="removes elements that are drawn outside of the viewBox"
const fn$8=()=>{let viewBoxData=null
return{element:{enter:(node,parentNode)=>{if(node.name==="svg"&&parentNode.type==="root"){let viewBox=""
node.attributes.viewBox!=null?viewBox=node.attributes.viewBox:node.attributes.height!=null&&node.attributes.width!=null&&(viewBox=`0 0 ${node.attributes.width} ${node.attributes.height}`)
@@ -1844,11 +1851,11 @@ const viewBoxPathData=[{command:"M",args:[left,top]},{command:"h",args:[width]},
intersects(viewBoxPathData,pathData)===false&&detachNodeFromParent(node,parentNode)}}}}}
var removeOffCanvasPaths=Object.freeze({__proto__:null,description:description$8,fn:fn$8,name:name$8})
const name$7="removeRasterImages"
const description$7="removes raster images (disabled by default)"
const description$7="removes raster images"
const fn$7=()=>({element:{enter:(node,parentNode)=>{node.name==="image"&&node.attributes["xlink:href"]!=null&&/(\.|image\/)(jpe?g|png|gif)/.test(node.attributes["xlink:href"])&&detachNodeFromParent(node,parentNode)}}})
var removeRasterImages=Object.freeze({__proto__:null,description:description$7,fn:fn$7,name:name$7})
const name$6="removeScripts"
const description$6="removes scripts (disabled by default)"
const description$6="removes scripts"
const eventAttrs=[...attrsGroups.animationEvent,...attrsGroups.documentEvent,...attrsGroups.documentElementEvent,...attrsGroups.globalEvent,...attrsGroups.graphicalEvent]
const fn$6=()=>({element:{enter:(node,parentNode)=>{if(node.name==="script"){detachNodeFromParent(node,parentNode)
return}for(const attr of eventAttrs)node.attributes[attr]!=null&&delete node.attributes[attr]},exit:(node,parentNode)=>{if(node.name!=="a")return
@@ -1858,7 +1865,7 @@ const usefulChildren=node.children.filter((child=>child.type!=="text"))
parentNode.children.splice(index,1,...usefulChildren)}}}})
var removeScripts=Object.freeze({__proto__:null,description:description$6,fn:fn$6,name:name$6})
const name$5="removeStyleElement"
const description$5="removes <style> element (disabled by default)"
const description$5="removes <style> element"
const fn$5=()=>({element:{enter:(node,parentNode)=>{node.name==="style"&&detachNodeFromParent(node,parentNode)}}})
var removeStyleElement=Object.freeze({__proto__:null,description:description$5,fn:fn$5,name:name$5})
const name$4="removeTitle"
@@ -1869,8 +1876,8 @@ const name$3="removeViewBox"
const description$3="removes viewBox attribute when possible"
const viewBoxElems=new Set(["pattern","svg","symbol"])
const fn$3=()=>({element:{enter:(node,parentNode)=>{if(viewBoxElems.has(node.name)&&node.attributes.viewBox!=null&&node.attributes.width!=null&&node.attributes.height!=null){if(node.name==="svg"&&parentNode.type!=="root")return
const nums=node.attributes.viewBox.split(/[ ,]+/g)
nums[0]==="0"&&nums[1]==="0"&&node.attributes.width.replace(/px$/,"")===nums[2]&&node.attributes.height.replace(/px$/,"")===nums[3]&&delete node.attributes.viewBox}}}})
const numbers=node.attributes.viewBox.split(/[ ,]+/g)
numbers[0]==="0"&&numbers[1]==="0"&&node.attributes.width.replace(/px$/,"")===numbers[2]&&node.attributes.height.replace(/px$/,"")===numbers[3]&&delete node.attributes.viewBox}}}})
var removeViewBox=Object.freeze({__proto__:null,description:description$3,fn:fn$3,name:name$3})
const name$2="removeXlink"
const description$2="remove xlink namespace and replaces attributes with the SVG 2 equivalent where applicable"
@@ -1916,7 +1923,7 @@ continue}if(overriddenPrefixes.includes(prefix)){const index=overriddenPrefixes.
overriddenPrefixes.splice(index,1)}}}}}}}
var removeXlink=Object.freeze({__proto__:null,description:description$2,fn:fn$2,name:name$2})
const name$1="removeXMLNS"
const description$1="removes xmlns attribute (for inline svg, disabled by default)"
const description$1="removes xmlns attribute (for inline svg)"
const fn$1=()=>({element:{enter:node=>{node.name==="svg"&&delete node.attributes.xmlns}}})
var removeXMLNS=Object.freeze({__proto__:null,description:description$1,fn:fn$1,name:name$1})
const name="reusePaths"
@@ -2076,7 +2083,7 @@ for(const[name,value]of Object.entries(node.attributes)){attrs+=" "+name
if(value!==void 0){const encodedValue=value.toString().replace(config.regValEntities,config.encodeEntity)
attrs+=config.attrStart+encodedValue+config.attrEnd}}return attrs}
const stringifyText=(node,config,state)=>createIndent(config,state)+config.textStart+node.value.replace(config.regEntities,config.encodeEntity)+(state.textContext?"":config.textEnd)
const VERSION="4.0.0"
const VERSION="4.0.1"
const pluginsMap=new Map
for(const plugin of builtinPlugins)pluginsMap.set(plugin.name,plugin)
function getPlugin(name){if(name==="removeScriptElement"){console.warn("Warning: removeScriptElement has been renamed to removeScripts, please update your SVGO config")

View File

@@ -6153,10 +6153,10 @@ const removeLeadingZero=value=>{const strValue=value.toString()
if(0<value&&value<1&&strValue.startsWith("0"))return strValue.slice(1)
if(-1<value&&value<0&&strValue[1]==="0")return strValue[0]+strValue.slice(2)
return strValue}
const hasScriptsEventAttrs=[...attrsGroups.animationEvent,...attrsGroups.documentEvent,...attrsGroups.documentElementEvent,...attrsGroups.globalEvent,...attrsGroups.graphicalEvent]
const hasScripts=node=>{if(node.name==="script"&&node.children.length!==0)return true
if(node.name==="a"){const hasJsLinks=Object.entries(node.attributes).some((([attrKey,attrValue])=>(attrKey==="href"||attrKey.endsWith(":href"))&&attrValue!=null&&attrValue.trimStart().startsWith("javascript:")))
if(hasJsLinks)return true}const eventAttrs=[...attrsGroups.animationEvent,...attrsGroups.documentEvent,...attrsGroups.documentElementEvent,...attrsGroups.globalEvent,...attrsGroups.graphicalEvent]
return eventAttrs.some((attr=>node.attributes[attr]!=null))}
if(hasJsLinks)return true}return hasScriptsEventAttrs.some((attr=>node.attributes[attr]!=null))}
const includesUrlReference=body=>new RegExp(regReferencesUrl).test(body)
const findReferences=(attribute,value)=>{const results=[]
if(referencesProps.has(attribute)){const matches=value.matchAll(regReferencesUrl)
@@ -6246,8 +6246,8 @@ const description$E='rounds numeric values to the fixed precision, removes defau
const regNumericValues$3=/^([-+]?\d*\.?\d+([eE][-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/
const absoluteLengths$1={cm:96/2.54,mm:96/25.4,in:96,pt:4/3,pc:16,px:1}
const fn$E=(_root,params)=>{const{floatPrecision:floatPrecision=3,leadingZero:leadingZero=true,defaultPx:defaultPx=true,convertToPx:convertToPx=true}=params
return{element:{enter:node=>{if(node.attributes.viewBox!=null){const nums=node.attributes.viewBox.trim().split(/(?:\s,?|,)\s*/g)
node.attributes.viewBox=nums.map((value=>{const num=Number(value)
return{element:{enter:node=>{if(node.attributes.viewBox!=null){const numbers=node.attributes.viewBox.trim().split(/(?:\s,?|,)\s*/g)
node.attributes.viewBox=numbers.map((value=>{const num=Number(value)
return Number.isNaN(num)?value:Number(num.toFixed(floatPrecision))})).join(" ")}for(const[name,value]of Object.entries(node.attributes)){if(name==="version")continue
const match=regNumericValues$3.exec(value)
if(match){let num=Number(Number(match[1]).toFixed(floatPrecision))
@@ -6276,10 +6276,10 @@ if(currentColor&&maskCounter===0){let matched
matched=typeof currentColor==="string"?val===currentColor:currentColor instanceof RegExp?currentColor.exec(val)!=null:val!=="none"
matched&&(val="currentColor")}if(names2hex){const colorName=val.toLowerCase()
colorsNames[colorName]!=null&&(val=colorsNames[colorName])}if(rgb2hex){const match=val.match(regRGB)
if(match!=null){const nums=match.slice(1,4).map((m=>{let n
if(match!=null){const numbers=match.slice(1,4).map((m=>{let n
n=m.indexOf("%")>-1?Math.round(parseFloat(m)*2.55):Number(m)
return Math.max(0,Math.min(n,255))}))
val=convertRgbToHex(nums)}}convertCase&&!includesUrlReference(val)&&val!=="currentColor"&&(convertCase==="lower"?val=val.toLowerCase():convertCase==="upper"&&(val=val.toUpperCase()))
val=convertRgbToHex(numbers)}}convertCase&&!includesUrlReference(val)&&val!=="currentColor"&&(convertCase==="lower"?val=val.toLowerCase():convertCase==="upper"&&(val=val.toUpperCase()))
if(shorthex){const match=regHEX.exec(val)
match!=null&&(val="#"+match[0][1]+match[0][3]+match[0][5])}if(shortname){const colorName=val.toLowerCase()
colorsShortNames[colorName]!=null&&(val=colorsShortNames[colorName])}node.attributes[name]=val}},exit:node=>{node.name==="mask"&&maskCounter--}}}}
@@ -6317,7 +6317,7 @@ if(keepRoleAttr&&name==="role")continue
if(name==="xmlns")continue
if(name.includes(":")){const[prefix]=name.split(":")
if(prefix!=="xml"&&prefix!=="xlink")continue}unknownAttrs&&allowedAttributes&&allowedAttributes.has(name)===false&&delete node.attributes[name]
defaultAttrs&&node.attributes.id==null&&attributesDefaults&&attributesDefaults.get(name)===value&&computedParentStyle?.[name]==null&&delete node.attributes[name]
defaultAttrs&&node.attributes.id==null&&attributesDefaults&&attributesDefaults.get(name)===value&&(computedParentStyle?.[name]!=null||stylesheet.rules.some((rule=>includesAttrSelector(rule.selector,name)))||delete node.attributes[name])
if(uselessOverrides&&node.attributes.id==null){const style=computedParentStyle?.[name]
presentationNonInheritableGroupAttrs.has(name)===false&&style!=null&&style.type==="static"&&style.value===value&&delete node.attributes[name]}}}}}}
var removeUnknownsAndDefaults=Object.freeze({__proto__:null,description:description$C,fn:fn$C,name:name$C})
@@ -6470,10 +6470,7 @@ const value=node.attributes[attr]
const id=value.slice(1)
let refs=referencesById.get(id)
if(!refs){refs=[]
referencesById.set(id,refs)}refs.push({node:node,parentNode:parentNode})}const computedStyle=computeStyle(stylesheet,node)
if(isHidden&&computedStyle.visibility&&computedStyle.visibility.type==="static"&&computedStyle.visibility.value==="hidden"&&querySelector(node,"[visibility=visible]")==null){removeElement(node,parentNode)
return}if(displayNone&&computedStyle.display&&computedStyle.display.type==="static"&&computedStyle.display.value==="none"&&node.name!=="marker"){removeElement(node,parentNode)
return}if(circleR0&&node.name==="circle"&&node.children.length===0&&node.attributes.r==="0"){removeElement(node,parentNode)
referencesById.set(id,refs)}refs.push({node:node,parentNode:parentNode})}if(circleR0&&node.name==="circle"&&node.children.length===0&&node.attributes.r==="0"){removeElement(node,parentNode)
return}if(ellipseRX0&&node.name==="ellipse"&&node.children.length===0&&node.attributes.rx==="0"){removeElement(node,parentNode)
return}if(ellipseRY0&&node.name==="ellipse"&&node.children.length===0&&node.attributes.ry==="0"){removeElement(node,parentNode)
return}if(rectWidth0&&node.name==="rect"&&node.children.length===0&&node.attributes.width==="0"){removeElement(node,parentNode)
@@ -6482,13 +6479,16 @@ return}if(patternWidth0&&node.name==="pattern"&&node.attributes.width==="0"){rem
return}if(patternHeight0&&node.name==="pattern"&&node.attributes.height==="0"){removeElement(node,parentNode)
return}if(imageWidth0&&node.name==="image"&&node.attributes.width==="0"){removeElement(node,parentNode)
return}if(imageHeight0&&node.name==="image"&&node.attributes.height==="0"){removeElement(node,parentNode)
return}if(polylineEmptyPoints&&node.name==="polyline"&&node.attributes.points==null){removeElement(node,parentNode)
return}if(polygonEmptyPoints&&node.name==="polygon"&&node.attributes.points==null){removeElement(node,parentNode)
return}const computedStyle=computeStyle(stylesheet,node)
if(isHidden&&computedStyle.visibility&&computedStyle.visibility.type==="static"&&computedStyle.visibility.value==="hidden"&&querySelector(node,"[visibility=visible]")==null){removeElement(node,parentNode)
return}if(displayNone&&computedStyle.display&&computedStyle.display.type==="static"&&computedStyle.display.value==="none"&&node.name!=="marker"){removeElement(node,parentNode)
return}if(pathEmptyD&&node.name==="path"){if(node.attributes.d==null){removeElement(node,parentNode)
return}const pathData=parsePathData(node.attributes.d)
if(pathData.length===0){removeElement(node,parentNode)
return}if(pathData.length===1&&computedStyle["marker-start"]==null&&computedStyle["marker-end"]==null){removeElement(node,parentNode)
return}}if(polylineEmptyPoints&&node.name==="polyline"&&node.attributes.points==null){removeElement(node,parentNode)
return}if(polygonEmptyPoints&&node.name==="polygon"&&node.attributes.points==null){removeElement(node,parentNode)
return}for(const[name,value]of Object.entries(node.attributes)){const ids=findReferences(name,value)
return}}for(const[name,value]of Object.entries(node.attributes)){const ids=findReferences(name,value)
for(const id of ids)allReferences.add(id)}}},root:{exit:()=>{for(const id of removedDefIds){const refs=referencesById.get(id)
if(refs)for(const{node:node,parentNode:parentNode}of refs)detachNodeFromParent(node,parentNode)}if(!deoptimized)for(const[nonRenderedNode,nonRenderedParent]of nonRenderedNodes.entries())canRemoveNonRenderingNode(nonRenderedNode)&&detachNodeFromParent(nonRenderedNode,nonRenderedParent)
for(const[node,parentNode]of allDefs.entries())node.children.length===0&&detachNodeFromParent(node,parentNode)}}}}
@@ -7122,25 +7122,25 @@ let{command:command,args:args}=pathItem
if(command==="m"){cursor[0]+=args[0]
cursor[1]+=args[1]
start[0]=cursor[0]
start[1]=cursor[1]}if(command==="M"){i!==0&&(command="m")
start[1]=cursor[1]}else if(command==="M"){i!==0&&(command="m")
args[0]-=cursor[0]
args[1]-=cursor[1]
cursor[0]+=args[0]
cursor[1]+=args[1]
start[0]=cursor[0]
start[1]=cursor[1]}if(command==="l"){cursor[0]+=args[0]
cursor[1]+=args[1]}if(command==="L"){command="l"
start[1]=cursor[1]}else if(command==="l"){cursor[0]+=args[0]
cursor[1]+=args[1]}else if(command==="L"){command="l"
args[0]-=cursor[0]
args[1]-=cursor[1]
cursor[0]+=args[0]
cursor[1]+=args[1]}command==="h"&&(cursor[0]+=args[0])
if(command==="H"){command="h"
cursor[1]+=args[1]}else if(command==="h")cursor[0]+=args[0]
else if(command==="H"){command="h"
args[0]-=cursor[0]
cursor[0]+=args[0]}command==="v"&&(cursor[1]+=args[0])
if(command==="V"){command="v"
cursor[0]+=args[0]}else if(command==="v")cursor[1]+=args[0]
else if(command==="V"){command="v"
args[0]-=cursor[1]
cursor[1]+=args[0]}if(command==="c"){cursor[0]+=args[4]
cursor[1]+=args[5]}if(command==="C"){command="c"
cursor[1]+=args[0]}else if(command==="c"){cursor[0]+=args[4]
cursor[1]+=args[5]}else if(command==="C"){command="c"
args[0]-=cursor[0]
args[1]-=cursor[1]
args[2]-=cursor[0]
@@ -7148,31 +7148,31 @@ args[3]-=cursor[1]
args[4]-=cursor[0]
args[5]-=cursor[1]
cursor[0]+=args[4]
cursor[1]+=args[5]}if(command==="s"){cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="S"){command="s"
cursor[1]+=args[5]}else if(command==="s"){cursor[0]+=args[2]
cursor[1]+=args[3]}else if(command==="S"){command="s"
args[0]-=cursor[0]
args[1]-=cursor[1]
args[2]-=cursor[0]
args[3]-=cursor[1]
cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="q"){cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="Q"){command="q"
cursor[1]+=args[3]}else if(command==="q"){cursor[0]+=args[2]
cursor[1]+=args[3]}else if(command==="Q"){command="q"
args[0]-=cursor[0]
args[1]-=cursor[1]
args[2]-=cursor[0]
args[3]-=cursor[1]
cursor[0]+=args[2]
cursor[1]+=args[3]}if(command==="t"){cursor[0]+=args[0]
cursor[1]+=args[1]}if(command==="T"){command="t"
cursor[1]+=args[3]}else if(command==="t"){cursor[0]+=args[0]
cursor[1]+=args[1]}else if(command==="T"){command="t"
args[0]-=cursor[0]
args[1]-=cursor[1]
cursor[0]+=args[0]
cursor[1]+=args[1]}if(command==="a"){cursor[0]+=args[5]
cursor[1]+=args[6]}if(command==="A"){command="a"
cursor[1]+=args[1]}else if(command==="a"){cursor[0]+=args[5]
cursor[1]+=args[6]}else if(command==="A"){command="a"
args[5]-=cursor[0]
args[6]-=cursor[1]
cursor[0]+=args[5]
cursor[1]+=args[6]}if(command==="Z"||command==="z"){cursor[0]=start[0]
cursor[1]+=args[6]}else if(command==="Z"||command==="z"){cursor[0]=start[0]
cursor[1]=start[1]}pathItem.command=command
pathItem.args=args
pathItem.base=prevCoords
@@ -7402,12 +7402,19 @@ var removeEmptyAttrs=Object.freeze({__proto__:null,description:description$p,fn:
const name$o="removeEmptyContainers"
const description$o="removes empty container elements"
const fn$o=root=>{const stylesheet=collectStylesheet(root)
return{element:{exit:(node,parentNode)=>{if(node.name==="svg"||!elemsGroups.container.has(node.name)||node.children.length!==0)return
const removedIds=new Set
const usesById=new Map
return{element:{enter:(node,parentNode)=>{if(node.name==="use")for(const[name,value]of Object.entries(node.attributes)){const ids=findReferences(name,value)
for(const id of ids){let references=usesById.get(id)
if(references===void 0){references=[]
usesById.set(id,references)}references.push({node:node,parent:parentNode})}}},exit:(node,parentNode)=>{if(node.name==="svg"||!elemsGroups.container.has(node.name)||node.children.length!==0)return
if(node.name==="pattern"&&Object.keys(node.attributes).length!==0)return
if(node.name==="mask"&&node.attributes.id!=null)return
if(parentNode.type==="element"&&parentNode.name==="switch")return
if(node.name==="g"&&(node.attributes.filter!=null||computeStyle(stylesheet,node).filter))return
detachNodeFromParent(node,parentNode)}}}}
detachNodeFromParent(node,parentNode)
node.attributes.id&&removedIds.add(node.attributes.id)}},root:{exit:()=>{for(const id of removedIds){const uses=usesById.get(id)
if(uses)for(const use of uses)detachNodeFromParent(use.node,use.parent)}}}}}
var removeEmptyContainers=Object.freeze({__proto__:null,description:description$o,fn:fn$o,name:name$o})
const name$n="mergePaths"
const description$n="merges multiple paths in one if possible"
@@ -7675,7 +7682,7 @@ delete node.attributes.width
delete node.attributes.height}}}})
var removeDimensions=Object.freeze({__proto__:null,description:description$a,fn:fn$a,name:name$a})
const name$9="removeElementsByAttr"
const description$9="removes arbitrary elements by ID or className (disabled by default)"
const description$9="removes arbitrary elements by ID or className"
const fn$9=(root,params)=>{const ids=params.id==null?[]:Array.isArray(params.id)?params.id:[params.id]
const classes=params.class==null?[]:Array.isArray(params.class)?params.class:[params.class]
return{element:{enter:(node,parentNode)=>{node.attributes.id!=null&&ids.length!==0&&ids.includes(node.attributes.id)&&detachNodeFromParent(node,parentNode)
@@ -7684,7 +7691,7 @@ for(const item of classes)if(classList.includes(item)){detachNodeFromParent(node
break}}}}}}
var removeElementsByAttr=Object.freeze({__proto__:null,description:description$9,fn:fn$9,name:name$9})
const name$8="removeOffCanvasPaths"
const description$8="removes elements that are drawn outside of the viewBox (disabled by default)"
const description$8="removes elements that are drawn outside of the viewBox"
const fn$8=()=>{let viewBoxData=null
return{element:{enter:(node,parentNode)=>{if(node.name==="svg"&&parentNode.type==="root"){let viewBox=""
node.attributes.viewBox!=null?viewBox=node.attributes.viewBox:node.attributes.height!=null&&node.attributes.width!=null&&(viewBox=`0 0 ${node.attributes.width} ${node.attributes.height}`)
@@ -7706,11 +7713,11 @@ const viewBoxPathData=[{command:"M",args:[left,top]},{command:"h",args:[width]},
intersects(viewBoxPathData,pathData)===false&&detachNodeFromParent(node,parentNode)}}}}}
var removeOffCanvasPaths=Object.freeze({__proto__:null,description:description$8,fn:fn$8,name:name$8})
const name$7="removeRasterImages"
const description$7="removes raster images (disabled by default)"
const description$7="removes raster images"
const fn$7=()=>({element:{enter:(node,parentNode)=>{node.name==="image"&&node.attributes["xlink:href"]!=null&&/(\.|image\/)(jpe?g|png|gif)/.test(node.attributes["xlink:href"])&&detachNodeFromParent(node,parentNode)}}})
var removeRasterImages=Object.freeze({__proto__:null,description:description$7,fn:fn$7,name:name$7})
const name$6="removeScripts"
const description$6="removes scripts (disabled by default)"
const description$6="removes scripts"
const eventAttrs=[...attrsGroups.animationEvent,...attrsGroups.documentEvent,...attrsGroups.documentElementEvent,...attrsGroups.globalEvent,...attrsGroups.graphicalEvent]
const fn$6=()=>({element:{enter:(node,parentNode)=>{if(node.name==="script"){detachNodeFromParent(node,parentNode)
return}for(const attr of eventAttrs)node.attributes[attr]!=null&&delete node.attributes[attr]},exit:(node,parentNode)=>{if(node.name!=="a")return
@@ -7720,7 +7727,7 @@ const usefulChildren=node.children.filter((child=>child.type!=="text"))
parentNode.children.splice(index,1,...usefulChildren)}}}})
var removeScripts=Object.freeze({__proto__:null,description:description$6,fn:fn$6,name:name$6})
const name$5="removeStyleElement"
const description$5="removes <style> element (disabled by default)"
const description$5="removes <style> element"
const fn$5=()=>({element:{enter:(node,parentNode)=>{node.name==="style"&&detachNodeFromParent(node,parentNode)}}})
var removeStyleElement=Object.freeze({__proto__:null,description:description$5,fn:fn$5,name:name$5})
const name$4="removeTitle"
@@ -7731,8 +7738,8 @@ const name$3="removeViewBox"
const description$3="removes viewBox attribute when possible"
const viewBoxElems=new Set(["pattern","svg","symbol"])
const fn$3=()=>({element:{enter:(node,parentNode)=>{if(viewBoxElems.has(node.name)&&node.attributes.viewBox!=null&&node.attributes.width!=null&&node.attributes.height!=null){if(node.name==="svg"&&parentNode.type!=="root")return
const nums=node.attributes.viewBox.split(/[ ,]+/g)
nums[0]==="0"&&nums[1]==="0"&&node.attributes.width.replace(/px$/,"")===nums[2]&&node.attributes.height.replace(/px$/,"")===nums[3]&&delete node.attributes.viewBox}}}})
const numbers=node.attributes.viewBox.split(/[ ,]+/g)
numbers[0]==="0"&&numbers[1]==="0"&&node.attributes.width.replace(/px$/,"")===numbers[2]&&node.attributes.height.replace(/px$/,"")===numbers[3]&&delete node.attributes.viewBox}}}})
var removeViewBox=Object.freeze({__proto__:null,description:description$3,fn:fn$3,name:name$3})
const name$2="removeXlink"
const description$2="remove xlink namespace and replaces attributes with the SVG 2 equivalent where applicable"
@@ -7778,7 +7785,7 @@ continue}if(overriddenPrefixes.includes(prefix)){const index=overriddenPrefixes.
overriddenPrefixes.splice(index,1)}}}}}}}
var removeXlink=Object.freeze({__proto__:null,description:description$2,fn:fn$2,name:name$2})
const name$1="removeXMLNS"
const description$1="removes xmlns attribute (for inline svg, disabled by default)"
const description$1="removes xmlns attribute (for inline svg)"
const fn$1=()=>({element:{enter:node=>{node.name==="svg"&&delete node.attributes.xmlns}}})
var removeXMLNS=Object.freeze({__proto__:null,description:description$1,fn:fn$1,name:name$1})
const name="reusePaths"
@@ -7829,6 +7836,9 @@ parser.bufferCheckPosition=sax.MAX_BUFFER_LENGTH
parser.opt=opt||{}
parser.opt.lowercase=parser.opt.lowercase||parser.opt.lowercasetags
parser.looseCase=parser.opt.lowercase?"toLowerCase":"toUpperCase"
parser.opt.maxEntityCount=parser.opt.maxEntityCount||512
parser.opt.maxEntityDepth=parser.opt.maxEntityDepth||4
parser.entityCount=parser.entityDepth=0
parser.tags=[]
parser.closed=parser.closedRoot=parser.sawRoot=false
parser.tag=parser.error=null
@@ -7987,7 +7997,7 @@ num=parseInt(entity,16)
numStr=num.toString(16)}else{entity=entity.slice(1)
num=parseInt(entity,10)
numStr=num.toString(10)}entity=entity.replace(/^0+/,"")
if(isNaN(num)||numStr.toLowerCase()!==entity){strictFail(parser,"Invalid character entity")
if(isNaN(num)||numStr.toLowerCase()!==entity||num<0||num>0x10ffff){strictFail(parser,"Invalid character entity")
return"&"+parser.entity+";"}return String.fromCodePoint(num)}function beginWhiteSpace(parser,c){if(c==="<"){parser.state=S.OPEN_WAKA
parser.startTagPosition=parser.position}else if(!isWhitespace(c)){strictFail(parser,"Non-whitespace before first tag.")
parser.textNode=c
@@ -8078,7 +8088,12 @@ case S.COMMENT_ENDED:if(c!==">"){strictFail(parser,"Malformed comment")
parser.comment+="--"+c
parser.state=S.COMMENT}else parser.doctype&&parser.doctype!==true?parser.state=S.DOCTYPE_DTD:parser.state=S.TEXT
continue
case S.CDATA:c==="]"?parser.state=S.CDATA_ENDING:parser.cdata+=c
case S.CDATA:var starti=i-1
while(c&&c!=="]"){c=charAt(chunk,i++)
if(c&&parser.trackPosition){parser.position++
if(c==="\n"){parser.line++
parser.column=0}else parser.column++}}parser.cdata+=chunk.substring(starti,i-1)
c==="]"&&(parser.state=S.CDATA_ENDING)
continue
case S.CDATA_ENDING:if(c==="]")parser.state=S.CDATA_ENDING_2
else{parser.cdata+="]"+c
@@ -8155,7 +8170,7 @@ c===">"?openTag(parser):parser.state=S.ATTRIB
continue
case S.CLOSE_TAG:if(parser.tagName)if(c===">")closeTag(parser)
else if(isMatch(nameBody,c))parser.tagName+=c
else if(parser.script){parser.script+="</"+parser.tagName
else if(parser.script){parser.script+="</"+parser.tagName+c
parser.tagName=""
parser.state=S.SCRIPT}else{isWhitespace(c)||strictFail(parser,"Invalid tagname in closing tag")
parser.state=S.CLOSE_TAG_SAW_WHITE}else{if(isWhitespace(c))continue
@@ -8176,9 +8191,11 @@ break
case S.ATTRIB_VALUE_ENTITY_U:returnState=S.ATTRIB_VALUE_UNQUOTED
buffer="attribValue"
break}if(c===";"){var parsedEntity=parseEntity(parser)
if(parser.opt.unparsedEntities&&!Object.values(sax.XML_ENTITIES).includes(parsedEntity)){parser.entity=""
if(parser.opt.unparsedEntities&&!Object.values(sax.XML_ENTITIES).includes(parsedEntity)){(parser.entityCount+=1)>parser.opt.maxEntityCount&&error(parser,"Parsed entity count exceeds max entity count");(parser.entityDepth+=1)>parser.opt.maxEntityDepth&&error(parser,"Parsed entity depth exceeds max entity depth")
parser.entity=""
parser.state=returnState
parser.write(parsedEntity)}else{parser[buffer]+=parsedEntity
parser.write(parsedEntity)
parser.entityDepth-=1}else{parser[buffer]+=parsedEntity
parser.entity=""
parser.state=returnState}}else if(isMatch(parser.entity.length?entityBody:entityStart,c))parser.entity+=c
else{strictFail(parser,"Invalid character in entity name")
@@ -8197,11 +8214,11 @@ var length=arguments.length
if(!length)return""
var result=""
while(++index<length){var codePoint=Number(arguments[index])
if(!isFinite(codePoint)||codePoint<0||codePoint>0x10FFFF||floor(codePoint)!==codePoint)throw RangeError("Invalid code point: "+codePoint)
if(codePoint<=0xFFFF)codeUnits.push(codePoint)
if(!isFinite(codePoint)||codePoint<0||codePoint>0x10ffff||floor(codePoint)!==codePoint)throw RangeError("Invalid code point: "+codePoint)
if(codePoint<=0xffff)codeUnits.push(codePoint)
else{codePoint-=0x10000
highSurrogate=0xD800+(codePoint>>10)
lowSurrogate=codePoint%0x400+0xDC00
highSurrogate=0xd800+(codePoint>>10)
lowSurrogate=codePoint%0x400+0xdc00
codeUnits.push(highSurrogate,lowSurrogate)}if(index+1===length||codeUnits.length>MAX_SIZE){result+=stringFromCharCode.apply(null,codeUnits)
codeUnits.length=0}}return result}
Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:fromCodePoint,configurable:true,writable:true}):String.fromCodePoint=fromCodePoint}()})(exports)})(sax)
@@ -8328,7 +8345,7 @@ for(const[name,value]of Object.entries(node.attributes)){attrs+=" "+name
if(value!==void 0){const encodedValue=value.toString().replace(config.regValEntities,config.encodeEntity)
attrs+=config.attrStart+encodedValue+config.attrEnd}}return attrs}
const stringifyText=(node,config,state)=>createIndent(config,state)+config.textStart+node.value.replace(config.regEntities,config.encodeEntity)+(state.textContext?"":config.textEnd)
const VERSION="4.0.0"
const VERSION="4.0.1"
const pluginsMap=new Map
for(const plugin of builtinPlugins)pluginsMap.set(plugin.name,plugin)
function getPlugin(name){if(name==="removeScriptElement"){console.warn("Warning: removeScriptElement has been renamed to removeScripts, please update your SVGO config")

29
node_modules/svgo/lib/svgo/coa.js generated vendored
View File

@@ -140,7 +140,7 @@ async function action(args, opts, command) {
!opts.string &&
!opts.stdin &&
!opts.folder &&
process.stdin.isTTY === true
process.stdin.isTTY
) {
return command.help();
}
@@ -524,10 +524,33 @@ function checkWriteFileError(input, output, data, error) {
}
}
/** Show list of available plugins with short description. */
/**
* Show list of available plugins with short description with the presets it belongs to.
*/
function showAvailablePlugins() {
const pluginToPresetsMap = new Map();
for (const plugin of builtinPlugins) {
if (plugin.isPreset) {
for (const presetPlugins of plugin.plugins) {
if (!pluginToPresetsMap.has(presetPlugins.name)) {
pluginToPresetsMap.set(presetPlugins.name, [plugin.name]);
} else {
pluginToPresetsMap.get(presetPlugins.name).push(plugin.name);
}
}
}
}
const list = builtinPlugins
.map((plugin) => ` [ ${colors.green(plugin.name)} ] ${plugin.description}`)
.map((plugin) => {
const name = plugin.name;
let description = plugin.description || '';
const presetsForThisPlugin = pluginToPresetsMap.get(name) || [];
if (presetsForThisPlugin && presetsForThisPlugin.length > 0) {
description += ` (${presetsForThisPlugin.join(', ')})`;
}
return ` [ ${colors.green(name)} ] ${description}`;
})
.join('\n');
console.log('Currently available plugins:\n' + list);
}

View File

@@ -33,7 +33,7 @@ export const invokePlugins = (
};
/**
* @template {string} T
* @template {`preset-${string}`} T
* @param {{ name: T, plugins: ReadonlyArray<import('../types.js').BuiltinPlugin<string, any>> }} arg0
* @returns {import('../types.js').BuiltinPluginOrPreset<T, any>}
*/

18
node_modules/svgo/lib/svgo/tools.js generated vendored
View File

@@ -145,6 +145,14 @@ export const removeLeadingZero = (value) => {
return strValue;
};
const hasScriptsEventAttrs = [
...attrsGroups.animationEvent,
...attrsGroups.documentEvent,
...attrsGroups.documentElementEvent,
...attrsGroups.globalEvent,
...attrsGroups.graphicalEvent,
];
/**
* If the current node contains any scripts. This does not check parents or
* children of the node, only the properties and attributes of the node itself.
@@ -170,15 +178,7 @@ export const hasScripts = (node) => {
}
}
const eventAttrs = [
...attrsGroups.animationEvent,
...attrsGroups.documentEvent,
...attrsGroups.documentElementEvent,
...attrsGroups.globalEvent,
...attrsGroups.graphicalEvent,
];
return eventAttrs.some((attr) => node.attributes[attr] != null);
return hasScriptsEventAttrs.some((attr) => node.attributes[attr] != null);
};
/**

26
node_modules/svgo/lib/types.ts generated vendored
View File

@@ -136,18 +136,26 @@ export type BuiltinPlugin<Name extends string, Params> = {
fn: Plugin<Params>;
};
type PresetProperties<IsPreset extends boolean> = {
name: IsPreset extends true ? `preset-${string}` : string;
/** If the plugin is itself a preset that invokes other plugins. */
isPreset: IsPreset extends true ? true : undefined;
/**
* If {@link #isPreset} is true, an array of the plugins in the preset
* in the order that they are invoked.
*/
plugins: IsPreset extends true
? ReadonlyArray<BuiltinPlugin<string, Object>>
: undefined;
};
export type BuiltinPluginOrPreset<Name extends string, Params> = BuiltinPlugin<
Name,
Params
> & {
/** If the plugin is itself a preset that invokes other plugins. */
isPreset?: true;
/**
* If the plugin is a preset that invokes other plugins, this returns an
* array of the plugins in the preset in the order that they are invoked.
*/
plugins?: ReadonlyArray<BuiltinPlugin<string, Object>>;
};
> &
(PresetProperties<true> | Partial<PresetProperties<false>>);
export type XastDoctype = {
type: 'doctype';

2
node_modules/svgo/lib/version.js generated vendored
View File

@@ -4,4 +4,4 @@
* @type {string}
* @since 4.0.0
*/
export const VERSION = '4.0.0';
export const VERSION = '4.0.1';

13
node_modules/svgo/package.json generated vendored
View File

@@ -1,7 +1,7 @@
{
"packageManager": "yarn@3.8.7",
"name": "svgo",
"version": "4.0.0",
"version": "4.0.1",
"description": "SVGO is a Node.js library and command-line application for optimizing vector images.",
"license": "MIT",
"type": "module",
@@ -83,11 +83,12 @@
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --maxWorkers=4 --coverage",
"test:bundles": "yarn build:bundles && node ./test/svgo.cjs && node ./test/browser.js",
"test:types": "yarn build:types && tsc && tsd",
"test:regression": "node ./test/regression-extract.js && cross-env NO_DIFF=1 node ./test/regression.js",
"test:regression": "node ./test/regression/extract.js && node ./test/regression/optimize.js && cross-env NO_DIFF=1 node ./test/regression/compare.js",
"qa": "yarn lint && yarn test:types && yarn test && yarn test:bundles && yarn test:regression",
"clean": "yarn clean:build && yarn clean:types",
"clean:build": "rimraf dist",
"clean:types": "rimraf types",
"spellcheck": "cspell -u .",
"prepublishOnly": "yarn clean && yarn build"
},
"jest": {
@@ -107,7 +108,7 @@
"css-what": "^6.1.0",
"csso": "^5.0.5",
"picocolors": "^1.1.1",
"sax": "^1.4.1"
"sax": "^1.5.0"
},
"devDependencies": {
"@eslint/js": "^9.25.1",
@@ -119,14 +120,16 @@
"@types/csso": "^5.0.4",
"@types/jest": "^29.5.14",
"@types/node": "^22.15.3",
"@types/pngjs": "^6.0.5",
"@types/sax": "^1.2.7",
"@types/tar-stream": "^3.1.3",
"cross-env": "^7.0.3",
"cspell": "^9.2.2",
"eslint": "^9.25.1",
"globals": "^14.0.0",
"jest": "^29.7.0",
"pixelmatch": "^7.1.0",
"playwright": "^1.52.0",
"playwright": "1.53.2",
"pngjs": "^7.0.0",
"prettier": "^3.5.3",
"rimraf": "^5.0.10",
@@ -136,6 +139,6 @@
"typescript": "^5.8.3"
},
"resolutions": {
"sax@^1.4.1": "patch:sax@npm%3A1.4.1#./.yarn/patches/sax-npm-1.4.1-503b1923cb.patch"
"sax@^1.5.0": "patch:sax@npm%3A1.5.0#./.yarn/patches/sax-npm-1.5.0-d40bca2226.patch"
}
}

View File

@@ -106,7 +106,7 @@ export const elemsGroups = {
* Elements where adding or removing whitespace may affect rendering, metadata,
* or semantic meaning.
*
* @see https://developer.mozilla.org/docs/Web/HTML/Element/pre
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
* @type {Readonly<Set<string>>}
*/
export const textElems = new Set([...elemsGroups.textContent, 'pre', 'title']);
@@ -2395,7 +2395,7 @@ export const colorsProps = new Set([
/**
* @type {Readonly<Record<string, Set<string>>>}
* @see https://developer.mozilla.org/docs/Web/CSS/Pseudo-classes
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
*/
export const pseudoClasses = {
displayState: new Set(['fullscreen', 'modal', 'picture-in-picture']),

View File

@@ -44,8 +44,10 @@ export const fn = (_root, params) => {
element: {
enter: (node) => {
if (node.attributes.viewBox != null) {
const nums = node.attributes.viewBox.trim().split(/(?:\s,?|,)\s*/g);
node.attributes.viewBox = nums
const numbers = node.attributes.viewBox
.trim()
.split(/(?:\s,?|,)\s*/g);
node.attributes.viewBox = numbers
.map((value) => {
const num = Number(value);
return Number.isNaN(num)

View File

@@ -123,7 +123,7 @@ export const fn = (_root, params) => {
if (rgb2hex) {
const match = val.match(regRGB);
if (match != null) {
const nums = match.slice(1, 4).map((m) => {
const numbers = match.slice(1, 4).map((m) => {
let n;
if (m.indexOf('%') > -1) {
n = Math.round(parseFloat(m) * 2.55);
@@ -132,7 +132,7 @@ export const fn = (_root, params) => {
}
return Math.max(0, Math.min(n, 255));
});
val = convertRgbToHex(nums);
val = convertRgbToHex(numbers);
}
}

View File

@@ -15,8 +15,8 @@ export const description =
*
* @author Seth Falco <seth@falco.fun>
* @type {import('../lib/types.js').Plugin}
* @see https://developer.mozilla.org/docs/Web/SVG/Element/linearGradient
* @see https://developer.mozilla.org/docs/Web/SVG/Element/radialGradient
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
*/
export const fn = (root) => {
const stylesheet = collectStylesheet(root);

View File

@@ -230,8 +230,7 @@ const convertToRelative = (pathData) => {
cursor[1] += args[1];
start[0] = cursor[0];
start[1] = cursor[1];
}
if (command === 'M') {
} else if (command === 'M') {
// M → m
// skip first moveto
if (i !== 0) {
@@ -247,11 +246,10 @@ const convertToRelative = (pathData) => {
}
// lineto (x y)
if (command === 'l') {
else if (command === 'l') {
cursor[0] += args[0];
cursor[1] += args[1];
}
if (command === 'L') {
} else if (command === 'L') {
// L → l
command = 'l';
args[0] -= cursor[0];
@@ -261,10 +259,9 @@ const convertToRelative = (pathData) => {
}
// horizontal lineto (x)
if (command === 'h') {
else if (command === 'h') {
cursor[0] += args[0];
}
if (command === 'H') {
} else if (command === 'H') {
// H → h
command = 'h';
args[0] -= cursor[0];
@@ -272,10 +269,9 @@ const convertToRelative = (pathData) => {
}
// vertical lineto (y)
if (command === 'v') {
else if (command === 'v') {
cursor[1] += args[0];
}
if (command === 'V') {
} else if (command === 'V') {
// V → v
command = 'v';
args[0] -= cursor[1];
@@ -283,11 +279,10 @@ const convertToRelative = (pathData) => {
}
// curveto (x1 y1 x2 y2 x y)
if (command === 'c') {
else if (command === 'c') {
cursor[0] += args[4];
cursor[1] += args[5];
}
if (command === 'C') {
} else if (command === 'C') {
// C → c
command = 'c';
args[0] -= cursor[0];
@@ -301,11 +296,10 @@ const convertToRelative = (pathData) => {
}
// smooth curveto (x2 y2 x y)
if (command === 's') {
else if (command === 's') {
cursor[0] += args[2];
cursor[1] += args[3];
}
if (command === 'S') {
} else if (command === 'S') {
// S → s
command = 's';
args[0] -= cursor[0];
@@ -317,11 +311,10 @@ const convertToRelative = (pathData) => {
}
// quadratic Bézier curveto (x1 y1 x y)
if (command === 'q') {
else if (command === 'q') {
cursor[0] += args[2];
cursor[1] += args[3];
}
if (command === 'Q') {
} else if (command === 'Q') {
// Q → q
command = 'q';
args[0] -= cursor[0];
@@ -333,11 +326,10 @@ const convertToRelative = (pathData) => {
}
// smooth quadratic Bézier curveto (x y)
if (command === 't') {
else if (command === 't') {
cursor[0] += args[0];
cursor[1] += args[1];
}
if (command === 'T') {
} else if (command === 'T') {
// T → t
command = 't';
args[0] -= cursor[0];
@@ -347,11 +339,10 @@ const convertToRelative = (pathData) => {
}
// elliptical arc (rx ry x-axis-rotation large-arc-flag sweep-flag x y)
if (command === 'a') {
else if (command === 'a') {
cursor[0] += args[5];
cursor[1] += args[6];
}
if (command === 'A') {
} else if (command === 'A') {
// A → a
command = 'a';
args[5] -= cursor[0];
@@ -361,7 +352,7 @@ const convertToRelative = (pathData) => {
}
// closepath
if (command === 'Z' || command === 'z') {
else if (command === 'Z' || command === 'z') {
// reset cursor
cursor[0] = start[0];
cursor[1] = start[1];

View File

@@ -29,7 +29,7 @@ export const description = 'inline styles (additional options)';
* Pseudo-classes that we can evaluate during optimization, and shouldn't be
* toggled conditionally through the `usePseudos` parameter.
*
* @see https://developer.mozilla.org/docs/Web/CSS/Pseudo-classes
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
*/
const preservedPseudos = [
...pseudoClasses.functional,

View File

@@ -67,7 +67,7 @@ export const description =
* ↓
* <rect x="0" y="0" width="100" height="100"/>
*
* @link https://developer.mozilla.org/docs/Web/CSS/CSS_Selectors|MDN CSS Selectors
* @link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|MDN CSS Selectors
*
* @author Bradley Mease
*

View File

@@ -17,7 +17,7 @@ const standardDescs = /^(Created with|Created using)/;
* description.
*
* @author Daniel Wabyick
* @see https://developer.mozilla.org/docs/Web/SVG/Element/desc
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc
*
* @type {import('../lib/types.js').Plugin<RemoveDescParams>}
*/

View File

@@ -7,8 +7,7 @@ import { detachNodeFromParent } from '../lib/xast.js';
*/
export const name = 'removeElementsByAttr';
export const description =
'removes arbitrary elements by ID or className (disabled by default)';
export const description = 'removes arbitrary elements by ID or className';
/**
* Remove arbitrary SVG elements by ID or className.

View File

@@ -1,6 +1,7 @@
import { elemsGroups } from './_collections.js';
import { detachNodeFromParent } from '../lib/xast.js';
import { collectStylesheet, computeStyle } from '../lib/style.js';
import { findReferences } from '../lib/svgo/tools.js';
export const name = 'removeEmptyContainers';
export const description = 'removes empty container elements';
@@ -22,9 +23,33 @@ export const description = 'removes empty container elements';
*/
export const fn = (root) => {
const stylesheet = collectStylesheet(root);
const removedIds = new Set();
/**
* @type {Map<string, {
* node: import('../lib/types.js').XastElement,
* parent: import('../lib/types.js').XastParent,
* }[]>}
*/
const usesById = new Map();
return {
element: {
enter: (node, parentNode) => {
if (node.name === 'use') {
// Record uses so those referencing empty containers can be removed.
for (const [name, value] of Object.entries(node.attributes)) {
const ids = findReferences(name, value);
for (const id of ids) {
let references = usesById.get(id);
if (references === undefined) {
references = [];
usesById.set(id, references);
}
references.push({ node: node, parent: parentNode });
}
}
}
},
exit: (node, parentNode) => {
// remove only empty non-svg containers
if (
@@ -61,6 +86,22 @@ export const fn = (root) => {
}
detachNodeFromParent(node, parentNode);
if (node.attributes.id) {
removedIds.add(node.attributes.id);
}
},
},
root: {
exit: () => {
// Remove any <use> elements that referenced an empty container.
for (const id of removedIds) {
const uses = usesById.get(id);
if (uses) {
for (const use of uses) {
detachNodeFromParent(use.node, use.parent);
}
}
}
},
},
};

View File

@@ -190,38 +190,6 @@ export const fn = (root, params) => {
}
}
// Removes hidden elements
// https://www.w3schools.com/cssref/pr_class_visibility.asp
const computedStyle = computeStyle(stylesheet, node);
if (
isHidden &&
computedStyle.visibility &&
computedStyle.visibility.type === 'static' &&
computedStyle.visibility.value === 'hidden' &&
// keep if any descendant enables visibility
querySelector(node, '[visibility=visible]') == null
) {
removeElement(node, parentNode);
return;
}
// display="none"
//
// https://www.w3.org/TR/SVG11/painting.html#DisplayProperty
// "A value of display: none indicates that the given element
// and its children shall not be rendered directly"
if (
displayNone &&
computedStyle.display &&
computedStyle.display.type === 'static' &&
computedStyle.display.value === 'none' &&
// markers with display: none still rendered
node.name !== 'marker'
) {
removeElement(node, parentNode);
return;
}
// Circles with zero radius
//
// https://www.w3.org/TR/SVG11/shapes.html#CircleElementRAttribute
@@ -363,32 +331,6 @@ export const fn = (root, params) => {
return;
}
// Path with empty data
//
// https://www.w3.org/TR/SVG11/paths.html#DAttribute
//
// <path d=""/>
if (pathEmptyD && node.name === 'path') {
if (node.attributes.d == null) {
removeElement(node, parentNode);
return;
}
const pathData = parsePathData(node.attributes.d);
if (pathData.length === 0) {
removeElement(node, parentNode);
return;
}
// keep single point paths for markers
if (
pathData.length === 1 &&
computedStyle['marker-start'] == null &&
computedStyle['marker-end'] == null
) {
removeElement(node, parentNode);
return;
}
}
// Polyline with empty points
//
// https://www.w3.org/TR/SVG11/shapes.html#PolylineElementPointsAttribute
@@ -417,6 +359,64 @@ export const fn = (root, params) => {
return;
}
// Removes hidden elements
// https://www.w3schools.com/cssref/pr_class_visibility.asp
const computedStyle = computeStyle(stylesheet, node);
if (
isHidden &&
computedStyle.visibility &&
computedStyle.visibility.type === 'static' &&
computedStyle.visibility.value === 'hidden' &&
// keep if any descendant enables visibility
querySelector(node, '[visibility=visible]') == null
) {
removeElement(node, parentNode);
return;
}
// display="none"
//
// https://www.w3.org/TR/SVG11/painting.html#DisplayProperty
// "A value of display: none indicates that the given element
// and its children shall not be rendered directly"
if (
displayNone &&
computedStyle.display &&
computedStyle.display.type === 'static' &&
computedStyle.display.value === 'none' &&
// markers with display: none still rendered
node.name !== 'marker'
) {
removeElement(node, parentNode);
return;
}
// Path with empty data
//
// https://www.w3.org/TR/SVG11/paths.html#DAttribute
//
// <path d=""/>
if (pathEmptyD && node.name === 'path') {
if (node.attributes.d == null) {
removeElement(node, parentNode);
return;
}
const pathData = parsePathData(node.attributes.d);
if (pathData.length === 0) {
removeElement(node, parentNode);
return;
}
// keep single point paths for markers
if (
pathData.length === 1 &&
computedStyle['marker-start'] == null &&
computedStyle['marker-end'] == null
) {
removeElement(node, parentNode);
return;
}
}
for (const [name, value] of Object.entries(node.attributes)) {
const ids = findReferences(name, value);

View File

@@ -5,7 +5,7 @@ import { intersects } from './_path.js';
export const name = 'removeOffCanvasPaths';
export const description =
'removes elements that are drawn outside of the viewBox (disabled by default)';
'removes elements that are drawn outside of the viewBox';
/**
* Remove elements that are drawn outside of the viewBox.

View File

@@ -1,7 +1,7 @@
import { detachNodeFromParent } from '../lib/xast.js';
export const name = 'removeRasterImages';
export const description = 'removes raster images (disabled by default)';
export const description = 'removes raster images';
/**
* Remove raster images references in <image>.

View File

@@ -2,7 +2,7 @@ import { attrsGroups } from './_collections.js';
import { detachNodeFromParent } from '../lib/xast.js';
export const name = 'removeScripts';
export const description = 'removes scripts (disabled by default)';
export const description = 'removes scripts';
/** Union of all event attributes. */
const eventAttrs = [

View File

@@ -1,7 +1,7 @@
import { detachNodeFromParent } from '../lib/xast.js';
export const name = 'removeStyleElement';
export const description = 'removes <style> element (disabled by default)';
export const description = 'removes <style> element';
/**
* Remove <style>.

View File

@@ -6,7 +6,7 @@ export const description = 'removes <title>';
/**
* Remove <title>.
*
* https://developer.mozilla.org/docs/Web/SVG/Element/title
* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
*
* @author Igor Kalashnikov
*

View File

@@ -7,7 +7,11 @@ import {
} from './_collections.js';
import { detachNodeFromParent } from '../lib/xast.js';
import { visitSkip } from '../lib/util/visit.js';
import { collectStylesheet, computeStyle } from '../lib/style.js';
import {
collectStylesheet,
computeStyle,
includesAttrSelector,
} from '../lib/style.js';
/**
* @typedef RemoveUnknownsAndDefaultsParams
@@ -192,7 +196,12 @@ export const fn = (root, params) => {
attributesDefaults.get(name) === value
) {
// keep defaults if parent has own or inherited style
if (computedParentStyle?.[name] == null) {
if (
computedParentStyle?.[name] == null &&
!stylesheet.rules.some((rule) =>
includesAttrSelector(rule.selector, name),
)
) {
delete node.attributes[name];
}
}

View File

@@ -31,12 +31,12 @@ export const fn = () => {
if (node.name === 'svg' && parentNode.type !== 'root') {
return;
}
const nums = node.attributes.viewBox.split(/[ ,]+/g);
const numbers = node.attributes.viewBox.split(/[ ,]+/g);
if (
nums[0] === '0' &&
nums[1] === '0' &&
node.attributes.width.replace(/px$/, '') === nums[2] && // could use parseFloat too
node.attributes.height.replace(/px$/, '') === nums[3]
numbers[0] === '0' &&
numbers[1] === '0' &&
node.attributes.width.replace(/px$/, '') === numbers[2] && // could use parseFloat too
node.attributes.height.replace(/px$/, '') === numbers[3]
) {
delete node.attributes.viewBox;
}

View File

@@ -1,6 +1,5 @@
export const name = 'removeXMLNS';
export const description =
'removes xmlns attribute (for inline svg, disabled by default)';
export const description = 'removes xmlns attribute (for inline svg)';
/**
* Remove the xmlns attribute when present.

View File

@@ -18,7 +18,7 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
* Map of `xlink:show` values to the SVG 2 `target` attribute values.
*
* @type {Record<string, string>}
* @see https://developer.mozilla.org/docs/Web/SVG/Attribute/xlink:show#usage_notes
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:show#usage_notes
*/
const SHOW_TO_TARGET = {
new: '_blank',
@@ -30,8 +30,8 @@ const SHOW_TO_TARGET = {
* don't support the SVG 2 href attribute.
*
* @type {Set<string>}
* @see https://developer.mozilla.org/docs/Web/SVG/Attribute/xlink:href
* @see https://developer.mozilla.org/docs/Web/SVG/Attribute/href
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/href
*/
const LEGACY_ELEMENTS = new Set([
'cursor',
@@ -60,7 +60,7 @@ const findPrefixedAttrs = (node, prefixes, attr) => {
* XLink namespace is deprecated in SVG 2.
*
* @type {import('../lib/types.js').Plugin<RemoveXlinkParams>}
* @see https://developer.mozilla.org/docs/Web/SVG/Attribute/xlink:href
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
*/
export const fn = (_, params) => {
const { includeLegacy } = params;

View File

@@ -26,7 +26,7 @@ export const fn = (root) => {
* element if one exists.
*
* @type {import('../lib/types.js').XastElement}
* @see https://developer.mozilla.org/docs/Web/SVG/Element/defs
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs
*/
let svgDefs;

View File

@@ -1,5 +1,5 @@
export function invokePlugins(ast: import("../types.js").XastNode, info: any, plugins: ReadonlyArray<any>, overrides: any, globalOverrides: any): void;
export function createPreset<T extends string>({ name, plugins }: {
export function createPreset<T extends `preset-${string}`>({ name, plugins }: {
name: T;
plugins: ReadonlyArray<import("../types.js").BuiltinPlugin<string, any>>;
}): import("../types.js").BuiltinPluginOrPreset<T, any>;

View File

@@ -122,15 +122,17 @@ export type BuiltinPlugin<Name extends string, Params> = {
description?: string;
fn: Plugin<Params>;
};
export type BuiltinPluginOrPreset<Name extends string, Params> = BuiltinPlugin<Name, Params> & {
type PresetProperties<IsPreset extends boolean> = {
name: IsPreset extends true ? `preset-${string}` : string;
/** If the plugin is itself a preset that invokes other plugins. */
isPreset?: true;
isPreset: IsPreset extends true ? true : undefined;
/**
* If the plugin is a preset that invokes other plugins, this returns an
* array of the plugins in the preset in the order that they are invoked.
* If {@link #isPreset} is true, an array of the plugins in the preset
* in the order that they are invoked.
*/
plugins?: ReadonlyArray<BuiltinPlugin<string, Object>>;
plugins: IsPreset extends true ? ReadonlyArray<BuiltinPlugin<string, Object>> : undefined;
};
export type BuiltinPluginOrPreset<Name extends string, Params> = BuiltinPlugin<Name, Params> & (PresetProperties<true> | Partial<PresetProperties<false>>);
export type XastDoctype = {
type: 'doctype';
name: string;
@@ -273,3 +275,4 @@ export type Config = {
export type Output = {
data: string;
};
export {};

View File

@@ -9,7 +9,7 @@ export const elemsGroups: Readonly<Record<string, Set<string>>>;
* Elements where adding or removing whitespace may affect rendering, metadata,
* or semantic meaning.
*
* @see https://developer.mozilla.org/docs/Web/HTML/Element/pre
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
* @type {Readonly<Set<string>>}
*/
export const textElems: Readonly<Set<string>>;
@@ -94,6 +94,6 @@ export const colorsShortNames: Readonly<Record<string, string>>;
export const colorsProps: Readonly<Set<string>>;
/**
* @type {Readonly<Record<string, Set<string>>>}
* @see https://developer.mozilla.org/docs/Web/CSS/Pseudo-classes
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
*/
export const pseudoClasses: Readonly<Record<string, Set<string>>>;

View File

@@ -5,7 +5,7 @@ export const description: "converts one-stop (single color) gradients to a plain
*
* @author Seth Falco <seth@falco.fun>
* @type {import('../lib/types.js').Plugin}
* @see https://developer.mozilla.org/docs/Web/SVG/Element/linearGradient
* @see https://developer.mozilla.org/docs/Web/SVG/Element/radialGradient
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
*/
export const fn: import("../lib/types.js").Plugin;

View File

@@ -63,7 +63,7 @@ export const description: "removes attributes of elements that match a css selec
* ↓
* <rect x="0" y="0" width="100" height="100"/>
*
* @link https://developer.mozilla.org/docs/Web/CSS/CSS_Selectors|MDN CSS Selectors
* @link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|MDN CSS Selectors
*
* @author Bradley Mease
*

View File

@@ -11,7 +11,7 @@ export const description: "removes <desc>";
* description.
*
* @author Daniel Wabyick
* @see https://developer.mozilla.org/docs/Web/SVG/Element/desc
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc
*
* @type {import('../lib/types.js').Plugin<RemoveDescParams>}
*/

View File

@@ -4,7 +4,7 @@
* @property {string | string[]=} class
*/
export const name: "removeElementsByAttr";
export const description: "removes arbitrary elements by ID or className (disabled by default)";
export const description: "removes arbitrary elements by ID or className";
/**
* Remove arbitrary SVG elements by ID or className.
*

View File

@@ -1,5 +1,5 @@
export const name: "removeOffCanvasPaths";
export const description: "removes elements that are drawn outside of the viewBox (disabled by default)";
export const description: "removes elements that are drawn outside of the viewBox";
/**
* Remove elements that are drawn outside of the viewBox.
*

View File

@@ -1,5 +1,5 @@
export const name: "removeRasterImages";
export const description: "removes raster images (disabled by default)";
export const description: "removes raster images";
/**
* Remove raster images references in <image>.
*

View File

@@ -1,5 +1,5 @@
export const name: "removeScripts";
export const description: "removes scripts (disabled by default)";
export const description: "removes scripts";
/**
* Remove scripts.
*

View File

@@ -1,5 +1,5 @@
export const name: "removeStyleElement";
export const description: "removes <style> element (disabled by default)";
export const description: "removes <style> element";
/**
* Remove <style>.
*

View File

@@ -3,7 +3,7 @@ export const description: "removes <title>";
/**
* Remove <title>.
*
* https://developer.mozilla.org/docs/Web/SVG/Element/title
* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
*
* @author Igor Kalashnikov
*

View File

@@ -1,5 +1,5 @@
export const name: "removeXMLNS";
export const description: "removes xmlns attribute (for inline svg, disabled by default)";
export const description: "removes xmlns attribute (for inline svg)";
/**
* Remove the xmlns attribute when present.
*

View File

@@ -13,7 +13,7 @@ export const description: "remove xlink namespace and replaces attributes with t
* XLink namespace is deprecated in SVG 2.
*
* @type {import('../lib/types.js').Plugin<RemoveXlinkParams>}
* @see https://developer.mozilla.org/docs/Web/SVG/Attribute/xlink:href
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
*/
export const fn: import("../lib/types.js").Plugin<RemoveXlinkParams>;
export type RemoveXlinkParams = {