@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
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.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(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
@@ -1014,6 +1014,33 @@ version: 4.5.1
1014
1014
  var _this = this;
1015
1015
 
1016
1016
  this._onResize = function () {
1017
+ var flicking = _this._flicking;
1018
+ var resizeDebounce = flicking.resizeDebounce;
1019
+ var maxResizeDebounce = flicking.maxResizeDebounce;
1020
+
1021
+ if (resizeDebounce <= 0) {
1022
+ void flicking.resize();
1023
+ } else {
1024
+ if (_this._maxResizeDebounceTimer <= 0) {
1025
+ if (maxResizeDebounce > 0 && maxResizeDebounce >= resizeDebounce) {
1026
+ _this._maxResizeDebounceTimer = window.setTimeout(_this._doScheduledResize, maxResizeDebounce);
1027
+ }
1028
+ }
1029
+
1030
+ if (_this._resizeTimer > 0) {
1031
+ clearTimeout(_this._resizeTimer);
1032
+ _this._resizeTimer = 0;
1033
+ }
1034
+
1035
+ _this._resizeTimer = window.setTimeout(_this._doScheduledResize, resizeDebounce);
1036
+ }
1037
+ };
1038
+
1039
+ this._doScheduledResize = function () {
1040
+ clearTimeout(_this._resizeTimer);
1041
+ clearTimeout(_this._maxResizeDebounceTimer);
1042
+ _this._maxResizeDebounceTimer = -1;
1043
+ _this._resizeTimer = -1;
1017
1044
  void _this._flicking.resize();
1018
1045
  }; // eslint-disable-next-line @typescript-eslint/member-ordering
1019
1046
 
@@ -1033,6 +1060,8 @@ version: 4.5.1
1033
1060
  this._flicking = flicking;
1034
1061
  this._enabled = false;
1035
1062
  this._resizeObserver = null;
1063
+ this._resizeTimer = -1;
1064
+ this._maxResizeDebounceTimer = -1;
1036
1065
  }
1037
1066
 
1038
1067
  var __proto = AutoResizer.prototype;
@@ -1884,6 +1913,8 @@ version: 4.5.1
1884
1913
  };
1885
1914
 
1886
1915
  __proto.onRelease = function (ctx) {
1916
+ var _a;
1917
+
1887
1918
  var flicking = ctx.flicking,
1888
1919
  axesEvent = ctx.axesEvent,
1889
1920
  transitTo = ctx.transitTo; // Update last position to cope with Axes's animating behavior
@@ -1903,7 +1934,13 @@ version: 4.5.1
1903
1934
  var control = flicking.control;
1904
1935
  var position = axesEvent.destPos[POSITION_KEY];
1905
1936
  var duration = Math.max(axesEvent.duration, flicking.duration);
1906
- void control.moveToPosition(position, duration, axesEvent);
1937
+
1938
+ try {
1939
+ void control.moveToPosition(position, duration, axesEvent);
1940
+ } catch (err) {
1941
+ transitTo(STATE_TYPE.IDLE);
1942
+ axesEvent.setTo((_a = {}, _a[POSITION_KEY] = flicking.camera.position, _a), 0);
1943
+ }
1907
1944
  };
1908
1945
 
1909
1946
  return DraggingState;
@@ -1979,7 +2016,11 @@ version: 4.5.1
1979
2016
  direction: getDirection(animatingContext.start, animatingContext.end),
1980
2017
  axesEvent: axesEvent
1981
2018
  }));
1982
- control.setActive(this._targetPanel, control.activePanel, axesEvent.isTrusted);
2019
+ var targetPanel = this._targetPanel;
2020
+
2021
+ if (targetPanel) {
2022
+ control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
2023
+ }
1983
2024
  };
1984
2025
 
1985
2026
  return AnimatingState;
@@ -2734,7 +2775,7 @@ version: 4.5.1
2734
2775
  */
2735
2776
 
2736
2777
 
