@egjs/flicking 4.5.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TODO.md +3 -0
- package/declaration/Flicking.d.ts +8 -1
- package/declaration/camera/Camera.d.ts +2 -2
- package/declaration/control/StrictControl.d.ts +1 -0
- package/declaration/core/AutoResizer.d.ts +3 -0
- package/declaration/core/ResizeWatcher.d.ts +33 -0
- package/declaration/renderer/Renderer.d.ts +13 -0
- package/dist/flicking-inline.css +45 -2
- package/dist/flicking-inline.min.css +1 -0
- package/dist/flicking.css +44 -2
- package/dist/flicking.esm.js +320 -171
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +320 -171
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.css +1 -0
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +320 -171
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +2 -2
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +14 -5
- package/sass/flicking-inline.sass +30 -0
- package/sass/flicking.sass +23 -0
- package/src/Flicking.ts +102 -21
- package/src/camera/Camera.ts +10 -14
- package/src/cfc/sync.ts +29 -23
- package/src/cfc/withFlickingMethods.ts +3 -2
- package/src/control/StrictControl.ts +10 -0
- package/src/core/AutoResizer.ts +33 -0
- package/src/core/ResizeWatcher.ts +133 -0
- package/src/renderer/Renderer.ts +92 -43
- package/css/flicking-inline.css +0 -38
- package/css/flicking.css +0 -28
- package/dist/flicking-inline.css.map +0 -1
- package/dist/flicking.css.map +0 -1
package/dist/flicking.pkgd.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.
|
|
7
|
+
version: 4.6.1
|
|
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.0
|
|
|
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.0
|
|
|
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;
|
|
@@ -9924,6 +9953,21 @@ version: 4.5.0
|
|
|
9924
9953
|
};
|
|
9925
9954
|
return this;
|
|
9926
9955
|
};
|
|
9956
|
+
|
|
9957
|
+
__proto.moveToPanel = function (panel, options) {
|
|
9958
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9959
|
+
var flicking, camera, controller;
|
|
9960
|
+
return __generator(this, function (_a) {
|
|
9961
|
+
flicking = getFlickingAttached(this._flicking);
|
|
9962
|
+
camera = flicking.camera;
|
|
9963
|
+
controller = this._controller;
|
|
9964
|
+
controller.update(camera.controlParams);
|
|
9965
|
+
return [2
|
|
9966
|
+
/*return*/
|
|
9967
|
+
, _super.prototype.moveToPanel.call(this, panel, options)];
|
|
9968
|
+
});
|
|
9969
|
+
});
|
|
9970
|
+
};
|
|
9927
9971
|
/**
|
|
9928
9972
|
* Move {@link Camera} to the given position
|
|
9929
9973
|
* @ko {@link Camera}를 주어진 좌표로 이동합니다
|
|
@@ -10501,7 +10545,7 @@ version: 4.5.0
|
|
|
10501
10545
|
/*#__PURE__*/
|
|
10502
10546
|
function () {
|
|
10503
10547
|
/** */
|
|
10504
|
-
function Camera(_a) {
|
|
10548
|
+
function Camera(flicking, _a) {
|
|
10505
10549
|
var _this = this;
|
|
10506
10550
|
|
|
10507
10551
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
@@ -10541,7 +10585,7 @@ version: 4.5.0
|
|
|
10541
10585
|
_this._transform = transformName;
|
|
10542
10586
|
};
|
|
10543
10587
|
|
|
10544
|
-
this._flicking =
|
|
10588
|
+
this._flicking = flicking;
|
|
10545
10589
|
|
|
10546
10590
|
this._resetInternalValues(); // Options
|
|
10547
10591
|
|
|
@@ -10836,17 +10880,14 @@ version: 4.5.0
|
|
|
10836
10880
|
/**
|
|
10837
10881
|
* Initialize Camera
|
|
10838
10882
|
* @ko Camera를 초기화합니다
|
|
10839
|
-
* @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
|
|
10840
|
-
* @chainable
|
|
10841
10883
|
* @throws {FlickingError}
|
|
10842
10884
|
* {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
|
|
10843
10885
|
* <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
|
|
10844
10886
|
* @return {this}
|
|
10845
10887
|
*/
|
|
10846
10888
|
|
|
10847
|
-
__proto.init = function (
|
|
10848
|
-
this._flicking
|
|
10849
|
-
var viewportEl = flicking.viewport.element;
|
|
10889
|
+
__proto.init = function () {
|
|
10890
|
+
var viewportEl = this._flicking.viewport.element;
|
|
10850
10891
|
checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
|
|
10851
10892
|
this._el = viewportEl.firstElementChild;
|
|
10852
10893
|
|
|
@@ -10864,8 +10905,6 @@ version: 4.5.0
|
|
|
10864
10905
|
|
|
10865
10906
|
|
|
10866
10907
|
__proto.destroy = function () {
|
|
10867
|
-
this._flicking = null;
|
|
10868
|
-
|
|
10869
10908
|
this._resetInternalValues();
|
|
10870
10909
|
|
|
10871
10910
|
return this;
|
|
@@ -10896,12 +10935,12 @@ version: 4.5.0
|
|
|
10896
10935
|
|
|
10897
10936
|
this._checkReachEnd(prevPos, pos);
|
|
10898
10937
|
|
|
10899
|
-
this.applyTransform();
|
|
10900
|
-
|
|
10901
10938
|
if (toggled) {
|
|
10902
10939
|
void flicking.renderer.render().then(function () {
|
|
10903
10940
|
_this.updateOffset();
|
|
10904
10941
|
});
|
|
10942
|
+
} else {
|
|
10943
|
+
this.applyTransform();
|
|
10905
10944
|
}
|
|
10906
10945
|
};
|
|
10907
10946
|
/**
|
|
@@ -11088,7 +11127,6 @@ version: 4.5.0
|
|
|
11088
11127
|
});
|
|
11089
11128
|
}
|
|
11090
11129
|
|
|
11091
|
-
this.updateOffset();
|
|
11092
11130
|
return this;
|
|
11093
11131
|
};
|
|
11094
11132
|
/**
|
|
@@ -11180,7 +11218,6 @@ version: 4.5.0
|
|
|
11180
11218
|
/**
|
|
11181
11219
|
* Apply "transform" style with the current position to camera element
|
|
11182
11220
|
* @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
|
|
11183
|
-
* @chainable
|
|
11184
11221
|
* @return {this}
|
|
11185
11222
|
*/
|
|
11186
11223
|
|
|
@@ -11188,6 +11225,8 @@ version: 4.5.0
|
|
|
11188
11225
|
__proto.applyTransform = function () {
|
|
11189
11226
|
var el = this._el;
|
|
11190
11227
|
var flicking = getFlickingAttached(this._flicking);
|
|
11228
|
+
var renderer = flicking.renderer;
|
|
11229
|
+
if (renderer.rendering) return this;
|
|
11191
11230
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
11192
11231
|
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
11193
11232
|
return this;
|
|
@@ -12380,7 +12419,8 @@ version: 4.5.0
|
|
|
12380
12419
|
align = _b === void 0 ? ALIGN.CENTER : _b,
|
|
12381
12420
|
strategy = _a.strategy;
|
|
12382
12421
|
this._flicking = null;
|
|
12383
|
-
this._panels = [];
|
|
12422
|
+
this._panels = [];
|
|
12423
|
+
this._rendering = false; // Bind options
|
|
12384
12424
|
|
|
12385
12425
|
this._align = align;
|
|
12386
12426
|
this._strategy = strategy;
|
|
@@ -12403,6 +12443,20 @@ version: 4.5.0
|
|
|
12403
12443
|
enumerable: false,
|
|
12404
12444
|
configurable: true
|
|
12405
12445
|
});
|
|
12446
|
+
Object.defineProperty(__proto, "rendering", {
|
|
12447
|
+
/**
|
|
12448
|
+
* A boolean value indicating whether rendering is in progress
|
|
12449
|
+
* @ko 현재 렌더링이 시작되어 끝나기 전까지의 상태인지의 여부
|
|
12450
|
+
* @type {boolean}
|
|
12451
|
+
* @readonly
|
|
12452
|
+
* @internal
|
|
12453
|
+
*/
|
|
12454
|
+
get: function () {
|
|
12455
|
+
return this._rendering;
|
|
12456
|
+
},
|
|
12457
|
+
enumerable: false,
|
|
12458
|
+
configurable: true
|
|
12459
|
+
});
|
|
12406
12460
|
Object.defineProperty(__proto, "panelCount", {
|
|
12407
12461
|
/**
|
|
12408
12462
|
* Count of panels
|
|
@@ -12534,6 +12588,25 @@ version: 4.5.0
|
|
|
12534
12588
|
|
|
12535
12589
|
|
|
12536
12590
|
__proto.batchInsert = function () {
|
|
12591
|
+
var items = [];
|
|
12592
|
+
|
|
12593
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
12594
|
+
items[_i] = arguments[_i];
|
|
12595
|
+
}
|
|
12596
|
+
|
|
12597
|
+
var allPanelsInserted = this.batchInsertDefer.apply(this, __spread$1(items));
|
|
12598
|
+
if (allPanelsInserted.length <= 0) return [];
|
|
12599
|
+
this.updateAfterPanelChange(allPanelsInserted, []);
|
|
12600
|
+
return allPanelsInserted;
|
|
12601
|
+
};
|
|
12602
|
+
/**
|
|
12603
|
+
* Defers update
|
|
12604
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
12605
|
+
* @internal
|
|
12606
|
+
*/
|
|
12607
|
+
|
|
12608
|
+
|
|
12609
|
+
__proto.batchInsertDefer = function () {
|
|
12537
12610
|
var _this = this;
|
|
12538
12611
|
|
|
12539
12612
|
var items = [];
|
|
@@ -12544,7 +12617,6 @@ version: 4.5.0
|
|
|
12544
12617
|
|
|
12545
12618
|
var panels = this._panels;
|
|
12546
12619
|
var flicking = getFlickingAttached(this._flicking);
|
|
12547
|
-
var control = flicking.control;
|
|
12548
12620
|
var prevFirstPanel = panels[0];
|
|
12549
12621
|
var align = parsePanelAlign(this._align);
|
|
12550
12622
|
var allPanelsInserted = items.reduce(function (addedPanels, item) {
|
|
@@ -12584,27 +12656,6 @@ version: 4.5.0
|
|
|
12584
12656
|
});
|
|
12585
12657
|
return __spread$1(addedPanels, panelsInserted);
|
|
12586
12658
|
}, []);
|
|
12587
|
-
if (allPanelsInserted.length <= 0) return []; // Update camera & control
|
|
12588
|
-
|
|
12589
|
-
this._updateCameraAndControl();
|
|
12590
|
-
|
|
12591
|
-
void this.render(); // Move to the first panel added if no panels existed
|
|
12592
|
-
// FIXME: fix for animating case
|
|
12593
|
-
|
|
12594
|
-
if (allPanelsInserted.length > 0 && !control.animating) {
|
|
12595
|
-
void control.moveToPanel(control.activePanel || allPanelsInserted[0], {
|
|
12596
|
-
duration: 0
|
|
12597
|
-
}).catch(function () {
|
|
12598
|
-
return void 0;
|
|
12599
|
-
});
|
|
12600
|
-
}
|
|
12601
|
-
|
|
12602
|
-
flicking.camera.updateOffset();
|
|
12603
|
-
flicking.trigger(new ComponentEvent$1(EVENTS.PANEL_CHANGE, {
|
|
12604
|
-
added: allPanelsInserted,
|
|
12605
|
-
removed: []
|
|
12606
|
-
}));
|
|
12607
|
-
this.checkPanelContentsReady(allPanelsInserted);
|
|
12608
12659
|
return allPanelsInserted;
|
|
12609
12660
|
};
|
|
12610
12661
|
/**
|
|
@@ -12621,6 +12672,25 @@ version: 4.5.0
|
|
|
12621
12672
|
|
|
12622
12673
|
|
|
12623
12674
|
__proto.batchRemove = function () {
|
|
12675
|
+
var items = [];
|
|
12676
|
+
|
|
12677
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
12678
|
+
items[_i] = arguments[_i];
|
|
12679
|
+
}
|
|
12680
|
+
|
|
12681
|
+
var allPanelsRemoved = this.batchRemoveDefer.apply(this, __spread$1(items));
|
|
12682
|
+
if (allPanelsRemoved.length <= 0) return [];
|
|
12683
|
+
this.updateAfterPanelChange([], allPanelsRemoved);
|
|
12684
|
+
return allPanelsRemoved;
|
|
12685
|
+
};
|
|
12686
|
+
/**
|
|
12687
|
+
* Defers update
|
|
12688
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
12689
|
+
* @internal
|
|
12690
|
+
*/
|
|
12691
|
+
|
|
12692
|
+
|
|
12693
|
+
__proto.batchRemoveDefer = function () {
|
|
12624
12694
|
var _this = this;
|
|
12625
12695
|
|
|
12626
12696
|
var items = [];
|
|
@@ -12631,10 +12701,8 @@ version: 4.5.0
|
|
|
12631
12701
|
|
|
12632
12702
|
var panels = this._panels;
|
|
12633
12703
|
var flicking = getFlickingAttached(this._flicking);
|
|
12634
|
-
var
|
|
12635
|
-
control = flicking.control;
|
|
12704
|
+
var control = flicking.control;
|
|
12636
12705
|
var activePanel = control.activePanel;
|
|
12637
|
-
var activeIndex = control.activeIndex;
|
|
12638
12706
|
var allPanelsRemoved = items.reduce(function (removed, item) {
|
|
12639
12707
|
var index = item.index,
|
|
12640
12708
|
deleteCount = item.deleteCount;
|
|
@@ -12662,33 +12730,61 @@ version: 4.5.0
|
|
|
12662
12730
|
}
|
|
12663
12731
|
|
|
12664
12732
|
return __spread$1(removed, panelsRemoved);
|
|
12665
|
-
}, []);
|
|
12733
|
+
}, []);
|
|
12734
|
+
return allPanelsRemoved;
|
|
12735
|
+
};
|
|
12736
|
+
/**
|
|
12737
|
+
* @internal
|
|
12738
|
+
*/
|
|
12739
|
+
|
|
12740
|
+
|
|
12741
|
+
__proto.updateAfterPanelChange = function (panelsAdded, panelsRemoved) {
|
|
12742
|
+
var _a;
|
|
12743
|
+
|
|
12744
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
12745
|
+
var camera = flicking.camera,
|
|
12746
|
+
control = flicking.control;
|
|
12747
|
+
var panels = this._panels;
|
|
12748
|
+
var activePanel = control.activePanel; // Update camera & control
|
|
12666
12749
|
|
|
12667
12750
|
this._updateCameraAndControl();
|
|
12668
12751
|
|
|
12669
|
-
void this.render();
|
|
12752
|
+
void this.render();
|
|
12670
12753
|
|
|
12671
|
-
if (
|
|
12672
|
-
|
|
12754
|
+
if (!activePanel || activePanel.removed) {
|
|
12755
|
+
if (panels.length <= 0) {
|
|
12756
|
+
// All panels removed
|
|
12757
|
+
camera.lookAt(0);
|
|
12758
|
+
} else {
|
|
12759
|
+
var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
|
|
12760
|
+
|
|
12761
|
+
if (targetIndex > panels.length - 1) {
|
|
12762
|
+
targetIndex = panels.length - 1;
|
|
12763
|
+
}
|
|
12673
12764
|
|
|
12674
|
-
|
|
12675
|
-
void control.moveToPanel(targetPanel, {
|
|
12765
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
12676
12766
|
duration: 0
|
|
12677
12767
|
}).catch(function () {
|
|
12678
12768
|
return void 0;
|
|
12679
12769
|
});
|
|
12680
|
-
} else {
|
|
12681
|
-
// All panels removed
|
|
12682
|
-
camera.lookAt(0);
|
|
12683
12770
|
}
|
|
12771
|
+
} else {
|
|
12772
|
+
void control.moveToPanel(control.activePanel, {
|
|
12773
|
+
duration: 0
|
|
12774
|
+
}).catch(function () {
|
|
12775
|
+
return void 0;
|
|
12776
|
+
});
|
|
12684
12777
|
}
|
|
12685
12778
|
|
|
12686
12779
|
flicking.camera.updateOffset();
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12780
|
+
|
|
12781
|
+
if (panelsAdded.length > 0 || panelsRemoved.length > 0) {
|
|
12782
|
+
flicking.trigger(new ComponentEvent$1(EVENTS.PANEL_CHANGE, {
|
|
12783
|
+
added: panelsAdded,
|
|
12784
|
+
removed: panelsRemoved
|
|
12785
|
+
}));
|
|
12786
|
+
this.checkPanelContentsReady(__spread$1(panelsAdded, panelsRemoved));
|
|
12787
|
+
}
|
|
12692
12788
|
};
|
|
12693
12789
|
/**
|
|
12694
12790
|
* @internal
|
|
@@ -12733,6 +12829,7 @@ version: 4.5.0
|
|
|
12733
12829
|
});
|
|
12734
12830
|
if (!flicking.initialized) return;
|
|
12735
12831
|
camera.updateRange();
|
|
12832
|
+
camera.updateOffset();
|
|
12736
12833
|
camera.updateAnchors();
|
|
12737
12834
|
|
|
12738
12835
|
if (control.animating) ; else {
|
|
@@ -12766,6 +12863,7 @@ version: 4.5.0
|
|
|
12766
12863
|
var camera = flicking.camera,
|
|
12767
12864
|
control = flicking.control;
|
|
12768
12865
|
camera.updateRange();
|
|
12866
|
+
camera.updateOffset();
|
|
12769
12867
|
camera.updateAnchors();
|
|
12770
12868
|
camera.resetNeedPanelHistory();
|
|
12771
12869
|
control.updateInput();
|
|
@@ -14064,10 +14162,14 @@ version: 4.5.0
|
|
|
14064
14162
|
autoResize = _4 === void 0 ? true : _4,
|
|
14065
14163
|
_5 = _b.useResizeObserver,
|
|
14066
14164
|
useResizeObserver = _5 === void 0 ? true : _5,
|
|
14067
|
-
_6 = _b.
|
|
14068
|
-
|
|
14069
|
-
_7 = _b.
|
|
14070
|
-
|
|
14165
|
+
_6 = _b.resizeDebounce,
|
|
14166
|
+
resizeDebounce = _6 === void 0 ? 0 : _6,
|
|
14167
|
+
_7 = _b.maxResizeDebounce,
|
|
14168
|
+
maxResizeDebounce = _7 === void 0 ? 100 : _7,
|
|
14169
|
+
_8 = _b.externalRenderer,
|
|
14170
|
+
externalRenderer = _8 === void 0 ? null : _8,
|
|
14171
|
+
_9 = _b.renderExternal,
|
|
14172
|
+
renderExternal = _9 === void 0 ? null : _9;
|
|
14071
14173
|
|
|
14072
14174
|
var _this = _super.call(this) || this; // Internal states
|
|
14073
14175
|
|
|
@@ -14103,6 +14205,8 @@ version: 4.5.0
|
|
|
14103
14205
|
_this._autoInit = autoInit;
|
|
14104
14206
|
_this._autoResize = autoResize;
|
|
14105
14207
|
_this._useResizeObserver = useResizeObserver;
|
|
14208
|
+
_this._resizeDebounce = resizeDebounce;
|
|
14209
|
+
_this._maxResizeDebounce = maxResizeDebounce;
|
|
14106
14210
|
_this._externalRenderer = externalRenderer;
|
|
14107
14211
|
_this._renderExternal = renderExternal; // Create core components
|
|
14108
14212
|
|
|
@@ -14951,6 +15055,38 @@ version: 4.5.0
|
|
|
14951
15055
|
enumerable: false,
|
|
14952
15056
|
configurable: true
|
|
14953
15057
|
});
|
|
15058
|
+
Object.defineProperty(__proto, "resizeDebounce", {
|
|
15059
|
+
/**
|
|
15060
|
+
* Delays size recalculation from `autoResize` by the given time in milisecond.
|
|
15061
|
+
* If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
|
|
15062
|
+
* This can increase performance by preventing `resize` being called too often.
|
|
15063
|
+
* @ko `autoResize` 설정시에 호출되는 크기 재계산을 주어진 시간(단위: ms)만큼 지연시킵니다.
|
|
15064
|
+
* 지연시키는 도중 크기가 다시 변경되었을 경우, 이전 것을 취소하고 주어진 시간만큼 다시 지연시킵니다.
|
|
15065
|
+
* 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
|
|
15066
|
+
* @type {number}
|
|
15067
|
+
* @default 0
|
|
15068
|
+
*/
|
|
15069
|
+
get: function () {
|
|
15070
|
+
return this._resizeDebounce;
|
|
15071
|
+
},
|
|
15072
|
+
enumerable: false,
|
|
15073
|
+
configurable: true
|
|
15074
|
+
});
|
|
15075
|
+
Object.defineProperty(__proto, "maxResizeDebounce", {
|
|
15076
|
+
/**
|
|
15077
|
+
* The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
|
|
15078
|
+
* This guarantees that size recalculation is performed at least once every (n)ms.
|
|
15079
|
+
* @ko `resizeDebounce` 사용시에 크기 재계산이 지연되는 최대 시간을 지정합니다. (단위: ms)
|
|
15080
|
+
* 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
|
|
15081
|
+
* @type {number}
|
|
15082
|
+
* @default 100
|
|
15083
|
+
*/
|
|
15084
|
+
get: function () {
|
|
15085
|
+
return this._maxResizeDebounce;
|
|
15086
|
+
},
|
|
15087
|
+
enumerable: false,
|
|
15088
|
+
configurable: true
|
|
15089
|
+
});
|
|
14954
15090
|
Object.defineProperty(__proto, "externalRenderer", {
|
|
14955
15091
|
/**
|
|
14956
15092
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
@@ -14986,85 +15122,61 @@ version: 4.5.0
|
|
|
14986
15122
|
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
14987
15123
|
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
14988
15124
|
* @fires Flicking#ready
|
|
14989
|
-
* @return {
|
|
15125
|
+
* @return {Promise<void>}
|
|
14990
15126
|
*/
|
|
14991
15127
|
|
|
14992
15128
|
__proto.init = function () {
|
|
14993
|
-
|
|
14994
|
-
var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
|
|
14995
|
-
|
|
14996
|
-
var _this = this;
|
|
14997
|
-
|
|
14998
|
-
return __generator(this, function (_a) {
|
|
14999
|
-
switch (_a.label) {
|
|
15000
|
-
case 0:
|
|
15001
|
-
if (this._initialized) return [2
|
|
15002
|
-
/*return*/
|
|
15003
|
-
];
|
|
15004
|
-
camera = this._camera;
|
|
15005
|
-
renderer = this._renderer;
|
|
15006
|
-
control = this._control;
|
|
15007
|
-
virtualManager = this._virtualManager;
|
|
15008
|
-
originalTrigger = this.trigger;
|
|
15009
|
-
preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
15010
|
-
camera.init(this);
|
|
15011
|
-
virtualManager.init();
|
|
15012
|
-
renderer.init(this);
|
|
15013
|
-
control.init(this);
|
|
15014
|
-
|
|
15015
|
-
if (preventEventsBeforeInit) {
|
|
15016
|
-
this.trigger = function () {
|
|
15017
|
-
return _this;
|
|
15018
|
-
};
|
|
15019
|
-
}
|
|
15020
|
-
|
|
15021
|
-
return [4
|
|
15022
|
-
/*yield*/
|
|
15023
|
-
, this.resize()];
|
|
15024
|
-
|
|
15025
|
-
case 1:
|
|
15026
|
-
_a.sent(); // Look at initial panel
|
|
15027
|
-
|
|
15129
|
+
var _this = this;
|
|
15028
15130
|
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15131
|
+
if (this._initialized) return Promise.resolve();
|
|
15132
|
+
var camera = this._camera;
|
|
15133
|
+
var renderer = this._renderer;
|
|
15134
|
+
var control = this._control;
|
|
15135
|
+
var virtualManager = this._virtualManager;
|
|
15136
|
+
var originalTrigger = this.trigger;
|
|
15137
|
+
var preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
15138
|
+
camera.init();
|
|
15139
|
+
virtualManager.init();
|
|
15140
|
+
renderer.init(this);
|
|
15141
|
+
control.init(this);
|
|
15142
|
+
|
|
15143
|
+
if (preventEventsBeforeInit) {
|
|
15144
|
+
this.trigger = function () {
|
|
15145
|
+
return _this;
|
|
15146
|
+
};
|
|
15147
|
+
}
|
|
15032
15148
|
|
|
15033
|
-
|
|
15034
|
-
// Look at initial panel
|
|
15035
|
-
_a.sent();
|
|
15149
|
+
this._initialResize(); // Look at initial panel
|
|
15036
15150
|
|
|
15037
|
-
if (this._autoResize) {
|
|
15038
|
-
this._autoResizer.enable();
|
|
15039
|
-
}
|
|
15040
15151
|
|
|
15041
|
-
|
|
15042
|
-
control.controller.addPreventClickHandler();
|
|
15043
|
-
}
|
|
15152
|
+
this._moveToInitialPanel();
|
|
15044
15153
|
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15154
|
+
if (this._autoResize) {
|
|
15155
|
+
this._autoResizer.enable();
|
|
15156
|
+
}
|
|
15048
15157
|
|
|
15049
|
-
|
|
15158
|
+
if (this._preventClickOnDrag) {
|
|
15159
|
+
control.controller.addPreventClickHandler();
|
|
15160
|
+
}
|
|
15050
15161
|
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15162
|
+
if (this._disableOnInit) {
|
|
15163
|
+
this.disableInput();
|
|
15164
|
+
}
|
|
15054
15165
|
|
|
15166
|
+
renderer.checkPanelContentsReady(renderer.panels);
|
|
15167
|
+
return renderer.render().then(function () {
|
|
15168
|
+
// Done initializing & emit ready event
|
|
15169
|
+
_this._plugins.forEach(function (plugin) {
|
|
15170
|
+
return plugin.init(_this);
|
|
15171
|
+
});
|
|
15055
15172
|
|
|
15056
|
-
|
|
15173
|
+
_this._initialized = true;
|
|
15057
15174
|
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15175
|
+
if (preventEventsBeforeInit) {
|
|
15176
|
+
_this.trigger = originalTrigger;
|
|
15177
|
+
}
|
|
15061
15178
|
|
|
15062
|
-
|
|
15063
|
-
return [2
|
|
15064
|
-
/*return*/
|
|
15065
|
-
];
|
|
15066
|
-
}
|
|
15067
|
-
});
|
|
15179
|
+
_this.trigger(new ComponentEvent$1(EVENTS.READY));
|
|
15068
15180
|
});
|
|
15069
15181
|
};
|
|
15070
15182
|
/**
|
|
@@ -15682,7 +15794,7 @@ version: 4.5.0
|
|
|
15682
15794
|
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
15683
15795
|
}
|
|
15684
15796
|
|
|
15685
|
-
return new Camera$1({
|
|
15797
|
+
return new Camera$1(this, {
|
|
15686
15798
|
align: this._align
|
|
15687
15799
|
});
|
|
15688
15800
|
};
|
|
@@ -15718,23 +15830,59 @@ version: 4.5.0
|
|
|
15718
15830
|
};
|
|
15719
15831
|
|
|
15720
15832
|
__proto._moveToInitialPanel = function () {
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
}
|
|
15833
|
+
var renderer = this._renderer;
|
|
15834
|
+
var control = this._control;
|
|
15835
|
+
var camera = this._camera;
|
|
15836
|
+
var initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
15837
|
+
if (!initialPanel) return;
|
|
15838
|
+
var nearestAnchor = camera.findNearestAnchor(initialPanel.position);
|
|
15839
|
+
control.setActive(initialPanel, null, false);
|
|
15840
|
+
|
|
15841
|
+
if (!nearestAnchor) {
|
|
15842
|
+
throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
|
|
15843
|
+
}
|
|
15844
|
+
|
|
15845
|
+
var position = initialPanel.position;
|
|
15846
|
+
|
|
15847
|
+
if (!camera.canReach(initialPanel)) {
|
|
15848
|
+
position = nearestAnchor.position;
|
|
15849
|
+
}
|
|
15850
|
+
|
|
15851
|
+
camera.lookAt(position);
|
|
15852
|
+
control.updateInput();
|
|
15853
|
+
camera.updateOffset();
|
|
15854
|
+
};
|
|
15855
|
+
|
|
15856
|
+
__proto._initialResize = function () {
|
|
15857
|
+
var viewport = this._viewport;
|
|
15858
|
+
var renderer = this._renderer;
|
|
15859
|
+
var camera = this._camera;
|
|
15860
|
+
var control = this._control;
|
|
15861
|
+
this.trigger(new ComponentEvent$1(EVENTS.BEFORE_RESIZE, {
|
|
15862
|
+
width: 0,
|
|
15863
|
+
height: 0,
|
|
15864
|
+
element: viewport.element
|
|
15865
|
+
}));
|
|
15866
|
+
viewport.resize();
|
|
15867
|
+
renderer.updatePanelSize();
|
|
15868
|
+
camera.updateAlignPos();
|
|
15869
|
+
camera.updateRange();
|
|
15870
|
+
camera.updateAnchors();
|
|
15871
|
+
camera.updateOffset();
|
|
15872
|
+
control.updateInput();
|
|
15873
|
+
var newWidth = viewport.width;
|
|
15874
|
+
var newHeight = viewport.height;
|
|
15875
|
+
var sizeChanged = newWidth !== 0 || newHeight !== 0;
|
|
15876
|
+
this.trigger(new ComponentEvent$1(EVENTS.AFTER_RESIZE, {
|
|
15877
|
+
width: viewport.width,
|
|
15878
|
+
height: viewport.height,
|
|
15879
|
+
prev: {
|
|
15880
|
+
width: 0,
|
|
15881
|
+
height: 0
|
|
15882
|
+
},
|
|
15883
|
+
sizeChanged: sizeChanged,
|
|
15884
|
+
element: viewport.element
|
|
15885
|
+
}));
|
|
15738
15886
|
};
|
|
15739
15887
|
/**
|
|
15740
15888
|
* Version info string
|
|
@@ -15748,7 +15896,7 @@ version: 4.5.0
|
|
|
15748
15896
|
*/
|
|
15749
15897
|
|
|
15750
15898
|
|
|
15751
|
-
Flicking.VERSION = "4.
|
|
15899
|
+
Flicking.VERSION = "4.6.1";
|
|
15752
15900
|
return Flicking;
|
|
15753
15901
|
}(Component$1);
|
|
15754
15902
|
|
|
@@ -15788,7 +15936,7 @@ version: 4.5.0
|
|
|
15788
15936
|
var withFlickingMethods = function (prototype, flickingName) {
|
|
15789
15937
|
[Component$1.prototype, Flicking.prototype].forEach(function (proto) {
|
|
15790
15938
|
Object.getOwnPropertyNames(proto).filter(function (name) {
|
|
15791
|
-
return !prototype[name] &&
|
|
15939
|
+
return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
|
|
15792
15940
|
}).forEach(function (name) {
|
|
15793
15941
|
var descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
15794
15942
|
|
|
@@ -15814,7 +15962,8 @@ version: 4.5.0
|
|
|
15814
15962
|
getterDescriptor.get = function () {
|
|
15815
15963
|
var _a;
|
|
15816
15964
|
|
|
15817
|
-
|
|
15965
|
+
var flicking = this[flickingName];
|
|
15966
|
+
return flicking && ((_a = descriptor.get) === null || _a === void 0 ? void 0 : _a.call(flicking));
|
|
15818
15967
|
};
|
|
15819
15968
|
}
|
|
15820
15969
|
|
|
@@ -15844,6 +15993,9 @@ version: 4.5.0
|
|
|
15844
15993
|
|
|
15845
15994
|
var prevList = __spread$1(diffResult.prevList);
|
|
15846
15995
|
|
|
15996
|
+
var added = [];
|
|
15997
|
+
var removed = [];
|
|
15998
|
+
|
|
15847
15999
|
if (diffResult.removed.length > 0) {
|
|
15848
16000
|
var endIdx_1 = -1;
|
|
15849
16001
|
var prevIdx_1 = -1;
|
|
@@ -15853,7 +16005,7 @@ version: 4.5.0
|
|
|
15853
16005
|
}
|
|
15854
16006
|
|
|
15855
16007
|
if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
|
|
15856
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
16008
|
+
removed.push.apply(removed, __spread$1(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
15857
16009
|
endIdx_1 = removedIdx;
|
|
15858
16010
|
prevIdx_1 = removedIdx;
|
|
15859
16011
|
} else {
|
|
@@ -15862,39 +16014,34 @@ version: 4.5.0
|
|
|
15862
16014
|
|
|
15863
16015
|
prevList.splice(removedIdx, 1);
|
|
15864
16016
|
});
|
|
15865
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
16017
|
+
removed.push.apply(removed, __spread$1(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
15866
16018
|
}
|
|
15867
16019
|
|
|
15868
16020
|
diffResult.ordered.forEach(function (_a) {
|
|
15869
16021
|
var _b = __read$1(_a, 2),
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
var prevPanel = panels[prevIdx];
|
|
15874
|
-
var indexDiff = newIdx - prevIdx;
|
|
15875
|
-
|
|
15876
|
-
if (indexDiff > 0) {
|
|
15877
|
-
var middlePanels = panels.slice(prevIdx + 1, newIdx + 1);
|
|
15878
|
-
prevPanel.increaseIndex(indexDiff);
|
|
15879
|
-
middlePanels.forEach(function (panel) {
|
|
15880
|
-
return panel.decreaseIndex(1);
|
|
15881
|
-
});
|
|
15882
|
-
} else {
|
|
15883
|
-
var middlePanels = panels.slice(newIdx, prevIdx);
|
|
15884
|
-
prevPanel.decreaseIndex(-indexDiff);
|
|
15885
|
-
middlePanels.forEach(function (panel) {
|
|
15886
|
-
return panel.increaseIndex(1);
|
|
15887
|
-
});
|
|
15888
|
-
} // Update position
|
|
15889
|
-
|
|
16022
|
+
from = _b[0],
|
|
16023
|
+
to = _b[1];
|
|
15890
16024
|
|
|
15891
|
-
prevPanel.
|
|
16025
|
+
var prevPanel = panels.splice(from, 1)[0];
|
|
16026
|
+
panels.splice(to, 0, prevPanel);
|
|
15892
16027
|
});
|
|
15893
16028
|
|
|
15894
16029
|
if (diffResult.ordered.length > 0) {
|
|
16030
|
+
panels.forEach(function (panel, idx) {
|
|
16031
|
+
var indexDiff = idx - panel.index;
|
|
16032
|
+
|
|
16033
|
+
if (indexDiff > 0) {
|
|
16034
|
+
panel.increaseIndex(indexDiff);
|
|
16035
|
+
} else {
|
|
16036
|
+
panel.decreaseIndex(-indexDiff);
|
|
16037
|
+
}
|
|
16038
|
+
});
|
|
15895
16039
|
panels.sort(function (panel1, panel2) {
|
|
15896
16040
|
return panel1.index - panel2.index;
|
|
15897
16041
|
});
|
|
16042
|
+
panels.forEach(function (panel) {
|
|
16043
|
+
panel.updatePosition();
|
|
16044
|
+
});
|
|
15898
16045
|
}
|
|
15899
16046
|
|
|
15900
16047
|
if (diffResult.added.length > 0) {
|
|
@@ -15907,7 +16054,7 @@ version: 4.5.0
|
|
|
15907
16054
|
}
|
|
15908
16055
|
|
|
15909
16056
|
if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
|
|
15910
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
|
|
16057
|
+
added.push.apply(added, __spread$1(batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1)));
|
|
15911
16058
|
startIdx_1 = -1;
|
|
15912
16059
|
prevIdx_2 = -1;
|
|
15913
16060
|
} else {
|
|
@@ -15916,13 +16063,15 @@ version: 4.5.0
|
|
|
15916
16063
|
});
|
|
15917
16064
|
|
|
15918
16065
|
if (startIdx_1 >= 0) {
|
|
15919
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
|
|
16066
|
+
added.push.apply(added, __spread$1(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
|
|
15920
16067
|
}
|
|
15921
16068
|
}
|
|
16069
|
+
|
|
16070
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
15922
16071
|
});
|
|
15923
16072
|
|
|
15924
16073
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|
|
15925
|
-
renderer.
|
|
16074
|
+
return renderer.batchInsertDefer.apply(renderer, __spread$1(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
|
|
15926
16075
|
return {
|
|
15927
16076
|
index: index,
|
|
15928
16077
|
elements: [addedElements[elIdx]],
|
|
@@ -15933,7 +16082,7 @@ version: 4.5.0
|
|
|
15933
16082
|
|
|
15934
16083
|
var batchRemove = function (renderer, startIdx, endIdx) {
|
|
15935
16084
|
var removed = renderer.panels.slice(startIdx, endIdx);
|
|
15936
|
-
renderer.
|
|
16085
|
+
return renderer.batchRemoveDefer({
|
|
15937
16086
|
index: startIdx,
|
|
15938
16087
|
deleteCount: removed.length,
|
|
15939
16088
|
hasDOMInElements: false
|