@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
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.2
7
+ version: 4.12.0-beta.4
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')) :
@@ -12,7 +12,7 @@ version: 4.12.0-beta.2
12
12
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Flicking = factory(global.eg.Component, global.eg.Axes, global.eg.ImReady));
13
13
  })(this, (function (Component, Axes, ImReady) { 'use strict';
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 @@ version: 4.12.0-beta.2
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 @@ version: 4.12.0-beta.2
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 @@ version: 4.12.0-beta.2
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 @@ version: 4.12.0-beta.2
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 @@ version: 4.12.0-beta.2
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
  var Constants = {
431
414
  __proto__: null,
@@ -436,7 +419,6 @@ version: 4.12.0-beta.2
436
419
  CLASS: CLASS,
437
420
  CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
438
421
  ORDER: ORDER,
439
- MOVE_DIRECTION: MOVE_DIRECTION,
440
422
  ERROR_CODE: CODE
441
423
  };
442
424
 
@@ -3793,6 +3775,7 @@ version: 4.12.0-beta.2
3793
3775
  var _this = this;
3794
3776
  var _b = (_a === void 0 ? {} : _a).align,
3795
3777
  align = _b === void 0 ? ALIGN.CENTER : _b;
3778
+ this._lookedOffset = 0;
3796
3779
  this._checkTranslateSupport = function () {
3797
3780
  var e_1, _a;
3798
3781
  var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
@@ -4152,6 +4135,8 @@ version: 4.12.0-beta.2
4152
4135
  */
4153
4136
  __proto.lookAt = function (pos) {
4154
4137
  var _this = this;
4138
+ var prevOffset = this._offset;
4139
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4155
4140
  var flicking = getFlickingAttached(this._flicking);
4156
4141
  var prevPos = this._position;
4157
4142
  this._position = pos;
@@ -4162,7 +4147,12 @@ version: 4.12.0-beta.2
4162
4147
  if (toggled) {
4163
4148
  void flicking.renderer.render().then(function () {
4164
4149
  _this.updateOffset();
4150
+ _this._lookedOffset = _this._offset;
4165
4151
  });
4152
+ } else if (isChangedOffset) {
4153
+ // sync offset for renderOnlyVisible on resize
4154
+ this.updateOffset();
4155
+ this._lookedOffset = this._offset;
4166
4156
  } else {
4167
4157
  this.applyTransform();
4168
4158
  }
@@ -4421,6 +4411,7 @@ version: 4.12.0-beta.2
4421
4411
  };
4422
4412
  __proto._resetInternalValues = function () {
4423
4413
  this._position = 0;
4414
+ this._lookedOffset = 0;
4424
4415
  this._alignPos = 0;
4425
4416
  this._offset = 0;
4426
4417
  this._circularOffset = 0;
@@ -7969,243 +7960,10 @@ version: 4.12.0-beta.2
7969
7960
  * Flicking.VERSION; // ex) 4.0.0
7970
7961
  * ```
7971
7962
  */
7972
- Flicking.VERSION = "4.12.0-beta.2";
7963
+ Flicking.VERSION = "4.12.0-beta.4";
7973
7964
  return Flicking;
7974
7965
  }(Component);
7975
7966
 
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
-
8209
7967
  /*
8210
7968
  * Copyright (c) 2015 NAVER Corp.
8211
7969
  * egjs projects are licensed under the MIT license
@@ -8451,7 +8209,6 @@ version: 4.12.0-beta.2
8451
8209
  merge(Flicking, Constants);
8452
8210
  merge(Flicking, CFC);
8453
8211
  merge(Flicking, Utils);
8454
- merge(Flicking, CrossFlicking$1);
8455
8212
 
8456
8213
  return Flicking;
8457
8214