@egjs/flicking 3.8.4 → 3.9.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.
Files changed (37) hide show
  1. package/declaration/Flicking.d.ts +2 -1
  2. package/declaration/components/AutoResizer.d.ts +12 -0
  3. package/declaration/types.d.ts +1 -0
  4. package/dist/flicking.esm.js +87 -18
  5. package/dist/flicking.esm.js.map +1 -1
  6. package/dist/flicking.js +87 -18
  7. package/dist/flicking.js.map +1 -1
  8. package/dist/flicking.min.js +2 -2
  9. package/dist/flicking.min.js.map +1 -1
  10. package/dist/flicking.pkgd.js +87 -18
  11. package/dist/flicking.pkgd.js.map +1 -1
  12. package/dist/flicking.pkgd.min.js +2 -2
  13. package/dist/flicking.pkgd.min.js.map +1 -1
  14. package/doc/eg.Flicking.html +102 -39
  15. package/doc/global.html +1 -1
  16. package/doc/index.html +1 -1
  17. package/doc/node_modules_@egjs_component_src_Component.ts.html +1 -1
  18. package/doc/src_Flicking.ts.html +9 -16
  19. package/doc/src_types.ts.html +2 -1
  20. package/docs/build/release/3.9.0/dist/flicking.esm.js +5124 -0
  21. package/docs/build/release/3.9.0/dist/flicking.esm.js.map +1 -0
  22. package/docs/build/release/3.9.0/dist/flicking.js +5131 -0
  23. package/docs/build/release/3.9.0/dist/flicking.js.map +1 -0
  24. package/docs/build/release/3.9.0/dist/flicking.min.js +10 -0
  25. package/docs/build/release/3.9.0/dist/flicking.min.js.map +1 -0
  26. package/docs/build/release/3.9.0/dist/flicking.pkgd.js +11460 -0
  27. package/docs/build/release/3.9.0/dist/flicking.pkgd.js.map +1 -0
  28. package/docs/build/release/3.9.0/dist/flicking.pkgd.min.js +10 -0
  29. package/docs/build/release/3.9.0/dist/flicking.pkgd.min.js.map +1 -0
  30. package/package.json +5 -2
  31. package/rollup.config.development.js +26 -0
  32. package/src/Flicking.ts +8 -15
  33. package/src/components/AutoResizer.ts +80 -0
  34. package/src/components/Viewport.ts +7 -2
  35. package/src/consts.ts +1 -0
  36. package/src/types.ts +1 -0
  37. package/tsconfig.test.json +1 -0
@@ -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: 3.8.4
7
+ version: 3.9.0
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -6444,7 +6444,8 @@ version: 3.8.4
6444
6444
  renderExternal: false,
6445
6445
  resizeOnContentsReady: false,
6446
6446
  iOSEdgeSwipeThreshold: 30,
6447
- collectStatistics: true
6447
+ collectStatistics: true,
6448
+ useResizeObserver: true
6448
6449
  };
6449
6450
  var DEFAULT_VIEWPORT_CSS = {
6450
6451
  position: "relative",
@@ -8843,7 +8844,12 @@ version: 3.8.4
8843
8844
  __proto.disable = function () {
8844
8845
  if (this.panInput) {
8845
8846
  this.panInput.destroy();
8846
- this.panInput = null;
8847
+ this.panInput = null; // Refresh Axes instance
8848
+
8849
+ this.axes.destroy();
8850
+ this.setAxesInstance();
8851
+ this.updateScrollArea();
8852
+ this.updateAxesPosition(this.state.position);
8847
8853
  this.stateMachine.transitTo(STATE_TYPE.IDLE);
8848
8854
  }
8849
8855
  };
@@ -9542,6 +9548,7 @@ version: 3.8.4
9542
9548
  this.applyCSSValue();
9543
9549
  this.setMoveType();
9544
9550
  this.setAxesInstance();
9551
+ this.createPanInput();
9545
9552
  this.refreshPanels();
9546
9553
  this.setDefaultPanel();
9547
9554
  this.resize();
@@ -9653,7 +9660,6 @@ version: 3.8.4
9653
9660
  deceleration: options.deceleration,
9654
9661
  interruptable: true
9655
9662
  });
9656
- this.createPanInput();
9657
9663
  };
9658
9664
 
9659
9665
  __proto.refreshPanels = function () {
@@ -10370,6 +10376,77 @@ version: 3.8.4
10370
10376
  return Viewport;
10371
10377
  }();
10372
10378
 
