@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
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.12.0-beta.
|
|
7
|
+
version: 4.12.0-beta.2
|
|
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')) :
|
|
@@ -387,6 +387,8 @@ version: 4.12.0-beta.0
|
|
|
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 @@ version: 4.12.0-beta.0
|
|
|
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
|
var Constants = {
|
|
418
431
|
__proto__: null,
|
|
@@ -423,6 +436,7 @@ version: 4.12.0-beta.0
|
|
|
423
436
|
CLASS: CLASS,
|
|
424
437
|
CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
|
|
425
438
|
ORDER: ORDER,
|
|
439
|
+
MOVE_DIRECTION: MOVE_DIRECTION,
|
|
426
440
|
ERROR_CODE: CODE
|
|
427
441
|
};
|
|
428
442
|
|
|
@@ -7955,10 +7969,243 @@ version: 4.12.0-beta.0
|
|
|
7955
7969
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7956
7970
|
* ```
|
|
7957
7971
|
*/
|
|
7958
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7972
|
+
Flicking.VERSION = "4.12.0-beta.2";
|
|
7959
7973
|
return Flicking;
|
|
7960
7974
|
}(Component);
|
|
7961
7975
|
|
|
7976
|
+
/*
|
|
7977
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
7978
|
+
* egjs projects are licensed under the MIT license
|
|
7979
|
+
*/
|
|
7980
|
+
/**
|
|
7981
|
+
* @extends Component
|
|
7982
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
7983
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
7984
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
7985
|
+
*/
|
|
7986
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7987
|
+
__extends(CrossFlicking, _super);
|
|
7988
|
+
// Options Setter
|
|
7989
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
7990
|
+
// this._align = val;
|
|
7991
|
+
// }
|
|
7992
|
+
function CrossFlicking(root, _a) {
|
|
7993
|
+
var _b = (_a === void 0 ? {} : _a).verticalOptions,
|
|
7994
|
+
verticalOptions = _b === void 0 ? undefined : _b;
|
|
7995
|
+
var _this = _super.call(this, root) || this;
|
|
7996
|
+
_this._onHorizontalHoldStart = function () {
|
|
7997
|
+
_this.dragThreshold = 10;
|
|
7998
|
+
_this._moveDirection = null;
|
|
7999
|
+
};
|
|
8000
|
+
_this._onHorizontalMove = function (e) {
|
|
8001
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
8002
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8003
|
+
child.dragThreshold = Infinity;
|
|
8004
|
+
});
|
|
8005
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
8006
|
+
}
|
|
8007
|
+
};
|
|
8008
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
8009
|
+
var visiblePanels = _this.visiblePanels;
|
|
8010
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8011
|
+
child.dragThreshold = 10;
|
|
8012
|
+
});
|
|
8013
|
+
_this._moveDirection = null;
|
|
8014
|
+
if (visiblePanels.length > 1) {
|
|
8015
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
8016
|
+
} else {
|
|
8017
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
8018
|
+
}
|
|
8019
|
+
_this._verticalFlicking.forEach(function (child, i) {
|
|
8020
|
+
if (_this._nextIndex !== i) {
|
|
8021
|
+
var _a = _this._verticalState[i],
|
|
8022
|
+
start = _a.start,
|
|
8023
|
+
end = _a.end;
|
|
8024
|
+
if (child.index < start) {
|
|
8025
|
+
child.stopAnimation();
|
|
8026
|
+
void child.moveTo(start, 0);
|
|
8027
|
+
} else if (child.index > end) {
|
|
8028
|
+
child.stopAnimation();
|
|
8029
|
+
void child.moveTo(end, 0);
|
|
8030
|
+
}
|
|
8031
|
+
}
|
|
8032
|
+
});
|
|
8033
|
+
if (e.isTrusted) {
|
|
8034
|
+
_this._syncToCategory(_this._verticalFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
8035
|
+
}
|
|
8036
|
+
};
|
|
8037
|
+
_this._onVerticalHoldStart = function () {
|
|
8038
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8039
|
+
child.dragThreshold = 10;
|
|
8040
|
+
});
|
|
8041
|
+
_this._moveDirection = null;
|
|
8042
|
+
};
|
|
8043
|
+
_this._onVerticalMove = function (e) {
|
|
8044
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
8045
|
+
_this.dragThreshold = Infinity;
|
|
8046
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
8047
|
+
}
|
|
8048
|
+
};
|
|
8049
|
+
_this._onVerticalMoveEnd = function () {
|
|
8050
|
+
_this.dragThreshold = 10;
|
|
8051
|
+
_this._moveDirection = null;
|
|
8052
|
+
};
|
|
8053
|
+
_this._onVerticalChanged = function (e) {
|
|
8054
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
8055
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
8056
|
+
if (_this.visiblePanels.length < 2 && _this._verticalFlicking[_this.index] === e.currentTarget) {
|
|
8057
|
+
_this._syncToCategory(e.index, _this.index);
|
|
8058
|
+
}
|
|
8059
|
+
};
|
|
8060
|
+
var horizontalPanels = toArray(getElement(root).children[0].children);
|
|
8061
|
+
// Internal states
|
|
8062
|
+
_this._verticalState = _this._createVerticalState(horizontalPanels);
|
|
8063
|
+
_this._moveDirection = null;
|
|
8064
|
+
_this._nextIndex = 0;
|
|
8065
|
+
// Bind options
|
|
8066
|
+
_this._verticalOptions = verticalOptions;
|
|
8067
|
+
// Create core components
|
|
8068
|
+
_this._verticalFlicking = _this._createVerticalFlicking(horizontalPanels);
|
|
8069
|
+
return _this;
|
|
8070
|
+
}
|
|
8071
|
+
var __proto = CrossFlicking.prototype;
|
|
8072
|
+
Object.defineProperty(__proto, "verticalFlicking", {
|
|
8073
|
+
// Components
|
|
8074
|
+
/**
|
|
8075
|
+
* {@link Control} instance of the Flicking
|
|
8076
|
+
* @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
|
|
8077
|
+
* @type {Control}
|
|
8078
|
+
* @default SnapControl
|
|
8079
|
+
* @readonly
|
|
8080
|
+
* @see Control
|
|
8081
|
+
* @see SnapControl
|
|
8082
|
+
* @see FreeControl
|
|
8083
|
+
*/
|
|
8084
|
+
get: function () {
|
|
8085
|
+
return this._verticalFlicking;
|
|
8086
|
+
},
|
|
8087
|
+
enumerable: false,
|
|
8088
|
+
configurable: true
|
|
8089
|
+
});
|
|
8090
|
+
Object.defineProperty(__proto, "verticalState", {
|
|
8091
|
+
// Internal States
|
|
8092
|
+
/**
|
|
8093
|
+
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
8094
|
+
* This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
|
|
8095
|
+
* @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
|
|
8096
|
+
* 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
|
|
8097
|
+
* @type {boolean}
|
|
8098
|
+
* @default false
|
|
8099
|
+
* @readonly
|
|
8100
|
+
*/
|
|
8101
|
+
get: function () {
|
|
8102
|
+
return this._verticalState;
|
|
8103
|
+
},
|
|
8104
|
+
enumerable: false,
|
|
8105
|
+
configurable: true
|
|
8106
|
+
});
|
|
8107
|
+
Object.defineProperty(__proto, "verticalOptions", {
|
|
8108
|
+
// Options Getter
|
|
8109
|
+
/**
|
|
8110
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
8111
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
8112
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
8113
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
8114
|
+
* @type {FlickingOptions}
|
|
8115
|
+
* @default undefined
|
|
8116
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
8117
|
+
*/
|
|
8118
|
+
get: function () {
|
|
8119
|
+
return this._verticalOptions;
|
|
8120
|
+
},
|
|
8121
|
+
enumerable: false,
|
|
8122
|
+
configurable: true
|
|
8123
|
+
});
|
|
8124
|
+
/**
|
|
8125
|
+
* Initialize Flicking and move to the default index
|
|
8126
|
+
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
8127
|
+
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
8128
|
+
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
8129
|
+
* @fires Flicking#ready
|
|
8130
|
+
* @return {Promise<void>}
|
|
8131
|
+
*/
|
|
8132
|
+
__proto.init = function () {
|
|
8133
|
+
var _this = this;
|
|
8134
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8135
|
+
return _this._addComponentEvents();
|
|
8136
|
+
});
|
|
8137
|
+
};
|
|
8138
|
+
__proto._addComponentEvents = function () {
|
|
8139
|
+
var _this = this;
|
|
8140
|
+
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8141
|
+
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8142
|
+
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8143
|
+
this._verticalFlicking.forEach(function (flicking) {
|
|
8144
|
+
flicking.on(EVENTS.HOLD_START, _this._onVerticalHoldStart);
|
|
8145
|
+
flicking.on(EVENTS.MOVE, _this._onVerticalMove);
|
|
8146
|
+
flicking.on(EVENTS.MOVE_END, _this._onVerticalMoveEnd);
|
|
8147
|
+
flicking.on(EVENTS.CHANGED, _this._onVerticalChanged);
|
|
8148
|
+
});
|
|
8149
|
+
};
|
|
8150
|
+
__proto._createVerticalState = function (panels) {
|
|
8151
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
|
|
8152
|
+
// panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
|
|
8153
|
+
// 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
|
|
8154
|
+
var verticalPanels = "";
|
|
8155
|
+
var verticalState = panels.reduce(function (state, panel) {
|
|
8156
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8157
|
+
verticalPanels += panel.innerHTML;
|
|
8158
|
+
return __spread(state, [{
|
|
8159
|
+
start: start,
|
|
8160
|
+
end: start + panel.children.length - 1,
|
|
8161
|
+
element: panel
|
|
8162
|
+
}]);
|
|
8163
|
+
}, []);
|
|
8164
|
+
var verticalCamera = document.createElement("div");
|
|
8165
|
+
verticalCamera.classList.add(CLASS.CAMERA);
|
|
8166
|
+
verticalCamera.innerHTML = verticalPanels;
|
|
8167
|
+
panels.forEach(function (panel) {
|
|
8168
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8169
|
+
if (!panel.classList.contains(className)) {
|
|
8170
|
+
panel.classList.add(className);
|
|
8171
|
+
}
|
|
8172
|
+
});
|
|
8173
|
+
panel.innerHTML = verticalCamera.outerHTML;
|
|
8174
|
+
});
|
|
8175
|
+
return verticalState;
|
|
8176
|
+
};
|
|
8177
|
+
__proto._createVerticalFlicking = function (panels) {
|
|
8178
|
+
var _this = this;
|
|
8179
|
+
return panels.map(function (panel, i) {
|
|
8180
|
+
return new Flicking(panel, __assign(__assign({}, _this.verticalOptions), {
|
|
8181
|
+
horizontal: false,
|
|
8182
|
+
panelsPerView: 1,
|
|
8183
|
+
defaultIndex: _this._verticalState[i].start
|
|
8184
|
+
}));
|
|
8185
|
+
});
|
|
8186
|
+
};
|
|
8187
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8188
|
+
var _this = this;
|
|
8189
|
+
this.stopAnimation();
|
|
8190
|
+
this._verticalFlicking.forEach(function (child, i) {
|
|
8191
|
+
var _a = _this._verticalState[i],
|
|
8192
|
+
start = _a.start,
|
|
8193
|
+
end = _a.end;
|
|
8194
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8195
|
+
child.stopAnimation();
|
|
8196
|
+
void child.moveTo(index, 0);
|
|
8197
|
+
void _this.moveTo(i, 0);
|
|
8198
|
+
}
|
|
8199
|
+
});
|
|
8200
|
+
};
|
|
8201
|
+
return CrossFlicking;
|
|
8202
|
+
}(Flicking);
|
|
8203
|
+
|
|
8204
|
+
var CrossFlicking$1 = {
|
|
8205
|
+
__proto__: null,
|
|
8206
|
+
CrossFlicking: CrossFlicking
|
|
8207
|
+
};
|
|
8208
|
+
|
|
7962
8209
|
/*
|
|
7963
8210
|
* Copyright (c) 2015 NAVER Corp.
|
|
7964
8211
|
* egjs projects are licensed under the MIT license
|
|
@@ -8204,6 +8451,7 @@ version: 4.12.0-beta.0
|
|
|
8204
8451
|
merge(Flicking, Constants);
|
|
8205
8452
|
merge(Flicking, CFC);
|
|
8206
8453
|
merge(Flicking, Utils);
|
|
8454
|
+
merge(Flicking, CrossFlicking$1);
|
|
8207
8455
|
|
|
8208
8456
|
return Flicking;
|
|
8209
8457
|
|