@egjs/flicking 4.14.1 → 4.14.2-beta.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/declaration/Flicking.d.ts +9 -1
- package/declaration/control/AxesController.d.ts +1 -0
- package/declaration/renderer/Renderer.d.ts +1 -0
- package/dist/flicking.cjs.js +115 -19
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +115 -19
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +115 -19
- 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 +166 -70
- 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 +39 -1
- package/src/cfc/getRenderingPanels.ts +9 -5
- package/src/control/AxesController.ts +9 -1
- package/src/control/Control.ts +9 -2
- package/src/control/StrictControl.ts +3 -2
- package/src/core/AutoResizer.ts +3 -0
- package/src/renderer/Renderer.ts +20 -0
- package/src/renderer/VanillaRenderer.ts +11 -3
package/dist/flicking.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.1
|
|
7
|
+
version: 4.14.2-beta.1
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready'), require('@cfcs/core')) :
|
|
@@ -26,7 +26,7 @@ version: 4.14.1
|
|
|
26
26
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
27
27
|
PERFORMANCE OF THIS SOFTWARE.
|
|
28
28
|
***************************************************************************** */
|
|
29
|
-
/* global Reflect, Promise, SuppressedError, Symbol
|
|
29
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
30
30
|
|
|
31
31
|
var extendStatics = function (d, b) {
|
|
32
32
|
extendStatics = Object.setPrototypeOf || {
|
|
@@ -96,8 +96,12 @@ version: 4.14.1
|
|
|
96
96
|
f,
|
|
97
97
|
y,
|
|
98
98
|
t,
|
|
99
|
-
g
|
|
100
|
-
return g
|
|
99
|
+
g;
|
|
100
|
+
return g = {
|
|
101
|
+
next: verb(0),
|
|
102
|
+
"throw": verb(1),
|
|
103
|
+
"return": verb(2)
|
|
104
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
101
105
|
return this;
|
|
102
106
|
}), g;
|
|
103
107
|
function verb(n) {
|
|
@@ -1002,6 +1006,9 @@ version: 4.14.1
|
|
|
1002
1006
|
* @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
|
|
1003
1007
|
*/
|
|
1004
1008
|
var AutoResizer = /*#__PURE__*/function () {
|
|
1009
|
+
/**
|
|
1010
|
+
* @param flicking
|
|
1011
|
+
*/
|
|
1005
1012
|
function AutoResizer(flicking) {
|
|
1006
1013
|
var _this = this;
|
|
1007
1014
|
this._onResizeWrapper = function () {
|
|
@@ -2444,7 +2451,7 @@ version: 4.14.1
|
|
|
2444
2451
|
if (!axes) {
|
|
2445
2452
|
return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING));
|
|
2446
2453
|
}
|
|
2447
|
-
var startPos =
|
|
2454
|
+
var startPos = this.getCurrentPosition();
|
|
2448
2455
|
if (startPos === position) {
|
|
2449
2456
|
var flicking = getFlickingAttached(this._flicking);
|
|
2450
2457
|
flicking.camera.lookAt(position);
|
|
@@ -2488,6 +2495,14 @@ version: 4.14.1
|
|
|
2488
2495
|
animate();
|
|
2489
2496
|
});
|
|
2490
2497
|
};
|
|
2498
|
+
/**
|
|
2499
|
+
* Returns the current axes position
|
|
2500
|
+
* @ko 현재 axes의 position을 반환합니다.
|
|
2501
|
+
*/
|
|
2502
|
+
__proto.getCurrentPosition = function () {
|
|
2503
|
+
var _a, _b;
|
|
2504
|
+
return (_b = (_a = this._axes) === null || _a === void 0 ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) !== null && _b !== void 0 ? _b : 0;
|
|
2505
|
+
};
|
|
2491
2506
|
__proto.updateDirection = function () {
|
|
2492
2507
|
var flicking = getFlickingAttached(this._flicking);
|
|
2493
2508
|
var axes = this._axes;
|
|
@@ -2825,16 +2840,20 @@ version: 4.14.1
|
|
|
2825
2840
|
newActivePanel = _a.newActivePanel,
|
|
2826
2841
|
axesEvent = _a.axesEvent;
|
|
2827
2842
|
return __awaiter(this, void 0, void 0, function () {
|
|
2828
|
-
var flicking, animate, state;
|
|
2843
|
+
var flicking, nextDuration, animate, state;
|
|
2829
2844
|
var _this = this;
|
|
2830
2845
|
return __generator(this, function (_b) {
|
|
2831
2846
|
flicking = getFlickingAttached(this._flicking);
|
|
2847
|
+
nextDuration = duration;
|
|
2848
|
+
if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
|
|
2849
|
+
nextDuration = 0;
|
|
2850
|
+
}
|
|
2832
2851
|
animate = function () {
|
|
2833
|
-
return _this._controller.animateTo(position,
|
|
2852
|
+
return _this._controller.animateTo(position, nextDuration, axesEvent);
|
|
2834
2853
|
};
|
|
2835
2854
|
state = this._controller.state;
|
|
2836
2855
|
state.targetPanel = newActivePanel;
|
|
2837
|
-
if (
|
|
2856
|
+
if (nextDuration <= 0) {
|
|
2838
2857
|
return [2 /*return*/, animate()];
|
|
2839
2858
|
} else {
|
|
2840
2859
|
return [2 /*return*/, animate().then(function () {
|
|
@@ -2860,6 +2879,7 @@ version: 4.14.1
|
|
|
2860
2879
|
});
|
|
2861
2880
|
});
|
|
2862
2881
|
};
|
|
2882
|
+
|
|
2863
2883
|
__proto._getPosition = function (panel, direction) {
|
|
2864
2884
|
if (direction === void 0) {
|
|
2865
2885
|
direction = DIRECTION.NONE;
|
|
@@ -3425,8 +3445,9 @@ version: 4.14.1
|
|
|
3425
3445
|
var anchors = camera.anchorPoints;
|
|
3426
3446
|
var firstAnchor = anchors[0];
|
|
3427
3447
|
var lastAnchor = anchors[anchors.length - 1];
|
|
3428
|
-
|
|
3429
|
-
var
|
|
3448
|
+
// position이 bounce으로 인하여 범위를 넘어가야 동작하도록 변경
|
|
3449
|
+
var shouldBounceToFirst = position < cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3450
|
+
var shouldBounceToLast = position > cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3430
3451
|
var isAdjacent = adjacentAnchor && (indexRange.min <= indexRange.max ? isBetween(adjacentAnchor.index, indexRange.min, indexRange.max) : adjacentAnchor.index >= indexRange.min || adjacentAnchor.index <= indexRange.max);
|
|
3431
3452
|
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
3432
3453
|
// In bounce area
|
|
@@ -4818,6 +4839,17 @@ version: 4.14.1
|
|
|
4818
4839
|
});
|
|
4819
4840
|
return Promise.resolve();
|
|
4820
4841
|
};
|
|
4842
|
+
/**
|
|
4843
|
+
* Return Rendered Panels
|
|
4844
|
+
* @ko 렌더링이 된 패널을 반환합니다.
|
|
4845
|
+
* @return {Panel[]}
|
|
4846
|
+
*/
|
|
4847
|
+
__proto.getRenderedPanels = function () {
|
|
4848
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4849
|
+
return flicking.renderer.panels.filter(function (panel) {
|
|
4850
|
+
return panel.rendered;
|
|
4851
|
+
});
|
|
4852
|
+
};
|
|
4821
4853
|
/**
|
|
4822
4854
|
* Update all panel sizes
|
|
4823
4855
|
* @ko 모든 패널의 크기를 업데이트합니다
|
|
@@ -5178,6 +5210,13 @@ version: 4.14.1
|
|
|
5178
5210
|
__proto._afterRender = function () {
|
|
5179
5211
|
var flicking = getFlickingAttached(this._flicking);
|
|
5180
5212
|
flicking.camera.applyTransform();
|
|
5213
|
+
if (flicking.useCSSOrderProperty) {
|
|
5214
|
+
// useCSSOrderProperty를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
|
|
5215
|
+
var panels_1 = flicking.panels;
|
|
5216
|
+
this._strategy.getRenderingIndexesByOrder(flicking).forEach(function (domIndex, index) {
|
|
5217
|
+
panels_1[domIndex].element.style.order = "" + index;
|
|
5218
|
+
});
|
|
5219
|
+
}
|
|
5181
5220
|
};
|
|
5182
5221
|
return Renderer;
|
|
5183
5222
|
}();
|
|
@@ -5206,6 +5245,7 @@ version: 4.14.1
|
|
|
5206
5245
|
});
|
|
5207
5246
|
});
|
|
5208
5247
|
};
|
|
5248
|
+
|
|
5209
5249
|
__proto._collectPanels = function () {
|
|
5210
5250
|
var flicking = getFlickingAttached(this._flicking);
|
|
5211
5251
|
var camera = flicking.camera;
|
|
@@ -5219,7 +5259,15 @@ version: 4.14.1
|
|
|
5219
5259
|
var flicking = getFlickingAttached(this._flicking);
|
|
5220
5260
|
var cameraEl = flicking.camera.element;
|
|
5221
5261
|
// We're using reversed panels here as last panel should be the last element of camera element
|
|
5222
|
-
var reversedElements =
|
|
5262
|
+
var reversedElements = [];
|
|
5263
|
+
if (flicking.useCSSOrderProperty) {
|
|
5264
|
+
// useCSSOrderProperty를 사용하는 경우 원본 그대로 렌더링
|
|
5265
|
+
reversedElements = this.getRenderedPanels().map(function (panel) {
|
|
5266
|
+
return panel.element;
|
|
5267
|
+
}).reverse();
|
|
5268
|
+
} else {
|
|
5269
|
+
reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
|
|
5270
|
+
}
|
|
5223
5271
|
reversedElements.forEach(function (el, idx) {
|
|
5224
5272
|
var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
|
|
5225
5273
|
if (el.nextElementSibling !== nextEl) {
|
|
@@ -6296,7 +6344,11 @@ version: 4.14.1
|
|
|
6296
6344
|
_15 = _b.renderExternal,
|
|
6297
6345
|
renderExternal = _15 === void 0 ? null : _15,
|
|
6298
6346
|
_16 = _b.optimizeSizeUpdate,
|
|
6299
|
-
optimizeSizeUpdate = _16 === void 0 ? false : _16
|
|
6347
|
+
optimizeSizeUpdate = _16 === void 0 ? false : _16,
|
|
6348
|
+
_17 = _b.animationThreshold,
|
|
6349
|
+
animationThreshold = _17 === void 0 ? 0.5 : _17,
|
|
6350
|
+
_18 = _b.useCSSOrderProperty,
|
|
6351
|
+
useCSSOrderProperty = _18 === void 0 ? false : _18;
|
|
6300
6352
|
var _this = _super.call(this) || this;
|
|
6301
6353
|
// Internal states
|
|
6302
6354
|
_this._initialized = false;
|
|
@@ -6342,6 +6394,8 @@ version: 4.14.1
|
|
|
6342
6394
|
_this._externalRenderer = externalRenderer;
|
|
6343
6395
|
_this._renderExternal = renderExternal;
|
|
6344
6396
|
_this._optimizeSizeUpdate = optimizeSizeUpdate;
|
|
6397
|
+
_this._animationThreshold = animationThreshold;
|
|
6398
|
+
_this._useCSSOrderProperty = useCSSOrderProperty;
|
|
6345
6399
|
// Create core components
|
|
6346
6400
|
_this._viewport = new Viewport(_this, getElement(root));
|
|
6347
6401
|
_this._autoResizer = new AutoResizer(_this);
|
|
@@ -7053,6 +7107,43 @@ version: 4.14.1
|
|
|
7053
7107
|
enumerable: false,
|
|
7054
7108
|
configurable: true
|
|
7055
7109
|
});
|
|
7110
|
+
Object.defineProperty(__proto, "animationThreshold", {
|
|
7111
|
+
/**
|
|
7112
|
+
* 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).
|
|
7113
|
+
* @ko animation이 진행되기 위한 최소한의 거리. 이동하려는 거리가 `animationThreshold`보다 적으면 애니메이션 없이(duration: 0) 즉시 이동한다.
|
|
7114
|
+
* @type {number}
|
|
7115
|
+
* @default 0.5
|
|
7116
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#animationThreshold animationThreshold ( Options )}
|
|
7117
|
+
*/
|
|
7118
|
+
get: function () {
|
|
7119
|
+
return this._animationThreshold;
|
|
7120
|
+
},
|
|
7121
|
+
set: function (val) {
|
|
7122
|
+
this._animationThreshold = val;
|
|
7123
|
+
},
|
|
7124
|
+
enumerable: false,
|
|
7125
|
+
configurable: true
|
|
7126
|
+
});
|
|
7127
|
+
Object.defineProperty(__proto, "useCSSOrderProperty", {
|
|
7128
|
+
/**
|
|
7129
|
+
* When `circular` is used, the DOM order changes depending on the position. Using `useCSSOrderProperty` does not change the DOM order, but the `order` CSS property changes the order on the screen.
|
|
7130
|
+
* When using `iframe`, you can prevent reloading when the DOM order changes.
|
|
7131
|
+
* @ko `circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다. `useCSSOrderProperty`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다.
|
|
7132
|
+
* `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
|
|
7133
|
+
* @type {boolean}
|
|
7134
|
+
* @requires `circular`
|
|
7135
|
+
* @default false
|
|
7136
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrderProperty animationThreshold ( Options )}
|
|
7137
|
+
*/
|
|
7138
|
+
get: function () {
|
|
7139
|
+
return this._useCSSOrderProperty;
|
|
7140
|
+
},
|
|
7141
|
+
set: function (val) {
|
|
7142
|
+
this._useCSSOrderProperty = val;
|
|
7143
|
+
},
|
|
7144
|
+
enumerable: false,
|
|
7145
|
+
configurable: true
|
|
7146
|
+
});
|
|
7056
7147
|
Object.defineProperty(__proto, "interruptable", {
|
|
7057
7148
|
/**
|
|
7058
7149
|
* Set animation to be interruptable by click/touch.
|
|
@@ -7941,6 +8032,7 @@ version: 4.14.1
|
|
|
7941
8032
|
if (!this._initialized) {
|
|
7942
8033
|
return [2 /*return*/];
|
|
7943
8034
|
}
|
|
8035
|
+
|
|
7944
8036
|
renderer.updatePanelSize();
|
|
7945
8037
|
camera.updateAlignPos();
|
|
7946
8038
|
camera.updateRange();
|
|
@@ -7954,6 +8046,7 @@ version: 4.14.1
|
|
|
7954
8046
|
if (!this._initialized) {
|
|
7955
8047
|
return [2 /*return*/];
|
|
7956
8048
|
}
|
|
8049
|
+
|
|
7957
8050
|
if (control.animating) ; else {
|
|
7958
8051
|
control.updatePosition(prevProgressInPanel);
|
|
7959
8052
|
control.updateInput();
|
|
@@ -8191,7 +8284,7 @@ version: 4.14.1
|
|
|
8191
8284
|
* Flicking.VERSION; // ex) 4.0.0
|
|
8192
8285
|
* ```
|
|
8193
8286
|
*/
|
|
8194
|
-
Flicking.VERSION = "4.14.1";
|
|
8287
|
+
Flicking.VERSION = "4.14.2-beta.1";
|
|
8195
8288
|
return Flicking;
|
|
8196
8289
|
}(Component);
|
|
8197
8290
|
|
|
@@ -8730,13 +8823,16 @@ version: 4.14.1
|
|
|
8730
8823
|
map[prev] = current;
|
|
8731
8824
|
return map;
|
|
8732
8825
|
}, {});
|
|
8733
|
-
|
|
8826
|
+
var renderingPanels = flicking.panels.filter(function (panel) {
|
|
8734
8827
|
return !removedPanels[panel.index];
|
|
8735
|
-
})
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8828
|
+
});
|
|
8829
|
+
if (!flicking.useCSSOrderProperty) {
|
|
8830
|
+
// useCSSOrderProperty를 사용하게 되는 경우 sort를 하지 않는다.
|
|
8831
|
+
renderingPanels.sort(function (panel1, panel2) {
|
|
8832
|
+
return panel1.position + panel1.offset - (panel2.position + panel2.offset);
|
|
8833
|
+
});
|
|
8834
|
+
}
|
|
8835
|
+
return __spread(renderingPanels.map(function (panel) {
|
|
8740
8836
|
return diffResult.list[maintainedMap[panel.index]];
|
|
8741
8837
|
}), diffResult.added.map(function (idx) {
|
|
8742
8838
|
return diffResult.list[idx];
|