@egjs/flicking-plugins 4.7.1 → 4.8.0-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.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.1
7
+ version: 4.8.0-beta.0
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@egjs/flicking')) :
@@ -12,22 +12,22 @@ version: 4.7.1
12
12
  (global = global || self, factory((global.Flicking = global.Flicking || {}, global.Flicking.Plugins = {}), global.Flicking));
13
13
  }(this, function (exports, flicking) { 'use strict';
14
14
 
15
- /**
16
- * You can apply parallax effect while panel is moving.
17
- * @ko 패널들을 움직이면서 parallax 효과를 부여할 수 있습니다.
18
- * @memberof Flicking.Plugins
15
+ /**
16
+ * You can apply parallax effect while panel is moving.
17
+ * @ko 패널들을 움직이면서 parallax 효과를 부여할 수 있습니다.
18
+ * @memberof Flicking.Plugins
19
19
  */
20
20
 
21
21
  var Parallax =
22
22
  /*#__PURE__*/
23
23
  function () {
24
- /**
25
- * @param {string} selector Selector of the element to apply parallax effect<ko> Parallax 효과를 적용할 엘리먼트의 선택자 </ko>
26
- * @param {number} scale Effect amplication scale<ko>효과 증폭도</ko>
27
- * @example
28
- * ```ts
29
- * flicking.addPlugins(new Parallax("img", 1));
30
- * ```
24
+ /**
25
+ * @param {string} selector Selector of the element to apply parallax effect<ko> Parallax 효과를 적용할 엘리먼트의 선택자 </ko>
26
+ * @param {number} scale Effect amplication scale<ko>효과 증폭도</ko>
27
+ * @example
28
+ * ```ts
29
+ * flicking.addPlugins(new Parallax("img", 1));
30
+ * ```
31
31
  */
32
32
  function Parallax(selector, scale) {
33
33
  var _this = this;
@@ -114,22 +114,22 @@ version: 4.7.1
114
114
  return Parallax;
115
115
  }();
116
116
 
117
- /**
118
- * You can apply fade in / out effect while panel is moving.
119
- * @ko 패널들을 움직이면서 fade in / out 효과를 부여할 수 있습니다.
120
- * @memberof Flicking.Plugins
117
+ /**
118
+ * You can apply fade in / out effect while panel is moving.
119
+ * @ko 패널들을 움직이면서 fade in / out 효과를 부여할 수 있습니다.
120
+ * @memberof Flicking.Plugins
121
121
  */
122
122
 
123
123
  var Fade =
124
124
  /*#__PURE__*/
125
125
  function () {
126
- /**
127
- * @param - The selector of the element to which the fade effect is to be applied. If the selector is blank, it applies to panel element. <ko>Fade 효과를 적용할 대상의 선택자. 선택자가 공백이면 패널 엘리먼트에 적용된다.</ko>
128
- * @param - Effect amplication scale<ko>효과 증폭도</ko>
129
- * @example
130
- * ```ts
131
- * flicking.addPlugins(new Fade("p", 1));
132
- * ```
126
+ /**
127
+ * @param - The selector of the element to which the fade effect is to be applied. If the selector is blank, it applies to panel element. <ko>Fade 효과를 적용할 대상의 선택자. 선택자가 공백이면 패널 엘리먼트에 적용된다.</ko>
128
+ * @param - Effect amplication scale<ko>효과 증폭도</ko>
129
+ * @example
130
+ * ```ts
131
+ * flicking.addPlugins(new Fade("p", 1));
132
+ * ```
133
133
  */
134
134
  function Fade(selector, scale) {
135
135
  var _this = this;
@@ -216,26 +216,26 @@ version: 4.7.1
216
216
  return Fade;
217
217
  }();
218
218
 
219
- /**
220
- * Plugin that allow you to automatically move to the next/previous panel, on a specific time basis
221
- * @ko 일정 시간마다, 자동으로 다음/이전 패널로 넘어가도록 할 수 있는 플러그인
222
- * @memberof Flicking.Plugins
219
+ /**
220
+ * Plugin that allow you to automatically move to the next/previous panel, on a specific time basis
221
+ * @ko 일정 시간마다, 자동으로 다음/이전 패널로 넘어가도록 할 수 있는 플러그인
222
+ * @memberof Flicking.Plugins
223
223
  */
224
224
 
225
225
  var AutoPlay =
226
226
  /*#__PURE__*/
227
227
  function () {
228
- /**
229
- * @param {AutoPlayOptions} options Options for the AutoPlay instance.<ko>AutoPlay 옵션</ko>
230
- * @param {number} options.duration Time to wait before moving on to the next panel.<ko>다음 패널로 움직이기까지 대기 시간</ko>
231
- * @param {number | undefined} options.animationDuration Duration of animation of moving to the next panel. If undefined, duration option of the Flicking instance is used instead.<ko>패널이 움직이는 애니메이션의 지속 시간, undefined라면 Flicking 인스턴스의 duration 값을 사용한다</ko>
232
- * @param {"PREV" | "NEXT"} options.direction The direction in which the panel moves.<ko>패널이 움직이는 방향</ko>
233
- * @param {boolean} options.stopOnHover Whether to stop when mouse hover upon the element.<ko>엘리먼트에 마우스를 올렸을 때 AutoPlay를 정지할지 여부</ko>
234
- * @param {number} options.delayAfterHover If stopOnHover is true, the amount of time to wait before moving on to the next panel when mouse leaves the element.<ko>stopOnHover를 사용한다면 마우스가 엘리먼트로부터 나간 뒤 다음 패널로 움직이기까지 대기 시간</ko>
235
- * @example
236
- * ```ts
237
- * flicking.addPlugins(new AutoPlay({ duration: 2000, direction: "NEXT" }));
238
- * ```
228
+ /**
229
+ * @param {AutoPlayOptions} options Options for the AutoPlay instance.<ko>AutoPlay 옵션</ko>
230
+ * @param {number} options.duration Time to wait before moving on to the next panel.<ko>다음 패널로 움직이기까지 대기 시간</ko>
231
+ * @param {number | undefined} options.animationDuration Duration of animation of moving to the next panel. If undefined, duration option of the Flicking instance is used instead.<ko>패널이 움직이는 애니메이션의 지속 시간, undefined라면 Flicking 인스턴스의 duration 값을 사용한다</ko>
232
+ * @param {"PREV" | "NEXT"} options.direction The direction in which the panel moves.<ko>패널이 움직이는 방향</ko>
233
+ * @param {boolean} options.stopOnHover Whether to stop when mouse hover upon the element.<ko>엘리먼트에 마우스를 올렸을 때 AutoPlay를 정지할지 여부</ko>
234
+ * @param {number} options.delayAfterHover If stopOnHover is true, the amount of time to wait before moving on to the next panel when mouse leaves the element.<ko>stopOnHover를 사용한다면 마우스가 엘리먼트로부터 나간 뒤 다음 패널로 움직이기까지 대기 시간</ko>
235
+ * @example
236
+ * ```ts
237
+ * flicking.addPlugins(new AutoPlay({ duration: 2000, direction: "NEXT" }));
238
+ * ```
239
239
  */
240
240
  function AutoPlay(_a) {
241
241
  var _this = this;
@@ -541,10 +541,10 @@ version: 4.7.1
541
541
  return el;
542
542
  };
543
543
 
544
- /**
545
- * A plugin to easily create prev/right arrow button of Flicking
546
- * @ko 이전/다음 버튼을 쉽게 만들 수 있는 플러그인
547
- * @memberof Flicking.Plugins
544
+ /**
545
+ * A plugin to easily create prev/right arrow button of Flicking
546
+ * @ko 이전/다음 버튼을 쉽게 만들 수 있는 플러그인
547
+ * @memberof Flicking.Plugins
548
548
  */
549
549
 
550
550
  var Arrow =
@@ -565,7 +565,9 @@ version: 4.7.1
565
565
  _g = _b.moveCount,
566
566
  moveCount = _g === void 0 ? 1 : _g,
567
567
  _h = _b.moveByViewportSize,
568
- moveByViewportSize = _h === void 0 ? false : _h;
568
+ moveByViewportSize = _h === void 0 ? false : _h,
569
+ _j = _b.interruptable,
570
+ interruptable = _j === void 0 ? false : _j;
569
571
  /* Internal Values */
570
572
 
571
573
 
@@ -577,9 +579,16 @@ version: 4.7.1
577
579
 
578
580
  this._onPrevClick = function () {
579
581
  var flicking = _this._flicking;
582
+ var index = flicking.animating ? _this._nextIndex : flicking.index;
583
+ var currentPanel = flicking.animating ? flicking.panels[_this._nextIndex] : flicking.currentPanel;
580
584
  var camera = flicking.camera;
581
585
  var anchorPoints = camera.anchorPoints;
582
- if (flicking.animating || anchorPoints.length <= 0) return;
586
+ if (flicking.animating && !_this.interruptable || anchorPoints.length <= 0) return;
587
+
588
+ if (flicking.animating) {
589
+ flicking.stopAnimation();
590
+ }
591
+
583
592
  var firstAnchor = anchorPoints[0];
584
593
  var moveCount = _this._moveCount;
585
594
 
@@ -587,26 +596,33 @@ version: 4.7.1
587
596
  flicking.control.moveToPosition(camera.position - camera.size, flicking.duration).catch(_this._onCatch);
588
597
  } else {
589
598
  if (flicking.circularEnabled) {
590
- var targetPanel = flicking.currentPanel;
599
+ var targetPanel = currentPanel;
591
600
 
592
601
  for (var i = 0; i < moveCount; i++) {
593
602
  targetPanel = targetPanel.prev();
594
603
  }
595
604
 
596
605
  targetPanel.focus().catch(_this._onCatch);
597
- } else if (flicking.index > firstAnchor.panel.index) {
598
- flicking.moveTo(Math.max(flicking.index - moveCount, firstAnchor.panel.index)).catch(_this._onCatch);
606
+ } else if (index > firstAnchor.panel.index) {
607
+ flicking.moveTo(Math.max(index - moveCount, firstAnchor.panel.index)).catch(_this._onCatch);
599
608
  } else if (camera.position > camera.range.min) {
600
- flicking.moveTo(flicking.index).catch(_this._onCatch);
609
+ flicking.moveTo(index).catch(_this._onCatch);
601
610
  }
602
611
  }
603
612
  };
604
613
 
605
614
  this._onNextClick = function () {
606
615
  var flicking = _this._flicking;
616
+ var index = flicking.animating ? _this._nextIndex : flicking.index;
617
+ var currentPanel = flicking.animating ? flicking.panels[_this._nextIndex] : flicking.currentPanel;
607
618
  var camera = flicking.camera;
608
619
  var anchorPoints = camera.anchorPoints;
609
- if (flicking.animating || anchorPoints.length <= 0) return;
620
+ if (flicking.animating && !_this.interruptable || anchorPoints.length <= 0) return;
621
+
622
+ if (flicking.animating) {
623
+ flicking.stopAnimation();
624
+ }
625
+
610
626
  var lastAnchor = anchorPoints[anchorPoints.length - 1];
611
627
  var moveCount = _this._moveCount;
612
628
 
@@ -614,17 +630,17 @@ version: 4.7.1
614
630
  flicking.control.moveToPosition(camera.position + camera.size, flicking.duration).catch(_this._onCatch);
615
631
  } else {
616
632
  if (flicking.circularEnabled) {
617
- var targetPanel = flicking.currentPanel;
633
+ var targetPanel = currentPanel;
618
634
 
619
635
  for (var i = 0; i < moveCount; i++) {
620
636
  targetPanel = targetPanel.next();
621
637
  }
622
638
 
623
639
  targetPanel.focus().catch(_this._onCatch);
624
- } else if (flicking.index < lastAnchor.panel.index) {
625
- flicking.moveTo(Math.min(flicking.index + moveCount, lastAnchor.panel.index)).catch(_this._onCatch);
640
+ } else if (index < lastAnchor.panel.index) {
641
+ flicking.moveTo(Math.min(index + moveCount, lastAnchor.panel.index)).catch(_this._onCatch);
626
642
  } else if (camera.position > camera.range.min) {
627
- flicking.moveTo(flicking.index).catch(_this._onCatch);
643
+ flicking.moveTo(index).catch(_this._onCatch);
628
644
  }
629
645
  }
630
646
  };
@@ -641,6 +657,10 @@ version: 4.7.1
641
657
  }
642
658
  };
643
659
 
660
+ this._onWillChange = function (e) {
661
+ _this._nextIndex = e.index;
662
+ };
663
+
644
664
  this._onCatch = function (err) {
645
665
  if (err instanceof flicking.FlickingError) return;
646
666
  throw err;
@@ -652,6 +672,7 @@ version: 4.7.1
652
672
  this._disabledClass = disabledClass;
653
673
  this._moveCount = moveCount;
654
674
  this._moveByViewportSize = moveByViewportSize;
675
+ this._interruptable = interruptable;
655
676
  }
656
677
 
657
678
  var __proto = Arrow.prototype;
@@ -729,6 +750,16 @@ version: 4.7.1
729
750
  enumerable: false,
730
751
  configurable: true
731
752
  });
