@egjs/flicking 4.11.4 → 4.11.5-beta.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.11.4
7
+ version: 4.11.5-beta.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')) :
@@ -955,6 +955,10 @@ version: 4.11.4
955
955
  return Viewport;
956
956
  }();
957
957
 
958
+ /**
959
+ * A component that detects size change and trigger resize method when the autoResize option is used
960
+ * @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
961
+ */
958
962
  var AutoResizer = /*#__PURE__*/function () {
959
963
  function AutoResizer(flicking) {
960
964
  var _this = this;
@@ -1017,9 +1021,13 @@ version: 4.11.4
1017
1021
  }
1018
1022
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
1019
1023
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
1020
- var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
1021
- resizeObserver.observe(flicking.viewport.element);
1022
- this._resizeObserver = resizeObserver;
1024
+ var resizeObserver_1 = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
1025
+ __spread([flicking.viewport.element, flicking.camera.element], flicking.panels.map(function (panel) {
1026
+ return panel.element;
1027
+ })).forEach(function (element) {
1028
+ resizeObserver_1.observe(element);
1029
+ });
1030
+ this._resizeObserver = resizeObserver_1;
1023
1031
  } else {
1024
1032
  window.addEventListener("resize", this._onResize);
1025
1033
  }
@@ -1038,6 +1046,12 @@ version: 4.11.4
1038
1046
  this._enabled = false;
1039
1047
  return this;
1040
1048
  };
1049
+ __proto.observe = function (element) {
1050
+ if (this._resizeObserver) {
1051
+ this._resizeObserver.observe(element);
1052
+ }
1053
+ return this;
1054
+ };
1041
1055
  return AutoResizer;
1042
1056
  }();
1043
1057
 
@@ -4845,6 +4859,11 @@ version: 4.11.4
4845
4859
  var activePanel = control.activePanel;
4846
4860
  // Update camera & control
4847
4861
  this._updateCameraAndControl();
4862
+ if (flicking.autoResize && flicking.useResizeObserver) {
4863
+ panelsAdded.forEach(function (panel) {
4864
+ flicking.autoResizer.observe(panel.element);
4865
+ });
4866
+ }
4848
4867
  void this.render();
4849
4868
  if (!flicking.animating) {
4850
4869
  if (!activePanel || activePanel.removed) {
@@ -6260,6 +6279,19 @@ version: 4.11.4
6260
6279
  enumerable: false,
6261
6280
  configurable: true
6262
6281
  });
6282
+ Object.defineProperty(__proto, "autoResizer", {
6283
+ /**
6284
+ * {@link AutoResizer} instance of the Flicking
6285
+ * @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
6286
+ * @internal
6287
+ * @readonly
6288
+ */
6289
+ get: function () {
6290
+ return this._autoResizer;
6291
+ },
6292
+ enumerable: false,
6293
+ configurable: true
6294
+ });
6263
6295
  Object.defineProperty(__proto, "initialized", {
6264
6296
  // Internal States
6265
6297
  /**
@@ -7112,6 +7144,9 @@ version: 4.11.4
7112
7144
  // OTHERS
7113
7145
  set: function (val) {
7114
7146
  this._autoResize = val;
7147
+ if (!this._initialized) {
7148
+ return;
7149
+ }
7115
7150
  if (val) {
7116
7151
  this._autoResizer.enable();
7117
7152
  } else {
@@ -7134,7 +7169,7 @@ version: 4.11.4
7134
7169
  },
7135
7170
  set: function (val) {
7136
7171
  this._useResizeObserver = val;
7137
- if (this._autoResize) {
7172
+ if (this._initialized && this._autoResize) {
7138
7173
  this._autoResizer.enable();
7139
7174
  }
7140
7175
  },
@@ -7931,7 +7966,7 @@ version: 4.11.4
7931
7966
  * Flicking.VERSION; // ex) 4.0.0
7932
7967
  * ```
7933
7968
  */
7934
- Flicking.VERSION = "4.11.4";
7969
+ Flicking.VERSION = "4.11.5-beta.1";
7935
7970
  return Flicking;
7936
7971
  }(Component);
7937
7972