@egjs/flicking 4.11.0 → 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.
@@ -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.11.0
7
+ version: 4.11.1
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
@@ -396,6 +396,17 @@ var CIRCULAR_FALLBACK = {
396
396
  LINEAR: "linear",
397
397
  BOUND: "bound"
398
398
  };
399
+ /**
400
+ * 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`)
401
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성을 구분하기 위한 객체
402
+ * @type {object}
403
+ * @property {string} LTR "ltr"
404
+ * @property {string} RTL "rtl"
405
+ */
406
+ var ORDER = {
407
+ LTR: "ltr",
408
+ RTL: "rtl"
409
+ };
399
410
 
400
411
  // eslint-disable-next-line @typescript-eslint/ban-types
401
412
  var merge = function (target) {
@@ -689,20 +700,22 @@ var getElementSize = function (_a) {
689
700
  useFractionalSize = _a.useFractionalSize,
690
701
  useOffset = _a.useOffset,
691
702
  style = _a.style;
703
+ var size = 0;
692
704
  if (useFractionalSize) {
693
- var baseSize = parseFloat(horizontal ? style.width : style.height);
705
+ var baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
694
706
  var isBorderBoxSizing = style.boxSizing === "border-box";
695
707
  var border = horizontal ? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0") : parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
696
708
  if (isBorderBoxSizing) {
697
- return useOffset ? baseSize : baseSize - border;
709
+ size = useOffset ? baseSize : baseSize - border;
698
710
  } else {
699
711
  var padding = horizontal ? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0") : parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
700
- return useOffset ? baseSize + padding + border : baseSize + padding;
712
+ size = useOffset ? baseSize + padding + border : baseSize + padding;
701
713
  }
702
714
  } else {
703
715
  var sizeStr = horizontal ? "Width" : "Height";
704
- return useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
716
+ size = useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
705
717
  }
718
+ return Math.max(size, 0);
706
719
  };
707
720
  var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
708
721
  obj.__proto__ = proto;
@@ -2086,7 +2099,7 @@ var AxesController = /*#__PURE__*/function () {
2086
2099
  threshold: 1,
2087
2100
  iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
2088
2101
  preventDefaultOnDrag: flicking.preventDefaultOnDrag,
2089
- scale: flicking.horizontal ? [-1, 0] : [0, -1],
2102
+ scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
2090
2103
  releaseOnScroll: true
2091
2104
  });
2092
2105
  var axes = this._axes;
@@ -2311,7 +2324,7 @@ var AxesController = /*#__PURE__*/function () {
2311
2324
  var panInput = this._panInput;
2312
2325
  axes.disconnect(panInput);
2313
2326
  axes.connect(flicking.horizontal ? [POSITION_KEY, ""] : ["", POSITION_KEY], panInput);
2314
- panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
2327
+ panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
2315
2328
  };
2316
2329
  __proto._resetInternalValues = function () {
2317
2330
  this._flicking = null;
@@ -3983,6 +3996,19 @@ var Camera = /*#__PURE__*/function () {
3983
3996
  enumerable: false,
3984
3997
  configurable: true
3985
3998
  });