753
+ Object.defineProperty(__proto, "interruptable", {
754
+ get: function () {
755
+ return this._interruptable;
756
+ },
757
+ set: function (val) {
758
+ this._interruptable = val;
759
+ },
760
+ enumerable: false,
761
+ configurable: true
762
+ });
732
763
 
733
764
  __proto.init = function (flicking$1) {
734
765
  var _this = this;
@@ -739,6 +770,7 @@ version: 4.7.1
739
770
 
740
771
  this._flicking = flicking$1;
741
772
  flicking$1.on(flicking.EVENTS.MOVE, this._onAnimation);
773
+ flicking$1.on(flicking.EVENTS.WILL_CHANGE, this._onWillChange);
742
774
  var parentEl = this._parentEl ? this._parentEl : flicking$1.element;
743
775
  var prevEl = getElement(this._prevElSelector, parentEl, "Arrow");
744
776
  var nextEl = getElement(this._nextElSelector, parentEl, "Arrow");
@@ -767,6 +799,7 @@ version: 4.7.1
767
799
  }
768
800
 
769
801
  flicking$1.off(flicking.EVENTS.MOVE, this._onAnimation);
802
+ flicking$1.off(flicking.EVENTS.WILL_CHANGE, this._onWillChange);
770
803
  var prevEl = this._prevEl;
