@egjs/flicking 4.11.0 → 4.11.2-beta.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/declaration/camera/Camera.d.ts +7 -0
- package/declaration/const/external.d.ts +4 -0
- package/declaration/control/Control.d.ts +1 -0
- package/dist/flicking.cjs.js +64 -13
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +63 -14
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +63 -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 +72 -37
- 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 +1 -1
- package/src/camera/Camera.ts +36 -3
- package/src/const/external.ts +12 -0
- package/src/control/AxesController.ts +3 -2
- package/src/control/Control.ts +4 -0
- package/src/control/StrictControl.ts +4 -4
- package/src/utils.ts +7 -4
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.11.0
|
|
7
|
+
version: 4.11.2-beta.0
|
|
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')) :
|
|
@@ -398,6 +398,17 @@ version: 4.11.0
|
|
|
398
398
|
LINEAR: "linear",
|
|
399
399
|
BOUND: "bound"
|
|
400
400
|
};
|
|
401
|
+
/**
|
|
402
|
+
* An object for identifying {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
|
|
403
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성을 구분하기 위한 객체
|
|
404
|
+
* @type {object}
|
|
405
|
+
* @property {string} LTR "ltr"
|
|
406
|
+
* @property {string} RTL "rtl"
|
|
407
|
+
*/
|
|
408
|
+
var ORDER = {
|
|
409
|
+
LTR: "ltr",
|
|
410
|
+
RTL: "rtl"
|
|
411
|
+
};
|
|
401
412
|
|
|
402
413
|
var Constants = {
|
|
403
414
|
__proto__: null,
|
|
@@ -407,6 +418,7 @@ version: 4.11.0
|
|
|
407
418
|
MOVE_TYPE: MOVE_TYPE,
|
|
408
419
|
CLASS: CLASS,
|
|
409
420
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
421
|
+
ORDER: ORDER,
|
|
410
422
|
ERROR_CODE: CODE
|
|
411
423
|
};
|
|
412
424
|
|
|
@@ -702,20 +714,22 @@ version: 4.11.0
|
|
|
702
714
|
useFractionalSize = _a.useFractionalSize,
|
|
703
715
|
useOffset = _a.useOffset,
|
|
704
716
|
style = _a.style;
|
|
717
|
+
var size = 0;
|
|
705
718
|
if (useFractionalSize) {
|
|
706
|
-
var baseSize = parseFloat(horizontal ? style.width : style.height);
|
|
719
|
+
var baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
|
|
707
720
|
var isBorderBoxSizing = style.boxSizing === "border-box";
|
|
708
721
|
var border = horizontal ? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0") : parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
|
|
709
722
|
if (isBorderBoxSizing) {
|
|
710
|
-
|
|
723
|
+
size = useOffset ? baseSize : baseSize - border;
|
|
711
724
|
} else {
|
|
712
725
|
var padding = horizontal ? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0") : parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
|
|
713
|
-
|
|
726
|
+
size = useOffset ? baseSize + padding + border : baseSize + padding;
|
|
714
727
|
}
|
|
715
728
|
} else {
|
|
716
729
|
var sizeStr = horizontal ? "Width" : "Height";
|
|
717
|
-
|
|
730
|
+
size = useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
|
|
718
731
|
}
|
|
732
|
+
return Math.max(size, 0);
|
|
719
733
|
};
|
|
720
734
|
var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
721
735
|
obj.__proto__ = proto;
|
|
@@ -2132,7 +2146,7 @@ version: 4.11.0
|
|
|
2132
2146
|
threshold: 1,
|
|
2133
2147
|
iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
|
|
2134
2148
|
preventDefaultOnDrag: flicking.preventDefaultOnDrag,
|
|
2135
|
-
scale: flicking.horizontal ? [-1, 0] : [0, -1],
|
|
2149
|
+
scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
|
|
2136
2150
|
releaseOnScroll: true
|
|
2137
2151
|
});
|
|
2138
2152
|
var axes = this._axes;
|
|
@@ -2357,7 +2371,7 @@ version: 4.11.0
|
|
|
2357
2371
|
var panInput = this._panInput;
|
|
2358
2372
|
axes.disconnect(panInput);
|
|
2359
2373
|
axes.connect(flicking.horizontal ? [POSITION_KEY, ""] : ["", POSITION_KEY], panInput);
|
|
2360
|
-
panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
|
|
2374
|
+
panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
|
|
2361
2375
|
};
|
|
2362
2376
|
__proto._resetInternalValues = function () {
|
|
2363
2377
|
this._flicking = null;
|
|
@@ -2639,6 +2653,7 @@ version: 4.11.0
|
|
|
2639
2653
|
var _a;
|
|
2640
2654
|
var flicking = getFlickingAttached(this._flicking);
|
|
2641
2655
|
this._activePanel = newActivePanel;
|
|
2656
|
+
this._nextPanel = null;
|
|
2642
2657
|
flicking.camera.updateAdaptiveHeight();
|
|
2643
2658
|
if (newActivePanel !== prevActivePanel) {
|
|
2644
2659
|
flicking.trigger(new Component.ComponentEvent(EVENTS.CHANGED, {
|
|
@@ -2675,6 +2690,7 @@ version: 4.11.0
|
|
|
2675
2690
|
isTrusted: (axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) || false,
|
|
2676
2691
|
direction: getDirection((_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.position) !== null && _a !== void 0 ? _a : camera.position, position)
|
|
2677
2692
|
});
|
|
2693
|
+
this._nextPanel = panel;
|
|
2678
2694
|
flicking.trigger(event);
|
|
2679
2695
|
if (event.isCanceled()) {
|
|
2680
2696
|
throw new FlickingError(MESSAGE.STOP_CALLED_BY_USER, CODE.STOP_CALLED_BY_USER);
|
|
@@ -3262,19 +3278,20 @@ version: 4.11.0
|
|
|
3262
3278
|
* @return {Promise<void>} A Promise which will be resolved after reaching the target position<ko>해당 좌표 도달시에 resolve되는 Promise</ko>
|
|
3263
3279
|
*/
|
|
3264
3280
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3281
|
+
var _a;
|
|
3265
3282
|
var flicking = getFlickingAttached(this._flicking);
|
|
3266
3283
|
var camera = flicking.camera;
|
|
3267
|
-
var
|
|
3284
|
+
var currentPanel = (_a = this._nextPanel) !== null && _a !== void 0 ? _a : this._activePanel;
|
|
3268
3285
|
var axesRange = this._controller.range;
|
|
3269
3286
|
var indexRange = this._indexRange;
|
|
3270
3287
|
var cameraRange = camera.range;
|
|
3271
3288
|
var state = this._controller.state;
|
|
3272
3289
|
var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3273
3290
|
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3274
|
-
if (!anchorAtPosition || !
|
|
3291
|
+
if (!anchorAtPosition || !currentPanel) {
|
|
3275
3292
|
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3276
3293
|
}
|
|
3277
|
-
var prevPos =
|
|
3294
|
+
var prevPos = currentPanel.position;
|
|
3278
3295
|
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3279
3296
|
var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
|
|
3280
3297
|
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
@@ -3291,7 +3308,7 @@ version: 4.11.0
|
|
|
3291
3308
|
var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
3292
3309
|
targetPanel = targetAnchor.panel;
|
|
3293
3310
|
targetPos = targetAnchor.position;
|
|
3294
|
-
} else if (isOverThreshold && anchorAtPosition.position !==
|
|
3311
|
+
} else if (isOverThreshold && anchorAtPosition.position !== currentPanel.position) {
|
|
3295
3312
|
// Move to anchor at position
|
|
3296
3313
|
targetPanel = anchorAtPosition.panel;
|
|
3297
3314
|
targetPos = anchorAtPosition.position;
|
|
@@ -4050,6 +4067,19 @@ version: 4.11.0
|
|
|
4050
4067
|
enumerable: false,
|
|
4051
4068
|
configurable: true
|
|
4052
4069
|
});
|
|
4070
|
+
Object.defineProperty(__proto, "panelOrder", {
|
|
4071
|
+
/**
|
|
4072
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
|
|
4073
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
|
|
4074
|
+
* @type {string}
|
|
4075
|
+
* @readonly
|
|
4076
|
+
*/
|
|
4077
|
+
get: function () {
|
|
4078
|
+
return this._panelOrder;
|
|
4079
|
+
},
|
|
4080
|
+
enumerable: false,
|
|
4081
|
+
configurable: true
|
|
4082
|
+
});
|
|
4053
4083
|
Object.defineProperty(__proto, "align", {
|
|
4054
4084
|
// Options Getter
|
|
4055
4085
|
/**
|
|
@@ -4081,6 +4111,7 @@ version: 4.11.0
|
|
|
4081
4111
|
this._el = viewportEl.firstElementChild;
|
|
4082
4112
|
this._checkTranslateSupport();
|
|
4083
4113
|
this._updateMode();
|
|
4114
|
+
this.updatePanelOrder();
|
|
4084
4115
|
return this;
|
|
4085
4116
|
};
|
|
4086
4117
|
/**
|
|
@@ -4323,6 +4354,24 @@ version: 4.11.0
|
|
|
4323
4354
|
this.applyTransform();
|
|
4324
4355
|
return this;
|
|
4325
4356
|
};
|
|
4357
|
+
/**
|
|
4358
|
+
* Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
|
|
4359
|
+
* @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
|
|
4360
|
+
* @return {this}
|
|
4361
|
+
*/
|
|
4362
|
+
__proto.updatePanelOrder = function () {
|
|
4363
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4364
|
+
if (!flicking.horizontal) return this;
|
|
4365
|
+
var el = this._el;
|
|
4366
|
+
var direction = getStyle(el).direction;
|
|
4367
|
+
if (direction !== this._panelOrder) {
|
|
4368
|
+
this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
|
|
4369
|
+
if (flicking.initialized) {
|
|
4370
|
+
flicking.control.controller.updateDirection();
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
return this;
|
|
4374
|
+
};
|
|
4326
4375
|
/**
|
|
4327
4376
|
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
|
|
4328
4377
|
* @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
|
|
@@ -4347,7 +4396,7 @@ version: 4.11.0
|
|
|
4347
4396
|
var renderer = flicking.renderer;
|
|
4348
4397
|
if (renderer.rendering || !flicking.initialized) return this;
|
|
4349
4398
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
4350
|
-
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4399
|
+
el.style[this._transform] = flicking.horizontal ? "translate(" + (this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition) + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4351
4400
|
return this;
|
|
4352
4401
|
};
|
|
4353
4402
|
__proto._resetInternalValues = function () {
|
|
@@ -7627,6 +7676,7 @@ version: 4.11.0
|
|
|
7627
7676
|
camera.updateRange();
|
|
7628
7677
|
camera.updateAnchors();
|
|
7629
7678
|
camera.updateAdaptiveHeight();
|
|
7679
|
+
camera.updatePanelOrder();
|
|
7630
7680
|
camera.updateOffset();
|
|
7631
7681
|
return [4 /*yield*/, renderer.render()];
|
|
7632
7682
|
case 2:
|
|
@@ -7867,7 +7917,7 @@ version: 4.11.0
|
|
|
7867
7917
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7868
7918
|
* ```
|
|
7869
7919
|
*/
|
|
7870
|
-
Flicking.VERSION = "4.11.0";
|
|
7920
|
+
Flicking.VERSION = "4.11.2-beta.0";
|
|
7871
7921
|
return Flicking;
|
|
7872
7922
|
}(Component);
|
|
7873
7923
|
|