@egjs/flicking 4.12.0-beta.5 → 4.12.0-beta.7

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 (78) hide show
  1. package/declaration/CrossFlicking.d.ts +36 -0
  2. package/declaration/Flicking.d.ts +244 -244
  3. package/declaration/camera/Camera.d.ts +89 -90
  4. package/declaration/camera/index.d.ts +4 -4
  5. package/declaration/camera/mode/BoundCameraMode.d.ts +13 -13
  6. package/declaration/camera/mode/CameraMode.d.ts +20 -20
  7. package/declaration/camera/mode/CircularCameraMode.d.ts +19 -19
  8. package/declaration/camera/mode/LinearCameraMode.d.ts +9 -9
  9. package/declaration/camera/mode/index.d.ts +6 -6
  10. package/declaration/cfc/getDefaultCameraTransform.d.ts +3 -3
  11. package/declaration/cfc/getRenderingPanels.d.ts +4 -4
  12. package/declaration/cfc/index.d.ts +5 -5
  13. package/declaration/cfc/sync.d.ts +4 -4
  14. package/declaration/cfc/withFlickingMethods.d.ts +2 -2
  15. package/declaration/const/axes.d.ts +8 -8
  16. package/declaration/const/error.d.ts +34 -34
  17. package/declaration/const/external.d.ts +54 -48
  18. package/declaration/control/AxesController.d.ts +44 -44
  19. package/declaration/control/Control.d.ts +45 -45
  20. package/declaration/control/FreeControl.d.ts +14 -14
  21. package/declaration/control/SnapControl.d.ts +16 -16
  22. package/declaration/control/StateMachine.d.ts +14 -14
  23. package/declaration/control/StrictControl.d.ts +20 -20
  24. package/declaration/control/index.d.ts +14 -14
  25. package/declaration/control/states/AnimatingState.d.ts +9 -9
  26. package/declaration/control/states/DisabledState.d.ts +9 -9
  27. package/declaration/control/states/DraggingState.d.ts +8 -8
  28. package/declaration/control/states/HoldingState.d.ts +10 -10
  29. package/declaration/control/states/IdleState.d.ts +9 -9
  30. package/declaration/control/states/State.d.ts +47 -47
  31. package/declaration/core/AnchorPoint.d.ts +15 -15
  32. package/declaration/core/AutoResizer.d.ts +16 -16
  33. package/declaration/core/FlickingError.d.ts +5 -5
  34. package/declaration/core/ResizeWatcher.d.ts +33 -33
  35. package/declaration/core/Viewport.d.ts +25 -25
  36. package/declaration/core/VirtualManager.d.ts +37 -37
  37. package/declaration/core/index.d.ts +6 -6
  38. package/declaration/core/panel/Panel.d.ts +89 -89
  39. package/declaration/core/panel/VirtualPanel.d.ts +19 -19
  40. package/declaration/core/panel/index.d.ts +5 -5
  41. package/declaration/core/panel/provider/ElementProvider.d.ts +8 -8
  42. package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -12
  43. package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -15
  44. package/declaration/core/panel/provider/index.d.ts +5 -5
  45. package/declaration/index.cjs.d.ts +3 -3
  46. package/declaration/index.d.ts +15 -13
  47. package/declaration/index.umd.d.ts +2 -2
  48. package/declaration/renderer/ExternalRenderer.d.ts +7 -7
  49. package/declaration/renderer/Renderer.d.ts +59 -59
  50. package/declaration/renderer/VanillaRenderer.d.ts +10 -10
  51. package/declaration/renderer/index.d.ts +6 -6
  52. package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -23
  53. package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -15
  54. package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -17
  55. package/declaration/renderer/strategy/index.d.ts +5 -5
  56. package/declaration/type/event.d.ts +88 -88
  57. package/declaration/type/external.d.ts +31 -31
  58. package/declaration/type/internal.d.ts +13 -13
  59. package/declaration/utils.d.ts +47 -45
  60. package/dist/flicking.cjs.js +363 -27
  61. package/dist/flicking.cjs.js.map +1 -1
  62. package/dist/flicking.esm.js +355 -27
  63. package/dist/flicking.esm.js.map +1 -1
  64. package/dist/flicking.js +364 -27
  65. package/dist/flicking.js.map +1 -1
  66. package/dist/flicking.min.js +2 -2
  67. package/dist/flicking.min.js.map +1 -1
  68. package/dist/flicking.pkgd.js +1129 -785
  69. package/dist/flicking.pkgd.js.map +1 -1
  70. package/dist/flicking.pkgd.min.js +2 -2
  71. package/dist/flicking.pkgd.min.js.map +1 -1
  72. package/package.json +3 -2
  73. package/src/CrossFlicking.ts +403 -0
  74. package/src/camera/Camera.ts +4 -24
  75. package/src/const/external.ts +14 -0
  76. package/src/index.ts +4 -1
  77. package/src/index.umd.ts +2 -0
  78. package/src/utils.ts +21 -0
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.5
7
+ version: 4.12.0-beta.7
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.5
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.5
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 */
29
+ /* global Reflect, Promise, SuppressedError, Symbol */
30
30
 