2737
- __proto.updatePosition = function (_progressInPanel) {
2778
+ __proto.updatePosition = function (progressInPanel) {
2738
2779
  var flicking = getFlickingAttached(this._flicking);
2739
2780
  var camera = flicking.camera;
2740
2781
  var activePanel = this._activePanel;
@@ -3110,48 +3151,41 @@ version: 4.5.1
3110
3151
  */
3111
3152
 
3112
3153
  __proto.moveToPosition = function (position, duration, axesEvent) {
3113
- return __awaiter(this, void 0, void 0, function () {
3114
- var flicking, camera, activeAnchor, anchorAtCamera, state, snapThreshold, posDelta, absPosDelta, snapDelta, targetAnchor;
3115
- return __generator(this, function (_a) {
3116
- flicking = getFlickingAttached(this._flicking);
3117
- camera = flicking.camera;
3118
- activeAnchor = camera.findActiveAnchor();
3119
- anchorAtCamera = camera.findNearestAnchor(camera.position);
3120
- state = flicking.control.controller.state;
3154
+ var flicking = getFlickingAttached(this._flicking);
3155
+ var camera = flicking.camera;
3156
+ var activeAnchor = camera.findActiveAnchor();
3157
+ var anchorAtCamera = camera.findNearestAnchor(camera.position);
3158
+ var state = flicking.control.controller.state;
3121
3159
 
3122
- if (!activeAnchor || !anchorAtCamera) {
3123
- return [2
3124
- /*return*/
3125
- , Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
3126
- }
3160
+ if (!activeAnchor || !anchorAtCamera) {
3161
+ return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
3162
+ }
3127
3163
 
3128
- snapThreshold = this._calcSnapThreshold(position, activeAnchor);
3129
- posDelta = flicking.animating ? state.delta : position - camera.position;
3130
- absPosDelta = Math.abs(posDelta);
3131
- snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
3132
-
3133
- if (snapDelta >= snapThreshold && snapDelta > 0) {
3134
- // Move to anchor at position
3135
- targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
3136
- } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
3137
- // Move to the adjacent panel
3138
- targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
3139
- } else {
3140
- // Restore to active panel
3141
- targetAnchor = anchorAtCamera;
3142
- }
3164
+ var snapThreshold = this._calcSnapThreshold(position, activeAnchor);
3143
3165
 
3144
- this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
3166
+ var posDelta = flicking.animating ? state.delta : position - camera.position;
3167
+ var absPosDelta = Math.abs(posDelta);
3168
+ var snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
3169
+ var targetAnchor;
3145
3170
 
3146
- return [2
3147
- /*return*/
3148
- , this._animateToPosition({
3149
- position: camera.clampToReachablePosition(targetAnchor.position),
3150
- duration: duration,
3151
- newActivePanel: targetAnchor.panel,
3152
- axesEvent: axesEvent
3153
- })];
3154
- });
3171
+ if (snapDelta >= snapThreshold && snapDelta > 0) {
3172
+ // Move to anchor at position
3173
+ targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
3174
+ } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
3175
+ // Move to the adjacent panel
3176
+ targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
3177
+ } else {
3178
+ // Restore to active panel
3179
+ targetAnchor = anchorAtCamera;
3180
+ }
3181
+
3182
+ this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
3183
+
3184
+ return this._animateToPosition({
3185
+ position: camera.clampToReachablePosition(targetAnchor.position),
3186
+ duration: duration,
3187
+ newActivePanel: targetAnchor.panel,
3188
+ axesEvent: axesEvent
3155
3189
  });
3156
3190
  };
3157
3191
 
@@ -3340,35 +3374,26 @@ version: 4.5.1
3340
3374
 
3341
3375
 
3342
3376
  __proto.moveToPosition = function (position, duration, axesEvent) {
3343
- return __awaiter(this, void 0, void 0, function () {
3344
- var flicking, camera, targetPos, anchorAtPosition, targetPanel;
3345
- return __generator(this, function (_a) {
3346
- flicking = getFlickingAttached(this._flicking);
3347
- camera = flicking.camera;
3348
- targetPos = camera.clampToReachablePosition(position);
3349
- anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
3377
+ var flicking = getFlickingAttached(this._flicking);
3378
+ var camera = flicking.camera;
3379
+ var targetPos = camera.clampToReachablePosition(position);
3380
+ var anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
3350
3381
 
3351
- if (!anchorAtPosition) {
3352
- return [2
3353
- /*return*/
3354
- , Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
3355
- }
3382
+ if (!anchorAtPosition) {
3383
+ return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
3384
+ }
3356
3385
 
3357
- targetPanel = anchorAtPosition.panel; // Trigger only change event
3386
+ var targetPanel = anchorAtPosition.panel; // Trigger only change event
3358
3387
 
3359
- if (targetPanel !== this._activePanel) {
3360
- this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
3361
- }
3388
+ if (targetPanel !== this._activePanel) {
3389
+ this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
3390
+ }
3362
3391
 
3363
- return [2
3364
- /*return*/
3365
- , this._animateToPosition({
3366
- position: this._stopAtEdge ? targetPos : position,
3367
- duration: duration,
3368
- newActivePanel: targetPanel,
3369
- axesEvent: axesEvent
3370
- })];
3371
- });
3392
+ return this._animateToPosition({
3393
+ position: this._stopAtEdge ? targetPos : position,
3394
+ duration: duration,
3395
+ newActivePanel: targetPanel,
3396
+ axesEvent: axesEvent
3372
3397
  });
3373
3398
  };
3374
3399
 
@@ -3566,62 +3591,56 @@ version: 4.5.1
3566
3591
 
3567
3592
 
3568
3593
  __proto.moveToPosition = function (position, duration, axesEvent) {
3569
- return __awaiter(this, void 0, void 0, function () {
3570
- var flicking, camera, activePanel, axesRange, indexRange, cameraRange, clampedPosition, anchorAtPosition, prevPos, isOverThreshold, adjacentAnchor, targetPos, targetPanel, anchors, firstAnchor, lastAnchor, shouldBounceToFirst, shouldBounceToLast, targetAnchor;
3571
- return __generator(this, function (_a) {
3572
- flicking = getFlickingAttached(this._flicking);
3573
- camera = flicking.camera;
3574
- activePanel = this._activePanel;
3575
- axesRange = this._controller.range;
3576
- indexRange = this._indexRange;
3577
- cameraRange = camera.range;
3578
- clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
3579
- anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
3580
-
3581
- if (!anchorAtPosition || !activePanel) {
3582
- return [2
3583
- /*return*/
3584
- , Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
3585
- }
3594
+ var flicking = getFlickingAttached(this._flicking);
3595
+ var camera = flicking.camera;
3596
+ var activePanel = this._activePanel;
3597
+ var axesRange = this._controller.range;
3598
+ var indexRange = this._indexRange;
3599
+ var cameraRange = camera.range;
3600
+ var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
3601
+ var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
3586
3602
 
3587
- prevPos = activePanel.position;
3588
- isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
3589
- adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
3590
- anchors = camera.anchorPoints;
3591
- firstAnchor = anchors[0];
3592
- lastAnchor = anchors[anchors.length - 1];
3593
- shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
3594
- shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
3595
-
3596
- if (shouldBounceToFirst || shouldBounceToLast) {
3597
- targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
3598
- targetPanel = targetAnchor.panel;
3599
- targetPos = targetAnchor.position;
3600
- } else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
3601
- // Move to anchor at position
3602
- targetPanel = anchorAtPosition.panel;
3603
- targetPos = anchorAtPosition.position;
3604
- } else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
3605
- // Move to adjacent anchor
3606
- targetPanel = adjacentAnchor.panel;
3607
- targetPos = adjacentAnchor.position;
3608
- } else {
3609
- // Restore to active panel
3610
- targetPos = camera.clampToReachablePosition(activePanel.position);
3611
- targetPanel = activePanel;
3612
- }
3603
+ if (!anchorAtPosition || !activePanel) {
3604
+ return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
3605
+ }
3606
+
3607
+ var prevPos = activePanel.position;
3608
+ var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
3609
+ var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
3610
+ var targetPos;
3611
+ var targetPanel;
3612
+ var anchors = camera.anchorPoints;
3613
+ var firstAnchor = anchors[0];
3614
+ var lastAnchor = anchors[anchors.length - 1];
3615
+ var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
3616
+ var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
3617
+
3618
+ if (shouldBounceToFirst || shouldBounceToLast) {
3619
+ // In bounce area
3620
+ var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
3621
+ targetPanel = targetAnchor.panel;
3622
+ targetPos = targetAnchor.position;
3623
+ } else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
3624
+ // Move to anchor at position
3625
+ targetPanel = anchorAtPosition.panel;
3626
+ targetPos = anchorAtPosition.position;
3627
+ } else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
3628
+ // Move to adjacent anchor
3629
+ targetPanel = adjacentAnchor.panel;
3630
+ targetPos = adjacentAnchor.position;
3631
+ } else {
3632
+ // Restore to active panel
3633
+ targetPos = camera.clampToReachablePosition(activePanel.position);
3634
+ targetPanel = activePanel;
3635
+ }
3613
3636
 
3614
- this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
3637
+ this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
3615
3638
 
3616
- return [2
3617
- /*return*/
3618
- , this._animateToPosition({
3619
- position: targetPos,
3620
- duration: duration,
3621
- newActivePanel: targetPanel,
3622
- axesEvent: axesEvent
3623
- })];
3624
- });
3639
+ return this._animateToPosition({
3640
+ position: targetPos,
3641
+ duration: duration,
3642
+ newActivePanel: targetPanel,
3643
+ axesEvent: axesEvent
3625
3644
  });
3626
3645
  };
3627
3646
 
@@ -4104,7 +4123,7 @@ version: 4.5.1
4104
4123
  /*#__PURE__*/
4105
4124
  function () {
4106
4125
  /** */
4107
- function Camera(_a) {
4126
+ function Camera(flicking, _a) {
4108
4127
  var _this = this;
4109
4128
 
4110
4129
  var _b = (_a === void 0 ? {} : _a).align,
@@ -4144,7 +4163,7 @@ version: 4.5.1
4144
4163
  _this._transform = transformName;
4145
4164
  };
4146
4165
 
4147
- this._flicking = null;
4166
+ this._flicking = flicking;
4148
4167
 
4149
4168
  this._resetInternalValues(); // Options
4150
4169
 
@@ -4439,17 +4458,14 @@ version: 4.5.1
4439
4458
  /**
4440
4459
  * Initialize Camera
4441
4460
  * @ko Camera를 초기화합니다
4442
- * @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
4443
- * @chainable
4444
4461
  * @throws {FlickingError}
4445
4462
  * {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
4446
4463
  * <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
4447
4464
  * @return {this}
4448
4465
  */
4449
4466
 
4450
- __proto.init = function (flicking) {
4451
- this._flicking = flicking;
4452
- var viewportEl = flicking.viewport.element;
4467
+ __proto.init = function () {
4468
+ var viewportEl = this._flicking.viewport.element;
4453
4469
  checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
4454
4470
  this._el = viewportEl.firstElementChild;
4455
4471
 
@@ -4467,8 +4483,6 @@ version: 4.5.1
4467
4483
 
4468
4484
 
4469
4485
  __proto.destroy = function () {
4470
- this._flicking = null;
4471
-
4472
4486
  this._resetInternalValues();
4473
4487
 
4474
4488
  return this;
@@ -4499,12 +4513,12 @@ version: 4.5.1
4499
4513
 
4500
4514
  this._checkReachEnd(prevPos, pos);
4501
4515
 
4502
- this.applyTransform();
4503
-
4504
4516
  if (toggled) {
4505
4517
  void flicking.renderer.render().then(function () {
4506
4518
  _this.updateOffset();
4507
4519
  });
4520
+ } else {
4521
+ this.applyTransform();
4508
4522
  }
4509
4523
  };
4510
4524
  /**
@@ -4691,7 +4705,6 @@ version: 4.5.1
4691
4705
  });
4692
4706
  }
4693
4707
 
4694
- this.updateOffset();
4695
4708
  return this;
4696
4709
  };
4697
4710
  /**
@@ -4783,7 +4796,6 @@ version: 4.5.1
4783
4796
  /**
4784
4797
  * Apply "transform" style with the current position to camera element
4785
4798
  * @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
4786
- * @chainable
4787
4799
  * @return {this}
4788
4800
  */
4789
4801
 
@@ -4791,6 +4803,8 @@ version: 4.5.1
4791
4803
  __proto.applyTransform = function () {
4792
4804
  var el = this._el;
4793
4805
  var flicking = getFlickingAttached(this._flicking);
4806
+ var renderer = flicking.renderer;
4807
+ if (renderer.rendering) return this;
4794
4808
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
4795
4809
  el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4796
4810
  return this;
@@ -4976,7 +4990,8 @@ version: 4.5.1
4976
4990
  align = _b === void 0 ? ALIGN.CENTER : _b,
4977
4991
  strategy = _a.strategy;
4978
4992
  this._flicking = null;
4979
- this._panels = []; // Bind options
4993
+ this._panels = [];
4994
+ this._rendering = false; // Bind options
4980
4995
 
4981
4996
  this._align = align;
4982
4997
  this._strategy = strategy;
@@ -4999,6 +5014,20 @@ version: 4.5.1
4999
5014
  enumerable: false,
5000
5015
  configurable: true
5001
5016
  });
5017
+ Object.defineProperty(__proto, "rendering", {
5018
+ /**
5019
+ * A boolean value indicating whether rendering is in progress
5020
+ * @ko 현재 렌더링이 시작되어 끝나기 전까지의 상태인지의 여부
5021
+ * @type {boolean}
5022
+ * @readonly
5023
+ * @internal
5024
+ */
5025
+ get: function () {
5026
+ return this._rendering;
5027
+ },
5028
+ enumerable: false,
5029
+ configurable: true
5030
+ });
5002
5031
  Object.defineProperty(__proto, "panelCount", {
5003
5032
  /**
5004
5033
  * Count of panels
@@ -5130,6 +5159,25 @@ version: 4.5.1
5130
5159
 
5131
5160
 
5132
5161
  __proto.batchInsert = function () {
5162
+ var items = [];
5163
+
5164
+ for (var _i = 0; _i < arguments.length; _i++) {
5165
+ items[_i] = arguments[_i];
5166
+ }
5167
+
5168
+ var allPanelsInserted = this.batchInsertDefer.apply(this, __spread(items));
5169
+ if (allPanelsInserted.length <= 0) return [];
5170
+ this.updateAfterPanelChange(allPanelsInserted, []);
5171
+ return allPanelsInserted;
5172
+ };
5173
+ /**
5174
+ * Defers update
5175
+ * camera position & others will be updated after calling updateAfterPanelChange
5176
+ * @internal
5177
+ */
5178
+
5179
+
5180
+ __proto.batchInsertDefer = function () {
5133
5181
  var _this = this;
5134
5182
 
5135
5183
  var items = [];
@@ -5140,7 +5188,6 @@ version: 4.5.1
5140
5188
 
5141
5189
  var panels = this._panels;
5142
5190
  var flicking = getFlickingAttached(this._flicking);
5143
- var control = flicking.control;
5144
5191
  var prevFirstPanel = panels[0];
5145
5192
  var align = parsePanelAlign(this._align);
5146
5193
  var allPanelsInserted = items.reduce(function (addedPanels, item) {
@@ -5180,27 +5227,6 @@ version: 4.5.1
5180
5227
  });
5181
5228
  return __spread(addedPanels, panelsInserted);
5182
5229
  }, []);
5183
- if (allPanelsInserted.length <= 0) return []; // Update camera & control
5184
-
5185
- this._updateCameraAndControl();
5186
-
5187
- void this.render(); // Move to the first panel added if no panels existed
5188
- // FIXME: fix for animating case
5189
-
5190
- if (allPanelsInserted.length > 0 && !control.animating) {
5191
- void control.moveToPanel(control.activePanel || allPanelsInserted[0], {
5192
- duration: 0
5193
- }).catch(function () {
5194
- return void 0;
5195
- });
5196
- }
5197
-
5198
- flicking.camera.updateOffset();
5199
- flicking.trigger(new Component.ComponentEvent(EVENTS.PANEL_CHANGE, {
5200
- added: allPanelsInserted,
5201
- removed: []
5202
- }));
5203
- this.checkPanelContentsReady(allPanelsInserted);
5204
5230
  return allPanelsInserted;
5205
5231
  };
5206
5232
  /**
@@ -5217,6 +5243,25 @@ version: 4.5.1
5217
5243
 
5218
5244
 
5219
5245
  __proto.batchRemove = function () {
5246
+ var items = [];
5247
+
5248
+ for (var _i = 0; _i < arguments.length; _i++) {
5249
+ items[_i] = arguments[_i];
5250
+ }
5251
+
5252
+ var allPanelsRemoved = this.batchRemoveDefer.apply(this, __spread(items));
5253
+ if (allPanelsRemoved.length <= 0) return [];
5254
+ this.updateAfterPanelChange([], allPanelsRemoved);
5255
+ return allPanelsRemoved;
5256
+ };
5257
+ /**
5258
+ * Defers update
5259
+ * camera position & others will be updated after calling updateAfterPanelChange
5260
+ * @internal
5261
+ */
5262
+
5263
+
5264
+ __proto.batchRemoveDefer = function () {
5220
5265
  var _this = this;
5221
5266
 
5222
5267
  var items = [];
@@ -5227,10 +5272,8 @@ version: 4.5.1
5227
5272
 
5228
5273
  var panels = this._panels;
5229
5274
  var flicking = getFlickingAttached(this._flicking);
5230
- var camera = flicking.camera,
5231
- control = flicking.control;
5275
+ var control = flicking.control;
5232
5276
  var activePanel = control.activePanel;
5233
- var activeIndex = control.activeIndex;
5234
5277
  var allPanelsRemoved = items.reduce(function (removed, item) {
5235
5278
  var index = item.index,
5236
5279
  deleteCount = item.deleteCount;
@@ -5258,33 +5301,63 @@ version: 4.5.1
5258
5301
  }
5259
5302
 
5260
5303
  return __spread(removed, panelsRemoved);
5261
- }, []); // Update camera & control
5304
+ }, []);
5305
+ return allPanelsRemoved;
5306
+ };
5307
+ /**
5308
+ * @internal
5309
+ */
5310
+
5311
+
5312
+ __proto.updateAfterPanelChange = function (panelsAdded, panelsRemoved) {
5313
+ var _a;
5314
+
5315
+ var flicking = getFlickingAttached(this._flicking);
5316
+ var camera = flicking.camera,
5317
+ control = flicking.control;
5318
+ var panels = this._panels;
5319
+ var activePanel = control.activePanel; // Update camera & control
5262
5320
 
5263
5321
  this._updateCameraAndControl();
5264
5322
 
5265
- void this.render(); // FIXME: fix for animating case
5323
+ void this.render();
5324
+
5325
+ if (!flicking.animating) {
5326
+ if (!activePanel || activePanel.removed) {
5327
+ if (panels.length <= 0) {
5328
+ // All panels removed
5329
+ camera.lookAt(0);
5330
+ } else {
5331
+ var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
5266
5332
 
5267
- if (allPanelsRemoved.length > 0 && !control.animating) {
5268
- var targetPanel = includes(allPanelsRemoved, activePanel) ? panels[activeIndex] || panels[panels.length - 1] : activePanel;
5333
+ if (targetIndex > panels.length - 1) {
5334
+ targetIndex = panels.length - 1;
5335
+ }
5269
5336
 
5270
- if (targetPanel) {
5271
- void control.moveToPanel(targetPanel, {
5337
+ void control.moveToPanel(panels[targetIndex], {
5338
+ duration: 0
5339
+ }).catch(function () {
5340
+ return void 0;
5341
+ });
5342
+ }
5343
+ } else {
5344
+ void control.moveToPanel(activePanel, {
5272
5345
  duration: 0
5273
5346
  }).catch(function () {
5274
5347
  return void 0;
5275
5348
  });
5276
- } else {
5277
- // All panels removed
5278
- camera.lookAt(0);
5279
5349
  }
5280
5350
  }
5281
5351
 
5282
5352
  flicking.camera.updateOffset();
5283
- flicking.trigger(new Component.ComponentEvent(EVENTS.PANEL_CHANGE, {
5284
- added: [],
5285
- removed: allPanelsRemoved
5286
- }));
5287
- return allPanelsRemoved;
5353
+
5354
+ if (panelsAdded.length > 0 || panelsRemoved.length > 0) {
5355
+ flicking.trigger(new Component.ComponentEvent(EVENTS.PANEL_CHANGE, {
5356
+ added: panelsAdded,
5357
+ removed: panelsRemoved
5358
+ }));
5359
+ this.checkPanelContentsReady(__spread(panelsAdded, panelsRemoved));
5360
+ }
5288
5361
  };
5289
5362
  /**
5290
5363
  * @internal
@@ -5329,6 +5402,7 @@ version: 4.5.1
5329
5402
  });
5330
5403
  if (!flicking.initialized) return;
5331
5404
  camera.updateRange();
5405
+ camera.updateOffset();
5332
5406
  camera.updateAnchors();
5333
5407
 
5334
5408
  if (control.animating) ; else {
@@ -5362,6 +5436,7 @@ version: 4.5.1
5362
5436
  var camera = flicking.camera,
5363
5437
  control = flicking.control;
5364
5438
  camera.updateRange();
5439
+ camera.updateOffset();
5365
5440
  camera.updateAnchors();
5366
5441
  camera.resetNeedPanelHistory();
5367
5442
  control.updateInput();
@@ -6660,10 +6735,14 @@ version: 4.5.1
6660
6735
  autoResize = _4 === void 0 ? true : _4,
6661
6736
  _5 = _b.useResizeObserver,
6662
6737
  useResizeObserver = _5 === void 0 ? true : _5,
6663
- _6 = _b.externalRenderer,
6664
- externalRenderer = _6 === void 0 ? null : _6,
6665
- _7 = _b.renderExternal,
6666
- renderExternal = _7 === void 0 ? null : _7;
6738
+ _6 = _b.resizeDebounce,
6739
+ resizeDebounce = _6 === void 0 ? 0 : _6,
6740
+ _7 = _b.maxResizeDebounce,
6741
+ maxResizeDebounce = _7 === void 0 ? 100 : _7,
6742
+ _8 = _b.externalRenderer,
6743
+ externalRenderer = _8 === void 0 ? null : _8,
6744
+ _9 = _b.renderExternal,
6745
+ renderExternal = _9 === void 0 ? null : _9;
6667
6746
 
6668
6747
  var _this = _super.call(this) || this; // Internal states
6669
6748
 
@@ -6699,6 +6778,8 @@ version: 4.5.1
6699
6778
  _this._autoInit = autoInit;
6700
6779
  _this._autoResize = autoResize;
6701
6780
  _this._useResizeObserver = useResizeObserver;
6781
+ _this._resizeDebounce = resizeDebounce;
6782
+ _this._maxResizeDebounce = maxResizeDebounce;
6702
6783
  _this._externalRenderer = externalRenderer;
6703
6784
  _this._renderExternal = renderExternal; // Create core components
6704
6785
 
@@ -7547,6 +7628,38 @@ version: 4.5.1
7547
7628
  enumerable: false,
7548
7629
  configurable: true
7549
7630
  });
7631
+ Object.defineProperty(__proto, "resizeDebounce", {
7632
+ /**
7633
+ * Delays size recalculation from `autoResize` by the given time in milisecond.
7634
+ * If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
7635
+ * This can increase performance by preventing `resize` being called too often.
7636
+ * @ko `autoResize` 설정시에 호출되는 크기 재계산을 주어진 시간(단위: ms)만큼 지연시킵니다.
7637
+ * 지연시키는 도중 크기가 다시 변경되었을 경우, 이전 것을 취소하고 주어진 시간만큼 다시 지연시킵니다.
7638
+ * 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
7639
+ * @type {number}
7640
+ * @default 0
7641
+ */
7642
+ get: function () {
7643
+ return this._resizeDebounce;
7644
+ },
7645
+ enumerable: false,
7646
+ configurable: true
7647
+ });
7648
+ Object.defineProperty(__proto, "maxResizeDebounce", {
7649
+ /**
7650
+ * The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
7651
+ * This guarantees that size recalculation is performed at least once every (n)ms.
7652
+ * @ko `resizeDebounce` 사용시에 크기 재계산이 지연되는 최대 시간을 지정합니다. (단위: ms)
7653
+ * 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
7654
+ * @type {number}
7655
+ * @default 100
7656
+ */
7657
+ get: function () {
7658
+ return this._maxResizeDebounce;
7659
+ },
7660
+ enumerable: false,
7661
+ configurable: true
7662
+ });
7550
7663
  Object.defineProperty(__proto, "externalRenderer", {
7551
7664
  /**
7552
7665
  * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
@@ -7582,85 +7695,61 @@ version: 4.5.1
7582
7695
  * @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
7583
7696
  * 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
7584
7697
  * @fires Flicking#ready
7585
- * @return {this}
7698
+ * @return {Promise<void>}
7586
7699
  */
7587
7700
 
7588
7701
  __proto.init = function () {
7589
- return __awaiter(this, void 0, void 0, function () {
7590
- var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
7591
-
7592
- var _this = this;
7593
-
7594
- return __generator(this, function (_a) {
7595
- switch (_a.label) {
7596
- case 0:
7597
- if (this._initialized) return [2
7598
- /*return*/
7599
- ];
7600
- camera = this._camera;
7601
- renderer = this._renderer;
7602
- control = this._control;
7603
- virtualManager = this._virtualManager;
7604
- originalTrigger = this.trigger;
7605
- preventEventsBeforeInit = this._preventEventsBeforeInit;
7606
- camera.init(this);
7607
- virtualManager.init();
7608
- renderer.init(this);
7609
- control.init(this);
7610
-
7611
- if (preventEventsBeforeInit) {
7612
- this.trigger = function () {
7613
- return _this;
7614
- };
7615
- }
7616
-
7617
- return [4
7618
- /*yield*/
7619
- , this.resize()];
7620
-
7621
- case 1:
7622
- _a.sent(); // Look at initial panel
7623
-
7702
+ var _this = this;
7624
7703
 
7625
- return [4
7626
- /*yield*/
7627
- , this._moveToInitialPanel()];
7704
+ if (this._initialized) return Promise.resolve();
7705
+ var camera = this._camera;
7706
+ var renderer = this._renderer;
7707
+ var control = this._control;
7708
+ var virtualManager = this._virtualManager;
7709
+ var originalTrigger = this.trigger;
7710
+ var preventEventsBeforeInit = this._preventEventsBeforeInit;
7711
+ camera.init();
7712
+ virtualManager.init();
7713
+ renderer.init(this);
7714
+ control.init(this);
7715
+
7716
+ if (preventEventsBeforeInit) {
7717
+ this.trigger = function () {
7718
+ return _this;
7719
+ };
7720
+ }
7628
7721
 
7629
- case 2:
7630
- // Look at initial panel
7631
- _a.sent();
7722
+ this._initialResize(); // Look at initial panel
7632
7723
 
7633
- if (this._autoResize) {
7634
- this._autoResizer.enable();
7635
- }
7636
7724
 
7637
- if (this._preventClickOnDrag) {
7638
- control.controller.addPreventClickHandler();
7639
- }
7725
+ this._moveToInitialPanel();
7640
7726
 
7641
- if (this._disableOnInit) {
7642
- this.disableInput();
7643
- }
7727
+ if (this._autoResize) {
7728
+ this._autoResizer.enable();
7729
+ }
7644
7730
 
7645
- renderer.checkPanelContentsReady(renderer.panels);
7731
+ if (this._preventClickOnDrag) {
7732
+ control.controller.addPreventClickHandler();
7733
+ }
7646
7734
 
7647
- this._plugins.forEach(function (plugin) {
7648
- return plugin.init(_this);
7649
- }); // Done initializing & emit ready event
7735
+ if (this._disableOnInit) {
7736
+ this.disableInput();
7737
+ }
7650
7738
 
7739
+ renderer.checkPanelContentsReady(renderer.panels);
7740
+ return renderer.render().then(function () {
7741
+ // Done initializing & emit ready event
7742
+ _this._plugins.forEach(function (plugin) {
7743
+ return plugin.init(_this);
7744
+ });
7651
7745
 
7652
- this._initialized = true;
7746
+ _this._initialized = true;
7653
7747
 
7654
- if (preventEventsBeforeInit) {
7655
- this.trigger = originalTrigger;
7656
- }
7748
+ if (preventEventsBeforeInit) {
7749
+ _this.trigger = originalTrigger;
7750
+ }
7657
7751
 
7658
- this.trigger(new Component.ComponentEvent(EVENTS.READY));
7659
- return [2
7660
- /*return*/
7661
- ];
7662
- }
7663
- });
7752
+ _this.trigger(new Component.ComponentEvent(EVENTS.READY));
7664
7753
  });
7665
7754
  };
7666
7755
  /**
@@ -8278,7 +8367,7 @@ version: 4.5.1
8278
8367
  console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
8279
8368
  }
8280
8369
 
8281
- return new Camera$1({
8370
+ return new Camera$1(this, {
8282
8371
  align: this._align
8283
8372
  });
8284
8373
  };
@@ -8314,23 +8403,59 @@ version: 4.5.1
8314
8403
  };
8315
8404
 
8316
8405
  __proto._moveToInitialPanel = function () {
8317
- return __awaiter(this, void 0, void 0, function () {
8318
- var renderer, control, initialPanel;
8319
- return __generator(this, function (_a) {
8320
- renderer = this._renderer;
8321
- control = this._control;
8322
- initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
8323
- if (!initialPanel) return [2
8324
- /*return*/
8325
- ];
8326
- control.setActive(initialPanel, null, false);
8327
- return [2
8328
- /*return*/
8329
- , control.moveToPanel(initialPanel, {
8330
- duration: 0
8331
- })];
8332
- });
8333
- });
8406
+ var renderer = this._renderer;
8407
+ var control = this._control;
8408
+ var camera = this._camera;
8409
+ var initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
8410
+ if (!initialPanel) return;
8411
+ var nearestAnchor = camera.findNearestAnchor(initialPanel.position);
8412
+ control.setActive(initialPanel, null, false);
8413
+
8414
+ if (!nearestAnchor) {
8415
+ throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
8416
+ }
8417
+
8418
+ var position = initialPanel.position;
8419
+
8420
+ if (!camera.canReach(initialPanel)) {
8421
+ position = nearestAnchor.position;
8422
+ }
8423
+
8424
+ camera.lookAt(position);
8425
+ control.updateInput();
8426
+ camera.updateOffset();
8427
+ };
8428
+
8429
+ __proto._initialResize = function () {
8430
+ var viewport = this._viewport;
8431
+ var renderer = this._renderer;
8432
+ var camera = this._camera;
8433
+ var control = this._control;
8434
+ this.trigger(new Component.ComponentEvent(EVENTS.BEFORE_RESIZE, {
8435
+ width: 0,
8436
+ height: 0,
8437
+ element: viewport.element
8438
+ }));
8439
+ viewport.resize();
8440
+ renderer.updatePanelSize();
8441
+ camera.updateAlignPos();
8442
+ camera.updateRange();
8443
+ camera.updateAnchors();
8444
+ camera.updateOffset();
8445
+ control.updateInput();
8446
+ var newWidth = viewport.width;
8447
+ var newHeight = viewport.height;
8448
+ var sizeChanged = newWidth !== 0 || newHeight !== 0;
8449
+ this.trigger(new Component.ComponentEvent(EVENTS.AFTER_RESIZE, {
8450
+ width: viewport.width,
8451
+ height: viewport.height,
8452
+ prev: {
8453
+ width: 0,
8454
+ height: 0
8455
+ },
8456
+ sizeChanged: sizeChanged,
8457
+ element: viewport.element
8458
+ }));
8334
8459
  };
8335
8460
  /**
8336
8461
  * Version info string
@@ -8344,7 +8469,7 @@ version: 4.5.1
8344
8469
  */
8345
8470
 
8346
8471
 
8347
- Flicking.VERSION = "4.5.1";
8472
+ Flicking.VERSION = "4.6.2";
8348
8473
  return Flicking;
8349
8474
  }(Component);
8350
8475
 
@@ -8384,7 +8509,7 @@ version: 4.5.1
8384
8509
  var withFlickingMethods = function (prototype, flickingName) {
8385
8510
  [Component.prototype, Flicking.prototype].forEach(function (proto) {
8386
8511
  Object.getOwnPropertyNames(proto).filter(function (name) {
8387
- return !prototype[name] && !name.startsWith("_") && name !== "constructor";
8512
+ return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
8388
8513
  }).forEach(function (name) {
8389
8514
  var descriptor = Object.getOwnPropertyDescriptor(proto, name);
8390
8515
 
@@ -8441,6 +8566,9 @@ version: 4.5.1
8441
8566
 
8442
8567
  var prevList = __spread(diffResult.prevList);
8443
8568
 
8569
+ var added = [];
8570
+ var removed = [];
8571
+
8444
8572
  if (diffResult.removed.length > 0) {
8445
8573
  var endIdx_1 = -1;
8446
8574
  var prevIdx_1 = -1;
@@ -8450,7 +8578,7 @@ version: 4.5.1
8450
8578
  }
8451
8579
 
8452
8580
  if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
8453
- batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
8581
+ removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
8454
8582
  endIdx_1 = removedIdx;
8455
8583
  prevIdx_1 = removedIdx;
8456
8584
  } else {
@@ -8459,39 +8587,34 @@ version: 4.5.1
8459
8587
 
8460
8588
  prevList.splice(removedIdx, 1);
8461
8589
  });
8462
- batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
8590
+ removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
8463
8591
  }
8464
8592
 
8465
8593
  diffResult.ordered.forEach(function (_a) {
8466
8594
  var _b = __read(_a, 2),
8467
- prevIdx = _b[0],
8468
- newIdx = _b[1];
8469
-
8470
- var prevPanel = panels[prevIdx];
8471
- var indexDiff = newIdx - prevIdx;
8472
-
8473
- if (indexDiff > 0) {
8474
- var middlePanels = panels.slice(prevIdx + 1, newIdx + 1);
8475
- prevPanel.increaseIndex(indexDiff);
8476
- middlePanels.forEach(function (panel) {
8477
- return panel.decreaseIndex(1);
8478
- });
8479
- } else {
8480
- var middlePanels = panels.slice(newIdx, prevIdx);
8481
- prevPanel.decreaseIndex(-indexDiff);
8482
- middlePanels.forEach(function (panel) {
8483
- return panel.increaseIndex(1);
8484
- });
8485
- } // Update position
8595
+ from = _b[0],
8596
+ to = _b[1];
8486
8597
 
8487
-
8488
- prevPanel.resize();
8598
+ var prevPanel = panels.splice(from, 1)[0];
8599
+ panels.splice(to, 0, prevPanel);
8489
8600
  });
8490
8601
 
8491
8602
  if (diffResult.ordered.length > 0) {
8603
+ panels.forEach(function (panel, idx) {
8604
+ var indexDiff = idx - panel.index;
8605
+
8606
+ if (indexDiff > 0) {
8607
+ panel.increaseIndex(indexDiff);
8608
+ } else {
8609
+ panel.decreaseIndex(-indexDiff);
8610
+ }
8611
+ });
8492
8612
  panels.sort(function (panel1, panel2) {
8493
8613
  return panel1.index - panel2.index;
8494
8614
  });
8615
+ panels.forEach(function (panel) {
8616
+ panel.updatePosition();
8617
+ });
8495
8618
  }
8496
8619
 
8497
8620
  if (diffResult.added.length > 0) {
@@ -8504,7 +8627,7 @@ version: 4.5.1
8504
8627
  }
8505
8628
 
8506
8629
  if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
8507
- batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
8630
+ added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1)));
8508
8631
  startIdx_1 = -1;
8509
8632
  prevIdx_2 = -1;
8510
8633
  } else {
@@ -8513,13 +8636,17 @@ version: 4.5.1
8513
8636
  });
8514
8637
 
8515
8638
  if (startIdx_1 >= 0) {
8516
- batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
8639
+ added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
8517
8640
  }
8518
8641
  }
8642
+
8643
+ if (diffResult.added.length > 0 || diffResult.removed.length > 0) {
8644
+ renderer.updateAfterPanelChange(added, removed);
8645
+ }
8519
8646
  });
8520
8647
 
8521
8648
  var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
8522
- renderer.batchInsert.apply(renderer, __spread(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
8649
+ return renderer.batchInsertDefer.apply(renderer, __spread(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
8523
8650
  return {
8524
8651
  index: index,
8525
8652
  elements: [addedElements[elIdx]],
@@ -8530,7 +8657,7 @@ version: 4.5.1
8530
8657
 
8531
8658
  var batchRemove = function (renderer, startIdx, endIdx) {
8532
8659
  var removed = renderer.panels.slice(startIdx, endIdx);
8533
- renderer.batchRemove({
8660
+ return renderer.batchRemoveDefer({
8534
8661
  index: startIdx,
8535
8662
  deleteCount: removed.length,
8536
8663
  hasDOMInElements: false