@egjs/flicking 4.11.5-beta.0 → 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.
@@ -9,6 +9,7 @@ declare class AutoResizer {
9
9
  constructor(flicking: Flicking);
10
10
  enable(): this;
11
11
  disable(): this;
12
+ observe(element: Element): this;
12
13
  private _onResize;
13
14
  private _doScheduledResize;
14
15
  private _skipFirstResize;
@@ -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.5-beta.0
7
+ version: 4.11.5-beta.1
8
8
  */
9
9
  'use strict';
10
10
 
@@ -910,6 +910,10 @@ var Viewport = /*#__PURE__*/function () {
910
910
  return Viewport;
911
911
  }();
912
912
 
913
+ /**
914
+ * A component that detects size change and trigger resize method when the autoResize option is used
915
+ * @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
916
+ */
913
917
  var AutoResizer = /*#__PURE__*/function () {
914
918
  function AutoResizer(flicking) {
915
919
  var _this = this;
@@ -973,7 +977,7 @@ var AutoResizer = /*#__PURE__*/function () {
973
977
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
974
978
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
975
979
  var resizeObserver_1 = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
976
- __spread([flicking.viewport.element], flicking.camera.element ? [flicking.camera.element] : [], flicking.panels.map(function (panel) {
980
+ __spread([flicking.viewport.element, flicking.camera.element], flicking.panels.map(function (panel) {
977
981
  return panel.element;
978
982
  })).forEach(function (element) {
979
983
  resizeObserver_1.observe(element);
@@ -997,6 +1001,12 @@ var AutoResizer = /*#__PURE__*/function () {
997
1001
  this._enabled = false;
998
1002
  return this;
999
1003
  };
1004
+ __proto.observe = function (element) {
1005
+ if (this._resizeObserver) {
1006
+ this._resizeObserver.observe(element);
1007
+ }
1008
+ return this;
1009
+ };
1000
1010
  return AutoResizer;
1001
1011
  }();
1002
1012
 
@@ -4770,8 +4780,10 @@ var Renderer = /*#__PURE__*/function () {
4770
4780
  var activePanel = control.activePanel;
4771
4781
  // Update camera & control
4772
4782
  this._updateCameraAndControl();
4773
- if (flicking.autoResize) {
4774
- flicking.autoResizer.enable();
4783
+ if (flicking.autoResize && flicking.useResizeObserver) {
4784
+ panelsAdded.forEach(function (panel) {
4785
+ flicking.autoResizer.observe(panel.element);
4786
+ });
4775
4787
  }
4776
4788
  void this.render();
4777
4789
  if (!flicking.animating) {
@@ -6175,6 +6187,12 @@ var Flicking = /*#__PURE__*/function (_super) {
6175
6187
  configurable: true
6176
6188
  });
6177
6189
  Object.defineProperty(__proto, "autoResizer", {
6190
+ /**
6191
+ * {@link AutoResizer} instance of the Flicking
6192
+ * @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
6193
+ * @internal
6194
+ * @readonly
6195
+ */
6178
6196
  get: function () {
6179
6197
  return this._autoResizer;
6180
6198
  },
@@ -7033,6 +7051,9 @@ var Flicking = /*#__PURE__*/function (_super) {
7033
7051
  // OTHERS
7034
7052
  set: function (val) {
7035
7053
  this._autoResize = val;
7054
+ if (!this._initialized) {
7055
+ return;
7056
+ }
7036
7057
  if (val) {
7037
7058
  this._autoResizer.enable();
7038
7059
  } else {
@@ -7055,7 +7076,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7055
7076
  },
7056
7077
  set: function (val) {
7057
7078
  this._useResizeObserver = val;
7058
- if (this._autoResize) {
7079
+ if (this._initialized && this._autoResize) {
7059
7080
  this._autoResizer.enable();
7060
7081
  }
7061
7082
  },
@@ -7852,7 +7873,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7852
7873
  * Flicking.VERSION; // ex) 4.0.0
7853
7874
  * ```
7854
7875
  */
7855
- Flicking.VERSION = "4.11.5-beta.0";
7876
+ Flicking.VERSION = "4.11.5-beta.1";
7856
7877
  return Flicking;
7857
7878
  }(Component);
7858
7879