@egjs/flicking 4.14.2-beta.1 → 4.15.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.14.2-beta.1
7
+ version: 4.15.0
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -10570,11 +10570,16 @@ version: 4.14.2-beta.1
10570
10570
  __proto._afterRender = function () {
10571
10571
  var flicking = getFlickingAttached(this._flicking);
10572
10572
  flicking.camera.applyTransform();
10573
- if (flicking.useCSSOrderProperty) {
10574
- // useCSSOrderProperty를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
10575
- var panels_1 = flicking.panels;
10573
+ if (flicking.useCSSOrder) {
10574
+ // `useCSSOrder`를 사용하는 경우 DOM은 변화가 없지만 대신 css `order`값을 주입
10575
+ var renderedPanels_1 = flicking.renderer.panels.filter(function (panel) {
10576
+ return panel.rendered;
10577
+ });
10576
10578
  this._strategy.getRenderingIndexesByOrder(flicking).forEach(function (domIndex, index) {
10577
- panels_1[domIndex].element.style.order = "" + index;
10579
+ if (renderedPanels_1[domIndex].element) {
10580
+ // 방어 코드 추가
10581
+ renderedPanels_1[domIndex].element.style.order = "" + index;
10582
+ }
10578
10583
  });
10579
10584
  }
10580
10585
  };
@@ -10620,8 +10625,8 @@ version: 4.14.2-beta.1
10620
10625
  var cameraEl = flicking.camera.element;
10621
10626
  // We're using reversed panels here as last panel should be the last element of camera element
10622
10627
  var reversedElements = [];
10623
- if (flicking.useCSSOrderProperty) {
10624
- // useCSSOrderProperty를 사용하는 경우 원본 그대로 렌더링
10628
+ if (flicking.useCSSOrder) {
10629
+ // useCSSOrder를 사용하는 경우 DOM은 변화가 없지만 대신 css `order`값을 주입
10625
10630
  reversedElements = this.getRenderedPanels().map(function (panel) {
10626
10631
  return panel.element;
10627
10632
  }).reverse();
@@ -11707,9 +11712,10 @@ version: 4.14.2-beta.1
11707
11712
  optimizeSizeUpdate = _16 === void 0 ? false : _16,
11708
11713
  _17 = _b.animationThreshold,
11709
11714
  animationThreshold = _17 === void 0 ? 0.5 : _17,
11710
- _18 = _b.useCSSOrderProperty,
11711
- useCSSOrderProperty = _18 === void 0 ? false : _18;
11715
+ _18 = _b.useCSSOrder,
11716
+ useCSSOrder = _18 === void 0 ? false : _18;
11712
11717
  var _this = _super.call(this) || this;
11718
+ _this._scheduleResize = false;
11713
11719
  // Internal states
11714
11720
  _this._initialized = false;
11715
11721
  _this._plugins = [];
@@ -11755,7 +11761,7 @@ version: 4.14.2-beta.1
11755
11761
  _this._renderExternal = renderExternal;
11756
11762
  _this._optimizeSizeUpdate = optimizeSizeUpdate;
11757
11763
  _this._animationThreshold = animationThreshold;
11758
- _this._useCSSOrderProperty = useCSSOrderProperty;
11764
+ _this._useCSSOrder = useCSSOrder;
11759
11765
  // Create core components
11760
11766
  _this._viewport = new Viewport(_this, getElement(root));
11761
11767
  _this._autoResizer = new AutoResizer(_this);
@@ -12484,22 +12490,23 @@ version: 4.14.2-beta.1
12484
12490
  enumerable: false,
12485
12491
  configurable: true
12486
12492
  });
12487
- Object.defineProperty(__proto, "useCSSOrderProperty", {
12493
+ Object.defineProperty(__proto, "useCSSOrder", {
12488
12494
  /**
12489
- * 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.
12495
+ * Using `useCSSOrder` does not change the DOM order, but the `order` CSS property changes the order on the screen. (When `circular` is used, the DOM order changes depending on the position.)
12490
12496
  * When using `iframe`, you can prevent reloading when the DOM order changes.
12491
- * @ko `circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다. `useCSSOrderProperty`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다.
12497
+ * In svelte, CSS order is always used.
12498
+ * @ko `useCSSOrder`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다. (`circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다.)
12492
12499
  * `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
12500
+ * svelte에서는 css order를 무조건 사용한다.
12493
12501
  * @type {boolean}
12494
- * @requires `circular`
12495
12502
  * @default false
12496
- * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrderProperty animationThreshold ( Options )}
12503
+ * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrder useCSSOrder ( Options )}
12497
12504
  */
12498
12505
  get: function () {
12499
- return this._useCSSOrderProperty;
12506
+ return this._useCSSOrder;
12500
12507
  },
12501
12508
  set: function (val) {
12502
- this._useCSSOrderProperty = val;
12509
+ this._useCSSOrder = val;
12503
12510
  },
12504
12511
  enumerable: false,
12505
12512
  configurable: true
@@ -12986,7 +12993,9 @@ version: 4.14.2-beta.1
12986
12993
  this._plugins.forEach(function (plugin) {
12987
12994
  return plugin.destroy();
12988
12995
  });
12996
+ this._scheduleResize = false;
12989
12997
  this._initialized = false;
12998
+ this._isResizing = false;
12990
12999
  };
12991
13000
  /**
12992
13001
  * Move to the previous panel (current index - 1)
@@ -13351,7 +13360,7 @@ version: 4.14.2-beta.1
13351
13360
  * @method
13352
13361
  * @fires Flicking#beforeResize
13353
13362
  * @fires Flicking#afterResize
13354
- * @return {this}
13363
+ * @return {boolean}
13355
13364
  */
13356
13365
  __proto.resize = function () {
13357
13366
  return __awaiter(this, void 0, void 0, function () {
@@ -13359,7 +13368,18 @@ version: 4.14.2-beta.1
13359
13368
  return __generator(this, function (_a) {
13360
13369
  switch (_a.label) {
13361
13370
  case 0:
13362
- if (this._isResizing) return [2 /*return*/];
13371
+ if (!this._initialized) {
13372
+ return [2 /*return*/];
13373
+ }
13374
+
13375
+ if (this._isResizing) {
13376
+ // resize를 연속으로 발생하면 무시하기에 마지막 viewport를 사이즈를 알 수 없음.
13377
+ // resize를 1번 더 실행할 수 잇는 스케줄링 등록
13378
+ this._scheduleResize = true;
13379
+ return [2 /*return*/];
13380
+ }
13381
+
13382
+ this._scheduleResize = false;
13363
13383
  this._isResizing = true;
13364
13384
  viewport = this._viewport;
13365
13385
  renderer = this._renderer;
@@ -13425,6 +13445,10 @@ version: 4.14.2-beta.1
13425
13445
  element: viewport.element
13426
13446
  }));
13427
13447
  this._isResizing = false;
13448
+ // 연속으로 resize를 호출하는 경우를 대비하기 위해서 스케줄링 반영
13449
+ if (this._scheduleResize) {
13450
+ this.resize();
13451
+ }
13428
13452
  return [2 /*return*/];
13429
13453
  }
13430
13454
  });
@@ -13644,7 +13668,7 @@ version: 4.14.2-beta.1
13644
13668
  * Flicking.VERSION; // ex) 4.0.0
13645
13669
  * ```
13646
13670
  */
13647
- Flicking.VERSION = "4.14.2-beta.1";
13671
+ Flicking.VERSION = "4.15.0";
13648
13672
  return Flicking;
13649
13673
  }(Component);
13650
13674
 
@@ -14186,8 +14210,8 @@ version: 4.14.2-beta.1
14186
14210
  var renderingPanels = flicking.panels.filter(function (panel) {
14187
14211
  return !removedPanels[panel.index];
14188
14212
  });
14189
- if (!flicking.useCSSOrderProperty) {
14190
- // useCSSOrderProperty를 사용하게 되는 경우 sort를 하지 않는다.
14213
+ if (!flicking.useCSSOrder) {
14214
+ // useCSSOrder를 사용하게 되는 경우 sort를 하지 않는다.
14191
14215
  renderingPanels.sort(function (panel1, panel2) {
14192
14216
  return panel1.position + panel1.offset - (panel2.position + panel2.offset);
14193
14217
  });