@egjs/flicking 4.7.0 → 4.7.3

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.
@@ -4,7 +4,7 @@ name: @egjs/flicking
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-flicking
7
- version: 4.7.0
7
+ version: 4.7.3
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2281,7 +2281,7 @@ version: 4.7.0
2281
2281
  license: MIT
2282
2282
  author: NAVER Corp.
2283
2283
  repository: https://github.com/naver/egjs-axes
2284
- version: 3.1.1-snapshot
2284
+ version: 3.2.2
2285
2285
  */
2286
2286
 
2287
2287
  /*! *****************************************************************************
@@ -2379,8 +2379,7 @@ version: 4.7.0
2379
2379
 
2380
2380
  return "";
2381
2381
  }();
2382
- var PREVENT_SCROLL_CSSPROPS = {
2383
- "touch-action": "none",
2382
+ var PREVENT_DRAG_CSSPROPS = {
2384
2383
  "user-select": "none",
2385
2384
  "-webkit-user-drag": "none"
2386
2385
  };
@@ -2590,11 +2589,28 @@ version: 4.7.0
2590
2589
  var getAngle = function (posX, posY) {
2591
2590
  return Math.atan2(posY, posX) * 180 / Math.PI;
2592
2591
  };
2593
- var setCssProps = function (element, originalCssProps) {
2592
+ var isCssPropsFromAxes = function (originalCssProps) {
2593
+ var same = true;
2594
+ Object.keys(PREVENT_DRAG_CSSPROPS).forEach(function (prop) {
2595
+ if (!originalCssProps || originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]) {
2596
+ same = false;
2597
+ }
2598
+ });
2599
+ return same;
2600
+ };
2601
+ var setCssProps = function (element, option, direction) {
2602
+ var _a;
2603
+
2604
+ var touchActionMap = (_a = {}, _a[DIRECTION_NONE] = "auto", _a[DIRECTION_ALL] = "none", _a[DIRECTION_VERTICAL] = "pan-x", _a[DIRECTION_HORIZONTAL] = "pan-y", _a);
2594
2605
  var oldCssProps = {};
2595
2606
 
2596
2607
  if (element && element.style) {
2597
- var newCssProps_1 = originalCssProps ? originalCssProps : PREVENT_SCROLL_CSSPROPS;
2608
+ var touchAction = option.touchAction ? option.touchAction : touchActionMap[direction];
2609
+
2610
+ var newCssProps_1 = __assign$1(__assign$1({}, PREVENT_DRAG_CSSPROPS), {
2611
+ "touch-action": element.style["touch-action"] === "none" ? "none" : touchAction
2612
+ });
2613
+
2598
2614
  Object.keys(newCssProps_1).forEach(function (prop) {
2599
2615
  oldCssProps[prop] = element.style[prop];
2600
2616
  element.style[prop] = newCssProps_1[prop];
@@ -2603,6 +2619,15 @@ version: 4.7.0
2603
2619
 
2604
2620
  return oldCssProps;
2605
2621
  };
2622
+ var revertCssProps = function (element, originalCssProps) {
2623
+ if (element && element.style && originalCssProps) {
2624
+ Object.keys(originalCssProps).forEach(function (prop) {
2625
+ element.style[prop] = originalCssProps[prop];
2626
+ });
2627
+ }
2628
+
2629
+ return;
2630
+ };
2606
2631
 
2607
2632
  var EventManager =
2608
2633
  /*#__PURE__*/
@@ -3354,8 +3379,8 @@ version: 4.7.0
3354
3379
  __proto._getMovement = function (event) {
3355
3380
  var prev = this.prevEvent.srcEvent;
3356
3381
  return {
3357
- x: event.pageX - prev.pageX,
3358
- y: event.pageY - prev.pageY
3382
+ x: event.clientX - prev.clientX,
3383
+ y: event.clientY - prev.clientY
3359
3384
  };
3360
3385
  };
3361
3386
 
@@ -3428,8 +3453,8 @@ version: 4.7.0
3428
3453
  }
3429
3454
 
3430
3455
  return {
3431
- x: event.touches[0].pageX - prev.touches[0].pageX,
3432
- y: event.touches[0].pageY - prev.touches[0].pageY
3456
+ x: event.touches[0].clientX - prev.touches[0].clientX,
3457
+ y: event.touches[0].clientY - prev.touches[0].clientY
3433
3458
  };
