@egjs/flicking 4.11.0 → 4.11.2-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.
@@ -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.2-beta.0
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -222,7 +222,7 @@ version: 4.11.0
222
222
  license: MIT
223
223
  author: NAVER Corp.
224
224
  repository: https://github.com/naver/egjs-component
225
- version: 3.0.4
225
+ version: 3.0.5
226
226
  */
227
227
  /*! *****************************************************************************
228
228
  Copyright (c) Microsoft Corporation.
@@ -554,7 +554,6 @@ version: 4.11.0
554
554
  * ```
555
555
  */
556
556
  __proto.off = function (eventName, handlerToDetach) {
557
- var e_1, _a;
558
557
  // Detach all event handlers.
559
558
  if (isUndefined(eventName)) {
560
559
  this._eventHandler = {};
@@ -576,28 +575,14 @@ version: 4.11.0
576
575
  // Detach single event handler
577
576
  var handlerList = this._eventHandler[eventName];
578
577
  if (handlerList) {
579
- var idx = 0;
580
- try {
581
- for (var handlerList_1 = __values(handlerList), handlerList_1_1 = handlerList_1.next(); !handlerList_1_1.done; handlerList_1_1 = handlerList_1.next()) {
582
- var handlerFunction = handlerList_1_1.value;
583
- if (handlerFunction === handlerToDetach) {
584
- handlerList.splice(idx, 1);
585
- if (handlerList.length <= 0) {
586
- delete this._eventHandler[eventName];
587
- }
588
- break;
578
+ var length = handlerList.length;
579
+ for (var i = 0; i < length; ++i) {
580
+ if (handlerList[i] === handlerToDetach) {
581
+ handlerList.splice(i, 1);
582
+ if (length <= 1) {
583
+ delete this._eventHandler[eventName];
589
584
  }
590
- idx++;
591
- }
592
- } catch (e_1_1) {
593
- e_1 = {
594
- error: e_1_1
595
- };
596
- } finally {
597
- try {
598
- if (handlerList_1_1 && !handlerList_1_1.done && (_a = handlerList_1.return)) _a.call(handlerList_1);
599
- } finally {
600
- if (e_1) throw e_1.error;
585
+ break;
601
586
  }
602
587
  }
603
588
  }
@@ -612,7 +597,7 @@ version: 4.11.0
612
597
  * Component.VERSION; // ex) 3.0.0
613
598
  * @memberof Component
614
599
  */
615
- Component.VERSION = "3.0.4";
600
+ Component.VERSION = "3.0.5";
616
601
  return Component;
617
602
  }();
618
603
 
@@ -805,6 +790,17 @@ version: 4.11.0
805
790
  LINEAR: "linear",
806
791
  BOUND: "bound"
807
792
  };
793
+ /**
794
+ * 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`)
795
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성을 구분하기 위한 객체
796
+ * @type {object}
797
+ * @property {string} LTR "ltr"
798
+ * @property {string} RTL "rtl"
799
+ */
800
+ var ORDER = {
801
+ LTR: "ltr",
802
+ RTL: "rtl"
803
+ };
808
804
 
809
805
  var Constants = {
810
806
  __proto__: null,
@@ -814,6 +810,7 @@ version: 4.11.0
814
810
  MOVE_TYPE: MOVE_TYPE,
815
811
  CLASS: CLASS,
816
812
  CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
813
+ ORDER: ORDER,
817
814
  ERROR_CODE: CODE
818
815
  };
819
816
 
@@ -1109,20 +1106,22 @@ version: 4.11.0
1109
1106
  useFractionalSize = _a.useFractionalSize,
1110
1107
  useOffset = _a.useOffset,
1111
1108
  style = _a.style;
1109
+ var size = 0;
1112
1110
  if (useFractionalSize) {
1113
- var baseSize = parseFloat(horizontal ? style.width : style.height);
1111
+ var baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
1114
1112
  var isBorderBoxSizing = style.boxSizing === "border-box";
1115
1113
  var border = horizontal ? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0") : parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
1116
1114
  if (isBorderBoxSizing) {
1117
- return useOffset ? baseSize : baseSize - border;
1115
+ size = useOffset ? baseSize : baseSize - border;
1118
1116
  } else {
1119
1117
  var padding = horizontal ? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0") : parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
1120
- return useOffset ? baseSize + padding + border : baseSize + padding;
1118
+ size = useOffset ? baseSize + padding + border : baseSize + padding;
1121
1119
  }
1122
1120
  } else {
1123
1121
  var sizeStr = horizontal ? "Width" : "Height";
1124
- return useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
1122
+ size = useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
1125
1123
  }
1124
+ return Math.max(size, 0);
1126
1125
  };
1127
1126
  var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
1128
1127
  obj.__proto__ = proto;
@@ -6290,7 +6289,7 @@ version: 4.11.0
6290
6289
  threshold: 1,
6291
6290
  iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
6292
6291
  preventDefaultOnDrag: flicking.preventDefaultOnDrag,
6293
- scale: flicking.horizontal ? [-1, 0] : [0, -1],
6292
+ scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
6294
6293
  releaseOnScroll: true
6295
6294
  });
