@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.esm.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
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -385,6 +385,8 @@ var MOVE_TYPE = {
|
|
|
385
385
|
STRICT: "strict"
|
|
386
386
|
};
|
|
387
387
|
var CLASS = {
|
|
388
|
+
VIEWPORT: "flicking-viewport",
|
|
389
|
+
CAMERA: "flicking-camera",
|
|
388
390
|
VERTICAL: "vertical",
|
|
389
391
|
HIDDEN: "flicking-hidden",
|
|
390
392
|
DEFAULT_VIRTUAL: "flicking-panel"
|
|
@@ -411,6 +413,17 @@ var ORDER = {
|
|
|
411
413
|
LTR: "ltr",
|
|
412
414
|
RTL: "rtl"
|
|
413
415
|
};
|
|
416
|
+
/**
|
|
417
|
+
* An object that contains the direction that {@link Flicking} is moving
|
|
418
|
+
* @ko {@link Flicking}이 움직이는 방향을 담고 있는 객체
|
|
419
|
+
* @type {object}
|
|
420
|
+
* @property {"horizontal"} HORIZONTAL horizontal<ko>수평 방향</ko>
|
|
421
|
+
* @property {"vertical"} VERTICAL vertical<ko>수직 방향</ko>
|
|
422
|
+
*/
|
|
423
|
+
var MOVE_DIRECTION = {
|
|
424
|
+
HORIZONTAL: "horizontal",
|
|
425
|
+
VERTICAL: "vertical"
|
|
426
|
+
};
|
|
414
427
|
|
|
415
428
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
416
429
|
var merge = function (target) {
|
|
@@ -7860,10 +7873,238 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7860
7873
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7861
7874
|
* ```
|
|
7862
7875
|
*/
|
|
7863
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7876
|
+
Flicking.VERSION = "4.12.0-beta.2";
|
|
7864
7877
|
return Flicking;
|
|
7865
7878
|
}(Component);
|
|
7866
7879
|
|
|
7880
|
+
/*
|
|
7881
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
7882
|
+
* egjs projects are licensed under the MIT license
|
|
7883
|
+
*/
|
|
7884
|
+
/**
|
|
7885
|
+
* @extends Component
|
|
7886
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
7887
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
7888
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
7889
|
+
*/
|
|
7890
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7891
|
+
__extends(CrossFlicking, _super);
|
|
7892
|
+
// Options Setter
|
|
7893
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
7894
|
+
// this._align = val;
|
|
7895
|
+
// }
|
|
7896
|
+
function CrossFlicking(root, _a) {
|
|
7897
|
+
var _b = (_a === void 0 ? {} : _a).verticalOptions,
|
|
7898
|
+
verticalOptions = _b === void 0 ? undefined : _b;
|
|
7899
|
+
var _this = _super.call(this, root) || this;
|
|
7900
|
+
_this._onHorizontalHoldStart = function () {
|
|
7901
|
+
_this.dragThreshold = 10;
|
|
7902
|
+
_this._moveDirection = null;
|
|
7903
|
+
};
|
|
7904
|
+
_this._onHorizontalMove = function (e) {
|
|
7905
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7906
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7907
|
+
child.dragThreshold = Infinity;
|
|
7908
|
+
});
|
|
7909
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
7910
|
+
}
|
|
7911
|
+
};
|
|
7912
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
7913
|
+
var visiblePanels = _this.visiblePanels;
|
|
7914
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7915
|
+
child.dragThreshold = 10;
|
|
7916
|
+
});
|
|
7917
|
+
_this._moveDirection = null;
|
|
7918
|
+
if (visiblePanels.length > 1) {
|
|
7919
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
7920
|
+
} else {
|
|
7921
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
7922
|
+
}
|
|
7923
|
+
_this._verticalFlicking.forEach(function (child, i) {
|
|
7924
|
+
if (_this._nextIndex !== i) {
|
|
7925
|
+
var _a = _this._verticalState[i],
|
|
7926
|
+
start = _a.start,
|
|
7927
|
+
end = _a.end;
|
|
7928
|
+
if (child.index < start) {
|
|
7929
|
+
child.stopAnimation();
|
|
7930
|
+
void child.moveTo(start, 0);
|
|
7931
|
+
} else if (child.index > end) {
|
|
7932
|
+
child.stopAnimation();
|
|
7933
|
+
void child.moveTo(end, 0);
|
|
7934
|
+
}
|
|
7935
|
+
}
|
|
7936
|
+
});
|
|
7937
|
+
if (e.isTrusted) {
|
|
7938
|
+
_this._syncToCategory(_this._verticalFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
7939
|
+
}
|
|
7940
|
+
};
|
|
7941
|
+
_this._onVerticalHoldStart = function () {
|
|
7942
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7943
|
+
child.dragThreshold = 10;
|
|
7944
|
+
});
|
|
7945
|
+
_this._moveDirection = null;
|
|
7946
|
+
};
|
|
7947
|
+
_this._onVerticalMove = function (e) {
|
|
7948
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7949
|
+
_this.dragThreshold = Infinity;
|
|
7950
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
7951
|
+
}
|
|
7952
|
+
};
|
|
7953
|
+
_this._onVerticalMoveEnd = function () {
|
|
7954
|
+
_this.dragThreshold = 10;
|
|
7955
|
+
_this._moveDirection = null;
|
|
7956
|
+
};
|
|
7957
|
+
_this._onVerticalChanged = function (e) {
|
|
7958
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
7959
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
7960
|
+
if (_this.visiblePanels.length < 2 && _this._verticalFlicking[_this.index] === e.currentTarget) {
|
|
7961
|
+
_this._syncToCategory(e.index, _this.index);
|
|
7962
|
+
}
|
|
7963
|
+
};
|
|
7964
|
+
var horizontalPanels = toArray(getElement(root).children[0].children);
|
|
7965
|
+
// Internal states
|
|
7966
|
+
_this._verticalState = _this._createVerticalState(horizontalPanels);
|
|
7967
|
+
_this._moveDirection = null;
|
|
7968
|
+
_this._nextIndex = 0;
|
|
7969
|
+
// Bind options
|
|
7970
|
+
_this._verticalOptions = verticalOptions;
|
|
7971
|
+
// Create core components
|
|
7972
|
+
_this._verticalFlicking = _this._createVerticalFlicking(horizontalPanels);
|
|
7973
|
+
return _this;
|
|
7974
|
+
}
|
|
7975
|
+
var __proto = CrossFlicking.prototype;
|
|
7976
|
+
Object.defineProperty(__proto, "verticalFlicking", {
|
|
7977
|
+
// Components
|
|
7978
|
+
/**
|
|
7979
|
+
* {@link Control} instance of the Flicking
|
|
7980
|
+
* @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
|
|
7981
|
+
* @type {Control}
|
|
7982
|
+
* @default SnapControl
|
|
7983
|
+
* @readonly
|
|
7984
|
+
* @see Control
|
|
7985
|
+
* @see SnapControl
|
|
7986
|
+
* @see FreeControl
|
|
7987
|
+
*/
|
|
7988
|
+
get: function () {
|
|
7989
|
+
return this._verticalFlicking;
|
|
7990
|
+
},
|
|
7991
|
+
enumerable: false,
|
|
7992
|
+
configurable: true
|
|
7993
|
+
});
|
|
7994
|
+
Object.defineProperty(__proto, "verticalState", {
|
|
7995
|
+
// Internal States
|
|
7996
|
+
/**
|
|
7997
|
+
* Whether Flicking's {@link Flicking#init init()} is called.
|
|
7998
|
+
* This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
|
|
7999
|
+
* @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
|
|
8000
|
+
* 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
|
|
8001
|
+
* @type {boolean}
|
|
8002
|
+
* @default false
|
|
8003
|
+
* @readonly
|
|
8004
|
+
*/
|
|
8005
|
+
get: function () {
|
|
8006
|
+
return this._verticalState;
|
|
8007
|
+
},
|
|
8008
|
+
enumerable: false,
|
|
8009
|
+
configurable: true
|
|
8010
|
+
});
|
|
8011
|
+
Object.defineProperty(__proto, "verticalOptions", {
|
|
8012
|
+
// Options Getter
|
|
8013
|
+
/**
|
|
8014
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
8015
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
8016
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
8017
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
8018
|
+
* @type {FlickingOptions}
|
|
8019
|
+
* @default undefined
|
|
8020
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
8021
|
+
*/
|
|
8022
|
+
get: function () {
|
|
8023
|
+
return this._verticalOptions;
|
|
8024
|
+
},
|
|
8025
|
+
enumerable: false,
|
|
8026
|
+
configurable: true
|
|
8027
|
+
});
|
|
8028
|
+
/**
|
|
8029
|
+
* Initialize Flicking and move to the default index
|
|
8030
|
+
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
8031
|
+
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
8032
|
+
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
8033
|
+
* @fires Flicking#ready
|
|
8034
|
+
* @return {Promise<void>}
|
|
8035
|
+
*/
|
|
8036
|
+
__proto.init = function () {
|
|
8037
|
+
var _this = this;
|
|
8038
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8039
|
+
return _this._addComponentEvents();
|
|
8040
|
+
});
|
|
8041
|
+
};
|
|
8042
|
+
__proto._addComponentEvents = function () {
|
|
8043
|
+
var _this = this;
|
|
8044
|
+
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
8045
|
+
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
8046
|
+
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
8047
|
+
this._verticalFlicking.forEach(function (flicking) {
|
|
8048
|
+
flicking.on(EVENTS.HOLD_START, _this._onVerticalHoldStart);
|
|
8049
|
+
flicking.on(EVENTS.MOVE, _this._onVerticalMove);
|
|
8050
|
+
flicking.on(EVENTS.MOVE_END, _this._onVerticalMoveEnd);
|
|
8051
|
+
flicking.on(EVENTS.CHANGED, _this._onVerticalChanged);
|
|
8052
|
+
});
|
|
8053
|
+
};
|
|
8054
|
+
__proto._createVerticalState = function (panels) {
|
|
8055
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
|
|
8056
|
+
// panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
|
|
8057
|
+
// 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
|
|
8058
|
+
var verticalPanels = "";
|
|
8059
|
+
var verticalState = panels.reduce(function (state, panel) {
|
|
8060
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8061
|
+
verticalPanels += panel.innerHTML;
|
|
8062
|
+
return __spread(state, [{
|
|
8063
|
+
start: start,
|
|
8064
|
+
end: start + panel.children.length - 1,
|
|
8065
|
+
element: panel
|
|
8066
|
+
}]);
|
|
8067
|
+
}, []);
|
|
8068
|
+
var verticalCamera = document.createElement("div");
|
|
8069
|
+
verticalCamera.classList.add(CLASS.CAMERA);
|
|
8070
|
+
verticalCamera.innerHTML = verticalPanels;
|
|
8071
|
+
panels.forEach(function (panel) {
|
|
8072
|
+
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
|
|
8073
|
+
if (!panel.classList.contains(className)) {
|
|
8074
|
+
panel.classList.add(className);
|
|
8075
|
+
}
|
|
8076
|
+
});
|
|
8077
|
+
panel.innerHTML = verticalCamera.outerHTML;
|
|
8078
|
+
});
|
|
8079
|
+
return verticalState;
|
|
8080
|
+
};
|
|
8081
|
+
__proto._createVerticalFlicking = function (panels) {
|
|
8082
|
+
var _this = this;
|
|
8083
|
+
return panels.map(function (panel, i) {
|
|
8084
|
+
return new Flicking(panel, __assign(__assign({}, _this.verticalOptions), {
|
|
8085
|
+
horizontal: false,
|
|
8086
|
+
panelsPerView: 1,
|
|
8087
|
+
defaultIndex: _this._verticalState[i].start
|
|
8088
|
+
}));
|
|
8089
|
+
});
|
|
8090
|
+
};
|
|
8091
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8092
|
+
var _this = this;
|
|
8093
|
+
this.stopAnimation();
|
|
8094
|
+
this._verticalFlicking.forEach(function (child, i) {
|
|
8095
|
+
var _a = _this._verticalState[i],
|
|
8096
|
+
start = _a.start,
|
|
8097
|
+
end = _a.end;
|
|
8098
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8099
|
+
child.stopAnimation();
|
|
8100
|
+
void child.moveTo(index, 0);
|
|
8101
|
+
void _this.moveTo(i, 0);
|
|
8102
|
+
}
|
|
8103
|
+
});
|
|
8104
|
+
};
|
|
8105
|
+
return CrossFlicking;
|
|
8106
|
+
}(Flicking);
|
|
8107
|
+
|
|
7867
8108
|
/**
|
|
7868
8109
|
* Decorator that makes the method of flicking available in the framework.
|
|
7869
8110
|
* @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
|
|
@@ -8078,5 +8319,5 @@ var parseAlign = function (alignVal) {
|
|
|
8078
8319
|
* egjs projects are licensed under the MIT license
|
|
8079
8320
|
*/
|
|
8080
8321
|
|
|
8081
|
-
export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCameraMode, CIRCULAR_FALLBACK, CLASS, Camera, CircularCameraMode, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCameraMode, MOVE_TYPE, NormalRenderingStrategy, ORDER, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaElementProvider, VanillaRenderer, Viewport, VirtualElementProvider, VirtualManager, VirtualPanel, VirtualRenderingStrategy, checkExistence, circulateIndex, circulatePosition, clamp, Flicking as default, find, findIndex, findRight, getDefaultCameraTransform, getDirection, getElement, getElementSize, getFlickingAttached, getMinusCompensatedIndex, getProgress, getRenderingPanels, getStyle, includes, isBetween, isString, merge, parseAlign$1 as parseAlign, parseArithmeticExpression, parseArithmeticSize, parseBounce, parseCSSSizeValue, parseElement, parsePanelAlign, range, setPrototypeOf, setSize, sync, toArray, withFlickingMethods };
|
|
8322
|
+
export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCameraMode, CIRCULAR_FALLBACK, CLASS, Camera, CircularCameraMode, Control, CrossFlicking, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCameraMode, MOVE_DIRECTION, MOVE_TYPE, NormalRenderingStrategy, ORDER, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaElementProvider, VanillaRenderer, Viewport, VirtualElementProvider, VirtualManager, VirtualPanel, VirtualRenderingStrategy, checkExistence, circulateIndex, circulatePosition, clamp, Flicking as default, find, findIndex, findRight, getDefaultCameraTransform, getDirection, getElement, getElementSize, getFlickingAttached, getMinusCompensatedIndex, getProgress, getRenderingPanels, getStyle, includes, isBetween, isString, merge, parseAlign$1 as parseAlign, parseArithmeticExpression, parseArithmeticSize, parseBounce, parseCSSSizeValue, parseElement, parsePanelAlign, range, setPrototypeOf, setSize, sync, toArray, withFlickingMethods };
|
|
8082
8323
|
//# sourceMappingURL=flicking.esm.js.map
|