vue-sliderx
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -40,2 +40,3 @@ 'use strict'; | ||
width: '100%', | ||
height: '100%', | ||
position: 'relative', | ||
@@ -284,3 +285,3 @@ overflow: 'hidden' | ||
height: ((this.viewportSize.height) + "px"), | ||
width: ((this.viewportSize.width) + "px") | ||
width: this.orientation === 'horizontal' ? ((this.viewportSize.width) + "px") : undefined | ||
} | ||
@@ -287,0 +288,0 @@ }, [this.$scopedSlots.prev && this.$scopedSlots.prev({ canPrev: this.canPrev, prev: this.prev }), measure, viewport, this.$scopedSlots.next && this.$scopedSlots.next({ canNext: this.canNext, next: this.next })]); |
@@ -36,2 +36,3 @@ import { Motion } from 'vue-motion'; | ||
width: '100%', | ||
height: '100%', | ||
position: 'relative', | ||
@@ -280,3 +281,3 @@ overflow: 'hidden' | ||
height: ((this.viewportSize.height) + "px"), | ||
width: ((this.viewportSize.width) + "px") | ||
width: this.orientation === 'horizontal' ? ((this.viewportSize.width) + "px") : undefined | ||
} | ||
@@ -283,0 +284,0 @@ }, [this.$scopedSlots.prev && this.$scopedSlots.prev({ canPrev: this.canPrev, prev: this.prev }), measure, viewport, this.$scopedSlots.next && this.$scopedSlots.next({ canNext: this.canNext, next: this.next })]); |
@@ -409,2 +409,3 @@ (function (global, factory) { | ||
width: '100%', | ||
height: '100%', | ||
position: 'relative', | ||
@@ -1676,3 +1677,3 @@ overflow: 'hidden' | ||
height: ((this.viewportSize.height) + "px"), | ||
width: ((this.viewportSize.width) + "px") | ||
width: this.orientation === 'horizontal' ? ((this.viewportSize.width) + "px") : undefined | ||
} | ||
@@ -1679,0 +1680,0 @@ }, [this.$scopedSlots.prev && this.$scopedSlots.prev({ canPrev: this.canPrev, prev: this.prev }), measure, viewport, this.$scopedSlots.next && this.$scopedSlots.next({ canNext: this.canNext, next: this.next })]); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VueVKeyboard=t()}(this,function(){"use strict";var e,t,i=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var i=[0,0];function n(e,t,n,r,o,s,a){var u=n+(-o*(t-r)+-s*n)*e,c=t+u*e;return Math.abs(u)<a&&Math.abs(c-r)<a?(i[0]=r,i[1]=0,i):(i[0]=c,i[1]=u,i)}var r={noWobble:{stiffness:170,damping:26,precision:.01},gentle:{stiffness:120,damping:14,precision:.01},wobbly:{stiffness:180,damping:12,precision:.01},stiff:{stiffness:210,damping:20,precision:.01}},o=window.requestAnimationFrame.bind(window),s=performance.now.bind(performance),a=Array.isArray.bind(Array),u=function(e){return null!==e&&"object"==typeof e},c={data:function(){return{currentValues:null,currentVelocities:null}},props:{value:Number,values:[Object,Array],tag:{type:String,default:"span"},spring:{type:[Object,String],default:"noWobble"}},computed:{springConfig:function(){return"string"==typeof this.spring?r[this.spring]:this.spring},realValues:function(){return null!=this.value?{value:this.value}:this.values}},render:function(e){return e(this.tag,[this.$scopedSlots.default(this.currentValues)])},watch:{realValues:function(e,t){t===e||this.wasAnimating||(this.prevTime=s(),this.accumulatedTime=0,this.animate())}},created:function(){var e=this.defineInitialValues(this.realValues,null);this.currentValues=e.values,this.currentVelocities=e.velocities},mounted:function(){this.prevTime=s(),this.accumulatedTime=0;var e=this.defineInitialValues(this.currentValues,this.currentVelocities);this.idealValues=e.values,this.idealVelocities=e.velocities,this.animate()},methods:{defineInitialValues:function(e,t){var i={},n={};return this.defineValues(e,t,i,n),{values:i,velocities:n}},defineValues:function(e,t,i,n){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a(e[r])||u(e[r])?(i[r]={},n[r]={},this.defineValues(e[r],t&&t[r],i[r],n[r])):(i[r]=e[r],n[r]=t?t[r]:0))},animate:function(){var e=this;this.animationId=o(function(){if(function e(t,i,n){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r))if(a(i[r])||u(i[r])){if(!e(t[r],i[r],n[r]))return!1}else{if(0!==n[r])return!1;if(t[r]!==i[r])return!1}return!0}(e.currentValues,e.realValues,e.currentVelocities))return e.wasAnimating&&e.$emit("motion-end"),e.animationId=null,void(e.wasAnimating=!1);e.wasAnimating||e.$emit("motion-start"),e.wasAnimating=!0;var t=s(),i=t-e.prevTime;if(e.prevTime=t,e.accumulatedTime+=i,e.accumulatedTime>1e3/60*10&&(e.accumulatedTime=0),0===e.accumulatedTime)return e.animationID=null,e.$emit("motion-restart"),void e.animate();var n=(e.accumulatedTime-Math.floor(e.accumulatedTime/(1e3/60))*(1e3/60))/(1e3/60),r=Math.floor(e.accumulatedTime/(1e3/60)),o=e.springConfig;e.animateValues({framesToCatchUp:r,currentFrameCompletion:n,springConfig:o,realValues:e.realValues,currentValues:e.currentValues,currentVelocities:e.currentVelocities,idealValues:e.idealValues,idealVelocities:e.idealVelocities}),e.animationID=null,e.accumulatedTime-=r*(1e3/60),e.animate()})},animateValues:function(e){var t=e.framesToCatchUp,i=e.currentFrameCompletion,r=e.springConfig,o=e.realValues,s=e.currentValues,c=e.currentVelocities,l=e.idealValues,h=e.idealVelocities;for(var f in o)if(Object.prototype.hasOwnProperty.call(o,f))if(a(o[f])||u(o[f]))this.animateValues({framesToCatchUp:t,currentFrameCompletion:i,springConfig:r,realValues:o[f],currentValues:s[f],currentVelocities:c[f],idealValues:l[f],idealVelocities:h[f]});else{for(var d=l[f],p=h[f],v=o[f],m=0;m<t;m++){var b;d=(b=n(1e3/60/1e3,d,p,v,r.stiffness,r.damping,r.precision))[0],p=b[1]}var g=n(1e3/60/1e3,d,p,v,r.stiffness,r.damping,r.precision),_=g[0],y=g[1];s[f]=d+(_-d)*i,c[f]=p+(y-p)*i,l[f]=d,h[f]=p}}}};function l(e){e.component("Motion",c)}"undefined"!=typeof window&&window.Vue&&window.Vue.use(l),l.presets=r;t.default=l,t.Motion=c,t.version="0.2.0",t.presets=r}(e={exports:{}},e.exports),e.exports);(t=i)&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")&&t.default;var n=i.Motion,r=(i.version,i.presets,{name:"TransformContainer",props:{transformValue:{default:0,type:Number},padding:{default:0,type:Number},orientation:{default:"vertical",type:String}},render:function(e,t){var i,r=this;return e(n,{props:{value:this.transformValue,tag:"div"},class:"viewport",style:{width:"100%",position:"relative",overflow:"hidden"},on:{},scopedSlots:{default:function(t){var n,o=t.value;return r.$emit("tick",o),e("div",{class:"transformcontainer",style:(i={transform:(n=o,"horizontal"===r.orientation?"translate3d("+n+"px, 0px, 0px)":"translate3d(0px, "+n+"px, 0px)"),display:"flex",flexDirection:"horizontal"===r.orientation?"row":"column",position:"absolute",width:"100%"},i["horizontal"===r.orientation?"left":"top"]=r.padding+"px",i)},r.$slots.default)}}})}}),o={name:"VirtualViewport",functional:!0,props:{index:{required:!0,type:Number},perPage:{required:!0,type:Number},orientation:{required:!0,type:String},offset:{type:Number,default:1}},render:function(e,t){var i=t.props,n=t.children,r=n.length,o=i.index,s=i.perPage,a=i.loop,u=i.offset,c=o<0?(r+o)%r:o%r,l=function(e,t){var i=0+e;return[[0-t],[0,i],[i,i+t]]}(s,u),h=0!==c||a?n.slice(c,r).concat(n.slice(0,c)):n,f={display:"flex",flexDirection:"horizontal"===i.orientation?"row":"column"};return[e("div",{class:"current",style:f},h.slice.apply(h,l[1])),e("div",{class:"after",style:f},h.slice.apply(h,l[2]))]}},s=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var i=-1;return e.some(function(e,n){return e[0]===t&&(i=n,!0)}),i}return function(){function t(){this.__entries__=[]}var i={size:{configurable:!0}};return i.size.get=function(){return this.__entries__.length},t.prototype.get=function(t){var i=e(this.__entries__,t),n=this.__entries__[i];return n&&n[1]},t.prototype.set=function(t,i){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=i:this.__entries__.push([t,i])},t.prototype.delete=function(t){var i=this.__entries__,n=e(i,t);~n&&i.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var i=0,n=this.__entries__;i<n.length;i+=1){var r=n[i];e.call(t,r[1],r[0])}},Object.defineProperties(t.prototype,i),t}()}(),a="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,u="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),c="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(u):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},l=2,h=["top","right","bottom","left","width","height","size","weight"],f="undefined"!=typeof MutationObserver,d=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var i=!1,n=!1,r=0;function o(){i&&(i=!1,e()),n&&a()}function s(){c(o)}function a(){var e=Date.now();if(i){if(e-r<l)return;n=!0}else i=!0,n=!1,setTimeout(s,t);r=e}return a}(this.refresh.bind(this),20)};d.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},d.prototype.removeObserver=function(e){var t=this.observers_,i=t.indexOf(e);~i&&t.splice(i,1),!t.length&&this.connected_&&this.disconnect_()},d.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},d.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},d.prototype.connect_=function(){a&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),f?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},d.prototype.disconnect_=function(){a&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},d.prototype.onTransitionEnd_=function(e){var t=e.propertyName;void 0===t&&(t=""),h.some(function(e){return!!~t.indexOf(e)})&&this.refresh()},d.getInstance=function(){return this.instance_||(this.instance_=new d),this.instance_},d.instance_=null;var p=function(e,t){for(var i=0,n=Object.keys(t);i<n.length;i+=1){var r=n[i];Object.defineProperty(e,r,{value:t[r],enumerable:!1,writable:!1,configurable:!0})}return e},v=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||u},m=x(0,0,0,0);function b(e){return parseFloat(e)||0}function g(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];return t.reduce(function(t,i){return t+b(e["border-"+i+"-width"])},0)}function _(e){var t=e.clientWidth,i=e.clientHeight;if(!t&&!i)return m;var n=v(e).getComputedStyle(e),r=function(e){for(var t={},i=0,n=["top","right","bottom","left"];i<n.length;i+=1){var r=n[i],o=e["padding-"+r];t[r]=b(o)}return t}(n),o=r.left+r.right,s=r.top+r.bottom,a=b(n.width),u=b(n.height);if("border-box"===n.boxSizing&&(Math.round(a+o)!==t&&(a-=g(n,"left","right")+o),Math.round(u+s)!==i&&(u-=g(n,"top","bottom")+s)),!function(e){return e===v(e).document.documentElement}(e)){var c=Math.round(a+o)-t,l=Math.round(u+s)-i;1!==Math.abs(c)&&(a-=c),1!==Math.abs(l)&&(u-=l)}return x(r.left,r.top,a,u)}var y="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof v(e).SVGGraphicsElement}:function(e){return e instanceof v(e).SVGElement&&"function"==typeof e.getBBox};function w(e){return a?y(e)?function(e){var t=e.getBBox();return x(0,0,t.width,t.height)}(e):_(e):m}function x(e,t,i,n){return{x:e,y:t,width:i,height:n}}var V=function(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=x(0,0,0,0),this.target=e};V.prototype.isActive=function(){var e=w(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},V.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e};var O=function(e,t){var i,n,r,o,s,a,u,c=(n=(i=t).x,r=i.y,o=i.width,s=i.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,u=Object.create(a.prototype),p(u,{x:n,y:r,width:o,height:s,top:r,right:n+o,bottom:s+r,left:n}),u);p(this,{target:e,contentRect:c})},S=function(e,t,i){if(this.activeObservations_=[],this.observations_=new s,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=i};S.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof v(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new V(e)),this.controller_.addObserver(this),this.controller_.refresh())}},S.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof v(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},S.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},S.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},S.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new O(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},S.prototype.clearActive=function(){this.activeObservations_.splice(0)},S.prototype.hasActive=function(){return this.activeObservations_.length>0};var T="undefined"!=typeof WeakMap?new WeakMap:new s,E=function(e){if(!(this instanceof E))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var t=d.getInstance(),i=new S(e,t,this);T.set(this,i)};["observe","unobserve","disconnect"].forEach(function(e){E.prototype[e]=function(){return(t=T.get(this))[e].apply(t,arguments);var t}});var z=void 0!==u.ResizeObserver?u.ResizeObserver:E,M={name:"RenderedSize",created:function(){var e=this;this.$nextTick(function(){e._computeSize(),new z(function(t,i){e._computeSize()}).observe(e.$el)})},methods:{_computeSize:function(){var e=this.$el;e&&this.$emit("changed",{width:e.scrollWidth,height:e.scrollHeight})}},render:function(e){if(this.$slots.default){var t=this.$slots.default[0],i=t.children||t.text;return e("span",{style:{position:"absolute",visibility:"hidden",left:"-10000px",top:"-10000px"}},[e(t.tag,t.data,i)])}}},A={name:"Slider",props:{perPage:{default:3,type:Number},current:{default:0,type:Number},viewportClass:{default:"",type:String},orientation:{default:"vertical",type:String},offset:{default:1,type:Number},loop:{default:!0,type:Boolean}},data:function(){return{index:0,isTransitioning:!1,effectiveTransform:0,elementSize:0}},computed:{canNext:function(){if(this.loop)return!0;var e=this.$slots.default.length;return this.index+this.perPage<e},canPrev:function(){return!!this.loop||this.index>0},transform:function(){return this.index*this.elementSizeValue+this.offset*this.elementSizeValue},effectiveIndex:function(){return Math.floor(-this.effectiveTransform/this.elementSizeValue)-this.offset},elementSizeValue:function(){return("horizontal"===this.orientation?this.elementSize.width:this.elementSize.height)||1},viewportSize:function(){return"horizontal"===this.orientation?{width:this.elementSize.width*this.perPage,height:this.elementSize.height}:{width:this.elementSize.width,height:this.elementSize.height*this.perPage}}},watch:{current:{immediate:!0,handler:function(e){this.index=e}},orientation:function(e){this.effectiveTransform=0},loop:function(e){this.index=this.current}},methods:{next:function(){this.index=this.canNext?this.index+1:this.index},prev:function(){this.index=this.canPrev>0?this.index-1:this.index}},render:function(e,t){var i=this,n=e(M,{on:{changed:function(e){i.elementSize=e}}},[this.$slots.default[0]]),s=e(r,{class:["viewport",this.viewportClass],on:{tick:function(e){i.effectiveTransform=e}},props:{transformValue:-this.transform,padding:this.effectiveIndex*this.elementSizeValue+this.offset*this.elementSizeValue,orientation:this.orientation}},[e(o,{props:{index:this.effectiveIndex,perPage:this.perPage,orientation:this.orientation}},this.$slots.default)]);return e("div",{class:{"slider-container":!0,"-cannext":this.canNext,"-canprev":this.canPrev,"-is-transitioning":this.isTransitioning},style:{position:"relative",height:this.viewportSize.height+"px",width:this.viewportSize.width+"px"}},[this.$scopedSlots.prev&&this.$scopedSlots.prev({canPrev:this.canPrev,prev:this.prev}),n,s,this.$scopedSlots.next&&this.$scopedSlots.next({canNext:this.canNext,next:this.next})])}};return function(e){e.component(A.name,A)}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VueVKeyboard=t()}(this,function(){"use strict";var e,t,i=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var i=[0,0];function n(e,t,n,r,o,s,a){var u=n+(-o*(t-r)+-s*n)*e,c=t+u*e;return Math.abs(u)<a&&Math.abs(c-r)<a?(i[0]=r,i[1]=0,i):(i[0]=c,i[1]=u,i)}var r={noWobble:{stiffness:170,damping:26,precision:.01},gentle:{stiffness:120,damping:14,precision:.01},wobbly:{stiffness:180,damping:12,precision:.01},stiff:{stiffness:210,damping:20,precision:.01}},o=window.requestAnimationFrame.bind(window),s=performance.now.bind(performance),a=Array.isArray.bind(Array),u=function(e){return null!==e&&"object"==typeof e},c={data:function(){return{currentValues:null,currentVelocities:null}},props:{value:Number,values:[Object,Array],tag:{type:String,default:"span"},spring:{type:[Object,String],default:"noWobble"}},computed:{springConfig:function(){return"string"==typeof this.spring?r[this.spring]:this.spring},realValues:function(){return null!=this.value?{value:this.value}:this.values}},render:function(e){return e(this.tag,[this.$scopedSlots.default(this.currentValues)])},watch:{realValues:function(e,t){t===e||this.wasAnimating||(this.prevTime=s(),this.accumulatedTime=0,this.animate())}},created:function(){var e=this.defineInitialValues(this.realValues,null);this.currentValues=e.values,this.currentVelocities=e.velocities},mounted:function(){this.prevTime=s(),this.accumulatedTime=0;var e=this.defineInitialValues(this.currentValues,this.currentVelocities);this.idealValues=e.values,this.idealVelocities=e.velocities,this.animate()},methods:{defineInitialValues:function(e,t){var i={},n={};return this.defineValues(e,t,i,n),{values:i,velocities:n}},defineValues:function(e,t,i,n){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a(e[r])||u(e[r])?(i[r]={},n[r]={},this.defineValues(e[r],t&&t[r],i[r],n[r])):(i[r]=e[r],n[r]=t?t[r]:0))},animate:function(){var e=this;this.animationId=o(function(){if(function e(t,i,n){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r))if(a(i[r])||u(i[r])){if(!e(t[r],i[r],n[r]))return!1}else{if(0!==n[r])return!1;if(t[r]!==i[r])return!1}return!0}(e.currentValues,e.realValues,e.currentVelocities))return e.wasAnimating&&e.$emit("motion-end"),e.animationId=null,void(e.wasAnimating=!1);e.wasAnimating||e.$emit("motion-start"),e.wasAnimating=!0;var t=s(),i=t-e.prevTime;if(e.prevTime=t,e.accumulatedTime+=i,e.accumulatedTime>1e3/60*10&&(e.accumulatedTime=0),0===e.accumulatedTime)return e.animationID=null,e.$emit("motion-restart"),void e.animate();var n=(e.accumulatedTime-Math.floor(e.accumulatedTime/(1e3/60))*(1e3/60))/(1e3/60),r=Math.floor(e.accumulatedTime/(1e3/60)),o=e.springConfig;e.animateValues({framesToCatchUp:r,currentFrameCompletion:n,springConfig:o,realValues:e.realValues,currentValues:e.currentValues,currentVelocities:e.currentVelocities,idealValues:e.idealValues,idealVelocities:e.idealVelocities}),e.animationID=null,e.accumulatedTime-=r*(1e3/60),e.animate()})},animateValues:function(e){var t=e.framesToCatchUp,i=e.currentFrameCompletion,r=e.springConfig,o=e.realValues,s=e.currentValues,c=e.currentVelocities,h=e.idealValues,l=e.idealVelocities;for(var f in o)if(Object.prototype.hasOwnProperty.call(o,f))if(a(o[f])||u(o[f]))this.animateValues({framesToCatchUp:t,currentFrameCompletion:i,springConfig:r,realValues:o[f],currentValues:s[f],currentVelocities:c[f],idealValues:h[f],idealVelocities:l[f]});else{for(var d=h[f],p=l[f],v=o[f],m=0;m<t;m++){var b;d=(b=n(1e3/60/1e3,d,p,v,r.stiffness,r.damping,r.precision))[0],p=b[1]}var g=n(1e3/60/1e3,d,p,v,r.stiffness,r.damping,r.precision),_=g[0],y=g[1];s[f]=d+(_-d)*i,c[f]=p+(y-p)*i,h[f]=d,l[f]=p}}}};function h(e){e.component("Motion",c)}"undefined"!=typeof window&&window.Vue&&window.Vue.use(h),h.presets=r;t.default=h,t.Motion=c,t.version="0.2.0",t.presets=r}(e={exports:{}},e.exports),e.exports);(t=i)&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")&&t.default;var n=i.Motion,r=(i.version,i.presets,{name:"TransformContainer",props:{transformValue:{default:0,type:Number},padding:{default:0,type:Number},orientation:{default:"vertical",type:String}},render:function(e,t){var i,r=this;return e(n,{props:{value:this.transformValue,tag:"div"},class:"viewport",style:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},on:{},scopedSlots:{default:function(t){var n,o=t.value;return r.$emit("tick",o),e("div",{class:"transformcontainer",style:(i={transform:(n=o,"horizontal"===r.orientation?"translate3d("+n+"px, 0px, 0px)":"translate3d(0px, "+n+"px, 0px)"),display:"flex",flexDirection:"horizontal"===r.orientation?"row":"column",position:"absolute",width:"100%"},i["horizontal"===r.orientation?"left":"top"]=r.padding+"px",i)},r.$slots.default)}}})}}),o={name:"VirtualViewport",functional:!0,props:{index:{required:!0,type:Number},perPage:{required:!0,type:Number},orientation:{required:!0,type:String},offset:{type:Number,default:1}},render:function(e,t){var i=t.props,n=t.children,r=n.length,o=i.index,s=i.perPage,a=i.loop,u=i.offset,c=o<0?(r+o)%r:o%r,h=function(e,t){var i=0+e;return[[0-t],[0,i],[i,i+t]]}(s,u),l=0!==c||a?n.slice(c,r).concat(n.slice(0,c)):n,f={display:"flex",flexDirection:"horizontal"===i.orientation?"row":"column"};return[e("div",{class:"current",style:f},l.slice.apply(l,h[1])),e("div",{class:"after",style:f},l.slice.apply(l,h[2]))]}},s=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var i=-1;return e.some(function(e,n){return e[0]===t&&(i=n,!0)}),i}return function(){function t(){this.__entries__=[]}var i={size:{configurable:!0}};return i.size.get=function(){return this.__entries__.length},t.prototype.get=function(t){var i=e(this.__entries__,t),n=this.__entries__[i];return n&&n[1]},t.prototype.set=function(t,i){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=i:this.__entries__.push([t,i])},t.prototype.delete=function(t){var i=this.__entries__,n=e(i,t);~n&&i.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var i=0,n=this.__entries__;i<n.length;i+=1){var r=n[i];e.call(t,r[1],r[0])}},Object.defineProperties(t.prototype,i),t}()}(),a="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,u="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),c="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(u):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},h=2,l=["top","right","bottom","left","width","height","size","weight"],f="undefined"!=typeof MutationObserver,d=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var i=!1,n=!1,r=0;function o(){i&&(i=!1,e()),n&&a()}function s(){c(o)}function a(){var e=Date.now();if(i){if(e-r<h)return;n=!0}else i=!0,n=!1,setTimeout(s,t);r=e}return a}(this.refresh.bind(this),20)};d.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},d.prototype.removeObserver=function(e){var t=this.observers_,i=t.indexOf(e);~i&&t.splice(i,1),!t.length&&this.connected_&&this.disconnect_()},d.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},d.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},d.prototype.connect_=function(){a&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),f?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},d.prototype.disconnect_=function(){a&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},d.prototype.onTransitionEnd_=function(e){var t=e.propertyName;void 0===t&&(t=""),l.some(function(e){return!!~t.indexOf(e)})&&this.refresh()},d.getInstance=function(){return this.instance_||(this.instance_=new d),this.instance_},d.instance_=null;var p=function(e,t){for(var i=0,n=Object.keys(t);i<n.length;i+=1){var r=n[i];Object.defineProperty(e,r,{value:t[r],enumerable:!1,writable:!1,configurable:!0})}return e},v=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||u},m=x(0,0,0,0);function b(e){return parseFloat(e)||0}function g(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];return t.reduce(function(t,i){return t+b(e["border-"+i+"-width"])},0)}function _(e){var t=e.clientWidth,i=e.clientHeight;if(!t&&!i)return m;var n=v(e).getComputedStyle(e),r=function(e){for(var t={},i=0,n=["top","right","bottom","left"];i<n.length;i+=1){var r=n[i],o=e["padding-"+r];t[r]=b(o)}return t}(n),o=r.left+r.right,s=r.top+r.bottom,a=b(n.width),u=b(n.height);if("border-box"===n.boxSizing&&(Math.round(a+o)!==t&&(a-=g(n,"left","right")+o),Math.round(u+s)!==i&&(u-=g(n,"top","bottom")+s)),!function(e){return e===v(e).document.documentElement}(e)){var c=Math.round(a+o)-t,h=Math.round(u+s)-i;1!==Math.abs(c)&&(a-=c),1!==Math.abs(h)&&(u-=h)}return x(r.left,r.top,a,u)}var y="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof v(e).SVGGraphicsElement}:function(e){return e instanceof v(e).SVGElement&&"function"==typeof e.getBBox};function w(e){return a?y(e)?function(e){var t=e.getBBox();return x(0,0,t.width,t.height)}(e):_(e):m}function x(e,t,i,n){return{x:e,y:t,width:i,height:n}}var V=function(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=x(0,0,0,0),this.target=e};V.prototype.isActive=function(){var e=w(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},V.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e};var O=function(e,t){var i,n,r,o,s,a,u,c=(n=(i=t).x,r=i.y,o=i.width,s=i.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,u=Object.create(a.prototype),p(u,{x:n,y:r,width:o,height:s,top:r,right:n+o,bottom:s+r,left:n}),u);p(this,{target:e,contentRect:c})},S=function(e,t,i){if(this.activeObservations_=[],this.observations_=new s,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=i};S.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof v(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new V(e)),this.controller_.addObserver(this),this.controller_.refresh())}},S.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof v(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},S.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},S.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},S.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new O(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},S.prototype.clearActive=function(){this.activeObservations_.splice(0)},S.prototype.hasActive=function(){return this.activeObservations_.length>0};var T="undefined"!=typeof WeakMap?new WeakMap:new s,E=function(e){if(!(this instanceof E))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var t=d.getInstance(),i=new S(e,t,this);T.set(this,i)};["observe","unobserve","disconnect"].forEach(function(e){E.prototype[e]=function(){return(t=T.get(this))[e].apply(t,arguments);var t}});var z=void 0!==u.ResizeObserver?u.ResizeObserver:E,M={name:"RenderedSize",created:function(){var e=this;this.$nextTick(function(){e._computeSize(),new z(function(t,i){e._computeSize()}).observe(e.$el)})},methods:{_computeSize:function(){var e=this.$el;e&&this.$emit("changed",{width:e.scrollWidth,height:e.scrollHeight})}},render:function(e){if(this.$slots.default){var t=this.$slots.default[0],i=t.children||t.text;return e("span",{style:{position:"absolute",visibility:"hidden",left:"-10000px",top:"-10000px"}},[e(t.tag,t.data,i)])}}},A={name:"Slider",props:{perPage:{default:3,type:Number},current:{default:0,type:Number},viewportClass:{default:"",type:String},orientation:{default:"vertical",type:String},offset:{default:1,type:Number},loop:{default:!0,type:Boolean}},data:function(){return{index:0,isTransitioning:!1,effectiveTransform:0,elementSize:0}},computed:{canNext:function(){if(this.loop)return!0;var e=this.$slots.default.length;return this.index+this.perPage<e},canPrev:function(){return!!this.loop||this.index>0},transform:function(){return this.index*this.elementSizeValue+this.offset*this.elementSizeValue},effectiveIndex:function(){return Math.floor(-this.effectiveTransform/this.elementSizeValue)-this.offset},elementSizeValue:function(){return("horizontal"===this.orientation?this.elementSize.width:this.elementSize.height)||1},viewportSize:function(){return"horizontal"===this.orientation?{width:this.elementSize.width*this.perPage,height:this.elementSize.height}:{width:this.elementSize.width,height:this.elementSize.height*this.perPage}}},watch:{current:{immediate:!0,handler:function(e){this.index=e}},orientation:function(e){this.effectiveTransform=0},loop:function(e){this.index=this.current}},methods:{next:function(){this.index=this.canNext?this.index+1:this.index},prev:function(){this.index=this.canPrev>0?this.index-1:this.index}},render:function(e,t){var i=this,n=e(M,{on:{changed:function(e){i.elementSize=e}}},[this.$slots.default[0]]),s=e(r,{class:["viewport",this.viewportClass],on:{tick:function(e){i.effectiveTransform=e}},props:{transformValue:-this.transform,padding:this.effectiveIndex*this.elementSizeValue+this.offset*this.elementSizeValue,orientation:this.orientation}},[e(o,{props:{index:this.effectiveIndex,perPage:this.perPage,orientation:this.orientation}},this.$slots.default)]);return e("div",{class:{"slider-container":!0,"-cannext":this.canNext,"-canprev":this.canPrev,"-is-transitioning":this.isTransitioning},style:{position:"relative",height:this.viewportSize.height+"px",width:"horizontal"===this.orientation?this.viewportSize.width+"px":void 0}},[this.$scopedSlots.prev&&this.$scopedSlots.prev({canPrev:this.canPrev,prev:this.prev}),n,s,this.$scopedSlots.next&&this.$scopedSlots.next({canNext:this.canNext,next:this.next})])}};return function(e){e.component(A.name,A)}}); | ||
//# sourceMappingURL=vue-sliderx.min.js.map |
{ | ||
"name": "vue-sliderx", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Virtual Slider", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-sliderx.cjs.js", |
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
150206
2048