@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
@@ -0,0 +1,40 @@
1
+ .flicking-viewport {
2
+ position: relative;
3
+ overflow: hidden;
4
+ }
5
+ .flicking-viewport.vertical {
6
+ display: -webkit-inline-box;
7
+ display: -ms-inline-flexbox;
8
+ display: inline-flex;
9
+ }
10
+ .flicking-viewport.vertical > .flicking-camera {
11
+ display: -webkit-inline-box;
12
+ display: -ms-inline-flexbox;
13
+ display: inline-flex;
14
+ -webkit-box-orient: vertical;
15
+ -webkit-box-direction: normal;
16
+ -ms-flex-direction: column;
17
+ flex-direction: column;
18
+ }
19
+ .flicking-viewport.flicking-hidden > .flicking-camera > * {
20
+ visibility: hidden;
21
+ }
22
+
23
+ .flicking-camera {
24
+ width: 100%;
25
+ height: 100%;
26
+ display: -webkit-box;
27
+ display: -ms-flexbox;
28
+ display: flex;
29
+ position: relative;
30
+ -webkit-box-orient: horizontal;
31
+ -webkit-box-direction: normal;
32
+ -ms-flex-direction: row;
33
+ flex-direction: row;
34
+ z-index: 1;
35
+ will-change: transform;
36
+ }
37
+ .flicking-camera > * {
38
+ -ms-flex-negative: 0;
39
+ flex-shrink: 0;
40
+ }
@@ -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
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
@@ -677,6 +677,9 @@ var getStyle = function (el) {
677
677
  var setSize = function (el, _a) {
678
678
  var width = _a.width,
679
679
  height = _a.height;
680
+ if (!el) {
681
+ return;
682
+ }
680
683
  if (width != null) {
681
684
  if (isString(width)) {
682
685
  el.style.width = width;
@@ -1590,6 +1593,9 @@ var HoldingState = /*#__PURE__*/function (_super) {
1590
1593
  axesEvent = ctx.axesEvent,
1591
1594
  transitTo = ctx.transitTo;
1592
1595
  var inputEvent = axesEvent.inputEvent;
1596
+ if (!inputEvent) {
1597
+ return;
1598
+ }
1593
1599
  var offset = flicking.horizontal ? inputEvent.offsetX : inputEvent.offsetY;
1594
1600
  var moveStartEvent = new ComponentEvent(EVENTS.MOVE_START, {
1595
1601
  isTrusted: axesEvent.isTrusted,
@@ -2907,8 +2913,9 @@ var SnapControl = /*#__PURE__*/function (_super) {
2907
2913
  if (snapDelta >= snapThreshold && snapDelta > 0) {
2908
2914
  // Move to anchor at position
2909
2915
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
2910
- } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
2916
+ } else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
2911
2917
  // Move to the adjacent panel
2918
+ // console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
2912
2919
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
2913
2920
  } else {
2914
2921
  // Fallback to nearest panel from current camera
@@ -2983,6 +2990,7 @@ var SnapControl = /*#__PURE__*/function (_super) {
2983
2990
  return anchorIncludePosition;
2984
2991
  }
2985
2992
  }
2993
+ // console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
2986
2994
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
2987
2995
  return adjacentAnchor;
2988
2996
  };
@@ -5449,6 +5457,9 @@ var Panel = /*#__PURE__*/function () {
5449
5457
  var flicking = this._flicking;
5450
5458
  var horizontal = flicking.horizontal,
5451
5459
  useFractionalSize = flicking.useFractionalSize;
5460
+ if (!el) {
5461
+ return this;
5462
+ }
5452
5463
  if (cached) {
5453
5464
  this._size = cached.size;
5454
5465
  this._margin = __assign({}, cached.margin);
@@ -7856,7 +7867,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7856
7867
  var defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
7857
7868
  if (!defaultPanel) return;
7858
7869
  var nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
7859
- var initialPanel = nearestAnchor && defaultPanel.index !== nearestAnchor.panel.index ? nearestAnchor.panel : defaultPanel;
7870
+ var initialPanel = nearestAnchor && defaultPanel.position !== nearestAnchor.panel.position && defaultPanel.index !== nearestAnchor.panel.index ? nearestAnchor.panel : defaultPanel;
7860
7871
  control.setActive(initialPanel, null, false);
7861
7872
  if (!nearestAnchor) {
7862
7873
  throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
@@ -7910,7 +7921,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7910
7921
  * Flicking.VERSION; // ex) 4.0.0
7911
7922
  * ```
7912
7923
  */
7913
- Flicking.VERSION = "4.12.0-beta.9";
7924
+ Flicking.VERSION = "4.12.1-beta.0";
7914
7925
  return Flicking;
7915
7926
  }(Component);
7916
7927
 
@@ -7921,7 +7932,9 @@ var SIDE_EVENTS = {
7921
7932
  MOVE: "sideMove",
7922
7933
  MOVE_END: "sideMoveEnd",
7923
7934
  WILL_CHANGE: "sideWillChange",
7924
- CHANGED: "sideChanged"
7935
+ CHANGED: "sideChanged",
7936
+ WILL_RESTORE: "sideWillRestore",
7937
+ RESTORED: "sideRestored"
7925
7938
  };
7926
7939
  var CrossFlicking = /*#__PURE__*/function (_super) {
7927
7940
  __extends(CrossFlicking, _super);
@@ -7947,7 +7960,8 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
7947
7960
  if (!_this._disableSlideOnHold) {
7948
7961
  return;
7949
7962
  }
7950
- var threshold = draggable ? _this.dragThreshold && _this.dragThreshold >= 10 ? _this.dragThreshold : 10 : Infinity;
7963
+ var dragThreshold = _this._originalDragThreshold;
7964
+ var threshold = draggable ? dragThreshold && dragThreshold >= 10 ? dragThreshold : 10 : Infinity;
7951
7965
  if (direction === MOVE_DIRECTION.HORIZONTAL === _this.horizontal) {
7952
7966
  _this.dragThreshold = threshold;
7953
7967
  } else if (direction === MOVE_DIRECTION.VERTICAL === _this.horizontal) {
@@ -7978,6 +7992,9 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
7978
7992
  }
7979
7993
  });
7980
7994
  };
7995
+ _this._addSideIndex = function (e) {
7996
+ e.sideIndex = _this._sideFlicking[e.index].index;
7997
+ };
7981
7998
  _this._onHorizontalHoldStart = function () {
7982
7999
  _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
7983
8000
  _this._moveDirection = null;
@@ -8037,6 +8054,7 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
8037
8054
  // Internal states
8038
8055
  _this._moveDirection = null;
8039
8056
  _this._nextIndex = 0;
8057
+ _this._originalDragThreshold = _this.dragThreshold;
8040
8058
  // Bind options
8041
8059
  _this._sideOptions = sideOptions;
8042
8060
  _this._preserveIndex = preserveIndex;
@@ -8053,6 +8071,15 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
8053
8071
  enumerable: false,
8054
8072
  configurable: true
8055
8073
  });
8074
+ Object.defineProperty(__proto, "sideIndex", {
8075
+ get: function () {
8076
+ return this._sideFlicking.map(function (i) {
8077
+ return i.index;
8078
+ });
8079
+ },
8080
+ enumerable: false,
8081
+ configurable: true
8082
+ });
8056
8083
  Object.defineProperty(__proto, "sideState", {
8057
8084
  get: function () {
8058
8085
  return this._sideState;
@@ -8121,6 +8148,9 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
8121
8148
  this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
8122
8149
  this.on(EVENTS.MOVE, this._onHorizontalMove);
8123
8150
  this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
8151
+ [EVENTS.CHANGED, EVENTS.WILL_CHANGE].forEach(function (event) {
8152
+ _this.on(event, _this._addSideIndex);
8153
+ });
8124
8154
  this._sideFlicking.forEach(function (flicking, mainIndex) {
8125
8155
  flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
8126
8156
  flicking.on(EVENTS.MOVE, _this._onSideMove);