@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Flicking, { FlickingOptions } from "../Flicking";
|
|
2
2
|
import Panel from "../core/panel/Panel";
|
|
3
3
|
import AnchorPoint from "../core/AnchorPoint";
|
|
4
|
+
import { ValueOf } from "../type/internal";
|
|
4
5
|
import { CameraMode } from "./mode";
|
|
5
6
|
export interface CameraOptions {
|
|
6
7
|
align: FlickingOptions["align"];
|
|
@@ -20,6 +21,7 @@ declare class Camera {
|
|
|
20
21
|
private _visiblePanels;
|
|
21
22
|
private _anchors;
|
|
22
23
|
private _needPanelTriggered;
|
|
24
|
+
private _panelOrder;
|
|
23
25
|
get element(): HTMLElement;
|
|
24
26
|
get children(): HTMLElement[];
|
|
25
27
|
get position(): number;
|
|
@@ -49,6 +51,10 @@ declare class Camera {
|
|
|
49
51
|
get atEdge(): boolean;
|
|
50
52
|
get size(): number;
|
|
51
53
|
get progress(): number;
|
|
54
|
+
get panelOrder(): ValueOf<{
|
|
55
|
+
readonly LTR: "ltr";
|
|
56
|
+
readonly RTL: "rtl";
|
|
57
|
+
}>;
|
|
52
58
|
get align(): FlickingOptions["align"];
|
|
53
59
|
set align(val: FlickingOptions["align"]);
|
|
54
60
|
constructor(flicking: Flicking, { align }?: Partial<CameraOptions>);
|
|
@@ -69,6 +75,7 @@ declare class Camera {
|
|
|
69
75
|
updateAnchors(): this;
|
|
70
76
|
updateAdaptiveHeight(): void;
|
|
71
77
|
updateOffset(): this;
|
|
78
|
+
updatePanelOrder(): this;
|
|
72
79
|
resetNeedPanelHistory(): this;
|
|
73
80
|
applyTransform(): this;
|
|
74
81
|
private _resetInternalValues;
|
|
@@ -8,6 +8,7 @@ declare abstract class Control {
|
|
|
8
8
|
protected _flicking: Flicking | null;
|
|
9
9
|
protected _controller: AxesController;
|
|
10
10
|
protected _activePanel: Panel | null;
|
|
11
|
+
protected _nextPanel: Panel | null;
|
|
11
12
|
get controller(): AxesController;
|
|
12
13
|
get activeIndex(): number;
|
|
13
14
|
get activePanel(): Panel;
|
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.11.0
|
|
7
|
+
version: 4.11.2-beta.0
|
|
8
8
|
*/
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -398,6 +398,17 @@ var CIRCULAR_FALLBACK = {
|
|
|
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
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
403
414
|
var merge = function (target) {
|
|
@@ -691,20 +702,22 @@ var getElementSize = function (_a) {
|
|
|
691
702
|
useFractionalSize = _a.useFractionalSize,
|
|
692
703
|
useOffset = _a.useOffset,
|
|
693
704
|
style = _a.style;
|
|
705
|
+
var size = 0;
|
|
694
706
|
if (useFractionalSize) {
|
|
695
|
-
var baseSize = parseFloat(horizontal ? style.width : style.height);
|
|
707
|
+
var baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
|
|
696
708
|
var isBorderBoxSizing = style.boxSizing === "border-box";
|
|
697
709
|
var border = horizontal ? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0") : parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
|
|
698
710
|
if (isBorderBoxSizing) {
|
|
699
|
-
|
|
711
|
+
size = useOffset ? baseSize : baseSize - border;
|
|
700
712
|
} else {
|
|
701
713
|
var padding = horizontal ? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0") : parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
|
|
702
|
-
|
|
714
|
+
size = useOffset ? baseSize + padding + border : baseSize + padding;
|
|
703
715
|
}
|
|
704
716
|
} else {
|
|
705
717
|
var sizeStr = horizontal ? "Width" : "Height";
|
|
706
|
-
|
|
718
|
+
size = useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
|
|
707
719
|
}
|
|
720
|
+
return Math.max(size, 0);
|
|
708
721
|
};
|
|
709
722
|
var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
710
723
|
obj.__proto__ = proto;
|
|
@@ -2088,7 +2101,7 @@ var AxesController = /*#__PURE__*/function () {
|
|
|
2088
2101
|
threshold: 1,
|
|
2089
2102
|
iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
|
|
2090
2103
|
preventDefaultOnDrag: flicking.preventDefaultOnDrag,
|
|
2091
|
-
scale: flicking.horizontal ? [-1, 0] : [0, -1],
|
|
2104
|
+
scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
|
|
2092
2105
|
releaseOnScroll: true
|
|
2093
2106
|
});
|
|
2094
2107
|
var axes = this._axes;
|
|
@@ -2313,7 +2326,7 @@ var AxesController = /*#__PURE__*/function () {
|
|
|
2313
2326
|
var panInput = this._panInput;
|
|
2314
2327
|
axes.disconnect(panInput);
|
|
2315
2328
|
axes.connect(flicking.horizontal ? [POSITION_KEY, ""] : ["", POSITION_KEY], panInput);
|
|
2316
|
-
panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
|
|
2329
|
+
panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
|
|
2317
2330
|
};
|
|
2318
2331
|
__proto._resetInternalValues = function () {
|
|
2319
2332
|
this._flicking = null;
|
|
@@ -2595,6 +2608,7 @@ var Control = /*#__PURE__*/function () {
|
|
|
2595
2608
|
var _a;
|
|
2596
2609
|
var flicking = getFlickingAttached(this._flicking);
|
|
2597
2610
|
this._activePanel = newActivePanel;
|
|
2611
|
+
this._nextPanel = null;
|
|
2598
2612
|
flicking.camera.updateAdaptiveHeight();
|
|
2599
2613
|
if (newActivePanel !== prevActivePanel) {
|
|
2600
2614
|
flicking.trigger(new Component.ComponentEvent(EVENTS.CHANGED, {
|
|
@@ -2631,6 +2645,7 @@ var Control = /*#__PURE__*/function () {
|
|
|
2631
2645
|
isTrusted: (axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) || false,
|
|
2632
2646
|
direction: getDirection((_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.position) !== null && _a !== void 0 ? _a : camera.position, position)
|
|
2633
2647
|
});
|
|
2648
|
+
this._nextPanel = panel;
|
|
2634
2649
|
flicking.trigger(event);
|
|
2635
2650
|
if (event.isCanceled()) {
|
|
2636
2651
|
throw new FlickingError(MESSAGE.STOP_CALLED_BY_USER, CODE.STOP_CALLED_BY_USER);
|
|
@@ -3218,19 +3233,20 @@ var StrictControl = /*#__PURE__*/function (_super) {
|
|
|
3218
3233
|
* @return {Promise<void>} A Promise which will be resolved after reaching the target position<ko>해당 좌표 도달시에 resolve되는 Promise</ko>
|
|
3219
3234
|
*/
|
|
3220
3235
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3236
|
+
var _a;
|
|
3221
3237
|
var flicking = getFlickingAttached(this._flicking);
|
|
3222
3238
|
var camera = flicking.camera;
|
|
3223
|
-
var
|
|
3239
|
+
var currentPanel = (_a = this._nextPanel) !== null && _a !== void 0 ? _a : this._activePanel;
|
|
3224
3240
|
var axesRange = this._controller.range;
|
|
3225
3241
|
var indexRange = this._indexRange;
|
|
3226
3242
|
var cameraRange = camera.range;
|
|
3227
3243
|
var state = this._controller.state;
|
|
3228
3244
|
var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3229
3245
|
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3230
|
-
if (!anchorAtPosition || !
|
|
3246
|
+
if (!anchorAtPosition || !currentPanel) {
|
|
3231
3247
|
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3232
3248
|
}
|
|
3233
|
-
var prevPos =
|
|
3249
|
+
var prevPos = currentPanel.position;
|
|
3234
3250
|
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3235
3251
|
var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
|
|
3236
3252
|
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
@@ -3247,7 +3263,7 @@ var StrictControl = /*#__PURE__*/function (_super) {
|
|
|
3247
3263
|
var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
3248
3264
|
targetPanel = targetAnchor.panel;
|
|
3249
3265
|
targetPos = targetAnchor.position;
|
|
3250
|
-
} else if (isOverThreshold && anchorAtPosition.position !==
|
|
3266
|
+
} else if (isOverThreshold && anchorAtPosition.position !== currentPanel.position) {
|
|
3251
3267
|
// Move to anchor at position
|
|
3252
3268
|
targetPanel = anchorAtPosition.panel;
|
|
3253
3269
|
targetPos = anchorAtPosition.position;
|
|
@@ -3985,6 +4001,19 @@ var Camera = /*#__PURE__*/function () {
|
|
|
3985
4001
|
enumerable: false,
|
|
3986
4002
|
configurable: true
|
|
3987
4003
|
});
|
|
4004
|
+
Object.defineProperty(__proto, "panelOrder", {
|
|
4005
|
+
/**
|
|
4006
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
|
|
4007
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
|
|
4008
|
+
* @type {string}
|
|
4009
|
+
* @readonly
|
|
4010
|
+
*/
|
|
4011
|
+
get: function () {
|
|
4012
|
+
return this._panelOrder;
|
|
4013
|
+
},
|
|
4014
|
+
enumerable: false,
|
|
4015
|
+
configurable: true
|
|
4016
|
+
});
|
|
3988
4017
|
Object.defineProperty(__proto, "align", {
|
|
3989
4018
|
// Options Getter
|
|
3990
4019
|
/**
|
|
@@ -4016,6 +4045,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4016
4045
|
this._el = viewportEl.firstElementChild;
|
|
4017
4046
|
this._checkTranslateSupport();
|
|
4018
4047
|
this._updateMode();
|
|
4048
|
+
this.updatePanelOrder();
|
|
4019
4049
|
return this;
|
|
4020
4050
|
};
|
|
4021
4051
|
/**
|
|
@@ -4258,6 +4288,24 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4258
4288
|
this.applyTransform();
|
|
4259
4289
|
return this;
|
|
4260
4290
|
};
|
|
4291
|
+
/**
|
|
4292
|
+
* Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
|
|
4293
|
+
* @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
|
|
4294
|
+
* @return {this}
|
|
4295
|
+
*/
|
|
4296
|
+
__proto.updatePanelOrder = function () {
|
|
4297
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4298
|
+
if (!flicking.horizontal) return this;
|
|
4299
|
+
var el = this._el;
|
|
4300
|
+
var direction = getStyle(el).direction;
|
|
4301
|
+
if (direction !== this._panelOrder) {
|
|
4302
|
+
this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
|
|
4303
|
+
if (flicking.initialized) {
|
|
4304
|
+
flicking.control.controller.updateDirection();
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
return this;
|
|
4308
|
+
};
|
|
4261
4309
|
/**
|
|
4262
4310
|
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
|
|
4263
4311
|
* @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
|
|
@@ -4282,7 +4330,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
4282
4330
|
var renderer = flicking.renderer;
|
|
4283
4331
|
if (renderer.rendering || !flicking.initialized) return this;
|
|
4284
4332
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
4285
|
-
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4333
|
+
el.style[this._transform] = flicking.horizontal ? "translate(" + (this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition) + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4286
4334
|
return this;
|
|
4287
4335
|
};
|
|
4288
4336
|
__proto._resetInternalValues = function () {
|
|
@@ -7535,6 +7583,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7535
7583
|
camera.updateRange();
|
|
7536
7584
|
camera.updateAnchors();
|
|
7537
7585
|
camera.updateAdaptiveHeight();
|
|
7586
|
+
camera.updatePanelOrder();
|
|
7538
7587
|
camera.updateOffset();
|
|
7539
7588
|
return [4 /*yield*/, renderer.render()];
|
|
7540
7589
|
case 2:
|
|
@@ -7775,7 +7824,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7775
7824
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7776
7825
|
* ```
|
|
7777
7826
|
*/
|
|
7778
|
-
Flicking.VERSION = "4.11.0";
|
|
7827
|
+
Flicking.VERSION = "4.11.2-beta.0";
|
|
7779
7828
|
return Flicking;
|
|
7780
7829
|
}(Component);
|
|
7781
7830
|
|
|
@@ -8032,6 +8081,7 @@ var modules = {
|
|
|
8032
8081
|
MOVE_TYPE: MOVE_TYPE,
|
|
8033
8082
|
CLASS: CLASS,
|
|
8034
8083
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
8084
|
+
ORDER: ORDER,
|
|
8035
8085
|
withFlickingMethods: withFlickingMethods,
|
|
8036
8086
|
sync: sync,
|
|
8037
8087
|
getRenderingPanels: getRenderingPanels,
|
|
@@ -8099,6 +8149,7 @@ exports.IdleState = IdleState;
|
|
|
8099
8149
|
exports.LinearCameraMode = LinearCameraMode;
|
|
8100
8150
|
exports.MOVE_TYPE = MOVE_TYPE;
|
|
8101
8151
|
exports.NormalRenderingStrategy = NormalRenderingStrategy;
|
|
8152
|
+
exports.ORDER = ORDER;
|
|
8102
8153
|
exports.Panel = Panel;
|
|
8103
8154
|
exports.Renderer = Renderer;
|
|
8104
8155
|
exports.SnapControl = SnapControl;
|