@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
|
@@ -53,6 +53,8 @@ export interface FlickingOptions {
|
|
|
53
53
|
moveType: ValueOf<typeof MOVE_TYPE> | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
|
|
54
54
|
threshold: number;
|
|
55
55
|
dragThreshold: number;
|
|
56
|
+
animationThreshold: number;
|
|
57
|
+
useCSSOrder: boolean;
|
|
56
58
|
interruptable: boolean;
|
|
57
59
|
bounce: number | string | [number | string, number | string];
|
|
58
60
|
iOSEdgeSwipeThreshold: number;
|
|
@@ -105,6 +107,8 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
105
107
|
private _moveType;
|
|
106
108
|
private _threshold;
|
|
107
109
|
private _dragThreshold;
|
|
110
|
+
private _animationThreshold;
|
|
111
|
+
private _useCSSOrder;
|
|
108
112
|
private _interruptable;
|
|
109
113
|
private _bounce;
|
|
110
114
|
private _iOSEdgeSwipeThreshold;
|
|
@@ -126,6 +130,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
126
130
|
private _initialized;
|
|
127
131
|
private _plugins;
|
|
128
132
|
private _isResizing;
|
|
133
|
+
private _scheduleResize;
|
|
129
134
|
get control(): Control;
|
|
130
135
|
get camera(): Camera;
|
|
131
136
|
get renderer(): Renderer;
|
|
@@ -166,6 +171,8 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
166
171
|
get moveType(): FlickingOptions["moveType"];
|
|
167
172
|
get threshold(): FlickingOptions["threshold"];
|
|
168
173
|
get dragThreshold(): FlickingOptions["dragThreshold"];
|
|
174
|
+
get animationThreshold(): FlickingOptions["animationThreshold"];
|
|
175
|
+
get useCSSOrder(): FlickingOptions["useCSSOrder"];
|
|
169
176
|
get interruptable(): FlickingOptions["interruptable"];
|
|
170
177
|
get bounce(): FlickingOptions["bounce"];
|
|
171
178
|
get iOSEdgeSwipeThreshold(): FlickingOptions["iOSEdgeSwipeThreshold"];
|
|
@@ -207,6 +214,8 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
207
214
|
set moveType(val: FlickingOptions["moveType"]);
|
|
208
215
|
set threshold(val: FlickingOptions["threshold"]);
|
|
209
216
|
set dragThreshold(val: FlickingOptions["dragThreshold"]);
|
|
217
|
+
set animationThreshold(val: FlickingOptions["animationThreshold"]);
|
|
218
|
+
set useCSSOrder(val: FlickingOptions["useCSSOrder"]);
|
|
210
219
|
set interruptable(val: FlickingOptions["interruptable"]);
|
|
211
220
|
set bounce(val: FlickingOptions["bounce"]);
|
|
212
221
|
set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]);
|
|
@@ -219,7 +228,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
219
228
|
set useResizeObserver(val: FlickingOptions["useResizeObserver"]);
|
|
220
229
|
set observePanelResize(val: FlickingOptions["observePanelResize"]);
|
|
221
230
|
set optimizeSizeUpdate(val: FlickingOptions["optimizeSizeUpdate"]);
|
|
222
|
-
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, dragThreshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, preventDefaultOnDrag, disableOnInit, changeOnHold, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, observePanelResize, maxResizeDebounce, useFractionalSize, externalRenderer, renderExternal, optimizeSizeUpdate }?: Partial<FlickingOptions>);
|
|
231
|
+
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, dragThreshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, preventDefaultOnDrag, disableOnInit, changeOnHold, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, observePanelResize, maxResizeDebounce, useFractionalSize, externalRenderer, renderExternal, optimizeSizeUpdate, animationThreshold, useCSSOrder, }?: Partial<FlickingOptions>);
|
|
223
232
|
init(): Promise<void>;
|
|
224
233
|
destroy(): void;
|
|
225
234
|
prev(duration?: number): Promise<void>;
|
package/dist/flicking.cjs.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
|
'use strict';
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
27
27
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
28
|
PERFORMANCE OF THIS SOFTWARE.
|
|
29
29
|
***************************************************************************** */
|
|
30
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
30
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
31
31
|
|
|
32
32
|
var extendStatics = function (d, b) {
|
|
33
33
|
extendStatics = Object.setPrototypeOf || {
|
|
@@ -97,8 +97,12 @@ function __generator(thisArg, body) {
|
|
|
97
97
|
f,
|
|
98
98
|
y,
|
|
99
99
|
t,
|
|
100
|
-
g
|
|
101
|
-
return g
|
|
100
|
+
g;
|
|
101
|
+
return g = {
|
|
102
|
+
next: verb(0),
|
|
103
|
+
"throw": verb(1),
|
|
104
|
+
"return": verb(2)
|
|
105
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
102
106
|
return this;
|
|
103
107
|
}), g;
|
|
104
108
|
function verb(n) {
|
|
@@ -2445,8 +2449,8 @@ var AxesController = /*#__PURE__*/function () {
|
|
|
2445
2449
|
});
|
|
2446
2450
|
};
|
|
2447
2451
|
/**
|
|
2448
|
-
*
|
|
2449
|
-
* @
|
|
2452
|
+
* Returns the current axes position
|
|
2453
|
+
* @ko 현재 axes의 position을 반환합니다.
|
|
2450
2454
|
*/
|
|
2451
2455
|
__proto.getCurrentPosition = function () {
|
|
2452
2456
|
var _a, _b;
|
|
@@ -2794,7 +2798,7 @@ var Control = /*#__PURE__*/function () {
|
|
|
2794
2798
|
return __generator(this, function (_b) {
|
|
2795
2799
|
flicking = getFlickingAttached(this._flicking);
|
|
2796
2800
|
nextDuration = duration;
|
|
2797
|
-
if (Math.abs(nextDuration - position) <
|
|
2801
|
+
if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
|
|
2798
2802
|
nextDuration = 0;
|
|
2799
2803
|
}
|
|
2800
2804
|
animate = function () {
|
|
@@ -2828,6 +2832,7 @@ var Control = /*#__PURE__*/function () {
|
|
|
2828
2832
|
});
|
|
2829
2833
|
});
|
|
2830
2834
|
};
|
|
2835
|
+
|
|
2831
2836
|
__proto._getPosition = function (panel, direction) {
|
|
2832
2837
|
if (direction === void 0) {
|
|
2833
2838
|
direction = DIRECTION.NONE;
|
|
@@ -4753,6 +4758,17 @@ var Renderer = /*#__PURE__*/function () {
|
|
|
4753
4758
|
});
|
|
4754
4759
|
return Promise.resolve();
|
|
4755
4760
|
};
|
|
4761
|
+
/**
|
|
4762
|
+
* Return Rendered Panels
|
|
4763
|
+
* @ko 렌더링이 된 패널을 반환합니다.
|
|
4764
|
+
* @return {Panel[]}
|
|
4765
|
+
*/
|
|
4766
|
+
__proto.getRenderedPanels = function () {
|
|
4767
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4768
|
+
return flicking.renderer.panels.filter(function (panel) {
|
|
4769
|
+
return panel.rendered;
|
|
4770
|
+
});
|
|
4771
|
+
};
|
|
4756
4772
|
/**
|
|
4757
4773
|
* Update all panel sizes
|
|
4758
4774
|
* @ko 모든 패널의 크기를 업데이트합니다
|
|
@@ -5113,6 +5129,13 @@ var Renderer = /*#__PURE__*/function () {
|
|
|
5113
5129
|
__proto._afterRender = function () {
|
|
5114
5130
|
var flicking = getFlickingAttached(this._flicking);
|
|
5115
5131
|
flicking.camera.applyTransform();
|
|
5132
|
+
if (flicking.useCSSOrder) {
|
|
5133
|
+
// useCSSOrder를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
|
|
5134
|
+
var panels_1 = flicking.panels;
|
|
5135
|
+
this._strategy.getRenderingIndexesByOrder(flicking).forEach(function (domIndex, index) {
|
|
5136
|
+
panels_1[domIndex].element.style.order = "" + index;
|
|
5137
|
+
});
|
|
5138
|
+
}
|
|
5116
5139
|
};
|
|
5117
5140
|
return Renderer;
|
|
5118
5141
|
}();
|
|
@@ -5141,6 +5164,7 @@ var VanillaRenderer = /*#__PURE__*/function (_super) {
|
|
|
5141
5164
|
});
|
|
5142
5165
|
});
|
|
5143
5166
|
};
|
|
5167
|
+
|
|
5144
5168
|
__proto._collectPanels = function () {
|
|
5145
5169
|
var flicking = getFlickingAttached(this._flicking);
|
|
5146
5170
|
var camera = flicking.camera;
|
|
@@ -5154,7 +5178,15 @@ var VanillaRenderer = /*#__PURE__*/function (_super) {
|
|
|
5154
5178
|
var flicking = getFlickingAttached(this._flicking);
|
|
5155
5179
|
var cameraEl = flicking.camera.element;
|
|
5156
5180
|
// We're using reversed panels here as last panel should be the last element of camera element
|
|
5157
|
-
var reversedElements =
|
|
5181
|
+
var reversedElements = [];
|
|
5182
|
+
if (flicking.useCSSOrder) {
|
|
5183
|
+
// useCSSOrder를 사용하는 경우 원본 그대로 렌더링
|
|
5184
|
+
reversedElements = this.getRenderedPanels().map(function (panel) {
|
|
5185
|
+
return panel.element;
|
|
5186
|
+
}).reverse();
|
|
5187
|
+
} else {
|
|
5188
|
+
reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
|
|
5189
|
+
}
|
|
5158
5190
|
reversedElements.forEach(function (el, idx) {
|
|
5159
5191
|
var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
|
|
5160
5192
|
if (el.nextElementSibling !== nextEl) {
|
|
@@ -6217,8 +6249,13 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6217
6249
|
_15 = _b.renderExternal,
|
|
6218
6250
|
renderExternal = _15 === void 0 ? null : _15,
|
|
6219
6251
|
_16 = _b.optimizeSizeUpdate,
|
|
6220
|
-
optimizeSizeUpdate = _16 === void 0 ? false : _16
|
|
6252
|
+
optimizeSizeUpdate = _16 === void 0 ? false : _16,
|
|
6253
|
+
_17 = _b.animationThreshold,
|
|
6254
|
+
animationThreshold = _17 === void 0 ? 0.5 : _17,
|
|
6255
|
+
_18 = _b.useCSSOrder,
|
|
6256
|
+
useCSSOrder = _18 === void 0 ? false : _18;
|
|
6221
6257
|
var _this = _super.call(this) || this;
|
|
6258
|
+
_this._scheduleResize = false;
|
|
6222
6259
|
// Internal states
|
|
6223
6260
|
_this._initialized = false;
|
|
6224
6261
|
_this._plugins = [];
|
|
@@ -6263,6 +6300,8 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6263
6300
|
_this._externalRenderer = externalRenderer;
|
|
6264
6301
|
_this._renderExternal = renderExternal;
|
|
6265
6302
|
_this._optimizeSizeUpdate = optimizeSizeUpdate;
|
|
6303
|
+
_this._animationThreshold = animationThreshold;
|
|
6304
|
+
_this._useCSSOrder = useCSSOrder;
|
|
6266
6305
|
// Create core components
|
|
6267
6306
|
_this._viewport = new Viewport(_this, getElement(root));
|
|
6268
6307
|
_this._autoResizer = new AutoResizer(_this);
|
|
@@ -6974,6 +7013,44 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6974
7013
|
enumerable: false,
|
|
6975
7014
|
configurable: true
|
|
6976
7015
|
});
|
|
7016
|
+
Object.defineProperty(__proto, "animationThreshold", {
|
|
7017
|
+
/**
|
|
7018
|
+
* 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).
|
|
7019
|
+
* @ko animation이 진행되기 위한 최소한의 거리. 이동하려는 거리가 `animationThreshold`보다 적으면 애니메이션 없이(duration: 0) 즉시 이동한다.
|
|
7020
|
+
* @type {number}
|
|
7021
|
+
* @default 0.5
|
|
7022
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#animationThreshold animationThreshold ( Options )}
|
|
7023
|
+
*/
|
|
7024
|
+
get: function () {
|
|
7025
|
+
return this._animationThreshold;
|
|
7026
|
+
},
|
|
7027
|
+
set: function (val) {
|
|
7028
|
+
this._animationThreshold = val;
|
|
7029
|
+
},
|
|
7030
|
+
enumerable: false,
|
|
7031
|
+
configurable: true
|
|
7032
|
+
});
|
|
7033
|
+
Object.defineProperty(__proto, "useCSSOrder", {
|
|
7034
|
+
/**
|
|
7035
|
+
* 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.)
|
|
7036
|
+
* When using `iframe`, you can prevent reloading when the DOM order changes.
|
|
7037
|
+
* In svelte, CSS order is always used.
|
|
7038
|
+
* @ko `useCSSOrder`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다. (`circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다.)
|
|
7039
|
+
* `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
|
|
7040
|
+
* svelte에서는 css order를 무조건 사용한다.
|
|
7041
|
+
* @type {boolean}
|
|
7042
|
+
* @default false
|
|
7043
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrder useCSSOrder ( Options )}
|
|
7044
|
+
*/
|
|
7045
|
+
get: function () {
|
|
7046
|
+
return this._useCSSOrder;
|
|
7047
|
+
},
|
|
7048
|
+
set: function (val) {
|
|
7049
|
+
this._useCSSOrder = val;
|
|
7050
|
+
},
|
|
7051
|
+
enumerable: false,
|
|
7052
|
+
configurable: true
|
|
7053
|
+
});
|
|
6977
7054
|
Object.defineProperty(__proto, "interruptable", {
|
|
6978
7055
|
/**
|
|
6979
7056
|
* Set animation to be interruptable by click/touch.
|
|
@@ -7456,7 +7533,9 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7456
7533
|
this._plugins.forEach(function (plugin) {
|
|
7457
7534
|
return plugin.destroy();
|
|
7458
7535
|
});
|
|
7536
|
+
this._scheduleResize = false;
|
|
7459
7537
|
this._initialized = false;
|
|
7538
|
+
this._isResizing = false;
|
|
7460
7539
|
};
|
|
7461
7540
|
/**
|
|
7462
7541
|
* Move to the previous panel (current index - 1)
|
|
@@ -7821,7 +7900,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7821
7900
|
* @method
|
|
7822
7901
|
* @fires Flicking#beforeResize
|
|
7823
7902
|
* @fires Flicking#afterResize
|
|
7824
|
-
* @return {
|
|
7903
|
+
* @return {boolean}
|
|
7825
7904
|
*/
|
|
7826
7905
|
__proto.resize = function () {
|
|
7827
7906
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -7829,7 +7908,16 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7829
7908
|
return __generator(this, function (_a) {
|
|
7830
7909
|
switch (_a.label) {
|
|
7831
7910
|
case 0:
|
|
7832
|
-
if (this.
|
|
7911
|
+
if (!this._initialized) {
|
|
7912
|
+
return [2 /*return*/];
|
|
7913
|
+
}
|
|
7914
|
+
|
|
7915
|
+
if (this._isResizing) {
|
|
7916
|
+
this._scheduleResize = true;
|
|
7917
|
+
return [2 /*return*/];
|
|
7918
|
+
}
|
|
7919
|
+
|
|
7920
|
+
this._scheduleResize = false;
|
|
7833
7921
|
this._isResizing = true;
|
|
7834
7922
|
viewport = this._viewport;
|
|
7835
7923
|
renderer = this._renderer;
|
|
@@ -7862,6 +7950,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7862
7950
|
if (!this._initialized) {
|
|
7863
7951
|
return [2 /*return*/];
|
|
7864
7952
|
}
|
|
7953
|
+
|
|
7865
7954
|
renderer.updatePanelSize();
|
|
7866
7955
|
camera.updateAlignPos();
|
|
7867
7956
|
camera.updateRange();
|
|
@@ -7875,6 +7964,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7875
7964
|
if (!this._initialized) {
|
|
7876
7965
|
return [2 /*return*/];
|
|
7877
7966
|
}
|
|
7967
|
+
|
|
7878
7968
|
if (control.animating) ; else {
|
|
7879
7969
|
control.updatePosition(prevProgressInPanel);
|
|
7880
7970
|
control.updateInput();
|
|
@@ -7893,6 +7983,9 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7893
7983
|
element: viewport.element
|
|
7894
7984
|
}));
|
|
7895
7985
|
this._isResizing = false;
|
|
7986
|
+
if (this._scheduleResize) {
|
|
7987
|
+
this.resize();
|
|
7988
|
+
}
|
|
7896
7989
|
return [2 /*return*/];
|
|
7897
7990
|
}
|
|
7898
7991
|
});
|
|
@@ -8112,7 +8205,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
8112
8205
|
* Flicking.VERSION; // ex) 4.0.0
|
|
8113
8206
|
* ```
|
|
8114
8207
|
*/
|
|
8115
|
-
Flicking.VERSION = "4.14.2-beta.
|
|
8208
|
+
Flicking.VERSION = "4.14.2-beta.2";
|
|
8116
8209
|
return Flicking;
|
|
8117
8210
|
}(Component);
|
|
8118
8211
|
|
|
@@ -8628,13 +8721,16 @@ var getRenderingPanels = (function (flicking, diffResult) {
|
|
|
8628
8721
|
map[prev] = current;
|
|
8629
8722
|
return map;
|
|
8630
8723
|
}, {});
|
|
8631
|
-
|
|
8724
|
+
var renderingPanels = flicking.panels.filter(function (panel) {
|
|
8632
8725
|
return !removedPanels[panel.index];
|
|
8633
|
-
})
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8726
|
+
});
|
|
8727
|
+
if (!flicking.useCSSOrder) {
|
|
8728
|
+
// useCSSOrder를 사용하게 되는 경우 sort를 하지 않는다.
|
|
8729
|
+
renderingPanels.sort(function (panel1, panel2) {
|
|
8730
|
+
return panel1.position + panel1.offset - (panel2.position + panel2.offset);
|
|
8731
|
+
});
|
|
8732
|
+
}
|
|
8733
|
+
return __spread(renderingPanels.map(function (panel) {
|
|
8638
8734
|
return diffResult.list[maintainedMap[panel.index]];
|
|
8639
8735
|
}), diffResult.added.map(function (idx) {
|
|
8640
8736
|
return diffResult.list[idx];
|