@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.
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.14.2-beta.0
7
+ version: 4.14.2-beta.1
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'), require('@cfcs/core')) :
@@ -26,7 +26,7 @@ version: 4.14.2-beta.0
26
26
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
27
  PERFORMANCE OF THIS SOFTWARE.
28
28
  ***************************************************************************** */
29
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
29
+ /* global Reflect, Promise, SuppressedError, Symbol */
30
30
 
31
31
  var extendStatics = function (d, b) {
32
32
  extendStatics = Object.setPrototypeOf || {
@@ -96,8 +96,12 @@ version: 4.14.2-beta.0
96
96
  f,
97
97
  y,
98
98
  t,
99
- g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
100
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
99
+ g;
100
+ return g = {
101
+ next: verb(0),
102
+ "throw": verb(1),
103
+ "return": verb(2)
104
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
101
105
  return this;
102
106
  }), g;
103
107
  function verb(n) {
@@ -2492,8 +2496,8 @@ version: 4.14.2-beta.0
2492
2496
  });
2493
2497
  };
2494
2498
  /**
2495
- * 현재
2496
- * @returns
2499
+ * Returns the current axes position
2500
+ * @ko 현재 axes의 position을 반환합니다.
2497
2501
  */
2498
2502
  __proto.getCurrentPosition = function () {
2499
2503
  var _a, _b;
@@ -2841,7 +2845,7 @@ version: 4.14.2-beta.0
2841
2845
  return __generator(this, function (_b) {
2842
2846
  flicking = getFlickingAttached(this._flicking);
2843
2847
  nextDuration = duration;
2844
- if (Math.abs(nextDuration - position) < 0.5) {
2848
+ if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
2845
2849
  nextDuration = 0;
2846
2850
  }
2847
2851
  animate = function () {
@@ -2875,6 +2879,7 @@ version: 4.14.2-beta.0
2875
2879
  });
2876
2880
  });
2877
2881
  };
2882
+
2878
2883
  __proto._getPosition = function (panel, direction) {
2879
2884
  if (direction === void 0) {
2880
2885
  direction = DIRECTION.NONE;
@@ -4834,6 +4839,17 @@ version: 4.14.2-beta.0
4834
4839
  });
4835
4840
  return Promise.resolve();
4836
4841
  };
