@egjs/flicking-plugins 4.7.1 → 4.8.0-beta.1

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.1
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,27 @@ 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 {boolean} options.stopOnInit Whether to stop when mouse hover upon the element.<ko>엘리먼트에 마우스를 올렸을 AutoPlay를 정지할지 여부</ko>
235
+ * @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>
236
+ * @example
237
+ * ```ts
238
+ * flicking.addPlugins(new AutoPlay({ duration: 2000, direction: "NEXT" }));
239
+ * ```
239
240
  */
240
241
  function AutoPlay(_a) {
241
242
  var _this = this;
@@ -249,6 +250,8 @@ version: 4.7.1
249
250
  direction = _e === void 0 ? flicking.DIRECTION.NEXT : _e,
250
251
  _f = _b.stopOnHover,
251
252
  stopOnHover = _f === void 0 ? false : _f,
253
+ _g = _b.stopOnInit,
254
+ stopOnInit = _g === void 0 ? false : _g,
252
255
  delayAfterHover = _b.delayAfterHover;
253
256
  /* Internal Values */
254
257
 
@@ -283,6 +286,7 @@ version: 4.7.1
283
286
  this._animationDuration = animationDuration;
284
287
  this._direction = direction;
285
288
  this._stopOnHover = stopOnHover;
289
+ this._stopOnInit = stopOnInit;
286
290
  this._delayAfterHover = delayAfterHover !== null && delayAfterHover !== void 0 ? delayAfterHover : duration;
287
291
  }
288
292
 
@@ -327,6 +331,16 @@ version: 4.7.1
327
331
  enumerable: false,
328
332
  configurable: true
329
333
  });
334
+ Object.defineProperty(__proto, "stopOnInit", {
335
+ get: function () {
336
+ return this._stopOnInit;
337
+ },
338
+ set: function (val) {
339
+ this._stopOnInit = val;
340
+ },
341
+ enumerable: false,
342
+ configurable: true
343
+ });
330
344
  Object.defineProperty(__proto, "delayAfterHover", {
331
345
  get: function () {
332
346
  return this._delayAfterHover;
@@ -361,7 +375,9 @@ version: 4.7.1
361
375
  targetEl.addEventListener("mouseleave", this._onMouseLeave, false);
362
376
  }
363
377
 
364
- this.play();
378
+ if (!this._stopOnInit) {
379
+ this.play();
380
+ }
365
381
  };
366
382
 
367
383
  __proto.destroy = function () {
@@ -541,10 +557,10 @@ version: 4.7.1
541
557
  return el;
542
558
  };
543
559
 
544
- /**
545
- * A plugin to easily create prev/right arrow button of Flicking
546
- * @ko 이전/다음 버튼을 쉽게 만들 수 있는 플러그인
547
- * @memberof Flicking.Plugins
560
+ /**
561
+ * A plugin to easily create prev/right arrow button of Flicking
562
+ * @ko 이전/다음 버튼을 쉽게 만들 수 있는 플러그인
563
+ * @memberof Flicking.Plugins
548
564
  */
549
565
 
550
566
  var Arrow =
@@ -565,7 +581,9 @@ version: 4.7.1
565
581
  _g = _b.moveCount,
566
582
  moveCount = _g === void 0 ? 1 : _g,
567
583
  _h = _b.moveByViewportSize,
568
- moveByViewportSize = _h === void 0 ? false : _h;
584
+ moveByViewportSize = _h === void 0 ? false : _h,
585
+ _j = _b.interruptable,
586
+ interruptable = _j === void 0 ? false : _j;
569
587
  /* Internal Values */
570
588
 
571
589
 
@@ -577,9 +595,16 @@ version: 4.7.1
577
595
 
578
596
  this._onPrevClick = function () {
579
597
  var flicking = _this._flicking;
598
+ var index = flicking.animating ? _this._nextIndex : flicking.index;
599
+ var currentPanel = flicking.animating ? flicking.panels[_this._nextIndex] : flicking.currentPanel;
580
600
  var camera = flicking.camera;
581
601
  var anchorPoints = camera.anchorPoints;
582
- if (flicking.animating || anchorPoints.length <= 0) return;
602
+ if (flicking.animating && !_this.interruptable || anchorPoints.length <= 0) return;
603
+
604
+ if (flicking.animating) {
605
+ flicking.stopAnimation();
606
+ }
607
+
583
608
  var firstAnchor = anchorPoints[0];
584
609
  var moveCount = _this._moveCount;
585
610
 
@@ -587,26 +612,33 @@ version: 4.7.1
587
612
  flicking.control.moveToPosition(camera.position - camera.size, flicking.duration).catch(_this._onCatch);
588
613
  } else {
589
614
  if (flicking.circularEnabled) {
590
- var targetPanel = flicking.currentPanel;
615
+ var targetPanel = currentPanel;
591
616
 
592
617
  for (var i = 0; i < moveCount; i++) {
593
618
  targetPanel = targetPanel.prev();
594
619
  }
595
620
 
596
621
  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);
622
+ } else if (index > firstAnchor.panel.index) {
623
+ flicking.moveTo(Math.max(index - moveCount, firstAnchor.panel.index)).catch(_this._onCatch);
599
624
  } else if (camera.position > camera.range.min) {
600
- flicking.moveTo(flicking.index).catch(_this._onCatch);
625
+ flicking.moveTo(index).catch(_this._onCatch);
601
626
  }
602
627
  }
