@egjs/flicking 4.12.0-beta.0 → 4.12.0-beta.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/CrossFlicking.d.ts +29 -0
- package/declaration/const/external.d.ts +4 -0
- package/declaration/index.d.ts +1 -0
- package/dist/flicking.cjs.js +191 -2
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +188 -3
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +194 -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 +194 -2
- 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 +252 -0
- package/src/const/external.ts +12 -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.1
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -411,6 +411,17 @@ var ORDER = {
|
|
|
411
411
|
LTR: "ltr",
|
|
412
412
|
RTL: "rtl"
|
|
413
413
|
};
|
|
414
|
+
/**
|
|
415
|
+
* An object that contains the direction that {@link Flicking} is moving
|
|
416
|
+
* @ko {@link Flicking}이 움직이는 방향을 담고 있는 객체
|
|
417
|
+
* @type {object}
|
|
418
|
+
* @property {"horizontal"} HORIZONTAL horizontal<ko>수평 방향</ko>
|
|
419
|
+
* @property {"vertical"} VERTICAL vertical<ko>수직 방향</ko>
|
|
420
|
+
*/
|
|
421
|
+
var MOVE_DIRECTION = {
|
|
422
|
+
HORIZONTAL: "horizontal",
|
|
423
|
+
VERTICAL: "vertical"
|
|
424
|
+
};
|
|
414
425
|
|
|
415
426
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
416
427
|
var merge = function (target) {
|
|
@@ -7860,10 +7871,184 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7860
7871
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7861
7872
|
* ```
|
|
7862
7873
|
*/
|
|
7863
|
-
Flicking.VERSION = "4.12.0-beta.
|
|
7874
|
+
Flicking.VERSION = "4.12.0-beta.1";
|
|
7864
7875
|
return Flicking;
|
|
7865
7876
|
}(Component);
|
|
7866
7877
|
|
|
7878
|
+
/*
|
|
7879
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
7880
|
+
* egjs projects are licensed under the MIT license
|
|
7881
|
+
*/
|
|
7882
|
+
/**
|
|
7883
|
+
* @extends Component
|
|
7884
|
+
* @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
|
|
7885
|
+
* @requires {@link https://github.com/naver/egjs-component|@egjs/component}
|
|
7886
|
+
* @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
|
|
7887
|
+
*/
|
|
7888
|
+
var CrossFlicking = /*#__PURE__*/function (_super) {
|
|
7889
|
+
__extends(CrossFlicking, _super);
|
|
7890
|
+
// Options Setter
|
|
7891
|
+
// UI / LAYOUT
|
|
7892
|
+
// public set align(val: FlickingOptions["align"]) {
|
|
7893
|
+
// this._align = val;
|
|
7894
|
+
// }
|
|
7895
|
+
function CrossFlicking(root, _a) {
|
|
7896
|
+
var _b = (_a === void 0 ? {} : _a).verticalOptions,
|
|
7897
|
+
verticalOptions = _b === void 0 ? undefined : _b;
|
|
7898
|
+
var _this = _super.call(this, root) || this;
|
|
7899
|
+
_this._onHorizontalHoldStart = function () {
|
|
7900
|
+
_this.dragThreshold = 10;
|
|
7901
|
+
_this._moveDirection = null;
|
|
7902
|
+
};
|
|
7903
|
+
_this._onHorizontalMove = function (e) {
|
|
7904
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7905
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7906
|
+
child.dragThreshold = Infinity;
|
|
7907
|
+
});
|
|
7908
|
+
_this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
|
|
7909
|
+
}
|
|
7910
|
+
};
|
|
7911
|
+
_this._onHorizontalMoveEnd = function (e) {
|
|
7912
|
+
var visiblePanels = _this.visiblePanels;
|
|
7913
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7914
|
+
child.dragThreshold = 10;
|
|
7915
|
+
});
|
|
7916
|
+
_this._moveDirection = null;
|
|
7917
|
+
if (visiblePanels.length > 1) {
|
|
7918
|
+
_this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
|
|
7919
|
+
} else {
|
|
7920
|
+
_this._nextIndex = visiblePanels[0].index;
|
|
7921
|
+
}
|
|
7922
|
+
_this._verticalFlicking.forEach(function (child, i) {
|
|
7923
|
+
if (_this._nextIndex !== i) {
|
|
7924
|
+
var _a = _this._verticalState[i],
|
|
7925
|
+
start = _a.start,
|
|
7926
|
+
end = _a.end;
|
|
7927
|
+
if (child.index < start) {
|
|
7928
|
+
child.stopAnimation();
|
|
7929
|
+
void child.moveTo(start, 0);
|
|
7930
|
+
} else if (child.index > end) {
|
|
7931
|
+
child.stopAnimation();
|
|
7932
|
+
void child.moveTo(end, 0);
|
|
7933
|
+
}
|
|
7934
|
+
}
|
|
7935
|
+
});
|
|
7936
|
+
if (e.isTrusted) {
|
|
7937
|
+
_this._syncToCategory(_this._verticalFlicking[_this._nextIndex].index, _this._nextIndex);
|
|
7938
|
+
}
|
|
7939
|
+
};
|
|
7940
|
+
_this._onVerticalHoldStart = function () {
|
|
7941
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
7942
|
+
child.dragThreshold = 10;
|
|
7943
|
+
});
|
|
7944
|
+
_this._moveDirection = null;
|
|
7945
|
+
};
|
|
7946
|
+
_this._onVerticalMove = function (e) {
|
|
7947
|
+
if (e.isTrusted && !_this._moveDirection) {
|
|
7948
|
+
_this.dragThreshold = Infinity;
|
|
7949
|
+
_this._moveDirection = MOVE_DIRECTION.VERTICAL;
|
|
7950
|
+
}
|
|
7951
|
+
};
|
|
7952
|
+
_this._onVerticalMoveEnd = function () {
|
|
7953
|
+
_this.dragThreshold = 10;
|
|
7954
|
+
_this._moveDirection = null;
|
|
7955
|
+
};
|
|
7956
|
+
_this._onVerticalChanged = function (e) {
|
|
7957
|
+
// this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
|
|
7958
|
+
// 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
|
|
7959
|
+
if (_this.visiblePanels.length < 2 && _this._verticalFlicking[_this.index] === e.currentTarget) {
|
|
7960
|
+
_this._syncToCategory(e.index, _this.index);
|
|
7961
|
+
}
|
|
7962
|
+
};
|
|
7963
|
+
// Internal states
|
|
7964
|
+
_this._verticalState = [];
|
|
7965
|
+
_this._moveDirection = null;
|
|
7966
|
+
_this._nextIndex = 0;
|
|
7967
|
+
// Bind options
|
|
7968
|
+
_this._verticalOptions = verticalOptions;
|
|
7969
|
+
return _this;
|
|
7970
|
+
// Create core components
|
|
7971
|
+
// this._viewport = new Viewport(this, getElement(root));
|
|
7972
|
+
}
|
|
7973
|
+
var __proto = CrossFlicking.prototype;
|
|
7974
|
+
Object.defineProperty(__proto, "verticalOptions", {
|
|
7975
|
+
// Components
|
|
7976
|
+
/**
|
|
7977
|
+
* Change active panel index on mouse/touch hold while animating.
|
|
7978
|
+
* `index` of the `willChange`/`willRestore` event will be used as new index.
|
|
7979
|
+
* @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
|
|
7980
|
+
* `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
|
|
7981
|
+
* @type {FlickingOptions}
|
|
7982
|
+
* @default undefined
|
|
7983
|
+
* @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
|
|
7984
|
+
*/
|
|
7985
|
+
get: function () {
|
|
7986
|
+
return this._verticalOptions;
|
|
7987
|
+
},
|
|
7988
|
+
enumerable: false,
|
|
7989
|
+
configurable: true
|
|
7990
|
+
});
|
|
7991
|
+
/**
|
|
7992
|
+
* Initialize Flicking and move to the default index
|
|
7993
|
+
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
7994
|
+
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
7995
|
+
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
7996
|
+
* @fires Flicking#ready
|
|
7997
|
+
* @return {Promise<void>}
|
|
7998
|
+
*/
|
|
7999
|
+
__proto.init = function () {
|
|
8000
|
+
var _this = this;
|
|
8001
|
+
return _super.prototype.init.call(this).then(function () {
|
|
8002
|
+
// data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
|
|
8003
|
+
// camera.children들에 대해 갯수 세기
|
|
8004
|
+
var verticalPanels = "";
|
|
8005
|
+
_this._verticalState = _this.camera.children.reduce(function (state, child) {
|
|
8006
|
+
var start = state.length ? +state[state.length - 1].end + 1 : 0;
|
|
8007
|
+
verticalPanels += child.children[0].innerHTML;
|
|
8008
|
+
return __spread(state, [{
|
|
8009
|
+
start: start,
|
|
8010
|
+
end: start + child.children[0].children.length - 1,
|
|
8011
|
+
element: child
|
|
8012
|
+
}]);
|
|
8013
|
+
}, []);
|
|
8014
|
+
_this.camera.children.forEach(function (child) {
|
|
8015
|
+
child.children[0].innerHTML = verticalPanels;
|
|
8016
|
+
});
|
|
8017
|
+
_this._verticalFlicking = _this.camera.children.map(function (child, i) {
|
|
8018
|
+
return new Flicking(child, __assign(__assign({}, _this.verticalOptions), {
|
|
8019
|
+
horizontal: false,
|
|
8020
|
+
panelsPerView: 1,
|
|
8021
|
+
defaultIndex: _this._verticalState[i].start
|
|
8022
|
+
}));
|
|
8023
|
+
});
|
|
8024
|
+
_this.on(EVENTS.HOLD_START, _this._onHorizontalHoldStart);
|
|
8025
|
+
_this.on(EVENTS.MOVE, _this._onHorizontalMove);
|
|
8026
|
+
_this.on(EVENTS.MOVE_END, _this._onHorizontalMoveEnd);
|
|
8027
|
+
_this._verticalFlicking.forEach(function (child) {
|
|
8028
|
+
child.on(EVENTS.HOLD_START, _this._onVerticalHoldStart);
|
|
8029
|
+
child.on(EVENTS.MOVE, _this._onVerticalMove);
|
|
8030
|
+
child.on(EVENTS.MOVE_END, _this._onVerticalMoveEnd);
|
|
8031
|
+
child.on(EVENTS.CHANGED, _this._onVerticalChanged);
|
|
8032
|
+
});
|
|
8033
|
+
});
|
|
8034
|
+
};
|
|
8035
|
+
__proto._syncToCategory = function (index, outerIndex) {
|
|
8036
|
+
var _this = this;
|
|
8037
|
+
this.stopAnimation();
|
|
8038
|
+
this._verticalFlicking.forEach(function (child, i) {
|
|
8039
|
+
var _a = _this._verticalState[i],
|
|
8040
|
+
start = _a.start,
|
|
8041
|
+
end = _a.end;
|
|
8042
|
+
if (start <= index && end >= index && outerIndex !== i) {
|
|
8043
|
+
child.stopAnimation();
|
|
8044
|
+
void child.moveTo(index, 0);
|
|
8045
|
+
void _this.moveTo(i, 0);
|
|
8046
|
+
}
|
|
8047
|
+
});
|
|
8048
|
+
};
|
|
8049
|
+
return CrossFlicking;
|
|
8050
|
+
}(Flicking);
|
|
8051
|
+
|
|
7867
8052
|
/**
|
|
7868
8053
|
* Decorator that makes the method of flicking available in the framework.
|
|
7869
8054
|
* @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
|
|
@@ -8078,5 +8263,5 @@ var parseAlign = function (alignVal) {
|
|
|
8078
8263
|
* egjs projects are licensed under the MIT license
|
|
8079
8264
|
*/
|
|
8080
8265
|
|
|
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 };
|
|
8266
|
+
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
8267
|
//# sourceMappingURL=flicking.esm.js.map
|