@egjs/flicking 4.12.0-beta.2 → 4.12.0-beta.4

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.
Files changed (77) hide show
  1. package/declaration/Flicking.d.ts +244 -244
  2. package/declaration/camera/Camera.d.ts +90 -89
  3. package/declaration/camera/index.d.ts +4 -4
  4. package/declaration/camera/mode/BoundCameraMode.d.ts +13 -13
  5. package/declaration/camera/mode/CameraMode.d.ts +20 -20
  6. package/declaration/camera/mode/CircularCameraMode.d.ts +19 -19
  7. package/declaration/camera/mode/LinearCameraMode.d.ts +9 -9
  8. package/declaration/camera/mode/index.d.ts +6 -6
  9. package/declaration/cfc/getDefaultCameraTransform.d.ts +3 -3
  10. package/declaration/cfc/getRenderingPanels.d.ts +4 -4
  11. package/declaration/cfc/index.d.ts +5 -5
  12. package/declaration/cfc/sync.d.ts +4 -4
  13. package/declaration/cfc/withFlickingMethods.d.ts +2 -2
  14. package/declaration/const/axes.d.ts +8 -8
  15. package/declaration/const/error.d.ts +34 -34
  16. package/declaration/const/external.d.ts +48 -54
  17. package/declaration/control/AxesController.d.ts +44 -44
  18. package/declaration/control/Control.d.ts +45 -45
  19. package/declaration/control/FreeControl.d.ts +14 -14
  20. package/declaration/control/SnapControl.d.ts +16 -16
  21. package/declaration/control/StateMachine.d.ts +14 -14
  22. package/declaration/control/StrictControl.d.ts +20 -20
  23. package/declaration/control/index.d.ts +14 -14
  24. package/declaration/control/states/AnimatingState.d.ts +9 -9
  25. package/declaration/control/states/DisabledState.d.ts +9 -9
  26. package/declaration/control/states/DraggingState.d.ts +8 -8
  27. package/declaration/control/states/HoldingState.d.ts +10 -10
  28. package/declaration/control/states/IdleState.d.ts +9 -9
  29. package/declaration/control/states/State.d.ts +47 -47
  30. package/declaration/core/AnchorPoint.d.ts +15 -15
  31. package/declaration/core/AutoResizer.d.ts +16 -16
  32. package/declaration/core/FlickingError.d.ts +5 -5
  33. package/declaration/core/ResizeWatcher.d.ts +33 -33
  34. package/declaration/core/Viewport.d.ts +25 -25
  35. package/declaration/core/VirtualManager.d.ts +37 -37
  36. package/declaration/core/index.d.ts +6 -6
  37. package/declaration/core/panel/Panel.d.ts +89 -89
  38. package/declaration/core/panel/VirtualPanel.d.ts +19 -19
  39. package/declaration/core/panel/index.d.ts +5 -5
  40. package/declaration/core/panel/provider/ElementProvider.d.ts +8 -8
  41. package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -12
  42. package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -15
  43. package/declaration/core/panel/provider/index.d.ts +5 -5
  44. package/declaration/index.cjs.d.ts +3 -3
  45. package/declaration/index.d.ts +13 -14
  46. package/declaration/index.umd.d.ts +2 -2
  47. package/declaration/renderer/ExternalRenderer.d.ts +7 -7
  48. package/declaration/renderer/Renderer.d.ts +59 -59
  49. package/declaration/renderer/VanillaRenderer.d.ts +10 -10
  50. package/declaration/renderer/index.d.ts +6 -6
  51. package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -23
  52. package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -15
  53. package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -17
  54. package/declaration/renderer/strategy/index.d.ts +5 -5
  55. package/declaration/type/event.d.ts +88 -88
  56. package/declaration/type/external.d.ts +31 -31
  57. package/declaration/type/internal.d.ts +13 -13
  58. package/declaration/utils.d.ts +45 -45
  59. package/dist/flicking.cjs.js +14 -254
  60. package/dist/flicking.cjs.js.map +1 -1
  61. package/dist/flicking.esm.js +15 -251
  62. package/dist/flicking.esm.js.map +1 -1
  63. package/dist/flicking.js +14 -257
  64. package/dist/flicking.js.map +1 -1
  65. package/dist/flicking.min.js +2 -2
  66. package/dist/flicking.min.js.map +1 -1
  67. package/dist/flicking.pkgd.js +772 -1022
  68. package/dist/flicking.pkgd.js.map +1 -1
  69. package/dist/flicking.pkgd.min.js +2 -2
  70. package/dist/flicking.pkgd.min.js.map +1 -1
  71. package/package.json +2 -2
  72. package/src/camera/Camera.ts +9 -0
  73. package/src/const/external.ts +0 -14
  74. package/src/index.ts +0 -2
  75. package/src/index.umd.ts +0 -2
  76. package/declaration/CrossFlicking.d.ts +0 -34
  77. package/src/CrossFlicking.ts +0 -296
