@egjs/flicking 4.5.1 → 4.6.2

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 (41) hide show
  1. package/TODO.md +3 -0
  2. package/declaration/Flicking.d.ts +8 -1
  3. package/declaration/camera/Camera.d.ts +2 -2
  4. package/declaration/control/Control.d.ts +1 -1
  5. package/declaration/core/AutoResizer.d.ts +3 -0
  6. package/declaration/core/ResizeWatcher.d.ts +33 -0
  7. package/declaration/renderer/Renderer.d.ts +13 -0
  8. package/dist/flicking-inline.css +45 -2
  9. package/dist/flicking-inline.min.css +1 -0
  10. package/dist/flicking.css +44 -2
  11. package/dist/flicking.esm.js +416 -289
  12. package/dist/flicking.esm.js.map +1 -1
  13. package/dist/flicking.js +416 -289
  14. package/dist/flicking.js.map +1 -1
  15. package/dist/flicking.min.css +1 -0
  16. package/dist/flicking.min.js +2 -2
  17. package/dist/flicking.min.js.map +1 -1
  18. package/dist/flicking.pkgd.js +416 -289
  19. package/dist/flicking.pkgd.js.map +1 -1
  20. package/dist/flicking.pkgd.min.js +2 -2
  21. package/dist/flicking.pkgd.min.js.map +1 -1
  22. package/package.json +13 -4
  23. package/sass/flicking-inline.sass +30 -0
  24. package/sass/flicking.sass +23 -0
  25. package/src/Flicking.ts +102 -21
  26. package/src/camera/Camera.ts +10 -14
  27. package/src/cfc/sync.ts +31 -23
  28. package/src/cfc/withFlickingMethods.ts +1 -1
  29. package/src/control/Control.ts +2 -2
  30. package/src/control/FreeControl.ts +1 -1
  31. package/src/control/SnapControl.ts +1 -1
  32. package/src/control/StrictControl.ts +1 -1
  33. package/src/control/states/AnimatingState.ts +4 -1
  34. package/src/control/states/DraggingState.ts +7 -2
  35. package/src/core/AutoResizer.ts +33 -0
  36. package/src/core/ResizeWatcher.ts +133 -0
  37. package/src/renderer/Renderer.ts +95 -44
  38. package/css/flicking-inline.css +0 -38
  39. package/css/flicking.css +0 -28
  40. package/dist/flicking-inline.css.map +0 -1
  41. package/dist/flicking.css.map +0 -1
@@ -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.5.1
7
+ version: 4.6.2
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1482,6 +1482,33 @@ version: 4.5.1
1482
1482
  var _this = this;
1483
1483
 
1484
1484
  this._onResize = function () {
1485
+ var flicking = _this._flicking;
1486
+ var resizeDebounce = flicking.resizeDebounce;
1487
+ var maxResizeDebounce = flicking.maxResizeDebounce;
1488
+
1489
+ if (resizeDebounce <= 0) {
1490
+ void flicking.resize();
1491
+ } else {
1492
+ if (_this._maxResizeDebounceTimer <= 0) {
1493
+ if (maxResizeDebounce > 0 && maxResizeDebounce >= resizeDebounce) {
1494
+ _this._maxResizeDebounceTimer = window.setTimeout(_this._doScheduledResize, maxResizeDebounce);
1495
+ }
1496
+ }
1497
+
1498
+ if (_this._resizeTimer > 0) {
1499
+ clearTimeout(_this._resizeTimer);
1500
+ _this._resizeTimer = 0;
1501
+ }
1502
+
1503
+ _this._resizeTimer = window.setTimeout(_this._doScheduledResize, resizeDebounce);
1504
+ }
1505
+ };
1506
+
1507
+ this._doScheduledResize = function () {
1508
+ clearTimeout(_this._resizeTimer);
1509
+ clearTimeout(_this._maxResizeDebounceTimer);
1510
+ _this._maxResizeDebounceTimer = -1;
1511
+ _this._resizeTimer = -1;
1485
1512
  void _this._flicking.resize();
1486
1513
  }; // eslint-disable-next-line @typescript-eslint/member-ordering
1487
1514
 
@@ -1501,6 +1528,8 @@ version: 4.5.1
1501
1528
  this._flicking = flicking;
1502
1529
  this._enabled = false;
1503
1530
  this._resizeObserver = null;
1531
+ this._resizeTimer = -1;
1532
+ this._maxResizeDebounceTimer = -1;
1504
1533
  }
1505
1534
 
1506
1535
  var __proto = AutoResizer.prototype;
@@ -8296,6 +8325,8 @@ version: 4.5.1
8296
8325
  };
8297
8326
 
8298
8327
  __proto.onRelease = function (ctx) {
8328
+ var _a;
8329
+
8299
8330
  var flicking = ctx.flicking,
8300
8331
  axesEvent = ctx.axesEvent,
8301
8332
  transitTo = ctx.transitTo; // Update last position to cope with Axes's animating behavior
@@ -8315,7 +8346,13 @@ version: 4.5.1
8315
8346
  var control = flicking.control;
8316
8347
  var position = axesEvent.destPos[POSITION_KEY];
8317
8348
  var duration = Math.max(axesEvent.duration, flicking.duration);
8318
- void control.moveToPosition(position, duration, axesEvent);
8349
+
8350
+ try {
8351
+ void control.moveToPosition(position, duration, axesEvent);
8352
+ } catch (err) {
8353
+ transitTo(STATE_TYPE.IDLE);
8354
+ axesEvent.setTo((_a = {}, _a[POSITION_KEY] = flicking.camera.position, _a), 0);
8355
+ }
8319
8356
  };
