@egjs/flicking 4.10.8 → 4.11.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 +5 -1
- package/declaration/camera/Camera.d.ts +7 -0
- package/declaration/const/external.d.ts +4 -0
- package/declaration/index.cjs.d.ts +3 -0
- package/dist/flicking.cjs.js +8197 -0
- package/dist/flicking.cjs.js.map +1 -0
- package/dist/flicking.esm.js +105 -34
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +105 -33
- 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 +125 -60
- 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 +4 -4
- package/rollup.config.js +6 -0
- package/src/Flicking.ts +22 -1
- package/src/camera/Camera.ts +36 -3
- package/src/const/external.ts +12 -0
- package/src/control/AxesController.ts +4 -2
- package/src/index.cjs.ts +14 -0
- package/src/utils.ts +7 -4
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egjs/flicking",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
|
|
5
|
-
"main": "dist/flicking.js",
|
|
5
|
+
"main": "dist/flicking.cjs.js",
|
|
6
6
|
"module": "dist/flicking.esm.js",
|
|
7
7
|
"sideEffects": [
|
|
8
8
|
"**/*.css",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"rollup-plugin-prototype-minify": "^1.1.0",
|
|
128
128
|
"rollup-plugin-serve": "^1.1.0",
|
|
129
129
|
"rollup-plugin-terser": "^7.0.2",
|
|
130
|
-
"rollup-plugin-typescript2": "^0.
|
|
130
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
131
131
|
"rollup-plugin-visualizer": "^4.2.1",
|
|
132
132
|
"sync-exec": "^0.6.2",
|
|
133
133
|
"ts-mock-imports": "^1.3.3",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"typescript-transform-paths": "^2.2.3"
|
|
140
140
|
},
|
|
141
141
|
"dependencies": {
|
|
142
|
-
"@egjs/axes": "^3.
|
|
142
|
+
"@egjs/axes": "^3.9.0",
|
|
143
143
|
"@egjs/component": "^3.0.1",
|
|
144
144
|
"@egjs/imready": "^1.3.1",
|
|
145
145
|
"@egjs/list-differ": "^1.0.1"
|
package/rollup.config.js
CHANGED
package/src/Flicking.ts
CHANGED
|
@@ -77,6 +77,7 @@ export interface FlickingOptions {
|
|
|
77
77
|
bounce: number | string | [number | string, number | string];
|
|
78
78
|
iOSEdgeSwipeThreshold: number;
|
|
79
79
|
preventClickOnDrag: boolean;
|
|
80
|
+
preventDefaultOnDrag: boolean;
|
|
80
81
|
disableOnInit: boolean;
|
|
81
82
|
changeOnHold: boolean;
|
|
82
83
|
|
|
@@ -155,6 +156,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
155
156
|
private _bounce: FlickingOptions["bounce"];
|
|
156
157
|
private _iOSEdgeSwipeThreshold: FlickingOptions["iOSEdgeSwipeThreshold"];
|
|
157
158
|
private _preventClickOnDrag: FlickingOptions["preventClickOnDrag"];
|
|
159
|
+
private _preventDefaultOnDrag: FlickingOptions["preventDefaultOnDrag"];
|
|
158
160
|
private _disableOnInit: FlickingOptions["disableOnInit"];
|
|
159
161
|
private _changeOnHold: FlickingOptions["changeOnHold"];
|
|
160
162
|
|
|
@@ -589,6 +591,14 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
589
591
|
* @see {@link https://naver.github.io/egjs-flicking/Options#preventclickondrag preventClickOnDrag ( Options )}
|
|
590
592
|
*/
|
|
591
593
|
public get preventClickOnDrag() { return this._preventClickOnDrag; }
|
|
594
|
+
/**
|
|
595
|
+
* Whether to use the {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} when the user starts dragging
|
|
596
|
+
* @ko 사용자가 드래그를 시작할 때 {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} 실행 여부
|
|
597
|
+
* @type {boolean}
|
|
598
|
+
* @default false
|
|
599
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#preventDefaultOnDrag preventDefaultOnDrag ( Options )}
|
|
600
|
+
*/
|
|
601
|
+
public get preventDefaultOnDrag() { return this._preventDefaultOnDrag; }
|
|
592
602
|
/**
|
|
593
603
|
* Automatically call {@link Flicking#disableInput disableInput()} on initialization
|
|
594
604
|
* @ko Flicking init시에 {@link Flicking#disableInput disableInput()}을 바로 호출합니다
|
|
@@ -875,6 +885,15 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
875
885
|
this._preventClickOnDrag = val;
|
|
876
886
|
}
|
|
877
887
|
|
|
888
|
+
public set preventDefaultOnDrag(val: FlickingOptions["preventDefaultOnDrag"]) {
|
|
889
|
+
this._preventDefaultOnDrag = val;
|
|
890
|
+
const panInput = this._control.controller.panInput;
|
|
891
|
+
|
|
892
|
+
if (panInput) {
|
|
893
|
+
panInput.options.preventDefaultOnDrag = val;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
878
897
|
public set disableOnInit(val: FlickingOptions["disableOnInit"]) { this._disableOnInit = val; }
|
|
879
898
|
public set changeOnHold(val: FlickingOptions["changeOnHold"]) { this._changeOnHold = val; }
|
|
880
899
|
// PERFORMANCE
|
|
@@ -954,6 +973,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
954
973
|
bounce = "20%",
|
|
955
974
|
iOSEdgeSwipeThreshold = 30,
|
|
956
975
|
preventClickOnDrag = true,
|
|
976
|
+
preventDefaultOnDrag = false,
|
|
957
977
|
disableOnInit = false,
|
|
958
978
|
changeOnHold = false,
|
|
959
979
|
renderOnlyVisible = false,
|
|
@@ -998,6 +1018,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
998
1018
|
this._bounce = bounce;
|
|
999
1019
|
this._iOSEdgeSwipeThreshold = iOSEdgeSwipeThreshold;
|
|
1000
1020
|
this._preventClickOnDrag = preventClickOnDrag;
|
|
1021
|
+
this._preventDefaultOnDrag = preventDefaultOnDrag;
|
|
1001
1022
|
this._disableOnInit = disableOnInit;
|
|
1002
1023
|
this._changeOnHold = changeOnHold;
|
|
1003
1024
|
this._renderOnlyVisible = renderOnlyVisible;
|
|
@@ -1054,7 +1075,6 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1054
1075
|
|
|
1055
1076
|
// Look at initial panel
|
|
1056
1077
|
this._moveToInitialPanel();
|
|
1057
|
-
|
|
1058
1078
|
if (this._autoResize) {
|
|
1059
1079
|
this._autoResizer.enable();
|
|
1060
1080
|
}
|
|
@@ -1488,6 +1508,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1488
1508
|
camera.updateRange();
|
|
1489
1509
|
camera.updateAnchors();
|
|
1490
1510
|
camera.updateAdaptiveHeight();
|
|
1511
|
+
camera.updatePanelOrder();
|
|
1491
1512
|
camera.updateOffset();
|
|
1492
1513
|
await renderer.render();
|
|
1493
1514
|
|
package/src/camera/Camera.ts
CHANGED
|
@@ -9,8 +9,9 @@ import FlickingError from "../core/FlickingError";
|
|
|
9
9
|
import Panel from "../core/panel/Panel";
|
|
10
10
|
import AnchorPoint from "../core/AnchorPoint";
|
|
11
11
|
import * as ERROR from "../const/error";
|
|
12
|
-
import { ALIGN, CIRCULAR_FALLBACK, DIRECTION, EVENTS } from "../const/external";
|
|
13
|
-
import { checkExistence, find, getFlickingAttached, getProgress, includes, parseAlign, toArray } from "../utils";
|
|
12
|
+
import { ALIGN, CIRCULAR_FALLBACK, DIRECTION, EVENTS, ORDER } from "../const/external";
|
|
13
|
+
import { checkExistence, find, getFlickingAttached, getProgress, getStyle, includes, parseAlign, toArray } from "../utils";
|
|
14
|
+
import { ValueOf } from "../type/internal";
|
|
14
15
|
|
|
15
16
|
import { CameraMode, BoundCameraMode, CircularCameraMode, LinearCameraMode } from "./mode";
|
|
16
17
|
|
|
@@ -40,6 +41,7 @@ class Camera {
|
|
|
40
41
|
private _visiblePanels: Panel[];
|
|
41
42
|
private _anchors: AnchorPoint[];
|
|
42
43
|
private _needPanelTriggered: { prev: boolean; next: boolean };
|
|
44
|
+
private _panelOrder: ValueOf<typeof ORDER>;
|
|
43
45
|
|
|
44
46
|
// Internal states getter
|
|
45
47
|
/**
|
|
@@ -217,6 +219,14 @@ class Camera {
|
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
|
|
222
|
+
/**
|
|
223
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
|
|
224
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
|
|
225
|
+
* @type {string}
|
|
226
|
+
* @readonly
|
|
227
|
+
*/
|
|
228
|
+
public get panelOrder() { return this._panelOrder; }
|
|
229
|
+
|
|
220
230
|
// Options Getter
|
|
221
231
|
/**
|
|
222
232
|
* A value indicating where the {@link Camera#alignPosition alignPosition} should be located at inside the viewport element
|
|
@@ -257,6 +267,7 @@ class Camera {
|
|
|
257
267
|
this._checkTranslateSupport();
|
|
258
268
|
|
|
259
269
|
this._updateMode();
|
|
270
|
+
this.updatePanelOrder();
|
|
260
271
|
|
|
261
272
|
return this;
|
|
262
273
|
}
|
|
@@ -530,6 +541,28 @@ class Camera {
|
|
|
530
541
|
return this;
|
|
531
542
|
}
|
|
532
543
|
|
|
544
|
+
/**
|
|
545
|
+
* Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
|
|
546
|
+
* @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
|
|
547
|
+
* @return {this}
|
|
548
|
+
*/
|
|
549
|
+
public updatePanelOrder(): this {
|
|
550
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
551
|
+
|
|
552
|
+
if (!flicking.horizontal) return this;
|
|
553
|
+
|
|
554
|
+
const el = this._el;
|
|
555
|
+
const direction = getStyle(el).direction;
|
|
556
|
+
if (direction !== this._panelOrder) {
|
|
557
|
+
this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
|
|
558
|
+
if (flicking.initialized) {
|
|
559
|
+
flicking.control.controller.updateDirection();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return this;
|
|
564
|
+
}
|
|
565
|
+
|
|
533
566
|
/**
|
|
534
567
|
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
|
|
535
568
|
* @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
|
|
@@ -556,7 +589,7 @@ class Camera {
|
|
|
556
589
|
const actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
557
590
|
|
|
558
591
|
el.style[this._transform] = flicking.horizontal
|
|
559
|
-
? `translate(${-actualPosition}px)`
|
|
592
|
+
? `translate(${this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition}px)`
|
|
560
593
|
: `translate(0, ${-actualPosition}px)`;
|
|
561
594
|
|
|
562
595
|
return this;
|
package/src/const/external.ts
CHANGED
|
@@ -110,3 +110,15 @@ export const CIRCULAR_FALLBACK = {
|
|
|
110
110
|
LINEAR: "linear",
|
|
111
111
|
BOUND: "bound"
|
|
112
112
|
} as const;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 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`)
|
|
116
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성을 구분하기 위한 객체
|
|
117
|
+
* @type {object}
|
|
118
|
+
* @property {string} LTR "ltr"
|
|
119
|
+
* @property {string} RTL "rtl"
|
|
120
|
+
*/
|
|
121
|
+
export const ORDER = {
|
|
122
|
+
LTR: "ltr",
|
|
123
|
+
RTL: "rtl"
|
|
124
|
+
} as const;
|
|
@@ -8,6 +8,7 @@ import Flicking from "../Flicking";
|
|
|
8
8
|
import FlickingError from "../core/FlickingError";
|
|
9
9
|
import * as AXES from "../const/axes";
|
|
10
10
|
import * as ERROR from "../const/error";
|
|
11
|
+
import { ORDER } from "../const/external";
|
|
11
12
|
import { getFlickingAttached, parseBounce } from "../utils";
|
|
12
13
|
import { ControlParams } from "../type/external";
|
|
13
14
|
|
|
@@ -149,7 +150,8 @@ class AxesController {
|
|
|
149
150
|
inputType: flicking.inputType,
|
|
150
151
|
threshold: 1,
|
|
151
152
|
iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
|
|
152
|
-
|
|
153
|
+
preventDefaultOnDrag: flicking.preventDefaultOnDrag,
|
|
154
|
+
scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
|
|
153
155
|
releaseOnScroll: true
|
|
154
156
|
});
|
|
155
157
|
|
|
@@ -402,7 +404,7 @@ class AxesController {
|
|
|
402
404
|
axes.disconnect(panInput);
|
|
403
405
|
axes.connect(flicking.horizontal ? [AXES.POSITION_KEY, ""] : ["", AXES.POSITION_KEY], panInput);
|
|
404
406
|
|
|
405
|
-
panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
|
|
407
|
+
panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
|
|
406
408
|
}
|
|
407
409
|
|
|
408
410
|
private _resetInternalValues() {
|
package/src/index.cjs.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
3
|
+
* egjs projects are licensed under the MIT license
|
|
4
|
+
*/
|
|
5
|
+
import Flicking, * as modules from "./index";
|
|
6
|
+
|
|
7
|
+
for (const name in modules) {
|
|
8
|
+
(Flicking as any)[name] = (modules as any)[name];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const module: any;
|
|
12
|
+
module.exports = Flicking;
|
|
13
|
+
export default Flicking;
|
|
14
|
+
export * from "./index";
|
package/src/utils.ts
CHANGED
|
@@ -313,15 +313,16 @@ export const getElementSize = ({
|
|
|
313
313
|
useOffset: boolean;
|
|
314
314
|
style: CSSStyleDeclaration;
|
|
315
315
|
}): number => {
|
|
316
|
+
let size = 0;
|
|
316
317
|
if (useFractionalSize) {
|
|
317
|
-
const baseSize = parseFloat(horizontal ? style.width : style.height);
|
|
318
|
+
const baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
|
|
318
319
|
const isBorderBoxSizing = style.boxSizing === "border-box";
|
|
319
320
|
const border = horizontal
|
|
320
321
|
? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0")
|
|
321
322
|
: parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
|
|
322
323
|
|
|
323
324
|
if (isBorderBoxSizing) {
|
|
324
|
-
|
|
325
|
+
size = useOffset
|
|
325
326
|
? baseSize
|
|
326
327
|
: baseSize - border;
|
|
327
328
|
} else {
|
|
@@ -329,17 +330,19 @@ export const getElementSize = ({
|
|
|
329
330
|
? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0")
|
|
330
331
|
: parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
|
|
331
332
|
|
|
332
|
-
|
|
333
|
+
size = useOffset
|
|
333
334
|
? baseSize + padding + border
|
|
334
335
|
: baseSize + padding;
|
|
335
336
|
}
|
|
336
337
|
} else {
|
|
337
338
|
const sizeStr = horizontal ? "Width" : "Height";
|
|
338
339
|
|
|
339
|
-
|
|
340
|
+
size = useOffset
|
|
340
341
|
? el[`offset${sizeStr}`]
|
|
341
342
|
: el[`client${sizeStr}`];
|
|
342
343
|
}
|
|
344
|
+
|
|
345
|
+
return Math.max(size, 0);
|
|
343
346
|
};
|
|
344
347
|
|
|
345
348
|
export const setPrototypeOf = Object.setPrototypeOf || ((obj, proto) => {
|