771
804
  var nextEl = this._nextEl;
772
805
  [BROWSER.MOUSE_DOWN, BROWSER.TOUCH_START].forEach(function (evt) {
@@ -807,10 +840,10 @@ version: 4.7.1
807
840
  return Arrow;
808
841
  }();
809
842
 
810
- /**
811
- * Plugin for synchronizing multiple flickings
812
- * @ko 다양한 형태로 Flicking들이 같이 움직이게 할 수 있습니다.
813
- * @memberof Flicking.Plugins
843
+ /**
844
+ * Plugin for synchronizing multiple flickings
845
+ * @ko 다양한 형태로 Flicking들이 같이 움직이게 할 수 있습니다.
846
+ * @memberof Flicking.Plugins
814
847
  */
815
848
 
816
849
  var Sync =
@@ -1057,24 +1090,24 @@ version: 4.7.1
1057
1090
  }();
1058
1091
 
1059
1092
  /* eslint-disable no-underscore-dangle */
1060
- /**
1061
- * You can apply perspective effect while panel is moving.
1062
- * @ko 패널들을 움직이면서 입체감을 부여할 수 있습니다.
1063
- * @memberof Flicking.Plugins
1093
+ /**
1094
+ * You can apply perspective effect while panel is moving.
1095
+ * @ko 패널들을 움직이면서 입체감을 부여할 수 있습니다.
1096
+ * @memberof Flicking.Plugins
1064
1097
  */