603
628
  };
604
629
 
605
630
  this._onNextClick = function () {
606
631
  var flicking = _this._flicking;
632
+ var index = flicking.animating ? _this._nextIndex : flicking.index;
633
+ var currentPanel = flicking.animating ? flicking.panels[_this._nextIndex] : flicking.currentPanel;
607
634
  var camera = flicking.camera;
608
635
  var anchorPoints = camera.anchorPoints;
609
- if (flicking.animating || anchorPoints.length <= 0) return;
636
+ if (flicking.animating && !_this.interruptable || anchorPoints.length <= 0) return;
637
+
638
+ if (flicking.animating) {
639
+ flicking.stopAnimation();
640
+ }
641
+
610
642
  var lastAnchor = anchorPoints[anchorPoints.length - 1];
611
643
  var moveCount = _this._moveCount;
612
644
 
@@ -614,17 +646,17 @@ version: 4.7.1
614
646
  flicking.control.moveToPosition(camera.position + camera.size, flicking.duration).catch(_this._onCatch);
615
647
  } else {
616
648
  if (flicking.circularEnabled) {
617
- var targetPanel = flicking.currentPanel;
649
+ var targetPanel = currentPanel;
618
650
 
619
651
  for (var i = 0; i < moveCount; i++) {
620
652
  targetPanel = targetPanel.next();
621
653
  }
622
654
 
623
655
  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);
656
+ } else if (index < lastAnchor.panel.index) {
657
+ flicking.moveTo(Math.min(index + moveCount, lastAnchor.panel.index)).catch(_this._onCatch);
626
658
  } else if (camera.position > camera.range.min) {
627
- flicking.moveTo(flicking.index).catch(_this._onCatch);
659
+ flicking.moveTo(index).catch(_this._onCatch);
628
660
  }
629
661
  }
630
662
  };
@@ -641,6 +673,10 @@ version: 4.7.1
641
673
  }
642
674
  };
643
675
 
676
+ this._onWillChange = function (e) {
677
+ _this._nextIndex = e.index;
678
+ };
679
+
644
680
  this._onCatch = function (err) {
645
681
  if (err instanceof flicking.FlickingError) return;
646
682
  throw err;
@@ -652,6 +688,7 @@ version: 4.7.1
652
688
  this._disabledClass = disabledClass;
653
689
  this._moveCount = moveCount;
654
690
  this._moveByViewportSize = moveByViewportSize;
691
+ this._interruptable = interruptable;
655
692
  }
656
693
 
657
694
  var __proto = Arrow.prototype;
@@ -729,6 +766,16 @@ version: 4.7.1
729
766
  enumerable: false,
730
767
  configurable: true
731
768
  });
