@egjs/flicking 4.10.8 → 4.11.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.10.8
7
+ version: 4.11.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')) :
@@ -398,6 +398,17 @@ version: 4.10.8
398
398
  LINEAR: "linear",
399
399
  BOUND: "bound"
400
400
  };
401
+ /**
402
+ * An object for identifying {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
403
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성을 구분하기 위한 객체
404
+ * @type {object}
405
+ * @property {string} LTR "ltr"
406
+ * @property {string} RTL "rtl"
407
+ */
408
+ var ORDER = {
409
+ LTR: "ltr",
410
+ RTL: "rtl"
411
+ };
401
412
 
402
413
  var Constants = {
403
414
  __proto__: null,
@@ -407,6 +418,7 @@ version: 4.10.8
407
418
  MOVE_TYPE: MOVE_TYPE,
408
419
  CLASS: CLASS,
409
420
  CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
421
+ ORDER: ORDER,
410
422
  ERROR_CODE: CODE
411
423
  };
412
424
 
@@ -702,20 +714,22 @@ version: 4.10.8
702
714
  useFractionalSize = _a.useFractionalSize,
703
715
  useOffset = _a.useOffset,
704
716
  style = _a.style;
717
+ var size = 0;
705
718
  if (useFractionalSize) {
706
- var baseSize = parseFloat(horizontal ? style.width : style.height);
719
+ var baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
707
720
  var isBorderBoxSizing = style.boxSizing === "border-box";
708
721
  var border = horizontal ? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0") : parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
709
722
  if (isBorderBoxSizing) {
710
- return useOffset ? baseSize : baseSize - border;
723
+ size = useOffset ? baseSize : baseSize - border;
711
724
  } else {
712
725
  var padding = horizontal ? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0") : parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
713
- return useOffset ? baseSize + padding + border : baseSize + padding;
726
+ size = useOffset ? baseSize + padding + border : baseSize + padding;
714
727
  }
715
728
  } else {
716
729
  var sizeStr = horizontal ? "Width" : "Height";
717
- return useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
730
+ size = useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
718
731
  }
732
+ return Math.max(size, 0);
719
733
  };
720
734
  var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
721
735
  obj.__proto__ = proto;
@@ -2131,7 +2145,8 @@ version: 4.10.8
2131
2145
  inputType: flicking.inputType,
2132
2146
  threshold: 1,
2133
2147
  iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
2134
- scale: flicking.horizontal ? [-1, 0] : [0, -1],
2148
+ preventDefaultOnDrag: flicking.preventDefaultOnDrag,
2149
+ scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
2135
2150
  releaseOnScroll: true
2136
2151
  });
2137
2152
  var axes = this._axes;
@@ -2356,7 +2371,7 @@ version: 4.10.8
2356
2371
  var panInput = this._panInput;
2357
2372
  axes.disconnect(panInput);
2358
2373
  axes.connect(flicking.horizontal ? [POSITION_KEY, ""] : ["", POSITION_KEY], panInput);
2359
- panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
2374
+ panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
2360
2375
  };
2361
2376
  __proto._resetInternalValues = function () {
2362
2377
  this._flicking = null;
@@ -4049,6 +4064,19 @@ version: 4.10.8
4049
4064
  enumerable: false,
4050
4065
  configurable: true
4051
4066
  });