@@ -4,13 +4,13 @@ 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.2
7
+ version: 4.12.0-beta.4
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
11
11
  import ImReady from '@egjs/imready';
12
12
 
13
- /******************************************************************************
13
+ /*! *****************************************************************************
14
14
  Copyright (c) Microsoft Corporation.
15
15
 
16
16
  Permission to use, copy, modify, and/or distribute this software for any
@@ -24,7 +24,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
24
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
25
  PERFORMANCE OF THIS SOFTWARE.
26
26
  ***************************************************************************** */
27
- /* global Reflect, Promise, SuppressedError, Symbol */
27
+ /* global Reflect, Promise */
28
28
 
29
29
  var extendStatics = function (d, b) {
30
30
  extendStatics = Object.setPrototypeOf || {
@@ -109,7 +109,7 @@ function __generator(thisArg, body) {
109
109
  }
110
110
  function step(op) {
111
111
  if (f) throw new TypeError("Generator is already executing.");
112
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
112
+ while (_) try {
113
113
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
114
114
  if (y = 0, t) op = [op[0] & 2, t.value];
115
115
  switch (op[0]) {
@@ -213,10 +213,6 @@ function __spread() {
213
213
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
214
214
  return ar;
215
215
  }
216
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
217
- var e = new Error(message);
218
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
219
- };
220
216
 
221
217
  /*
222
218
  * Copyright (c) 2015 NAVER Corp.
@@ -385,8 +381,6 @@ var MOVE_TYPE = {
385
381
  STRICT: "strict"
386
382
  };
387
383
  var CLASS = {
388
- VIEWPORT: "flicking-viewport",
389
- CAMERA: "flicking-camera",
390
384
  VERTICAL: "vertical",
391
385
  HIDDEN: "flicking-hidden",
392
386
  DEFAULT_VIRTUAL: "flicking-panel"
@@ -413,17 +407,6 @@ var ORDER = {
413
407
  LTR: "ltr",
414
408
  RTL: "rtl"
415
409
  };
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
- };
427
410
 
428
411
  // eslint-disable-next-line @typescript-eslint/ban-types
429
412
  var merge = function (target) {
@@ -3724,6 +3707,7 @@ var Camera = /*#__PURE__*/function () {
3724
3707
  var _this = this;
3725
3708
  var _b = (_a === void 0 ? {} : _a).align,
3726
3709
  align = _b === void 0 ? ALIGN.CENTER : _b;
3710
+ this._lookedOffset = 0;
3727
3711
  this._checkTranslateSupport = function () {
3728
3712
  var e_1, _a;
3729
3713
  var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
@@ -4083,6 +4067,8 @@ var Camera = /*#__PURE__*/function () {
4083
4067
  */
4084
4068
  __proto.lookAt = function (pos) {
4085
4069
  var _this = this;
4070
+ var prevOffset = this._offset;
4071
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4086
4072
  var flicking = getFlickingAttached(this._flicking);
4087
4073
  var prevPos = this._position;
4088
4074
  this._position = pos;
@@ -4093,7 +4079,12 @@ var Camera = /*#__PURE__*/function () {
4093
4079
  if (toggled) {
4094
4080
  void flicking.renderer.render().then(function () {
4095
4081
  _this.updateOffset();
4082
+ _this._lookedOffset = _this._offset;
4096
4083
  });
4084
+ } else if (isChangedOffset) {
4085
+ // sync offset for renderOnlyVisible on resize
4086
+ this.updateOffset();
4087
+ this._lookedOffset = this._offset;
4097
4088
  } else {
4098
4089
  this.applyTransform();
4099
4090
  }
@@ -4352,6 +4343,7 @@ var Camera = /*#__PURE__*/function () {
4352
4343
  };
4353
4344
  __proto._resetInternalValues = function () {
4354
4345
  this._position = 0;
4346
+ this._lookedOffset = 0;
4355
4347
  this._alignPos = 0;
4356
4348
  this._offset = 0;
4357
4349
  this._circularOffset = 0;
@@ -7873,238 +7865,10 @@ var Flicking = /*#__PURE__*/function (_super) {
7873
7865
  * Flicking.VERSION; // ex) 4.0.0
7874
7866
  * ```
7875
7867
  */
7876
- Flicking.VERSION = "4.12.0-beta.2";
7868
+ Flicking.VERSION = "4.12.0-beta.4";
7877
7869
  return Flicking;
7878
7870
  }(Component);
7879
7871
 
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
-
8108
7872
  /**
8109
7873
  * Decorator that makes the method of flicking available in the framework.
8110
7874
  * @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
@@ -8319,5 +8083,5 @@ var parseAlign = function (alignVal) {
8319
8083
  * egjs projects are licensed under the MIT license
8320
8084
  */
8321
8085
 
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 };
8086
+ 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 };
8323
8087
  //# sourceMappingURL=flicking.esm.js.map