@egjs/flicking 4.14.2-beta.0 → 4.14.2-beta.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.
- package/declaration/Flicking.d.ts +10 -1
- package/declaration/renderer/Renderer.d.ts +1 -0
- package/dist/flicking.cjs.js +114 -18
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +114 -18
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +114 -18
- 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 +165 -69
- 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 +1 -1
- package/src/Flicking.ts +60 -6
- package/src/cfc/getRenderingPanels.ts +9 -5
- package/src/control/AxesController.ts +2 -2
- package/src/control/Control.ts +1 -1
- package/src/renderer/Renderer.ts +20 -0
- package/src/renderer/VanillaRenderer.ts +11 -3
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.14.2-beta.
|
|
7
|
+
version: 4.14.2-beta.2
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -25,7 +25,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
25
25
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27
27
|
***************************************************************************** */
|
|
28
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
28
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
29
29
|
|
|
30
30
|
var extendStatics = function (d, b) {
|
|
31
31
|
extendStatics = Object.setPrototypeOf || {
|
|
@@ -95,8 +95,12 @@ function __generator(thisArg, body) {
|
|
|
95
95
|
f,
|
|
96
96
|
y,
|
|
97
97
|
t,
|
|
98
|
-
g
|
|
99
|
-
return g
|
|
98
|
+
g;
|
|
99
|
+
return g = {
|
|
100
|
+
next: verb(0),
|
|
101
|
+
"throw": verb(1),
|
|
102
|
+
"return": verb(2)
|
|
103
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
100
104
|
return this;
|
|
101
105
|
}), g;
|
|
102
106
|
function verb(n) {
|
|
@@ -2443,8 +2447,8 @@ var AxesController = /*#__PURE__*/function () {
|
|
|
2443
2447
|
});
|
|
2444
2448
|
};
|
|
2445
2449
|
/**
|
|
2446
|
-
*
|
|
2447
|
-
* @
|
|
2450
|
+
* Returns the current axes position
|
|
2451
|
+
* @ko 현재 axes의 position을 반환합니다.
|
|
2448
2452
|
*/
|
|
2449
2453
|
__proto.getCurrentPosition = function () {
|
|
2450
2454
|
var _a, _b;
|
|
@@ -2792,7 +2796,7 @@ var Control = /*#__PURE__*/function () {
|
|
|
2792
2796
|
return __generator(this, function (_b) {
|
|
2793
2797
|
flicking = getFlickingAttached(this._flicking);
|
|
2794
2798
|
nextDuration = duration;
|
|
2795
|
-
if (Math.abs(nextDuration - position) <
|
|
2799
|
+
if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
|
|
2796
2800
|
nextDuration = 0;
|
|
2797
2801
|
}
|
|
2798
2802
|
animate = function () {
|
|
@@ -2826,6 +2830,7 @@ var Control = /*#__PURE__*/function () {
|
|
|
2826
2830
|
});
|
|
2827
2831
|
});
|
|
2828
2832
|
};
|
|
2833
|
+
|
|
2829
2834
|
__proto._getPosition = function (panel, direction) {
|
|
2830
2835
|
if (direction === void 0) {
|
|
2831
2836
|
direction = DIRECTION.NONE;
|
|
@@ -4751,6 +4756,17 @@ var Renderer = /*#__PURE__*/function () {
|
|
|
4751
4756
|
});
|
|
4752
4757
|
return Promise.resolve();
|
|
4753
4758
|
};
|
|
4759
|
+
/**
|
|
4760
|
+
* Return Rendered Panels
|
|
4761
|
+
* @ko 렌더링이 된 패널을 반환합니다.
|
|
4762
|
+
* @return {Panel[]}
|
|
4763
|
+
*/
|
|
4764
|
+
__proto.getRenderedPanels = function () {
|
|
4765
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4766
|
+
return flicking.renderer.panels.filter(function (panel) {
|
|
4767
|
+
return panel.rendered;
|
|
4768
|
+
});
|
|
4769
|
+
};
|
|
4754
4770
|
/**
|
|
4755
4771
|
* Update all panel sizes
|
|
4756
4772
|
* @ko 모든 패널의 크기를 업데이트합니다
|
|
@@ -5111,6 +5127,13 @@ var Renderer = /*#__PURE__*/function () {
|
|
|
5111
5127
|
__proto._afterRender = function () {
|
|
5112
5128
|
var flicking = getFlickingAttached(this._flicking);
|
|
5113
5129
|
flicking.camera.applyTransform();
|
|
5130
|
+
if (flicking.useCSSOrder) {
|
|
5131
|
+
// useCSSOrder를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
|
|
5132
|
+
var panels_1 = flicking.panels;
|
|
5133
|
+
this._strategy.getRenderingIndexesByOrder(flicking).forEach(function (domIndex, index) {
|
|
5134
|
+
panels_1[domIndex].element.style.order = "" + index;
|
|
5135
|
+
});
|
|
5136
|
+
}
|
|
5114
5137
|
};
|
|
5115
5138
|
return Renderer;
|
|
5116
5139
|
}();
|
|
@@ -5139,6 +5162,7 @@ var VanillaRenderer = /*#__PURE__*/function (_super) {
|
|
|
5139
5162
|
});
|
|
5140
5163
|
});
|
|
5141
5164
|
};
|
|
5165
|
+
|
|
5142
5166
|
__proto._collectPanels = function () {
|
|
5143
5167
|
var flicking = getFlickingAttached(this._flicking);
|
|
5144
5168
|
var camera = flicking.camera;
|
|
@@ -5152,7 +5176,15 @@ var VanillaRenderer = /*#__PURE__*/function (_super) {
|
|
|
5152
5176
|
var flicking = getFlickingAttached(this._flicking);
|
|
5153
5177
|
var cameraEl = flicking.camera.element;
|
|
5154
5178
|
// We're using reversed panels here as last panel should be the last element of camera element
|
|
5155
|
-
var reversedElements =
|
|
5179
|
+
var reversedElements = [];
|
|
5180
|
+
if (flicking.useCSSOrder) {
|
|
5181
|
+
// useCSSOrder를 사용하는 경우 원본 그대로 렌더링
|
|
5182
|
+
reversedElements = this.getRenderedPanels().map(function (panel) {
|
|
5183
|
+
return panel.element;
|
|
5184
|
+
}).reverse();
|
|
5185
|
+
} else {
|
|
5186
|
+
reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
|
|
5187
|
+
}
|
|
5156
5188
|
reversedElements.forEach(function (el, idx) {
|
|
5157
5189
|
var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
|
|
5158
5190
|
if (el.nextElementSibling !== nextEl) {
|
|
@@ -6215,8 +6247,13 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6215
6247
|
_15 = _b.renderExternal,
|
|
6216
6248
|
renderExternal = _15 === void 0 ? null : _15,
|
|
6217
6249
|
_16 = _b.optimizeSizeUpdate,
|
|
6218
|
-
optimizeSizeUpdate = _16 === void 0 ? false : _16
|
|
6250
|
+
optimizeSizeUpdate = _16 === void 0 ? false : _16,
|
|
6251
|
+
_17 = _b.animationThreshold,
|
|
6252
|
+
animationThreshold = _17 === void 0 ? 0.5 : _17,
|
|
6253
|
+
_18 = _b.useCSSOrder,
|
|
6254
|
+
useCSSOrder = _18 === void 0 ? false : _18;
|
|
6219
6255
|
var _this = _super.call(this) || this;
|
|
6256
|
+
_this._scheduleResize = false;
|
|
6220
6257
|
// Internal states
|
|
6221
6258
|
_this._initialized = false;
|
|
6222
6259
|
_this._plugins = [];
|
|
@@ -6261,6 +6298,8 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6261
6298
|
_this._externalRenderer = externalRenderer;
|
|
6262
6299
|
_this._renderExternal = renderExternal;
|
|
6263
6300
|
_this._optimizeSizeUpdate = optimizeSizeUpdate;
|
|
6301
|
+
_this._animationThreshold = animationThreshold;
|
|
6302
|
+
_this._useCSSOrder = useCSSOrder;
|
|
6264
6303
|
// Create core components
|
|
6265
6304
|
_this._viewport = new Viewport(_this, getElement(root));
|
|
6266
6305
|
_this._autoResizer = new AutoResizer(_this);
|
|
@@ -6972,6 +7011,44 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6972
7011
|
enumerable: false,
|
|
6973
7012
|
configurable: true
|
|
6974
7013
|
});
|
|
7014
|
+
Object.defineProperty(__proto, "animationThreshold", {
|
|
7015
|
+
/**
|
|
7016
|
+
* The minimum distance for animation to proceed. If the distance to be moved is less than `animationThreshold`, the movement proceeds immediately without animation (duration: 0).
|
|
7017
|
+
* @ko animation이 진행되기 위한 최소한의 거리. 이동하려는 거리가 `animationThreshold`보다 적으면 애니메이션 없이(duration: 0) 즉시 이동한다.
|
|
7018
|
+
* @type {number}
|
|
7019
|
+
* @default 0.5
|
|
7020
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#animationThreshold animationThreshold ( Options )}
|
|
7021
|
+
*/
|
|
7022
|
+
get: function () {
|
|
7023
|
+
return this._animationThreshold;
|
|
7024
|
+
},
|
|
7025
|
+
set: function (val) {
|
|
7026
|
+
this._animationThreshold = val;
|
|
7027
|
+
},
|
|
7028
|
+
enumerable: false,
|
|
7029
|
+
configurable: true
|
|
7030
|
+
});
|
|
7031
|
+
Object.defineProperty(__proto, "useCSSOrder", {
|
|
7032
|
+
/**
|
|
7033
|
+
* Using `useCSSOrder` does not change the DOM order, but the `order` CSS property changes the order on the screen. (When `circular` is used, the DOM order changes depending on the position.)
|
|
7034
|
+
* When using `iframe`, you can prevent reloading when the DOM order changes.
|
|
7035
|
+
* In svelte, CSS order is always used.
|
|
7036
|
+
* @ko `useCSSOrder`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다. (`circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다.)
|
|
7037
|
+
* `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
|
|
7038
|
+
* svelte에서는 css order를 무조건 사용한다.
|
|
7039
|
+
* @type {boolean}
|
|
7040
|
+
* @default false
|
|
7041
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrder useCSSOrder ( Options )}
|
|
7042
|
+
*/
|
|
7043
|
+
get: function () {
|
|
7044
|
+
return this._useCSSOrder;
|
|
7045
|
+
},
|
|
7046
|
+
set: function (val) {
|
|
7047
|
+
this._useCSSOrder = val;
|
|
7048
|
+
},
|
|
7049
|
+
enumerable: false,
|
|
7050
|
+
configurable: true
|
|
7051
|
+
});
|
|
6975
7052
|
Object.defineProperty(__proto, "interruptable", {
|
|
6976
7053
|
/**
|
|
6977
7054
|
* Set animation to be interruptable by click/touch.
|
|
@@ -7454,7 +7531,9 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7454
7531
|
this._plugins.forEach(function (plugin) {
|
|
7455
7532
|
return plugin.destroy();
|
|
7456
7533
|
});
|
|
7534
|
+
this._scheduleResize = false;
|
|
7457
7535
|
this._initialized = false;
|
|
7536
|
+
this._isResizing = false;
|
|
7458
7537
|
};
|
|
7459
7538
|
/**
|
|
7460
7539
|
* Move to the previous panel (current index - 1)
|
|
@@ -7819,7 +7898,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7819
7898
|
* @method
|
|
7820
7899
|
* @fires Flicking#beforeResize
|
|
7821
7900
|
* @fires Flicking#afterResize
|
|
7822
|
-
* @return {
|
|
7901
|
+
* @return {boolean}
|
|
7823
7902
|
*/
|
|
7824
7903
|
__proto.resize = function () {
|
|
7825
7904
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -7827,7 +7906,16 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7827
7906
|
return __generator(this, function (_a) {
|
|
7828
7907
|
switch (_a.label) {
|
|
7829
7908
|
case 0:
|
|
7830
|
-
if (this.
|
|
7909
|
+
if (!this._initialized) {
|
|
7910
|
+
return [2 /*return*/];
|
|
7911
|
+
}
|
|
7912
|
+
|
|
7913
|
+
if (this._isResizing) {
|
|
7914
|
+
this._scheduleResize = true;
|
|
7915
|
+
return [2 /*return*/];
|
|
7916
|
+
}
|
|
7917
|
+
|
|
7918
|
+
this._scheduleResize = false;
|
|
7831
7919
|
this._isResizing = true;
|
|
7832
7920
|
viewport = this._viewport;
|
|
7833
7921
|
renderer = this._renderer;
|
|
@@ -7860,6 +7948,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7860
7948
|
if (!this._initialized) {
|
|
7861
7949
|
return [2 /*return*/];
|
|
7862
7950
|
}
|
|
7951
|
+
|
|
7863
7952
|
renderer.updatePanelSize();
|
|
7864
7953
|
camera.updateAlignPos();
|
|
7865
7954
|
camera.updateRange();
|
|
@@ -7873,6 +7962,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7873
7962
|
if (!this._initialized) {
|
|
7874
7963
|
return [2 /*return*/];
|
|
7875
7964
|
}
|
|
7965
|
+
|
|
7876
7966
|
if (control.animating) ; else {
|
|
7877
7967
|
control.updatePosition(prevProgressInPanel);
|
|
7878
7968
|
control.updateInput();
|
|
@@ -7891,6 +7981,9 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7891
7981
|
element: viewport.element
|
|
7892
7982
|
}));
|
|
7893
7983
|
this._isResizing = false;
|
|
7984
|
+
if (this._scheduleResize) {
|
|
7985
|
+
this.resize();
|
|
7986
|
+
}
|
|
7894
7987
|
return [2 /*return*/];
|
|
7895
7988
|
}
|
|
7896
7989
|
});
|
|
@@ -8110,7 +8203,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
8110
8203
|
* Flicking.VERSION; // ex) 4.0.0
|
|
8111
8204
|
* ```
|
|
8112
8205
|
*/
|
|
8113
|
-
Flicking.VERSION = "4.14.2-beta.
|
|
8206
|
+
Flicking.VERSION = "4.14.2-beta.2";
|
|
8114
8207
|
return Flicking;
|
|
8115
8208
|
}(Component);
|
|
8116
8209
|
|
|
@@ -8626,13 +8719,16 @@ var getRenderingPanels = (function (flicking, diffResult) {
|
|
|
8626
8719
|
map[prev] = current;
|
|
8627
8720
|
return map;
|
|
8628
8721
|
}, {});
|
|
8629
|
-
|
|
8722
|
+
var renderingPanels = flicking.panels.filter(function (panel) {
|
|
8630
8723
|
return !removedPanels[panel.index];
|
|
8631
|
-
})
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8724
|
+
});
|
|
8725
|
+
if (!flicking.useCSSOrder) {
|
|
8726
|
+
// useCSSOrder를 사용하게 되는 경우 sort를 하지 않는다.
|
|
8727
|
+
renderingPanels.sort(function (panel1, panel2) {
|
|
8728
|
+
return panel1.position + panel1.offset - (panel2.position + panel2.offset);
|
|
8729
|
+
});
|
|
8730
|
+
}
|
|
8731
|
+
return __spread(renderingPanels.map(function (panel) {
|
|
8636
8732
|
return diffResult.list[maintainedMap[panel.index]];
|
|
8637
8733
|
}), diffResult.added.map(function (idx) {
|
|
8638
8734
|
return diffResult.list[idx];
|