8320
8357
 
8321
8358
  return DraggingState;
@@ -8391,7 +8428,11 @@ version: 4.5.1
8391
8428
  direction: getDirection$1(animatingContext.start, animatingContext.end),
8392
8429
  axesEvent: axesEvent
8393
8430
  }));
8394
- control.setActive(this._targetPanel, control.activePanel, axesEvent.isTrusted);
8431
+ var targetPanel = this._targetPanel;
8432
+
8433
+ if (targetPanel) {
8434
+ control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
8435
+ }
8395
8436
  };
8396
8437
 
8397
8438
  return AnimatingState;
@@ -9146,7 +9187,7 @@ version: 4.5.1
9146
9187
  */
9147
9188
 
9148
9189
 
9149
- __proto.updatePosition = function (_progressInPanel) {
9190
+ __proto.updatePosition = function (progressInPanel) {
9150
9191
  var flicking = getFlickingAttached(this._flicking);
9151
9192
  var camera = flicking.camera;
9152
9193
  var activePanel = this._activePanel;
@@ -9522,48 +9563,41 @@ version: 4.5.1
9522
9563
  */
9523
9564
 
9524
9565
  __proto.moveToPosition = function (position, duration, axesEvent) {
9525
- return __awaiter(this, void 0, void 0, function () {
9526
- var flicking, camera, activeAnchor, anchorAtCamera, state, snapThreshold, posDelta, absPosDelta, snapDelta, targetAnchor;
9527
- return __generator(this, function (_a) {
9528
- flicking = getFlickingAttached(this._flicking);
9529
- camera = flicking.camera;
9530
- activeAnchor = camera.findActiveAnchor();
9531
- anchorAtCamera = camera.findNearestAnchor(camera.position);
9532
- state = flicking.control.controller.state;
9566
+ var flicking = getFlickingAttached(this._flicking);
9567
+ var camera = flicking.camera;
9568
+ var activeAnchor = camera.findActiveAnchor();
9569
+ var anchorAtCamera = camera.findNearestAnchor(camera.position);
9570
+ var state = flicking.control.controller.state;
9533
9571
 
9534
- if (!activeAnchor || !anchorAtCamera) {
9535
- return [2
9536
- /*return*/
9537
- , Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
9538
- }
9572
+ if (!activeAnchor || !anchorAtCamera) {
9573
+ return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
9574
+ }
9539
9575
 
9540
- snapThreshold = this._calcSnapThreshold(position, activeAnchor);
9541
- posDelta = flicking.animating ? state.delta : position - camera.position;
9542
- absPosDelta = Math.abs(posDelta);
9543
- snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
9544
-
9545
- if (snapDelta >= snapThreshold && snapDelta > 0) {
9546
- // Move to anchor at position
9547
- targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
9548
- } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
9549
- // Move to the adjacent panel
9550
- targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
9551
- } else {
9552
- // Restore to active panel
9553
- targetAnchor = anchorAtCamera;
9554
- }
9576
+ var snapThreshold = this._calcSnapThreshold(position, activeAnchor);
9555
9577
 
9556
- this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
9578
+ var posDelta = flicking.animating ? state.delta : position - camera.position;
9579
+ var absPosDelta = Math.abs(posDelta);
9580
+ var snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
9581
+ var targetAnchor;
9557
9582
 
9558
- return [2
9559
- /*return*/
9560
- , this._animateToPosition({
9561
- position: camera.clampToReachablePosition(targetAnchor.position),
9562
- duration: duration,
9563
- newActivePanel: targetAnchor.panel,
9564
- axesEvent: axesEvent
9565
- })];
9566
- });
9583
+ if (snapDelta >= snapThreshold && snapDelta > 0) {
9584
+ // Move to anchor at position
9585
+ targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
9586
+ } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
9587
+ // Move to the adjacent panel
9588
+ targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
9589
+ } else {
9590
+ // Restore to active panel
9591
+ targetAnchor = anchorAtCamera;
9592
+ }
9593
+
9594
+ this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
9595
+
9596
+ return this._animateToPosition({
9597
+ position: camera.clampToReachablePosition(targetAnchor.position),
9598
+ duration: duration,
9599
+ newActivePanel: targetAnchor.panel,
9600
+ axesEvent: axesEvent
9567
9601
  });
9568
9602
  };
9569
9603
 
@@ -9752,35 +9786,26 @@ version: 4.5.1
9752
9786
 
9753
9787
 
9754
9788
  __proto.moveToPosition = function (position, duration, axesEvent) {
9755
- return __awaiter(this, void 0, void 0, function () {
9756
- var flicking, camera, targetPos, anchorAtPosition, targetPanel;
9757
- return __generator(this, function (_a) {
9758
- flicking = getFlickingAttached(this._flicking);
9759
- camera = flicking.camera;
9760
- targetPos = camera.clampToReachablePosition(position);
9761
- anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
9789
+ var flicking = getFlickingAttached(this._flicking);
9790
+ var camera = flicking.camera;
9791
+ var targetPos = camera.clampToReachablePosition(position);
9792
+ var anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
9762
9793
 
9763
- if (!anchorAtPosition) {
9764
- return [2
9765
- /*return*/
9766
- , Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
9767
- }
9794
+ if (!anchorAtPosition) {
9795
+ return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
9796
+ }
9768
9797
 
9769
- targetPanel = anchorAtPosition.panel; // Trigger only change event
9798
+ var targetPanel = anchorAtPosition.panel; // Trigger only change event
9770
9799
 
9771
- if (targetPanel !== this._activePanel) {
9772
- this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
9773
- }
9800
+ if (targetPanel !== this._activePanel) {
9801
+ this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
9802
+ }
9774
9803
 
9775
- return [2
9776
- /*return*/
9777
- , this._animateToPosition({
9778
- position: this._stopAtEdge ? targetPos : position,
9779
- duration: duration,
9780
- newActivePanel: targetPanel,
9781
- axesEvent: axesEvent
9782
- })];
9783
- });
9804
+ return this._animateToPosition({
9805
+ position: this._stopAtEdge ? targetPos : position,
9806
+ duration: duration,
9807
+ newActivePanel: targetPanel,
9808
+ axesEvent: axesEvent
9784
9809
  });
9785
9810
  };
9786
9811
 
@@ -9978,62 +10003,56 @@ version: 4.5.1
9978
10003
 
9979
10004
 
9980
10005
  __proto.moveToPosition = function (position, duration, axesEvent) {
9981
- return __awaiter(this, void 0, void 0, function () {
9982
- var flicking, camera, activePanel, axesRange, indexRange, cameraRange, clampedPosition, anchorAtPosition, prevPos, isOverThreshold, adjacentAnchor, targetPos, targetPanel, anchors, firstAnchor, lastAnchor, shouldBounceToFirst, shouldBounceToLast, targetAnchor;
9983
- return __generator(this, function (_a) {
9984
- flicking = getFlickingAttached(this._flicking);
9985
- camera = flicking.camera;
9986
- activePanel = this._activePanel;
9987
- axesRange = this._controller.range;
9988
- indexRange = this._indexRange;
9989
- cameraRange = camera.range;
9990
- clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
9991
- anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
9992
-
9993
- if (!anchorAtPosition || !activePanel) {
9994
- return [2
9995
- /*return*/
9996
- , Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
9997
- }
10006
+ var flicking = getFlickingAttached(this._flicking);
10007
+ var camera = flicking.camera;
10008
+ var activePanel = this._activePanel;
10009
+ var axesRange = this._controller.range;
10010
+ var indexRange = this._indexRange;
10011
+ var cameraRange = camera.range;
10012
+ var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
10013
+ var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
9998
10014
 
9999
- prevPos = activePanel.position;
10000
- isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
10001
- adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
10002
- anchors = camera.anchorPoints;
10003
- firstAnchor = anchors[0];
10004
- lastAnchor = anchors[anchors.length - 1];
10005
- shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
10006
- shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
10007
-
10008
- if (shouldBounceToFirst || shouldBounceToLast) {
10009
- targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
10010
- targetPanel = targetAnchor.panel;
10011
- targetPos = targetAnchor.position;
10012
- } else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
10013
- // Move to anchor at position
10014
- targetPanel = anchorAtPosition.panel;
10015
- targetPos = anchorAtPosition.position;
10016
- } else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
10017
- // Move to adjacent anchor
10018
- targetPanel = adjacentAnchor.panel;
10019
- targetPos = adjacentAnchor.position;
10020
- } else {
10021
- // Restore to active panel
10022
- targetPos = camera.clampToReachablePosition(activePanel.position);
10023
- targetPanel = activePanel;
10024
- }
10015
+ if (!anchorAtPosition || !activePanel) {
10016
+ return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
10017
+ }
10025
10018
 
10026
- this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
10019
+ var prevPos = activePanel.position;
10020
+ var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
10021
+ var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
10022
+ var targetPos;
10023
+ var targetPanel;
10024
+ var anchors = camera.anchorPoints;
10025
+ var firstAnchor = anchors[0];
10026
+ var lastAnchor = anchors[anchors.length - 1];
10027
+ var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
10028
+ var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
10029
+
10030
+ if (shouldBounceToFirst || shouldBounceToLast) {
10031
+ // In bounce area
10032
+ var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
10033
+ targetPanel = targetAnchor.panel;
10034
+ targetPos = targetAnchor.position;
10035
+ } else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
10036
+ // Move to anchor at position
10037
+ targetPanel = anchorAtPosition.panel;
10038
+ targetPos = anchorAtPosition.position;
10039
+ } else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
10040
+ // Move to adjacent anchor
10041
+ targetPanel = adjacentAnchor.panel;
10042
+ targetPos = adjacentAnchor.position;
10043
+ } else {
10044
+ // Restore to active panel
10045
+ targetPos = camera.clampToReachablePosition(activePanel.position);
10046
+ targetPanel = activePanel;
10047
+ }
10027
10048
 
10028
- return [2
10029
- /*return*/
10030
- , this._animateToPosition({
10031
- position: targetPos,
10032
- duration: duration,
10033
- newActivePanel: targetPanel,
10034
- axesEvent: axesEvent
10035
- })];
10036
- });
10049
+ this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
10050
+
10051
+ return this._animateToPosition({
10052
+ position: targetPos,
10053
+ duration: duration,
10054
+ newActivePanel: targetPanel,
10055
+ axesEvent: axesEvent
10037
10056
  });
10038
10057
  };
10039
10058
 
@@ -10516,7 +10535,7 @@ version: 4.5.1
10516
10535
  /*#__PURE__*/
10517
10536
  function () {
10518
10537
  /** */
10519
- function Camera(_a) {
10538
+ function Camera(flicking, _a) {
10520
10539
  var _this = this;
10521
10540
 
10522
10541
  var _b = (_a === void 0 ? {} : _a).align,
@@ -10556,7 +10575,7 @@ version: 4.5.1
10556
10575
  _this._transform = transformName;
10557
10576
  };
10558
10577
 
10559
- this._flicking = null;
10578
+ this._flicking = flicking;
10560
10579
 
10561
10580
  this._resetInternalValues(); // Options
10562
10581
 
@@ -10851,17 +10870,14 @@ version: 4.5.1
10851
10870
  /**
10852
10871
  * Initialize Camera
10853
10872
  * @ko Camera를 초기화합니다
10854
- * @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
10855
- * @chainable
10856
10873
  * @throws {FlickingError}
10857
10874
  * {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
10858
10875
  * <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
10859
10876
  * @return {this}
10860
10877
  */
10861
10878
 
10862
- __proto.init = function (flicking) {
10863
- this._flicking = flicking;
10864
- var viewportEl = flicking.viewport.element;
10879
+ __proto.init = function () {
10880
+ var viewportEl = this._flicking.viewport.element;
10865
10881
  checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
10866
10882
  this._el = viewportEl.firstElementChild;
10867
10883
 
@@ -10879,8 +10895,6 @@ version: 4.5.1
10879
10895
 
10880
10896
 
10881
10897
  __proto.destroy = function () {
10882
- this._flicking = null;
10883
-
10884
10898
  this._resetInternalValues();
10885
10899
 
10886
10900
  return this;
@@ -10911,12 +10925,12 @@ version: 4.5.1
10911
10925
 
10912
10926
  this._checkReachEnd(prevPos, pos);
10913
10927
 
10914
- this.applyTransform();
10915
-
10916
10928
  if (toggled) {
10917
10929
  void flicking.renderer.render().then(function () {
10918
10930
  _this.updateOffset();
10919
10931
  });
10932
+ } else {
10933
+ this.applyTransform();
10920
10934
  }
10921
10935
  };
10922
10936
  /**
@@ -11103,7 +11117,6 @@ version: 4.5.1
11103
11117
  });
11104
11118
  }
11105
11119
 
11106
- this.updateOffset();
11107
11120
  return this;
11108
11121
  };
11109
11122
  /**
@@ -11195,7 +11208,6 @@ version: 4.5.1
11195
11208
  /**
11196
11209
  * Apply "transform" style with the current position to camera element
11197
11210
  * @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
11198
- * @chainable
11199
11211
  * @return {this}
11200
11212
  */
11201
11213
 
@@ -11203,6 +11215,8 @@ version: 4.5.1
11203
11215
  __proto.applyTransform = function () {
11204
11216
  var el = this._el;
11205
11217
  var flicking = getFlickingAttached(this._flicking);
11218
+ var renderer = flicking.renderer;
11219
+ if (renderer.rendering) return this;
11206
11220
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
11207
11221
  el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
11208
11222
  return this;
@@ -12395,7 +12409,8 @@ version: 4.5.1
12395
12409
  align = _b === void 0 ? ALIGN.CENTER : _b,
12396
12410
  strategy = _a.strategy;
12397
12411
  this._flicking = null;
12398
- this._panels = []; // Bind options
12412
+ this._panels = [];
12413
+ this._rendering = false; // Bind options
12399
12414
 
12400
12415
  this._align = align;
12401
12416
  this._strategy = strategy;
@@ -12418,6 +12433,20 @@ version: 4.5.1
12418
12433
  enumerable: false,
12419
12434
  configurable: true
12420
12435
  });
12436
+ Object.defineProperty(__proto, "rendering", {
12437
+ /**
12438
+ * A boolean value indicating whether rendering is in progress
12439
+ * @ko 현재 렌더링이 시작되어 끝나기 전까지의 상태인지의 여부
12440
+ * @type {boolean}
12441
+ * @readonly
12442
+ * @internal
12443
+ */
12444
+ get: function () {
12445
+ return this._rendering;
12446
+ },
12447
+ enumerable: false,
12448
+ configurable: true
12449
+ });
12421
12450
  Object.defineProperty(__proto, "panelCount", {
12422
12451
  /**
12423
12452
  * Count of panels
@@ -12549,6 +12578,25 @@ version: 4.5.1
12549
12578
 
12550
12579
 
12551
12580
  __proto.batchInsert = function () {
12581
+ var items = [];
12582
+
12583
+ for (var _i = 0; _i < arguments.length; _i++) {
12584
+ items[_i] = arguments[_i];
12585
+ }
12586
+
12587
+ var allPanelsInserted = this.batchInsertDefer.apply(this, __spread$1(items));
12588
+ if (allPanelsInserted.length <= 0) return [];
12589
+ this.updateAfterPanelChange(allPanelsInserted, []);
12590
+ return allPanelsInserted;
12591
+ };
12592
+ /**
12593
+ * Defers update
12594
+ * camera position & others will be updated after calling updateAfterPanelChange
12595
+ * @internal
12596
+ */
12597
+
12598
+
12599
+ __proto.batchInsertDefer = function () {
12552
12600
  var _this = this;
12553
12601
 
12554
12602
  var items = [];
@@ -12559,7 +12607,6 @@ version: 4.5.1
12559
12607
 
12560
12608
  var panels = this._panels;
12561
12609
  var flicking = getFlickingAttached(this._flicking);
12562
- var control = flicking.control;
12563
12610
  var prevFirstPanel = panels[0];
12564
12611
  var align = parsePanelAlign(this._align);
12565
12612
  var allPanelsInserted = items.reduce(function (addedPanels, item) {
@@ -12599,27 +12646,6 @@ version: 4.5.1
12599
12646
  });
12600
12647
  return __spread$1(addedPanels, panelsInserted);
12601
12648
  }, []);
12602
- if (allPanelsInserted.length <= 0) return []; // Update camera & control
12603
-
12604
- this._updateCameraAndControl();
12605
-
12606
- void this.render(); // Move to the first panel added if no panels existed
12607
- // FIXME: fix for animating case
12608
-
12609
- if (allPanelsInserted.length > 0 && !control.animating) {
12610
- void control.moveToPanel(control.activePanel || allPanelsInserted[0], {
12611
- duration: 0
12612
- }).catch(function () {
12613
- return void 0;
12614
- });
12615
- }
12616
-
12617
- flicking.camera.updateOffset();
12618
- flicking.trigger(new ComponentEvent$1(EVENTS.PANEL_CHANGE, {
12619
- added: allPanelsInserted,
12620
- removed: []
12621
- }));
12622
- this.checkPanelContentsReady(allPanelsInserted);
12623
12649
  return allPanelsInserted;
12624
12650
  };
12625
12651
  /**
@@ -12636,6 +12662,25 @@ version: 4.5.1
12636
12662
 
12637
12663
 
12638
12664
  __proto.batchRemove = function () {
12665
+ var items = [];
12666
+
12667
+ for (var _i = 0; _i < arguments.length; _i++) {
12668
+ items[_i] = arguments[_i];
12669
+ }
12670
+
12671
+ var allPanelsRemoved = this.batchRemoveDefer.apply(this, __spread$1(items));
12672
+ if (allPanelsRemoved.length <= 0) return [];
12673
+ this.updateAfterPanelChange([], allPanelsRemoved);
12674
+ return allPanelsRemoved;
12675
+ };
12676
+ /**
12677
+ * Defers update
12678
+ * camera position & others will be updated after calling updateAfterPanelChange
12679
+ * @internal
12680
+ */
12681
+
12682
+
12683
+ __proto.batchRemoveDefer = function () {
12639
12684
  var _this = this;
12640
12685
 
12641
12686
  var items = [];
@@ -12646,10 +12691,8 @@ version: 4.5.1
12646
12691
 
12647
12692
  var panels = this._panels;
12648
12693
  var flicking = getFlickingAttached(this._flicking);
12649
- var camera = flicking.camera,
12650
- control = flicking.control;
12694
+ var control = flicking.control;
12651
12695
  var activePanel = control.activePanel;
12652
- var activeIndex = control.activeIndex;
12653
12696
  var allPanelsRemoved = items.reduce(function (removed, item) {
12654
12697
  var index = item.index,
12655
12698
  deleteCount = item.deleteCount;
@@ -12677,33 +12720,63 @@ version: 4.5.1
12677
12720
  }
12678
12721
 
12679
12722
  return __spread$1(removed, panelsRemoved);
12680
- }, []); // Update camera & control
12723
+ }, []);
12724
+ return allPanelsRemoved;
12725
+ };
12726
+ /**
12727
+ * @internal
12728
+ */
12729
+
12730
+
12731
+ __proto.updateAfterPanelChange = function (panelsAdded, panelsRemoved) {
12732
+ var _a;
12733
+
12734
+ var flicking = getFlickingAttached(this._flicking);
12735
+ var camera = flicking.camera,
12736
+ control = flicking.control;
12737
+ var panels = this._panels;
12738
+ var activePanel = control.activePanel; // Update camera & control
12681
12739
 
12682
12740
  this._updateCameraAndControl();
12683
12741
 
12684
- void this.render(); // FIXME: fix for animating case
12742
+ void this.render();
12743
+
12744
+ if (!flicking.animating) {
12745
+ if (!activePanel || activePanel.removed) {
12746
+ if (panels.length <= 0) {
12747
+ // All panels removed
12748
+ camera.lookAt(0);
12749
+ } else {
12750
+ var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
12685
12751
 
12686
- if (allPanelsRemoved.length > 0 && !control.animating) {
12687
- var targetPanel = includes(allPanelsRemoved, activePanel) ? panels[activeIndex] || panels[panels.length - 1] : activePanel;
12752
+ if (targetIndex > panels.length - 1) {
12753
+ targetIndex = panels.length - 1;
12754
+ }
12688
12755
 
12689
- if (targetPanel) {
12690
- void control.moveToPanel(targetPanel, {
12756
+ void control.moveToPanel(panels[targetIndex], {
12757
+ duration: 0
12758
+ }).catch(function () {
12759
+ return void 0;
12760
+ });
12761
+ }
12762
+ } else {
12763
+ void control.moveToPanel(activePanel, {
12691
12764
  duration: 0
12692
12765
  }).catch(function () {
12693
12766
  return void 0;
12694
12767
  });
12695
- } else {
12696
- // All panels removed
12697
- camera.lookAt(0);
12698
12768
  }
12699
12769
  }
12700
12770
 
12701
12771
  flicking.camera.updateOffset();
12702
- flicking.trigger(new ComponentEvent$1(EVENTS.PANEL_CHANGE, {
12703
- added: [],
12704
- removed: allPanelsRemoved
12705
- }));
12706
- return allPanelsRemoved;
12772
+
12773
+ if (panelsAdded.length > 0 || panelsRemoved.length > 0) {
12774
+ flicking.trigger(new ComponentEvent$1(EVENTS.PANEL_CHANGE, {
12775
+ added: panelsAdded,
12776
+ removed: panelsRemoved
12777
+ }));
12778
+ this.checkPanelContentsReady(__spread$1(panelsAdded, panelsRemoved));
12779
+ }
12707
12780
  };
12708
12781
  /**
12709
12782
  * @internal
@@ -12748,6 +12821,7 @@ version: 4.5.1
12748
12821
  });
12749
12822
  if (!flicking.initialized) return;
12750
12823
  camera.updateRange();
12824
+ camera.updateOffset();
12751
12825
  camera.updateAnchors();
12752
12826
 
12753
12827
  if (control.animating) ; else {
@@ -12781,6 +12855,7 @@ version: 4.5.1
12781
12855
  var camera = flicking.camera,
12782
12856
  control = flicking.control;
12783
12857
  camera.updateRange();
12858
+ camera.updateOffset();
12784
12859
  camera.updateAnchors();
12785
12860
  camera.resetNeedPanelHistory();
12786
12861
  control.updateInput();
@@ -14079,10 +14154,14 @@ version: 4.5.1
14079
14154
  autoResize = _4 === void 0 ? true : _4,
14080
14155
  _5 = _b.useResizeObserver,
14081
14156
  useResizeObserver = _5 === void 0 ? true : _5,
14082
- _6 = _b.externalRenderer,
14083
- externalRenderer = _6 === void 0 ? null : _6,
14084
- _7 = _b.renderExternal,
14085
- renderExternal = _7 === void 0 ? null : _7;
14157
+ _6 = _b.resizeDebounce,
14158
+ resizeDebounce = _6 === void 0 ? 0 : _6,
14159
+ _7 = _b.maxResizeDebounce,
14160
+ maxResizeDebounce = _7 === void 0 ? 100 : _7,
14161
+ _8 = _b.externalRenderer,
14162
+ externalRenderer = _8 === void 0 ? null : _8,
14163
+ _9 = _b.renderExternal,
14164
+ renderExternal = _9 === void 0 ? null : _9;
14086
14165
 
14087
14166
  var _this = _super.call(this) || this; // Internal states
14088
14167
 
@@ -14118,6 +14197,8 @@ version: 4.5.1
14118
14197
  _this._autoInit = autoInit;
14119
14198
  _this._autoResize = autoResize;
14120
14199
  _this._useResizeObserver = useResizeObserver;
14200
+ _this._resizeDebounce = resizeDebounce;
14201
+ _this._maxResizeDebounce = maxResizeDebounce;
14121
14202
  _this._externalRenderer = externalRenderer;
14122
14203
  _this._renderExternal = renderExternal; // Create core components
14123
14204
 
@@ -14966,6 +15047,38 @@ version: 4.5.1
14966
15047
  enumerable: false,
14967
15048
  configurable: true
14968
15049
  });
15050
+ Object.defineProperty(__proto, "resizeDebounce", {
15051
+ /**
15052
+ * Delays size recalculation from `autoResize` by the given time in milisecond.
15053
+ * If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
15054
+ * This can increase performance by preventing `resize` being called too often.
15055
+ * @ko `autoResize` 설정시에 호출되는 크기 재계산을 주어진 시간(단위: ms)만큼 지연시킵니다.
15056
+ * 지연시키는 도중 크기가 다시 변경되었을 경우, 이전 것을 취소하고 주어진 시간만큼 다시 지연시킵니다.
15057
+ * 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
15058
+ * @type {number}
15059
+ * @default 0
15060
+ */
15061
+ get: function () {
15062
+ return this._resizeDebounce;
15063
+ },
15064
+ enumerable: false,
15065
+ configurable: true
15066
+ });
15067
+ Object.defineProperty(__proto, "maxResizeDebounce", {
15068
+ /**
15069
+ * The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
15070
+ * This guarantees that size recalculation is performed at least once every (n)ms.
15071
+ * @ko `resizeDebounce` 사용시에 크기 재계산이 지연되는 최대 시간을 지정합니다. (단위: ms)
15072
+ * 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
15073
+ * @type {number}
15074
+ * @default 100
15075
+ */
15076
+ get: function () {
15077
+ return this._maxResizeDebounce;
15078
+ },
15079
+ enumerable: false,
15080
+ configurable: true
15081
+ });
14969
15082
  Object.defineProperty(__proto, "externalRenderer", {
14970
15083
  /**
14971
15084
  * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
@@ -15001,85 +15114,61 @@ version: 4.5.1
15001
15114
  * @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
15002
15115
  * 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
15003
15116
  * @fires Flicking#ready
15004
- * @return {this}
15117
+ * @return {Promise<void>}
15005
15118
  */
15006
15119
 
15007
15120
  __proto.init = function () {
15008
- return __awaiter(this, void 0, void 0, function () {
15009
- var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
15010
-
15011
- var _this = this;
15012
-
15013
- return __generator(this, function (_a) {
15014
- switch (_a.label) {
15015
- case 0:
15016
- if (this._initialized) return [2
15017
- /*return*/
15018
- ];
15019
- camera = this._camera;
15020
- renderer = this._renderer;
15021
- control = this._control;
15022
- virtualManager = this._virtualManager;
15023
- originalTrigger = this.trigger;
15024
- preventEventsBeforeInit = this._preventEventsBeforeInit;
15025
- camera.init(this);
15026
- virtualManager.init();
15027
- renderer.init(this);
15028
- control.init(this);
15029
-
15030
- if (preventEventsBeforeInit) {
15031
- this.trigger = function () {
15032
- return _this;
15033
- };
15034
- }
15035
-
15036
- return [4
15037
- /*yield*/
15038
- , this.resize()];
15039
-
15040
- case 1:
15041
- _a.sent(); // Look at initial panel
15042
-
15121
+ var _this = this;
15043
15122
 
15044
- return [4
15045
- /*yield*/
15046
- , this._moveToInitialPanel()];
15123
+ if (this._initialized) return Promise.resolve();
15124
+ var camera = this._camera;
15125
+ var renderer = this._renderer;
15126
+ var control = this._control;
15127
+ var virtualManager = this._virtualManager;
15128
+ var originalTrigger = this.trigger;
15129
+ var preventEventsBeforeInit = this._preventEventsBeforeInit;
15130
+ camera.init();
15131
+ virtualManager.init();
15132
+ renderer.init(this);
15133
+ control.init(this);
15134
+
15135
+ if (preventEventsBeforeInit) {
15136
+ this.trigger = function () {
15137
+ return _this;
15138
+ };
15139
+ }
15047
15140
 
15048
- case 2:
15049
- // Look at initial panel
15050
- _a.sent();
15141
+ this._initialResize(); // Look at initial panel
15051
15142
 
15052
- if (this._autoResize) {
15053
- this._autoResizer.enable();
15054
- }
15055
15143
 
15056
- if (this._preventClickOnDrag) {
15057
- control.controller.addPreventClickHandler();
15058
- }
15144
+ this._moveToInitialPanel();
15059
15145
 
15060
- if (this._disableOnInit) {
15061
- this.disableInput();
15062
- }
15146
+ if (this._autoResize) {
15147
+ this._autoResizer.enable();
15148
+ }
15063
15149
 
15064
- renderer.checkPanelContentsReady(renderer.panels);
15150
+ if (this._preventClickOnDrag) {
15151
+ control.controller.addPreventClickHandler();
15152
+ }
15065
15153
 
15066
- this._plugins.forEach(function (plugin) {
15067
- return plugin.init(_this);
15068
- }); // Done initializing & emit ready event
15154
+ if (this._disableOnInit) {
15155
+ this.disableInput();
15156
+ }
15069
15157
 
15158
+ renderer.checkPanelContentsReady(renderer.panels);
15159
+ return renderer.render().then(function () {
15160
+ // Done initializing & emit ready event
15161
+ _this._plugins.forEach(function (plugin) {
15162
+ return plugin.init(_this);
15163
+ });
15070
15164
 
15071
- this._initialized = true;
15165
+ _this._initialized = true;
15072
15166
 
15073
- if (preventEventsBeforeInit) {
15074
- this.trigger = originalTrigger;
15075
- }
15167
+ if (preventEventsBeforeInit) {
15168
+ _this.trigger = originalTrigger;
15169
+ }
15076
15170
 
15077
- this.trigger(new ComponentEvent$1(EVENTS.READY));
15078
- return [2
15079
- /*return*/
15080
- ];
15081
- }
15082
- });
15171
+ _this.trigger(new ComponentEvent$1(EVENTS.READY));
15083
15172
  });
15084
15173
  };
15085
15174
  /**
@@ -15697,7 +15786,7 @@ version: 4.5.1
15697
15786
  console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
15698
15787
  }
15699
15788
 
15700
- return new Camera$1({
15789
+ return new Camera$1(this, {
15701
15790
  align: this._align
15702
15791
  });
15703
15792
  };
@@ -15733,23 +15822,59 @@ version: 4.5.1
15733
15822
  };
15734
15823
 
15735
15824
  __proto._moveToInitialPanel = function () {
15736
- return __awaiter(this, void 0, void 0, function () {
15737
- var renderer, control, initialPanel;
15738
- return __generator(this, function (_a) {
15739
- renderer = this._renderer;
15740
- control = this._control;
15741
- initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
15742
- if (!initialPanel) return [2
15743
- /*return*/
15744
- ];
15745
- control.setActive(initialPanel, null, false);
15746
- return [2
15747
- /*return*/
15748
- , control.moveToPanel(initialPanel, {
15749
- duration: 0
15750
- })];
15751
- });
15752
- });
15825
+ var renderer = this._renderer;
15826
+ var control = this._control;
15827
+ var camera = this._camera;
15828
+ var initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
15829
+ if (!initialPanel) return;
15830
+ var nearestAnchor = camera.findNearestAnchor(initialPanel.position);
15831
+ control.setActive(initialPanel, null, false);
15832
+
15833
+ if (!nearestAnchor) {
15834
+ throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
15835
+ }
15836
+
15837
+ var position = initialPanel.position;
15838
+
15839
+ if (!camera.canReach(initialPanel)) {
15840
+ position = nearestAnchor.position;
15841
+ }
15842
+
15843
+ camera.lookAt(position);
15844
+ control.updateInput();
15845
+ camera.updateOffset();
15846
+ };
15847
+
15848
+ __proto._initialResize = function () {
15849
+ var viewport = this._viewport;
15850
+ var renderer = this._renderer;
15851
+ var camera = this._camera;
15852
+ var control = this._control;
15853
+ this.trigger(new ComponentEvent$1(EVENTS.BEFORE_RESIZE, {
15854
+ width: 0,
15855
+ height: 0,
15856
+ element: viewport.element
15857
+ }));
15858
+ viewport.resize();
15859
+ renderer.updatePanelSize();
15860
+ camera.updateAlignPos();
15861
+ camera.updateRange();
15862
+ camera.updateAnchors();
15863
+ camera.updateOffset();
15864
+ control.updateInput();
15865
+ var newWidth = viewport.width;
15866
+ var newHeight = viewport.height;
15867
+ var sizeChanged = newWidth !== 0 || newHeight !== 0;
15868
+ this.trigger(new ComponentEvent$1(EVENTS.AFTER_RESIZE, {
15869
+ width: viewport.width,
15870
+ height: viewport.height,
15871
+ prev: {
15872
+ width: 0,
15873
+ height: 0
15874
+ },
15875
+ sizeChanged: sizeChanged,
15876
+ element: viewport.element
15877
+ }));
15753
15878
  };
15754
15879
  /**
15755
15880
  * Version info string
@@ -15763,7 +15888,7 @@ version: 4.5.1
15763
15888
  */
15764
15889
 
15765
15890
 
15766
- Flicking.VERSION = "4.5.1";
15891
+ Flicking.VERSION = "4.6.2";
15767
15892
  return Flicking;
15768
15893
  }(Component$1);
15769
15894
 
@@ -15803,7 +15928,7 @@ version: 4.5.1
15803
15928
  var withFlickingMethods = function (prototype, flickingName) {
15804
15929
  [Component$1.prototype, Flicking.prototype].forEach(function (proto) {
15805
15930
  Object.getOwnPropertyNames(proto).filter(function (name) {
15806
- return !prototype[name] && !name.startsWith("_") && name !== "constructor";
15931
+ return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
15807
15932
  }).forEach(function (name) {
15808
15933
  var descriptor = Object.getOwnPropertyDescriptor(proto, name);
15809
15934
 
@@ -15860,6 +15985,9 @@ version: 4.5.1
15860
15985
 
15861
15986
  var prevList = __spread$1(diffResult.prevList);
15862
15987
 
15988
+ var added = [];
15989
+ var removed = [];
15990
+
15863
15991
  if (diffResult.removed.length > 0) {
15864
15992
  var endIdx_1 = -1;
15865
15993
  var prevIdx_1 = -1;
@@ -15869,7 +15997,7 @@ version: 4.5.1
15869
15997
  }
15870
15998
 
15871
15999
  if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
15872
- batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
16000
+ removed.push.apply(removed, __spread$1(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
15873
16001
  endIdx_1 = removedIdx;
15874
16002
  prevIdx_1 = removedIdx;
15875
16003
  } else {
@@ -15878,39 +16006,34 @@ version: 4.5.1
15878
16006
 
15879
16007
  prevList.splice(removedIdx, 1);
15880
16008
  });
15881
- batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
16009
+ removed.push.apply(removed, __spread$1(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
15882
16010
  }
15883
16011
 
15884
16012
  diffResult.ordered.forEach(function (_a) {
15885
16013
  var _b = __read$1(_a, 2),
15886
- prevIdx = _b[0],
15887
- newIdx = _b[1];
15888
-
15889
- var prevPanel = panels[prevIdx];
15890
- var indexDiff = newIdx - prevIdx;
15891
-
15892
- if (indexDiff > 0) {
15893
- var middlePanels = panels.slice(prevIdx + 1, newIdx + 1);
15894
- prevPanel.increaseIndex(indexDiff);
15895
- middlePanels.forEach(function (panel) {
15896
- return panel.decreaseIndex(1);
15897
- });
15898
- } else {
15899
- var middlePanels = panels.slice(newIdx, prevIdx);
15900
- prevPanel.decreaseIndex(-indexDiff);
15901
- middlePanels.forEach(function (panel) {
15902
- return panel.increaseIndex(1);
15903
- });
15904
- } // Update position
16014
+ from = _b[0],
16015
+ to = _b[1];
15905
16016
 
15906
-
15907
- prevPanel.resize();
16017
+ var prevPanel = panels.splice(from, 1)[0];
16018
+ panels.splice(to, 0, prevPanel);
15908
16019
  });
15909
16020
 
15910
16021
  if (diffResult.ordered.length > 0) {
16022
+ panels.forEach(function (panel, idx) {
16023
+ var indexDiff = idx - panel.index;
16024
+
16025
+ if (indexDiff > 0) {
16026
+ panel.increaseIndex(indexDiff);
16027
+ } else {
16028
+ panel.decreaseIndex(-indexDiff);
16029
+ }
16030
+ });
15911
16031
  panels.sort(function (panel1, panel2) {
15912
16032
  return panel1.index - panel2.index;
15913
16033
  });
16034
+ panels.forEach(function (panel) {
16035
+ panel.updatePosition();
16036
+ });
15914
16037
  }
15915
16038
 
15916
16039
  if (diffResult.added.length > 0) {
@@ -15923,7 +16046,7 @@ version: 4.5.1
15923
16046
  }
15924
16047
 
15925
16048
  if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
15926
- batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
16049
+ added.push.apply(added, __spread$1(batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1)));
15927
16050
  startIdx_1 = -1;
15928
16051
  prevIdx_2 = -1;
15929
16052
  } else {
@@ -15932,13 +16055,17 @@ version: 4.5.1
15932
16055
  });
15933
16056
 
15934
16057
  if (startIdx_1 >= 0) {
15935
- batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
16058
+ added.push.apply(added, __spread$1(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
15936
16059
  }
15937
16060
  }
16061
+
16062
+ if (diffResult.added.length > 0 || diffResult.removed.length > 0) {
16063
+ renderer.updateAfterPanelChange(added, removed);
16064
+ }
15938
16065
  });
15939
16066
 
15940
16067
  var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
15941
- renderer.batchInsert.apply(renderer, __spread$1(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
16068
+ return renderer.batchInsertDefer.apply(renderer, __spread$1(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
15942
16069
  return {
15943
16070
  index: index,
15944
16071
  elements: [addedElements[elIdx]],
@@ -15949,7 +16076,7 @@ version: 4.5.1
15949
16076
 
15950
16077
  var batchRemove = function (renderer, startIdx, endIdx) {
15951
16078
  var removed = renderer.panels.slice(startIdx, endIdx);
15952
- renderer.batchRemove({
16079
+ return renderer.batchRemoveDefer({
15953
16080
  index: startIdx,
15954
16081
  deleteCount: removed.length,
15955
16082
  hasDOMInElements: false