@egjs/flicking 4.14.2-beta.0 → 4.14.2-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.
@@ -53,6 +53,8 @@ export interface FlickingOptions {
53
53
  moveType: ValueOf<typeof MOVE_TYPE> | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
54
54
  threshold: number;
55
55
  dragThreshold: number;
56
+ animationThreshold: number;
57
+ useCSSOrderProperty: boolean;
56
58
  interruptable: boolean;
57
59
  bounce: number | string | [number | string, number | string];
58
60
  iOSEdgeSwipeThreshold: number;
@@ -105,6 +107,8 @@ declare class Flicking extends Component<FlickingEvents> {
105
107
  private _moveType;
106
108
  private _threshold;
107
109
  private _dragThreshold;
110
+ private _animationThreshold;
111
+ private _useCSSOrderProperty;
108
112
  private _interruptable;
109
113
  private _bounce;
110
114
  private _iOSEdgeSwipeThreshold;
@@ -166,6 +170,8 @@ declare class Flicking extends Component<FlickingEvents> {
166
170
  get moveType(): FlickingOptions["moveType"];
167
171
  get threshold(): FlickingOptions["threshold"];
168
172
  get dragThreshold(): FlickingOptions["dragThreshold"];
173
+ get animationThreshold(): FlickingOptions["animationThreshold"];
174
+ get useCSSOrderProperty(): FlickingOptions["useCSSOrderProperty"];
169
175
  get interruptable(): FlickingOptions["interruptable"];
170
176
  get bounce(): FlickingOptions["bounce"];
171
177
  get iOSEdgeSwipeThreshold(): FlickingOptions["iOSEdgeSwipeThreshold"];
@@ -207,6 +213,8 @@ declare class Flicking extends Component<FlickingEvents> {
207
213
  set moveType(val: FlickingOptions["moveType"]);
208
214
  set threshold(val: FlickingOptions["threshold"]);
209
215
  set dragThreshold(val: FlickingOptions["dragThreshold"]);
216
+ set animationThreshold(val: FlickingOptions["animationThreshold"]);
217
+ set useCSSOrderProperty(val: FlickingOptions["useCSSOrderProperty"]);
210
218
  set interruptable(val: FlickingOptions["interruptable"]);
211
219
  set bounce(val: FlickingOptions["bounce"]);
212
220
  set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]);
@@ -219,7 +227,7 @@ declare class Flicking extends Component<FlickingEvents> {
219
227
  set useResizeObserver(val: FlickingOptions["useResizeObserver"]);
220
228
  set observePanelResize(val: FlickingOptions["observePanelResize"]);
221
229
  set optimizeSizeUpdate(val: FlickingOptions["optimizeSizeUpdate"]);
222
- constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, dragThreshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, preventDefaultOnDrag, disableOnInit, changeOnHold, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, observePanelResize, maxResizeDebounce, useFractionalSize, externalRenderer, renderExternal, optimizeSizeUpdate }?: Partial<FlickingOptions>);
230
+ constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, dragThreshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, preventDefaultOnDrag, disableOnInit, changeOnHold, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, observePanelResize, maxResizeDebounce, useFractionalSize, externalRenderer, renderExternal, optimizeSizeUpdate, animationThreshold, useCSSOrderProperty, }?: Partial<FlickingOptions>);
223
231
  init(): Promise<void>;
224
232
  destroy(): void;
225
233
  prev(duration?: number): Promise<void>;