3434
3459
  };
3435
3460
 
@@ -3520,8 +3545,8 @@ version: 4.7.0
3520
3545
  }
3521
3546
 
3522
3547
  return {
3523
- x: event.pageX - prev.pageX,
3524
- y: event.pageY - prev.pageY
3548
+ x: event.clientX - prev.clientX,
3549
+ y: event.clientY - prev.clientY
3525
3550
  };
3526
3551
  };
3527
3552
 
@@ -3646,18 +3671,18 @@ version: 4.7.0
3646
3671
  var prev = this.prevEvent.srcEvent;
3647
3672
 
3648
3673
  var _a = [event, prev].map(function (e) {
3649
- if (_this._isTouchEvent(event)) {
3674
+ if (_this._isTouchEvent(e)) {
3650
3675
  return {
3651
3676
  id: e.touches[0].identifier,
3652
- x: e.touches[0].pageX,
3653
- y: e.touches[0].pageY
3677
+ x: e.touches[0].clientX,
3678
+ y: e.touches[0].clientY
3654
3679
  };
3655
3680
  }
3656
3681
 
3657
3682
  return {
3658
3683
  id: null,
3659
- x: e.pageX,
3660
- y: e.pageY
3684
+ x: e.clientX,
3685
+ y: e.clientY
3661
3686
  };
3662
3687
  }),
3663
3688
  nextSpot = _a[0],
@@ -4868,7 +4893,7 @@ version: 4.7.0
4868
4893
  */
4869
4894
 
4870
4895
 
4871
- Axes.VERSION = "3.1.1-snapshot";
4896
+ Axes.VERSION = "3.2.2";
4872
4897
  /* eslint-enable */
4873
4898
 
4874
4899
  /**
@@ -4944,6 +4969,8 @@ version: 4.7.0
4944
4969
  return Axes;
4945
4970
  }(Component);
4946
4971
 
4972
+ /* eslint-disable @typescript-eslint/no-empty-function */
4973
+
4947
4974
  var getDirectionByAngle = function (angle, thresholdAngle) {
4948
4975
  if (thresholdAngle < 0 || thresholdAngle > 90) {
4949
4976
  return DIRECTION_NONE;
@@ -4962,11 +4989,13 @@ version: 4.7.0
4962
4989
  /**
4963
4990
  * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.
4964
4991
  * @ko eg.Axes.PanInput 모듈의 옵션 객체
4965
- * @param {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices
4992
+ * @param {String[]} [inputType=["touch", "mouse", "pointer"]] Types of input devices
4966
4993
  * - touch: Touch screen
4967
- * - mouse: Mouse <ko>입력 장치 종류
4994
+ * - mouse: Mouse
4995
+ * - pointer: Mouse and touch <ko>입력 장치 종류
4968
4996
  * - touch: 터치 입력 장치
4969
- * - mouse: 마우스</ko>
4997
+ * - mouse: 마우스
4998
+ * - pointer: 마우스 및 터치</ko>
4970
4999
  * @param {String[]} [inputButton=["left"]] List of buttons to allow input
4971
5000
  * - left: Left mouse button and normal touch
4972
5001
  * - middle: Mouse wheel press
@@ -4980,6 +5009,7 @@ version: 4.7.0
4980
5009
  * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) <ko>사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)</ko>
4981
5010
  * @param {Number} [threshold=0] Minimal pan distance required before recognizing <ko>사용자의 Pan 동작을 인식하기 위해산 최소한의 거리</ko>
4982
5011
  * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari <ko>iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)</ko>
5012
+ * @param {String} [touchAction=null] Value that overrides the element's "touch-action" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. <ko>엘리먼트의 "touch-action" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다.</ko>
4983
5013
  **/
4984
5014
 
4985
5015
  /**
@@ -5042,7 +5072,8 @@ version: 4.7.0
5042
5072
  thresholdAngle: 45,
5043
5073
  threshold: 0,
5044
5074
  iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,
5045
- releaseOnScroll: false
5075
+ releaseOnScroll: false,
5076
+ touchAction: null
5046
5077
  }, options);
5047
5078
  this._onPanstart = this._onPanstart.bind(this);
5048
5079
  this._onPanmove = this._onPanmove.bind(this);
@@ -5077,7 +5108,7 @@ version: 4.7.0
5077
5108
 
5078
5109
  this._attachElementEvent(observer);
5079
5110
 
5080
- this._originalCssProps = setCssProps(this.element);
5111
+ this._originalCssProps = setCssProps(this.element, this.options, this._direction);
5081
5112
  return this;
5082
5113
  };
5083
5114
 
@@ -5086,8 +5117,8 @@ version: 4.7.0
5086
5117
 
5087
5118
  this._detachWindowEvent(this._activeEvent);
5088
5119
 
5089
- if (this._originalCssProps !== PREVENT_SCROLL_CSSPROPS) {
5090
- setCssProps(this.element, this._originalCssProps);
5120
+ if (!isCssPropsFromAxes(this._originalCssProps)) {
5121
+ revertCssProps(this.element, this._originalCssProps);
5091
5122
  }
5092
5123
 
5093
5124
  this._direction = DIRECTION_NONE;
@@ -5150,7 +5181,6 @@ version: 4.7.0
5150
5181
  this._observer.hold(this, panEvent);
5151
5182
 
5152
5183
  this._atRightEdge = IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold;
5153
- console.log("onPanStart");
5154
5184
 
5155
5185
  this._attachWindowEvent(activeEvent);
5156
5186
 
@@ -5242,7 +5272,6 @@ version: 4.7.0
5242
5272
  var velocity = this._applyScale([Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1), Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]);
5243
5273
 
5244
5274
  activeEvent.onRelease();
5245
- console.log("onPanEnd");
5246
5275
 
5247
5276
  this._observer.release(this, prevEvent, velocity);
5248
5277
  };
@@ -5251,10 +5280,14 @@ version: 4.7.0
5251
5280
  var _this = this;
5252
5281
 
5253
5282
  activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) {
5254
- window.addEventListener(event, _this._onPanmove);
5283
+ window.addEventListener(event, _this._onPanmove, {
5284
+ passive: false
5285
+ });
5255
5286
  });
5256
5287
  activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) {
5257
- window.addEventListener(event, _this._onPanend);
5288
+ window.addEventListener(event, _this._onPanend, {
5289
+ passive: false
5290
+ });
5258
5291
  });
5259
5292
  };
5260
5293
 
@@ -5275,16 +5308,22 @@ version: 4.7.0
5275
5308
  var activeEvent = convertInputType(this.options.inputType);
5276
5309
 
5277
5310
  if (!activeEvent) {
5278
- throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");
5311
+ return;
5279
5312
  }
5280
5313
 
5281
5314
  this._observer = observer;
5282
5315
  this._enabled = true;
5283
5316
  this._activeEvent = activeEvent;
5284
- activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) {
5317
+ activeEvent.start.forEach(function (event) {
5285
5318
  var _a;
5286
5319
 
5287
5320
  (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._onPanstart);
5321
+ }); // adding event listener to element prevents invalid behavior in iOS Safari
5322
+
5323
+ activeEvent.move.forEach(function (event) {
5324
+ var _a;
5325
+
5326
+ (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, function () {});
5288
5327
  });
5289
5328
  };
5290
5329
 
@@ -5297,6 +5336,11 @@ version: 4.7.0
5297
5336
 
5298
5337
  (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._onPanstart);
5299
5338
  });
5339
+ activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) {
5340
+ var _a;
5341
+
5342
+ (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, function () {});
5343
+ });
5300
5344
  this._enabled = false;
5301
5345
  this._observer = null;
5302
5346
  };
@@ -10287,7 +10331,7 @@ version: 4.7.0
10287
10331
  if (!resizeOnContentsReady || flicking.virtualEnabled) return;
10288
10332
 
10289
10333
  var hasContents = function (panel) {
10290
- return !!panel.element.querySelector("img, video");
10334
+ return panel.element && !!panel.element.querySelector("img, video");
10291
10335
  };
10292
10336
 
10293
10337
  checkingPanels = checkingPanels.filter(function (panel) {
@@ -13404,7 +13448,7 @@ version: 4.7.0
13404
13448
  */
13405
13449
 
13406
13450
 
13407
- Flicking.VERSION = "4.7.0";
13451
+ Flicking.VERSION = "4.7.3";
13408
13452
  return Flicking;
13409
13453
  }(Component);
13410
13454