@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,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.2
7
+ version: 4.12.0-beta.4
8
8
  */
9
9
  'use strict';
10
10
 
@@ -12,7 +12,7 @@ var Component = require('@egjs/component');
12
12
  var Axes = require('@egjs/axes');
13
13
  var ImReady = require('@egjs/imready');
14
14
 
15
- /******************************************************************************
15
+ /*! *****************************************************************************
16
16
  Copyright (c) Microsoft Corporation.
17
17
 
18
18
  Permission to use, copy, modify, and/or distribute this software for any
@@ -26,7 +26,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
26
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
27
  PERFORMANCE OF THIS SOFTWARE.
28
28
  ***************************************************************************** */
29
- /* global Reflect, Promise, SuppressedError, Symbol */
29
+ /* global Reflect, Promise */
30
30
 
31
31
  var extendStatics = function (d, b) {
32
32
  extendStatics = Object.setPrototypeOf || {
@@ -111,7 +111,7 @@ function __generator(thisArg, body) {
111
111
  }
112
112
  function step(op) {
113
113
  if (f) throw new TypeError("Generator is already executing.");
114
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
114
+ while (_) try {
115
115
  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;
116
116
  if (y = 0, t) op = [op[0] & 2, t.value];
117
117
  switch (op[0]) {
@@ -215,10 +215,6 @@ function __spread() {
215
215
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
216
216
  return ar;
217
217
  }
218
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
219
- var e = new Error(message);
220
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
221
- };
222
218
 
223
219
  /*
224
220
  * Copyright (c) 2015 NAVER Corp.
@@ -387,8 +383,6 @@ var MOVE_TYPE = {
387
383
  STRICT: "strict"
388
384
  };
389
385
  var CLASS = {
390
- VIEWPORT: "flicking-viewport",
391
- CAMERA: "flicking-camera",
392
386
  VERTICAL: "vertical",
393
387
  HIDDEN: "flicking-hidden",
394
388
  DEFAULT_VIRTUAL: "flicking-panel"
@@ -415,17 +409,6 @@ var ORDER = {
415
409
  LTR: "ltr",
416
410
  RTL: "rtl"
417
411
  };
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
- };
429
412
 
430
413
  // eslint-disable-next-line @typescript-eslint/ban-types
431
414
  var merge = function (target) {
@@ -3726,6 +3709,7 @@ var Camera = /*#__PURE__*/function () {
3726
3709
  var _this = this;
3727
3710
  var _b = (_a === void 0 ? {} : _a).align,
3728
3711
  align = _b === void 0 ? ALIGN.CENTER : _b;
3712
+ this._lookedOffset = 0;
3729
3713
  this._checkTranslateSupport = function () {
3730
3714
  var e_1, _a;
3731
3715
  var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
@@ -4085,6 +4069,8 @@ var Camera = /*#__PURE__*/function () {
4085
4069
  */
4086
4070
  __proto.lookAt = function (pos) {
4087
4071
  var _this = this;
4072
+ var prevOffset = this._offset;
4073
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4088
4074
  var flicking = getFlickingAttached(this._flicking);
4089
4075
  var prevPos = this._position;
4090
4076
  this._position = pos;
@@ -4095,7 +4081,12 @@ var Camera = /*#__PURE__*/function () {
4095
4081
  if (toggled) {
4096
4082
  void flicking.renderer.render().then(function () {
4097
4083
  _this.updateOffset();
4084
+ _this._lookedOffset = _this._offset;
4098
4085
  });
4086
+ } else if (isChangedOffset) {
4087
+ // sync offset for renderOnlyVisible on resize
4088
+ this.updateOffset();
4089
+ this._lookedOffset = this._offset;
4099
4090
  } else {
4100
4091
  this.applyTransform();
4101
4092
  }
@@ -4354,6 +4345,7 @@ var Camera = /*#__PURE__*/function () {
4354
4345
  };
4355
4346
  __proto._resetInternalValues = function () {
4356
4347
  this._position = 0;
4348
+ this._lookedOffset = 0;
4357
4349
  this._alignPos = 0;
4358
4350
  this._offset = 0;
4359
4351
  this._circularOffset = 0;
@@ -7875,238 +7867,10 @@ var Flicking = /*#__PURE__*/function (_super) {
7875
7867
  * Flicking.VERSION; // ex) 4.0.0
7876
7868
  * ```
7877
7869
  */
7878
- Flicking.VERSION = "4.12.0-beta.2";
7870
+ Flicking.VERSION = "4.12.0-beta.4";
7879
7871
  return Flicking;
7880
7872
  }(Component);
7881
7873
 
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
-
8110
7874
  /**
8111
7875
  * Decorator that makes the method of flicking available in the framework.
8112
7876
  * @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
@@ -8324,7 +8088,6 @@ var parseAlign = function (alignVal) {
8324
8088
  var modules = {
8325
8089
  __proto__: null,
8326
8090
  'default': Flicking,
8327
- CrossFlicking: CrossFlicking,
8328
8091
  VanillaElementProvider: VanillaElementProvider,
8329
8092
  VirtualElementProvider: VirtualElementProvider,
8330
8093
  Panel: Panel,
@@ -8362,7 +8125,6 @@ var modules = {
8362
8125
  CLASS: CLASS,
8363
8126
  CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
8364
8127
  ORDER: ORDER,
8365
- MOVE_DIRECTION: MOVE_DIRECTION,
8366
8128
  withFlickingMethods: withFlickingMethods,
8367
8129
  sync: sync,
8368
8130
  getRenderingPanels: getRenderingPanels,
@@ -8417,7 +8179,6 @@ exports.CLASS = CLASS;
8417
8179
  exports.Camera = Camera;
8418
8180
  exports.CircularCameraMode = CircularCameraMode;
8419
8181
  exports.Control = Control;
8420
- exports.CrossFlicking = CrossFlicking;
8421
8182
  exports.DIRECTION = DIRECTION;
8422
8183
  exports.DisabledState = DisabledState;
8423
8184
  exports.DraggingState = DraggingState;
@@ -8429,7 +8190,6 @@ exports.FreeControl = FreeControl;
8429
8190
  exports.HoldingState = HoldingState;
8430
8191
  exports.IdleState = IdleState;
8431
8192
  exports.LinearCameraMode = LinearCameraMode;
8432
- exports.MOVE_DIRECTION = MOVE_DIRECTION;
8433
8193
  exports.MOVE_TYPE = MOVE_TYPE;
8434
8194
  exports.NormalRenderingStrategy = NormalRenderingStrategy;
8435
8195
  exports.ORDER = ORDER;