@@ -25,6 +25,7 @@ declare abstract class Renderer {
25
25
  destroy(): void;
26
26
  getPanel(index: number): Panel | null;
27
27
  forceRenderAllPanels(): Promise<void>;
28
+ getRenderedPanels(): Panel[];
28
29
  updatePanelSize(): this;
29
30
  batchInsert(...items: Array<{
30
31
  index: number;
@@ -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.14.2-beta.0
7
+ version: 4.14.2-beta.1
8
8
  */
9
9
  'use strict';
10
10
 
@@ -27,7 +27,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
27
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
28
  PERFORMANCE OF THIS SOFTWARE.
29
29
  ***************************************************************************** */
30
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
30
+ /* global Reflect, Promise, SuppressedError, Symbol */
31
31
 
32
32
  var extendStatics = function (d, b) {
33
33
  extendStatics = Object.setPrototypeOf || {
@@ -97,8 +97,12 @@ function __generator(thisArg, body) {
97
97
  f,
98
98
  y,
99
99
  t,
100
- g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
101
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
100
+ g;
101
+ return g = {
102
+ next: verb(0),
103
+ "throw": verb(1),
104
+ "return": verb(2)
105
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
102
106
  return this;
103
107
  }), g;
104
108
  function verb(n) {
@@ -2445,8 +2449,8 @@ var AxesController = /*#__PURE__*/function () {
2445
2449
  });
2446
2450
  };
2447
2451
  /**
2448
- * 현재
2449
- * @returns
2452
+ * Returns the current axes position
2453
+ * @ko 현재 axes의 position을 반환합니다.
2450
2454
  */
2451
2455
  __proto.getCurrentPosition = function () {
2452
2456
  var _a, _b;
@@ -2794,7 +2798,7 @@ var Control = /*#__PURE__*/function () {
2794
2798
  return __generator(this, function (_b) {
2795
2799
  flicking = getFlickingAttached(this._flicking);
2796
2800
  nextDuration = duration;
2797
- if (Math.abs(nextDuration - position) < 0.5) {
2801
+ if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
2798
2802
  nextDuration = 0;
2799
2803
  }
2800
2804
  animate = function () {
@@ -2828,6 +2832,7 @@ var Control = /*#__PURE__*/function () {
2828
2832
  });
2829
2833
  });
2830
2834
  };
2835
+
2831
2836
  __proto._getPosition = function (panel, direction) {
2832
2837
  if (direction === void 0) {
2833
2838
  direction = DIRECTION.NONE;
@@ -4753,6 +4758,17 @@ var Renderer = /*#__PURE__*/function () {
4753
4758
  });
4754
4759
  return Promise.resolve();
4755
4760
  };
4761
+ /**
4762
+ * Return Rendered Panels
4763
+ * @ko 렌더링이 된 패널을 반환합니다.
4764
+ * @return {Panel[]}
4765
+ */
4766
+ __proto.getRenderedPanels = function () {
4767
+ var flicking = getFlickingAttached(this._flicking);
4768
+ return flicking.renderer.panels.filter(function (panel) {
4769
+ return panel.rendered;
4770
+ });
4771
+ };
4756
4772
  /**
4757
4773
  * Update all panel sizes
4758
4774
  * @ko 모든 패널의 크기를 업데이트합니다
@@ -5113,6 +5129,13 @@ var Renderer = /*#__PURE__*/function () {
5113
5129
  __proto._afterRender = function () {
5114
5130
  var flicking = getFlickingAttached(this._flicking);
5115
5131
  flicking.camera.applyTransform();
5132
+ if (flicking.useCSSOrderProperty) {
5133
+ // useCSSOrderProperty를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
5134
+ var panels_1 = flicking.panels;
5135
+ this._strategy.getRenderingIndexesByOrder(flicking).forEach(function (domIndex, index) {
5136
+ panels_1[domIndex].element.style.order = "" + index;
5137
+ });
5138
+ }
5116
5139
  };
5117
5140
  return Renderer;
5118
5141
  }();
@@ -5141,6 +5164,7 @@ var VanillaRenderer = /*#__PURE__*/function (_super) {
5141
5164
  });
5142
5165
  });
5143
5166
  };
5167
+
5144
5168
  __proto._collectPanels = function () {
5145
5169
  var flicking = getFlickingAttached(this._flicking);
5146
5170
  var camera = flicking.camera;
@@ -5154,7 +5178,15 @@ var VanillaRenderer = /*#__PURE__*/function (_super) {
5154
5178
  var flicking = getFlickingAttached(this._flicking);
5155
5179
  var cameraEl = flicking.camera.element;
5156
5180
  // We're using reversed panels here as last panel should be the last element of camera element
5157
- var reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
5181
+ var reversedElements = [];
5182
+ if (flicking.useCSSOrderProperty) {
5183
+ // useCSSOrderProperty를 사용하는 경우 원본 그대로 렌더링
5184
+ reversedElements = this.getRenderedPanels().map(function (panel) {
5185
+ return panel.element;
5186
+ }).reverse();
5187
+ } else {
5188
+ reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
5189
+ }
5158
5190
  reversedElements.forEach(function (el, idx) {
5159
5191
  var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
5160
5192
  if (el.nextElementSibling !== nextEl) {
@@ -6217,7 +6249,11 @@ var Flicking = /*#__PURE__*/function (_super) {
6217
6249
  _15 = _b.renderExternal,
6218
6250
  renderExternal = _15 === void 0 ? null : _15,
6219
6251
  _16 = _b.optimizeSizeUpdate,
6220
- optimizeSizeUpdate = _16 === void 0 ? false : _16;
6252
+ optimizeSizeUpdate = _16 === void 0 ? false : _16,
6253
+ _17 = _b.animationThreshold,
6254
+ animationThreshold = _17 === void 0 ? 0.5 : _17,
6255
+ _18 = _b.useCSSOrderProperty,
6256
+ useCSSOrderProperty = _18 === void 0 ? false : _18;
6221
6257
  var _this = _super.call(this) || this;
6222
6258
  // Internal states
6223
6259
  _this._initialized = false;
@@ -6263,6 +6299,8 @@ var Flicking = /*#__PURE__*/function (_super) {
6263
6299
  _this._externalRenderer = externalRenderer;
6264
6300
  _this._renderExternal = renderExternal;
6265
6301
  _this._optimizeSizeUpdate = optimizeSizeUpdate;
6302
+ _this._animationThreshold = animationThreshold;
6303
+ _this._useCSSOrderProperty = useCSSOrderProperty;
6266
6304
  // Create core components
6267
6305
  _this._viewport = new Viewport(_this, getElement(root));
6268
6306
  _this._autoResizer = new AutoResizer(_this);
@@ -6974,6 +7012,43 @@ var Flicking = /*#__PURE__*/function (_super) {
6974
7012
  enumerable: false,
6975
7013
  configurable: true
6976
7014
  });
7015
+ Object.defineProperty(__proto, "animationThreshold", {
7016
+ /**
7017
+ * The minimum distance for animation to proceed. If the distance to be moved is less than `animationThreshold`, the movement proceeds immediately without animation (duration: 0).
7018
+ * @ko animation이 진행되기 위한 최소한의 거리. 이동하려는 거리가 `animationThreshold`보다 적으면 애니메이션 없이(duration: 0) 즉시 이동한다.
7019
+ * @type {number}
7020
+ * @default 0.5
7021
+ * @see {@link https://naver.github.io/egjs-flicking/Options#animationThreshold animationThreshold ( Options )}
7022
+ */
7023
+ get: function () {
7024
+ return this._animationThreshold;
7025
+ },
7026
+ set: function (val) {
7027
+ this._animationThreshold = val;
7028
+ },
7029
+ enumerable: false,
7030
+ configurable: true
7031
+ });
7032
+ Object.defineProperty(__proto, "useCSSOrderProperty", {
7033
+ /**
7034
+ * When `circular` is used, the DOM order changes depending on the position. Using `useCSSOrderProperty` does not change the DOM order, but the `order` CSS property changes the order on the screen.
7035
+ * When using `iframe`, you can prevent reloading when the DOM order changes.
7036
+ * @ko `circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다. `useCSSOrderProperty`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다.
7037
+ * `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
7038
+ * @type {boolean}
7039
+ * @requires `circular`
7040
+ * @default false
7041
+ * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrderProperty animationThreshold ( Options )}
7042
+ */
7043
+ get: function () {
7044
+ return this._useCSSOrderProperty;
7045
+ },
7046
+ set: function (val) {
7047
+ this._useCSSOrderProperty = val;
7048
+ },
7049
+ enumerable: false,
7050
+ configurable: true
7051
+ });
6977
7052
  Object.defineProperty(__proto, "interruptable", {
6978
7053
  /**
6979
7054
  * Set animation to be interruptable by click/touch.
@@ -7862,6 +7937,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7862
7937
  if (!this._initialized) {
7863
7938
  return [2 /*return*/];
7864
7939
  }
7940
+
7865
7941
  renderer.updatePanelSize();
7866
7942
  camera.updateAlignPos();
7867
7943
  camera.updateRange();
@@ -7875,6 +7951,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7875
7951
  if (!this._initialized) {
7876
7952
  return [2 /*return*/];
7877
7953
  }
7954
+
7878
7955
  if (control.animating) ; else {
7879
7956
  control.updatePosition(prevProgressInPanel);
7880
7957
  control.updateInput();
@@ -8112,7 +8189,7 @@ var Flicking = /*#__PURE__*/function (_super) {
8112
8189
  * Flicking.VERSION; // ex) 4.0.0
8113
8190
  * ```
8114
8191
  */
8115
- Flicking.VERSION = "4.14.2-beta.0";
8192
+ Flicking.VERSION = "4.14.2-beta.1";
8116
8193
  return Flicking;
8117
8194
  }(Component);
8118
8195
 
@@ -8628,13 +8705,16 @@ var getRenderingPanels = (function (flicking, diffResult) {
8628
8705
  map[prev] = current;
8629
8706
  return map;
8630
8707
  }, {});
8631
- return __spread(flicking.panels.filter(function (panel) {
8708
+ var renderingPanels = flicking.panels.filter(function (panel) {
8632
8709
  return !removedPanels[panel.index];
8633
- })
8634
- // Sort panels by position
8635
- .sort(function (panel1, panel2) {
8636
- return panel1.position + panel1.offset - (panel2.position + panel2.offset);
8637
- }).map(function (panel) {
8710
+ });
8711
+ if (!flicking.useCSSOrderProperty) {
8712
+ // useCSSOrderProperty를 사용하게 되는 경우 sort 하지 않는다.
8713
+ renderingPanels.sort(function (panel1, panel2) {
8714
+ return panel1.position + panel1.offset - (panel2.position + panel2.offset);
8715
+ });
8716
+ }
8717
+ return __spread(renderingPanels.map(function (panel) {
8638
8718
  return diffResult.list[maintainedMap[panel.index]];
8639
8719
  }), diffResult.added.map(function (idx) {
8640
8720
  return diffResult.list[idx];