@egjs/flicking 4.11.3-beta.3 → 4.11.3-beta.4
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 +2 -1
- package/dist/flicking.cjs.js +84 -23
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +83 -24
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +83 -23
- 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 +83 -23
- 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/dist/flicking.pkgd.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.
|
|
7
|
+
version: 4.11.3-beta.4
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -805,6 +805,17 @@ version: 4.11.0-snapshot
|
|
|
805
805
|
LINEAR: "linear",
|
|
806
806
|
BOUND: "bound"
|
|
807
807
|
};
|
|
808
|
+
/**
|
|
809
|
+
* 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`)
|
|
810
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성을 구분하기 위한 객체
|
|
811
|
+
* @type {object}
|
|
812
|
+
* @property {string} LTR "ltr"
|
|
813
|
+
* @property {string} RTL "rtl"
|
|
814
|
+
*/
|
|
815
|
+
var ORDER = {
|
|
816
|
+
LTR: "ltr",
|
|
817
|
+
RTL: "rtl"
|
|
818
|
+
};
|
|
808
819
|
|
|
809
820
|
var Constants = {
|
|
810
821
|
__proto__: null,
|
|
@@ -814,6 +825,7 @@ version: 4.11.0-snapshot
|
|
|
814
825
|
MOVE_TYPE: MOVE_TYPE,
|
|
815
826
|
CLASS: CLASS,
|
|
816
827
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
828
|
+
ORDER: ORDER,
|
|
817
829
|
ERROR_CODE: CODE
|
|
818
830
|
};
|
|
819
831
|
|
|
@@ -1109,20 +1121,22 @@ version: 4.11.0-snapshot
|
|
|
1109
1121
|
useFractionalSize = _a.useFractionalSize,
|
|
1110
1122
|
useOffset = _a.useOffset,
|
|
1111
1123
|
style = _a.style;
|
|
1124
|
+
var size = 0;
|
|
1112
1125
|
if (useFractionalSize) {
|
|
1113
|
-
var baseSize = parseFloat(horizontal ? style.width : style.height);
|
|
1126
|
+
var baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
|
|
1114
1127
|
var isBorderBoxSizing = style.boxSizing === "border-box";
|
|
1115
1128
|
var border = horizontal ? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0") : parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
|
|
1116
1129
|
if (isBorderBoxSizing) {
|
|
1117
|
-
|
|
1130
|
+
size = useOffset ? baseSize : baseSize - border;
|
|
1118
1131
|
} else {
|
|
1119
1132
|
var padding = horizontal ? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0") : parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
|
|
1120
|
-
|
|
1133
|
+
size = useOffset ? baseSize + padding + border : baseSize + padding;
|
|
1121
1134
|
}
|
|
1122
1135
|
} else {
|
|
1123
1136
|
var sizeStr = horizontal ? "Width" : "Height";
|
|
1124
|
-
|
|
1137
|
+
size = useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
|
|
1125
1138
|
}
|
|
1139
|
+
return Math.max(size, 0);
|
|
1126
1140
|
};
|
|
1127
1141
|
var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
1128
1142
|
obj.__proto__ = proto;
|
|
@@ -6290,7 +6304,7 @@ version: 4.11.0-snapshot
|
|
|
6290
6304
|
threshold: 1,
|
|
6291
6305
|
iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
|
|
6292
6306
|
preventDefaultOnDrag: flicking.preventDefaultOnDrag,
|
|
6293
|
-
scale: flicking.horizontal ? [-1, 0] : [0, -1],
|
|
6307
|
+
scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
|
|
6294
6308
|
releaseOnScroll: true
|
|
6295
6309
|
});
|
|
6296
6310
|
var axes = this._axes;
|
|
@@ -6515,7 +6529,7 @@ version: 4.11.0-snapshot
|
|
|
6515
6529
|
var panInput = this._panInput;
|
|
6516
6530
|
axes.disconnect(panInput);
|
|
6517
6531
|
axes.connect(flicking.horizontal ? [POSITION_KEY, ""] : ["", POSITION_KEY], panInput);
|
|
6518
|
-
panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
|
|
6532
|
+
panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
|
|
6519
6533
|
};
|
|
6520
6534
|
__proto._resetInternalValues = function () {
|
|
6521
6535
|
this._flicking = null;
|
|
@@ -6780,7 +6794,7 @@ version: 4.11.0-snapshot
|
|
|
6780
6794
|
var position;
|
|
6781
6795
|
return __generator(this, function (_c) {
|
|
6782
6796
|
position = this._getPosition(panel, direction);
|
|
6783
|
-
this._triggerIndexChangeEvent(panel, panel.position, axesEvent);
|
|
6797
|
+
this._triggerIndexChangeEvent(panel, panel.position, axesEvent, direction);
|
|
6784
6798
|
return [2 /*return*/, this._animateToPosition({
|
|
6785
6799
|
position: position,
|
|
6786
6800
|
duration: duration,
|
|
@@ -6797,6 +6811,7 @@ version: 4.11.0-snapshot
|
|
|
6797
6811
|
var _a;
|
|
6798
6812
|
var flicking = getFlickingAttached(this._flicking);
|
|
6799
6813
|
this._activePanel = newActivePanel;
|
|
6814
|
+
this._nextPanel = null;
|
|
6800
6815
|
flicking.camera.updateAdaptiveHeight();
|
|
6801
6816
|
if (newActivePanel !== prevActivePanel) {
|
|
6802
6817
|
flicking.trigger(new ComponentEvent$1(EVENTS.CHANGED, {
|
|
@@ -6821,7 +6836,7 @@ version: 4.11.0-snapshot
|
|
|
6821
6836
|
this._activePanel = control._activePanel;
|
|
6822
6837
|
this._controller = control._controller;
|
|
6823
6838
|
};
|
|
6824
|
-
__proto._triggerIndexChangeEvent = function (panel, position, axesEvent) {
|
|
6839
|
+
__proto._triggerIndexChangeEvent = function (panel, position, axesEvent, direction) {
|
|
6825
6840
|
var _a;
|
|
6826
6841
|
var flicking = getFlickingAttached(this._flicking);
|
|
6827
6842
|
var triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
|
|
@@ -6831,8 +6846,9 @@ version: 4.11.0-snapshot
|
|
|
6831
6846
|
index: panel.index,
|
|
6832
6847
|
panel: panel,
|
|
6833
6848
|
isTrusted: (axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) || false,
|
|
6834
|
-
direction: getDirection$1((_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.position) !== null && _a !== void 0 ? _a : camera.position, position)
|
|
6849
|
+
direction: direction !== null && direction !== void 0 ? direction : getDirection$1((_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.position) !== null && _a !== void 0 ? _a : camera.position, position)
|
|
6835
6850
|
});
|
|
6851
|
+
this._nextPanel = panel;
|
|
6836
6852
|
flicking.trigger(event);
|
|
6837
6853
|
if (event.isCanceled()) {
|
|
6838
6854
|
throw new FlickingError(MESSAGE.STOP_CALLED_BY_USER, CODE.STOP_CALLED_BY_USER);
|
|
@@ -7051,7 +7067,7 @@ version: 4.11.0-snapshot
|
|
|
7051
7067
|
if (!activeAnchor || !anchorAtCamera) {
|
|
7052
7068
|
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
7053
7069
|
}
|
|
7054
|
-
var snapThreshold = this._calcSnapThreshold(position, activeAnchor);
|
|
7070
|
+
var snapThreshold = this._calcSnapThreshold(flicking.threshold, position, activeAnchor);
|
|
7055
7071
|
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
7056
7072
|
var absPosDelta = Math.abs(posDelta);
|
|
7057
7073
|
var snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
@@ -7138,7 +7154,7 @@ version: 4.11.0-snapshot
|
|
|
7138
7154
|
var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
|
|
7139
7155
|
return adjacentAnchor;
|
|
7140
7156
|
};
|
|
7141
|
-
__proto._calcSnapThreshold = function (position, activeAnchor) {
|
|
7157
|
+
__proto._calcSnapThreshold = function (threshold, position, activeAnchor) {
|
|
7142
7158
|
var isNextDirection = position > activeAnchor.position;
|
|
7143
7159
|
var panel = activeAnchor.panel;
|
|
7144
7160
|
var panelSize = panel.size;
|
|
@@ -7149,7 +7165,7 @@ version: 4.11.0-snapshot
|
|
|
7149
7165
|
* |<------>|<------------>|
|
|
7150
7166
|
* [ |<-Anchor ]
|
|
7151
7167
|
*/
|
|
7152
|
-
return isNextDirection ? panelSize - alignPos + panel.margin.next : alignPos + panel.margin.prev;
|
|
7168
|
+
return Math.max(threshold, isNextDirection ? panelSize - alignPos + panel.margin.next : alignPos + panel.margin.prev);
|
|
7153
7169
|
};
|
|
7154
7170
|
return SnapControl;
|
|
7155
7171
|
}(Control$1);
|
|
@@ -7420,19 +7436,20 @@ version: 4.11.0-snapshot
|
|
|
7420
7436
|
* @return {Promise<void>} A Promise which will be resolved after reaching the target position<ko>해당 좌표 도달시에 resolve되는 Promise</ko>
|
|
7421
7437
|
*/
|
|
7422
7438
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
7439
|
+
var _a;
|
|
7423
7440
|
var flicking = getFlickingAttached(this._flicking);
|
|
7424
7441
|
var camera = flicking.camera;
|
|
7425
|
-
var
|
|
7442
|
+
var currentPanel = (_a = this._nextPanel) !== null && _a !== void 0 ? _a : this._activePanel;
|
|
7426
7443
|
var axesRange = this._controller.range;
|
|
7427
7444
|
var indexRange = this._indexRange;
|
|
7428
7445
|
var cameraRange = camera.range;
|
|
7429
7446
|
var state = this._controller.state;
|
|
7430
7447
|
var clampedPosition = clamp$1(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
7431
7448
|
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
7432
|
-
if (!anchorAtPosition || !
|
|
7449
|
+
if (!anchorAtPosition || !currentPanel) {
|
|
7433
7450
|
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
7434
7451
|
}
|
|
7435
|
-
var prevPos =
|
|
7452
|
+
var prevPos = currentPanel.position;
|
|
7436
7453
|
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
7437
7454
|
var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
|
|
7438
7455
|
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
@@ -7449,7 +7466,7 @@ version: 4.11.0-snapshot
|
|
|
7449
7466
|
var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
7450
7467
|
targetPanel = targetAnchor.panel;
|
|
7451
7468
|
targetPos = targetAnchor.position;
|
|
7452
|
-
} else if (isOverThreshold && anchorAtPosition.position !==
|
|
7469
|
+
} else if (isOverThreshold && anchorAtPosition.position !== currentPanel.position) {
|
|
7453
7470
|
// Move to anchor at position
|
|
7454
7471
|
targetPanel = anchorAtPosition.panel;
|
|
7455
7472
|
targetPos = anchorAtPosition.position;
|
|
@@ -8208,6 +8225,19 @@ version: 4.11.0-snapshot
|
|
|
8208
8225
|
enumerable: false,
|
|
8209
8226
|
configurable: true
|
|
8210
8227
|
});
|
|
8228
|
+
Object.defineProperty(__proto, "panelOrder", {
|
|
8229
|
+
/**
|
|
8230
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
|
|
8231
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
|
|
8232
|
+
* @type {string}
|
|
8233
|
+
* @readonly
|
|
8234
|
+
*/
|
|
8235
|
+
get: function () {
|
|
8236
|
+
return this._panelOrder;
|
|
8237
|
+
},
|
|
8238
|
+
enumerable: false,
|
|
8239
|
+
configurable: true
|
|
8240
|
+
});
|
|
8211
8241
|
Object.defineProperty(__proto, "align", {
|
|
8212
8242
|
// Options Getter
|
|
8213
8243
|
/**
|
|
@@ -8239,6 +8269,7 @@ version: 4.11.0-snapshot
|
|
|
8239
8269
|
this._el = viewportEl.firstElementChild;
|
|
8240
8270
|
this._checkTranslateSupport();
|
|
8241
8271
|
this._updateMode();
|
|
8272
|
+
this.updatePanelOrder();
|
|
8242
8273
|
return this;
|
|
8243
8274
|
};
|
|
8244
8275
|
/**
|
|
@@ -8360,11 +8391,13 @@ version: 4.11.0-snapshot
|
|
|
8360
8391
|
* @return {AnchorPoint | null}
|
|
8361
8392
|
*/
|
|
8362
8393
|
__proto.findActiveAnchor = function () {
|
|
8394
|
+
var _a;
|
|
8363
8395
|
var flicking = getFlickingAttached(this._flicking);
|
|
8364
|
-
var
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8396
|
+
var activePanel = flicking.control.activePanel;
|
|
8397
|
+
if (!activePanel) return null;
|
|
8398
|
+
return (_a = find$1(this._anchors, function (anchor) {
|
|
8399
|
+
return anchor.panel.index === activePanel.index;
|
|
8400
|
+
})) !== null && _a !== void 0 ? _a : this.findNearestAnchor(activePanel.position);
|
|
8368
8401
|
};
|
|
8369
8402
|
/**
|
|
8370
8403
|
* Clamp the given position between camera's range
|
|
@@ -8481,6 +8514,24 @@ version: 4.11.0-snapshot
|
|
|
8481
8514
|
this.applyTransform();
|
|
8482
8515
|
return this;
|
|
8483
8516
|
};
|
|
8517
|
+
/**
|
|
8518
|
+
* Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
|
|
8519
|
+
* @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
|
|
8520
|
+
* @return {this}
|
|
8521
|
+
*/
|
|
8522
|
+
__proto.updatePanelOrder = function () {
|
|
8523
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
8524
|
+
if (!flicking.horizontal) return this;
|
|
8525
|
+
var el = this._el;
|
|
8526
|
+
var direction = getStyle(el).direction;
|
|
8527
|
+
if (direction !== this._panelOrder) {
|
|
8528
|
+
this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
|
|
8529
|
+
if (flicking.initialized) {
|
|
8530
|
+
flicking.control.controller.updateDirection();
|
|
8531
|
+
}
|
|
8532
|
+
}
|
|
8533
|
+
return this;
|
|
8534
|
+
};
|
|
8484
8535
|
/**
|
|
8485
8536
|
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
|
|
8486
8537
|
* @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
|
|
@@ -8505,7 +8556,7 @@ version: 4.11.0-snapshot
|
|
|
8505
8556
|
var renderer = flicking.renderer;
|
|
8506
8557
|
if (renderer.rendering || !flicking.initialized) return this;
|
|
8507
8558
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
8508
|
-
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
8559
|
+
el.style[this._transform] = flicking.horizontal ? "translate(" + (this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition) + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
8509
8560
|
return this;
|
|
8510
8561
|
};
|
|
8511
8562
|
__proto._resetInternalValues = function () {
|
|
@@ -12650,15 +12701,24 @@ version: 4.11.0-snapshot
|
|
|
12650
12701
|
return [4 /*yield*/, renderer.forceRenderAllPanels()];
|
|
12651
12702
|
case 1:
|
|
12652
12703
|
_a.sent(); // Render all panel elements, to update sizes
|
|
12704
|
+
if (!this._initialized) {
|
|
12705
|
+
return [2 /*return*/];
|
|
12706
|
+
}
|
|
12707
|
+
|
|
12653
12708
|
renderer.updatePanelSize();
|
|
12654
12709
|
camera.updateAlignPos();
|
|
12655
12710
|
camera.updateRange();
|
|
12656
12711
|
camera.updateAnchors();
|
|
12657
12712
|
camera.updateAdaptiveHeight();
|
|
12713
|
+
camera.updatePanelOrder();
|
|
12658
12714
|
camera.updateOffset();
|
|
12659
12715
|
return [4 /*yield*/, renderer.render()];
|
|
12660
12716
|
case 2:
|
|
12661
12717
|
_a.sent();
|
|
12718
|
+
if (!this._initialized) {
|
|
12719
|
+
return [2 /*return*/];
|
|
12720
|
+
}
|
|
12721
|
+
|
|
12662
12722
|
if (control.animating) ; else {
|
|
12663
12723
|
control.updatePosition(prevProgressInPanel);
|
|
12664
12724
|
control.updateInput();
|
|
@@ -12895,7 +12955,7 @@ version: 4.11.0-snapshot
|
|
|
12895
12955
|
* Flicking.VERSION; // ex) 4.0.0
|
|
12896
12956
|
* ```
|
|
12897
12957
|
*/
|
|
12898
|
-
Flicking.VERSION = "4.11.
|
|
12958
|
+
Flicking.VERSION = "4.11.3-beta.4";
|
|
12899
12959
|
return Flicking;
|
|
12900
12960
|
}(Component);
|
|
12901
12961
|
|