@egjs/flicking 4.12.0-beta.0 → 4.12.0-beta.2
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/CrossFlicking.d.ts +34 -0
- package/declaration/const/external.d.ts +6 -0
- package/declaration/index.d.ts +1 -0
- package/dist/flicking.cjs.js +247 -2
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +244 -3
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +250 -2
- 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 +1015 -760
- 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/CrossFlicking.ts +296 -0
- package/src/const/external.ts +14 -0
- package/src/index.ts +2 -0
- package/src/index.umd.ts +2 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Flicking, { FlickingOptions } from "./Flicking";
|
|
2
|
+
export interface CrossFlickingEvents {
|
|
3
|
+
}
|
|
4
|
+
export interface CrossFlickingOptions {
|
|
5
|
+
verticalOptions: FlickingOptions | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface VerticalState {
|
|
8
|
+
start: number;
|
|
9
|
+
end: number;
|
|
10
|
+
element: HTMLElement;
|
|
11
|
+
}
|
|
12
|
+
export declare class CrossFlicking extends Flicking {
|
|
13
|
+
private _verticalFlicking;
|
|
14
|
+
private _verticalOptions;
|
|
15
|
+
private _verticalState;
|
|
16
|
+
private _moveDirection;
|
|
17
|
+
private _nextIndex;
|
|
18
|
+
get verticalFlicking(): Flicking[];
|
|
19
|
+
get verticalState(): VerticalState[];
|
|
20
|
+
get verticalOptions(): FlickingOptions;
|
|
21
|
+
constructor(root: HTMLElement | string, { verticalOptions }?: Partial<CrossFlickingOptions>);
|
|
22
|
+
init(): Promise<void>;
|
|
23
|
+
private _addComponentEvents;
|
|
24
|
+
private _createVerticalState;
|
|
25
|
+
private _createVerticalFlicking;
|
|
26
|
+
private _syncToCategory;
|
|
27
|
+
private _onHorizontalHoldStart;
|
|
28
|
+
private _onHorizontalMove;
|
|
29
|
+
private _onHorizontalMoveEnd;
|
|
30
|
+
private _onVerticalHoldStart;
|
|
31
|
+
private _onVerticalMove;
|
|
32
|
+
private _onVerticalMoveEnd;
|
|
33
|
+
private _onVerticalChanged;
|
|
34
|
+
}
|
|
@@ -34,6 +34,8 @@ export declare const MOVE_TYPE: {
|
|
|
34
34
|
readonly STRICT: "strict";
|
|
35
35
|
};
|
|
36
36
|
export declare const CLASS: {
|
|
37
|
+
VIEWPORT: string;
|
|
38
|
+
CAMERA: string;
|
|
37
39
|
VERTICAL: string;
|
|
38
40
|
HIDDEN: string;
|
|
39
41
|
DEFAULT_VIRTUAL: string;
|
|
@@ -46,3 +48,7 @@ export declare const ORDER: {
|
|
|
46
48
|
readonly LTR: "ltr";
|
|
47
49
|
readonly RTL: "rtl";
|
|
48
50
|
};
|
|
51
|
+
export declare const MOVE_DIRECTION: {
|
|
52
|
+
readonly HORIZONTAL: "horizontal";
|
|
53
|
+
readonly VERTICAL: "vertical";
|
|
54
|
+
};
|
package/declaration/index.d.ts
CHANGED
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.12.0-beta.
|
|
7
|
+
version: 4.12.0-beta.2
|
|
8
8
|
*/
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -387,6 +387,8 @@ var MOVE_TYPE = {
|
|
|
387
387
|
STRICT: "strict"
|
|
388
388
|
};
|
|
389
389
|
var CLASS = {
|
|
390
|
+
VIEWPORT: "flicking-viewport",
|
|
391
|
+
CAMERA: "flicking-camera",
|
|
390
392
|
VERTICAL: "vertical",
|
|
391
393
|
HIDDEN: "flicking-hidden",
|
|
392
394
|
DEFAULT_VIRTUAL: "flicking-panel"
|
|
@@ -413,6 +415,17 @@ var ORDER = {
|
|
|
413
415
|
LTR: "ltr",
|
|
414
416
|
RTL: "rtl"
|
|
415
417
|
};
|
|
418
|
+
/**
|
|
419
|
+
* An object that contains the direction that {@link Flicking} is moving
|
|
420
|
+
* @ko {@link Flicking}이 움직이는 방향을 담고 있는 객체
|
|
421
|
+
* @type {object}
|
|
422
|
+
* @property {"horizontal"} HORIZONTAL horizontal<ko>수평 방향</ko>
|
|
423
|
+
* @property {"vertical"} VERTICAL vertical<ko>수직 방향</ko>
|
|
424
|
+
*/
|
|
425
|
+
var MOVE_DIRECTION = {
|
|
426
|
+
HORIZONTAL: "horizontal",
|
|
427
|
+
VERTICAL: "vertical"
|
|
428
|
+
};
|
|
416
429
|
|
|
417
430
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
418
431
|
var merge = function (target) {
|
|
@@ -7862,10 +7875,238 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7862
7875
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7863
7876
|
* ```
|
|
7864
7877
|
*/
|
|
7865
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7878
|
+
Flicking.VERSION = "4.12.0-beta.2";
|
|
7866
7879
|
return Flicking;
|
|
7867
7880
|
}(Component);
|
|
7868
7881
|
|
|
7882
|
+
/*
|
|
7883
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
7884
|
+
* egjs projects are licensed under the MIT license
|
|
7885
|
+
*/
|
|
7886
|
+
/**
|
|
7887
|
+
* @extends Component
|
|
7888
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
7889
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
7890
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
7891
|
+
*/
|
|
7892
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7893
|
+
__extends(CrossFlicking, _super);
|
|
7894
|
+
// Options Setter
|
|
7895
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
7896
|
+
// this._align = val;
|
|
7897
|
+
// }
|
|
7898
|
+
function CrossFlicking(root, _a) {
|
|
7899
|
+
var _b = (_a === void 0 ? {} : _a).verticalOptions,
|
|
7900
|
+
verticalOptions = _b === void 0 ? undefined : _b;
|
|
7901
|
+
var _this = _super.call(this, root) || this;
|
|
7902
|
+
_this._onHorizontalHoldStart = function () {
|
|
7903
|
+
_this.dragThreshold = 10;
|
|
7904
|
+
_this._moveDirection = null;
|
|
7905
|
+
};
|
|
7906
|
+
_this._onHorizontalMove = function (e) {
|
|
7907
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7908
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7909
|
+
child.dragThreshold = Infinity;
|
|
7910
|
+
});
|
|
7911
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
7912
|
+
}
|
|
7913
|
+
};
|
|
7914
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
7915
|
+
var visiblePanels = _this.visiblePanels;
|
|
7916
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7917
|
+
child.dragThreshold = 10;
|
|
7918
|
+
});
|
|
7919
|
+
_this._moveDirection = null;
|
|
7920
|
+
if (visiblePanels.length > 1) {
|
|
7921
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
7922
|
+
} else {
|
|
7923
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
7924
|
+
}
|
|
7925
|
+
_this._verticalFlicking.forEach(function (child, i) {
|
|
7926
|
+
if (_this._nextIndex !== i) {
|
|
7927
|
+
var _a = _this._verticalState[i],
|
|
7928
|
+
start = _a.start,
|
|
7929
|
+
end = _a.end;
|
|
7930
|
+
if (child.index < start) {
|
|
7931
|
+
child.stopAnimation();
|
|
7932
|
+
void child.moveTo(start, 0);
|
|
7933
|
+
} else if (child.index > end) {
|
|
7934
|
+
child.stopAnimation();
|
|
7935
|
+
void child.moveTo(end, 0);
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
});
|
|
7939
|
+
if (e.isTrusted) {
|
|
7940
|
+
_this._syncToCategory(_this._verticalFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
7941
|
+
}
|
|
7942
|
+
};
|
|
7943
|
+
_this._onVerticalHoldStart = function () {
|
|
7944
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7945
|
+
child.dragThreshold = 10;
|
|
7946
|
+
});
|
|
7947
|
+
_this._moveDirection = null;
|
|
7948
|
+
};
|
|
7949
|
+
_this._onVerticalMove = function (e) {
|
|
7950
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7951
|
+
_this.dragThreshold = Infinity;
|
|
7952
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
7953
|
+
}
|
|
7954
|
+
};
|
|
7955
|
+
_this._onVerticalMoveEnd = function () {
|
|
7956
|
+
_this.dragThreshold = 10;
|
|
7957
|
+
_this._moveDirection = null;
|
|
7958
|
+
};
|
|
7959
|
+
_this._onVerticalChanged = function (e) {
|
|
7960
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
7961
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
7962
|
+
if (_this.visiblePanels.length < 2 && _this._verticalFlicking[_this.index] === e.currentTarget) {
|
|
7963
|
+
_this._syncToCategory(e.index, _this.index);
|
|
7964
|
+
}
|
|
7965
|
+
};
|
|
7966
|
+
var horizontalPanels = toArray(getElement(root).children[0].children);
|
|
7967
|
+
// Internal states
|
|
7968
|
+
_this._verticalState = _this._createVerticalState(horizontalPanels);
|
|
7969
|
+
_this._moveDirection = null;
|
|
7970
|
+
_this._nextIndex = 0;
|
|
7971
|
+
// Bind options
|
|
7972
|
+
_this._verticalOptions = verticalOptions;
|
|
7973
|
+
// Create core components
|
|
7974
|
+
_this._verticalFlicking = _this._createVerticalFlicking(horizontalPanels);
|
|
7975
|
+
return _this;
|
|
7976
|
+
}
|
|
7977
|
+
var __proto = CrossFlicking.prototype;
|
|
7978
|
+
Object.defineProperty(__proto, "verticalFlicking", {
|
|
7979
|
+
// Components
|
|
7980
|
+
/**
|
|
7981
|
+
* {@link Control} instance of the Flicking
|
|
7982
|
+
* @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
|
|
7983
|
+
* @type {Control}
|
|
7984
|
+
* @default SnapControl
|
|
7985
|
+
* @readonly
|
|
7986
|
+
* @see Control
|
|
7987
|
+
* @see SnapControl
|
|
7988
|
+
* @see FreeControl
|
|
7989
|
+
*/
|
|
7990
|
+
get: function () {
|
|
7991
|
+
return this._verticalFlicking;
|
|
7992
|
+
},
|
|
7993
|
+
enumerable: false,
|
|
7994
|
+
configurable: true
|
|
7995
|
+
});
|
|
7996
|
+
Object.defineProperty(__proto, "verticalState", {
|
|
7997
|
+
// Internal States
|
|
7998
|
+
/**
|
|
7999
|
+
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
8000
|
+
* This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
|
|
8001
|
+
* @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
|
|
8002
|
+
* 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
|
|
8003
|
+
* @type {boolean}
|
|
8004
|
+
* @default false
|
|
8005
|
+
* @readonly
|
|
8006
|
+
*/
|
|
8007
|
+
get: function () {
|
|
8008
|
+
return this._verticalState;
|
|
8009
|
+
},
|
|
8010
|
+
enumerable: false,
|
|
8011
|
+
configurable: true
|
|
8012
|
+
});
|
|
8013
|
+
Object.defineProperty(__proto, "verticalOptions", {
|
|
8014
|
+
// Options Getter
|
|
8015
|
+
/**
|
|
8016
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
8017
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
8018
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
8019
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
8020
|
+
* @type {FlickingOptions}
|
|
8021
|
+
* @default undefined
|
|
8022
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
8023
|
+
*/
|
|
8024
|
+
get: function () {
|
|
8025
|
+
return this._verticalOptions;
|
|
8026
|
+
},
|
|
8027
|
+
enumerable: false,
|
|
8028
|
+
configurable: true
|
|
8029
|
+
});
|
|
8030
|
+
/**
|
|
8031
|
+
* Initialize Flicking and move to the default index
|
|
8032
|
+
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
8033
|
+
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
8034
|
+
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
8035
|
+
* @fires Flicking#ready
|
|
8036
|
+
* @return {Promise<void>}
|
|
8037
|
+
*/
|
|
8038
|
+
__proto.init = function () {
|
|
8039
|
+
var _this = this;
|
|
8040
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8041
|
+
return _this._addComponentEvents();
|
|
8042
|
+
});
|
|
8043
|
+
};
|
|
8044
|
+
__proto._addComponentEvents = function () {
|
|
8045
|
+
var _this = this;
|
|
8046
|
+
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8047
|
+
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8048
|
+
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8049
|
+
this._verticalFlicking.forEach(function (flicking) {
|
|
8050
|
+
flicking.on(EVENTS.HOLD_START, _this._onVerticalHoldStart);
|
|
8051
|
+
flicking.on(EVENTS.MOVE, _this._onVerticalMove);
|
|
8052
|
+
flicking.on(EVENTS.MOVE_END, _this._onVerticalMoveEnd);
|
|
8053
|
+
flicking.on(EVENTS.CHANGED, _this._onVerticalChanged);
|
|
8054
|
+
});
|
|
8055
|
+
};
|
|
8056
|
+
__proto._createVerticalState = function (panels) {
|
|
8057
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
|
|
8058
|
+
// panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
|
|
8059
|
+
// 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
|
|
8060
|
+
var verticalPanels = "";
|
|
8061
|
+
var verticalState = panels.reduce(function (state, panel) {
|
|
8062
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8063
|
+
verticalPanels += panel.innerHTML;
|
|
8064
|
+
return __spread(state, [{
|
|
8065
|
+
start: start,
|
|
8066
|
+
end: start + panel.children.length - 1,
|
|
8067
|
+
element: panel
|
|
8068
|
+
}]);
|
|
8069
|
+
}, []);
|
|
8070
|
+
var verticalCamera = document.createElement("div");
|
|
8071
|
+
verticalCamera.classList.add(CLASS.CAMERA);
|
|
8072
|
+
verticalCamera.innerHTML = verticalPanels;
|
|
8073
|
+
panels.forEach(function (panel) {
|
|
8074
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8075
|
+
if (!panel.classList.contains(className)) {
|
|
8076
|
+
panel.classList.add(className);
|
|
8077
|
+
}
|
|
8078
|
+
});
|
|
8079
|
+
panel.innerHTML = verticalCamera.outerHTML;
|
|
8080
|
+
});
|
|
8081
|
+
return verticalState;
|
|
8082
|
+
};
|
|
8083
|
+
__proto._createVerticalFlicking = function (panels) {
|
|
8084
|
+
var _this = this;
|
|
8085
|
+
return panels.map(function (panel, i) {
|
|
8086
|
+
return new Flicking(panel, __assign(__assign({}, _this.verticalOptions), {
|
|
8087
|
+
horizontal: false,
|
|
8088
|
+
panelsPerView: 1,
|
|
8089
|
+
defaultIndex: _this._verticalState[i].start
|
|
8090
|
+
}));
|
|
8091
|
+
});
|
|
8092
|
+
};
|
|
8093
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8094
|
+
var _this = this;
|
|
8095
|
+
this.stopAnimation();
|
|
8096
|
+
this._verticalFlicking.forEach(function (child, i) {
|
|
8097
|
+
var _a = _this._verticalState[i],
|
|
8098
|
+
start = _a.start,
|
|
8099
|
+
end = _a.end;
|
|
8100
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8101
|
+
child.stopAnimation();
|
|
8102
|
+
void child.moveTo(index, 0);
|
|
8103
|
+
void _this.moveTo(i, 0);
|
|
8104
|
+
}
|
|
8105
|
+
});
|
|
8106
|
+
};
|
|
8107
|
+
return CrossFlicking;
|
|
8108
|
+
}(Flicking);
|
|
8109
|
+
|
|
7869
8110
|
/**
|
|
7870
8111
|
* Decorator that makes the method of flicking available in the framework.
|
|
7871
8112
|
* @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
|
|
@@ -8083,6 +8324,7 @@ var parseAlign = function (alignVal) {
|
|
|
8083
8324
|
var modules = {
|
|
8084
8325
|
__proto__: null,
|
|
8085
8326
|
'default': Flicking,
|
|
8327
|
+
CrossFlicking: CrossFlicking,
|
|
8086
8328
|
VanillaElementProvider: VanillaElementProvider,
|
|
8087
8329
|
VirtualElementProvider: VirtualElementProvider,
|
|
8088
8330
|
Panel: Panel,
|
|
@@ -8120,6 +8362,7 @@ var modules = {
|
|
|
8120
8362
|
CLASS: CLASS,
|
|
8121
8363
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
8122
8364
|
ORDER: ORDER,
|
|
8365
|
+
MOVE_DIRECTION: MOVE_DIRECTION,
|
|
8123
8366
|
withFlickingMethods: withFlickingMethods,
|
|
8124
8367
|
sync: sync,
|
|
8125
8368
|
getRenderingPanels: getRenderingPanels,
|
|
@@ -8174,6 +8417,7 @@ exports.CLASS = CLASS;
|
|
|
8174
8417
|
exports.Camera = Camera;
|
|
8175
8418
|
exports.CircularCameraMode = CircularCameraMode;
|
|
8176
8419
|
exports.Control = Control;
|
|
8420
|
+
exports.CrossFlicking = CrossFlicking;
|
|
8177
8421
|
exports.DIRECTION = DIRECTION;
|
|
8178
8422
|
exports.DisabledState = DisabledState;
|
|
8179
8423
|
exports.DraggingState = DraggingState;
|
|
@@ -8185,6 +8429,7 @@ exports.FreeControl = FreeControl;
|
|
|
8185
8429
|
exports.HoldingState = HoldingState;
|
|
8186
8430
|
exports.IdleState = IdleState;
|
|
8187
8431
|
exports.LinearCameraMode = LinearCameraMode;
|
|
8432
|
+
exports.MOVE_DIRECTION = MOVE_DIRECTION;
|
|
8188
8433
|
exports.MOVE_TYPE = MOVE_TYPE;
|
|
8189
8434
|
exports.NormalRenderingStrategy = NormalRenderingStrategy;
|
|
8190
8435
|
exports.ORDER = ORDER;
|