@egjs/flicking 4.5.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TODO.md +3 -0
- package/declaration/Flicking.d.ts +8 -1
- package/declaration/camera/Camera.d.ts +2 -2
- 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/{css → dist/css}/flicking-inline.css +20 -13
- package/dist/css/flicking-inline.min.css +1 -0
- package/dist/css/flicking.css +44 -0
- package/dist/css/flicking.min.css +1 -0
- package/dist/flicking.esm.js +303 -170
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +303 -170
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +303 -170
- 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 +13 -4
- 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 +1 -1
- package/src/core/AutoResizer.ts +33 -0
- package/src/core/ResizeWatcher.ts +133 -0
- package/src/renderer/Renderer.ts +92 -43
- package/css/flicking.css +0 -28
- package/dist/flicking-inline.css +0 -2
- package/dist/flicking-inline.css.map +0 -1
- package/dist/flicking.css +0 -2
- 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.0
|
|
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;
|
|
@@ -10516,7 +10545,7 @@ version: 4.5.1
|
|
|
10516
10545
|
/*#__PURE__*/
|
|
10517
10546
|
function () {
|
|
10518
10547
|
/** */
|
|
10519
|
-
function Camera(_a) {
|
|
10548
|
+
function Camera(flicking, _a) {
|
|
10520
10549
|
var _this = this;
|
|
10521
10550
|
|
|
10522
10551
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
@@ -10556,7 +10585,7 @@ version: 4.5.1
|
|
|
10556
10585
|
_this._transform = transformName;
|
|
10557
10586
|
};
|
|
10558
10587
|
|
|
10559
|
-
this._flicking =
|
|
10588
|
+
this._flicking = flicking;
|
|
10560
10589
|
|
|
10561
10590
|
this._resetInternalValues(); // Options
|
|
10562
10591
|
|
|
@@ -10851,17 +10880,14 @@ version: 4.5.1
|
|
|
10851
10880
|
/**
|
|
10852
10881
|
* Initialize Camera
|
|
10853
10882
|
* @ko Camera를 초기화합니다
|
|
10854
|
-
* @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
|
|
10855
|
-
* @chainable
|
|
10856
10883
|
* @throws {FlickingError}
|
|
10857
10884
|
* {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
|
|
10858
10885
|
* <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
|
|
10859
10886
|
* @return {this}
|
|
10860
10887
|
*/
|
|
10861
10888
|
|
|
10862
|
-
__proto.init = function (
|
|
10863
|
-
this._flicking
|
|
10864
|
-
var viewportEl = flicking.viewport.element;
|
|
10889
|
+
__proto.init = function () {
|
|
10890
|
+
var viewportEl = this._flicking.viewport.element;
|
|
10865
10891
|
checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
|
|
10866
10892
|
this._el = viewportEl.firstElementChild;
|
|
10867
10893
|
|
|
@@ -10879,8 +10905,6 @@ version: 4.5.1
|
|
|
10879
10905
|
|
|
10880
10906
|
|
|
10881
10907
|
__proto.destroy = function () {
|
|
10882
|
-
this._flicking = null;
|
|
10883
|
-
|
|
10884
10908
|
this._resetInternalValues();
|
|
10885
10909
|
|
|
10886
10910
|
return this;
|
|
@@ -10911,12 +10935,12 @@ version: 4.5.1
|
|
|
10911
10935
|
|
|
10912
10936
|
this._checkReachEnd(prevPos, pos);
|
|
10913
10937
|
|
|
10914
|
-
this.applyTransform();
|
|
10915
|
-
|
|
10916
10938
|
if (toggled) {
|
|
10917
10939
|
void flicking.renderer.render().then(function () {
|
|
10918
10940
|
_this.updateOffset();
|
|
10919
10941
|
});
|
|
10942
|
+
} else {
|
|
10943
|
+
this.applyTransform();
|
|
10920
10944
|
}
|
|
10921
10945
|
};
|
|
10922
10946
|
/**
|
|
@@ -11103,7 +11127,6 @@ version: 4.5.1
|
|
|
11103
11127
|
});
|
|
11104
11128
|
}
|
|
11105
11129
|
|
|
11106
|
-
this.updateOffset();
|
|
11107
11130
|
return this;
|
|
11108
11131
|
};
|
|
11109
11132
|
/**
|
|
@@ -11195,7 +11218,6 @@ version: 4.5.1
|
|
|
11195
11218
|
/**
|
|
11196
11219
|
* Apply "transform" style with the current position to camera element
|
|
11197
11220
|
* @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
|
|
11198
|
-
* @chainable
|
|
11199
11221
|
* @return {this}
|
|
11200
11222
|
*/
|
|
11201
11223
|
|
|
@@ -11203,6 +11225,8 @@ version: 4.5.1
|
|
|
11203
11225
|
__proto.applyTransform = function () {
|
|
11204
11226
|
var el = this._el;
|
|
11205
11227
|
var flicking = getFlickingAttached(this._flicking);
|
|
11228
|
+
var renderer = flicking.renderer;
|
|
11229
|
+
if (renderer.rendering) return this;
|
|
11206
11230
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
11207
11231
|
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
11208
11232
|
return this;
|
|
@@ -12395,7 +12419,8 @@ version: 4.5.1
|
|
|
12395
12419
|
align = _b === void 0 ? ALIGN.CENTER : _b,
|
|
12396
12420
|
strategy = _a.strategy;
|
|
12397
12421
|
this._flicking = null;
|
|
12398
|
-
this._panels = [];
|
|
12422
|
+
this._panels = [];
|
|
12423
|
+
this._rendering = false; // Bind options
|
|
12399
12424
|
|
|
12400
12425
|
this._align = align;
|
|
12401
12426
|
this._strategy = strategy;
|
|
@@ -12418,6 +12443,20 @@ version: 4.5.1
|
|
|
12418
12443
|
enumerable: false,
|
|
12419
12444
|
configurable: true
|
|
12420
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
|
+
});
|
|
12421
12460
|
Object.defineProperty(__proto, "panelCount", {
|
|
12422
12461
|
/**
|
|
12423
12462
|
* Count of panels
|
|
@@ -12549,6 +12588,25 @@ version: 4.5.1
|
|
|
12549
12588
|
|
|
12550
12589
|
|
|
12551
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 () {
|
|
12552
12610
|
var _this = this;
|
|
12553
12611
|
|
|
12554
12612
|
var items = [];
|
|
@@ -12559,7 +12617,6 @@ version: 4.5.1
|
|
|
12559
12617
|
|
|
12560
12618
|
var panels = this._panels;
|
|
12561
12619
|
var flicking = getFlickingAttached(this._flicking);
|
|
12562
|
-
var control = flicking.control;
|
|
12563
12620
|
var prevFirstPanel = panels[0];
|
|
12564
12621
|
var align = parsePanelAlign(this._align);
|
|
12565
12622
|
var allPanelsInserted = items.reduce(function (addedPanels, item) {
|
|
@@ -12599,27 +12656,6 @@ version: 4.5.1
|
|
|
12599
12656
|
});
|
|
12600
12657
|
return __spread$1(addedPanels, panelsInserted);
|
|
12601
12658
|
}, []);
|
|
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
12659
|
return allPanelsInserted;
|
|
12624
12660
|
};
|
|
12625
12661
|
/**
|
|
@@ -12636,6 +12672,25 @@ version: 4.5.1
|
|
|
12636
12672
|
|
|
12637
12673
|
|
|
12638
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 () {
|
|
12639
12694
|
var _this = this;
|
|
12640
12695
|
|
|
12641
12696
|
var items = [];
|
|
@@ -12646,10 +12701,8 @@ version: 4.5.1
|
|
|
12646
12701
|
|
|
12647
12702
|
var panels = this._panels;
|
|
12648
12703
|
var flicking = getFlickingAttached(this._flicking);
|
|
12649
|
-
var
|
|
12650
|
-
control = flicking.control;
|
|
12704
|
+
var control = flicking.control;
|
|
12651
12705
|
var activePanel = control.activePanel;
|
|
12652
|
-
var activeIndex = control.activeIndex;
|
|
12653
12706
|
var allPanelsRemoved = items.reduce(function (removed, item) {
|
|
12654
12707
|
var index = item.index,
|
|
12655
12708
|
deleteCount = item.deleteCount;
|
|
@@ -12677,33 +12730,61 @@ version: 4.5.1
|
|
|
12677
12730
|
}
|
|
12678
12731
|
|
|
12679
12732
|
return __spread$1(removed, panelsRemoved);
|
|
12680
|
-
}, []);
|
|
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
|
|
12681
12749
|
|
|
12682
12750
|
this._updateCameraAndControl();
|
|
12683
12751
|
|
|
12684
|
-
void this.render();
|
|
12752
|
+
void this.render();
|
|
12685
12753
|
|
|
12686
|
-
if (
|
|
12687
|
-
|
|
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;
|
|
12688
12760
|
|
|
12689
|
-
|
|
12690
|
-
|
|
12761
|
+
if (targetIndex > panels.length - 1) {
|
|
12762
|
+
targetIndex = panels.length - 1;
|
|
12763
|
+
}
|
|
12764
|
+
|
|
12765
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
12691
12766
|
duration: 0
|
|
12692
12767
|
}).catch(function () {
|
|
12693
12768
|
return void 0;
|
|
12694
12769
|
});
|
|
12695
|
-
} else {
|
|
12696
|
-
// All panels removed
|
|
12697
|
-
camera.lookAt(0);
|
|
12698
12770
|
}
|
|
12771
|
+
} else {
|
|
12772
|
+
void control.moveToPanel(control.activePanel, {
|
|
12773
|
+
duration: 0
|
|
12774
|
+
}).catch(function () {
|
|
12775
|
+
return void 0;
|
|
12776
|
+
});
|
|
12699
12777
|
}
|
|
12700
12778
|
|
|
12701
12779
|
flicking.camera.updateOffset();
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
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
|
+
}
|
|
12707
12788
|
};
|
|
12708
12789
|
/**
|
|
12709
12790
|
* @internal
|
|
@@ -12748,6 +12829,7 @@ version: 4.5.1
|
|
|
12748
12829
|
});
|
|
12749
12830
|
if (!flicking.initialized) return;
|
|
12750
12831
|
camera.updateRange();
|
|
12832
|
+
camera.updateOffset();
|
|
12751
12833
|
camera.updateAnchors();
|
|
12752
12834
|
|
|
12753
12835
|
if (control.animating) ; else {
|
|
@@ -12781,6 +12863,7 @@ version: 4.5.1
|
|
|
12781
12863
|
var camera = flicking.camera,
|
|
12782
12864
|
control = flicking.control;
|
|
12783
12865
|
camera.updateRange();
|
|
12866
|
+
camera.updateOffset();
|
|
12784
12867
|
camera.updateAnchors();
|
|
12785
12868
|
camera.resetNeedPanelHistory();
|
|
12786
12869
|
control.updateInput();
|
|
@@ -14079,10 +14162,14 @@ version: 4.5.1
|
|
|
14079
14162
|
autoResize = _4 === void 0 ? true : _4,
|
|
14080
14163
|
_5 = _b.useResizeObserver,
|
|
14081
14164
|
useResizeObserver = _5 === void 0 ? true : _5,
|
|
14082
|
-
_6 = _b.
|
|
14083
|
-
|
|
14084
|
-
_7 = _b.
|
|
14085
|
-
|
|
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;
|
|
14086
14173
|
|
|
14087
14174
|
var _this = _super.call(this) || this; // Internal states
|
|
14088
14175
|
|
|
@@ -14118,6 +14205,8 @@ version: 4.5.1
|
|
|
14118
14205
|
_this._autoInit = autoInit;
|
|
14119
14206
|
_this._autoResize = autoResize;
|
|
14120
14207
|
_this._useResizeObserver = useResizeObserver;
|
|
14208
|
+
_this._resizeDebounce = resizeDebounce;
|
|
14209
|
+
_this._maxResizeDebounce = maxResizeDebounce;
|
|
14121
14210
|
_this._externalRenderer = externalRenderer;
|
|
14122
14211
|
_this._renderExternal = renderExternal; // Create core components
|
|
14123
14212
|
|
|
@@ -14966,6 +15055,38 @@ version: 4.5.1
|
|
|
14966
15055
|
enumerable: false,
|
|
14967
15056
|
configurable: true
|
|
14968
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
|
+
});
|
|
14969
15090
|
Object.defineProperty(__proto, "externalRenderer", {
|
|
14970
15091
|
/**
|
|
14971
15092
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
@@ -15001,85 +15122,61 @@ version: 4.5.1
|
|
|
15001
15122
|
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
15002
15123
|
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
15003
15124
|
* @fires Flicking#ready
|
|
15004
|
-
* @return {
|
|
15125
|
+
* @return {Promise<void>}
|
|
15005
15126
|
*/
|
|
15006
15127
|
|
|
15007
15128
|
__proto.init = function () {
|
|
15008
|
-
|
|
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
|
-
|
|
15129
|
+
var _this = this;
|
|
15043
15130
|
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
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
|
+
}
|
|
15047
15148
|
|
|
15048
|
-
|
|
15049
|
-
// Look at initial panel
|
|
15050
|
-
_a.sent();
|
|
15149
|
+
this._initialResize(); // Look at initial panel
|
|
15051
15150
|
|
|
15052
|
-
if (this._autoResize) {
|
|
15053
|
-
this._autoResizer.enable();
|
|
15054
|
-
}
|
|
15055
15151
|
|
|
15056
|
-
|
|
15057
|
-
control.controller.addPreventClickHandler();
|
|
15058
|
-
}
|
|
15152
|
+
this._moveToInitialPanel();
|
|
15059
15153
|
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15154
|
+
if (this._autoResize) {
|
|
15155
|
+
this._autoResizer.enable();
|
|
15156
|
+
}
|
|
15063
15157
|
|
|
15064
|
-
|
|
15158
|
+
if (this._preventClickOnDrag) {
|
|
15159
|
+
control.controller.addPreventClickHandler();
|
|
15160
|
+
}
|
|
15065
15161
|
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15162
|
+
if (this._disableOnInit) {
|
|
15163
|
+
this.disableInput();
|
|
15164
|
+
}
|
|
15069
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
|
+
});
|
|
15070
15172
|
|
|
15071
|
-
|
|
15173
|
+
_this._initialized = true;
|
|
15072
15174
|
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15175
|
+
if (preventEventsBeforeInit) {
|
|
15176
|
+
_this.trigger = originalTrigger;
|
|
15177
|
+
}
|
|
15076
15178
|
|
|
15077
|
-
|
|
15078
|
-
return [2
|
|
15079
|
-
/*return*/
|
|
15080
|
-
];
|
|
15081
|
-
}
|
|
15082
|
-
});
|
|
15179
|
+
_this.trigger(new ComponentEvent$1(EVENTS.READY));
|
|
15083
15180
|
});
|
|
15084
15181
|
};
|
|
15085
15182
|
/**
|
|
@@ -15697,7 +15794,7 @@ version: 4.5.1
|
|
|
15697
15794
|
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
15698
15795
|
}
|
|
15699
15796
|
|
|
15700
|
-
return new Camera$1({
|
|
15797
|
+
return new Camera$1(this, {
|
|
15701
15798
|
align: this._align
|
|
15702
15799
|
});
|
|
15703
15800
|
};
|
|
@@ -15733,23 +15830,59 @@ version: 4.5.1
|
|
|
15733
15830
|
};
|
|
15734
15831
|
|
|
15735
15832
|
__proto._moveToInitialPanel = function () {
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
}
|
|
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
|
+
}));
|
|
15753
15886
|
};
|
|
15754
15887
|
/**
|
|
15755
15888
|
* Version info string
|
|
@@ -15763,7 +15896,7 @@ version: 4.5.1
|
|
|
15763
15896
|
*/
|
|
15764
15897
|
|
|
15765
15898
|
|
|
15766
|
-
Flicking.VERSION = "4.
|
|
15899
|
+
Flicking.VERSION = "4.6.0";
|
|
15767
15900
|
return Flicking;
|
|
15768
15901
|
}(Component$1);
|
|
15769
15902
|
|
|
@@ -15803,7 +15936,7 @@ version: 4.5.1
|
|
|
15803
15936
|
var withFlickingMethods = function (prototype, flickingName) {
|
|
15804
15937
|
[Component$1.prototype, Flicking.prototype].forEach(function (proto) {
|
|
15805
15938
|
Object.getOwnPropertyNames(proto).filter(function (name) {
|
|
15806
|
-
return !prototype[name] &&
|
|
15939
|
+
return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
|
|
15807
15940
|
}).forEach(function (name) {
|
|
15808
15941
|
var descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
15809
15942
|
|
|
@@ -15860,6 +15993,9 @@ version: 4.5.1
|
|
|
15860
15993
|
|
|
15861
15994
|
var prevList = __spread$1(diffResult.prevList);
|
|
15862
15995
|
|
|
15996
|
+
var added = [];
|
|
15997
|
+
var removed = [];
|
|
15998
|
+
|
|
15863
15999
|
if (diffResult.removed.length > 0) {
|
|
15864
16000
|
var endIdx_1 = -1;
|
|
15865
16001
|
var prevIdx_1 = -1;
|
|
@@ -15869,7 +16005,7 @@ version: 4.5.1
|
|
|
15869
16005
|
}
|
|
15870
16006
|
|
|
15871
16007
|
if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
|
|
15872
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
16008
|
+
removed.push.apply(removed, __spread$1(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
15873
16009
|
endIdx_1 = removedIdx;
|
|
15874
16010
|
prevIdx_1 = removedIdx;
|
|
15875
16011
|
} else {
|
|
@@ -15878,39 +16014,34 @@ version: 4.5.1
|
|
|
15878
16014
|
|
|
15879
16015
|
prevList.splice(removedIdx, 1);
|
|
15880
16016
|
});
|
|
15881
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
16017
|
+
removed.push.apply(removed, __spread$1(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
15882
16018
|
}
|
|
15883
16019
|
|
|
15884
16020
|
diffResult.ordered.forEach(function (_a) {
|
|
15885
16021
|
var _b = __read$1(_a, 2),
|
|
15886
|
-
|
|
15887
|
-
|
|
16022
|
+
from = _b[0],
|
|
16023
|
+
to = _b[1];
|
|
15888
16024
|
|
|
15889
|
-
var prevPanel = panels[
|
|
15890
|
-
|
|
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
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
prevPanel.resize();
|
|
16025
|
+
var prevPanel = panels.splice(from, 1)[0];
|
|
16026
|
+
panels.splice(to, 0, prevPanel);
|
|
15908
16027
|
});
|
|
15909
16028
|
|
|
15910
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
|
+
});
|
|
15911
16039
|
panels.sort(function (panel1, panel2) {
|
|
15912
16040
|
return panel1.index - panel2.index;
|
|
15913
16041
|
});
|
|
16042
|
+
panels.forEach(function (panel) {
|
|
16043
|
+
panel.updatePosition();
|
|
16044
|
+
});
|
|
15914
16045
|
}
|
|
15915
16046
|
|
|
15916
16047
|
if (diffResult.added.length > 0) {
|
|
@@ -15923,7 +16054,7 @@ version: 4.5.1
|
|
|
15923
16054
|
}
|
|
15924
16055
|
|
|
15925
16056
|
if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
|
|
15926
|
-
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)));
|
|
15927
16058
|
startIdx_1 = -1;
|
|
15928
16059
|
prevIdx_2 = -1;
|
|
15929
16060
|
} else {
|
|
@@ -15932,13 +16063,15 @@ version: 4.5.1
|
|
|
15932
16063
|
});
|
|
15933
16064
|
|
|
15934
16065
|
if (startIdx_1 >= 0) {
|
|
15935
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
|
|
16066
|
+
added.push.apply(added, __spread$1(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
|
|
15936
16067
|
}
|
|
15937
16068
|
}
|
|
16069
|
+
|
|
16070
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
15938
16071
|
});
|
|
15939
16072
|
|
|
15940
16073
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|
|
15941
|
-
renderer.
|
|
16074
|
+
return renderer.batchInsertDefer.apply(renderer, __spread$1(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
|
|
15942
16075
|
return {
|
|
15943
16076
|
index: index,
|
|
15944
16077
|
elements: [addedElements[elIdx]],
|
|
@@ -15949,7 +16082,7 @@ version: 4.5.1
|
|
|
15949
16082
|
|
|
15950
16083
|
var batchRemove = function (renderer, startIdx, endIdx) {
|
|
15951
16084
|
var removed = renderer.panels.slice(startIdx, endIdx);
|
|
15952
|
-
renderer.
|
|
16085
|
+
return renderer.batchRemoveDefer({
|
|
15953
16086
|
index: startIdx,
|
|
15954
16087
|
deleteCount: removed.length,
|
|
15955
16088
|
hasDOMInElements: false
|