31
31
  var extendStatics = function (d, b) {
32
32
  extendStatics = Object.setPrototypeOf || {
@@ -111,7 +111,7 @@ version: 4.12.0-beta.5
111
111
  }
112
112
  function step(op) {
113
113
  if (f) throw new TypeError("Generator is already executing.");
114
- while (_) try {
114
+ while (g && (g = 0, op[0] && (_ = 0)), _) 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,6 +215,10 @@ version: 4.12.0-beta.5
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
+ };
218
222
 
219
223
  /*
220
224
  * Copyright (c) 2015 NAVER Corp.
@@ -383,6 +387,8 @@ version: 4.12.0-beta.5
383
387
  STRICT: "strict"
384
388
  };
385
389
  var CLASS = {
390
+ VIEWPORT: "flicking-viewport",
391
+ CAMERA: "flicking-camera",
386
392
  VERTICAL: "vertical",
387
393
  HIDDEN: "flicking-hidden",
388
394
  DEFAULT_VIRTUAL: "flicking-panel"
@@ -409,6 +415,17 @@ version: 4.12.0-beta.5
409
415
  LTR: "ltr",
410
416
  RTL: "rtl"
411
417
  };
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
+ };
412
429
 
413
430
  var Constants = {
414
431
  __proto__: null,
@@ -419,6 +436,7 @@ version: 4.12.0-beta.5
419
436
  CLASS: CLASS,
420
437
  CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
421
438
  ORDER: ORDER,
439
+ MOVE_DIRECTION: MOVE_DIRECTION,
422
440
  ERROR_CODE: CODE
423
441
  };
424
442
 
@@ -735,6 +753,26 @@ version: 4.12.0-beta.5
735
753
  obj.__proto__ = proto;
736
754
  return obj;
737
755
  };
756
+ var camelize = function (str) {
757
+ return str.replace(/[\s-_]([a-z])/g, function (all, letter) {
758
+ return letter.toUpperCase();
759
+ });
760
+ };
761
+ var getDataAttributes = function (element, attributePrefix) {
762
+ var dataAttributes = {};
763
+ var attributes = element.attributes;
764
+ var length = attributes.length;
765
+ for (var i = 0; i < length; ++i) {
766
+ var attribute = attributes[i];
767
+ var name_1 = attribute.name,
768
+ value = attribute.value;
769
+ if (name_1.indexOf(attributePrefix) === -1) {
770
+ continue;
771
+ }
772
+ dataAttributes[camelize(name_1.replace(attributePrefix, ""))] = value;
773
+ }
774
+ return dataAttributes;
775
+ };
738
776
 
739
777
  var Utils = {
740
778
  __proto__: null,
@@ -766,7 +804,9 @@ version: 4.12.0-beta.5
766
804
  circulateIndex: circulateIndex,
767
805
  range: range,
768
806
  getElementSize: getElementSize,
769
- setPrototypeOf: setPrototypeOf
807
+ setPrototypeOf: setPrototypeOf,
808
+ camelize: camelize,
809
+ getDataAttributes: getDataAttributes
770
810
  };
771
811
 
772
812
  /*
@@ -3775,7 +3815,6 @@ version: 4.12.0-beta.5
3775
3815
  var _this = this;
3776
3816
  var _b = (_a === void 0 ? {} : _a).align,
3777
3817
  align = _b === void 0 ? ALIGN.CENTER : _b;
3778
- this._lookedOffset = 0;
3779
3818
  this._checkTranslateSupport = function () {
3780
3819
  var e_1, _a;
3781
3820
  var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
@@ -4135,8 +4174,6 @@ version: 4.12.0-beta.5
4135
4174
  */
4136
4175
  __proto.lookAt = function (pos) {
4137
4176
  var _this = this;
4138
- var prevOffset = this._offset;
4139
- var isChangedOffset = this._lookedOffset !== prevOffset;
4140
4177
  var flicking = getFlickingAttached(this._flicking);
4141
4178
  var prevPos = this._position;
4142
4179
  this._position = pos;
@@ -4147,12 +4184,7 @@ version: 4.12.0-beta.5
4147
4184
  if (toggled) {
4148
4185
  void flicking.renderer.render().then(function () {
4149
4186
  _this.updateOffset();
4150
- _this._lookedOffset = _this._offset;
4151
4187
  });
4152
- } else if (isChangedOffset) {
4153
- // sync offset for renderOnlyVisible on resize
4154
- this.updateOffset();
4155
- this._lookedOffset = this._offset;
4156
4188
  } else {
4157
4189
  this.applyTransform();
4158
4190
  }
@@ -4327,8 +4359,8 @@ version: 4.12.0-beta.5
4327
4359
  return this;
4328
4360
  };
4329
4361
  /**
4330
- * Update Viewport's height to visible panel's max height
4331
- * @ko 현재 활성화된 패널과 보이는 패널의 최대 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
4362
+ * Update Viewport's height to active panel's height
4363
+ * @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
4332
4364
  * @throws {FlickingError}
4333
4365
  * {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
4334
4366
  * <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
@@ -4338,17 +4370,9 @@ version: 4.12.0-beta.5
4338
4370
  __proto.updateAdaptiveHeight = function () {
4339
4371
  var flicking = getFlickingAttached(this._flicking);
4340
4372
  var activePanel = flicking.control.activePanel;
4341
- var visiblePanels = flicking.visiblePanels;
4342
- var selectedPanels = __spread(visiblePanels);
4343
- if (activePanel) {
4344
- selectedPanels.push(activePanel);
4345
- }
4346
- if (!flicking.horizontal || !flicking.adaptive || !selectedPanels.length) return;
4347
- var maxHeight = Math.max.apply(Math, __spread(selectedPanels.map(function (panel) {
4348
- return panel.height;
4349
- })));
4373
+ if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
4350
4374
  flicking.viewport.setSize({
4351
- height: maxHeight
4375
+ height: activePanel.height
4352
4376
  });
4353
4377
  };
4354
4378
  /**
@@ -4419,7 +4443,6 @@ version: 4.12.0-beta.5
4419
4443
  };
4420
4444
  __proto._resetInternalValues = function () {
4421
4445
  this._position = 0;
4422
- this._lookedOffset = 0;
4423
4446
  this._alignPos = 0;
4424
4447
  this._offset = 0;
4425
4448
  this._circularOffset = 0;
@@ -7968,10 +7991,323 @@ version: 4.12.0-beta.5
7968
7991
  * Flicking.VERSION; // ex) 4.0.0
7969
7992
  * ```
7970
7993
  */
7971
- Flicking.VERSION = "4.12.0-beta.5";
7994
+ Flicking.VERSION = "4.12.0-beta.7";
7972
7995
  return Flicking;
7973
7996
  }(Component);
7974
7997
 
7998
+ /*
7999
+ * Copyright (c) 2015 NAVER Corp.
8000
+ * egjs projects are licensed under the MIT license
8001
+ */
8002
+ /**
8003
+ * @extends Component
8004
+ * @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
8005
+ * @requires {@link https://github.com/naver/egjs-component|@egjs/component}
8006
+ * @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
8007
+ */
8008
+ var CrossFlicking = /*#__PURE__*/function (_super) {
8009
+ __extends(CrossFlicking, _super);
8010
+ // Options Setter
8011
+ // public set align(val: FlickingOptions["align"]) {
8012
+ // this._align = val;
8013
+ // }
8014
+ function CrossFlicking(root, options) {
8015
+ if (options === void 0) {
8016
+ options = {};
8017
+ }
8018
+ var _this = _super.call(this, root, options) || this;
8019
+ _this._onHorizontalHoldStart = function () {
8020
+ _this.dragThreshold = 10;
8021
+ _this._moveDirection = null;
8022
+ };
8023
+ _this._onHorizontalMove = function (e) {
8024
+ if (e.isTrusted && !_this._moveDirection) {
8025
+ _this._sideFlicking.forEach(function (child) {
8026
+ child.dragThreshold = Infinity;
8027
+ });
8028
+ _this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
8029
+ }
8030
+ };
8031
+ _this._onHorizontalMoveEnd = function (e) {
8032
+ var visiblePanels = _this.visiblePanels;
8033
+ _this._sideFlicking.forEach(function (child) {
8034
+ child.dragThreshold = 10;
8035
+ });
8036
+ _this._moveDirection = null;
8037
+ if (visiblePanels.length > 1) {
8038
+ _this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
8039
+ } else {
8040
+ _this._nextIndex = visiblePanels[0].index;
8041
+ }
8042
+ // _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 timeout으로 처리
8043
+ _this._sideFlicking.forEach(function (child, i) {
8044
+ if (_this._nextIndex !== i) {
8045
+ var _a = _this._sideState[i],
8046
+ start = _a.start,
8047
+ end = _a.end;
8048
+ if (child.index < start) {
8049
+ child.stopAnimation();
8050
+ void child.moveTo(start, 0);
8051
+ } else if (child.index > end) {
8052
+ child.stopAnimation();
8053
+ void child.moveTo(end, 0);
8054
+ }
8055
+ }
8056
+ });
8057
+ if (e.isTrusted) {
8058
+ _this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
8059
+ }
8060
+ };
8061
+ _this._onSideHoldStart = function () {
8062
+ _this._sideFlicking.forEach(function (child) {
8063
+ child.dragThreshold = 10;
8064
+ });
8065
+ _this._moveDirection = null;
8066
+ };
8067
+ _this._onSideMove = function (e) {
8068
+ if (e.isTrusted && !_this._moveDirection) {
8069
+ _this.dragThreshold = Infinity;
8070
+ _this._moveDirection = MOVE_DIRECTION.VERTICAL;
8071
+ }
8072
+ };
8073
+ _this._onSideMoveEnd = function () {
8074
+ _this.dragThreshold = 10;
8075
+ _this._moveDirection = null;
8076
+ };
8077
+ _this._onSideChanged = function (e) {
8078
+ // this.visiblePanels.length 가 2보다 크다면 가로 방향 Flicking이 조작 중이라는 것을 의미합니다.
8079
+ // 이 경우 가로 방향 Flicking의 이동이 완전히 끝난 뒤 _onHorizontalMoveEnd 에서 syncToCategory할 것이므로 여기서는 하지 않습니다.
8080
+ if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
8081
+ _this._syncToCategory(e.index, _this.index);
8082
+ }
8083
+ };
8084
+ // Internal states
8085
+ _this._sideState = _this._createSideState();
8086
+ _this._moveDirection = null;
8087
+ _this._nextIndex = 0;
8088
+ // Bind options
8089
+ _this._sideOptions = options.sideOptions;
8090
+ // Create core components
8091
+ _this._sideFlicking = _this._createSideFlicking();
8092
+ return _this;
8093
+ }
8094
+ var __proto = CrossFlicking.prototype;
8095
+ Object.defineProperty(__proto, "sideFlicking", {
8096
+ // Components
8097
+ /**
8098
+ * {@link Control} instance of the Flicking
8099
+ * @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
8100
+ * @type {Control}
8101
+ * @default SnapControl
8102
+ * @readonly
8103
+ * @see Control
8104
+ * @see SnapControl
8105
+ * @see FreeControl
8106
+ */
8107
+ get: function () {
8108
+ return this._sideFlicking;
8109
+ },
8110
+ enumerable: false,
8111
+ configurable: true
8112
+ });
8113
+ Object.defineProperty(__proto, "sideState", {
8114
+ // Internal States
8115
+ /**
8116
+ * Whether Flicking's {@link Flicking#init init()} is called.
8117
+ * This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
8118
+ * @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
8119
+ * 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
8120
+ * @type {boolean}
8121
+ * @default false
8122
+ * @readonly
8123
+ */
8124
+ get: function () {
8125
+ return this._sideState;
8126
+ },
8127
+ enumerable: false,
8128
+ configurable: true
8129
+ });
8130
+ Object.defineProperty(__proto, "sideOptions", {
8131
+ // Options Getter
8132
+ /**
8133
+ * Change active panel index on mouse/touch hold while animating.
8134
+ * `index` of the `willChange`/`willRestore` event will be used as new index.
8135
+ * @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
8136
+ * `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
8137
+ * @type {FlickingOptions}
8138
+ * @default undefined
8139
+ * @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
8140
+ */
8141
+ get: function () {
8142
+ return this._sideOptions;
8143
+ },
8144
+ enumerable: false,
8145
+ configurable: true
8146
+ });
8147
+ /**
8148
+ * Initialize Flicking and move to the default index
8149
+ * This is automatically called on Flicking's constructor when `autoInit` is true(default)
8150
+ * @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
8151
+ * 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
8152
+ * @fires Flicking#ready
8153
+ * @return {Promise<void>}
8154
+ */
8155
+ __proto.init = function () {
8156
+ var _this = this;
8157
+ return _super.prototype.init.call(this).then(function () {
8158
+ return _this._addComponentEvents();
8159
+ });
8160
+ };
8161
+ /**
8162
+ * Destroy Flicking and remove all event handlers
8163
+ * @ko Flicking과 하위 컴포넌트들을 초기 상태로 되돌리고, 부착된 모든 이벤트 핸들러를 제거합니다
8164
+ * @return {void}
8165
+ */
8166
+ __proto.destroy = function () {
8167
+ // TODO 모든 child flicking destroy
8168
+ _super.prototype.destroy.call(this);
8169
+ };
8170
+ __proto._addComponentEvents = function () {
8171
+ var _this = this;
8172
+ this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
8173
+ this.on(EVENTS.MOVE, this._onHorizontalMove);
8174
+ this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
8175
+ this._sideFlicking.forEach(function (flicking) {
8176
+ flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
8177
+ flicking.on(EVENTS.MOVE, _this._onSideMove);
8178
+ flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
8179
+ flicking.on(EVENTS.CHANGED, _this._onSideChanged);
8180
+ });
8181
+ };
8182
+ __proto._createSideState = function () {
8183
+ var _this = this;
8184
+ // data-index로 분류하기 전에 임시로 모든 children에 대해 side flicking으로 해보자.
8185
+ // panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
8186
+ // 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
8187
+ var viewportEl = this.element;
8188
+ var cameraEl = this.camera.element;
8189
+ var panels = toArray(cameraEl.children);
8190
+ var sideState = [];
8191
+ var sidePanels = "";
8192
+ // check data attribute exists
8193
+ var groupKeys = [];
8194
+ var groupPanels = {};
8195
+ var sideCamera = document.createElement("div");
8196
+ sideCamera.classList.add(CLASS.CAMERA);
8197
+ var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
8198
+ if (!isCrossStructure) {
8199
+ viewportEl.setAttribute("data-cross-structure", "true");
8200
+ panels.forEach(function (panel) {
8201
+ var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
8202
+ if (groupKey && !includes(groupKeys, groupKey)) {
8203
+ groupKeys.push(groupKey);
8204
+ groupPanels[groupKey] = [panel];
8205
+ } else if (groupKey) {
8206
+ groupPanels[groupKey].push(panel);
8207
+ }
8208
+ });
8209
+ if (groupKeys.length) {
8210
+ sideState = groupKeys.reduce(function (state, key) {
8211
+ var start = state.length ? +state[state.length - 1].end + 1 : 0;
8212
+ var element = groupPanels[key].reduce(function (el, panel) {
8213
+ sidePanels += panel.outerHTML;
8214
+ el.innerHTML += panel.outerHTML;
8215
+ return el;
8216
+ }, document.createElement("div"));
8217
+ return __spread(state, [{
8218
+ key: key,
8219
+ start: start,
8220
+ end: start + groupPanels[key].length - 1,
8221
+ element: element
8222
+ }]);
8223
+ }, []);
8224
+ this.remove(0, this.panelCount - groupKeys.length);
8225
+ sideState.forEach(function (_, i) {
8226
+ var panel = _this.camera.children[i];
8227
+ Array.from(panel.attributes).forEach(function (attribute) {
8228
+ return panel.removeAttribute(attribute.name);
8229
+ });
8230
+ });
8231
+ } else {
8232
+ sideState = panels.reduce(function (state, panel, i) {
8233
+ var start = state.length ? +state[state.length - 1].end + 1 : 0;
8234
+ sidePanels += panel.innerHTML;
8235
+ return __spread(state, [{
8236
+ key: i.toString(),
8237
+ start: start,
8238
+ end: start + panel.children.length - 1,
8239
+ element: panel
8240
+ }]);
8241
+ }, []);
8242
+ }
8243
+ sideCamera.innerHTML = sidePanels;
8244
+ sideState.forEach(function (_, i) {
8245
+ var panel = _this.camera.children[i];
8246
+ [CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
8247
+ if (!panel.classList.contains(className)) {
8248
+ panel.classList.add(className);
8249
+ }
8250
+ });
8251
+ panel.innerHTML = sideCamera.outerHTML;
8252
+ });
8253
+ } else {
8254
+ toArray(panels[0].children[0].children).forEach(function (panel) {
8255
+ var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
8256
+ if (groupKey && !includes(groupKeys, groupKey)) {
8257
+ groupKeys.push(groupKey);
8258
+ groupPanels[groupKey] = [panel];
8259
+ } else if (groupKey) {
8260
+ groupPanels[groupKey].push(panel);
8261
+ }
8262
+ });
8263
+ sideState = groupKeys.reduce(function (state, key) {
8264
+ var start = state.length ? +state[state.length - 1].end + 1 : 0;
8265
+ var element = groupPanels[key].reduce(function (el, panel) {
8266
+ el.innerHTML += panel.outerHTML;
8267
+ return el;
8268
+ }, document.createElement("div"));
8269
+ return __spread(state, [{
8270
+ key: key,
8271
+ start: start,
8272
+ end: start + groupPanels[key].length - 1,
8273
+ element: element
8274
+ }]);
8275
+ }, []);
8276
+ }
8277
+ return sideState;
8278
+ };
8279
+ __proto._createSideFlicking = function () {
8280
+ var _this = this;
8281
+ return this.sideState.map(function (state, i) {
8282
+ return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
8283
+ horizontal: false,
8284
+ panelsPerView: 1,
8285
+ defaultIndex: state.start
8286
+ }));
8287
+ });
8288
+ };
8289
+ __proto._syncToCategory = function (index, outerIndex) {
8290
+ var _this = this;
8291
+ this.stopAnimation();
8292
+ this._sideFlicking.forEach(function (child, i) {
8293
+ var _a = _this._sideState[i],
8294
+ start = _a.start,
8295
+ end = _a.end;
8296
+ if (start <= index && end >= index && outerIndex !== i) {
8297
+ child.stopAnimation();
8298
+ void child.moveTo(index, 0);
8299
+ void _this.moveTo(i, 0);
8300
+ }
8301
+ });
8302
+ };
8303
+ return CrossFlicking;
8304
+ }(Flicking);
8305
+
8306
+ var CrossFlicking$1 = {
8307
+ __proto__: null,
8308
+ CrossFlicking: CrossFlicking
8309
+ };
8310
+
7975
8311
  /*
7976
8312
  * Copyright (c) 2015 NAVER Corp.
7977
8313
  * egjs projects are licensed under the MIT license
@@ -8217,6 +8553,7 @@ version: 4.12.0-beta.5
8217
8553
  merge(Flicking, Constants);
8218
8554
  merge(Flicking, CFC);
8219
8555
  merge(Flicking, Utils);
8556
+ merge(Flicking, CrossFlicking$1);
8220
8557
 
8221
8558
  return Flicking;
8222
8559