From 2d93758d50ea5d4dc4e7254593293d3c99caa76f Mon Sep 17 00:00:00 2001 From: Amphiluke Date: Mon, 6 Jan 2020 19:35:13 +0700 Subject: [PATCH] Rebuild with correct homepage --- dist/lindsvg.esm.js | 2 +- dist/lindsvg.esm.min.js | 2 +- dist/lindsvg.js | 2 +- dist/lindsvg.min.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/lindsvg.esm.js b/dist/lindsvg.esm.js index 0509871..08ac793 100644 --- a/dist/lindsvg.esm.js +++ b/dist/lindsvg.esm.js @@ -1,6 +1,6 @@ /*! lindsvg v1.0.0 -https://github.com/Amphiluke/lindsvg#readme +https://amphiluke.github.io/l-systems/ (c) 2020 Amphiluke */ let messages = { diff --git a/dist/lindsvg.esm.min.js b/dist/lindsvg.esm.min.js index 1087130..6924e67 100644 --- a/dist/lindsvg.esm.min.js +++ b/dist/lindsvg.esm.min.js @@ -1,6 +1,6 @@ /*! lindsvg v1.0.0 -https://github.com/Amphiluke/lindsvg#readme +https://amphiluke.github.io/l-systems/ (c) 2020 Amphiluke */ let t={AXIOM:"Axiom may only contain the following characters: A..Z,+,-,[,]",RULE:"Production rules may only contain the following characters: A..Z,+,-,[,]",LETTER:"Allowed alphabet letters are: A..Z",ALPHA:"The “alpha” parameter must be a finite number",THETA:"The “theta” parameter must be a finite number",STEP:"The “step” parameter must be a positive finite number",COUNT:"The number of iterations must be integer and finite",NUMBER:"A valid finite number expected"},e=/^[A-Z]$/;let a=/^[A-Z+\-[\]]*$/;function i(e,i=t.RULE){return a.test(e)||i}function n(a,n,r){let s=new Map;return Object.entries(a).forEach(([a,h])=>{let c=function(a,i=t.LETTER){return e.test(a)||i}(a,n);!0===c&&(c=i(h,r)),!0!==c&&s.set(a,c)}),!s.size||s}function r(e){let a=new Map;return Object.entries(e).forEach(([e,r])=>{let s=!0;switch(e){case"axiom":s=i(r,t.AXIOM);break;case"rules":s=n(r);break;case"alpha":case"theta":s=function(e,a=t.NUMBER){return Number.isFinite(e)||a}(r,t[e.toUpperCase()]);break;case"step":s=function(e,a=t.STEP){return Number.isFinite(e)&&e>0||a}(r);break;case"iterations":s=function(e,a=t.COUNT){return Number.isInteger(e)&&e>0||a}(r)}!0!==s&&a.set(e,s)}),!a.size||a}let s={F:"",B:"","+":"+","-":"-","[":"[","]":"]"},h={alpha:0,theta:0,step:10,iterations:3};function c(t){let e=r(t);if(!0!==e)throw new Error(function t(e){return[...e].reduce((e,[a,i])=>i instanceof Map?`${e}\n${a}:${t(i).replace(/\n/g,"\n ")}`:`${e}\n${a}: ${i}`,"")}(e));let{axiom:a,iterations:i}={...h,...t},n={...s,...t.rules};for(;i>0;i--)a=[...a].reduce((t,e)=>t+(n[e]||""),"");return a}let o={translate(){this.x+=this.step*Math.cos(this.alpha),this.y+=this.step*Math.sin(this.alpha),this.minX=Math.min(this.minX,this.x),this.maxX=Math.max(this.maxX,this.x),this.minY=Math.min(this.minY,this.y),this.maxY=Math.max(this.maxY,this.y)},rotate(t){this.alpha+=t*this.theta},pushStack(){this.stack.push({x:this.x,y:this.y,alpha:this.alpha})},popStack(){({x:this.x,y:this.y,alpha:this.alpha}=this.stack.pop())},getDrawingRect(){let t=Math.floor(this.minX),e=Math.floor(this.minY),a=Math.ceil(this.maxX),i=Math.ceil(this.maxY);return{minX:t,minY:e,maxX:a,maxY:i,width:a-t,height:i-e}}};function l(t,e){return`${+t.toFixed(4)} ${+e.toFixed(4)}`}function u(t){let e=c(t),a=function({x:t,y:e,step:a,alpha:i,theta:n}){let r=Object.create(o);return r.stack=[],r.x=r.minX=r.maxX=t,r.y=r.minY=r.maxY=e,r.step=a,r.alpha=-i,r.theta=n,r}({x:0,y:0,...t});return{pathData:function(t,e){let a;return[...t].reduce((t,i)=>{switch(i){case"F":e.translate(),t+=("L"===a?" ":"L")+l(e.x,e.y),a="L";break;case"B":e.translate(),"M"===a&&(t=t.slice(0,t.lastIndexOf("M"))),t+="M"+l(e.x,e.y),a="M";break;case"+":e.rotate(1);break;case"-":e.rotate(-1);break;case"[":e.pushStack();break;case"]":e.popStack(),t+=`M${l(e.x,e.y)}`,a="M"}return t},"M"+l(e.x,e.y))}(function(t){return t.replace(/[^FB[\]+-]/g,"")}(e),a),...a.getDrawingRect()}}function p(t,e){let{pathData:a,minX:i,minY:n,width:r,height:s}=u(t);e={width:r,height:s,padding:0,fill:"none",stroke:"#000",...e};let{padding:h}=e;return`\n \n`}export{p as getSVGCode,u as getSVGData}; diff --git a/dist/lindsvg.js b/dist/lindsvg.js index 0657f96..2c1f7a7 100644 --- a/dist/lindsvg.js +++ b/dist/lindsvg.js @@ -1,6 +1,6 @@ /*! lindsvg v1.0.0 -https://github.com/Amphiluke/lindsvg#readme +https://amphiluke.github.io/l-systems/ (c) 2020 Amphiluke */ (function (global, factory) { diff --git a/dist/lindsvg.min.js b/dist/lindsvg.min.js index 66060e3..7283be8 100644 --- a/dist/lindsvg.min.js +++ b/dist/lindsvg.min.js @@ -1,6 +1,6 @@ /*! lindsvg v1.0.0 -https://github.com/Amphiluke/lindsvg#readme +https://amphiluke.github.io/l-systems/ (c) 2020 Amphiluke */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).lindsvg={})}(this,(function(t){"use strict";let e={AXIOM:"Axiom may only contain the following characters: A..Z,+,-,[,]",RULE:"Production rules may only contain the following characters: A..Z,+,-,[,]",LETTER:"Allowed alphabet letters are: A..Z",ALPHA:"The “alpha” parameter must be a finite number",THETA:"The “theta” parameter must be a finite number",STEP:"The “step” parameter must be a positive finite number",COUNT:"The number of iterations must be integer and finite",NUMBER:"A valid finite number expected"},a=/^[A-Z]$/;let i=/^[A-Z+\-[\]]*$/;function n(t,a=e.RULE){return i.test(t)||a}function s(t,i,s){let r=new Map;return Object.entries(t).forEach(([t,h])=>{let o=function(t,i=e.LETTER){return a.test(t)||i}(t,i);!0===o&&(o=n(h,s)),!0!==o&&r.set(t,o)}),!r.size||r}function r(t){let a=new Map;return Object.entries(t).forEach(([t,i])=>{let r=!0;switch(t){case"axiom":r=n(i,e.AXIOM);break;case"rules":r=s(i);break;case"alpha":case"theta":r=function(t,a=e.NUMBER){return Number.isFinite(t)||a}(i,e[t.toUpperCase()]);break;case"step":r=function(t,a=e.STEP){return Number.isFinite(t)&&t>0||a}(i);break;case"iterations":r=function(t,a=e.COUNT){return Number.isInteger(t)&&t>0||a}(i)}!0!==r&&a.set(t,r)}),!a.size||a}let h={F:"",B:"","+":"+","-":"-","[":"[","]":"]"},o={alpha:0,theta:0,step:10,iterations:3};function c(t){let e=r(t);if(!0!==e)throw new Error(function t(e){return[...e].reduce((e,[a,i])=>i instanceof Map?`${e}\n${a}:${t(i).replace(/\n/g,"\n ")}`:`${e}\n${a}: ${i}`,"")}(e));let{axiom:a,iterations:i}={...o,...t},n={...h,...t.rules};for(;i>0;i--)a=[...a].reduce((t,e)=>t+(n[e]||""),"");return a}let l={translate(){this.x+=this.step*Math.cos(this.alpha),this.y+=this.step*Math.sin(this.alpha),this.minX=Math.min(this.minX,this.x),this.maxX=Math.max(this.maxX,this.x),this.minY=Math.min(this.minY,this.y),this.maxY=Math.max(this.maxY,this.y)},rotate(t){this.alpha+=t*this.theta},pushStack(){this.stack.push({x:this.x,y:this.y,alpha:this.alpha})},popStack(){({x:this.x,y:this.y,alpha:this.alpha}=this.stack.pop())},getDrawingRect(){let t=Math.floor(this.minX),e=Math.floor(this.minY),a=Math.ceil(this.maxX),i=Math.ceil(this.maxY);return{minX:t,minY:e,maxX:a,maxY:i,width:a-t,height:i-e}}};function u(t,e){return`${+t.toFixed(4)} ${+e.toFixed(4)}`}function p(t){let e=c(t),a=function({x:t,y:e,step:a,alpha:i,theta:n}){let s=Object.create(l);return s.stack=[],s.x=s.minX=s.maxX=t,s.y=s.minY=s.maxY=e,s.step=a,s.alpha=-i,s.theta=n,s}({x:0,y:0,...t});return{pathData:function(t,e){let a;return[...t].reduce((t,i)=>{switch(i){case"F":e.translate(),t+=("L"===a?" ":"L")+u(e.x,e.y),a="L";break;case"B":e.translate(),"M"===a&&(t=t.slice(0,t.lastIndexOf("M"))),t+="M"+u(e.x,e.y),a="M";break;case"+":e.rotate(1);break;case"-":e.rotate(-1);break;case"[":e.pushStack();break;case"]":e.popStack(),t+=`M${u(e.x,e.y)}`,a="M"}return t},"M"+u(e.x,e.y))}(function(t){return t.replace(/[^FB[\]+-]/g,"")}(e),a),...a.getDrawingRect()}}t.getSVGCode=function(t,e){let{pathData:a,minX:i,minY:n,width:s,height:r}=p(t);e={width:s,height:r,padding:0,fill:"none",stroke:"#000",...e};let{padding:h}=e;return`\n \n`},t.getSVGData=p,Object.defineProperty(t,"__esModule",{value:!0})}));