vuejs-image-placeholder
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["vuejs-image-placeholder"]=e():t["vuejs-image-placeholder"]=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=3)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:{width:{type:Number,default:200},height:{type:Number,default:150},percentWidth:Boolean,percentHeight:Boolean,backgroundColour:{type:String,default:"#ccc"},borderColour:{type:String,default:"#333"},borderWidth:{type:Number,default:1},showRatio:{type:Boolean,default:!1},fontFamily:{type:String,default:"monospace, sans-serif"},fontColour:{type:String,default:"#333"},fontSize:{type:Number,default:14}},computed:{imgStyle:function(){return{fill:this.backgroundColour,outlineColor:this.borderColour,outlineStyle:"solid",outlineWidth:this.borderWidth+"px",outlineOffset:-1*this.borderWidth+"px"}},displayText:function(){return!1===this.showRatio?this.size:this.ratio},imgWidth:function(){return this.percentWidth?this.width+"%":this.width},imgHeight:function(){return this.percentHeight?this.height+"%":this.height},size:function(){return this.width+(this.percentWidth?"%":"")+"x"+this.height+(this.percentHeight?"%":"")},ratio:function(){var t=this.getSimplifiedRatio(this.width/this.height);return t.x+":"+t.y},internalWidth:function(){return this.percentWidth?this.width+"%":this.width-2*this.borderWidth},internalHeight:function(){return this.percentHeight?this.height+"%":this.height-2*this.borderWidth},textPosition:function(){return{x:this.percentWidth?this.width/2+"%":"50%",y:this.percentHeight?this.height/2+"%":"50%"}}},methods:{getSimplifiedRatio:function(t){var e=this.isNegative(t);e&&(t*=-1);for(var i=[0,1],n=[1,0],r=this.getMaxNumerator(t),o=t,s=void 0,u=NaN,h=2;h<1e3;h++){var a=Math.floor(o);if(i[h]=a*i[h-1]+i[h-2],Math.abs(i[h])>r)break;if(n[h]=a*n[h-1]+n[h-2],(s=i[h]/n[h])===u)break;if(s===t)break;u=s,o=1/(o-a)}return e&&(i[h]*=-1),{x:i[h],y:n[h]}},getMaxNumerator:function(t){var e=this.getScientificRatio(t);e=this.getDigits(e);var i=void 0,n=this.getNumDigitsPastDecimal(t,e);for(i=n;i>0&&e%2==0;i--)e/=2;for(i=n;i>0&&e%5==0;i--)e/=5;return e},isNegative:function(t){return t<0},getScientificRatio:function(t){var e=t.toString().indexOf("E");return-1===e&&(e=t.toString().indexOf("e")),-1===e?t.toString():t.toString().substring(0,e)},getDigits:function(t){var e=t.toString().indexOf(".");return-1===e?t:0===e?t.substring(1,t.length):e<t.length?t.substring(0,e)+t.substring(e+1,t.length):null},getNumDigitsPastDecimal:function(t,e){var i=e.toString().length,n=t.toString().length;return 0===t&&(n=0),i-n}}}},function(t,e){t.exports=function(t,e,i,n,r){var o,s=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(o=t,s=t.default);var h="function"==typeof s?s.options:s;e&&(h.render=e.render,h.staticRenderFns=e.staticRenderFns),n&&(h._scopeId=n);var a;if(r?(a=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},h._ssrRegister=a):i&&(a=i),a){var f=h.functional,d=f?h.render:h.beforeCreate;f?h.render=function(t,e){return a.call(e),d(t,e)}:h.beforeCreate=d?[].concat(d,a):[a]}return{esModule:o,exports:s,options:h}}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%"}},[i("rect",{style:t.imgStyle,attrs:{width:t.imgWidth,height:t.imgHeight}}),t._v(" "),i("text",{attrs:{x:t.textPosition.x,y:t.textPosition.y,"font-size":t.fontSize,"font-family":t.fontFamily,fill:t.fontColour,"text-anchor":"middle","alignment-baseline":"middle"}},[t._t("default",[t._v(t._s(t.displayText))])],2)])},staticRenderFns:[]}},function(t,e,i){var n=i(1)(i(0),i(2),null,null,null);t.exports=n.exports}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["vuejs-image-placeholder"]=e():t["vuejs-image-placeholder"]=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=3)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:{width:{type:Number,default:200},height:{type:Number,default:150},percentWidth:Boolean,percentHeight:Boolean,backgroundColour:{type:String,default:"#ccc"},borderColour:{type:String,default:"#333"},borderWidth:{type:Number,default:1},showRatio:{type:Boolean,default:!1},fontFamily:{type:String,default:"monospace, sans-serif"},fontColour:{type:String,default:"#333"},fontSize:{type:Number,default:14}},computed:{imgStyle:function(){return{fill:this.backgroundColour,outlineColor:this.borderColour,outlineStyle:"solid",outlineWidth:this.borderWidth+"px",outlineOffset:-1*this.borderWidth+"px"}},displayText:function(){return!1===this.showRatio?this.size:this.ratio},imgWidth:function(){return this.percentWidth?this.width+"%":this.width},imgHeight:function(){return this.percentHeight?this.height+"%":this.height},rectWidth:function(){return this.percentWidth?"100%":this.width},rectHeight:function(){return this.percentHeight?"100%":this.height},size:function(){return this.width+(this.percentWidth?"%":"")+"x"+this.height+(this.percentHeight?"%":"")},ratio:function(){var t=this.getSimplifiedRatio(this.width/this.height);return t.x+":"+t.y},internalWidth:function(){return this.percentWidth?this.width+"%":this.width-2*this.borderWidth},internalHeight:function(){return this.percentHeight?this.height+"%":this.height-2*this.borderWidth}},methods:{getSimplifiedRatio:function(t){var e=this.isNegative(t);e&&(t*=-1);for(var i=[0,1],n=[1,0],r=this.getMaxNumerator(t),o=t,s=void 0,u=NaN,h=2;h<1e3;h++){var a=Math.floor(o);if(i[h]=a*i[h-1]+i[h-2],Math.abs(i[h])>r)break;if(n[h]=a*n[h-1]+n[h-2],(s=i[h]/n[h])===u)break;if(s===t)break;u=s,o=1/(o-a)}return e&&(i[h]*=-1),{x:i[h],y:n[h]}},getMaxNumerator:function(t){var e=this.getScientificRatio(t);e=this.getDigits(e);var i=void 0,n=this.getNumDigitsPastDecimal(t,e);for(i=n;i>0&&e%2==0;i--)e/=2;for(i=n;i>0&&e%5==0;i--)e/=5;return e},isNegative:function(t){return t<0},getScientificRatio:function(t){var e=t.toString().indexOf("E");return-1===e&&(e=t.toString().indexOf("e")),-1===e?t.toString():t.toString().substring(0,e)},getDigits:function(t){var e=t.toString().indexOf(".");return-1===e?t:0===e?t.substring(1,t.length):e<t.length?t.substring(0,e)+t.substring(e+1,t.length):null},getNumDigitsPastDecimal:function(t,e){var i=e.toString().length,n=t.toString().length;return 0===t&&(n=0),i-n}}}},function(t,e){t.exports=function(t,e,i,n,r){var o,s=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(o=t,s=t.default);var h="function"==typeof s?s.options:s;e&&(h.render=e.render,h.staticRenderFns=e.staticRenderFns),n&&(h._scopeId=n);var a;if(r?(a=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},h._ssrRegister=a):i&&(a=i),a){var d=h.functional,f=d?h.render:h.beforeCreate;d?h.render=function(t,e){return a.call(e),f(t,e)}:h.beforeCreate=f?[].concat(f,a):[a]}return{esModule:o,exports:s,options:h}}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:t.imgWidth,height:t.imgHeight}},[i("rect",{style:t.imgStyle,attrs:{width:t.rectWidth,height:t.rectHeight}}),t._v(" "),i("text",{attrs:{x:"50%",y:"50%","font-size":t.fontSize,"font-family":t.fontFamily,fill:t.fontColour,"text-anchor":"middle","alignment-baseline":"middle"}},[t._t("default",[t._v(t._s(t.displayText))])],2)])},staticRenderFns:[]}},function(t,e,i){var n=i(1)(i(0),i(2),null,null,null);t.exports=n.exports}])}); | ||
//# sourceMappingURL=build.js.map |
{ | ||
"name": "vuejs-image-placeholder", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Svg image placeholder", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42027