@egjs/flicking 4.12.0-beta.9 → 4.12.1-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.
Files changed (84) hide show
  1. package/declaration/CrossFlicking.d.ts +89 -76
  2. package/declaration/Flicking.d.ts +244 -244
  3. package/declaration/camera/Camera.d.ts +90 -90
  4. package/declaration/camera/index.d.ts +4 -4
  5. package/declaration/camera/mode/BoundCameraMode.d.ts +13 -13
  6. package/declaration/camera/mode/CameraMode.d.ts +20 -20
  7. package/declaration/camera/mode/CircularCameraMode.d.ts +19 -19
  8. package/declaration/camera/mode/LinearCameraMode.d.ts +9 -9
  9. package/declaration/camera/mode/index.d.ts +6 -6
  10. package/declaration/cfc/getDefaultCameraTransform.d.ts +3 -3
  11. package/declaration/cfc/getRenderingPanels.d.ts +4 -4
  12. package/declaration/cfc/index.d.ts +5 -5
  13. package/declaration/cfc/sync.d.ts +4 -4
  14. package/declaration/cfc/withFlickingMethods.d.ts +2 -2
  15. package/declaration/const/axes.d.ts +8 -8
  16. package/declaration/const/error.d.ts +34 -34
  17. package/declaration/const/external.d.ts +54 -54
  18. package/declaration/control/AxesController.d.ts +44 -44
  19. package/declaration/control/Control.d.ts +45 -45
  20. package/declaration/control/FreeControl.d.ts +14 -14
  21. package/declaration/control/SnapControl.d.ts +16 -16
  22. package/declaration/control/StateMachine.d.ts +14 -14
  23. package/declaration/control/StrictControl.d.ts +20 -20
  24. package/declaration/control/index.d.ts +14 -14
  25. package/declaration/control/states/AnimatingState.d.ts +9 -9
  26. package/declaration/control/states/DisabledState.d.ts +9 -9
  27. package/declaration/control/states/DraggingState.d.ts +8 -8
  28. package/declaration/control/states/HoldingState.d.ts +10 -10
  29. package/declaration/control/states/IdleState.d.ts +9 -9
  30. package/declaration/control/states/State.d.ts +47 -47
  31. package/declaration/core/AnchorPoint.d.ts +15 -15
  32. package/declaration/core/AutoResizer.d.ts +16 -16
  33. package/declaration/core/FlickingError.d.ts +5 -5
  34. package/declaration/core/ResizeWatcher.d.ts +33 -33
  35. package/declaration/core/Viewport.d.ts +25 -25
  36. package/declaration/core/VirtualManager.d.ts +37 -37
  37. package/declaration/core/index.d.ts +6 -6
  38. package/declaration/core/panel/Panel.d.ts +89 -89
  39. package/declaration/core/panel/VirtualPanel.d.ts +19 -19
  40. package/declaration/core/panel/index.d.ts +5 -5
  41. package/declaration/core/panel/provider/ElementProvider.d.ts +8 -8
  42. package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -12
  43. package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -15
  44. package/declaration/core/panel/provider/index.d.ts +5 -5
  45. package/declaration/index.cjs.d.ts +3 -3
  46. package/declaration/index.d.ts +15 -15
  47. package/declaration/index.umd.d.ts +2 -2
  48. package/declaration/renderer/ExternalRenderer.d.ts +7 -7
  49. package/declaration/renderer/Renderer.d.ts +59 -59
  50. package/declaration/renderer/VanillaRenderer.d.ts +10 -10
  51. package/declaration/renderer/index.d.ts +6 -6
  52. package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -23
  53. package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -15
  54. package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -17
  55. package/declaration/renderer/strategy/index.d.ts +5 -5
  56. package/declaration/type/event.d.ts +88 -88
  57. package/declaration/type/external.d.ts +31 -31
  58. package/declaration/type/internal.d.ts +13 -13
  59. package/declaration/utils.d.ts +47 -47
  60. package/dist/flicking-inline.css +37 -0
  61. package/dist/flicking-inline.min.css +1 -0
  62. package/dist/flicking-inline.min.min.css +1 -0
  63. package/dist/flicking.cjs.js +36 -6
  64. package/dist/flicking.cjs.js.map +1 -1
  65. package/dist/flicking.css +40 -0
  66. package/dist/flicking.esm.js +36 -6
  67. package/dist/flicking.esm.js.map +1 -1
  68. package/dist/flicking.js +36 -6
  69. package/dist/flicking.js.map +1 -1
  70. package/dist/flicking.min.css +1 -0
  71. package/dist/flicking.min.js +2 -2
  72. package/dist/flicking.min.js.map +1 -1
  73. package/dist/flicking.min.min.css +1 -0
  74. package/dist/flicking.pkgd.js +786 -756
  75. package/dist/flicking.pkgd.js.map +1 -1
  76. package/dist/flicking.pkgd.min.js +2 -2
  77. package/dist/flicking.pkgd.min.js.map +1 -1
  78. package/package.json +5 -6
  79. package/src/CrossFlicking.ts +32 -4
  80. package/src/Flicking.ts +1 -1
  81. package/src/control/SnapControl.ts +3 -1
  82. package/src/control/states/HoldingState.ts +4 -0
  83. package/src/core/panel/Panel.ts +4 -0
  84. package/src/utils.ts +4 -0
