diff --git a/build/cardmaker.js b/build/cardmaker.js index d23156e..8cfa141 100644 --- a/build/cardmaker.js +++ b/build/cardmaker.js @@ -1,4 +1,4 @@ /* Web Font Loader v1.6.28 - (c) Adobe Systems, Google. License: Apache 2.0 */ -define("draw/Group",["react","react-class"],function(e,t){var r=t({render:function(){var t=this.props.children,r=this.props.canvas,n=this.props.repaint||this.repaint;return t=e.Children.map(t,function(t){return e.cloneElement(t,{canvas:r,repaint:n})}),e.createElement("div",{style:{position:"relative"}},t)},componentWillUpdate:function(){if("function"!==this.props.repaint){this.r=!0;var e=this.props.canvas;if(null!==e){var t=e.getContext("2d");t.fillStyle="#fff",t.fillRect(0,0,e.width,e.height)}}},repaint:function(){"function"!=typeof this.props.repaint?this.forceUpdate():this.props.repaint()}});return r.displayName="Group",r.defaultProps={},r}),define("draw/Canvas",["react","react-class","./Group"],function(e,t,r){return t({getInitialState:function(){return{canvas:null}},render:function(){return e.createElement("canvas",{onClick:this.save.bind(this),className:this.props.className,width:this.props.width,height:this.props.height,ref:function(e){this.canvas=e}.bind(this)},e.createElement(r,{canvas:this.state.canvas},this.props.children))},save:function(){var e="";null!==this.state.canvas&&(e=this.state.canvas.toDataURL());var t=document.createElement("a");if(t.setAttribute("href",e),t.setAttribute("download","Image.png"),document.createEvent){var r=document.createEvent("MouseEvent");r.initEvent("click",!0,!0),t.dispatchEvent(r)}else t.click()},componentDidMount:function(){var e=this.canvas;delete this.canvas,this.setState({canvas:e})}})}),define("draw/Text",["react","react-class"],function(e,t){var r=t({render:function(){return e.createElement("div",{style:this.props.style},this.props.text)},componentDidMount:function(){this.draw()},componentDidUpdate:function(){this.draw()},draw:function(){var e=this.props.canvas;if(null!==e){var t=e.getContext("2d"),r=JSON.parse(JSON.stringify(this.props.style));t.save(),t.fillStyle=r.color||"black";var n;do{this.setFont(t,r),n=this.createParagraphs(t,this.props.text,r.width);var a=r.fontSize*n.reduce(function(e,t){return e+t.length},0);if(void 0===r.height||a0);this.drawText(t,n,r.fontSize),t.restore()}},createParagraphs:function(e,t,r){return t.split("\n").map(function(t){switch(this.props.style.whitespace){case"nowrap":return[t];default:return this.wrapParagraph(e,t,r)}},this)},wrapParagraph:function(e,t,r){for(var n=t.split(" ").filter(function(e){return e.length>0}),a=[],i=e.measureText(" ").width,o={width:-i,words:[]},l=0;l0&&(a[a.length]=o.words.join(" ")),o={width:p,words:[s]})}return a[a.length]=o.words.join(" "),a},drawText:function(e,t,r){e.save(),e.translate(this.props.style.left,this.props.style.top);for(var n=0;n0,c=p?o.maxWidth-(o.width+s):0,u=p?-1:1,h=0;hparseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))}return ne}function _(e,t,r){for(var n in re)if(re.hasOwnProperty(n)&&t===e.f[re[n]]&&r===e.f[re[n]])return!0;return!1}function B(e){var t,r=e.g.a.offsetWidth,n=e.h.a.offsetWidth;(t=r===e.f.serif&&n===e.f["sans-serif"])||(t=R()&&_(e,r,n)),t?ee()-e.A>=e.w?R()&&_(e,r,n)&&(null===e.u||e.u.hasOwnProperty(e.a.c))?M(e,e.v):M(e,e.B):D(e):M(e,e.v)}function D(e){setTimeout(r(function(){B(this)},e),50)}function M(e,t){setTimeout(r(function(){o(this.g.a),o(this.h.a),o(this.j.a),o(this.m.a),t(this.a)},e),0)}function W(e,t,r){this.c=e,this.a=t,this.f=0,this.m=this.j=!1,this.s=r}function z(e){0==--e.f&&e.j&&(e.m?(e=e.a,e.g&&l(e.f,[e.a.c("wf","active")],[e.a.c("wf","loading"),e.a.c("wf","inactive")]),A(e,"active")):S(e.a))}function O(e){this.j=e,this.a=new N,this.h=0,this.f=this.g=!0}function G(e,t,n,a,i){var o=0==--e.h;(e.f||e.g)&&setTimeout(function(){var e=i||null,s=a||null||{};if(0===n.length&&o)S(t.a);else{t.f+=n.length,o&&(t.j=o);var p,c=[];for(p=0;p=t.f?a():e.fonts.load(y(t.a),t.h).then(function(e){1<=e.length?n():setTimeout(i,25)},function(){a()})}i()}),a=null,i=new Promise(function(e,r){a=setTimeout(r,t.f)});Promise.race([i,n]).then(function(){a&&(clearTimeout(a),a=null),t.g(t.a)},function(){t.j(t.a)})};var re={D:"serif",C:"sans-serif"},ne=null;P.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=ee(),B(this)};var ae=null;W.prototype.g=function(e){var t=this.a;t.g&&l(t.f,[t.a.c("wf",e.c,b(e).toString(),"active")],[t.a.c("wf",e.c,b(e).toString(),"loading"),t.a.c("wf",e.c,b(e).toString(),"inactive")]),A(t,"fontactive",e),this.m=!0,z(this)},W.prototype.h=function(e){var t=this.a;if(t.g){var r=s(t.f,t.a.c("wf",e.c,b(e).toString(),"active")),n=[],a=[t.a.c("wf",e.c,b(e).toString(),"loading")];r||n.push(t.a.c("wf",e.c,b(e).toString(),"inactive")),l(t.f,n,a)}A(t,"fontinactive",e),z(this)},O.prototype.load=function(e){this.c=new n(this.j,e.context||this.j),this.g=!1!==e.events,this.f=!1!==e.classes,U(this,new x(this.c,e),e)},X.prototype.load=function(e){function t(){if(i["__mti_fntLst"+n]){var r,a=i["__mti_fntLst"+n](),o=[];if(a)for(var l=0;l0);this.drawText(t,a,r.fontSize),t.restore()}},createParagraphs:function(e,t,r){return t.split("\n").map(function(t){switch(this.props.style.whitespace){case"nowrap":return[t];default:return this.wrapParagraph(e,t,r)}},this)},wrapParagraph:function(e,t,r){for(var a=t.split(" ").filter(function(e){return e.length>0}),n=[],i=e.measureText(" ").width,l={width:-i,words:[]},o=0;o0&&(n[n.length]=l.words.join(" ")),l={width:p,words:[s]})}return n[n.length]=l.words.join(" "),n},drawText:function(e,t,r){e.save(),e.translate(this.props.style.left,this.props.style.top);for(var a=0;a0,c=p?l.maxWidth-(l.width+s):0,u=p?-1:1,h=0;hparseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))}return ae}function _(e,t,r){for(var a in re)if(re.hasOwnProperty(a)&&t===e.f[re[a]]&&r===e.f[re[a]])return!0;return!1}function B(e){var t,r=e.g.a.offsetWidth,a=e.h.a.offsetWidth;(t=r===e.f.serif&&a===e.f["sans-serif"])||(t=R()&&_(e,r,a)),t?ee()-e.A>=e.w?R()&&_(e,r,a)&&(null===e.u||e.u.hasOwnProperty(e.a.c))?M(e,e.v):M(e,e.B):D(e):M(e,e.v)}function D(e){setTimeout(r(function(){B(this)},e),50)}function M(e,t){setTimeout(r(function(){l(this.g.a),l(this.h.a),l(this.j.a),l(this.m.a),t(this.a)},e),0)}function z(e,t,r){this.c=e,this.a=t,this.f=0,this.m=this.j=!1,this.s=r}function W(e){0==--e.f&&e.j&&(e.m?(e=e.a,e.g&&o(e.f,[e.a.c("wf","active")],[e.a.c("wf","loading"),e.a.c("wf","inactive")]),A(e,"active")):C(e.a))}function O(e){this.j=e,this.a=new N,this.h=0,this.f=this.g=!0}function G(e,t,a,n,i){var l=0==--e.h;(e.f||e.g)&&setTimeout(function(){var e=i||null,s=n||null||{};if(0===a.length&&l)C(t.a);else{t.f+=a.length,l&&(t.j=l);var p,c=[];for(p=0;p=t.f?n():e.fonts.load(y(t.a),t.h).then(function(e){1<=e.length?a():setTimeout(i,25)},function(){n()})}i()}),n=null,i=new Promise(function(e,r){n=setTimeout(r,t.f)});Promise.race([i,a]).then(function(){n&&(clearTimeout(n),n=null),t.g(t.a)},function(){t.j(t.a)})};var re={D:"serif",C:"sans-serif"},ae=null;P.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=ee(),B(this)};var ne=null;z.prototype.g=function(e){var t=this.a;t.g&&o(t.f,[t.a.c("wf",e.c,E(e).toString(),"active")],[t.a.c("wf",e.c,E(e).toString(),"loading"),t.a.c("wf",e.c,E(e).toString(),"inactive")]),A(t,"fontactive",e),this.m=!0,W(this)},z.prototype.h=function(e){var t=this.a;if(t.g){var r=s(t.f,t.a.c("wf",e.c,E(e).toString(),"active")),a=[],n=[t.a.c("wf",e.c,E(e).toString(),"loading")];r||a.push(t.a.c("wf",e.c,E(e).toString(),"inactive")),o(t.f,a,n)}A(t,"fontinactive",e),W(this)},O.prototype.load=function(e){this.c=new a(this.j,e.context||this.j),this.g=!1!==e.events,this.f=!1!==e.classes,U(this,new x(this.c,e),e)},X.prototype.load=function(e){function t(){if(i["__mti_fntLst"+a]){var r,n=i["__mti_fntLst"+a](),l=[];if(n)for(var o=0;o