vuejs-image-placeholder
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -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(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=3)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:{width:{type:Number,default:200},height:{type:Number,default:150},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,stroke:this.borderColour,strokeWidth:this.borderWidth}},displayText:function(){return!1===this.showRatio?this.size:this.ratio},size:function(){return this.width+"x"+this.height},ratio:function(){var t=this.getSimplifiedRatio(this.width/this.height);return t.x+":"+t.y},internalWidth:function(){return this.width-2*this.borderWidth},internalHeight:function(){return this.height-2*this.borderWidth}},methods:{getSimplifiedRatio:function(t){var e=this.isNegative(t);e&&(t*=-1);for(var r=[0,1],i=[1,0],n=this.getMaxNumerator(t),o=t,s=void 0,u=NaN,a=2;a<1e3;a++){var f=Math.floor(o);if(r[a]=f*r[a-1]+r[a-2],Math.abs(r[a])>n)break;if(i[a]=f*i[a-1]+i[a-2],(s=r[a]/i[a])===u)break;if(s===t)break;u=s,o=1/(o-f)}return e&&(r[a]*=-1),{x:r[a],y:i[a]}},getMaxNumerator:function(t){var e=this.getScientificRatio(t);e=this.getDigits(e);var r=void 0,i=this.getNumDigitsPastDecimal(t,e);for(r=i;r>0&&e%2==0;r--)e/=2;for(r=i;r>0&&e%5==0;r--)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 r=e.toString().length,i=t.toString().length;return 0===t&&(i=0),r-i}}}},function(t,e){t.exports=function(t,e,r,i,n){var o,s=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(o=t,s=t.default);var a="function"==typeof s?s.options:s;e&&(a.render=e.render,a.staticRenderFns=e.staticRenderFns),i&&(a._scopeId=i);var f;if(n?(f=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__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(n)},a._ssrRegister=f):r&&(f=r),f){var d=a.functional,l=d?a.render:a.beforeCreate;d?a.render=function(t,e){return f.call(e),l(t,e)}:a.beforeCreate=l?[].concat(l,f):[f]}return{esModule:o,exports:s,options:a}}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:t.width,height:t.height}},[r("rect",{style:t.imgStyle,attrs:{x:t.borderWidth,y:t.borderWidth,width:t.internalWidth,height:t.internalHeight}}),t._v(" "),r("text",{attrs:{x:"50%",y:"50%","font-size":t.fontSize,"font-family":t.fontFamily,fill:t.fontColour,"text-anchor":"middle","alignment-baseline":"middle"}},[t._v("\n "+t._s(t.displayText)+"\n ")])])},staticRenderFns:[]}},function(t,e,r){var i=r(1)(r(0),r(2),null,null,null);t.exports=i.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(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=3)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:{width:{type:Number,default:200},height:{type:Number,default:150},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,stroke:this.borderColour,strokeWidth:this.borderWidth}},displayText:function(){return!1===this.showRatio?this.size:this.ratio},size:function(){return this.width+"x"+this.height},ratio:function(){var t=this.getSimplifiedRatio(this.width/this.height);return t.x+":"+t.y},internalWidth:function(){return this.width-2*this.borderWidth},internalHeight:function(){return this.height-2*this.borderWidth}},methods:{getSimplifiedRatio:function(t){var e=this.isNegative(t);e&&(t*=-1);for(var r=[0,1],i=[1,0],n=this.getMaxNumerator(t),o=t,s=void 0,u=NaN,a=2;a<1e3;a++){var f=Math.floor(o);if(r[a]=f*r[a-1]+r[a-2],Math.abs(r[a])>n)break;if(i[a]=f*i[a-1]+i[a-2],(s=r[a]/i[a])===u)break;if(s===t)break;u=s,o=1/(o-f)}return e&&(r[a]*=-1),{x:r[a],y:i[a]}},getMaxNumerator:function(t){var e=this.getScientificRatio(t);e=this.getDigits(e);var r=void 0,i=this.getNumDigitsPastDecimal(t,e);for(r=i;r>0&&e%2==0;r--)e/=2;for(r=i;r>0&&e%5==0;r--)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 r=e.toString().length,i=t.toString().length;return 0===t&&(i=0),r-i}}}},function(t,e){t.exports=function(t,e,r,i,n){var o,s=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(o=t,s=t.default);var a="function"==typeof s?s.options:s;e&&(a.render=e.render,a.staticRenderFns=e.staticRenderFns),i&&(a._scopeId=i);var f;if(n?(f=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__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(n)},a._ssrRegister=f):r&&(f=r),f){var d=a.functional,l=d?a.render:a.beforeCreate;d?a.render=function(t,e){return f.call(e),l(t,e)}:a.beforeCreate=l?[].concat(l,f):[f]}return{esModule:o,exports:s,options:a}}},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:t.width,height:t.height}},[r("rect",{style:t.imgStyle,attrs:{x:t.borderWidth,y:t.borderWidth,width:t.internalWidth,height:t.internalHeight}}),t._v(" "),r("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,r){var i=r(1)(r(0),r(2),null,null,null);t.exports=i.exports}])}); | ||
//# sourceMappingURL=build.js.map |
{ | ||
"name": "vuejs-image-placeholder", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Svg image placeholder", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -32,3 +32,10 @@ # Vuejs Image Placeholder | ||
By default the image shows the dimensions, using `showRatio` prop the ratio can displayed instead. | ||
Alternatively you can provide your own text. | ||
```html | ||
<image-placeholder>My Custom Text</image-placeholder> | ||
``` | ||
## Available props | ||
@@ -35,0 +42,0 @@ |
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
39404
53