3999
+ Object.defineProperty(__proto, "panelOrder", {
4000
+ /**
4001
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
4002
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
4003
+ * @type {string}
4004
+ * @readonly
4005
+ */
4006
+ get: function () {
4007
+ return this._panelOrder;
4008
+ },
4009
+ enumerable: false,
4010
+ configurable: true
4011
+ });
3986
4012
  Object.defineProperty(__proto, "align", {
3987
4013
  // Options Getter
3988
4014
  /**
@@ -4014,6 +4040,7 @@ var Camera = /*#__PURE__*/function () {
4014
4040
  this._el = viewportEl.firstElementChild;
4015
4041
  this._checkTranslateSupport();
4016
4042
  this._updateMode();
4043
+ this.updatePanelOrder();
4017
4044
  return this;
4018
4045
  };
4019
4046
  /**
@@ -4256,6 +4283,24 @@ var Camera = /*#__PURE__*/function () {
4256
4283
  this.applyTransform();
4257
4284
  return this;
4258
4285
  };
4286
+ /**
4287
+ * Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
4288
+ * @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
4289
+ * @return {this}
4290
+ */
4291
+ __proto.updatePanelOrder = function () {
4292
+ var flicking = getFlickingAttached(this._flicking);
4293
+ if (!flicking.horizontal) return this;
4294
+ var el = this._el;
4295
+ var direction = getStyle(el).direction;
4296
+ if (direction !== this._panelOrder) {
4297
+ this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
4298
+ if (flicking.initialized) {
4299
+ flicking.control.controller.updateDirection();
4300
+ }
4301
+ }
4302
+ return this;
4303
+ };
4259
4304
  /**
4260
4305
  * Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
4261
4306
  * @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
@@ -4280,7 +4325,7 @@ var Camera = /*#__PURE__*/function () {
4280
4325
  var renderer = flicking.renderer;
4281
4326
  if (renderer.rendering || !flicking.initialized) return this;
4282
4327
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
4283
- el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4328
+ el.style[this._transform] = flicking.horizontal ? "translate(" + (this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition) + "px)" : "translate(0, " + -actualPosition + "px)";
4284
4329
  return this;
4285
4330
  };
4286
4331
  __proto._resetInternalValues = function () {
@@ -7533,6 +7578,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7533
7578
  camera.updateRange();
7534
7579
  camera.updateAnchors();
7535
7580
  camera.updateAdaptiveHeight();
7581
+ camera.updatePanelOrder();
7536
7582
  camera.updateOffset();
7537
7583
  return [4 /*yield*/, renderer.render()];
7538
7584
  case 2:
@@ -7773,7 +7819,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7773
7819
  * Flicking.VERSION; // ex) 4.0.0
7774
7820
  * ```
7775
7821
  */
7776
- Flicking.VERSION = "4.11.0";
7822
+ Flicking.VERSION = "4.11.1";
7777
7823
  return Flicking;
7778
7824
  }(Component);
7779
7825
 
@@ -7991,5 +8037,5 @@ var parseAlign = function (alignVal) {
7991
8037
  * egjs projects are licensed under the MIT license
7992
8038
  */
7993
8039
 
7994
- export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCameraMode, CIRCULAR_FALLBACK, CLASS, Camera, CircularCameraMode, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCameraMode, MOVE_TYPE, NormalRenderingStrategy, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaElementProvider, VanillaRenderer, Viewport, VirtualElementProvider, VirtualManager, VirtualPanel, VirtualRenderingStrategy, checkExistence, circulateIndex, circulatePosition, clamp, Flicking as default, find, findIndex, findRight, getDefaultCameraTransform, getDirection, getElement, getElementSize, getFlickingAttached, getMinusCompensatedIndex, getProgress, getRenderingPanels, getStyle, includes, isBetween, isString, merge, parseAlign$1 as parseAlign, parseArithmeticExpression, parseArithmeticSize, parseBounce, parseCSSSizeValue, parseElement, parsePanelAlign, range, setPrototypeOf, setSize, sync, toArray, withFlickingMethods };
8040
+ export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCameraMode, CIRCULAR_FALLBACK, CLASS, Camera, CircularCameraMode, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCameraMode, MOVE_TYPE, NormalRenderingStrategy, ORDER, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaElementProvider, VanillaRenderer, Viewport, VirtualElementProvider, VirtualManager, VirtualPanel, VirtualRenderingStrategy, checkExistence, circulateIndex, circulatePosition, clamp, Flicking as default, find, findIndex, findRight, getDefaultCameraTransform, getDirection, getElement, getElementSize, getFlickingAttached, getMinusCompensatedIndex, getProgress, getRenderingPanels, getStyle, includes, isBetween, isString, merge, parseAlign$1 as parseAlign, parseArithmeticExpression, parseArithmeticSize, parseBounce, parseCSSSizeValue, parseElement, parsePanelAlign, range, setPrototypeOf, setSize, sync, toArray, withFlickingMethods };
7995
8041
  //# sourceMappingURL=flicking.esm.js.map