UNPKG

wind-barbs

Version:

A small utility to generate wind barb SVGs

1 lines 2.58 kB
var t={729:(t,r,e)=>{e.d(r,{A:()=>c});const o={color:"#000000",rotationPoint:"stem"},n=Number(18)/2,i=Number(25)/2,s="2",l=2.9,a=6.85,c=(t,r=0,e)=>{const c=5*Math.round(t/5),{color:p=o.color,rotationPoint:h=o.rotationPoint}=e||{},d={attr:{viewBox:"0 0 18 25",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${r}deg)`,transformOrigin:"stem"===h?"bottom center":"center center",height:"100%"}},children:[]};if(c<3)return d.children=[{type:"circle",attr:{cx:n.toString(),cy:i.toString(),r:5..toString(),stroke:p,strokeWidth:s,fill:"none"}}],d;let y=l,g=c;if(c>=50||c<8?d.children.push({type:"polyline",attr:{points:`${n},25 ${n},2.9`,fill:"none",stroke:p,strokeWidth:s}}):(d.children.push({type:"polyline",attr:{points:`${n},25 ${n},3.9 17.7,0.95`,fill:"none",stroke:p,strokeWidth:s}}),g-=10,y=a),c>=3&&c<8)return y=a,d.children.push({type:"line",attr:{x1:n.toString(),y1:y.toString(),x2:13.35.toString(),y2:(y-1.45).toString(),stroke:p,strokeWidth:s}}),d;for(;g>=50;)d.children.push({type:"path",attr:{d:`M${n},${y} \n L15,${y+2} \n L${n},${y+4} \n Z`,fill:p,stroke:p,strokeWidth:s}}),g-=50,y+=g>=50?5.5:7;for(;g>=10&&y!==l;)d.children.push({type:"line",attr:{x1:n.toString(),y1:y.toString(),x2:17.7.toString(),y2:(y-l).toString(),stroke:p,strokeWidth:s}}),g-=10,y=y==l?a:y+3;for(;g>=5;)d.children.push({type:"line",attr:{x1:n.toString(),y1:y.toString(),x2:13.35.toString(),y2:(y-1.45).toString(),stroke:p,strokeWidth:s}}),g-=5,y+=3;return d}}},r={};function e(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return t[o](i,i.exports,e),i.exports}e.d=(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},e.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r);var o={};e.d(o,{A:()=>s});var n=e(729);const i={x1:"x1",x2:"x2",y1:"y1",y2:"y2",stroke:"stroke",strokeWidth:"stroke-width",fill:"fill",d:"d",cx:"cx",cy:"cy",r:"r",points:"points",style:"style",viewBox:"viewBox",xmlns:"xmlns",transform:"transform",transformOrigin:"transform-origin",height:"height"},s=(t,r=0,e)=>{const o=(0,n.A)(t,r,e),s=o.children.map((t=>((t,r)=>{const e=document.createElementNS(r,t.type),o=t.attr;return Object.entries(o).map((([t,r])=>{e.setAttribute(i[t],r.toString())})),e})(t,o.attr.xmlns))),l=document.createElementNS(o.attr.xmlns,"svg"),a=o.attr;return Object.entries(a).map((([t,r])=>{if("style"===t){let e="";Object.entries(r).map((([t,r])=>{e+=`${t}: ${r}; `})),l.setAttribute(t,e)}else l.setAttribute(i[t],r.toString())})),s.forEach((t=>l.appendChild(t))),l};var l=o.A;export{l as default};