@egjs/flicking 4.12.0-beta.0 → 4.12.0-beta.10

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.
@@ -0,0 +1,77 @@
1
+ import Flicking, { FlickingEvents, FlickingOptions } from "./Flicking";
2
+ import { ChangedEvent, HoldEndEvent, HoldStartEvent, MoveEndEvent, MoveEvent, MoveStartEvent, WillChangeEvent } from "./type/event";
3
+ export declare const SIDE_EVENTS: {
4
+ readonly HOLD_START: "sideHoldStart";
5
+ readonly HOLD_END: "sideHoldEnd";
6
+ readonly MOVE_START: "sideMoveStart";
7
+ readonly MOVE: "sideMove";
8
+ readonly MOVE_END: "sideMoveEnd";
9
+ readonly WILL_CHANGE: "sideWillChange";
10
+ readonly CHANGED: "sideChanged";
11
+ };
12
+ export declare type CrossFlickingEvent<T> = {
13
+ mainIndex: number;
14
+ } & T;
15
+ export interface CrossFlickingEvents extends FlickingEvents {
16
+ [SIDE_EVENTS.HOLD_START]: CrossFlickingEvent<HoldStartEvent>;
17
+ [SIDE_EVENTS.HOLD_END]: CrossFlickingEvent<HoldEndEvent>;
18
+ [SIDE_EVENTS.MOVE_START]: CrossFlickingEvent<MoveStartEvent>;
19
+ [SIDE_EVENTS.MOVE]: CrossFlickingEvent<MoveEvent>;
20
+ [SIDE_EVENTS.MOVE_END]: CrossFlickingEvent<MoveEndEvent>;
21
+ [SIDE_EVENTS.WILL_CHANGE]: CrossFlickingEvent<WillChangeEvent>;
22
+ [SIDE_EVENTS.CHANGED]: CrossFlickingEvent<ChangedEvent>;
23
+ }
24
+ export interface CrossFlickingOptions extends FlickingOptions {
25
+ sideOptions: Partial<FlickingOptions> | undefined;
26
+ preserveIndex: boolean | undefined;
27
+ disableSlideOnHold: boolean | undefined;
28
+ disableIndexSync: boolean | undefined;
29
+ }
30
+ export interface SideState {
31
+ key: string;
32
+ start: number;
33
+ end: number;
34
+ element: HTMLElement;
35
+ }
36
+ export declare class CrossFlicking extends Flicking {
37
+ private _sideFlicking;
38
+ private _sideOptions;
39
+ private _preserveIndex;
40
+ private _disableSlideOnHold;
41
+ private _disableIndexSync;
42
+ private _sideState;
43
+ private _moveDirection;
44
+ private _originalDragThreshold;
45
+ private _nextIndex;
46
+ get sideFlicking(): Flicking[];
47
+ get sideState(): SideState[];
48
+ get sideOptions(): CrossFlickingOptions["sideOptions"];
49
+ get preserveIndex(): CrossFlickingOptions["preserveIndex"];
50
+ get disableSlideOnHold(): CrossFlickingOptions["disableSlideOnHold"];
51
+ get disableIndexSync(): CrossFlickingOptions["disableIndexSync"];
52
+ set sideOptions(val: CrossFlickingOptions["sideOptions"]);
53
+ set preserveIndex(val: CrossFlickingOptions["preserveIndex"]);
54
+ set disableSlideOnHold(val: CrossFlickingOptions["disableSlideOnHold"]);
55
+ set disableIndexSync(val: CrossFlickingOptions["disableIndexSync"]);
56
+ constructor(root: HTMLElement | string, options: Partial<CrossFlickingOptions>);
57
+ init(): Promise<void>;
58
+ destroy(): void;
59
+ private _addComponentEvents;
60
+ private _createSideState;
61
+ private _createCrossStructure;
62
+ private _getGroupFromAttribute;
63
+ private _getSideStateFromGroup;
64
+ private _getSideStateFromPanels;
65
+ private _getSideStateFromCrossStructure;
66
+ private _createSideFlicking;
67
+ private _syncToCategory;
68
+ private _setDraggable;
69
+ private _setPreviousSideIndex;
70
+ private _onHorizontalHoldStart;
71
+ private _onHorizontalMove;
72
+ private _onHorizontalMoveEnd;
73
+ private _onSideHoldStart;
74
+ private _onSideMove;
75
+ private _onSideMoveEnd;
76
+ private _onSideChanged;
77
+ }
@@ -12,6 +12,7 @@ declare class Camera {
12
12
  private _mode;
13
13
  private _el;
14
14
  private _transform;
15
+ private _lookedOffset;
15
16
  private _position;
16
17
  private _alignPos;
17
18
  private _offset;
@@ -34,6 +34,8 @@ export declare const MOVE_TYPE: {
34
34
  readonly STRICT: "strict";
35
35
  };
36
36
  export declare const CLASS: {
37
+ VIEWPORT: string;
38
+ CAMERA: string;
37
39
  VERTICAL: string;
38
40
  HIDDEN: string;
39
41
  DEFAULT_VIRTUAL: string;
@@ -46,3 +48,7 @@ export declare const ORDER: {
46
48
  readonly LTR: "ltr";
47
49
  readonly RTL: "rtl";
48
50
  };
51
+ export declare const MOVE_DIRECTION: {
52
+ readonly HORIZONTAL: "horizontal";
53
+ readonly VERTICAL: "vertical";
54
+ };
@@ -1,5 +1,7 @@
1
1
  import Flicking from "./Flicking";
2
2
  import type { FlickingOptions, FlickingEvents } from "./Flicking";
3
+ import type { CrossFlickingOptions } from "./CrossFlicking";
4
+ export * from "./CrossFlicking";
3
5
  export * from "./core";
4
6
  export * from "./camera";
5
7
  export * from "./control";
@@ -9,5 +11,5 @@ export * from "./cfc";
9
11
  export * from "./utils";
10
12
  export * from "./type/event";
11
13
  export * from "./type/external";
12
- export type { FlickingOptions, FlickingEvents };
14
+ export type { FlickingOptions, FlickingEvents, CrossFlickingOptions };
13
15
  export default Flicking;
@@ -43,3 +43,5 @@ export declare const getElementSize: ({ el, horizontal, useFractionalSize, useOf
43
43
  style: CSSStyleDeclaration;
44
44
  }) => number;
45
45
  export declare const setPrototypeOf: (o: any, proto: object) => any;
46
+ export declare const camelize: (str: string) => string;
47
+ export declare const getDataAttributes: (element: HTMLElement, attributePrefix: string) => Record<string, string>;
@@ -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.0
7
+ version: 4.12.0-beta.10
8
8
  */
9
9
  'use strict';
10
10
 
@@ -387,6 +387,8 @@ var MOVE_TYPE = {
387
387
  STRICT: "strict"
388
388
  };
389
389
  var CLASS = {
390
+ VIEWPORT: "flicking-viewport",
391
+ CAMERA: "flicking-camera",
390
392
  VERTICAL: "vertical",
391
393
  HIDDEN: "flicking-hidden",
392
394
  DEFAULT_VIRTUAL: "flicking-panel"
@@ -413,6 +415,17 @@ var ORDER = {
413
415
  LTR: "ltr",
414
416
  RTL: "rtl"
415
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
+ };
416
429
 
417
430
  // eslint-disable-next-line @typescript-eslint/ban-types
418
431
  var merge = function (target) {
@@ -727,6 +740,26 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
727
740
  obj.__proto__ = proto;
728
741
  return obj;
729
742
  };
743
+ var camelize = function (str) {
744
+ return str.replace(/[\s-_]([a-z])/g, function (all, letter) {
745
+ return letter.toUpperCase();
746
+ });
747
+ };
748
+ var getDataAttributes = function (element, attributePrefix) {
749
+ var dataAttributes = {};
750
+ var attributes = element.attributes;
751
+ var length = attributes.length;
752
+ for (var i = 0; i < length; ++i) {
753
+ var attribute = attributes[i];
754
+ var name_1 = attribute.name,
755
+ value = attribute.value;
756
+ if (name_1.indexOf(attributePrefix) === -1) {
757
+ continue;
758
+ }
759
+ dataAttributes[camelize(name_1.replace(attributePrefix, ""))] = value;
760
+ }
761
+ return dataAttributes;
762
+ };
730
763
 
731
764
  /*
732
765
  * Copyright (c) 2015 NAVER Corp.
@@ -3713,6 +3746,7 @@ var Camera = /*#__PURE__*/function () {
3713
3746
  var _this = this;
3714
3747
  var _b = (_a === void 0 ? {} : _a).align,
3715
3748
  align = _b === void 0 ? ALIGN.CENTER : _b;
3749
+ this._lookedOffset = 0;
3716
3750
  this._checkTranslateSupport = function () {
3717
3751
  var e_1, _a;
3718
3752
  var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
@@ -4072,6 +4106,8 @@ var Camera = /*#__PURE__*/function () {
4072
4106
  */
4073
4107
  __proto.lookAt = function (pos) {
4074
4108
  var _this = this;
4109
+ var prevOffset = this._offset;
4110
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4075
4111
  var flicking = getFlickingAttached(this._flicking);
4076
4112
  var prevPos = this._position;
4077
4113
  this._position = pos;
@@ -4082,7 +4118,12 @@ var Camera = /*#__PURE__*/function () {
4082
4118
  if (toggled) {
4083
4119
  void flicking.renderer.render().then(function () {
4084
4120
  _this.updateOffset();
4121
+ _this._lookedOffset = _this._offset;
4085
4122
  });
4123
+ } else if (isChangedOffset) {
4124
+ // sync offset for renderOnlyVisible on resize
4125
+ this.updateOffset();
4126
+ this._lookedOffset = this._offset;
4086
4127
  } else {
4087
4128
  this.applyTransform();
4088
4129
  }
@@ -4257,8 +4298,8 @@ var Camera = /*#__PURE__*/function () {
4257
4298
  return this;
4258
4299
  };
4259
4300
  /**
4260
- * Update Viewport's height to active panel's height
4261
- * @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
4301
+ * Update Viewport's height to visible panel's max height
4302
+ * @ko 현재 활성화된 패널과 보이는 패널의 최대 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
4262
4303
  * @throws {FlickingError}
4263
4304
  * {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
4264
4305
  * <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
@@ -4268,9 +4309,17 @@ var Camera = /*#__PURE__*/function () {
4268
4309
  __proto.updateAdaptiveHeight = function () {
4269
4310
  var flicking = getFlickingAttached(this._flicking);
4270
4311
  var activePanel = flicking.control.activePanel;
4271
- if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
4312
+ var visiblePanels = flicking.visiblePanels;
4313
+ var selectedPanels = __spread(visiblePanels);
4314
+ if (activePanel) {
4315
+ selectedPanels.push(activePanel);
4316
+ }
4317
+ if (!flicking.horizontal || !flicking.adaptive || !selectedPanels.length) return;
4318
+ var maxHeight = Math.max.apply(Math, __spread(selectedPanels.map(function (panel) {
4319
+ return panel.height;
4320
+ })));
4272
4321
  flicking.viewport.setSize({
4273
- height: activePanel.height
4322
+ height: maxHeight
4274
4323
  });
4275
4324
  };
4276
4325
  /**
@@ -4341,6 +4390,7 @@ var Camera = /*#__PURE__*/function () {
4341
4390
  };
4342
4391
  __proto._resetInternalValues = function () {
4343
4392
  this._position = 0;
4393
+ this._lookedOffset = 0;
4344
4394
  this._alignPos = 0;
4345
4395
  this._offset = 0;
4346
4396
  this._circularOffset = 0;
@@ -7862,10 +7912,336 @@ var Flicking = /*#__PURE__*/function (_super) {
7862
7912
  * Flicking.VERSION; // ex) 4.0.0
7863
7913
  * ```
7864
7914
  */
7865
- Flicking.VERSION = "4.12.0-beta.0";
7915
+ Flicking.VERSION = "4.12.0-beta.10";
7866
7916
  return Flicking;
7867
7917
  }(Component);
7868
7918
 
7919
+ var SIDE_EVENTS = {
7920
+ HOLD_START: "sideHoldStart",
7921
+ HOLD_END: "sideHoldEnd",
7922
+ MOVE_START: "sideMoveStart",
7923
+ MOVE: "sideMove",
7924
+ MOVE_END: "sideMoveEnd",
7925
+ WILL_CHANGE: "sideWillChange",
7926
+ CHANGED: "sideChanged"
7927
+ };
7928
+ var CrossFlicking = /*#__PURE__*/function (_super) {
7929
+ __extends(CrossFlicking, _super);
7930
+ function CrossFlicking(root, options) {
7931
+ var _this = _super.call(this, root, options) || this;
7932
+ _this._syncToCategory = function (index, outerIndex) {
7933
+ if (_this._disableIndexSync) {
7934
+ return;
7935
+ }
7936
+ _this.stopAnimation();
7937
+ _this._sideFlicking.forEach(function (child, i) {
7938
+ var _a = _this._sideState[i],
7939
+ start = _a.start,
7940
+ end = _a.end;
7941
+ if (start <= index && end >= index && outerIndex !== i) {
7942
+ child.stopAnimation();
7943
+ void child.moveTo(index, 0);
7944
+ void _this.moveTo(i, 0);
7945
+ }
7946
+ });
7947
+ };
7948
+ _this._setDraggable = function (direction, draggable) {
7949
+ if (!_this._disableSlideOnHold) {
7950
+ return;
7951
+ }
7952
+ var dragThreshold = _this._originalDragThreshold;
7953
+ var threshold = draggable ? dragThreshold && dragThreshold >= 10 ? dragThreshold : 10 : Infinity;
7954
+ if (direction === MOVE_DIRECTION.HORIZONTAL === _this.horizontal) {
7955
+ _this.dragThreshold = threshold;
7956
+ } else if (direction === MOVE_DIRECTION.VERTICAL === _this.horizontal) {
7957
+ _this._sideFlicking.forEach(function (child) {
7958
+ child.dragThreshold = threshold;
7959
+ });
7960
+ }
7961
+ };
7962
+ _this._setPreviousSideIndex = function () {
7963
+ _this._sideFlicking.forEach(function (child, i) {
7964
+ var _a = _this._sideState[i],
7965
+ start = _a.start,
7966
+ end = _a.end;
7967
+ if (_this._preserveIndex) {
7968
+ if (_this._nextIndex !== i) {
7969
+ if (child.index < start) {
7970
+ child.stopAnimation();
7971
+ void child.moveTo(start, 0);
7972
+ } else if (child.index > end) {
7973
+ child.stopAnimation();
7974
+ void child.moveTo(end, 0);
7975
+ }
7976
+ }
7977
+ } else {
7978
+ if (_this._nextIndex !== i) {
7979
+ void child.moveTo(start, 0);
7980
+ }
7981
+ }
7982
+ });
7983
+ };
7984
+ _this._onHorizontalHoldStart = function () {
7985
+ _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
7986
+ _this._moveDirection = null;
7987
+ };
7988
+ _this._onHorizontalMove = function (e) {
7989
+ if (e.isTrusted && !_this._moveDirection) {
7990
+ _this._setDraggable(MOVE_DIRECTION.VERTICAL, false);
7991
+ _this._moveDirection = MOVE_DIRECTION.HORIZONTAL;
7992
+ }
7993
+ };
7994
+ _this._onHorizontalMoveEnd = function (e) {
7995
+ var visiblePanels = _this.visiblePanels;
7996
+ if (visiblePanels.length > 1) {
7997
+ _this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
7998
+ } else {
7999
+ _this._nextIndex = visiblePanels[0].index;
8000
+ }
8001
+ _this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
8002
+ _this._moveDirection = null;
8003
+ // _syncToCategory에서 완전히 가로 이동이 이루어지기 전에 세로 방향 index가 변하는 경우가 있어 requestAnimationFrame 처리
8004
+ requestAnimationFrame(function () {
8005
+ return _this._setPreviousSideIndex();
8006
+ });
8007
+ if (e.isTrusted) {
8008
+ _this._syncToCategory(_this._sideFlicking[_this._nextIndex].index, _this._nextIndex);
8009
+ }
8010
+ };
8011
+ _this._onSideHoldStart = function () {
8012
+ _this._setDraggable(MOVE_DIRECTION.VERTICAL, true);
8013
+ _this._moveDirection = null;
8014
+ };
8015
+ _this._onSideMove = function (e) {
8016
+ if (e.isTrusted && !_this._moveDirection) {
8017
+ _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, false);
8018
+ _this._moveDirection = MOVE_DIRECTION.VERTICAL;
8019
+ }
8020
+ };
8021
+ _this._onSideMoveEnd = function () {
8022
+ _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
8023
+ _this._moveDirection = null;
8024
+ };
8025
+ _this._onSideChanged = function (e) {
8026
+ // If this.visiblePanels.length >= 2, it means that horizontal flicking is being dragged.
8027
+ // In this case, syncToCategory in _onHorizontalMoveEnd will fire after moving finishes, so we don't fire it here.
8028
+ if (_this.visiblePanels.length < 2 && _this._sideFlicking[_this.index] === e.currentTarget) {
8029
+ _this._syncToCategory(e.index, _this.index);
8030
+ }
8031
+ };
8032
+ var _a = options.sideOptions,
8033
+ sideOptions = _a === void 0 ? {} : _a,
8034
+ _b = options.preserveIndex,
8035
+ preserveIndex = _b === void 0 ? true : _b,
8036
+ _c = options.disableSlideOnHold,
8037
+ disableSlideOnHold = _c === void 0 ? true : _c,
8038
+ _d = options.disableIndexSync,
8039
+ disableIndexSync = _d === void 0 ? false : _d;
8040
+ // Internal states
8041
+ _this._moveDirection = null;
8042
+ _this._nextIndex = 0;
8043
+ _this._originalDragThreshold = _this.dragThreshold;
8044
+ // Bind options
8045
+ _this._sideOptions = sideOptions;
8046
+ _this._preserveIndex = preserveIndex;
8047
+ _this._disableSlideOnHold = disableSlideOnHold;
8048
+ _this._disableIndexSync = disableIndexSync;
8049
+ return _this;
8050
+ }
8051
+ var __proto = CrossFlicking.prototype;
8052
+ Object.defineProperty(__proto, "sideFlicking", {
8053
+ // Components
8054
+ get: function () {
8055
+ return this._sideFlicking;
8056
+ },
8057
+ enumerable: false,
8058
+ configurable: true
8059
+ });
8060
+ Object.defineProperty(__proto, "sideState", {
8061
+ get: function () {
8062
+ return this._sideState;
8063
+ },
8064
+ enumerable: false,
8065
+ configurable: true
8066
+ });
8067
+ Object.defineProperty(__proto, "sideOptions", {
8068
+ // Options Getter
8069
+ get: function () {
8070
+ return this._sideOptions;
8071
+ },
8072
+ // Options Setter
8073
+ set: function (val) {
8074
+ this._sideOptions = val;
8075
+ },
8076
+ enumerable: false,
8077
+ configurable: true
8078
+ });
8079
+ Object.defineProperty(__proto, "preserveIndex", {
8080
+ get: function () {
8081
+ return this._preserveIndex;
8082
+ },
8083
+ set: function (val) {
8084
+ this._preserveIndex = val;
8085
+ },
8086
+ enumerable: false,
8087
+ configurable: true
8088
+ });
8089
+ Object.defineProperty(__proto, "disableSlideOnHold", {
8090
+ get: function () {
8091
+ return this._disableSlideOnHold;
8092
+ },
8093
+ set: function (val) {
8094
+ this._disableSlideOnHold = val;
8095
+ },
8096
+ enumerable: false,
8097
+ configurable: true
8098
+ });
8099
+ Object.defineProperty(__proto, "disableIndexSync", {
8100
+ get: function () {
8101
+ return this._disableIndexSync;
8102
+ },
8103
+ set: function (val) {
8104
+ this._disableIndexSync = val;
8105
+ },
8106
+ enumerable: false,
8107
+ configurable: true
8108
+ });
8109
+ __proto.init = function () {
8110
+ var _this = this;
8111
+ return _super.prototype.init.call(this).then(function () {
8112
+ _this._sideState = _this._createSideState();
8113
+ _this._sideFlicking = _this._createSideFlicking();
8114
+ _this._addComponentEvents();
8115
+ });
8116
+ };
8117
+ __proto.destroy = function () {
8118
+ this._sideFlicking.forEach(function (flicking) {
8119
+ flicking.destroy();
8120
+ });
8121
+ _super.prototype.destroy.call(this);
8122
+ };
8123
+ __proto._addComponentEvents = function () {
8124
+ var _this = this;
8125
+ this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
8126
+ this.on(EVENTS.MOVE, this._onHorizontalMove);
8127
+ this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
8128
+ this._sideFlicking.forEach(function (flicking, mainIndex) {
8129
+ flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
8130
+ flicking.on(EVENTS.MOVE, _this._onSideMove);
8131
+ flicking.on(EVENTS.MOVE_END, _this._onSideMoveEnd);
8132
+ flicking.on(EVENTS.CHANGED, _this._onSideChanged);
8133
+ Object.keys(SIDE_EVENTS).forEach(function (name) {
8134
+ flicking.on(EVENTS[name], function (event) {
8135
+ _this.trigger(new Component.ComponentEvent(SIDE_EVENTS[name], __assign({
8136
+ mainIndex: mainIndex
8137
+ }, event)));
8138
+ });
8139
+ });
8140
+ });
8141
+ };
8142
+ __proto._createSideState = function () {
8143
+ var viewportEl = this.element;
8144
+ var cameraEl = this.camera.element;
8145
+ var panels = toArray(cameraEl.children);
8146
+ var isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
8147
+ var sideState = [];
8148
+ if (!isCrossStructure) {
8149
+ var groupPanels = this._getGroupFromAttribute(panels);
8150
+ var groupKeys = Object.keys(groupPanels);
8151
+ if (groupKeys.length) {
8152
+ sideState = this._getSideStateFromGroup(groupPanels);
8153
+ this.remove(0, this.panelCount - groupKeys.length);
8154
+ } else {
8155
+ sideState = this._getSideStateFromPanels(panels);
8156
+ }
8157
+ this._createCrossStructure(sideState);
8158
+ } else {
8159
+ sideState = this._getSideStateFromCrossStructure(panels);
8160
+ }
8161
+ void this.resize();
8162
+ return sideState;
8163
+ };
8164
+ __proto._createCrossStructure = function (sideState) {
8165
+ var _this = this;
8166
+ var sideCamera = document.createElement("div");
8167
+ var sidePanels = "";
8168
+ sideCamera.classList.add(CLASS.CAMERA);
8169
+ sideState.forEach(function (state, i) {
8170
+ var panel = _this.camera.children[i];
8171
+ sidePanels += state.element.innerHTML;
8172
+ Array.from(panel.attributes).forEach(function (attribute) {
8173
+ return panel.removeAttribute(attribute.name);
8174
+ });
8175
+ });
8176
+ sideCamera.innerHTML = sidePanels;
8177
+ sideState.forEach(function (_, i) {
8178
+ var panel = _this.camera.children[i];
8179
+ [CLASS.VIEWPORT, CLASS.VERTICAL].forEach(function (className) {
8180
+ if (!panel.classList.contains(className)) {
8181
+ panel.classList.add(className);
8182
+ }
8183
+ });
8184
+ panel.innerHTML = sideCamera.outerHTML;
8185
+ });
8186
+ this.element.setAttribute("data-cross-structure", "true");
8187
+ };
8188
+ __proto._getGroupFromAttribute = function (panels) {
8189
+ var groupKeys = [];
8190
+ var groupPanels = {};
8191
+ panels.forEach(function (panel) {
8192
+ var groupKey = getDataAttributes(panel, "data-cross-").groupkey;
8193
+ if (groupKey && !includes(groupKeys, groupKey)) {
8194
+ groupKeys.push(groupKey);
8195
+ groupPanels[groupKey] = [panel];
8196
+ } else if (groupKey) {
8197
+ groupPanels[groupKey].push(panel);
8198
+ }
8199
+ });
8200
+ return groupPanels;
8201
+ };
8202
+ __proto._getSideStateFromGroup = function (groupPanels) {
8203
+ return Object.keys(groupPanels).reduce(function (state, key) {
8204
+ var start = state.length ? +state[state.length - 1].end + 1 : 0;
8205
+ var element = groupPanels[key].reduce(function (el, panel) {
8206
+ el.innerHTML += panel.outerHTML;
8207
+ return el;
8208
+ }, document.createElement("div"));
8209
+ return __spread(state, [{
8210
+ key: key,
8211
+ start: start,
8212
+ end: start + groupPanels[key].length - 1,
8213
+ element: element
8214
+ }]);
8215
+ }, []);
8216
+ };
8217
+ __proto._getSideStateFromPanels = function (panels) {
8218
+ return panels.reduce(function (state, panel, i) {
8219
+ var start = state.length ? +state[state.length - 1].end + 1 : 0;
8220
+ return __spread(state, [{
8221
+ key: i.toString(),
8222
+ start: start,
8223
+ end: start + panel.children.length - 1,
8224
+ element: panel
8225
+ }]);
8226
+ }, []);
8227
+ };
8228
+ __proto._getSideStateFromCrossStructure = function (panels) {
8229
+ var groupPanels = this._getGroupFromAttribute(panels);
8230
+ return this._getSideStateFromGroup(groupPanels);
8231
+ };
8232
+ __proto._createSideFlicking = function () {
8233
+ var _this = this;
8234
+ return this.sideState.map(function (state, i) {
8235
+ return new Flicking(_this.camera.children[i], __assign(__assign({}, _this.sideOptions), {
8236
+ horizontal: false,
8237
+ panelsPerView: 1,
8238
+ defaultIndex: state.start
8239
+ }));
8240
+ });
8241
+ };
8242
+ return CrossFlicking;
8243
+ }(Flicking);
8244
+
7869
8245
  /**
7870
8246
  * Decorator that makes the method of flicking available in the framework.
7871
8247
  * @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
@@ -8083,6 +8459,8 @@ var parseAlign = function (alignVal) {
8083
8459
  var modules = {
8084
8460
  __proto__: null,
8085
8461
  'default': Flicking,
8462
+ SIDE_EVENTS: SIDE_EVENTS,
8463
+ CrossFlicking: CrossFlicking,
8086
8464
  VanillaElementProvider: VanillaElementProvider,
8087
8465
  VirtualElementProvider: VirtualElementProvider,
8088
8466
  Panel: Panel,
@@ -8120,6 +8498,7 @@ var modules = {
8120
8498
  CLASS: CLASS,
8121
8499
  CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
8122
8500
  ORDER: ORDER,
8501
+ MOVE_DIRECTION: MOVE_DIRECTION,
8123
8502
  withFlickingMethods: withFlickingMethods,
8124
8503
  sync: sync,
8125
8504
  getRenderingPanels: getRenderingPanels,
@@ -8152,7 +8531,9 @@ var modules = {
8152
8531
  circulateIndex: circulateIndex,
8153
8532
  range: range,
8154
8533
  getElementSize: getElementSize,
8155
- setPrototypeOf: setPrototypeOf
8534
+ setPrototypeOf: setPrototypeOf,
8535
+ camelize: camelize,
8536
+ getDataAttributes: getDataAttributes
8156
8537
  };
8157
8538
 
8158
8539
  /*
@@ -8174,6 +8555,7 @@ exports.CLASS = CLASS;
8174
8555
  exports.Camera = Camera;
8175
8556
  exports.CircularCameraMode = CircularCameraMode;
8176
8557
  exports.Control = Control;
8558
+ exports.CrossFlicking = CrossFlicking;
8177
8559
  exports.DIRECTION = DIRECTION;
8178
8560
  exports.DisabledState = DisabledState;
8179
8561
  exports.DraggingState = DraggingState;
@@ -8185,11 +8567,13 @@ exports.FreeControl = FreeControl;
8185
8567
  exports.HoldingState = HoldingState;
8186
8568
  exports.IdleState = IdleState;
8187
8569
  exports.LinearCameraMode = LinearCameraMode;
8570
+ exports.MOVE_DIRECTION = MOVE_DIRECTION;
8188
8571
  exports.MOVE_TYPE = MOVE_TYPE;
8189
8572
  exports.NormalRenderingStrategy = NormalRenderingStrategy;
8190
8573
  exports.ORDER = ORDER;
8191
8574
  exports.Panel = Panel;
8192
8575
  exports.Renderer = Renderer;
8576
+ exports.SIDE_EVENTS = SIDE_EVENTS;
8193
8577
  exports.SnapControl = SnapControl;
8194
8578
  exports.State = State;
8195
8579
  exports.StateMachine = StateMachine;
@@ -8201,6 +8585,7 @@ exports.VirtualElementProvider = VirtualElementProvider;
8201
8585
  exports.VirtualManager = VirtualManager;
8202
8586
  exports.VirtualPanel = VirtualPanel;
8203
8587
  exports.VirtualRenderingStrategy = VirtualRenderingStrategy;
8588
+ exports.camelize = camelize;
8204
8589
  exports.checkExistence = checkExistence;
8205
8590
  exports.circulateIndex = circulateIndex;
8206
8591
  exports.circulatePosition = circulatePosition;
@@ -8209,6 +8594,7 @@ exports["default"] = Flicking;
8209
8594
  exports.find = find;
8210
8595
  exports.findIndex = findIndex;
8211
8596
  exports.findRight = findRight;
8597
+ exports.getDataAttributes = getDataAttributes;
8212
8598
  exports.getDefaultCameraTransform = getDefaultCameraTransform;
8213
8599
  exports.getDirection = getDirection;
8214
8600
  exports.getElement = getElement;