wind-barbs
Version:
A small utility to generate wind barb SVGs
1 lines • 2.83 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.WindBarb=e(require("react")):t.WindBarb=e(t.react)}(self,(t=>(()=>{"use strict";var e={155:e=>{e.exports=t},729:(t,e,r)=>{r.d(e,{default:()=>c});const o={color:"#000000",rotationPoint:"stem"},n=Number(18)/2,i=Number(25)/2,a="2",s=2.9,l=6.85,c=(t,e=0,r)=>{const c=5*Math.round(t/5),{color:p=o.color,rotationPoint:d=o.rotationPoint}=r||{},u={attr:{viewBox:"0 0 18 25",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e}deg)`,transformOrigin:"stem"===d?"bottom center":"center center",height:"100%"}},children:[]};if(c<3)return u.children=[{type:"circle",attr:{cx:n.toString(),cy:i.toString(),r:5..toString(),stroke:p,strokeWidth:a,fill:"none"}}],u;let f=s,y=c;if(c>=50||c<8?u.children.push({type:"polyline",attr:{points:`${n},25 ${n},2.9`,fill:"none",stroke:p,strokeWidth:a}}):(u.children.push({type:"polyline",attr:{points:`${n},25 ${n},3.9 17.7,0.95`,fill:"none",stroke:p,strokeWidth:a}}),y-=10,f=l),c>=3&&c<8)return f=l,u.children.push({type:"line",attr:{x1:n.toString(),y1:f.toString(),x2:13.35.toString(),y2:(f-1.45).toString(),stroke:p,strokeWidth:a}}),u;for(;y>=50;)u.children.push({type:"path",attr:{d:`M${n},${f} \n L15,${f+2} \n L${n},${f+4} \n Z`,fill:p,stroke:p,strokeWidth:a}}),y-=50,f+=y>=50?5.5:7;for(;y>=10&&f!==s;)u.children.push({type:"line",attr:{x1:n.toString(),y1:f.toString(),x2:17.7.toString(),y2:(f-s).toString(),stroke:p,strokeWidth:a}}),y-=10,f=f==s?l:f+3;for(;y>=5;)u.children.push({type:"line",attr:{x1:n.toString(),y1:f.toString(),x2:13.35.toString(),y2:(f-1.45).toString(),stroke:p,strokeWidth:a}}),y-=5,f+=3;return u}}},r={};function o(t){var n=r[t];if(void 0!==n)return n.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{default:()=>c});var i=o(155),a=o.n(i),s=o(729);const l=t=>{switch(t.type){case"line":return a().createElement("line",Object.assign({},t.attr));case"circle":return a().createElement("circle",Object.assign({},t.attr));case"polyline":return a().createElement("polyline",Object.assign({},t.attr));case"path":return a().createElement("path",Object.assign({},t.attr))}},c=(t,e=0,r)=>{const o=(0,s.default)(t,e,r),n=o.children.map(l);return a().createElement("svg",Object.assign({},o.attr),n)};return n})()));