From f96d6ed638a00487a9c3b4f88e4b7f8376226c9c Mon Sep 17 00:00:00 2001 From: Bartosz Dominiak Date: Mon, 14 Sep 2020 00:14:06 +0200 Subject: [PATCH 1/2] bump --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95c7d2c..29e468d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.1] - 2020-09-14 +### Updated +- TravisCI configs + ## [0.3.0] - 2020-09-05 ### Added - Dynamic slides support (#25) From 6d42f6386ef7efab40e4fe254f8eeb16a818da0d Mon Sep 17 00:00:00 2001 From: Bartosz Dominiak Date: Mon, 14 Sep 2020 00:15:03 +0200 Subject: [PATCH 2/2] bump --- dist/vue-snap.esm.js | 2 +- dist/vue-snap.js | 2 +- dist/vue-snap.umd.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/vue-snap.esm.js b/dist/vue-snap.esm.js index 0f15e96..fd4d046 100644 --- a/dist/vue-snap.esm.js +++ b/dist/vue-snap.esm.js @@ -1 +1 @@ -import{polyfill as t}from"seamless-scroll-polyfill/dist/esm/Element.scrollBy";import"core-js/modules/es.array.find-index";import"core-js/modules/es.array.from";import"core-js/modules/es.array.map";import"core-js/modules/es.string.iterator";import e from"lodash.debounce";var i="undefined"==typeof document||"undefined"==typeof window,s=!i;i||"scrollBehavior"in document.documentElement.style||t();function n(t,e,i,s,n,r,o,a,c,l){"boolean"!=typeof o&&(c=a,a=o,o=!1);const d="function"==typeof i?i.options:i;let h;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,n&&(d.functional=!0)),s&&(d._scopeId=s),r?(h=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(r)},d._ssrRegister=h):e&&(h=o?function(t){e.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),h)if(d.functional){const t=d.render;d.render=function(e,i){return h.call(i),t(e,i)}}else{const t=d.beforeCreate;d.beforeCreate=t?[].concat(t,h):[h]}return i}const r={props:{navigationArrows:{type:Boolean,default:!0}},data:function(){return{boundLeft:!0,boundRight:!1,slidesWidth:[],wrapperScrollWidth:0,wrapperVisibleWidth:0,currentPage:0,currentPos:0,maxPages:0,step:1,observer:null}},mounted:function(){this.calcOnInit(),s&&(this.attachMutationObserver(),this.$refs.vsWrapper.addEventListener("scroll",e(this.calcOnScroll,100)),window.addEventListener("resize",e(this.calcOnInit,410),!1))},beforeDestroy:function(){s&&(this.observer.disconnect(),this.$refs.vsWrapper.removeEventListener("scroll",e(this.calcOnScroll,100)),window.removeEventListener("resize",e(this.calcOnInit,410),!1))},methods:{calcOnInit:function(){this.calcWrapperWidth(),this.calcSlidesWidth(),this.calcCurrentPosition(),this.calcBounds(),this.calcMaxPages()},calcOnScroll:function(){this.calcCurrentPosition(),this.calcBounds()},calcBounds:function(){this.boundLeft=0===this.currentPos,this.boundRight=this.wrapperScrollWidth-this.wrapperVisibleWidth===this.currentPos},calcWrapperWidth:function(){this.wrapperScrollWidth=this.$refs.vsWrapper.scrollWidth,this.wrapperVisibleWidth=this.$refs.vsWrapper.offsetWidth},calcSlidesWidth:function(){var t=Array.from(this.$refs.vsWrapper.childNodes);this.slidesWidth=t.map((function(t){return{offsetLeft:t.offsetLeft,width:t.offsetWidth}}))},calcCurrentPosition:function(){var t=this;this.currentPos=this.$refs.vsWrapper.scrollLeft||0,this.currentPage=this.slidesWidth.findIndex((function(e){return i=e.offsetLeft,s=t.currentPos,n=5,Math.abs(i-s)<=n;var i,s,n})),-1===this.currentPage&&(this.currentPage=this.maxPages)},calcMaxPages:function(){var t=this.wrapperScrollWidth-this.wrapperVisibleWidth;this.maxPages=this.slidesWidth.findIndex((function(e){return e.offsetLeft>t}))-1},calcNextWidth:function(t){var e=t>0?this.currentPage:this.currentPage+t,i=this.slidesWidth[e].width||0;if(i)return i*t},attachMutationObserver:function(){var t=this;this.observer=new MutationObserver((function(){t.calcOnInit()})),this.observer.observe(this.$el,{attributes:!0,childList:!0,characterData:!0,subtree:!0})},changeSlide:function(t){var e=-1===t&&this.boundLeft,i=1===t&&this.boundRight;if(!e&&!i){var s=this.calcNextWidth(t);s&&this.scrollTo(s)}},scrollTo:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.$refs.vsWrapper.scrollBy({left:t,behavior:"smooth"})}}};var o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vs-carousel"},[i("div",{ref:"vsWrapper",staticClass:"vs-carousel__wrapper"},[t._t("default")],2),t._v(" "),t.navigationArrows?t._t("navigation",[i("button",{directives:[{name:"show",rawName:"v-show",value:!t.boundLeft,expression:"!boundLeft"}],staticClass:"\n vs-carousel__navigation\n vs-carousel__navigation--left\n ",attrs:{type:"button","aria-label":"Slide left"},on:{click:function(e){return t.changeSlide(-1)}}},[t._v("\n ←\n ")]),t._v(" "),i("button",{directives:[{name:"show",rawName:"v-show",value:!t.boundRight,expression:"!boundRight"}],staticClass:"\n vs-carousel__navigation\n vs-carousel__navigation--right\n ",attrs:{type:"button","aria-label":"Slide right"},on:{click:function(e){return t.changeSlide(1)}}},[t._v("\n →\n ")])]):t._e()],2)};o._withStripped=!0;const a=n({render:o,staticRenderFns:[]},undefined,r,undefined,false,undefined,!1,void 0,void 0,void 0);var c=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{ref:"vsSlide",staticClass:"vs-carousel__slide",attrs:{tabindex:"0"}},[t._t("default")],2)};c._withStripped=!0;const l=n({render:c,staticRenderFns:[]},undefined,{},undefined,false,undefined,!1,void 0,void 0,void 0);var d={install:function(t){t.component("carousel",a),t.component("slide",l)}};export default d;export{a as Carousel,l as Slide}; +import{polyfill as t}from"seamless-scroll-polyfill/dist/esm/Element.scrollBy";import"core-js/modules/es.array.find-index";import"core-js/modules/es.array.from";import"core-js/modules/es.array.map";import"core-js/modules/es.string.iterator";import e from"lodash.debounce";var i="undefined"==typeof window,s=!i;i||"scrollBehavior"in document.documentElement.style||t();function r(t,e,i,s,r,n,o,a,c,l){"boolean"!=typeof o&&(c=a,a=o,o=!1);const d="function"==typeof i?i.options:i;let h;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,r&&(d.functional=!0)),s&&(d._scopeId=s),n?(h=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=h):e&&(h=o?function(t){e.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),h)if(d.functional){const t=d.render;d.render=function(e,i){return h.call(i),t(e,i)}}else{const t=d.beforeCreate;d.beforeCreate=t?[].concat(t,h):[h]}return i}const n={props:{navigationArrows:{type:Boolean,default:!0}},data:function(){return{boundLeft:!0,boundRight:!1,slidesWidth:[],wrapperScrollWidth:0,wrapperVisibleWidth:0,currentPage:0,currentPos:0,maxPages:0,step:1,observer:null}},mounted:function(){this.calcOnInit(),s&&(this.attachMutationObserver(),this.$refs.vsWrapper.addEventListener("scroll",e(this.calcOnScroll,100)),window.addEventListener("resize",e(this.calcOnInit,410),!1))},beforeDestroy:function(){s&&(this.observer.disconnect(),this.$refs.vsWrapper.removeEventListener("scroll",e(this.calcOnScroll,100)),window.removeEventListener("resize",e(this.calcOnInit,410),!1))},methods:{calcOnInit:function(){this.calcWrapperWidth(),this.calcSlidesWidth(),this.calcCurrentPosition(),this.calcBounds(),this.calcMaxPages()},calcOnScroll:function(){this.calcCurrentPosition(),this.calcBounds()},calcBounds:function(){this.boundLeft=0===this.currentPos,this.boundRight=this.wrapperScrollWidth-this.wrapperVisibleWidth===this.currentPos},calcWrapperWidth:function(){this.wrapperScrollWidth=this.$refs.vsWrapper.scrollWidth,this.wrapperVisibleWidth=this.$refs.vsWrapper.offsetWidth},calcSlidesWidth:function(){var t=Array.from(this.$refs.vsWrapper.childNodes);this.slidesWidth=t.map((function(t){return{offsetLeft:t.offsetLeft,width:t.offsetWidth}}))},calcCurrentPosition:function(){var t=this;this.currentPos=this.$refs.vsWrapper.scrollLeft||0,this.currentPage=this.slidesWidth.findIndex((function(e){return i=e.offsetLeft,s=t.currentPos,r=5,Math.abs(i-s)<=r;var i,s,r})),-1===this.currentPage&&(this.currentPage=this.maxPages)},calcMaxPages:function(){var t=this.wrapperScrollWidth-this.wrapperVisibleWidth;this.maxPages=this.slidesWidth.findIndex((function(e){return e.offsetLeft>t}))-1},calcNextWidth:function(t){var e=t>0?this.currentPage:this.currentPage+t,i=this.slidesWidth[e].width||0;if(i)return i*t},attachMutationObserver:function(){var t=this;this.observer=new MutationObserver((function(){t.calcOnInit()})),this.observer.observe(this.$el,{attributes:!0,childList:!0,characterData:!0,subtree:!0})},changeSlide:function(t){var e=-1===t&&this.boundLeft,i=1===t&&this.boundRight;if(!e&&!i){var s=this.calcNextWidth(t);s&&this.scrollTo(s)}},scrollTo:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.$refs.vsWrapper.scrollBy({left:t,behavior:"smooth"})}}};var o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"vs-carousel"},[i("div",{ref:"vsWrapper",staticClass:"vs-carousel__wrapper"},[t._t("default")],2),t._v(" "),t.navigationArrows?t._t("navigation",[i("button",{directives:[{name:"show",rawName:"v-show",value:!t.boundLeft,expression:"!boundLeft"}],staticClass:"\n vs-carousel__navigation\n vs-carousel__navigation--left\n ",attrs:{type:"button","aria-label":"Slide left"},on:{click:function(e){return t.changeSlide(-1)}}},[t._v("\n ←\n ")]),t._v(" "),i("button",{directives:[{name:"show",rawName:"v-show",value:!t.boundRight,expression:"!boundRight"}],staticClass:"\n vs-carousel__navigation\n vs-carousel__navigation--right\n ",attrs:{type:"button","aria-label":"Slide right"},on:{click:function(e){return t.changeSlide(1)}}},[t._v("\n →\n ")])]):t._e()],2)};o._withStripped=!0;const a=r({render:o,staticRenderFns:[]},undefined,n,undefined,false,undefined,!1,void 0,void 0,void 0);var c=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{ref:"vsSlide",staticClass:"vs-carousel__slide",attrs:{tabindex:"0"}},[t._t("default")],2)};c._withStripped=!0;const l=r({render:c,staticRenderFns:[]},undefined,{},undefined,false,undefined,!1,void 0,void 0,void 0);var d={install:function(t){t.component("carousel",a),t.component("slide",l)}};export default d;export{a as Carousel,l as Slide}; diff --git a/dist/vue-snap.js b/dist/vue-snap.js index f46a2cd..2b86675 100644 --- a/dist/vue-snap.js +++ b/dist/vue-snap.js @@ -1 +1 @@ -var VueSnap=function(t){"use strict";const e=t=>.5*(1-Math.cos(Math.PI*t)),n=()=>(performance&&performance.now?performance:Date).now(),r=t=>{const o=(n()-t.timeStamp)/(t.duration||500);if(o>1)return t.method(t.targetX,t.targetY),void t.callback();const i=(t.timingFunc||e)(o),c=t.startX+(t.targetX-t.startX)*i,u=t.startY+(t.targetY-t.startY)*i;t.method(c,u),t.rafId=requestAnimationFrame(()=>{r(t)})};let o;const i=()=>(void 0===o&&(o=Element.prototype.scroll||Element.prototype.scrollTo||function(t,e){this.scrollLeft=t,this.scrollTop=e}),o),c=(t,e)=>{const o=(e.left||0)+t.scrollLeft,c=(e.top||0)+t.scrollTop;return((t,e)=>{const o=i().bind(t);if(void 0===e.left&&void 0===e.top)return;const c=t.scrollLeft,u=t.scrollTop,{left:a=c,top:s=u}=e;if("smooth"!==e.behavior)return o(a,s);const f=()=>{window.removeEventListener("wheel",p),window.removeEventListener("touchmove",p)},l={timeStamp:n(),duration:e.duration,startX:c,startY:u,targetX:a,targetY:s,rafId:0,method:o,timingFunc:e.timingFunc,callback:f},p=()=>{cancelAnimationFrame(l.rafId),f()};window.addEventListener("wheel",p,{passive:!0,once:!0}),window.addEventListener("touchmove",p,{passive:!0,once:!0}),r(l)})(t,{...e,left:o,top:c})},u=t=>{Element.prototype.scrollBy=function(){const[e=0,n=0]=arguments;if("number"==typeof e&&"number"==typeof n)return c(this,{left:e,top:n});if(Object(e)!==e)throw new TypeError("Failed to execute 'scrollBy' on 'Element': parameter 1 ('options') is not an object.");return c(this,{...e,...t})}};var a="undefined"==typeof document||"undefined"==typeof window,s=!a;a||"scrollBehavior"in document.documentElement.style||u();var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}var p=function(t){return t&&t.Math==Math&&t},d=p("object"==typeof globalThis&&globalThis)||p("object"==typeof window&&window)||p("object"==typeof self&&self)||p("object"==typeof f&&f)||Function("return this")(),h=function(t){try{return!!t()}catch(t){return!0}},v=!h((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),y={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,b={f:g&&!y.call({1:2},1)?function(t){var e=g(this,t);return!!e&&e.enumerable}:y},m=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},w={}.toString,S=function(t){return w.call(t).slice(8,-1)},O="".split,_=h((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==S(t)?O.call(t,""):Object(t)}:Object,j=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},E=function(t){return _(j(t))},P=function(t){return"object"==typeof t?null!==t:"function"==typeof t},A=function(t,e){if(!P(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!P(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!P(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!P(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},x={}.hasOwnProperty,T=function(t,e){return x.call(t,e)},W=d.document,I=P(W)&&P(W.createElement),C=function(t){return I?W.createElement(t):{}},L=!v&&!h((function(){return 7!=Object.defineProperty(C("div"),"a",{get:function(){return 7}}).a})),R=Object.getOwnPropertyDescriptor,F={f:v?R:function(t,e){if(t=E(t),e=A(e,!0),L)try{return R(t,e)}catch(t){}if(T(t,e))return m(!b.f.call(t,e),t[e])}},M=function(t){if(!P(t))throw TypeError(String(t)+" is not an object");return t},$=Object.defineProperty,N={f:v?$:function(t,e,n){if(M(t),e=A(e,!0),M(n),L)try{return $(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},k=v?function(t,e,n){return N.f(t,e,m(1,n))}:function(t,e,n){return t[e]=n,t},B=function(t,e){try{k(d,t,e)}catch(n){d[t]=e}return e},D="__core-js_shared__",X=d[D]||B(D,{}),Y=Function.toString;"function"!=typeof X.inspectSource&&(X.inspectSource=function(t){return Y.call(t)});var V,z,G,U=X.inspectSource,q=d.WeakMap,K="function"==typeof q&&/native code/.test(U(q)),H=l((function(t){(t.exports=function(t,e){return X[t]||(X[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),J=0,Q=Math.random(),Z=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++J+Q).toString(36)},tt=H("keys"),et=function(t){return tt[t]||(tt[t]=Z(t))},nt={},rt=d.WeakMap;if(K){var ot=new rt,it=ot.get,ct=ot.has,ut=ot.set;V=function(t,e){return ut.call(ot,t,e),e},z=function(t){return it.call(ot,t)||{}},G=function(t){return ct.call(ot,t)}}else{var at=et("state");nt[at]=!0,V=function(t,e){return k(t,at,e),e},z=function(t){return T(t,at)?t[at]:{}},G=function(t){return T(t,at)}}var st,ft={set:V,get:z,has:G,enforce:function(t){return G(t)?z(t):V(t,{})},getterFor:function(t){return function(e){var n;if(!P(e)||(n=z(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},lt=l((function(t){var e=ft.get,n=ft.enforce,r=String(String).split("String");(t.exports=function(t,e,o,i){var c=!!i&&!!i.unsafe,u=!!i&&!!i.enumerable,a=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||T(o,"name")||k(o,"name",e),n(o).source=r.join("string"==typeof e?e:"")),t!==d?(c?!a&&t[e]&&(u=!0):delete t[e],u?t[e]=o:k(t,e,o)):u?t[e]=o:B(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||U(this)}))})),pt=d,dt=function(t){return"function"==typeof t?t:void 0},ht=function(t,e){return arguments.length<2?dt(pt[t])||dt(d[t]):pt[t]&&pt[t][e]||d[t]&&d[t][e]},vt=Math.ceil,yt=Math.floor,gt=function(t){return isNaN(t=+t)?0:(t>0?yt:vt)(t)},bt=Math.min,mt=function(t){return t>0?bt(gt(t),9007199254740991):0},wt=Math.max,St=Math.min,Ot=function(t){return function(e,n,r){var o,i=E(e),c=mt(i.length),u=function(t,e){var n=gt(t);return n<0?wt(n+e,0):St(n,e)}(r,c);if(t&&n!=n){for(;c>u;)if((o=i[u++])!=o)return!0}else for(;c>u;u++)if((t||u in i)&&i[u]===n)return t||u||0;return!t&&-1}},_t={includes:Ot(!0),indexOf:Ot(!1)}.indexOf,jt=function(t,e){var n,r=E(t),o=0,i=[];for(n in r)!T(nt,n)&&T(r,n)&&i.push(n);for(;e.length>o;)T(r,n=e[o++])&&(~_t(i,n)||i.push(n));return i},Et=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Pt=Et.concat("length","prototype"),At={f:Object.getOwnPropertyNames||function(t){return jt(t,Pt)}},xt={f:Object.getOwnPropertySymbols},Tt=ht("Reflect","ownKeys")||function(t){var e=At.f(M(t)),n=xt.f;return n?e.concat(n(t)):e},Wt=function(t,e){for(var n=Tt(e),r=N.f,o=F.f,i=0;ig;g++)if((c||g in h)&&(p=v(l=h[g],g,d),t))if(e)m[g]=p;else if(p)switch(t){case 3:return!0;case 5:return l;case 6:return g;case 2:Jt.call(m,l)}else if(o)return!1;return i?-1:r||o?o:m}},Zt={forEach:Qt(0),map:Qt(1),filter:Qt(2),some:Qt(3),every:Qt(4),find:Qt(5),findIndex:Qt(6)},te=Object.keys||function(t){return jt(t,Et)},ee=v?Object.defineProperties:function(t,e){M(t);for(var n,r=te(e),o=r.length,i=0;o>i;)N.f(t,n=r[i++],e[n]);return t},ne=ht("document","documentElement"),re=et("IE_PROTO"),oe=function(){},ie=function(t){return"