10379
+ var AutoResizer =
10380
+ /*#__PURE__*/
10381
+ function () {
10382
+ function AutoResizer(flicking) {
10383
+ var _this = this;
10384
+
10385
+ this.skipFirstResize = function () {
10386
+ var isFirstResize = true;
10387
+ return function () {
10388
+ if (isFirstResize) {
10389
+ isFirstResize = false;
10390
+ return;
10391
+ }
10392
+
10393
+ _this.onResize();
10394
+ };
10395
+ }();
10396
+
10397
+ this.onResize = function () {
10398
+ _this.flicking.resize();
10399
+ };
10400
+
10401
+ this.flicking = flicking;
10402
+ this.enabled = false;
10403
+ this.resizeObserver = null;
10404
+ }
10405
+
10406
+ var __proto = AutoResizer.prototype;
10407
+
10408
+ __proto.enable = function () {
10409
+ var flicking = this.flicking;
10410
+
10411
+ if (this.enabled) {
10412
+ this.disable();
10413
+ }
10414
+
10415
+ if (flicking.options.useResizeObserver && !!window.ResizeObserver) {
10416
+ var flickingEl = flicking.getElement();
10417
+ var viewportSizeNot0 = flickingEl.clientWidth !== 0 || flickingEl.clientHeight !== 0;
10418
+ var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this.skipFirstResize) : new ResizeObserver(this.onResize);
10419
+ resizeObserver.observe(flickingEl);
10420
+ this.resizeObserver = resizeObserver;
10421
+ } else {
10422
+ window.addEventListener("resize", this.onResize);
10423
+ }
10424
+
10425
+ this.enabled = true;
10426
+ return this;
10427
+ };
10428
+
10429
+ __proto.disable = function () {
10430
+ if (!this.enabled) {
10431
+ return this;
10432
+ }
10433
+
10434
+ var resizeObserver = this.resizeObserver;
10435
+
10436
+ if (resizeObserver) {
10437
+ resizeObserver.disconnect();
10438
+ this.resizeObserver = null;
10439
+ } else {
10440
+ window.removeEventListener("resize", this.onResize);
10441
+ }
10442
+
10443
+ this.enabled = false;
10444
+ return this;
10445
+ };
10446
+
10447
+ return AutoResizer;
10448
+ }();
10449
+
10373
10450
  /**
10374
10451
  * Copyright (c) 2015 NAVER Corp.
10375
10452
  * egjs projects are licensed under the MIT license
@@ -10419,6 +10496,7 @@ version: 3.8.4
10419
10496
  * @param {boolean} [options.isConstantSize=false] Whether all panels have a constant size that won't be changed after resize. Enabling this option can increase performance while recalculating panel size.<ko>모든 패널의 크기가 불변인지의 여부. 이 옵션을 'true'로 설정하면 패널 크기 재설정시에 성능을 높일 수 있다.</ko>
10420
10497
  * @param {boolean} [options.renderExternal=false] Whether to use external rendering. It will delegate DOM manipulation and can synchronize the rendered state by calling `sync()` method. You can use this option to use in frameworks like React, Vue, Angular, which has its states and rendering methods.<ko>외부 렌더링을 사용할 지의 여부. 이 옵션을 사용시 렌더링을 외부에 위임할 수 있고, `sync()`를 호출하여 그 상태를 동기화할 수 있다. 이 옵션을 사용하여, React, Vue, Angular 등 자체적인 상태와 렌더링 방법을 갖는 프레임워크에 대응할 수 있다.</ko>
10421
10498
  * @param {boolean} [options.resizeOnContentsReady=false] Whether to resize the Flicking after the image/video elements inside viewport are ready.<br/>Use this property to prevent wrong Flicking layout caused by dynamic image / video sizes.<ko>Flicking 내부의 이미지 / 비디오 엘리먼트들이 전부 로드되었을 때 Flicking의 크기를 재계산하기 위한 옵션.<br/>이미지 / 비디오 크기가 고정 크기가 아닐 경우 사용하여 레이아웃이 잘못되는 것을 방지할 수 있다.</ko>
10499
+ * @param {boolean} [options.useResizeObserver=true] Whether to listen {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}'s event instead of Window's {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} event when using the `autoResize` option<ko>autoResize 옵션 사용시 {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}의 이벤트를 Window객체의 {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} 이벤트 대신 수신할지 여부를 설정합니다</ko>
10422
10500
  * @param {boolean} [options.collectStatistics=true] Whether to collect statistics on how you are using `Flicking`. These statistical data do not contain any personal information and are used only as a basis for the development of a user-friendly product.<ko>어떻게 `Flicking`을 사용하고 있는지에 대한 통계 수집 여부를 나타낸다. 이 통계자료는 개인정보를 포함하고 있지 않으며 오직 사용자 친화적인 제품으로 발전시키기 위한 근거자료로서 활용한다.</ko>
10423
10501
  */
10424
10502
 
@@ -10586,18 +10664,13 @@ version: 3.8.4
10586
10664
 
10587
10665
 
10588
10666
  _this.viewport = new Viewport(_this, _this.options, _this.triggerEvent);
10667
+ _this.autoResizer = new AutoResizer(_this);
10589
10668
 
10590
10669
  _this.listenInput();
10591
10670
 
10592
10671
  _this.listenResize();
10593
10672
 
10594
- return _this; // if (this.options.collectStatistics) {
10595
- // sendEvent(
10596
- // "usage",
10597
- // "options",
10598
- // options,
10599
- // );
10600
- // }
10673
+ return _this;
10601
10674
  }
10602
10675
  /**
10603
10676
  * Move to the previous panel if it exists.
@@ -10931,11 +11004,7 @@ version: 3.8.4
10931
11004
  }
10932
11005
 
10933
11006
  this.off();
10934
-
10935
- if (this.options.autoResize) {
10936
- window.removeEventListener("resize", this.resize);
10937
- }
10938
-
11007
+ this.autoResizer.disable();
10939
11008
  this.viewport.destroy(option);
10940
11009
  (_a = this.contentsReadyChecker) === null || _a === void 0 ? void 0 : _a.destroy(); // release resources
10941
11010
 
@@ -11307,7 +11376,7 @@ version: 3.8.4
11307
11376
  var options = this.options;
11308
11377
 
11309
11378
  if (options.autoResize) {
11310
- window.addEventListener("resize", this.resize);
11379
+ this.autoResizer.enable();
11311
11380
  }
11312
11381
 
11313
11382
  if (options.resizeOnContentsReady) {
@@ -11347,7 +11416,7 @@ version: 3.8.4
11347
11416
  */
11348
11417
 
11349
11418
 
11350
- Flicking.VERSION = "3.8.4";
11419
+ Flicking.VERSION = "3.9.0";
11351
11420
  /**
11352
11421
  * Direction constant - "PREV" or "NEXT"
11353
11422
  * @ko 방향 상수 - "PREV" 또는 "NEXT"