@egjs/flicking
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -1,14 +0,35 @@ | ||
# 2.1.0 release (2017-09-27) | ||
# 2.2.0 release (2018-01-30) | ||
## Features : | ||
## Bug Fixes : | ||
- **Event** | ||
- Intent to ship event.isTrusted (#45) ([#41](https://github.com/naver/egjs-flicking/issues/41)) | ||
- Set to null e.distance on API call ([#64](https://github.com/naver/egjs-flicking/issues/64)) | ||
- **Utils** | ||
- Correct getting panel's dimension ([#52](https://github.com/naver/egjs-flicking/issues/52)) | ||
## Documents : | ||
- **All** | ||
- Reinforce API description ([#59](https://github.com/naver/egjs-flicking/issues/59)) | ||
## Code Styles : | ||
- **Flicking** | ||
- Mark physical as deprecated ([#61](https://github.com/naver/egjs-flicking/issues/61)) | ||
- **Utils** | ||
- Remove outdated .isHWAccelerable() ([#66](https://github.com/naver/egjs-flicking/issues/66)) | ||
- **D.ts** | ||
- Add return types ([#57](https://github.com/naver/egjs-flicking/issues/57)) | ||
## Refactorings : | ||
- **Flicking** | ||
- Remove .getTotalCount() ([#69](https://github.com/naver/egjs-flicking/issues/69)) | ||
## Chore tasks : | ||
- **Dependency** | ||
- Update dependencies ([#46](https://github.com/naver/egjs-flicking/issues/46)) | ||
- **Flicking.d.ts** | ||
- Add type definition ([#35](https://github.com/naver/egjs-flicking/issues/35)) | ||
- **Flicking** | ||
- Update egjs-axes to 2.4.2 ([#72](https://github.com/naver/egjs-flicking/issues/72)) |
@@ -0,0 +0,0 @@ # How to contribute to egjs-flicking |
@@ -8,5 +8,5 @@ /*! | ||
* | ||
* @version 2.1.0 | ||
* @version 2.2.0 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@egjs/component"),require("@egjs/axes")):"function"==typeof define&&define.amd?define("Flicking",["@egjs/component","@egjs/axes"],e):"object"==typeof exports?exports.Flicking=e(require("@egjs/component"),require("@egjs/axes")):(t.eg=t.eg||{},t.eg.Flicking=e(t.eg.Component,t.eg.Axes))}(this,function(t,e){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(t,e,n){"use strict";e.__esModule=!0;var i="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof self&&(self.Math===Math?self:Function("return this")()),o=i.document;e.window=i,e.document=o},function(t,e,n){"use strict";e.__esModule=!0,e.DATA_HEIGHT=e.IS_ANDROID2=e.SUPPORT_WILLCHANGE=e.TRANSFORM=e.EVENTS=undefined;var i=n(0),o={beforeFlickStart:"beforeFlickStart",beforeRestore:"beforeRestore",flick:"flick",flickEnd:"flickEnd",restore:"restore"},r={name:"transform"};r.support=function(){var t=i.document.documentElement.style;return r.name in t||(r.name="webkitTransform")in t}();var s=i.window.CSS&&i.window.CSS.supports&&i.window.CSS.supports("will-change","transform"),a=/Android 2\./.test(navigator.userAgent);e.EVENTS=o,e.TRANSFORM=r,e.SUPPORT_WILLCHANGE=s,e.IS_ANDROID2=a,e.DATA_HEIGHT="data-height"},function(t,e,n){"use strict";var i=n(3),o=function(t){return t&&t.__esModule?t:{"default":t}}(i);o["default"].VERSION="2.1.0",t.exports=o["default"]},function(t,e,n){"use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{"default":t}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var i=n(4),o=_interopRequireDefault(i),r=n(5),s=_interopRequireDefault(r),a=n(6),l=n(1),c=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}(l),u=n(7),p=n(0),h=n(8),d=_interopRequireDefault(h),f=function(t){function Flicking(e,n,i){_classCallCheck(this,Flicking);var o=_possibleConstructorReturn(this,t.call(this));o.$wrapper=a.utils.$(e);var r=o.$wrapper&&o.$wrapper.children;if(!o.$wrapper||!r||!r.length)throw new Error("Given base element doesn't exist or it hasn't proper DOM structure to be initialized.");return o._setOptions(n),o._setConfig(r,i),!a.utils.hasClickBug()&&(o._setPointerEvents=function(){}),o._build(),o._bindEvents(!0),o._applyPanelsCss(),o._arrangePanels(),o.options.hwAccelerable&&c.SUPPORT_WILLCHANGE&&o._setHint(),o.options.adaptiveHeight&&o._setAdaptiveHeight(),o._adjustContainerCss("end"),o}return _inherits(Flicking,t),Flicking.prototype._setOptions=function(t){var e={previewPadding:[0,0],bounce:[10,10]};this.options=a.utils.extend(a.utils.extend({},u.OPTIONS),e,t);for(var n in e){var i=this.options[n];"number"==typeof i?i=[i,i]:a.utils.isArray(i)||(i=e[n]),this.options[n]=i}},Flicking.prototype._setConfig=function(t,e){var n=this.options,i=n.previewPadding,o=t;a.utils.classList(o[0],n.prefix+"-container")&&(o=o[0],this.$container=o,o=o.children),o=[].slice.call(o);var r=this._conf=a.utils.extend(a.utils.extend({},u.CONFIG),{panel:{$list:o,minCount:i[0]+i[1]>0?5:3},origPanelStyle:{wrapper:{className:this.$wrapper.getAttribute("class")||null,style:this.$wrapper.getAttribute("style")||null},container:{className:this.$container&&this.$container.getAttribute("class")||null,style:this.$container&&this.$container.getAttribute("style")||null},list:o.map(function(t){return{className:t.getAttribute("class")||null,style:t.getAttribute("style")||null}})},useLayerHack:n.hwAccelerable&&!c.SUPPORT_WILLCHANGE,eventPrefix:e||""});[["LEFT","RIGHT"],["UP","DOWN"]][+!n.horizontal].forEach(function(t){return r.dirData.push(s["default"]["DIRECTION_"+t])})},Flicking.prototype._build=function(){var t=this._conf.panel,e=this.options,n=t.$list,i=e.previewPadding.concat(),o=e.prefix,r=e.horizontal,l=t.count=t.origCount=n.length,c=e.bounce;this._setPadding(i,!0);var u=this._getDataByDirection([t.size,"100%"]),h={position:"relative",zIndex:2e3,width:"100%",height:"100%"};if(r&&(h.top="0px"),this.$container)a.utils.css(this.$container,h);else{var d=n[0].parentNode,f=p.document.createElement("div");f.className=o+"-container",a.utils.css(f,h),n.forEach(function(t){return f.appendChild(t)}),d.appendChild(f),this.$container=f}n.forEach(function(t){a.utils.classList(t,o+"-panel",!0),a.utils.css(t,{position:"absolute",width:a.utils.getUnitValue(u[0]),height:a.utils.getUnitValue(u[1]),boxSizing:"border-box",top:0,left:0})}),this._addClonePanels()&&(l=t.count=(t.$list=[].slice.call(this.$container.children)).length),this._axesInst=new s["default"]({flick:{range:[0,t.size*(l-1)],bounce:c}},{easing:e.panelEffect,deceleration:e.deceleration,interruptable:!1}),this._setDefaultPanel(e.defaultIndex)},Flicking.prototype._setPadding=function(t,e){var n=this.options.horizontal,i=this._conf.panel,o=t[0]+t[1],r={};!o&&e||(r.padding=n?"0 "+t.reverse().join("px 0 ")+"px":t.join("px 0 ")+"px"),e&&(r.overflow="hidden",r.boxSizing="border-box"),Object.keys(r).length&&a.utils.css(this.$wrapper,r);var s=getComputedStyle(this.$wrapper),l=n?["Left","Right"]:["Top","Bottom"],c=Math.max(this.$wrapper["offset"+(n?"Width":"Height")],a.utils.getNumValue(s[n?"width":"height"]));i.size=c-(a.utils.getNumValue(s["padding"+l[0]])+a.utils.getNumValue(s["padding"+l[1]]))},Flicking.prototype._addClonePanels=function(){var t=this,e=this._conf.panel,n=e.origCount,i=e.minCount-n,o=e.$list,r=void 0;if(this.options.circular&&n<e.minCount){for(r=o.map(function(t){return t.cloneNode(!0)});r.length<i;)r=r.concat(o.map(function(t){return t.cloneNode(!0)}));return r.forEach(function(e){return t.$container.appendChild(e)}),!!r.length}return!1},Flicking.prototype._movePanelPosition=function(t,e){var n=this._conf.panel,i=n.$list,o=i.splice(e?0:n.count-t,t);n.$list=e?i.concat(o):o.concat(i)},Flicking.prototype._setDefaultPanel=function(t){var e=this._conf.panel,n=e.count-1,i=void 0,o=void 0;this.options.circular?(t>0&&t<=n&&this._movePanelPosition(t,!0),o=this._getBasePositionIndex(),this._movePanelPosition(o,!1),this._setPanelNo({no:t,currNo:t})):t>0&&t<=n&&(this._setPanelNo({index:t,no:t,currIndex:t,currNo:t}),i=[-e.size*t,0],this._setTranslate(i),this._setAxes("setTo",Math.abs(i[0]),0))},Flicking.prototype._arrangePanels=function(t,e){var n=this._conf,i=n.panel,o=n.touch,r=n.dirData,s=void 0;this.options.circular&&(n.customEvent.flick=!1,t&&(e&&(o.direction=r[+!(e>0)]),this._arrangePanelPosition(o.direction,e)),s=this._getBasePositionIndex(),this._setPanelNo({index:s,currIndex:s}),n.customEvent.flick=!!this._setAxes("setTo",i.size*i.index,0)),this._applyPanelsPos()},Flicking.prototype._applyPanelsPos=function(){this._conf.panel.$list.forEach(this._applyPanelsCss.bind(this))},Flicking.prototype._setMoveStyle=function(t,e){var n=c.TRANSFORM;this._setMoveStyle=n.support?function(t,e){var i;a.utils.css(t,(i={},i[n.name]=a.utils.translate(e[0],e[1],this._conf.useLayerHack),i))}:function(t,e){a.utils.css(t,{left:e[0],top:e[1]})},this._setMoveStyle(t,e)},Flicking.prototype._applyPanelsCss=function(){var t=this._conf;c.IS_ANDROID2?(t.$dummyAnchor=a.utils.$(".__dummy_anchor"),!t.$dummyAnchor&&this.$wrapper.appendChild(t.$dummyAnchor=a.utils.$('<a href="javascript:void(0)" class="__dummy_anchor" style="position:absolute;height:0px;width:0px">')),this._applyPanelsCss=function(t,e){var n=this._getDataByDirection([this._conf.panel.size*e+"px",0]);a.utils.css(t,{left:n[0],top:n[1]})}):this._applyPanelsCss=function(t,e){var n=this._getDataByDirection([c.TRANSFORM.support?100*e+"%":this._conf.panel.size*e+"px",0]);this._setMoveStyle(t,n)}},Flicking.prototype._adjustContainerCss=function(t,e){var n=this._conf,i=n.panel,o=this.options,r=o.horizontal,s=o.previewPadding[0],l=this.$container,u=e,p=void 0;if(c.IS_ANDROID2)if(u||(u=-i.size*i.index),"start"===t)l=l.style,p=parseInt(l[r?"left":"top"],10),r?p&&(l.left="0px"):p!==s&&(l.top="0px"),this._setTranslate([-u,0]);else if("end"===t){var h;u=this._getCoordsValue([u,0]),a.utils.css(l,(h={left:u.x,top:u.y},h[c.TRANSFORM.name]=a.utils.translate(0,0,n.useLayerHack),h)),n.$dummyAnchor.focus()}},Flicking.prototype._setAxes=function(t,e,n){return this._axesInst[t]({flick:e},n)},Flicking.prototype._setHint=function(){var t={willChange:"transform"};a.utils.css(this.$container,t),a.utils.css(this._conf.panel.$list,t)},Flicking.prototype._getDataByDirection=function(t){var e=t.concat();return!this.options.horizontal&&e.reverse(),e},Flicking.prototype._arrangePanelPosition=function(t,e){var n=t===this._conf.dirData[0];this._movePanelPosition(Math.abs(e||1),n)},Flicking.prototype._getBasePositionIndex=function(){return Math.floor(this._conf.panel.count/2-.1)},Flicking.prototype._bindEvents=function(t){var e=this.options,n=this.$wrapper,i=this._axesInst;t?(this._panInput=new s["default"].PanInput(n,{inputType:e.inputType,thresholdAngle:e.thresholdAngle,scale:this._getDataByDirection([-1,0])}),i.on({hold:this._holdHandler.bind(this),change:this._changeHandler.bind(this),release:this._releaseHandler.bind(this),animationStart:this._animationStartHandler.bind(this),animationEnd:this._animationEndHandler.bind(this)}).connect(this._getDataByDirection(["flick",""]),this._panInput)):(this.disableInput(),i.off())},Flicking.prototype._setAdaptiveHeight=function(t){var e=this._conf,n=e.indexToMove,i=void 0,o=void 0,r=0===n?this["get"+(t===s["default"].DIRECTION_LEFT&&"Next"||t===s["default"].DIRECTION_RIGHT&&"Prev"||"")+"Element"]():e.panel.$list[e.panel.currIndex+n],l=r.querySelector(":first-child");l&&(o=l.getAttribute(c.DATA_HEIGHT),o||(i=r.children,(o=a.utils.outerHeight(i.length>1?(r.style.height="auto",r):l))>0&&l.setAttribute(c.DATA_HEIGHT,o)),o>0&&(this.$wrapper.style.height=o+"px"))},Flicking.prototype._triggerBeforeRestore=function(t){var e=this._conf,n=e.touch;n.direction=+e.dirData.join("").replace(n.direction,""),e.customEvent.restore=this._triggerEvent(c.EVENTS.beforeRestore,{depaPos:t.depaPos.flick,destPos:t.destPos.flick}),e.customEvent.restore||("stop"in t&&t.stop(),e.panel.animating=!1)},Flicking.prototype._triggerRestore=function(){var t=this._conf.customEvent;t.restore&&this._triggerEvent(c.EVENTS.restore),t.restore=t.restoreCall=!1},Flicking.prototype._setPhaseValue=function(t,e){var n=this._conf,i=this.options,o=n.panel;if("start"===t&&(o.changed=this._isMovable())){if(!this._triggerEvent(c.EVENTS.beforeFlickStart,e))return o.changed=o.animating=!1,!1;i.adaptiveHeight&&this._setAdaptiveHeight(n.touch.direction),0===n.indexToMove&&this._setPanelNo()}else"end"===t&&(i.circular&&o.changed&&this._arrangePanels(!0,n.indexToMove),!c.IS_ANDROID2&&this._setTranslate([-o.size*o.index,0]),n.touch.distance=n.indexToMove=0,o.changed&&this._triggerEvent(c.EVENTS.flickEnd));return this._adjustContainerCss(t),!0},Flicking.prototype._getNumByDirection=function(){var t=this._conf;return t.touch.direction===t.dirData[0]?1:-1},Flicking.prototype._revertPanelNo=function(){var t=this._conf.panel,e=this._getNumByDirection(),n=t.currIndex>=0?t.currIndex:t.index-e,i=t.currNo>=0?t.currNo:t.no-e;this._setPanelNo({index:n,no:i})},Flicking.prototype._setPanelNo=function(t){var e=this._conf.panel,n=e.origCount-1,i=this._getNumByDirection();if(a.utils.isObject(t))for(var o in t)e[o]=t[o];else e.currIndex=e.index,e.currNo=e.no,e.index+=i,e.no+=i;e.no>n?e.no=0:e.no<0&&(e.no=n)},Flicking.prototype._setPointerEvents=function(t){var e=a.utils.css(this.$container,"pointerEvents"),n=void 0;t&&t.holding&&t.inputEvent&&t.inputEvent.preventSystemEvent&&"none"!==e?n="none":t||"auto"===e||(n="auto"),n&&a.utils.css(this.$container,{pointerEvents:n})},Flicking.prototype._getCoordsValue=function(t){var e=this._getDataByDirection(t);return{x:a.utils.getUnitValue(e[0]),y:a.utils.getUnitValue(e[1])}},Flicking.prototype._setTranslate=function(t){var e=this._getCoordsValue(t);this._setMoveStyle(this.$container,[e.x,e.y])},Flicking.prototype._isMovable=function(){var t=this.options,e=this._axesInst,n=Math.abs(this._conf.touch.distance)>=t.threshold,i=void 0,o=void 0;return!(!t.circular&&n&&(i=e.axis.flick.range[1],(o=e.get().flick)<0||o>i))&&n},Flicking.prototype._triggerEvent=function(t,e){var n=this._conf,i=n.panel;return t===c.EVENTS.flickEnd&&(i.currNo=i.no,i.currIndex=i.index),this.trigger(n.eventPrefix+t,a.utils.extend({eventType:t,index:i.currIndex,no:i.currNo,direction:n.touch.direction,isTrusted:n.touch.isTrusted},e))},Flicking.prototype._getElement=function(t,e,n){var i=this._conf.panel,o=this.options.circular,r=i.currIndex,s=t===this._conf.dirData[0],a=null,l=void 0,c=void 0;n?(l=i.count,c=r):(l=i.origCount,c=i.currNo);var u=c;return s?c<l-1?c++:o&&(c=0):c>0?c--:o&&(c=l-1),u!==c&&(a=e?i.$list[s?r+1:r-1]:c),a},Flicking.prototype._setValueToMove=function(t){var e=this._conf;e.touch.distance=this.options.threshold+1,e.touch.direction=e.dirData[+!t]},Flicking.prototype.getIndex=function(t){return this._conf.panel[t?"currIndex":"currNo"]},Flicking.prototype.getElement=function(){var t=this._conf.panel;return t.$list[t.currIndex]},Flicking.prototype.getNextElement=function(){return this._getElement(this._conf.dirData[0],!0)},Flicking.prototype.getNextIndex=function(t){return this._getElement(this._conf.dirData[0],!1,t)},Flicking.prototype.getAllElements=function(){return this._conf.panel.$list},Flicking.prototype.getPrevElement=function(){return this._getElement(this._conf.dirData[1],!0)},Flicking.prototype.getPrevIndex=function(t){return this._getElement(this._conf.dirData[1],!1,t)},Flicking.prototype.getTotalCount=function(t){return this._conf.panel[t?"count":"origCount"]},Flicking.prototype.isPlaying=function(){return this._conf.panel.animating},Flicking.prototype._movePanel=function(t,e){var n=this._conf,i=n.panel,o=this.options;return i.animating||n.touch.holding?undefined:(this._setValueToMove(t),(o.circular||null!==this["get"+(t?"Next":"Prev")+"Index"]())&&this._movePanelByPhase("setBy",i.size*(t?1:-1),e),this)},Flicking.prototype._movePanelByPhase=function(t,e,n){var i=a.utils.getNumValue(n,this.options.duration);!1!==this._setPhaseValue("start")&&(this._setAxes(t,e,i),!i&&this._setPhaseValue("end"))},Flicking.prototype.next=function(t){return this._movePanel(!0,t)},Flicking.prototype.prev=function(t){return this._movePanel(!1,t)},Flicking.prototype.moveTo=function(t,e){var n=this._conf,i=n.panel,o=this.options.circular,r=i.index,s=void 0,l=void 0,c=t;return(c=a.utils.getNumValue(c,-1))<0||c>=i.origCount||c===i.no||i.animating||n.touch.holding?this:(s=c-(o?i.no:r),l=s>0,o&&Math.abs(s)>(l?i.count-(r+1):r)&&(s+=(l?-1:1)*i.count,l=s>0),this._setPanelNo(o?{no:c}:{no:c,index:c}),this._conf.indexToMove=s,this._setValueToMove(l),this._movePanelByPhase(o?"setBy":"setTo",i.size*(o?s:c),e),this)},Flicking.prototype.resize=function(){var t=this._conf,e=this.options,n=t.panel,i=e.horizontal,o=void 0;if(!this.isPlaying()){var r;a.utils.isArray(e.previewPadding)&&"number"==typeof+e.previewPadding.join("")?(this._setPadding(e.previewPadding.concat()),o=n.size):i&&(o=n.size=a.utils.css(this.$wrapper,"width",!0));var s=o*(n.count-1),l=this._getDataByDirection([s,0]);if(i&&a.utils.css(this.$container,{width:l[0]+o+"px"}),a.utils.css(n.$list,(r={},r[i?"width":"height"]=a.utils.getUnitValue(o),r)),e.adaptiveHeight){var u=this.$container.querySelectorAll("["+c.DATA_HEIGHT+"]");u.length&&([].slice.call(u).forEach(function(t){return t.removeAttribute(c.DATA_HEIGHT)}),this._setAdaptiveHeight())}this._axesInst.axis.flick.range=[0,s],this._setAxes("setTo",o*n.index,0),c.IS_ANDROID2&&(this._applyPanelsPos(),this._adjustContainerCss("end"))}return this},Flicking.prototype.restore=function(t){var e=this._conf,n=e.panel,i=this._axesInst.get().flick,o=t,r=void 0;return i!==n.currIndex*n.size?(e.customEvent.restoreCall=!0,o=a.utils.getNumValue(o,this.options.duration),this._revertPanelNo(),r=n.size*n.index,this._triggerBeforeRestore({depaPos:i,destPos:r}),this._setAxes("setTo",r,o),o||(this._adjustContainerCss("end"),this._triggerRestore())):n.changed&&(this._revertPanelNo(),e.touch.distance=e.indexToMove=0),this},Flicking.prototype.enableInput=function(){return this._panInput.enable(),this},Flicking.prototype.disableInput=function(){return this._panInput.disable(),this},Flicking.prototype.getStatus=function(t){var e=this._conf.panel,n=/((?:-webkit-)?transform|left|top|will-change|box-sizing|width):[^;]*;/g,i={panel:{index:e.index,no:e.no,currIndex:e.currIndex,currNo:e.currNo},$list:e.$list.map(function(t){return{style:t.style.cssText.replace(n,"").trim(),className:t.className,html:t.innerHTML}})};return t?JSON.stringify(i):i},Flicking.prototype.setStatus=function(t){var e=this._conf.panel,n=this.options.adaptiveHeight,i="string"==typeof t?JSON.parse(t):t;if(i){for(var o in i.panel)o in e&&(e[o]=i.panel[o]);e.$list.forEach(function(t,e){var n=i.$list[e],o=n.style,r=n.className,s=n.html;o&&(t.style.cssText+=o),r&&(t.className=r),s&&(t.innerHTML=s)}),n&&this._setAdaptiveHeight()}},Flicking.prototype.destroy=function(){var t=this._conf,e=t.origPanelStyle,n=e.wrapper,i=e.container,o=e.list,r=this.$wrapper;r.setAttribute("class",n.className),r[n.style?"setAttribute":"removeAttribute"]("style",n.style);var s=this.$container,a=[].slice.call(s.children);e.container.className?(s.setAttribute("class",i.className),s[i.style?"setAttribute":"removeAttribute"]("style",i.style)):(a.forEach(function(t){return r.appendChild(t)}),s.parentNode.removeChild(s));for(var l,c=0;l=a[c];c++)if(c>o.length-1)l.parentNode.removeChild(l);else{var u=o[c].className,p=o[c].style;l[u?"setAttribute":"removeAttribute"]("class",u),l[p?"setAttribute":"removeAttribute"]("style",p)}this._bindEvents(!1),this.off(),this._axesInst.destroy(),this._panInput.destroy();for(var h in this)this[h]=null},Flicking}((0,a.Mixin)(o["default"])["with"](d["default"]));f.DIRECTION_NONE=s["default"].DIRECTION_NONE,f.DIRECTION_LEFT=s["default"].DIRECTION_LEFT,f.DIRECTION_RIGHT=s["default"].DIRECTION_RIGHT,f.DIRECTION_UP=s["default"].DIRECTION_UP,f.DIRECTION_DOWN=s["default"].DIRECTION_DOWN,f.DIRECTION_HORIZONTAL=s["default"].DIRECTION_HORIZONTAL,f.DIRECTION_VERTICAL=s["default"].DIRECTION_VERTICAL,f.DIRECTION_ALL=s["default"].DIRECTION_ALL,e["default"]=f,t.exports=e["default"]},function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0,e.Mixin=e.utils=undefined;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(0),r={$:function(t){var e=null;if("string"==typeof t){var n=t.match(/^<([a-z]+)\s*([^>]*)>/);n?(e=o.document.createElement(n[1]),3===n.length&&n[2].split(" ").forEach(function(t){var n=t.split("=");e.setAttribute(n[0],n[1].trim().replace(/(^["']|["']$)/g,""))})):(e=o.document.querySelectorAll(t),e.length?1===e.length&&(e=e[0]):e=null)}else t.nodeName&&1===t.nodeType&&(e=t);return e},isArray:function(t){return t&&t.constructor===Array},isObject:function(t){return t&&!t.nodeType&&"object"===(void 0===t?"undefined":i(t))&&!this.isArray(t)},extend:function(t){for(var e=this,n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];if(!i.length||1===i.length&&!i[0])return t;var r=i.shift();return this.isObject(t)&&this.isObject(r)&&Object.keys(r).forEach(function(n){var i=r[n];e.isObject(i)?(!t[n]&&(t[n]={}),t[n]=e.extend(t[n],i)):t[n]=e.isArray(i)?i.concat():i}),this.extend.apply(this,[t].concat(i))},css:function(t,e,n){if("string"==typeof e){var i=o.window.getComputedStyle(t)[e];return n?this.getNumValue(i):i}var r=function(t,e){return Object.keys(e).forEach(function(n){t[n]=e[n]})};return this.isArray(t)?t.forEach(function(t){return r(t.style,e)}):r(t.style,e),t},classList:function(t,e,n){var i="boolean"==typeof n,o=void 0;return t.classList?o=t.classList[i&&(n?"add":"remove")||"contains"](e):(o=t.className,i?n&&-1===o.indexOf(e)?o=t.className=(o+" "+e).replace(/\s{2,}/g," "):n||(o=t.className=o.replace(e,"")):o=new RegExp("\\b"+e+"\\b").test(o)),o},getNumValue:function(t,e){var n=t;return isNaN(n=parseInt(n,10))?e:n},getUnitValue:function(t){var e=/(?:[a-z]{2,}|%)$/;return(parseInt(t,10)||0)+(String(t).match(e)||"px")},getOuter:function(t,e){var n=o.window.getComputedStyle(t),i="outerWidth"===e?["marginLeft","marginRight"]:["marginTop","marginBottom"];return this.getNumValue(n[e.replace("outer","").toLocaleLowerCase()])+this.getNumValue(n[i[0]])+this.getNumValue(n[i[1]])},outerWidth:function(t){return this.getOuter(t,"outerWidth")},outerHeight:function(t){return this.getOuter(t,"outerHeight")},isHWAccelerable:function(){var t=o.window.navigator.userAgent,e=!1,n=void 0;if(n=t.match(/Chrome\/(\d+)/))e=n[1]>="25";else if(/ie|edge|firefox|safari|inapp/.test(t))e=!0;else if(n=t.match(/Android ([\d.]+)/)){var i=n[1],r=(t.match(/\(.*\)/)||[null])[0];e=i>="4.1.0"&&!/EK-GN120|SM-G386F/.test(r)||i>="4.0.3"&&/SHW-|SHV-|GT-|SCH-|SGH-|SPH-|LG-F160|LG-F100|LG-F180|LG-F200|EK-|IM-A|LG-F240|LG-F260/.test(r)&&!/SHW-M420|SHW-M200|GT-S7562/.test(r)}return this.isHWAccelerable=function(){return e},e},translate:function(t,e,n){return n?"translate3d("+t+","+e+",0)":"translate("+t+","+e+")"},hasClickBug:function(){var t=o.window.navigator.userAgent,e=/Safari/.test(t);return this.hasClickBug=function(){return e},e}},s=function(){function MixinBuilder(t){_classCallCheck(this,MixinBuilder),this.superclass=t||function(){function _class(){_classCallCheck(this,_class)}return _class}()}return MixinBuilder.prototype["with"]=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce(function(t,e){return e(t)},this.superclass)},MixinBuilder}(),a=function(t){return new s(t)};e.utils=r,e.Mixin=a},function(t,e,n){"use strict";e.__esModule=!0;var i={panel:{$list:null,index:0,no:0,currIndex:0,currNo:0,size:0,count:0,origCount:0,changed:!1,animating:!1,minCount:3},touch:{holdPos:0,destPos:0,distance:0,direction:null,lastPos:0,holding:!1,isTrusted:!1},customEvent:{flick:!0,restore:!1,restoreCall:!1},dirData:[],indexToMove:0,$dummyAnchor:null},o={hwAccelerable:!0,prefix:"eg-flick",deceleration:6e-4,horizontal:!0,circular:!1,previewPadding:null,bounce:null,threshold:40,duration:100,panelEffect:function(t){return 1-Math.pow(1-t,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,adaptiveHeight:!1};e.CONFIG=i,e.OPTIONS=o},function(t,e,n){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var i=n(1),o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}(i);e["default"]=function(t){return function(t){function _class(){return _classCallCheck(this,_class),_possibleConstructorReturn(this,t.apply(this,arguments))}return _inherits(_class,t),_class.prototype._holdHandler=function(t){var e=this._conf,n=e.touch,i=t.pos.flick;n.holdPos=i,n.holding=!0,n.isTrusted=!0,e.panel.changed=!1,this._adjustContainerCss("start",i)},_class.prototype._changeHandler=function(t){var e=this._conf,n=e.touch,i=t.pos.flick,r=n.holdPos,s=void 0,a=null,l=void 0;this._setPointerEvents(t),t.inputEvent?(s=t.inputEvent.direction,l=t.inputEvent[this.options.horizontal?"deltaX":"deltaY"],~e.dirData.indexOf(s)||(s=e.dirData[+(Math.abs(n.lastPos)<=l)]),n.lastPos=l):n.lastPos=null,e.customEvent.flick&&(a=this._triggerEvent(o.EVENTS.flick,{pos:i,holding:t.holding,direction:s||n.direction,distance:i-r})),(a||null===a)&&this._setTranslate([-i,0])},_class.prototype._releaseHandler=function(t){var e=this._conf,n=e.touch,i=n.holdPos,o=e.panel.size,r=e.customEvent,s=n.holdPos<t.depaPos.flick;n.distance=t.depaPos.flick-i,n.direction=e.dirData[+!s],n.destPos=i+(s?o:-o);var a=n.distance,l=this.options.duration,c=i;this._isMovable()?(!r.restoreCall&&(r.restore=!1),c=n.destPos):Math.abs(a)>0?this._triggerBeforeRestore(t):l=0,t.setTo({flick:c},l),0===a&&this._adjustContainerCss("end"),n.holding=!1,this._setPointerEvents()},_class.prototype._animationStartHandler=function(t){var e=this._conf,n=e.panel,i=e.customEvent,o=t.inputEvent||e.touch.lastPos;!i.restoreCall&&o&&!1===this._setPhaseValue("start",{depaPos:t.depaPos.flick,destPos:t.destPos.flick})&&t.stop(),o&&(t.duration=this.options.duration,t.destPos.flick=n.size*(n.index+e.indexToMove)),n.animating=!0},_class.prototype._animationEndHandler=function(){var t=this._conf;t.panel.animating=!1,this._setPhaseValue("end"),this._triggerRestore(),t.touch.isTrusted=!1},_class}(t)},t.exports=e["default"]}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@egjs/component"),require("@egjs/axes")):"function"==typeof define&&define.amd?define("Flicking",["@egjs/component","@egjs/axes"],e):"object"==typeof exports?exports.Flicking=e(require("@egjs/component"),require("@egjs/axes")):(t.eg=t.eg||{},t.eg.Flicking=e(t.eg.Component,t.eg.Axes))}("undefined"!=typeof self?self:this,function(t,e){return function(t){var e={};function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(t,e,n){"use strict";e.__esModule=!0;var i="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof self&&(self.Math===Math?self:Function("return this")()),o=i.document;e.window=i,e.document=o},function(t,e,n){"use strict";e.__esModule=!0,e.DATA_HEIGHT=e.IS_ANDROID2=e.SUPPORT_WILLCHANGE=e.TRANSFORM=e.EVENTS=void 0;var i=n(0),o={name:"transform"};o.support=function(){var t=i.document.documentElement.style;return o.name in t||(o.name="webkitTransform")in t}();var r=i.window.CSS&&i.window.CSS.supports&&i.window.CSS.supports("will-change","transform"),s=/Android 2\./.test(navigator.userAgent);e.EVENTS={beforeFlickStart:"beforeFlickStart",beforeRestore:"beforeRestore",flick:"flick",flickEnd:"flickEnd",restore:"restore"},e.TRANSFORM=o,e.SUPPORT_WILLCHANGE=r,e.IS_ANDROID2=s,e.DATA_HEIGHT="data-height"},function(t,e,n){"use strict";var i,o=n(3),r=(i=o,i&&i.__esModule?i:{default:i});r.default.VERSION="2.2.0",t.exports=r.default},function(t,e,n){"use strict";e.__esModule=!0;var i=_interopRequireDefault(n(4)),o=n(5),r=_interopRequireDefault(o),s=n(6),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(1)),l=n(7),c=n(0),u=_interopRequireDefault(n(8));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}var p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(Flicking,t);function Flicking(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,Flicking);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this));o.$wrapper=s.utils.$(e);var r=o.$wrapper&&o.$wrapper.children;if(!o.$wrapper||!r||!r.length)throw new Error("Given base element doesn't exist or it hasn't proper DOM structure to be initialized.");return o._setOptions(n),o._setConfig(r,i),!s.utils.hasClickBug()&&(o._setPointerEvents=function(){}),o._build(),o._bindEvents(!0),o._applyPanelsCss(),o._arrangePanels(),o.options.hwAccelerable&&a.SUPPORT_WILLCHANGE&&o._setHint(),o.options.adaptiveHeight&&o._setAdaptiveHeight(),o._adjustContainerCss("end"),o}return Flicking.prototype._setOptions=function(t){var e={previewPadding:[0,0],bounce:[10,10]};this.options=s.utils.extend(s.utils.extend({},l.OPTIONS),e,t);for(var n in e){var i=this.options[n];"number"==typeof i?i=[i,i]:s.utils.isArray(i)||(i=e[n]),this.options[n]=i}},Flicking.prototype._setConfig=function(t,e){var n=this.options,i=n.previewPadding,o=t;s.utils.classList(o[0],n.prefix+"-container")&&(o=o[0],this.$container=o,o=o.children),o=[].slice.call(o);var c=this._conf=s.utils.extend(s.utils.extend({},l.CONFIG),{panel:{$list:o,minCount:i[0]+i[1]>0?5:3},origPanelStyle:{wrapper:{className:this.$wrapper.getAttribute("class")||null,style:this.$wrapper.getAttribute("style")||null},container:{className:this.$container&&this.$container.getAttribute("class")||null,style:this.$container&&this.$container.getAttribute("style")||null},list:o.map(function(t){return{className:t.getAttribute("class")||null,style:t.getAttribute("style")||null}})},useLayerHack:n.hwAccelerable&&!a.SUPPORT_WILLCHANGE,eventPrefix:e||""});[["LEFT","RIGHT"],["UP","DOWN"]][+!n.horizontal].forEach(function(t){return c.dirData.push(r.default["DIRECTION_"+t])})},Flicking.prototype._build=function(){var t=this._conf.panel,e=this.options,n=t.$list,i=e.previewPadding.concat(),o=e.prefix,a=e.horizontal,l=t.count=t.origCount=n.length,u=e.bounce;this._setPadding(i,!0);var p=this._getDataByDirection([t.size,"100%"]),h={position:"relative",zIndex:2e3,width:"100%",height:"100%"};if(a&&(h.top="0px"),this.$container)s.utils.css(this.$container,h);else{var d=n[0].parentNode,f=c.document.createElement("div");f.className=o+"-container",s.utils.css(f,h),n.forEach(function(t){return f.appendChild(t)}),d.appendChild(f),this.$container=f}n.forEach(function(t){s.utils.classList(t,o+"-panel",!0),s.utils.css(t,{position:"absolute",width:s.utils.getUnitValue(p[0]),height:s.utils.getUnitValue(p[1]),boxSizing:"border-box",top:0,left:0})}),this._addClonePanels()&&(l=t.count=(t.$list=[].slice.call(this.$container.children)).length),this._axesInst=new r.default({flick:{range:[0,t.size*(l-1)],bounce:u}},{easing:e.panelEffect,deceleration:e.deceleration,interruptable:!1}),this._setDefaultPanel(e.defaultIndex)},Flicking.prototype._setPadding=function(t,e){var n=this.options.horizontal,i=this._conf.panel,o={};!(t[0]+t[1])&&e||(o.padding=n?"0 "+t.reverse().join("px 0 ")+"px":t.join("px 0 ")+"px"),e&&(o.overflow="hidden",o.boxSizing="border-box"),Object.keys(o).length&&s.utils.css(this.$wrapper,o);var r=getComputedStyle(this.$wrapper),a=n?["Left","Right"]:["Top","Bottom"],l=Math.max(this.$wrapper["offset"+(n?"Width":"Height")],s.utils.getNumValue(r[n?"width":"height"]));i.size=l-(s.utils.getNumValue(r["padding"+a[0]])+s.utils.getNumValue(r["padding"+a[1]]))},Flicking.prototype._addClonePanels=function(){var t=this,e=this._conf.panel,n=e.origCount,i=e.minCount-n,o=e.$list,r=void 0;if(this.options.circular&&n<e.minCount){for(r=o.map(function(t){return t.cloneNode(!0)});r.length<i;)r=r.concat(o.map(function(t){return t.cloneNode(!0)}));return r.forEach(function(e){return t.$container.appendChild(e)}),!!r.length}return!1},Flicking.prototype._movePanelPosition=function(t,e){var n=this._conf.panel,i=n.$list,o=i.splice(e?0:n.count-t,t);n.$list=e?i.concat(o):o.concat(i)},Flicking.prototype._setDefaultPanel=function(t){var e=this._conf.panel,n=e.count-1,i=void 0,o=void 0;this.options.circular?(t>0&&t<=n&&this._movePanelPosition(t,!0),o=this._getBasePositionIndex(),this._movePanelPosition(o,!1),this._setPanelNo({no:t,currNo:t})):t>0&&t<=n&&(this._setPanelNo({index:t,no:t,currIndex:t,currNo:t}),i=[-e.size*t,0],this._setTranslate(i),this._setAxes("setTo",Math.abs(i[0]),0))},Flicking.prototype._arrangePanels=function(t,e){var n=this._conf,i=n.panel,o=n.touch,r=n.dirData,s=void 0;this.options.circular&&(n.customEvent.flick=!1,t&&(e&&(o.direction=r[+!(e>0)]),this._arrangePanelPosition(o.direction,e)),s=this._getBasePositionIndex(),this._setPanelNo({index:s,currIndex:s}),n.customEvent.flick=!!this._setAxes("setTo",i.size*i.index,0)),this._applyPanelsPos()},Flicking.prototype._applyPanelsPos=function(){this._conf.panel.$list.forEach(this._applyPanelsCss.bind(this))},Flicking.prototype._setMoveStyle=function(t,e){var n=a.TRANSFORM;this._setMoveStyle=n.support?function(t,e){var i;s.utils.css(t,((i={})[n.name]=s.utils.translate(e[0],e[1],this._conf.useLayerHack),i))}:function(t,e){s.utils.css(t,{left:e[0],top:e[1]})},this._setMoveStyle(t,e)},Flicking.prototype._applyPanelsCss=function(){var t=this._conf,e="__dummy_anchor";a.IS_ANDROID2?(t.$dummyAnchor=s.utils.$("."+e),!t.$dummyAnchor&&this.$wrapper.appendChild(t.$dummyAnchor=s.utils.$('<a href="javascript:void(0)" class="'+e+'" style="position:absolute;height:0px;width:0px">')),this._applyPanelsCss=function(t,e){var n=this._getDataByDirection([this._conf.panel.size*e+"px",0]);s.utils.css(t,{left:n[0],top:n[1]})}):this._applyPanelsCss=function(t,e){var n=this._getDataByDirection([a.TRANSFORM.support?100*e+"%":this._conf.panel.size*e+"px",0]);this._setMoveStyle(t,n)}},Flicking.prototype._adjustContainerCss=function(t,e){var n=this._conf,i=n.panel,o=this.options,r=o.horizontal,l=o.previewPadding[0],c=this.$container,u=e,p=void 0;if(a.IS_ANDROID2)if(u||(u=-i.size*i.index),"start"===t)c=c.style,p=parseInt(c[r?"left":"top"],10),r?p&&(c.left="0px"):p!==l&&(c.top="0px"),this._setTranslate([-u,0]);else if("end"===t){var h;u=this._getCoordsValue([u,0]),s.utils.css(c,((h={left:u.x,top:u.y})[a.TRANSFORM.name]=s.utils.translate(0,0,n.useLayerHack),h)),n.$dummyAnchor.focus()}},Flicking.prototype._setAxes=function(t,e,n){return this._axesInst[t]({flick:e},n)},Flicking.prototype._setHint=function(){var t={willChange:"transform"};s.utils.css(this.$container,t),s.utils.css(this._conf.panel.$list,t)},Flicking.prototype._getDataByDirection=function(t){var e=t.concat();return!this.options.horizontal&&e.reverse(),e},Flicking.prototype._arrangePanelPosition=function(t,e){var n=t===this._conf.dirData[0];this._movePanelPosition(Math.abs(e||1),n)},Flicking.prototype._getBasePositionIndex=function(){return Math.floor(this._conf.panel.count/2-.1)},Flicking.prototype._bindEvents=function(t){var e=this.options,n=this.$wrapper,i=this._axesInst;t?(this._panInput=new o.PanInput(n,{inputType:e.inputType,thresholdAngle:e.thresholdAngle,scale:this._getDataByDirection([-1,0])}),i.on({hold:this._holdHandler.bind(this),change:this._changeHandler.bind(this),release:this._releaseHandler.bind(this),animationStart:this._animationStartHandler.bind(this),animationEnd:this._animationEndHandler.bind(this)}).connect(this._getDataByDirection(["flick",""]),this._panInput)):(this.disableInput(),i.off())},Flicking.prototype._setAdaptiveHeight=function(t){var e=this._conf,n=e.indexToMove,i=void 0,o=void 0,l=0===n?this["get"+((t===r.default.DIRECTION_LEFT?"Next":t===r.default.DIRECTION_RIGHT&&"Prev")||"")+"Element"]():e.panel.$list[e.panel.currIndex+n],c=l.querySelector(":first-child");c&&((o=c.getAttribute(a.DATA_HEIGHT))||(i=l.children,(o=s.utils.outerHeight(i.length>1?(l.style.height="auto",l):c))>0&&c.setAttribute(a.DATA_HEIGHT,o)),o>0&&(this.$wrapper.style.height=o+"px"))},Flicking.prototype._triggerBeforeRestore=function(t){var e=this._conf,n=e.touch;n.direction=+e.dirData.join("").replace(n.direction,""),e.customEvent.restore=this._triggerEvent(a.EVENTS.beforeRestore,{depaPos:t.depaPos.flick,destPos:t.destPos.flick}),e.customEvent.restore||("stop"in t&&t.stop(),e.panel.animating=!1)},Flicking.prototype._triggerRestore=function(){var t=this._conf.customEvent;t.restore&&this._triggerEvent(a.EVENTS.restore),t.restore=t.restoreCall=!1},Flicking.prototype._setPhaseValue=function(t,e){var n=this._conf,i=this.options,o=n.panel;if("start"===t&&(o.changed=this._isMovable())){if(!this._triggerEvent(a.EVENTS.beforeFlickStart,e))return o.changed=o.animating=!1,!1;i.adaptiveHeight&&this._setAdaptiveHeight(n.touch.direction),0===n.indexToMove&&this._setPanelNo()}else"end"===t&&(i.circular&&o.changed&&this._arrangePanels(!0,n.indexToMove),!a.IS_ANDROID2&&this._setTranslate([-o.size*o.index,0]),n.touch.distance=n.indexToMove=0,o.changed&&this._triggerEvent(a.EVENTS.flickEnd));return this._adjustContainerCss(t),!0},Flicking.prototype._getNumByDirection=function(){var t=this._conf;return t.touch.direction===t.dirData[0]?1:-1},Flicking.prototype._revertPanelNo=function(){var t=this._conf.panel,e=this._getNumByDirection(),n=t.currIndex>=0?t.currIndex:t.index-e,i=t.currNo>=0?t.currNo:t.no-e;this._setPanelNo({index:n,no:i})},Flicking.prototype._setPanelNo=function(t){var e=this._conf.panel,n=e.origCount-1,i=this._getNumByDirection();if(s.utils.isObject(t))for(var o in t)e[o]=t[o];else e.currIndex=e.index,e.currNo=e.no,e.index+=i,e.no+=i;e.no>n?e.no=0:e.no<0&&(e.no=n)},Flicking.prototype._setPointerEvents=function(t){var e=s.utils.css(this.$container,"pointerEvents"),n=void 0;t&&t.holding&&t.inputEvent&&t.inputEvent.preventSystemEvent&&"none"!==e?n="none":t||"auto"===e||(n="auto"),n&&s.utils.css(this.$container,{pointerEvents:n})},Flicking.prototype._getCoordsValue=function(t){var e=this._getDataByDirection(t);return{x:s.utils.getUnitValue(e[0]),y:s.utils.getUnitValue(e[1])}},Flicking.prototype._setTranslate=function(t){var e=this._getCoordsValue(t);this._setMoveStyle(this.$container,[e.x,e.y])},Flicking.prototype._isMovable=function(){var t=this.options,e=this._axesInst,n=Math.abs(this._conf.touch.distance)>=t.threshold,i=void 0,o=void 0;return!(!t.circular&&n&&(i=e.axis.flick.range[1],(o=e.get().flick)<0||o>i))&&n},Flicking.prototype._triggerEvent=function(t,e){var n=this._conf,i=n.panel;return t===a.EVENTS.flickEnd&&(i.currNo=i.no,i.currIndex=i.index),this.trigger(n.eventPrefix+t,s.utils.extend({eventType:t,no:i.currNo,direction:n.touch.direction,isTrusted:n.touch.isTrusted},e))},Flicking.prototype._getElement=function(t,e,n){var i=this._conf.panel,o=this.options.circular,r=i.currIndex,s=t===this._conf.dirData[0],a=null,l=void 0,c=void 0;n?(l=i.count,c=r):(l=i.origCount,c=i.currNo);var u=c;return s?c<l-1?c++:o&&(c=0):c>0?c--:o&&(c=l-1),u!==c&&(a=e?i.$list[s?r+1:r-1]:c),a},Flicking.prototype._setValueToMove=function(t){var e=this._conf;e.touch.distance=this.options.threshold+1,e.touch.direction=e.dirData[+!t]},Flicking.prototype.getIndex=function(t){return this._conf.panel[t?"currIndex":"currNo"]},Flicking.prototype.getElement=function(){var t=this._conf.panel;return t.$list[t.currIndex]},Flicking.prototype.getNextElement=function(){return this._getElement(this._conf.dirData[0],!0)},Flicking.prototype.getNextIndex=function(t){return this._getElement(this._conf.dirData[0],!1,t)},Flicking.prototype.getAllElements=function(){return this._conf.panel.$list},Flicking.prototype.getPrevElement=function(){return this._getElement(this._conf.dirData[1],!0)},Flicking.prototype.getPrevIndex=function(t){return this._getElement(this._conf.dirData[1],!1,t)},Flicking.prototype.isPlaying=function(){return this._conf.panel.animating},Flicking.prototype._movePanel=function(t,e){var n=this._conf,i=n.panel,o=this.options;if(!i.animating&&!n.touch.holding)return this._setValueToMove(t),(o.circular||null!==this["get"+(t?"Next":"Prev")+"Index"]())&&this._movePanelByPhase("setBy",i.size*(t?1:-1),e),this},Flicking.prototype._movePanelByPhase=function(t,e,n){var i=s.utils.getNumValue(n,this.options.duration);!1!==this._setPhaseValue("start")&&(this._setAxes(t,e,i),!i&&this._setPhaseValue("end"))},Flicking.prototype.next=function(t){return this._movePanel(!0,t)},Flicking.prototype.prev=function(t){return this._movePanel(!1,t)},Flicking.prototype.moveTo=function(t,e){var n=this._conf,i=n.panel,o=this.options.circular,r=i.index,a=void 0,l=void 0,c=t;return(c=s.utils.getNumValue(c,-1))<0||c>=i.origCount||c===i.no||i.animating||n.touch.holding?this:(l=(a=c-(o?i.no:r))>0,o&&Math.abs(a)>(l?i.count-(r+1):r)&&(l=(a+=(l?-1:1)*i.count)>0),this._setPanelNo(o?{no:c}:{no:c,index:c}),this._conf.indexToMove=a,this._setValueToMove(l),this._movePanelByPhase(o?"setBy":"setTo",i.size*(o?a:c),e),this)},Flicking.prototype.resize=function(){var t=this._conf,e=this.options,n=t.panel,i=e.horizontal,o=void 0;if(!this.isPlaying()){var r;s.utils.isArray(e.previewPadding)&&"number"==typeof+e.previewPadding.join("")?(this._setPadding(e.previewPadding.concat()),o=n.size):i&&(o=n.size=s.utils.css(this.$wrapper,"width",!0));var l=o*(n.count-1),c=this._getDataByDirection([l,0]);if(i&&s.utils.css(this.$container,{width:c[0]+o+"px"}),s.utils.css(n.$list,((r={})[i?"width":"height"]=s.utils.getUnitValue(o),r)),e.adaptiveHeight){var u=this.$container.querySelectorAll("["+a.DATA_HEIGHT+"]");u.length&&([].slice.call(u).forEach(function(t){return t.removeAttribute(a.DATA_HEIGHT)}),this._setAdaptiveHeight())}this._axesInst.axis.flick.range=[0,l],this._setAxes("setTo",o*n.index,0),a.IS_ANDROID2&&(this._applyPanelsPos(),this._adjustContainerCss("end"))}return this},Flicking.prototype.restore=function(t){var e=this._conf,n=e.panel,i=this._axesInst.get().flick,o=t,r=void 0;return i!==n.currIndex*n.size?(e.customEvent.restoreCall=!0,o=s.utils.getNumValue(o,this.options.duration),this._revertPanelNo(),r=n.size*n.index,this._triggerBeforeRestore({depaPos:i,destPos:r}),this._setAxes("setTo",r,o),o||(this._adjustContainerCss("end"),this._triggerRestore())):n.changed&&(this._revertPanelNo(),e.touch.distance=e.indexToMove=0),this},Flicking.prototype.enableInput=function(){return this._panInput.enable(),this},Flicking.prototype.disableInput=function(){return this._panInput.disable(),this},Flicking.prototype.getStatus=function(t){var e=this._conf.panel,n=/((?:-webkit-)?transform|left|top|will-change|box-sizing|width):[^;]*;/g,i={panel:{index:e.index,no:e.no,currIndex:e.currIndex,currNo:e.currNo},$list:e.$list.map(function(t){return{style:t.style.cssText.replace(n,"").trim(),className:t.className,html:t.innerHTML}})};return t?JSON.stringify(i):i},Flicking.prototype.setStatus=function(t){var e=this._conf.panel,n=this.options.adaptiveHeight,i="string"==typeof t?JSON.parse(t):t;if(i){for(var o in i.panel)o in e&&(e[o]=i.panel[o]);e.$list.forEach(function(t,e){var n=i.$list[e],o=n.style,r=n.className,s=n.html;o&&(t.style.cssText+=o),r&&(t.className=r),s&&(t.innerHTML=s)}),n&&this._setAdaptiveHeight()}},Flicking.prototype.destroy=function(){var t=this._conf.origPanelStyle,e=t.wrapper,n=t.container,i=t.list,o=this.$wrapper;o.setAttribute("class",e.className),o[e.style?"setAttribute":"removeAttribute"]("style",e.style);var r=this.$container,s=[].slice.call(r.children);t.container.className?(r.setAttribute("class",n.className),r[n.style?"setAttribute":"removeAttribute"]("style",n.style)):(s.forEach(function(t){return o.appendChild(t)}),r.parentNode.removeChild(r));for(var a,l=0;a=s[l];l++)if(l>i.length-1)a.parentNode.removeChild(a);else{var c=i[l].className,u=i[l].style;a[c?"setAttribute":"removeAttribute"]("class",c),a[u?"setAttribute":"removeAttribute"]("style",u)}this._bindEvents(!1),this.off(),this._axesInst.destroy(),this._panInput.destroy();for(var p in this)this[p]=null},Flicking}((0,s.Mixin)(i.default).with(u.default));p.DIRECTION_NONE=r.default.DIRECTION_NONE,p.DIRECTION_LEFT=r.default.DIRECTION_LEFT,p.DIRECTION_RIGHT=r.default.DIRECTION_RIGHT,p.DIRECTION_UP=r.default.DIRECTION_UP,p.DIRECTION_DOWN=r.default.DIRECTION_DOWN,p.DIRECTION_HORIZONTAL=r.default.DIRECTION_HORIZONTAL,p.DIRECTION_VERTICAL=r.default.DIRECTION_VERTICAL,p.DIRECTION_ALL=r.default.DIRECTION_ALL,e.default=p,t.exports=e.default},function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";e.__esModule=!0,e.Mixin=e.utils=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(0);function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r={$:function(t){var e=null;if("string"==typeof t){var n=t.match(/^<([a-z]+)\s*([^>]*)>/);n?(e=o.document.createElement(n[1]),3===n.length&&n[2].split(" ").forEach(function(t){var n=t.split("=");e.setAttribute(n[0],n[1].trim().replace(/(^["']|["']$)/g,""))})):(e=o.document.querySelectorAll(t)).length?1===e.length&&(e=e[0]):e=null}else t.nodeName&&1===t.nodeType&&(e=t);return e},isArray:function(t){return t&&t.constructor===Array},isObject:function(t){return t&&!t.nodeType&&"object"===(void 0===t?"undefined":i(t))&&!this.isArray(t)},extend:function(t){for(var e=this,n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];if(!i.length||1===i.length&&!i[0])return t;var r=i.shift();return this.isObject(t)&&this.isObject(r)&&Object.keys(r).forEach(function(n){var i=r[n];e.isObject(i)?(!t[n]&&(t[n]={}),t[n]=e.extend(t[n],i)):t[n]=e.isArray(i)?i.concat():i}),this.extend.apply(this,[t].concat(i))},css:function(t,e,n){if("string"==typeof e){var i=o.window.getComputedStyle(t)[e];return n?this.getNumValue(i):i}var r=function(t,e){return Object.keys(e).forEach(function(n){t[n]=e[n]})};return this.isArray(t)?t.forEach(function(t){return r(t.style,e)}):r(t.style,e),t},classList:function(t,e,n){var i="boolean"==typeof n,o=void 0;return t.classList?o=t.classList[i&&(n?"add":"remove")||"contains"](e):(o=t.className,i?n&&-1===o.indexOf(e)?o=t.className=(o+" "+e).replace(/\s{2,}/g," "):n||(o=t.className=o.replace(e,"")):o=new RegExp("\\b"+e+"\\b").test(o)),o},getNumValue:function(t,e){var n=t;return isNaN(n=parseInt(n,10))?e:n},getUnitValue:function(t){return(parseInt(t,10)||0)+(String(t).match(/(?:[a-z]{2,}|%)$/)||"px")},getOuter:function(t,e){var n=this,i=o.window.getComputedStyle(t),r=0;return("outerWidth"===e?["Left","Right"]:["Top","Bottom"]).forEach(function(t){["padding","margin"].forEach(function(e){r+=n.getNumValue(i[""+e+t])})}),this.getNumValue(i[e.replace("outer","").toLocaleLowerCase()])+r},outerWidth:function(t){return this.getOuter(t,"outerWidth")},outerHeight:function(t){return this.getOuter(t,"outerHeight")},translate:function(t,e,n){return n?"translate3d("+t+","+e+",0)":"translate("+t+","+e+")"},hasClickBug:function(){var t=o.window.navigator.userAgent,e=/Safari/.test(t);return this.hasClickBug=function(){return e},e}},s=function(){function MixinBuilder(t){_classCallCheck(this,MixinBuilder),this.superclass=t||function(){return function _class(){_classCallCheck(this,_class)}}()}return MixinBuilder.prototype.with=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce(function(t,e){return e(t)},this.superclass)},MixinBuilder}();e.utils=r,e.Mixin=function(t){return new s(t)}},function(t,e,n){"use strict";e.__esModule=!0;var i={hwAccelerable:!0,prefix:"eg-flick",deceleration:6e-4,horizontal:!0,circular:!1,previewPadding:null,bounce:null,threshold:40,duration:100,panelEffect:function(t){return 1-Math.pow(1-t,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,adaptiveHeight:!1};e.CONFIG={panel:{$list:null,index:0,no:0,currIndex:0,currNo:0,size:0,count:0,origCount:0,changed:!1,animating:!1,minCount:3},touch:{holdPos:0,destPos:0,distance:0,direction:null,lastPos:0,holding:!1,isTrusted:!1},customEvent:{flick:!0,restore:!1,restoreCall:!1},dirData:[],indexToMove:0,$dummyAnchor:null},e.OPTIONS=i},function(t,e,n){"use strict";e.__esModule=!0;var i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(1));e.default=function(t){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(_class,t);function _class(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,_class),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return _class.prototype._holdHandler=function(t){var e=this._conf,n=e.touch,i=t.pos.flick;n.holdPos=i,n.holding=!0,n.isTrusted=!0,e.panel.changed=!1,this._adjustContainerCss("start",i)},_class.prototype._changeHandler=function(t){var e=this._conf,n=e.touch,o=t.pos.flick,r=n.holdPos,s=void 0,a=null,l=void 0;this._setPointerEvents(t),t.inputEvent?(s=t.inputEvent.direction,l=t.inputEvent[this.options.horizontal?"deltaX":"deltaY"],~e.dirData.indexOf(s)||(s=e.dirData[+(Math.abs(n.lastPos)<=l)]),n.lastPos=l):n.lastPos=null,e.customEvent.flick&&(a=this._triggerEvent(i.EVENTS.flick,{pos:o,holding:t.holding,direction:s||n.direction,distance:n.isTrusted?o-r:null})),(a||null===a)&&this._setTranslate([-o,0])},_class.prototype._releaseHandler=function(t){var e=this._conf,n=e.touch,i=n.holdPos,o=e.panel.size,r=e.customEvent,s=n.holdPos<t.depaPos.flick;n.distance=t.depaPos.flick-i,n.direction=e.dirData[+!s],n.destPos=i+(s?o:-o);var a=n.distance,l=this.options.duration,c=i;this._isMovable()?(!r.restoreCall&&(r.restore=!1),c=n.destPos):Math.abs(a)>0?this._triggerBeforeRestore(t):l=0,t.setTo({flick:c},l),0===a&&this._adjustContainerCss("end"),n.holding=!1,this._setPointerEvents()},_class.prototype._animationStartHandler=function(t){var e=this._conf,n=e.panel,i=e.customEvent,o=t.inputEvent||e.touch.lastPos;!i.restoreCall&&o&&!1===this._setPhaseValue("start",{depaPos:t.depaPos.flick,destPos:t.destPos.flick})&&t.stop(),o&&(t.duration=this.options.duration,t.destPos.flick=n.size*(n.index+e.indexToMove)),n.animating=!0},_class.prototype._animationEndHandler=function(){var t=this._conf;t.panel.animating=!1,this._setPhaseValue("end"),this._triggerRestore(),t.touch.isTrusted=!1},_class}(t)},t.exports=e.default}])}); | ||
//# sourceMappingURL=flicking.min.js.map |
{ | ||
"name": "@egjs/flicking", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"main": "dist/flicking.js", | ||
@@ -39,3 +39,3 @@ "es2015": "src/Flicking.js", | ||
"dependencies": { | ||
"@egjs/axes": "^2.2.0", | ||
"@egjs/axes": "^2.5.0", | ||
"@egjs/component": "^2.1.0" | ||
@@ -46,3 +46,3 @@ }, | ||
"babel-core": "^6.25.0", | ||
"babel-eslint": "^8.0.0", | ||
"babel-eslint": "^8.1.2", | ||
"babel-loader": "^7.1.1", | ||
@@ -56,10 +56,10 @@ "babel-plugin-add-module-exports": "^0.2.1", | ||
"chai": "^4.1.1", | ||
"clean-webpack-plugin": "^0.1.16", | ||
"coveralls": "^2.13.1", | ||
"clean-webpack-plugin": "^0.1.18", | ||
"coveralls": "^3.0.0", | ||
"cpx": "^1.5.0", | ||
"egjs-jsdoc-template": "1.3.3", | ||
"eslint": "^4.5.0", | ||
"eslint-config-naver": "^1.0.0", | ||
"egjs-jsdoc-template": "^1.4.4", | ||
"eslint": "^4.16.0", | ||
"eslint-config-naver": "^2.0.0", | ||
"eslint-loader": "^1.9.0", | ||
"gh-pages": "^1.0.0", | ||
"gh-pages": "^1.1.0", | ||
"hammer-simulator": "0.0.1", | ||
@@ -69,20 +69,20 @@ "husky": "^0.14.3", | ||
"istanbul-instrumenter-loader": "^3.0.0", | ||
"jsdoc": "^3.5.4", | ||
"karma": "^1.7.0", | ||
"jsdoc": "^3.5.5", | ||
"karma": "^2.0.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage-istanbul-reporter": "^1.3.0", | ||
"karma-coverage-istanbul-reporter": "^1.4.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.3", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"karma-sinon": "^1.0.5", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "^2.0.4", | ||
"karma-webpack": "^2.0.9", | ||
"lite-fixture": "^1.0.2", | ||
"mocha": "^3.5.0", | ||
"sinon": "^4.0.0", | ||
"mocha": "^5.0.0", | ||
"sinon": "^4.2.2", | ||
"string-replace-webpack-plugin": "0.1.3", | ||
"uglifyjs-webpack-plugin": "^0.4.6", | ||
"webpack": "^3.5.3", | ||
"webpack-dev-server": "^2.7.1", | ||
"webpack-merge": "^4.1.0", | ||
"uglifyjs-webpack-plugin": "^1.1.8", | ||
"webpack": "^3.10.0", | ||
"webpack-dev-server": "^2.11.1", | ||
"webpack-merge": "^4.1.1", | ||
"write-file-webpack-plugin": "^4.1.0", | ||
@@ -89,0 +89,0 @@ "xml2js": "^0.4.17" |
@@ -54,2 +54,4 @@ # egjs-flicking | ||
- jsDelivr: https://cdn.jsdelivr.net/npm/@egjs/flicking/dist/ | ||
- cdnjs: https://cdnjs.com/libraries/egjs-flicking | ||
- unpkg: https://unpkg.com/@egjs/flicking/dist/ | ||
@@ -56,0 +58,0 @@ ## Supported Browsers |
@@ -0,0 +0,0 @@ /** |
@@ -42,3 +42,3 @@ /** | ||
const OPTIONS = { | ||
hwAccelerable: true, // ns.isHWAccelerable(), // check weather hw acceleration is available | ||
hwAccelerable: true, // set for hw acceleration (see https://gist.github.com/netil/c1d1b67e1c1926364c0709f110a09b44 for old devices support) | ||
prefix: "eg-flick", // prefix value of class name | ||
@@ -45,0 +45,0 @@ deceleration: 0.0006, // deceleration value |
@@ -0,0 +0,0 @@ /** |
@@ -10,2 +10,3 @@ /** | ||
* 'hold' event handler | ||
* @private | ||
*/ | ||
@@ -27,2 +28,3 @@ _holdHandler(e) { | ||
* 'change' event handler | ||
* @private | ||
*/ | ||
@@ -41,15 +43,32 @@ _changeHandler(e) { | ||
/** | ||
* This event is fired when panel moves. | ||
* @ko 패널이 이동할 때 발생하는 이벤트 | ||
* An event that occurs whenever the panel's coordinate value changes. It occurs in the following cases.<br><br>1. When the user is inputing the move.<br>2. When moving to the destination panel after you have finished inputing the move in step 1.<br>3. When the current panel is moving to its original position after the movement is finished in step 1.<br>4. Moving to the destination panel by calling the `moveTo()`, `prev()`, `next()` method. (Do not prevent the default behavior of the [beforeFlickStart]{@link eg.Flicking#event:beforeFlickStart} event.) | ||
* @ko 패널의 좌표값이 변할 때마다 발생하는 이벤트. 아래의 경우에 발생한다.<br><br>1. 사용자가 이동(move) 액션 입력중일 때.<br>2. 1번에서 이동(move) 액션 입력이 끝나고 목적 패널로 이동중일 때.<br>3. 1번에서 이동(move) 액션 입력이 끝나고 현재 패널의 원래 위치로 이동중일 때.<br>4. `moveTo()`, `prev()`, `next()`, 메서드를 호출하여 목적 패널로 이동중일 때. ([beforeFlickStart]{@link eg.Flicking#event:beforeFlickStart}이벤트의 기본동작을 막지 않아야 한다.)<br>5. `restore()` 메서드를 호출하여 현재 패널이 원래 위치로 이동중일 때. ([beforeFlickStart]{@link eg.Flicking#event:beforeFlickStart}이벤트의 기본동작 방지 전제.) | ||
* @name eg.Flicking#flick | ||
* @event | ||
* @param {Object} param The object of data to be sent to an event <ko>이벤트에 전달되는 데이터 객체</ko> | ||
* @param {String} param.eventType The name of the event<ko>이름명</ko> | ||
* @param {Boolean} param.isTrusted true when the event was generated by a user action otherwise false<ko>사용자의 액션으로 인해 이벤트가 생성된 경우, true. 그 외는 false</ko> | ||
* @param {Number} param.index Physical index number of the current panel element, which is relative to DOM (@deprecated since 1.3.0)<ko>현재 패널 엘리먼트의 물리적 인덱스 번호. DOM 엘리먼트를 기준으로 하는 인덱스 번호다 (@deprecated since 1.3.0)</ko> | ||
* @param {Number} param.no Logical index number of the current panel element, which is relative to the panel content <ko>현재 패널 엘리먼트의 논리적 인덱스 번호. 패널 콘텐츠를 기준으로 하는 인덱스 번호다</ko> | ||
* @param {Number} param.direction Direction of the movement (see eg.Axes.DIRECTION_* constant) <ko>이동 방향(eg.Axes.DIRECTION_* constant 참고)</ko> | ||
* @param {Number} param.pos current coordinate <ko>현재 좌표</ko> | ||
* @param {Boolean} param.holding Indicates whether a user holds an element on the screen of the device. <ko>사용자가 기기의 화면을 누르고 있는지 여부</ko> | ||
* @param {Number} param.distance Distance moved from then starting point. According the move direction, positive on eg.Axes.DIRECTION_LEFT/UP and negative on eg.Axes.DIRECTION_RIGHT/DOWN <ko>시작점부터 이동된 거리의 값. 이동 방향에 따라 eg.Axes.DIRECTION_LEFT/UP의 경우 양수를 eg.Axes.DIRECTION_RIGHT/DOWN의 경우는 음수를 반환</ko> | ||
* @property {String} eventType The name of the event<ko>이벤트 명</ko> | ||
* @property {Boolean} isTrusted true when the event was generated by a user action(`"mouse"` or `"touch"`) otherwise false<ko>사용자 액션(`"mouse"` 또는 `"touch"`)에 의해 이벤트가 생성된 경우 `true`. 그 외는 `false`</ko> | ||
* @property {Number} no Index number of the current panel element. See the [getIndex()]{@link eg.Flicking#getIndex} method.<ko>현재 패널 요소의 인덱스 번호. [getIndex()]{@link eg.Flicking#getIndex}메서드 참조.</ko> | ||
* @property {Number} direction of the panel movement. If `horizontal=true` is {@link eg.Flicking.DIRECTION_LEFT} or {@link eg.Flicking.DIRECTION_RIGHT}. If `horizontal=false` is {@link eg.Flicking.DIRECTION_UP} or {@link eg.Flicking.DIRECTION_DOWN}.<ko>패널 이동 방향. `horizontal=true` 이면 {@link eg.Flicking.DIRECTION_LEFT} 혹은 {@link eg.Flicking.DIRECTION_RIGHT}. `horizontal=false` 이면 {@link eg.Flicking.DIRECTION_UP} 혹은 {@link eg.Flicking.DIRECTION_DOWN}.</ko> | ||
* @property {Number} pos current coordinate <ko>현재 좌표.</ko> | ||
* @property {Boolean} holding Whether the user is inputing through the input device. (Whether it is 'mousedown' for a mouse device or 'touchmove' for a touch device.)<ko>사용자가 입력 장치를 통해 입력중인지 여부. (마우스 장치라면 'mousedown' 여부, 터치 장치라면 'touchmove' 여부)</ko> | ||
* @property {Number} distance Distance value from the touch starting point. If the `direction` property value is {@link eg.Flicking.DIRECTION_LEFT} or {@link eg.Flicking.DIRECTION_UP}, it returns a positive number. {@link eg.Flicking.DIRECTION_RIGHT} or {@link eg.Flicking.DIRECTION_DOWN} returns a negative value.<ko>터치 시작점으로부터 이동한 거리 값. `direction`속성값이 {@link eg.Flicking.DIRECTION_LEFT} 혹은 {@link eg.Flicking.DIRECTION_UP}이면 양수를, {@link eg.Flicking.DIRECTION_RIGHT} 혹은 {@link eg.Flicking.DIRECTION_DOWN}이면 음수를 반환한다.</ko> | ||
* @see eg.Flicking#event:beforeRestore | ||
* @see eg.Flicking#restore | ||
* @see eg.Flicking#event:beforeFlickStart | ||
* @see eg.Flicking#event:flickEnd | ||
* @see eg.Flicking#moveTo | ||
* @see eg.Flicking#prev | ||
* @see eg.Flicking#next | ||
* @example | ||
* The order of event occurrence. | ||
* 이벤트 발생 순서 | ||
* ```javascript | ||
* // When moving to the destination panel. | ||
* // 목적 패널로 이동할 때. | ||
* beforeFlickStart (once) > flick (many times) > flickEnd (once) | ||
* | ||
* // When the restore operation. | ||
* // 복원 동작일 때. | ||
* beforeRestore (once) > flick (many times) > restore (once) | ||
* ``` | ||
*/ | ||
@@ -76,3 +95,3 @@ if (e.inputEvent) { | ||
direction: direction || touch.direction, | ||
distance: pos - holdPos | ||
distance: touch.isTrusted ? pos - holdPos : null | ||
}) | ||
@@ -86,2 +105,3 @@ ); | ||
* 'release' event handler | ||
* @private | ||
*/ | ||
@@ -124,2 +144,3 @@ _releaseHandler(e) { | ||
* 'animationStart' event handler | ||
* @private | ||
*/ | ||
@@ -155,2 +176,3 @@ _animationStartHandler(e) { | ||
* 'animationEnd' event handler | ||
* @private | ||
*/ | ||
@@ -157,0 +179,0 @@ _animationEndHandler() { |
@@ -7,2 +7,4 @@ // Type definitions for egjs-flicking 2.0 | ||
import * as Component from '@egjs/component'; | ||
export as namespace eg; | ||
@@ -43,5 +45,5 @@ | ||
declare class Flicking { | ||
declare class Flicking extends Component { | ||
constructor(el: string | HTMLElement, options?: FlickingOption); | ||
destroy(); | ||
destroy(): void; | ||
disableInput(): Flicking; | ||
@@ -57,3 +59,2 @@ enableInput(): Flicking; | ||
getStatus(stringify: boolean): FlickingStatus | string; | ||
getTotalCount(physical: boolean): number; | ||
isPlaying(): boolean; | ||
@@ -65,7 +66,7 @@ moveTo(no: number, duration?: number): Flicking; | ||
restore(duration?: number): Flicking; | ||
setStatus(status: FlickingStatus | string); | ||
setStatus(status: FlickingStatus | string): void; | ||
} | ||
declare namespace Flicking { | ||
function destroy(); | ||
function destroy(): void; | ||
function disableInput(): Flicking; | ||
@@ -81,3 +82,2 @@ function enableInput(): Flicking; | ||
function getStatus(stringify: boolean): FlickingStatus | string; | ||
function getTotalCount(physical: boolean): number; | ||
function isPlaying(): boolean; | ||
@@ -89,3 +89,3 @@ function moveTo(no: number, duration?: number): Flicking; | ||
function restore(duration?: number): Flicking; | ||
function setStatus(status: FlickingStatus | string); | ||
function setStatus(status: FlickingStatus | string): void; | ||
} |
@@ -0,0 +0,0 @@ /** |
@@ -193,8 +193,14 @@ /** | ||
const style = window.getComputedStyle(el); | ||
const margin = type === "outerWidth" ? | ||
["marginLeft", "marginRight"] : ["marginTop", "marginBottom"]; | ||
let paddingMargin = 0; | ||
return this.getNumValue(style[type.replace("outer", "").toLocaleLowerCase()]) + | ||
this.getNumValue(style[margin[0]]) + | ||
this.getNumValue(style[margin[1]]); | ||
(type === "outerWidth" ? | ||
["Left", "Right"] : | ||
["Top", "Bottom"] | ||
).forEach(dir => { | ||
["padding", "margin"].forEach(v => { | ||
paddingMargin += this.getNumValue(style[`${v}${dir}`]); | ||
}); | ||
}); | ||
return this.getNumValue(style[type.replace("outer", "").toLocaleLowerCase()]) + paddingMargin; | ||
}, | ||
@@ -221,38 +227,2 @@ | ||
/** | ||
* Checks whether hardware acceleration is enabled. | ||
* | ||
* @ko 하드웨어 가속을 사용할 수 있는 환경인지 확인한다 | ||
* @method eg#isHWAccelerable | ||
* @return {Boolean} Indicates whether hardware acceleration is enabled. <ko>하드웨어 가속 사용 가능 여부</ko> | ||
*/ | ||
isHWAccelerable() { | ||
const ua = window.navigator.userAgent; | ||
let result = false; | ||
let match; | ||
// chrome 25- has a text blur bug (except Samsung's sbrowser) | ||
if ((match = ua.match(/Chrome\/(\d+)/))) { | ||
result = match[1] >= "25"; | ||
} else if (/ie|edge|firefox|safari|inapp/.test(ua)) { | ||
result = true; | ||
} else if ((match = ua.match(/Android ([\d.]+)/))) { | ||
const version = match[1]; | ||
const useragent = (ua.match(/\(.*\)/) || [null])[0]; | ||
// android 4.1+ blacklist | ||
// EK-GN120 : Galaxy Camera, SM-G386F : Galaxy Core LTE | ||
// SHW-M420 : Galaxy Nexus , SHW-M200 : NexusS , GT-S7562 : Galaxy S duos | ||
result = (version >= "4.1.0" && !/EK-GN120|SM-G386F/.test(useragent)) || | ||
( | ||
version >= "4.0.3" && | ||
/SHW-|SHV-|GT-|SCH-|SGH-|SPH-|LG-F160|LG-F100|LG-F180|LG-F200|EK-|IM-A|LG-F240|LG-F260/.test(useragent) && | ||
!/SHW-M420|SHW-M200|GT-S7562/.test(useragent) | ||
); | ||
} | ||
this.isHWAccelerable = () => result; | ||
return result; | ||
}, | ||
/** | ||
* Returns the syntax of the translate style which is applied to CSS transition properties. | ||
@@ -259,0 +229,0 @@ * |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1926633
13279
175
50
Updated@egjs/axes@^2.5.0