@egjs/flicking 4.7.2 → 4.8.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.
@@ -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.2
7
+ version: 4.8.1
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1294,7 +1294,7 @@ version: 4.7.2
1294
1294
  * @ko Flicking 내부에서 알려진 오류 발생시 throw되는 에러
1295
1295
  * @property {number} code Error code<ko>에러 코드</ko>
1296
1296
  * @property {string} message Error message<ko>에러 메시지</ko>
1297
- * @see {@link Constants.ERROR_CODE ERROR_CODE}
1297
+ * @see {@link ERROR_CODE ERROR_CODE}
1298
1298
  * @example
1299
1299
  * ```ts
1300
1300
  * import Flicking, { FlickingError, ERROR_CODES } from "@egjs/flicking";
@@ -2281,7 +2281,7 @@ version: 4.7.2
2281
2281
  license: MIT
2282
2282
  author: NAVER Corp.
2283
2283
  repository: https://github.com/naver/egjs-axes
2284
- version: 3.2.1
2284
+ version: 3.2.2
2285
2285
  */
2286
2286
 
2287
2287
  /*! *****************************************************************************
@@ -4893,7 +4893,7 @@ version: 4.7.2
4893
4893
  */
4894
4894
 
4895
4895
 
4896
- Axes.VERSION = "3.2.1";
4896
+ Axes.VERSION = "3.2.2";
4897
4897
  /* eslint-enable */
4898
4898
 
4899
4899
  /**
@@ -4969,6 +4969,8 @@ version: 4.7.2
4969
4969
  return Axes;
4970
4970
  }(Component);
4971
4971
 
4972
+ /* eslint-disable @typescript-eslint/no-empty-function */
4973
+
4972
4974
  var getDirectionByAngle = function (angle, thresholdAngle) {
4973
4975
  if (thresholdAngle < 0 || thresholdAngle > 90) {
4974
4976
  return DIRECTION_NONE;
@@ -5306,16 +5308,22 @@ version: 4.7.2
5306
5308
  var activeEvent = convertInputType(this.options.inputType);
5307
5309
 
5308
5310
  if (!activeEvent) {
5309
- throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");
5311
+ return;
5310
5312
  }
5311
5313
 
5312
5314
  this._observer = observer;
5313
5315
  this._enabled = true;
5314
5316
  this._activeEvent = activeEvent;
5315
- activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) {
5317
+ activeEvent.start.forEach(function (event) {
5316
5318
  var _a;
5317
5319
 
5318
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 () {});
5319
5327
  });
5320
5328
  };
5321
5329
 
@@ -5328,6 +5336,11 @@ version: 4.7.2
5328
5336
 
5329
5337
  (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._onPanstart);
5330
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
+ });
5331
5344
  this._enabled = false;
5332
5345
  this._observer = null;
5333
5346
  };
@@ -5895,8 +5908,15 @@ version: 4.7.2
5895
5908
  var flicking = ctx.flicking,
5896
5909
  axesEvent = ctx.axesEvent,
5897
5910
  transitTo = ctx.transitTo;
5911
+ var targetPanel = this._targetPanel;
5912
+ var control = flicking.control;
5898
5913
  this._delta = 0;
5899
5914
  flicking.control.updateInput();
5915
+
5916
+ if (flicking.changeOnHold && targetPanel) {
5917
+ control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
5918
+ }
5919
+
5900
5920
  var holdStartEvent = new ComponentEvent$1(EVENTS.HOLD_START, {
5901
5921
  axesEvent: axesEvent
5902
5922
  });
@@ -6103,7 +6123,9 @@ version: 4.7.2
6103
6123
  };
6104
6124
 
6105
6125
  this._onAxesChange = function () {
6106
- _this._dragged = true;
6126
+ var _a;
6127
+
6128
+ _this._dragged = !!((_a = _this._panInput) === null || _a === void 0 ? void 0 : _a.isEnabled());
6107
6129
  };
6108
6130
 
6109
6131
  this._preventClickWhenDragged = function (e) {
@@ -7066,7 +7088,7 @@ version: 4.7.2
7066
7088
  var camera = flicking.camera;
7067
7089
  var activeAnchor = camera.findActiveAnchor();
7068
7090
  var anchorAtCamera = camera.findNearestAnchor(camera.position);
7069
- var state = flicking.control.controller.state;
7091
+ var state = this._controller.state;
7070
7092
 
7071
7093
  if (!activeAnchor || !anchorAtCamera) {
7072
7094
  return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
@@ -7084,10 +7106,13 @@ version: 4.7.2
7084
7106
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
7085
7107
  } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
7086
7108
  // Move to the adjacent panel
7087
- targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
7109
+ targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
7088
7110
  } else {
7089
7111
  // Restore to active panel
7090
- targetAnchor = anchorAtCamera;
7112
+ return this.moveToPanel(activeAnchor.panel, {
7113
+ duration: duration,
7114
+ axesEvent: axesEvent
7115
+ });
7091
7116
  }
7092
7117
 
7093
7118
  this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
@@ -7158,11 +7183,20 @@ version: 4.7.2
7158
7183
  }
7159
7184
  };
7160
7185
 
7161
- __proto._findAdjacentAnchor = function (posDelta, anchorAtCamera) {
7186
+ __proto._findAdjacentAnchor = function (position, posDelta, anchorAtCamera) {
7162
7187
  var _a;
7163
7188
 
7164
7189
  var flicking = getFlickingAttached(this._flicking);
7165
7190
  var camera = flicking.camera;
7191
+
7192
+ if (camera.circularEnabled) {
7193
+ var anchorIncludePosition = camera.findAnchorIncludePosition(position);
7194
+
7195
+ if (anchorIncludePosition && anchorIncludePosition.position !== anchorAtCamera.position) {
7196
+ return anchorIncludePosition;
7197
+ }
7198
+ }
7199
+
7166
7200
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
7167
7201
  return adjacentAnchor;
7168
7202
  };
@@ -7508,6 +7542,7 @@ version: 4.7.2
7508
7542
  var axesRange = this._controller.range;
7509
7543
  var indexRange = this._indexRange;
7510
7544
  var cameraRange = camera.range;
7545
+ var state = this._controller.state;
7511
7546
  var clampedPosition = clamp$1(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
7512
7547
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
7513
7548
 
@@ -7516,7 +7551,8 @@ version: 4.7.2
7516
7551
  }
7517
7552
 
7518
7553
  var prevPos = activePanel.position;
7519
- var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
7554
+ var posDelta = flicking.animating ? state.delta : position - camera.position;
7555
+ var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
7520
7556
  var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
7521
7557
  var targetPos;
7522
7558
  var targetPanel;
@@ -11672,24 +11708,26 @@ version: 4.7.2
11672
11708
  preventClickOnDrag = _0 === void 0 ? true : _0,
11673
11709
  _1 = _b.disableOnInit,
11674
11710
  disableOnInit = _1 === void 0 ? false : _1,
11675
- _2 = _b.renderOnlyVisible,
11676
- renderOnlyVisible = _2 === void 0 ? false : _2,
11677
- _3 = _b.virtual,
11678
- virtual = _3 === void 0 ? null : _3,
11679
- _4 = _b.autoInit,
11680
- autoInit = _4 === void 0 ? true : _4,
11681
- _5 = _b.autoResize,
11682
- autoResize = _5 === void 0 ? true : _5,
11683
- _6 = _b.useResizeObserver,
11684
- useResizeObserver = _6 === void 0 ? true : _6,
11685
- _7 = _b.resizeDebounce,
11686
- resizeDebounce = _7 === void 0 ? 0 : _7,
11687
- _8 = _b.maxResizeDebounce,
11688
- maxResizeDebounce = _8 === void 0 ? 100 : _8,
11689
- _9 = _b.externalRenderer,
11690
- externalRenderer = _9 === void 0 ? null : _9,
11691
- _10 = _b.renderExternal,
11692
- renderExternal = _10 === void 0 ? null : _10;
11711
+ _2 = _b.changeOnHold,
11712
+ changeOnHold = _2 === void 0 ? false : _2,
11713
+ _3 = _b.renderOnlyVisible,
11714
+ renderOnlyVisible = _3 === void 0 ? false : _3,
11715
+ _4 = _b.virtual,
11716
+ virtual = _4 === void 0 ? null : _4,
11717
+ _5 = _b.autoInit,
11718
+ autoInit = _5 === void 0 ? true : _5,
11719
+ _6 = _b.autoResize,
11720
+ autoResize = _6 === void 0 ? true : _6,
11721
+ _7 = _b.useResizeObserver,
11722
+ useResizeObserver = _7 === void 0 ? true : _7,
11723
+ _8 = _b.resizeDebounce,
11724
+ resizeDebounce = _8 === void 0 ? 0 : _8,
11725
+ _9 = _b.maxResizeDebounce,
11726
+ maxResizeDebounce = _9 === void 0 ? 100 : _9,
11727
+ _10 = _b.externalRenderer,
11728
+ externalRenderer = _10 === void 0 ? null : _10,
11729
+ _11 = _b.renderExternal,
11730
+ renderExternal = _11 === void 0 ? null : _11;
11693
11731
 
11694
11732
  var _this = _super.call(this) || this; // Internal states
11695
11733
 
@@ -11722,6 +11760,7 @@ version: 4.7.2
11722
11760
  _this._iOSEdgeSwipeThreshold = iOSEdgeSwipeThreshold;
11723
11761
  _this._preventClickOnDrag = preventClickOnDrag;
11724
11762
  _this._disableOnInit = disableOnInit;
11763
+ _this._changeOnHold = changeOnHold;
11725
11764
  _this._renderOnlyVisible = renderOnlyVisible;
11726
11765
  _this._autoInit = autoInit;
11727
11766
  _this._autoResize = autoResize;
@@ -12478,6 +12517,24 @@ version: 4.7.2
12478
12517
  enumerable: false,
12479
12518
  configurable: true
12480
12519
  });
12520
+ Object.defineProperty(__proto, "changeOnHold", {
12521
+ /**
12522
+ * Change active panel index on mouse/touch hold while animating.
12523
+ * `index` of the `willChange`/`willRestore` event will be used as new index.
12524
+ * @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
12525
+ * `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
12526
+ * @type {boolean}
12527
+ * @default false
12528
+ */
12529
+ get: function () {
12530
+ return this._changeOnHold;
12531
+ },
12532
+ set: function (val) {
12533
+ this._changeOnHold = val;
12534
+ },
12535
+ enumerable: false,
12536
+ configurable: true
12537
+ });
12481
12538
  Object.defineProperty(__proto, "renderOnlyVisible", {
12482
12539
  // PERFORMANCE
12483
12540
 
@@ -13158,6 +13215,8 @@ version: 4.7.2
13158
13215
  camera.updateAlignPos();
13159
13216
  camera.updateRange();
13160
13217
  camera.updateAnchors();
13218
+ camera.updateAdaptiveHeight();
13219
+ camera.updateOffset();
13161
13220
  return [4
13162
13221
  /*yield*/
13163
13222
  , renderer.render()];
@@ -13435,7 +13494,7 @@ version: 4.7.2
13435
13494
  */
13436
13495
 
13437
13496
 
13438
- Flicking.VERSION = "4.7.2";
13497
+ Flicking.VERSION = "4.8.1";
13439
13498
  return Flicking;
13440
13499
  }(Component);
13441
13500