769
+ Object.defineProperty(__proto, "interruptable", {
770
+ get: function () {
771
+ return this._interruptable;
772
+ },
773
+ set: function (val) {
774
+ this._interruptable = val;
775
+ },
776
+ enumerable: false,
777
+ configurable: true
778
+ });
732
779
 
733
780
  __proto.init = function (flicking$1) {
734
781
  var _this = this;
@@ -739,6 +786,7 @@ version: 4.7.1
739
786
 
740
787
  this._flicking = flicking$1;
741
788
  flicking$1.on(flicking.EVENTS.MOVE, this._onAnimation);
789
+ flicking$1.on(flicking.EVENTS.WILL_CHANGE, this._onWillChange);
742
790
  var parentEl = this._parentEl ? this._parentEl : flicking$1.element;
743
791
  var prevEl = getElement(this._prevElSelector, parentEl, "Arrow");
744
792
  var nextEl = getElement(this._nextElSelector, parentEl, "Arrow");
@@ -767,6 +815,7 @@ version: 4.7.1
767
815
  }
768
816
 
769
817
  flicking$1.off(flicking.EVENTS.MOVE, this._onAnimation);
818
+ flicking$1.off(flicking.EVENTS.WILL_CHANGE, this._onWillChange);
770
819
  var prevEl = this._prevEl;
771
820
  var nextEl = this._nextEl;
772
821
  [BROWSER.MOUSE_DOWN, BROWSER.TOUCH_START].forEach(function (evt) {
@@ -807,10 +856,10 @@ version: 4.7.1
807
856
  return Arrow;
808
857
  }();
809
858
 
810
- /**
811
- * Plugin for synchronizing multiple flickings
812
- * @ko 다양한 형태로 Flicking들이 같이 움직이게 할 수 있습니다.
813
- * @memberof Flicking.Plugins
859
+ /**
860
+ * Plugin for synchronizing multiple flickings
861
+ * @ko 다양한 형태로 Flicking들이 같이 움직이게 할 수 있습니다.
862
+ * @memberof Flicking.Plugins
814
863
  */
815
864
 
816
865
  var Sync =
@@ -1057,24 +1106,24 @@ version: 4.7.1
1057
1106
  }();
1058
1107
 
1059
1108
  /* eslint-disable no-underscore-dangle */
1060
- /**
1061
- * You can apply perspective effect while panel is moving.
1062
- * @ko 패널들을 움직이면서 입체감을 부여할 수 있습니다.
1063
- * @memberof Flicking.Plugins
1109
+ /**
1110
+ * You can apply perspective effect while panel is moving.
1111
+ * @ko 패널들을 움직이면서 입체감을 부여할 수 있습니다.
1112
+ * @memberof Flicking.Plugins
1064
1113
  */
1065
1114
 
1066
1115
  var Perspective =
1067
1116
  /*#__PURE__*/
1068
1117
  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
- * ```
1118
+ /**
1119
+ * @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>
1120
+ * @param - Effect amplication scale.<ko>효과 증폭도</ko>
1121
+ * @param - Effect amplication rotate.<ko>회전 증폭도</ko>
1122
+ * @param - The value of perspective CSS property. <ko>css perspective 속성 값</ko>
1123
+ * @example
1124
+ * ```ts
1125
+ * flicking.addPlugins(new Perspective({ selector: "p", scale: 1, rotate: 1, perspective = 1000 }));
1126
+ * ```
1078
1127
  */
1079
1128
  function Perspective(_a) {
1080
1129
  var _this = this;
@@ -1611,8 +1660,8 @@ version: 4.7.1
1611
1660
  return ScrollBulletRenderer;
1612
1661
  }(Renderer);
1613
1662
 
1614
- /**
1615
- * @memberof Flicking.Plugins
1663
+ /**
1664
+ * @memberof Flicking.Plugins
1616
1665
  */
1617
1666
 
1618
1667
  var Pagination =
@@ -1872,8 +1921,8 @@ version: 4.7.1
1872
1921
  return Pagination;
1873
1922
  }();
1874
1923
 
1875
- /**
1876
- * @namespace Flicking
1924
+ /**
1925
+ * @namespace Flicking
1877
1926
  */
1878
1927
 
1879
1928
  exports.ARROW = ARROW;