@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.
@@ -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() :
@@ -1362,6 +1362,10 @@ version: 4.11.4
1362
1362
  return Viewport;
1363
1363
  }();
1364
1364
 
1365
+ /**
1366
+ * A component that detects size change and trigger resize method when the autoResize option is used
1367
+ * @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
1368
+ */
1365
1369
  var AutoResizer = /*#__PURE__*/function () {
1366
1370
  function AutoResizer(flicking) {
1367
1371
  var _this = this;
@@ -1424,9 +1428,13 @@ version: 4.11.4
1424
1428
  }
1425
1429
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
1426
1430
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
1427
- var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
1428
- resizeObserver.observe(flicking.viewport.element);
1429
- this._resizeObserver = resizeObserver;
1431
+ var resizeObserver_1 = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
1432
+ __spread$1([flicking.viewport.element, flicking.camera.element], flicking.panels.map(function (panel) {
1433
+ return panel.element;
1434
+ })).forEach(function (element) {
1435
+ resizeObserver_1.observe(element);
1436
+ });
1437
+ this._resizeObserver = resizeObserver_1;
1430
1438
  } else {
1431
1439
  window.addEventListener("resize", this._onResize);
1432
1440
  }
@@ -1445,6 +1453,12 @@ version: 4.11.4
1445
1453
  this._enabled = false;
1446
1454
  return this;
1447
1455
  };
1456
+ __proto.observe = function (element) {
1457
+ if (this._resizeObserver) {
1458
+ this._resizeObserver.observe(element);
1459
+ }
1460
+ return this;
1461
+ };
1448
1462
  return AutoResizer;
1449
1463
  }();
1450
1464
 
@@ -9880,6 +9894,11 @@ version: 4.11.4
9880
9894
  var activePanel = control.activePanel;
9881
9895
  // Update camera & control
9882
9896
  this._updateCameraAndControl();
9897
+ if (flicking.autoResize && flicking.useResizeObserver) {
9898
+ panelsAdded.forEach(function (panel) {
9899
+ flicking.autoResizer.observe(panel.element);
9900
+ });
9901
+ }
9883
9902
  void this.render();
9884
9903
  if (!flicking.animating) {
9885
9904
  if (!activePanel || activePanel.removed) {
@@ -11295,6 +11314,19 @@ version: 4.11.4
11295
11314
  enumerable: false,
11296
11315
  configurable: true
11297
11316
  });
11317
+ Object.defineProperty(__proto, "autoResizer", {
11318
+ /**
11319
+ * {@link AutoResizer} instance of the Flicking
11320
+ * @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
11321
+ * @internal
11322
+ * @readonly
11323
+ */
11324
+ get: function () {
11325
+ return this._autoResizer;
11326
+ },
11327
+ enumerable: false,
11328
+ configurable: true
11329
+ });
11298
11330
  Object.defineProperty(__proto, "initialized", {
11299
11331
  // Internal States
11300
11332
  /**
@@ -12147,6 +12179,9 @@ version: 4.11.4
12147
12179
  // OTHERS
12148
12180
  set: function (val) {
12149
12181
  this._autoResize = val;
12182
+ if (!this._initialized) {
12183
+ return;
12184
+ }
12150
12185
  if (val) {
12151
12186
  this._autoResizer.enable();
12152
12187
  } else {
@@ -12169,7 +12204,7 @@ version: 4.11.4
12169
12204
  },
12170
12205
  set: function (val) {
12171
12206
  this._useResizeObserver = val;
12172
- if (this._autoResize) {
12207
+ if (this._initialized && this._autoResize) {
12173
12208
  this._autoResizer.enable();
12174
12209
  }
12175
12210
  },
@@ -12966,7 +13001,7 @@ version: 4.11.4
12966
13001
  * Flicking.VERSION; // ex) 4.0.0
12967
13002
  * ```
12968
13003
  */
12969
- Flicking.VERSION = "4.11.4";
13004
+ Flicking.VERSION = "4.11.5-beta.1";
12970
13005
  return Flicking;
12971
13006
  }(Component);
12972
13007