4067
+ Object.defineProperty(__proto, "panelOrder", {
4068
+ /**
4069
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
4070
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
4071
+ * @type {string}
4072
+ * @readonly
4073
+ */
4074
+ get: function () {
4075
+ return this._panelOrder;
4076
+ },
4077
+ enumerable: false,
4078
+ configurable: true
4079
+ });
4052
4080
  Object.defineProperty(__proto, "align", {
4053
4081
  // Options Getter
4054
4082
  /**
@@ -4080,6 +4108,7 @@ version: 4.10.8
4080
4108
  this._el = viewportEl.firstElementChild;
4081
4109
  this._checkTranslateSupport();
4082
4110
  this._updateMode();
4111
+ this.updatePanelOrder();
4083
4112
  return this;
4084
4113
  };
4085
4114
  /**
@@ -4322,6 +4351,24 @@ version: 4.10.8
4322
4351
  this.applyTransform();
4323
4352
  return this;
4324
4353
  };
4354
+ /**
4355
+ * Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
4356
+ * @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
4357
+ * @return {this}
4358
+ */
4359
+ __proto.updatePanelOrder = function () {
4360
+ var flicking = getFlickingAttached(this._flicking);
4361
+ if (!flicking.horizontal) return this;
4362
+ var el = this._el;
4363
+ var direction = getStyle(el).direction;
4364
+ if (direction !== this._panelOrder) {
4365
+ this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
4366
+ if (flicking.initialized) {
4367
+ flicking.control.controller.updateDirection();
4368
+ }
4369
+ }
4370
+ return this;
4371
+ };
4325
4372
  /**
4326
4373
  * Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
4327
4374
  * @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
@@ -4346,7 +4393,7 @@ version: 4.10.8
4346
4393
  var renderer = flicking.renderer;
4347
4394
  if (renderer.rendering || !flicking.initialized) return this;
4348
4395
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
4349
- el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4396
+ el.style[this._transform] = flicking.horizontal ? "translate(" + (this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition) + "px)" : "translate(0, " + -actualPosition + "px)";
4350
4397
  return this;
4351
4398
  };
4352
4399
  __proto._resetInternalValues = function () {
@@ -6057,30 +6104,32 @@ version: 4.10.8
6057
6104
  iOSEdgeSwipeThreshold = _z === void 0 ? 30 : _z,
6058
6105
  _0 = _b.preventClickOnDrag,
6059
6106
  preventClickOnDrag = _0 === void 0 ? true : _0,
6060
- _1 = _b.disableOnInit,
6061
- disableOnInit = _1 === void 0 ? false : _1,
6062
- _2 = _b.changeOnHold,
6063
- changeOnHold = _2 === void 0 ? false : _2,
6064
- _3 = _b.renderOnlyVisible,
6065
- renderOnlyVisible = _3 === void 0 ? false : _3,
6066
- _4 = _b.virtual,
6067
- virtual = _4 === void 0 ? null : _4,
6068
- _5 = _b.autoInit,
6069
- autoInit = _5 === void 0 ? true : _5,
6070
- _6 = _b.autoResize,
6071
- autoResize = _6 === void 0 ? true : _6,
6072
- _7 = _b.useResizeObserver,
6073
- useResizeObserver = _7 === void 0 ? true : _7,
6074
- _8 = _b.resizeDebounce,
6075
- resizeDebounce = _8 === void 0 ? 0 : _8,
6076
- _9 = _b.maxResizeDebounce,
6077
- maxResizeDebounce = _9 === void 0 ? 100 : _9,
6078
- _10 = _b.useFractionalSize,
6079
- useFractionalSize = _10 === void 0 ? false : _10,
6080
- _11 = _b.externalRenderer,
6081
- externalRenderer = _11 === void 0 ? null : _11,
6082
- _12 = _b.renderExternal,
6083
- renderExternal = _12 === void 0 ? null : _12;
6107
+ _1 = _b.preventDefaultOnDrag,
6108
+ preventDefaultOnDrag = _1 === void 0 ? false : _1,
6109
+ _2 = _b.disableOnInit,
6110
+ disableOnInit = _2 === void 0 ? false : _2,
6111
+ _3 = _b.changeOnHold,
6112
+ changeOnHold = _3 === void 0 ? false : _3,
6113
+ _4 = _b.renderOnlyVisible,
6114
+ renderOnlyVisible = _4 === void 0 ? false : _4,
6115
+ _5 = _b.virtual,
6116
+ virtual = _5 === void 0 ? null : _5,
6117
+ _6 = _b.autoInit,
6118
+ autoInit = _6 === void 0 ? true : _6,
6119
+ _7 = _b.autoResize,
6120
+ autoResize = _7 === void 0 ? true : _7,
6121
+ _8 = _b.useResizeObserver,
6122
+ useResizeObserver = _8 === void 0 ? true : _8,
6123
+ _9 = _b.resizeDebounce,
6124
+ resizeDebounce = _9 === void 0 ? 0 : _9,
6125
+ _10 = _b.maxResizeDebounce,
6126
+ maxResizeDebounce = _10 === void 0 ? 100 : _10,
6127
+ _11 = _b.useFractionalSize,
6128
+ useFractionalSize = _11 === void 0 ? false : _11,
6129
+ _12 = _b.externalRenderer,
6130
+ externalRenderer = _12 === void 0 ? null : _12,
6131
+ _13 = _b.renderExternal,
6132
+ renderExternal = _13 === void 0 ? null : _13;
6084
6133
  var _this = _super.call(this) || this;
6085
6134
  // Internal states
6086
6135
  _this._initialized = false;
@@ -6110,6 +6159,7 @@ version: 4.10.8
6110
6159
  _this._bounce = bounce;
6111
6160
  _this._iOSEdgeSwipeThreshold = iOSEdgeSwipeThreshold;
6112
6161
  _this._preventClickOnDrag = preventClickOnDrag;
6162
+ _this._preventDefaultOnDrag = preventDefaultOnDrag;
6113
6163
  _this._disableOnInit = disableOnInit;
6114
6164
  _this._changeOnHold = changeOnHold;
6115
6165
  _this._renderOnlyVisible = renderOnlyVisible;
@@ -6908,6 +6958,27 @@ version: 4.10.8
6908
6958
  enumerable: false,
6909
6959
  configurable: true
6910
6960
  });
6961
+ Object.defineProperty(__proto, "preventDefaultOnDrag", {
6962
+ /**
6963
+ * Whether to use the {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} when the user starts dragging
6964
+ * @ko 사용자가 드래그를 시작할 때 {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} 실행 여부
6965
+ * @type {boolean}
6966
+ * @default false
6967
+ * @see {@link https://naver.github.io/egjs-flicking/Options#preventDefaultOnDrag preventDefaultOnDrag ( Options )}
6968
+ */
6969
+ get: function () {
6970
+ return this._preventDefaultOnDrag;
6971
+ },
6972
+ set: function (val) {
6973
+ this._preventDefaultOnDrag = val;
6974
+ var panInput = this._control.controller.panInput;
6975
+ if (panInput) {
6976
+ panInput.options.preventDefaultOnDrag = val;
6977
+ }
6978
+ },
6979
+ enumerable: false,
6980
+ configurable: true
6981
+ });
6911
6982
  Object.defineProperty(__proto, "disableOnInit", {
6912
6983
  /**
6913
6984
  * Automatically call {@link Flicking#disableInput disableInput()} on initialization
@@ -7602,6 +7673,7 @@ version: 4.10.8
7602
7673
  camera.updateRange();
7603
7674
  camera.updateAnchors();
7604
7675
  camera.updateAdaptiveHeight();
7676
+ camera.updatePanelOrder();
7605
7677
  camera.updateOffset();
7606
7678
  return [4 /*yield*/, renderer.render()];
7607
7679
  case 2:
@@ -7842,7 +7914,7 @@ version: 4.10.8
7842
7914
  * Flicking.VERSION; // ex) 4.0.0
7843
7915
  * ```
7844
7916
  */
7845
- Flicking.VERSION = "4.10.8";
7917
+ Flicking.VERSION = "4.11.1";
7846
7918
  return Flicking;
7847
7919
  }(Component);
7848
7920