@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.
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.1
7
+ version: 4.15.0
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')) :
@@ -5210,11 +5210,16 @@ version: 4.14.2-beta.1
5210
5210
  __proto._afterRender = function () {
5211
5211
  var flicking = getFlickingAttached(this._flicking);
5212
5212
  flicking.camera.applyTransform();
5213
- if (flicking.useCSSOrderProperty) {
5214
- // useCSSOrderProperty를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
5215
- var panels_1 = flicking.panels;
5213
+ if (flicking.useCSSOrder) {
5214
+ // `useCSSOrder`를 사용하는 경우 DOM은 변화가 없지만 대신 css `order`값을 주입
5215
+ var renderedPanels_1 = flicking.renderer.panels.filter(function (panel) {
5216
+ return panel.rendered;
5217
+ });
5216
5218
  this._strategy.getRenderingIndexesByOrder(flicking).forEach(function (domIndex, index) {
5217
- panels_1[domIndex].element.style.order = "" + index;
5219
+ if (renderedPanels_1[domIndex].element) {
5220
+ // 방어 코드 추가
5221
+ renderedPanels_1[domIndex].element.style.order = "" + index;
5222
+ }
5218
5223
  });
5219
5224
  }
5220
5225
  };
@@ -5260,8 +5265,8 @@ version: 4.14.2-beta.1
5260
5265
  var cameraEl = flicking.camera.element;
5261
5266
  // We're using reversed panels here as last panel should be the last element of camera element
5262
5267
  var reversedElements = [];
5263
- if (flicking.useCSSOrderProperty) {
5264
- // useCSSOrderProperty를 사용하는 경우 원본 그대로 렌더링
5268
+ if (flicking.useCSSOrder) {
5269
+ // useCSSOrder를 사용하는 경우 DOM은 변화가 없지만 대신 css `order`값을 주입
5265
5270
  reversedElements = this.getRenderedPanels().map(function (panel) {
5266
5271
  return panel.element;
5267
5272
  }).reverse();
@@ -6347,9 +6352,10 @@ version: 4.14.2-beta.1
6347
6352
  optimizeSizeUpdate = _16 === void 0 ? false : _16,
6348
6353
  _17 = _b.animationThreshold,
6349
6354
  animationThreshold = _17 === void 0 ? 0.5 : _17,
6350
- _18 = _b.useCSSOrderProperty,
6351
- useCSSOrderProperty = _18 === void 0 ? false : _18;
6355
+ _18 = _b.useCSSOrder,
6356
+ useCSSOrder = _18 === void 0 ? false : _18;
6352
6357
  var _this = _super.call(this) || this;
6358
+ _this._scheduleResize = false;
6353
6359
  // Internal states
6354
6360
  _this._initialized = false;
6355
6361
  _this._plugins = [];
@@ -6395,7 +6401,7 @@ version: 4.14.2-beta.1
6395
6401
  _this._renderExternal = renderExternal;
6396
6402
  _this._optimizeSizeUpdate = optimizeSizeUpdate;
6397
6403
  _this._animationThreshold = animationThreshold;
6398
- _this._useCSSOrderProperty = useCSSOrderProperty;
6404
+ _this._useCSSOrder = useCSSOrder;
6399
6405
  // Create core components
6400
6406
  _this._viewport = new Viewport(_this, getElement(root));
6401
6407
  _this._autoResizer = new AutoResizer(_this);
@@ -7124,22 +7130,23 @@ version: 4.14.2-beta.1
7124
7130
  enumerable: false,
7125
7131
  configurable: true
7126
7132
  });
7127
- Object.defineProperty(__proto, "useCSSOrderProperty", {
7133
+ Object.defineProperty(__proto, "useCSSOrder", {
7128
7134
  /**
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.
7135
+ * 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.)
7130
7136
  * When using `iframe`, you can prevent reloading when the DOM order changes.
7131
- * @ko `circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다. `useCSSOrderProperty`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다.
7137
+ * In svelte, CSS order is always used.
7138
+ * @ko `useCSSOrder`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다. (`circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다.)
7132
7139
  * `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
7140
+ * svelte에서는 css order를 무조건 사용한다.
7133
7141
  * @type {boolean}
7134
- * @requires `circular`
7135
7142
  * @default false
7136
- * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrderProperty animationThreshold ( Options )}
7143
+ * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrder useCSSOrder ( Options )}
7137
7144
  */
7138
7145
  get: function () {
7139
- return this._useCSSOrderProperty;
7146
+ return this._useCSSOrder;
7140
7147
  },
7141
7148
  set: function (val) {
7142
- this._useCSSOrderProperty = val;
7149
+ this._useCSSOrder = val;
7143
7150
  },
7144
7151
  enumerable: false,
7145
7152
  configurable: true
@@ -7626,7 +7633,9 @@ version: 4.14.2-beta.1
7626
7633
  this._plugins.forEach(function (plugin) {
7627
7634
  return plugin.destroy();
7628
7635
  });
7636
+ this._scheduleResize = false;
7629
7637
  this._initialized = false;
7638
+ this._isResizing = false;
7630
7639
  };
7631
7640
  /**
7632
7641
  * Move to the previous panel (current index - 1)
@@ -7991,7 +8000,7 @@ version: 4.14.2-beta.1
7991
8000
  * @method
7992
8001
  * @fires Flicking#beforeResize
7993
8002
  * @fires Flicking#afterResize
7994
- * @return {this}
8003
+ * @return {boolean}
7995
8004
  */
7996
8005
  __proto.resize = function () {
7997
8006
  return __awaiter(this, void 0, void 0, function () {
@@ -7999,7 +8008,18 @@ version: 4.14.2-beta.1
7999
8008
  return __generator(this, function (_a) {
8000
8009
  switch (_a.label) {
8001
8010
  case 0:
8002
- if (this._isResizing) return [2 /*return*/];
8011
+ if (!this._initialized) {
8012
+ return [2 /*return*/];
8013
+ }
8014
+
8015
+ if (this._isResizing) {
8016
+ // resize를 연속으로 발생하면 무시하기에 마지막 viewport를 사이즈를 알 수 없음.
8017
+ // resize를 1번 더 실행할 수 잇는 스케줄링 등록
8018
+ this._scheduleResize = true;
8019
+ return [2 /*return*/];
8020
+ }
8021
+
8022
+ this._scheduleResize = false;
8003
8023
  this._isResizing = true;
8004
8024
  viewport = this._viewport;
8005
8025
  renderer = this._renderer;
@@ -8065,6 +8085,10 @@ version: 4.14.2-beta.1
8065
8085
  element: viewport.element
8066
8086
  }));
8067
8087
  this._isResizing = false;
8088
+ // 연속으로 resize를 호출하는 경우를 대비하기 위해서 스케줄링 반영
8089
+ if (this._scheduleResize) {
8090
+ this.resize();
8091
+ }
8068
8092
  return [2 /*return*/];
8069
8093
  }
8070
8094
  });
@@ -8284,7 +8308,7 @@ version: 4.14.2-beta.1
8284
8308
  * Flicking.VERSION; // ex) 4.0.0
8285
8309
  * ```
8286
8310
  */
8287
- Flicking.VERSION = "4.14.2-beta.1";
8311
+ Flicking.VERSION = "4.15.0";
8288
8312
  return Flicking;
8289
8313
  }(Component);
8290
8314
 
@@ -8826,8 +8850,8 @@ version: 4.14.2-beta.1
8826
8850
  var renderingPanels = flicking.panels.filter(function (panel) {
8827
8851
  return !removedPanels[panel.index];
8828
8852
  });
8829
- if (!flicking.useCSSOrderProperty) {
8830
- // useCSSOrderProperty를 사용하게 되는 경우 sort를 하지 않는다.
8853
+ if (!flicking.useCSSOrder) {
8854
+ // useCSSOrder를 사용하게 되는 경우 sort를 하지 않는다.
8831
8855
  renderingPanels.sort(function (panel1, panel2) {
8832
8856
  return panel1.position + panel1.offset - (panel2.position + panel2.offset);
8833
8857
  });