4842
+ /**
4843
+ * Return Rendered Panels
4844
+ * @ko 렌더링이 된 패널을 반환합니다.
4845
+ * @return {Panel[]}
4846
+ */
4847
+ __proto.getRenderedPanels = function () {
4848
+ var flicking = getFlickingAttached(this._flicking);
4849
+ return flicking.renderer.panels.filter(function (panel) {
4850
+ return panel.rendered;
4851
+ });
4852
+ };
4837
4853
  /**
4838
4854
  * Update all panel sizes
4839
4855
  * @ko 모든 패널의 크기를 업데이트합니다
@@ -5194,6 +5210,13 @@ version: 4.14.2-beta.0
5194
5210
  __proto._afterRender = function () {
5195
5211
  var flicking = getFlickingAttached(this._flicking);
5196
5212
  flicking.camera.applyTransform();
5213
+ if (flicking.useCSSOrderProperty) {
5214
+ // useCSSOrderProperty를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
5215
+ var panels_1 = flicking.panels;
5216
+ this._strategy.getRenderingIndexesByOrder(flicking).forEach(function (domIndex, index) {
5217
+ panels_1[domIndex].element.style.order = "" + index;
5218
+ });
5219
+ }
5197
5220
  };
5198
5221
  return Renderer;
5199
5222
  }();
@@ -5222,6 +5245,7 @@ version: 4.14.2-beta.0
5222
5245
  });
5223
5246
  });
5224
5247
  };
5248
+
5225
5249
  __proto._collectPanels = function () {
5226
5250
  var flicking = getFlickingAttached(this._flicking);
5227
5251
  var camera = flicking.camera;
@@ -5235,7 +5259,15 @@ version: 4.14.2-beta.0
5235
5259
  var flicking = getFlickingAttached(this._flicking);
5236
5260
  var cameraEl = flicking.camera.element;
5237
5261
  // We're using reversed panels here as last panel should be the last element of camera element
5238
- var reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
5262
+ var reversedElements = [];
5263
+ if (flicking.useCSSOrderProperty) {
5264
+ // useCSSOrderProperty를 사용하는 경우 원본 그대로 렌더링
5265
+ reversedElements = this.getRenderedPanels().map(function (panel) {
5266
+ return panel.element;
5267
+ }).reverse();
5268
+ } else {
5269
+ reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
5270
+ }
5239
5271
  reversedElements.forEach(function (el, idx) {
5240
5272
  var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
5241
5273
  if (el.nextElementSibling !== nextEl) {
@@ -6312,7 +6344,11 @@ version: 4.14.2-beta.0
6312
6344
  _15 = _b.renderExternal,
6313
6345
  renderExternal = _15 === void 0 ? null : _15,
6314
6346
  _16 = _b.optimizeSizeUpdate,
6315
- optimizeSizeUpdate = _16 === void 0 ? false : _16;
6347
+ optimizeSizeUpdate = _16 === void 0 ? false : _16,
6348
+ _17 = _b.animationThreshold,
6349
+ animationThreshold = _17 === void 0 ? 0.5 : _17,
6350
+ _18 = _b.useCSSOrderProperty,
6351
+ useCSSOrderProperty = _18 === void 0 ? false : _18;
6316
6352
  var _this = _super.call(this) || this;
6317
6353
  // Internal states
6318
6354
  _this._initialized = false;
@@ -6358,6 +6394,8 @@ version: 4.14.2-beta.0
6358
6394
  _this._externalRenderer = externalRenderer;
6359
6395
  _this._renderExternal = renderExternal;
6360
6396
  _this._optimizeSizeUpdate = optimizeSizeUpdate;
6397
+ _this._animationThreshold = animationThreshold;
6398
+ _this._useCSSOrderProperty = useCSSOrderProperty;
6361
6399
  // Create core components
6362
6400
  _this._viewport = new Viewport(_this, getElement(root));
6363
6401
  _this._autoResizer = new AutoResizer(_this);
@@ -7069,6 +7107,43 @@ version: 4.14.2-beta.0
7069
7107
  enumerable: false,
7070
7108
  configurable: true
7071
7109
  });
7110
+ Object.defineProperty(__proto, "animationThreshold", {
7111
+ /**
7112
+ * 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).
7113
+ * @ko animation이 진행되기 위한 최소한의 거리. 이동하려는 거리가 `animationThreshold`보다 적으면 애니메이션 없이(duration: 0) 즉시 이동한다.
7114
+ * @type {number}
7115
+ * @default 0.5
7116
+ * @see {@link https://naver.github.io/egjs-flicking/Options#animationThreshold animationThreshold ( Options )}
7117
+ */
7118
+ get: function () {
7119
+ return this._animationThreshold;
7120
+ },
7121
+ set: function (val) {
7122
+ this._animationThreshold = val;
7123
+ },
7124
+ enumerable: false,
7125
+ configurable: true
7126
+ });
7127
+ Object.defineProperty(__proto, "useCSSOrderProperty", {
7128
+ /**
7129
+ * 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.
7130
+ * When using `iframe`, you can prevent reloading when the DOM order changes.
7131
+ * @ko `circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다. `useCSSOrderProperty`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다.
7132
+ * `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
7133
+ * @type {boolean}
7134
+ * @requires `circular`
7135
+ * @default false
7136
+ * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrderProperty animationThreshold ( Options )}
7137
+ */
7138
+ get: function () {
7139
+ return this._useCSSOrderProperty;
7140
+ },
7141
+ set: function (val) {
7142
+ this._useCSSOrderProperty = val;
7143
+ },
7144
+ enumerable: false,
7145
+ configurable: true
7146
+ });
7072
7147
  Object.defineProperty(__proto, "interruptable", {
7073
7148
  /**
7074
7149
  * Set animation to be interruptable by click/touch.
@@ -7957,6 +8032,7 @@ version: 4.14.2-beta.0
7957
8032
  if (!this._initialized) {
7958
8033
  return [2 /*return*/];
7959
8034
  }
8035
+
7960
8036
  renderer.updatePanelSize();
7961
8037
  camera.updateAlignPos();
7962
8038
  camera.updateRange();
@@ -7970,6 +8046,7 @@ version: 4.14.2-beta.0
7970
8046
  if (!this._initialized) {
7971
8047
  return [2 /*return*/];
7972
8048
  }
8049
+
7973
8050
  if (control.animating) ; else {
7974
8051
  control.updatePosition(prevProgressInPanel);
7975
8052
  control.updateInput();
@@ -8207,7 +8284,7 @@ version: 4.14.2-beta.0
8207
8284
  * Flicking.VERSION; // ex) 4.0.0
8208
8285
  * ```
8209
8286
  */
8210
- Flicking.VERSION = "4.14.2-beta.0";
8287
+ Flicking.VERSION = "4.14.2-beta.1";
8211
8288
  return Flicking;
8212
8289
  }(Component);
8213
8290
 
@@ -8746,13 +8823,16 @@ version: 4.14.2-beta.0
8746
8823
  map[prev] = current;
8747
8824
  return map;
8748
8825
  }, {});
8749
- return __spread(flicking.panels.filter(function (panel) {
8826
+ var renderingPanels = flicking.panels.filter(function (panel) {
8750
8827
  return !removedPanels[panel.index];
8751
- })
8752
- // Sort panels by position
8753
- .sort(function (panel1, panel2) {
8754
- return panel1.position + panel1.offset - (panel2.position + panel2.offset);
8755
- }).map(function (panel) {
8828
+ });
8829
+ if (!flicking.useCSSOrderProperty) {
8830
+ // useCSSOrderProperty를 사용하게 되는 경우 sort 하지 않는다.
8831
+ renderingPanels.sort(function (panel1, panel2) {
8832
+ return panel1.position + panel1.offset - (panel2.position + panel2.offset);
8833
+ });
8834
+ }
8835
+ return __spread(renderingPanels.map(function (panel) {
8756
8836
  return diffResult.list[maintainedMap[panel.index]];
8757
8837
  }), diffResult.added.map(function (idx) {
8758
8838
  return diffResult.list[idx];