6296
6295
  var axes = this._axes;
@@ -6515,7 +6514,7 @@ version: 4.11.0
6515
6514
  var panInput = this._panInput;
6516
6515
  axes.disconnect(panInput);
6517
6516
  axes.connect(flicking.horizontal ? [POSITION_KEY, ""] : ["", POSITION_KEY], panInput);
6518
- panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
6517
+ panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
6519
6518
  };
6520
6519
  __proto._resetInternalValues = function () {
6521
6520
  this._flicking = null;
@@ -6797,6 +6796,7 @@ version: 4.11.0
6797
6796
  var _a;
6798
6797
  var flicking = getFlickingAttached(this._flicking);
6799
6798
  this._activePanel = newActivePanel;
6799
+ this._nextPanel = null;
6800
6800
  flicking.camera.updateAdaptiveHeight();
6801
6801
  if (newActivePanel !== prevActivePanel) {
6802
6802
  flicking.trigger(new ComponentEvent$1(EVENTS.CHANGED, {
@@ -6833,6 +6833,7 @@ version: 4.11.0
6833
6833
  isTrusted: (axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) || false,
6834
6834
  direction: getDirection$1((_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.position) !== null && _a !== void 0 ? _a : camera.position, position)
6835
6835
  });
6836
+ this._nextPanel = panel;
6836
6837
  flicking.trigger(event);
6837
6838
  if (event.isCanceled()) {
6838
6839
  throw new FlickingError(MESSAGE.STOP_CALLED_BY_USER, CODE.STOP_CALLED_BY_USER);
@@ -7420,19 +7421,20 @@ version: 4.11.0
7420
7421
  * @return {Promise<void>} A Promise which will be resolved after reaching the target position<ko>해당 좌표 도달시에 resolve되는 Promise</ko>
7421
7422
  */
7422
7423
  __proto.moveToPosition = function (position, duration, axesEvent) {
7424
+ var _a;
7423
7425
  var flicking = getFlickingAttached(this._flicking);
7424
7426
  var camera = flicking.camera;
7425
- var activePanel = this._activePanel;
7427
+ var currentPanel = (_a = this._nextPanel) !== null && _a !== void 0 ? _a : this._activePanel;
7426
7428
  var axesRange = this._controller.range;
7427
7429
  var indexRange = this._indexRange;
7428
7430
  var cameraRange = camera.range;
7429
7431
  var state = this._controller.state;
7430
7432
  var clampedPosition = clamp$1(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
7431
7433
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
7432
- if (!anchorAtPosition || !activePanel) {
7434
+ if (!anchorAtPosition || !currentPanel) {
7433
7435
  return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
7434
7436
  }
7435
- var prevPos = activePanel.position;
7437
+ var prevPos = currentPanel.position;
7436
7438
  var posDelta = flicking.animating ? state.delta : position - camera.position;
7437
7439
  var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
7438
7440
  var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
@@ -7449,7 +7451,7 @@ version: 4.11.0
7449
7451
  var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
7450
7452
  targetPanel = targetAnchor.panel;
7451
7453
  targetPos = targetAnchor.position;
7452
- } else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
7454
+ } else if (isOverThreshold && anchorAtPosition.position !== currentPanel.position) {
7453
7455
  // Move to anchor at position
7454
7456
  targetPanel = anchorAtPosition.panel;
7455
7457
  targetPos = anchorAtPosition.position;
@@ -8208,6 +8210,19 @@ version: 4.11.0
8208
8210
  enumerable: false,
8209
8211
  configurable: true
8210
8212
  });
8213
+ Object.defineProperty(__proto, "panelOrder", {
8214
+ /**
8215
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
8216
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
8217
+ * @type {string}
8218
+ * @readonly
8219
+ */
8220
+ get: function () {
8221
+ return this._panelOrder;
8222
+ },
8223
+ enumerable: false,
8224
+ configurable: true
8225
+ });
8211
8226
  Object.defineProperty(__proto, "align", {
8212
8227
  // Options Getter
8213
8228
  /**
@@ -8239,6 +8254,7 @@ version: 4.11.0
8239
8254
  this._el = viewportEl.firstElementChild;
8240
8255
  this._checkTranslateSupport();
8241
8256
  this._updateMode();
8257
+ this.updatePanelOrder();
8242
8258
  return this;
8243
8259
  };
8244
8260
  /**
@@ -8481,6 +8497,24 @@ version: 4.11.0
8481
8497
  this.applyTransform();
8482
8498
  return this;
8483
8499
  };
8500
+ /**
8501
+ * Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
8502
+ * @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
8503
+ * @return {this}
8504
+ */
8505
+ __proto.updatePanelOrder = function () {
8506
+ var flicking = getFlickingAttached(this._flicking);
8507
+ if (!flicking.horizontal) return this;
8508
+ var el = this._el;
8509
+ var direction = getStyle(el).direction;
8510
+ if (direction !== this._panelOrder) {
8511
+ this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
8512
+ if (flicking.initialized) {
8513
+ flicking.control.controller.updateDirection();
8514
+ }
8515
+ }
8516
+ return this;
8517
+ };
8484
8518
  /**
8485
8519
  * Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
8486
8520
  * @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
@@ -8505,7 +8539,7 @@ version: 4.11.0
8505
8539
  var renderer = flicking.renderer;
8506
8540
  if (renderer.rendering || !flicking.initialized) return this;
8507
8541
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
8508
- el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
8542
+ el.style[this._transform] = flicking.horizontal ? "translate(" + (this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition) + "px)" : "translate(0, " + -actualPosition + "px)";
8509
8543
  return this;
8510
8544
  };
8511
8545
  __proto._resetInternalValues = function () {
@@ -12655,6 +12689,7 @@ version: 4.11.0
12655
12689
  camera.updateRange();
12656
12690
  camera.updateAnchors();
12657
12691
  camera.updateAdaptiveHeight();
12692
+ camera.updatePanelOrder();
12658
12693
  camera.updateOffset();
12659
12694
  return [4 /*yield*/, renderer.render()];
12660
12695
  case 2:
@@ -12895,7 +12930,7 @@ version: 4.11.0
12895
12930
  * Flicking.VERSION; // ex) 4.0.0
12896
12931
  * ```
12897
12932
  */
12898
- Flicking.VERSION = "4.11.0";
12933
+ Flicking.VERSION = "4.11.2-beta.0";
12899
12934
  return Flicking;
12900
12935
  }(Component);
12901
12936