@egjs/flicking 4.12.1-beta.2 → 4.12.1-beta.3
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/debug/example/index.html +82 -0
- package/declaration/Flicking.d.ts +3 -2
- package/dist/flicking.cjs.js +40 -13
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +40 -13
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +40 -13
- 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 +43 -31
- 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 +2 -2
- package/src/Flicking.ts +449 -200
- package/src/control/SnapControl.ts +1 -3
- package/src/core/AutoResizer.ts +40 -11
package/dist/flicking.esm.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.12.
|
|
7
|
+
version: 4.12.2-beta.0
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -947,10 +947,25 @@ var Viewport = /*#__PURE__*/function () {
|
|
|
947
947
|
var AutoResizer = /*#__PURE__*/function () {
|
|
948
948
|
function AutoResizer(flicking) {
|
|
949
949
|
var _this = this;
|
|
950
|
-
this._onResize = function () {
|
|
950
|
+
this._onResize = function (entries) {
|
|
951
951
|
var flicking = _this._flicking;
|
|
952
952
|
var resizeDebounce = flicking.resizeDebounce;
|
|
953
953
|
var maxResizeDebounce = flicking.maxResizeDebounce;
|
|
954
|
+
if (entries.length) {
|
|
955
|
+
var resizeEntryInfo = entries[0].contentRect;
|
|
956
|
+
var beforeSize = {
|
|
957
|
+
width: flicking.viewport.width,
|
|
958
|
+
height: flicking.viewport.height
|
|
959
|
+
};
|
|
960
|
+
var afterSize = {
|
|
961
|
+
width: resizeEntryInfo.width,
|
|
962
|
+
height: resizeEntryInfo.height
|
|
963
|
+
};
|
|
964
|
+
// resize 이벤트가 발생했으나 이전과 width, height의 변화가 없다면 이후 로직을 진행하지 않는다.
|
|
965
|
+
if (beforeSize.height === afterSize.height && beforeSize.width === afterSize.width) {
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
954
969
|
if (resizeDebounce <= 0) {
|
|
955
970
|
void flicking.resize();
|
|
956
971
|
} else {
|
|
@@ -976,12 +991,12 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
976
991
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
977
992
|
this._skipFirstResize = function () {
|
|
978
993
|
var isFirstResize = true;
|
|
979
|
-
return function () {
|
|
994
|
+
return function (entries) {
|
|
980
995
|
if (isFirstResize) {
|
|
981
996
|
isFirstResize = false;
|
|
982
997
|
return;
|
|
983
998
|
}
|
|
984
|
-
_this._onResize();
|
|
999
|
+
_this._onResize(entries);
|
|
985
1000
|
};
|
|
986
1001
|
}();
|
|
987
1002
|
this._flicking = flicking;
|
|
@@ -999,6 +1014,7 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
999
1014
|
configurable: true
|
|
1000
1015
|
});
|
|
1001
1016
|
__proto.enable = function () {
|
|
1017
|
+
var _this = this;
|
|
1002
1018
|
var flicking = this._flicking;
|
|
1003
1019
|
var viewport = flicking.viewport;
|
|
1004
1020
|
if (this._enabled) {
|
|
@@ -1006,23 +1022,32 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
1006
1022
|
}
|
|
1007
1023
|
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
1008
1024
|
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
1009
|
-
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(
|
|
1025
|
+
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(function (entries) {
|
|
1026
|
+
return _this._skipFirstResize(entries);
|
|
1027
|
+
}) : new ResizeObserver(function (entries) {
|
|
1028
|
+
return _this._onResize(entries);
|
|
1029
|
+
});
|
|
1010
1030
|
resizeObserver.observe(flicking.viewport.element);
|
|
1011
1031
|
this._resizeObserver = resizeObserver;
|
|
1012
1032
|
} else {
|
|
1013
|
-
window.addEventListener("resize",
|
|
1033
|
+
window.addEventListener("resize", function () {
|
|
1034
|
+
return _this._onResize([]);
|
|
1035
|
+
});
|
|
1014
1036
|
}
|
|
1015
1037
|
this._enabled = true;
|
|
1016
1038
|
return this;
|
|
1017
1039
|
};
|
|
1018
1040
|
__proto.disable = function () {
|
|
1041
|
+
var _this = this;
|
|
1019
1042
|
if (!this._enabled) return this;
|
|
1020
1043
|
var resizeObserver = this._resizeObserver;
|
|
1021
1044
|
if (resizeObserver) {
|
|
1022
1045
|
resizeObserver.disconnect();
|
|
1023
1046
|
this._resizeObserver = null;
|
|
1024
1047
|
} else {
|
|
1025
|
-
window.removeEventListener("resize",
|
|
1048
|
+
window.removeEventListener("resize", function () {
|
|
1049
|
+
return _this._onResize([]);
|
|
1050
|
+
});
|
|
1026
1051
|
}
|
|
1027
1052
|
this._enabled = false;
|
|
1028
1053
|
return this;
|
|
@@ -2913,9 +2938,8 @@ var SnapControl = /*#__PURE__*/function (_super) {
|
|
|
2913
2938
|
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
2914
2939
|
// Move to anchor at position
|
|
2915
2940
|
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
2916
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0
|
|
2941
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
2917
2942
|
// Move to the adjacent panel
|
|
2918
|
-
// console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
|
|
2919
2943
|
targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
|
|
2920
2944
|
} else {
|
|
2921
2945
|
// Fallback to nearest panel from current camera
|
|
@@ -2990,7 +3014,6 @@ var SnapControl = /*#__PURE__*/function (_super) {
|
|
|
2990
3014
|
return anchorIncludePosition;
|
|
2991
3015
|
}
|
|
2992
3016
|
}
|
|
2993
|
-
// console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
|
|
2994
3017
|
var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
|
|
2995
3018
|
return adjacentAnchor;
|
|
2996
3019
|
};
|
|
@@ -6111,6 +6134,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6111
6134
|
// Internal states
|
|
6112
6135
|
_this._initialized = false;
|
|
6113
6136
|
_this._plugins = [];
|
|
6137
|
+
_this._isResizing = false;
|
|
6114
6138
|
// Bind options
|
|
6115
6139
|
_this._align = align;
|
|
6116
6140
|
_this._defaultIndex = defaultIndex;
|
|
@@ -7650,6 +7674,8 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7650
7674
|
return __generator(this, function (_a) {
|
|
7651
7675
|
switch (_a.label) {
|
|
7652
7676
|
case 0:
|
|
7677
|
+
if (this._isResizing) return [2 /*return*/];
|
|
7678
|
+
this._isResizing = true;
|
|
7653
7679
|
viewport = this._viewport;
|
|
7654
7680
|
renderer = this._renderer;
|
|
7655
7681
|
camera = this._camera;
|
|
@@ -7702,6 +7728,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7702
7728
|
sizeChanged: sizeChanged,
|
|
7703
7729
|
element: viewport.element
|
|
7704
7730
|
}));
|
|
7731
|
+
this._isResizing = false;
|
|
7705
7732
|
return [2 /*return*/];
|
|
7706
7733
|
}
|
|
7707
7734
|
});
|
|
@@ -7829,7 +7856,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7829
7856
|
__proto._createCamera = function () {
|
|
7830
7857
|
if (this._circular && this._bound) {
|
|
7831
7858
|
// eslint-disable-next-line no-console
|
|
7832
|
-
console.warn("
|
|
7859
|
+
console.warn('"circular" and "bound" option cannot be used together, ignoring bound.');
|
|
7833
7860
|
}
|
|
7834
7861
|
return new Camera(this, {
|
|
7835
7862
|
align: this._align
|
|
@@ -7839,7 +7866,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7839
7866
|
var externalRenderer = this._externalRenderer;
|
|
7840
7867
|
if (this._virtual && this._panelsPerView <= 0) {
|
|
7841
7868
|
// eslint-disable-next-line no-console
|
|
7842
|
-
console.warn("
|
|
7869
|
+
console.warn('"virtual" and "panelsPerView" option should be used together, ignoring virtual.');
|
|
7843
7870
|
}
|
|
7844
7871
|
return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
|
|
7845
7872
|
};
|
|
@@ -7921,7 +7948,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7921
7948
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7922
7949
|
* ```
|
|
7923
7950
|
*/
|
|
7924
|
-
Flicking.VERSION = "4.12.
|
|
7951
|
+
Flicking.VERSION = "4.12.2-beta.0";
|
|
7925
7952
|
return Flicking;
|
|
7926
7953
|
}(Component);
|
|
7927
7954
|
|