1065
1098
 
1066
1099
  var Perspective =
1067
1100
  /*#__PURE__*/
1068
1101
  function () {
1069
- /**
1070
- * @param - The selector of the element to which the perspective effect is to be applied. If the selector is blank, it applies to panel element. <ko>입체 효과를 적용할 대상의 선택자. 선택자가 공백이면 패널 엘리먼트에 적용된다.</ko>
1071
- * @param - Effect amplication scale.<ko>효과 증폭도</ko>
1072
- * @param - Effect amplication rotate.<ko>회전 증폭도</ko>
1073
- * @param - The value of perspective CSS property. <ko>css perspective 속성 값</ko>
1074
- * @example
1075
- * ```ts
1076
- * flicking.addPlugins(new Perspective({ selector: "p", scale: 1, rotate: 1, perspective = 1000 }));
1077
- * ```
1102
+ /**
1103
+ * @param - The selector of the element to which the perspective effect is to be applied. If the selector is blank, it applies to panel element. <ko>입체 효과를 적용할 대상의 선택자. 선택자가 공백이면 패널 엘리먼트에 적용된다.</ko>
1104
+ * @param - Effect amplication scale.<ko>효과 증폭도</ko>
1105
+ * @param - Effect amplication rotate.<ko>회전 증폭도</ko>
1106
+ * @param - The value of perspective CSS property. <ko>css perspective 속성 값</ko>
1107
+ * @example
1108
+ * ```ts
1109
+ * flicking.addPlugins(new Perspective({ selector: "p", scale: 1, rotate: 1, perspective = 1000 }));
1110
+ * ```
1078
1111
  */
1079
1112
  function Perspective(_a) {
1080
1113
  var _this = this;
@@ -1611,8 +1644,8 @@ version: 4.7.1
1611
1644
  return ScrollBulletRenderer;
1612
1645
  }(Renderer);
1613
1646
 
1614
- /**
1615
- * @memberof Flicking.Plugins
1647
+ /**
1648
+ * @memberof Flicking.Plugins
1616
1649
  */
1617
1650
 
1618
1651
  var Pagination =
@@ -1872,8 +1905,8 @@ version: 4.7.1
1872
1905
  return Pagination;
1873
1906
  }();
1874
1907
 
1875
- /**
1876
- * @namespace Flicking
1908
+ /**
1909
+ * @namespace Flicking
1877
1910
  */
1878
1911
 
1879
1912
  exports.ARROW = ARROW;