diff --git a/CHANGELOG.md b/CHANGELOG.md index b3ea971..dd8463d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.4.2 + +- **FIX** restored install function for ES6 modules + ## v0.4.1 - **FIX** accidentaly removed install function diff --git a/dist/vue-clazy-load.js b/dist/vue-clazy-load.js index 1d643e5..e9e4885 100644 --- a/dist/vue-clazy-load.js +++ b/dist/vue-clazy-load.js @@ -85,7 +85,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); * Vue Clazy Load * Component-based lazy (CLazy) load images in Vue.js 2 * @author Matheus Grieger - * @version 0.4.1 + * @version 0.4.2 */ var ClazyLoadComponent = { name: 'ClazyLoad', @@ -284,7 +284,7 @@ var ClazyLoadComponent = { } }; -// Exports install function for Vue +// Export install function for CDN embeds var install = function install(Vue) { Vue.component('clazy-load', ClazyLoadComponent); }; @@ -292,6 +292,11 @@ var install = function install(Vue) { // Component object var VueClazyLoad = ClazyLoadComponent; +// Exports default object for ES6 modules +/* harmony default export */ __webpack_exports__["default"] = ({ + install: install +}); + /***/ }) /******/ ]); }); \ No newline at end of file diff --git a/dist/vue-clazy-load.min.js b/dist/vue-clazy-load.min.js index f00a672..27ffc9e 100644 --- a/dist/vue-clazy-load.min.js +++ b/dist/vue-clazy-load.min.js @@ -2,6 +2,6 @@ * Vue Clazy Load * Component-based lazy (CLazy) load images in Vue.js 2 * @author Matheus Grieger - * @version 0.4.1 + * @version 0.4.2 */ -var n={name:"ClazyLoad",props:{tag:{type:String,default:"div"},src:{type:String,required:!0},element:String,threshold:{type:[Array,Number],default:function(){return[0,.5,1]}},ratio:{type:Number,default:.4,validator:function(e){return e>0&&e<=1}},margin:{type:String,default:"0px"},crossorigin:{type:String,default:null,validator:function(e){return"anonymous"===e||"use-credentials"===e}},loadedClass:{type:String,default:"loaded"},loadingClass:{type:String,default:"loading"},errorClass:{type:String,default:null}},data:function(){return{loaded:!1,observer:null,errored:!1}},methods:{load:function(){var e=this;if(this.$emit("loading"),this.observer.disconnect(),!this.loaded){var t=new Image;t.addEventListener("load",function(){e.loaded=!0,e.$emit("load"),r()}),t.addEventListener("error",function(t){e.errored=!0,e.$emit("error",t),r()});var r=function(){t=null,e.observer=null};null!==this.crossorigin&&(t.crossOrigin=this.crossorigin),t.src=this.src}},observe:function(){var e=this,t={threshold:this.threshold,root:this.element?document.querySelector(this.element):null,rootMargin:this.margin};this.observer=new IntersectionObserver(function(t){t[0].intersectionRatio>=e.ratio&&e.load()},t),this.observer.observe(this.$el)}},render:function(e){var t=this.loaded?this.loadedClass:this.loadingClass;return e(this.tag,{class:this.errored&&this.errorClass?this.errorClass:t},[this.loaded?this.$slots.default||this.$slots.image:this.$slots.placeholder])},mounted:function(){this.$nextTick(this.observe)}},o=function(e){e.component("clazy-load",n)},i=n}])}); \ No newline at end of file +var n={name:"ClazyLoad",props:{tag:{type:String,default:"div"},src:{type:String,required:!0},element:String,threshold:{type:[Array,Number],default:function(){return[0,.5,1]}},ratio:{type:Number,default:.4,validator:function(e){return e>0&&e<=1}},margin:{type:String,default:"0px"},crossorigin:{type:String,default:null,validator:function(e){return"anonymous"===e||"use-credentials"===e}},loadedClass:{type:String,default:"loaded"},loadingClass:{type:String,default:"loading"},errorClass:{type:String,default:null}},data:function(){return{loaded:!1,observer:null,errored:!1}},methods:{load:function(){var e=this;if(this.$emit("loading"),this.observer.disconnect(),!this.loaded){var t=new Image;t.addEventListener("load",function(){e.loaded=!0,e.$emit("load"),r()}),t.addEventListener("error",function(t){e.errored=!0,e.$emit("error",t),r()});var r=function(){t=null,e.observer=null};null!==this.crossorigin&&(t.crossOrigin=this.crossorigin),t.src=this.src}},observe:function(){var e=this,t={threshold:this.threshold,root:this.element?document.querySelector(this.element):null,rootMargin:this.margin};this.observer=new IntersectionObserver(function(t){t[0].intersectionRatio>=e.ratio&&e.load()},t),this.observer.observe(this.$el)}},render:function(e){var t=this.loaded?this.loadedClass:this.loadingClass;return e(this.tag,{class:this.errored&&this.errorClass?this.errorClass:t},[this.loaded?this.$slots.default||this.$slots.image:this.$slots.placeholder])},mounted:function(){this.$nextTick(this.observe)}},o=function(e){e.component("clazy-load",n)},i=n;t.default={install:o}}])}); \ No newline at end of file diff --git a/src/clazy-load.js b/src/clazy-load.js index e1d19fc..8cd9aba 100644 --- a/src/clazy-load.js +++ b/src/clazy-load.js @@ -2,7 +2,7 @@ * Vue Clazy Load * Component-based lazy (CLazy) load images in Vue.js 2 * @author Matheus Grieger - * @version 0.4.1 + * @version 0.4.2 */ const ClazyLoadComponent = { name: 'ClazyLoad', @@ -199,10 +199,15 @@ const ClazyLoadComponent = { } } -// Exports install function for Vue +// Export install function for CDN embeds export const install = (Vue) => { Vue.component('clazy-load', ClazyLoadComponent) } // Component object export const VueClazyLoad = ClazyLoadComponent + +// Exports default object for ES6 modules +export default { + install +}