package/dist/flicking.js CHANGED
@@ -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.12.0-beta.9
7
+ version: 4.12.1-beta.0
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
@@ -692,6 +692,9 @@ version: 4.12.0-beta.9
692
692
  var setSize = function (el, _a) {
693
693
  var width = _a.width,
694
694
  height = _a.height;
695
+ if (!el) {
696
+ return;
697
+ }
695
698
  if (width != null) {
696
699
  if (isString(width)) {
697
700
  el.style.width = width;
@@ -1640,6 +1643,9 @@ version: 4.12.0-beta.9
1640
1643
  axesEvent = ctx.axesEvent,
1641
1644
  transitTo = ctx.transitTo;
1642
1645
  var inputEvent = axesEvent.inputEvent;
1646
+ if (!inputEvent) {
1647
+ return;
1648
+ }
1643
1649
  var offset = flicking.horizontal ? inputEvent.offsetX : inputEvent.offsetY;
1644
1650
  var moveStartEvent = new Component.ComponentEvent(EVENTS.MOVE_START, {
1645
1651
  isTrusted: axesEvent.isTrusted,
@@ -2957,8 +2963,9 @@ version: 4.12.0-beta.9
2957
2963
  if (snapDelta >= snapThreshold && snapDelta > 0) {
2958
2964
  // Move to anchor at position
2959
2965
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
2960
- } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
2966
+ } else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
2961
2967
  // Move to the adjacent panel
2968
+ // console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
2962
2969
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
2963
2970
  } else {
2964
2971
  // Fallback to nearest panel from current camera
@@ -3033,6 +3040,7 @@ version: 4.12.0-beta.9
3033
3040
  return anchorIncludePosition;
3034
3041
  }
3035
3042
  }
3043
+ // console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
3036
3044
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
3037
3045
  return adjacentAnchor;
3038
3046
  };
@@ -5533,6 +5541,9 @@ version: 4.12.0-beta.9
5533
5541
  var flicking = this._flicking;
5534
5542
  var horizontal = flicking.horizontal,
5535
5543
  useFractionalSize = flicking.useFractionalSize;
5544
+ if (!el) {
5545
+ return this;
5546
+ }
5536
5547
  if (cached) {
5537
5548
  this._size = cached.size;
5538
5549
  this._margin = __assign({}, cached.margin);
@@ -7954,7 +7965,7 @@ version: 4.12.0-beta.9
7954
7965
  var defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
7955
7966
  if (!defaultPanel) return;
7956
7967
  var nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
7957
- var initialPanel = nearestAnchor && defaultPanel.index !== nearestAnchor.panel.index ? nearestAnchor.panel : defaultPanel;
7968
+ var initialPanel = nearestAnchor && defaultPanel.position !== nearestAnchor.panel.position && defaultPanel.index !== nearestAnchor.panel.index ? nearestAnchor.panel : defaultPanel;
7958
7969
  control.setActive(initialPanel, null, false);
7959
7970
  if (!nearestAnchor) {
7960
7971
  throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
@@ -8008,7 +8019,7 @@ version: 4.12.0-beta.9
8008
8019
  * Flicking.VERSION; // ex) 4.0.0
8009
8020
  * ```
8010
8021
  */
8011
- Flicking.VERSION = "4.12.0-beta.9";
8022
+ Flicking.VERSION = "4.12.1-beta.0";
8012
8023
  return Flicking;
8013
8024
  }(Component);
8014
8025
 
@@ -8019,7 +8030,9 @@ version: 4.12.0-beta.9
8019
8030
  MOVE: "sideMove",
8020
8031
  MOVE_END: "sideMoveEnd",
8021
8032
  WILL_CHANGE: "sideWillChange",
8022
- CHANGED: "sideChanged"
8033
+ CHANGED: "sideChanged",
8034
+ WILL_RESTORE: "sideWillRestore",
8035
+ RESTORED: "sideRestored"
8023
8036
  };
8024
8037
  var CrossFlicking = /*#__PURE__*/function (_super) {
8025
8038
  __extends(CrossFlicking, _super);
@@ -8045,7 +8058,8 @@ version: 4.12.0-beta.9
8045
8058
  if (!_this._disableSlideOnHold) {
8046
8059
  return;
8047
8060
  }
8048
- var threshold = draggable ? _this.dragThreshold && _this.dragThreshold >= 10 ? _this.dragThreshold : 10 : Infinity;
8061
+ var dragThreshold = _this._originalDragThreshold;
8062
+ var threshold = draggable ? dragThreshold && dragThreshold >= 10 ? dragThreshold : 10 : Infinity;
8049
8063
  if (direction === MOVE_DIRECTION.HORIZONTAL === _this.horizontal) {
8050
8064
  _this.dragThreshold = threshold;
8051
8065
  } else if (direction === MOVE_DIRECTION.VERTICAL === _this.horizontal) {
@@ -8076,6 +8090,9 @@ version: 4.12.0-beta.9
8076
8090
  }
8077
8091
  });
8078
8092
  };
8093
+ _this._addSideIndex = function (e) {
8094
+ e.sideIndex = _this._sideFlicking[e.index].index;
8095
+ };
8079
8096
  _this._onHorizontalHoldStart = function () {
8080
8097
  _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
8081
8098
  _this._moveDirection = null;
@@ -8135,6 +8152,7 @@ version: 4.12.0-beta.9
8135
8152
  // Internal states
8136
8153
  _this._moveDirection = null;
8137
8154
  _this._nextIndex = 0;
8155
+ _this._originalDragThreshold = _this.dragThreshold;
8138
8156
  // Bind options
8139
8157
  _this._sideOptions = sideOptions;
8140
8158
  _this._preserveIndex = preserveIndex;
@@ -8151,6 +8169,15 @@ version: 4.12.0-beta.9
8151
8169
  enumerable: false,
8152
8170
  configurable: true
8153
8171
  });
8172
+ Object.defineProperty(__proto, "sideIndex", {
8173
+ get: function () {
8174
+ return this._sideFlicking.map(function (i) {
8175
+ return i.index;
8176
+ });
8177
+ },
8178
+ enumerable: false,
8179
+ configurable: true
8180
+ });
8154
8181
  Object.defineProperty(__proto, "sideState", {
8155
8182
  get: function () {
8156
8183
  return this._sideState;
@@ -8219,6 +8246,9 @@ version: 4.12.0-beta.9
8219
8246
  this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
8220
8247
  this.on(EVENTS.MOVE, this._onHorizontalMove);
8221
8248
  this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
8249
+ [EVENTS.CHANGED, EVENTS.WILL_CHANGE].forEach(function (event) {
8250
+ _this.on(event, _this._addSideIndex);
8251
+ });
8222
8252
  this._sideFlicking.forEach(function (flicking, mainIndex) {
8223
8253
  flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
8224
8254
  flicking.on(EVENTS.MOVE, _this._onSideMove);