@egjs/flicking-plugins 4.7.1 → 4.7.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins.esm.js +1 -1
- package/dist/plugins.js +1 -1
- package/dist/plugins.min.js +1 -1
- package/package.json +3 -3
package/dist/plugins.esm.js
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -4,7 +4,7 @@ name: @egjs/flicking-plugins
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking-plugins
|
|
7
|
-
version: 4.7.
|
|
7
|
+
version: 4.7.2-beta.0
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@egjs/flicking')) :
|
package/dist/plugins.min.js
CHANGED
|
@@ -4,7 +4,7 @@ name: @egjs/flicking-plugins
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking-plugins
|
|
7
|
-
version: 4.7.
|
|
7
|
+
version: 4.7.2-beta.0
|
|
8
8
|
*/
|
|
9
9
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@egjs/flicking")):"function"==typeof define&&define.amd?define(["exports","@egjs/flicking"],t):t(((e=e||self).Flicking=e.Flicking||{},e.Flicking.Plugins={}),e.Flicking)}(this,function(e,m){"use strict";function T(e,t){e&&(e.classList?e.classList.add(t):e.className.split(" ").indexOf(t)<0&&(e.className=e.className+" "+t))}function b(e,t){if(e)if(e.classList)e.classList.remove(t);else{var n=new RegExp("( |^)"+t+"( |$)","g");e.className.replace(n," ")}}function o(e,t,n){var i=t.querySelector(e);if(!i)throw new Error("[Flicking-"+n+"] Couldn't find element with the given selector: "+e);return i}var t=function(){function e(e,t){var a=this;void 0===e&&(e=""),void 0===t&&(t=1),this.update=function(){a._onMove()},this._onMove=function(){var e=a._flicking;e&&e.visiblePanels.forEach(function(e){var t=e.outsetProgress,n=e.element,i=a._selector?n.querySelector(a._selector):n,r=i.parentNode,o=i.getBoundingClientRect(),s="translate(-50%) translate("+(r.getBoundingClientRect().width-o.width)/2*t*a._scale+"px)";i.style.cssText+="transform: "+s+";-webkit-transform: "+s+";-ms-transform:"+s})},this._flicking=null,this._selector=e,this._scale=t}var t=e.prototype;return Object.defineProperty(t,"selector",{get:function(){return this._selector},set:function(e){this._selector=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scale",{get:function(){return this._scale},set:function(e){this._scale=e},enumerable:!1,configurable:!0}),t.init=function(e){this._flicking&&this.destroy(),(this._flicking=e).on(m.EVENTS.MOVE,this._onMove),e.on(m.EVENTS.AFTER_RESIZE,this.update),this._onMove()},t.destroy=function(){this._flicking&&(this._flicking.off(m.EVENTS.MOVE,this._onMove),this._flicking.off(m.EVENTS.AFTER_RESIZE,this.update),this._flicking=null)},e}(),n=function(){function e(e,t){var n=this;void 0===e&&(e=""),void 0===t&&(t=1),this.update=function(){n._onMove()},this._onMove=function(){var e=n._flicking,o=n._selector,s=n._scale;e&&e.visiblePanels.forEach(function(e){var t=e.outsetProgress,n=e.element,i=o?n.querySelector(o):n;if(i){var r=Math.min(1,Math.max(0,1-Math.abs(t*s)));i.style.opacity=""+r}})},this._flicking=null,this._selector=e,this._scale=t}var t=e.prototype;return Object.defineProperty(t,"selector",{get:function(){return this._selector},set:function(e){this._selector=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scale",{get:function(){return this._scale},set:function(e){this._scale=e},enumerable:!1,configurable:!0}),t.init=function(e){this._flicking&&this.destroy(),(this._flicking=e).on(m.EVENTS.MOVE,this._onMove),e.on(m.EVENTS.AFTER_RESIZE,this.update),this._onMove()},t.destroy=function(){this._flicking&&(this._flicking.off(m.EVENTS.MOVE,this._onMove),this._flicking.off(m.EVENTS.AFTER_RESIZE,this.update),this._flicking=null)},e}(),i=function(){function e(e){var t=this,n=void 0===e?{}:e,i=n.duration,r=void 0===i?2e3:i,o=n.animationDuration,s=void 0===o?void 0:o,a=n.direction,l=void 0===a?m.DIRECTION.NEXT:a,c=n.stopOnHover,u=void 0!==c&&c,f=n.delayAfterHover;this._flicking=null,this._timerId=0,this._mouseEntered=!1,this._playing=!1,this.play=function(){t._movePanel(t._duration)},this.stop=function(){t._playing=!1,clearTimeout(t._timerId)},this._onMouseEnter=function(){t._mouseEntered=!0,t.stop()},this._onMouseLeave=function(){t._mouseEntered=!1,t._movePanel(t._delayAfterHover)},this._duration=r,this._animationDuration=s,this._direction=l,this._stopOnHover=u,this._delayAfterHover=null!=f?f:r}var t=e.prototype;return Object.defineProperty(t,"duration",{get:function(){return this._duration},set:function(e){this._duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"animationDuration",{get:function(){return this._animationDuration},set:function(e){this._animationDuration=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"direction",{get:function(){return this._direction},set:function(e){this._direction=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"stopOnHover",{get:function(){return this._stopOnHover},set:function(e){this._stopOnHover=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"delayAfterHover",{get:function(){return this._delayAfterHover},set:function(e){this._delayAfterHover=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),t.init=function(e){var t;if(this._flicking&&this.destroy(),e.on(((t={})[m.EVENTS.MOVE_START]=this.stop,t[m.EVENTS.HOLD_START]=this.stop,t[m.EVENTS.MOVE_END]=this.play,t[m.EVENTS.SELECT]=this.play,t)),this._flicking=e,this._stopOnHover){var n=this._flicking.element;n.addEventListener("mouseenter",this._onMouseEnter,!1),n.addEventListener("mouseleave",this._onMouseLeave,!1)}this.play()},t.destroy=function(){var e=this._flicking;if(this._mouseEntered=!1,this.stop(),e){e.off(m.EVENTS.MOVE_START,this.stop),e.off(m.EVENTS.HOLD_START,this.stop),e.off(m.EVENTS.MOVE_END,this.play),e.off(m.EVENTS.SELECT,this.play);var t=e.element;t.removeEventListener("mouseenter",this._onMouseEnter,!1),t.removeEventListener("mouseleave",this._onMouseLeave,!1),this._flicking=null}},t.update=function(){},t._movePanel=function(e){var h=this,d=this._flicking,p=this._direction;d&&(this.stop(),this._mouseEntered||d.animating||(this._playing=!0,this._timerId=window.setTimeout(function(){var e,t,n=h._animationDuration||d.duration,i=d.moveType;if(i===m.MOVE_TYPE.FREE_SCROLL||(null==i?void 0:i[0])===m.MOVE_TYPE.FREE_SCROLL){var r=d.camera.range,o=d.camera.position,s=d.currentPanel,a=s.prev(),l=s.next(),c=s.position,u=null!==(e=null==l?void 0:l.position)&&void 0!==e?e:r.max,f=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:r.min;if(c<f&&(f=r.min-(r.max-f)),u<c&&(u+=r.max),p===m.DIRECTION.NEXT){var _=u-o;o<c&&(_=u-o),n*=_/(u-c)}else{_=o-f;c<o&&(_=o-f),n*=_/(c-f)}}p===m.DIRECTION.NEXT?d.next(n).catch(function(){}):d.prev(n).catch(function(){}),h.play()},e)))},e}(),s={CLICK:"click",MOUSE_DOWN:"mousedown",TOUCH_START:"touchstart"},p={PREV_SELECTOR:".flicking-arrow-prev",NEXT_SELECTOR:".flicking-arrow-next",DISABLED_CLASS:"flicking-arrow-disabled"},O={SELECTOR:".flicking-pagination",PREFIX:"flicking-pagination",BULLET_WRAPPER_SUFFIX:"bullets",BULLET_SUFFIX:"bullet",BULLET_ACTIVE_SUFFIX:"bullet-active",FRACTION_WRAPPER_SUFFIX:"fraction",FRACTION_CURRENT_SUFFIX:"fraction-current",FRACTION_TOTAL_SUFFIX:"fraction-total",SCROLL_UNINIT_SUFFIX:"uninitialized",SCROLL_WRAPPER_SUFFIX:"scroll",SCROLL_SLIDER_SUFFIX:"slider",SCROLL_PREV_SUFFIX:"bullet-prev",SCROLL_NEXT_SUFFIX:"bullet-next",TYPE:{BULLET:"bullet",FRACTION:"fraction",SCROLL:"scroll"}},a={TYPE:{CAMERA:"camera",INDEX:"index"}},r=function(){function e(e){var a=this,t=void 0===e?{}:e,n=t.parentEl,i=void 0===n?null:n,r=t.prevElSelector,o=void 0===r?p.PREV_SELECTOR:r,s=t.nextElSelector,l=void 0===s?p.NEXT_SELECTOR:s,c=t.disabledClass,u=void 0===c?p.DISABLED_CLASS:c,f=t.moveCount,_=void 0===f?1:f,h=t.moveByViewportSize,d=void 0!==h&&h;this._flicking=null,this._preventInputPropagation=function(e){e.stopPropagation()},this._onPrevClick=function(){var e=a._flicking,t=e.camera,n=t.anchorPoints;if(!(e.animating||n.length<=0)){var i=n[0],r=a._moveCount;if(a._moveByViewportSize)e.control.moveToPosition(t.position-t.size,e.duration).catch(a._onCatch);else if(e.circularEnabled){for(var o=e.currentPanel,s=0;s<r;s++)o=o.prev();o.focus().catch(a._onCatch)}else e.index>i.panel.index?e.moveTo(Math.max(e.index-r,i.panel.index)).catch(a._onCatch):t.position>t.range.min&&e.moveTo(e.index).catch(a._onCatch)}},this._onNextClick=function(){var e=a._flicking,t=e.camera,n=t.anchorPoints;if(!(e.animating||n.length<=0)){var i=n[n.length-1],r=a._moveCount;if(a._moveByViewportSize)e.control.moveToPosition(t.position+t.size,e.duration).catch(a._onCatch);else if(e.circularEnabled){for(var o=e.currentPanel,s=0;s<r;s++)o=o.next();o.focus().catch(a._onCatch)}else e.index<i.panel.index?e.moveTo(Math.min(e.index+r,i.panel.index)).catch(a._onCatch):t.position>t.range.min&&e.moveTo(e.index).catch(a._onCatch)}},this._onAnimation=function(){var e=a._flicking,t=e.camera,n=e.control.controller;e.holding?a._updateClass(t.position):a._updateClass(n.animatingContext.end)},this._onCatch=function(e){if(!(e instanceof m.FlickingError))throw e},this._parentEl=i,this._prevElSelector=o,this._nextElSelector=l,this._disabledClass=u,this._moveCount=_,this._moveByViewportSize=d}var t=e.prototype;return Object.defineProperty(t,"prevEl",{get:function(){return this._prevEl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"nextEl",{get:function(){return this._nextEl},enumerable:!1,configurable:!0}),Object.defineProperty(t,"parentEl",{get:function(){return this._parentEl},set:function(e){this._parentEl=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"prevElSelector",{get:function(){return this._prevElSelector},set:function(e){this._prevElSelector=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"nextElSelector",{get:function(){return this._nextElSelector},set:function(e){this._nextElSelector=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"disabledClass",{get:function(){return this._disabledClass},set:function(e){this._disabledClass=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"moveCount",{get:function(){return this._moveCount},set:function(e){this._moveCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"moveByViewportSize",{get:function(){return this._moveByViewportSize},set:function(e){this._moveByViewportSize=e},enumerable:!1,configurable:!0}),t.init=function(e){var t=this;this._flicking&&this.destroy(),(this._flicking=e).on(m.EVENTS.MOVE,this._onAnimation);var n=this._parentEl?this._parentEl:e.element,i=o(this._prevElSelector,n,"Arrow"),r=o(this._nextElSelector,n,"Arrow");[s.MOUSE_DOWN,s.TOUCH_START].forEach(function(e){i.addEventListener(e,t._preventInputPropagation,{passive:!0}),r.addEventListener(e,t._preventInputPropagation,{passive:!0})}),i.addEventListener(s.CLICK,this._onPrevClick),r.addEventListener(s.CLICK,this._onNextClick),this._prevEl=i,this._nextEl=r,this.update()},t.destroy=function(){var t=this,e=this._flicking;if(e){e.off(m.EVENTS.MOVE,this._onAnimation);var n=this._prevEl,i=this._nextEl;[s.MOUSE_DOWN,s.TOUCH_START].forEach(function(e){n.removeEventListener(e,t._preventInputPropagation),i.removeEventListener(e,t._preventInputPropagation)}),n.removeEventListener(s.CLICK,this._onPrevClick),i.removeEventListener(s.CLICK,this._onNextClick),this._flicking=null}},t.update=function(){this._updateClass(this._flicking.camera.position)},t._updateClass=function(e){var t=this._flicking,n=this._disabledClass,i=this._prevEl,r=this._nextEl,o=t.camera.range,s=!t.circularEnabled&&e<=o.min,a=!t.circularEnabled&&e>=o.max;s?T(i,n):b(i,n),a?T(r,n):b(r,n)},e}(),l=function(){function e(e){var s=this,t=void 0===e?{}:e,n=t.type,i=void 0===n?a.TYPE.CAMERA:n,r=t.synchronizedFlickingOptions,o=void 0===r?[]:r;this._flicking=null,this._addEvents=function(){var r=s._type;s._synchronizedFlickingOptions.forEach(function(e){var t=e.flicking,n=e.isSlidable,i=e.isClickable;r===a.TYPE.CAMERA&&(t.on(m.EVENTS.MOVE,s._onMove),t.on(m.EVENTS.MOVE_START,s._onMoveStart),t.on(m.EVENTS.MOVE_END,s._onMoveEnd)),r===a.TYPE.INDEX&&n&&(t.on(m.EVENTS.WILL_CHANGE,s._onIndexChange),t.on(m.EVENTS.WILL_RESTORE,s._onIndexChange)),i&&t.on(m.EVENTS.SELECT,s._onSelect)})},this._removeEvents=function(){var r=s._type;s._synchronizedFlickingOptions.forEach(function(e){var t=e.flicking,n=e.isSlidable,i=e.isClickable;r===a.TYPE.CAMERA&&(t.off(m.EVENTS.MOVE,s._onMove),t.off(m.EVENTS.MOVE_START,s._onMoveStart),t.off(m.EVENTS.MOVE_END,s._onMoveEnd)),r===a.TYPE.INDEX&&n&&(t.off(m.EVENTS.WILL_CHANGE,s._onIndexChange),t.off(m.EVENTS.WILL_RESTORE,s._onIndexChange)),i&&t.off(m.EVENTS.SELECT,s._onSelect)})},this._onIndexChange=function(e){var t=e.currentTarget;t.initialized&&s._synchronizeByIndex(t,e.index)},this._onMove=function(i){var r=i.currentTarget.camera,o=(r.position-r.range.min)/r.rangeDiff;s._synchronizedFlickingOptions.forEach(function(e){var t=e.flicking;if(t!==i.currentTarget){var n=0;n=r.position<r.range.min?r.position:r.position>r.range.max?t.camera.range.max+r.position-r.range.max:t.camera.range.min+t.camera.rangeDiff*o,t.camera.lookAt(n)}})},this._onMoveStart=function(n){s._synchronizedFlickingOptions.forEach(function(e){var t=e.flicking;t!==n.currentTarget&&t.disableInput()})},this._onMoveEnd=function(n){s._synchronizedFlickingOptions.forEach(function(e){var t=e.flicking;t!==n.currentTarget&&(t.enableInput(),t.control.updateInput())})},this._onSelect=function(e){e.currentTarget.moveTo(e.index).catch(function(){}),s._synchronizeByIndex(e.currentTarget,e.index)},this._synchronizeByIndex=function(i,r){var e=s._synchronizedFlickingOptions;s._preventEvent(function(){e.forEach(function(e){s._updateClass(e,r);var t=e.flicking;if(t!==i){var n=m.clamp(r,0,t.panels.length);t.animating?t.once(m.EVENTS.MOVE_END,function(){t.moveTo(n).catch(function(){})}):t.moveTo(n)}})})},this._updateClass=function(e,t){var n=e.flicking,i=e.activeClass;i&&n.panels.forEach(function(e){e.index===t?T(e.element,i):b(e.element,i)})},this._type=i,this._synchronizedFlickingOptions=o}var t=e.prototype;return Object.defineProperty(t,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"synchronizedFlickingOptions",{get:function(){return this._synchronizedFlickingOptions},set:function(e){this._synchronizedFlickingOptions=e},enumerable:!1,configurable:!0}),t.init=function(e){var n=this,t=this._synchronizedFlickingOptions;this._flicking&&this.destroy(),this._flicking=e,this._addEvents(),t.forEach(function(e){var t=e.flicking;n._updateClass(e,t.defaultIndex)})},t.destroy=function(){this._flicking&&(this._removeEvents(),this._flicking=null)},t.update=function(){var t=this;this._synchronizedFlickingOptions.forEach(function(e){t._updateClass(e,e.flicking.index)})},t._preventEvent=function(e){this._removeEvents(),e(),this._addEvents()},e}(),c=function(){function e(e){var t=this,n=void 0===e?{}:e,i=n.selector,r=void 0===i?"":i,o=n.scale,s=void 0===o?1:o,a=n.rotate,l=void 0===a?1:a,c=n.perspective,u=void 0===c?1e3:c;this.update=function(){t._onMove()},this._onMove=function(){var e=t._flicking,c=t._selector,u=t._scale,f=t._rotate,_=t._perspective;if(e){var h=e.horizontal;e.visiblePanels.forEach(function(e){var t=e.outsetProgress,n=e.element,i=c?n.querySelector(c):n,r=1/(Math.abs(t*u)+1),o=0<t?Math.min(90,100*t*f):Math.max(-90,100*t*f),s=h?[0,o]:[o,0],a=s[0],l=s[1];i.style.transform="perspective("+_+"px) rotateX("+a+"deg) rotateY("+l+"deg) scale("+r+")"})}},this._flicking=null,this._selector=r,this._scale=s,this._rotate=l,this._perspective=u}var t=e.prototype;return Object.defineProperty(t,"selector",{get:function(){return this._selector},set:function(e){this._selector=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scale",{get:function(){return this._scale},set:function(e){this._scale=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"perspective",{get:function(){return this._perspective},set:function(e){this._perspective=e},enumerable:!1,configurable:!0}),t.init=function(e){this._flicking&&this.destroy(),(this._flicking=e).on(m.EVENTS.MOVE,this._onMove),e.on(m.EVENTS.AFTER_RESIZE,this.update),this._onMove()},t.destroy=function(){this._flicking&&(this._flicking.off(m.EVENTS.MOVE,this._onMove),this._flicking.off(m.EVENTS.AFTER_RESIZE,this.update),this._flicking=null)},e}(),u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var _=function(){function e(e){var t=e.flicking,n=e.pagination,i=e.wrapper;this._flicking=t,this._pagination=n,this._wrapper=i}var t=e.prototype;return t._createBulletFromString=function(e,t){var n=document.createRange().createContextualFragment(e).firstChild;return this._addBulletEvents(n,t),n},t._addBulletEvents=function(e,t){var n=this,i=this._flicking.camera.anchorPoints[t].panel.index;e.addEventListener(s.MOUSE_DOWN,function(e){e.stopPropagation()}),e.addEventListener(s.TOUCH_START,function(e){e.stopPropagation()},{passive:!0}),e.addEventListener(s.CLICK,function(){n._flicking.moveTo(i).catch(function(e){if(!(e instanceof m.FlickingError))throw e})})},e}(),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._bullets=[],e._prevIndex=-1,e}f(e,t);var n=e.prototype;return Object.defineProperty(n,"_bulletClass",{get:function(){return this._pagination.classPrefix+"-"+O.BULLET_SUFFIX},enumerable:!1,configurable:!0}),Object.defineProperty(n,"_activeClass",{get:function(){return this._pagination.classPrefix+"-"+O.BULLET_ACTIVE_SUFFIX},enumerable:!1,configurable:!0}),n.destroy=function(){this._bullets=[],this._prevIndex=-1},n.render=function(){var n=this,i=this._flicking,e=this._pagination,t=this._wrapper,r=this._bulletClass,o=this._activeClass,s=e.renderBullet,a=e.renderActiveBullet,l=e.classPrefix+"-"+O.BULLET_WRAPPER_SUFFIX,c=i.camera.anchorPoints;T(t,l),t.innerHTML=c.map(function(e,t){return a&&e.panel.index===i.index?a(r,t):s(r,t)}).join("\n");var u=[].slice.call(t.children);u.forEach(function(e,t){c[t].panel.index===i.index&&(T(e,o),n._prevIndex=t),n._addBulletEvents(e,t)}),this._bullets=u},n.update=function(e){var t=this._flicking,n=this._pagination,i=this._wrapper,r=this._bullets,o=this._bulletClass,s=this._activeClass,a=this._prevIndex,l=t.camera.anchorPoints,c=n.renderBullet,u=n.renderActiveBullet;if(!(l.length<=0)){var f=e-l[0].panel.index;if(a!==f){if(u){if(p=r[a]){var _=this._createBulletFromString(c(o,a),a);p.parentElement.replaceChild(_,p),r[a]=_}var h=r[f],d=this._createBulletFromString(u(o+" "+s,f),f);i.replaceChild(d,h),r[f]=d}else{var p;h=r[f];(p=r[a])&&b(p,s),T(h,s)}this._prevIndex=f}}},e}(_),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._prevIndex=-1,e._prevTotal=-1,e}f(e,t);var n=e.prototype;return n.destroy=function(){this._prevIndex=-1,this._prevTotal=-1},n.render=function(){var e=this._flicking,t=this._wrapper,n=this._pagination,i=n.classPrefix+"-"+O.FRACTION_WRAPPER_SUFFIX,r=n.classPrefix+"-"+O.FRACTION_CURRENT_SUFFIX,o=n.classPrefix+"-"+O.FRACTION_TOTAL_SUFFIX;T(t,i),t.innerHTML=n.renderFraction(r,o),this.update(e.index)},n.update=function(e){var t=this._flicking,n=this._wrapper,i=this._pagination,r=t.camera.anchorPoints,o=0<r.length?e-r[0].panel.index+1:0,s=r.length;if(o!==this._prevIndex||s!==this._prevTotal){var a="."+i.classPrefix+"-"+O.FRACTION_CURRENT_SUFFIX,l="."+i.classPrefix+"-"+O.FRACTION_TOTAL_SUFFIX,c=n.querySelector(a),u=n.querySelector(l);c.innerHTML=i.fractionCurrentFormat(o),u.innerHTML=i.fractionTotalFormat(s),this._prevIndex=o,this._prevTotal=s}},e}(_),E=function(e){function t(){var o=null!==e&&e.apply(this,arguments)||this;return o._bullets=[],o._bulletSize=0,o._previousIndex=-1,o._sliderIndex=-1,o.moveTo=function(e){var t=o._pagination,n=o._wrapper.firstElementChild,i=o._bulletSize,r=i*t.bulletCount;n.style.transform="translate("+(r/2-(e+.5)*i)+"px)",o._sliderIndex=e},o}f(t,e);var n=t.prototype;return n.destroy=function(){this._bullets=[],this._bulletSize=0,this._previousIndex=-1,this._sliderIndex=-1},n.render=function(){var n=this,e=this._wrapper,t=this._flicking,i=this._pagination,r=i.renderBullet,o=t.camera.anchorPoints,s=i.classPrefix+"-"+O.SCROLL_WRAPPER_SUFFIX,a=i.classPrefix+"-"+O.BULLET_SUFFIX,l=i.classPrefix+"-"+O.SCROLL_SLIDER_SUFFIX,c=i.classPrefix+"-"+O.SCROLL_UNINIT_SUFFIX,u=document.createElement("div");T(u,l),T(e,c),T(e,s),e.appendChild(u),u.innerHTML=o.map(function(e,t){return r(a,t)}).join("\n");var f=[].slice.call(u.children);if(f.forEach(function(e,t){n._addBulletEvents(e,t)}),!(f.length<=0)){var _=getComputedStyle(f[0]),h=f[0].clientWidth+parseFloat(_.marginLeft)+parseFloat(_.marginRight);e.style.width=h*i.bulletCount+"px",this._bullets=f,this._bulletSize=h,this._previousIndex=-1,this.update(this._flicking.index),window.requestAnimationFrame(function(){b(e,c)})}},n.update=function(e){var t=this._pagination,n=this._flicking,i=this._bullets,r=this._previousIndex,o=t.renderBullet,s=t.renderActiveBullet,a=n.camera.anchorPoints,l=e-a[0].panel.index;if(!(a.length<=0)){var c=t.classPrefix+"-"+O.BULLET_SUFFIX,u=t.classPrefix+"-"+O.BULLET_ACTIVE_SUFFIX,f=t.classPrefix+"-"+O.SCROLL_PREV_SUFFIX,_=t.classPrefix+"-"+O.SCROLL_NEXT_SUFFIX,h=new RegExp("^"+f),d=new RegExp("^"+_);if(s){var p=i[r];if(p){var E=this._createBulletFromString(o(c,r),r);p.parentElement.replaceChild(E,p),i[r]=E}var v=i[l];if(v){var g=this._createBulletFromString(s(c,l),l);v.parentElement.replaceChild(g,v),i[l]=g}}i.forEach(function(e,t){for(var n=t-l,i=0,r=e.className.split(" ");i<r.length;i++){var o=r[i];(o===u||h.test(o)||d.test(o))&&b(e,o)}T(e,0==n?u:0<n?function(e){return _+(1<e?e:"")}(Math.abs(n)):function(e){return f+(1<e?e:"")}(Math.abs(n)))}),t.scrollOnChange(l,{total:i.length,prevIndex:r,sliderIndex:this._sliderIndex,direction:r<l?m.DIRECTION.NEXT:m.DIRECTION.PREV,bullets:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||t)}([],i),moveTo:this.moveTo}),this._previousIndex=l}},t}(_),v=function(){function e(e){var t=this,n=void 0===e?{}:e,i=n.parentEl,r=void 0===i?null:i,o=n.selector,s=void 0===o?O.SELECTOR:o,a=n.type,l=void 0===a?O.TYPE.BULLET:a,c=n.classPrefix,u=void 0===c?O.PREFIX:c,f=n.bulletCount,_=void 0===f?5:f,h=n.renderBullet,d=void 0===h?function(e){return'<span class="'+e+'"></span>'}:h,p=n.renderActiveBullet,E=void 0===p?null:p,v=n.renderFraction,g=void 0===v?function(e,t){return'<span class="'+e+'"></span>/<span class="'+t+'"></span>'}:v,m=n.fractionCurrentFormat,T=void 0===m?function(e){return e.toString()}:m,b=n.fractionTotalFormat,S=void 0===b?function(e){return e.toString()}:b,C=n.scrollOnChange,y=void 0===C?function(e,t){return t.moveTo(e)}:C;this._flicking=null,this.update=function(){t._removeAllChilds(),t._renderer.render()},this._onIndexChange=function(e){t._renderer.update(e.index)},this._parentEl=r,this._selector=s,this._type=l,this._classPrefix=u,this._bulletCount=_,this._renderBullet=d,this._renderActiveBullet=E,this._renderFraction=g,this._fractionCurrentFormat=T,this._fractionTotalFormat=S,this._scrollOnChange=y}var t=e.prototype;return Object.defineProperty(t,"parentEl",{get:function(){return this._parentEl},set:function(e){this._parentEl=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"selector",{get:function(){return this._selector},set:function(e){this._selector=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"classPrefix",{get:function(){return this._classPrefix},enumerable:!1,configurable:!0}),Object.defineProperty(t,"bulletCount",{get:function(){return this._bulletCount},set:function(e){this._bulletCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"renderBullet",{get:function(){return this._renderBullet},set:function(e){this._renderBullet=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"renderActiveBullet",{get:function(){return this._renderActiveBullet},set:function(e){this._renderActiveBullet=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"renderFraction",{get:function(){return this._renderFraction},set:function(e){this._renderFraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fractionCurrentFormat",{get:function(){return this._fractionCurrentFormat},set:function(e){this._fractionCurrentFormat=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fractionTotalFormat",{get:function(){return this._fractionTotalFormat},set:function(e){this._fractionTotalFormat=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"scrollOnChange",{get:function(){return this._scrollOnChange},set:function(e){this._scrollOnChange=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"bulletWrapperclassPrefixClass",{set:function(e){this._classPrefix=e},enumerable:!1,configurable:!0}),t.init=function(e){this._flicking&&this.destroy(),this._flicking=e;var t=this._type,n=this._selector,i=(this._parentEl?this._parentEl:e.element).querySelector(n);if(!i)throw new Error("[Flicking-Pagination] Couldn't find element with the given selector: "+n);this._wrapper=i,this._renderer=this._createRenderer(t),e.on(m.EVENTS.WILL_CHANGE,this._onIndexChange),e.on(m.EVENTS.WILL_RESTORE,this._onIndexChange),e.on(m.EVENTS.PANEL_CHANGE,this.update),this.update()},t.destroy=function(){var e=this._flicking;e&&(e.off(m.EVENTS.WILL_CHANGE,this._onIndexChange),e.off(m.EVENTS.WILL_RESTORE,this._onIndexChange),e.off(m.EVENTS.PANEL_CHANGE,this.update),this._renderer.destroy(),this._removeAllChilds(),this._flicking=null)},t._createRenderer=function(e){var t={flicking:this._flicking,pagination:this,wrapper:this._wrapper};switch(e){case O.TYPE.BULLET:return new h(t);case O.TYPE.FRACTION:return new d(t);case O.TYPE.SCROLL:return new E(t);default:throw new Error('[Flicking-Pagination] type "'+e+'" is not supported.')}},t._removeAllChilds=function(){for(var e=this._wrapper;e.firstChild;)e.removeChild(e.firstChild)},e}();e.ARROW=p,e.Arrow=r,e.AutoPlay=i,e.Fade=n,e.PAGINATION=O,e.Pagination=v,e.Parallax=t,e.Perspective=c,e.SYNC=a,e.Sync=l});
|
|
10
10
|
//# sourceMappingURL=plugins.min.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egjs/flicking-plugins",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2-beta.0",
|
|
4
4
|
"description": "Ready-to-use plugins for @egjs/flicking",
|
|
5
5
|
"module": "./dist/plugins.esm.js",
|
|
6
6
|
"main": "./dist/plugins.js",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"not op_mini all"
|
|
59
59
|
],
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@egjs/flicking": "^4.
|
|
61
|
+
"@egjs/flicking": "^4.11.5-beta.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@egjs/build-helper": "0.0.5",
|
|
65
|
-
"@egjs/flicking": "^4.
|
|
65
|
+
"@egjs/flicking": "^4.11.5-beta.0",
|
|
66
66
|
"@egjs/release-helper": "0.0.3",
|
|
67
67
|
"@types/chai": "^4.0.10",
|
|
68
68
|
"@types/karma-chai": "^0.1.1",
|