@egjs/flicking 4.2.5 → 4.4.1

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/README.md +1 -1
  2. package/declaration/Flicking.d.ts +27 -11
  3. package/declaration/camera/Camera.d.ts +3 -2
  4. package/declaration/camera/CircularCamera.d.ts +2 -1
  5. package/declaration/const/error.d.ts +3 -1
  6. package/declaration/const/external.d.ts +5 -0
  7. package/declaration/core/AutoResizer.d.ts +13 -0
  8. package/declaration/core/VirtualManager.d.ts +37 -0
  9. package/declaration/core/index.d.ts +2 -1
  10. package/declaration/core/panel/Panel.d.ts +17 -10
  11. package/declaration/core/panel/VirtualPanel.d.ts +19 -0
  12. package/declaration/core/panel/index.d.ts +4 -4
  13. package/declaration/core/panel/provider/ElementProvider.d.ts +8 -0
  14. package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -0
  15. package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -0
  16. package/declaration/core/panel/provider/index.d.ts +5 -0
  17. package/declaration/index.d.ts +11 -1
  18. package/declaration/renderer/ExternalRenderer.d.ts +1 -1
  19. package/declaration/renderer/Renderer.d.ts +18 -13
  20. package/declaration/renderer/VanillaRenderer.d.ts +2 -7
  21. package/declaration/renderer/index.d.ts +1 -0
  22. package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -0
  23. package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -0
  24. package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -0
  25. package/declaration/renderer/strategy/index.d.ts +5 -0
  26. package/declaration/utils.d.ts +7 -1
  27. package/dist/flicking.esm.js +1616 -562
  28. package/dist/flicking.esm.js.map +1 -1
  29. package/dist/flicking.js +1571 -494
  30. package/dist/flicking.js.map +1 -1
  31. package/dist/flicking.min.js +2 -2
  32. package/dist/flicking.min.js.map +1 -1
  33. package/dist/flicking.pkgd.js +8733 -6647
  34. package/dist/flicking.pkgd.js.map +1 -1
  35. package/dist/flicking.pkgd.min.js +2 -2
  36. package/dist/flicking.pkgd.min.js.map +1 -1
  37. package/package.json +10 -22
  38. package/src/Flicking.ts +163 -32
  39. package/src/camera/BoundCamera.ts +2 -2
  40. package/src/camera/Camera.ts +49 -26
  41. package/src/camera/CircularCamera.ts +52 -27
  42. package/src/camera/LinearCamera.ts +1 -1
  43. package/src/cfc/sync.ts +2 -2
  44. package/src/const/error.ts +6 -3
  45. package/src/const/external.ts +6 -0
  46. package/src/control/AxesController.ts +15 -8
  47. package/src/control/Control.ts +7 -7
  48. package/src/control/FreeControl.ts +2 -2
  49. package/src/control/SnapControl.ts +3 -3
  50. package/src/control/StrictControl.ts +2 -2
  51. package/src/core/AutoResizer.ts +81 -0
  52. package/src/core/Viewport.ts +4 -4
  53. package/src/core/VirtualManager.ts +188 -0
  54. package/src/core/index.ts +3 -1
  55. package/src/core/panel/Panel.ts +68 -60
  56. package/src/core/panel/VirtualPanel.ts +110 -0
  57. package/src/core/panel/index.ts +5 -7
  58. package/src/core/panel/provider/ElementProvider.ts +14 -0
  59. package/src/core/panel/provider/VanillaElementProvider.ts +45 -0
  60. package/src/core/panel/provider/VirtualElementProvider.ts +48 -0
  61. package/src/core/panel/provider/index.ts +16 -0
  62. package/src/index.ts +12 -1
  63. package/src/index.umd.ts +2 -0
  64. package/src/renderer/ExternalRenderer.ts +7 -7
  65. package/src/renderer/Renderer.ts +173 -68
  66. package/src/renderer/VanillaRenderer.ts +28 -86
  67. package/src/renderer/index.ts +2 -0
  68. package/src/renderer/strategy/NormalRenderingStrategy.ts +106 -0
  69. package/src/renderer/strategy/RenderingStrategy.ts +21 -0
  70. package/src/renderer/strategy/VirtualRenderingStrategy.ts +110 -0
  71. package/src/renderer/strategy/index.ts +17 -0
  72. package/src/utils.ts +36 -2
  73. package/declaration/core/panel/ElementPanel.d.ts +0 -14
  74. package/declaration/core/panel/ExternalPanel.d.ts +0 -9
  75. package/declaration/exports.d.ts +0 -10
  76. package/src/core/panel/ElementPanel.ts +0 -52
  77. package/src/core/panel/ExternalPanel.ts +0 -32
  78. package/src/exports.ts +0 -16
@@ -4,10 +4,11 @@ name: @egjs/flicking
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-flicking
7
- version: 4.2.5
7
+ version: 4.4.1
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
11
+ import ImReady from '@egjs/imready';
11
12
 
12
13
  /*! *****************************************************************************
13
14
  Copyright (c) Microsoft Corporation.
@@ -273,6 +274,7 @@ function __spreadArray(to, from) {
273
274
  * <ko>프레임워크(React, Angular, Vue ...)에서 사용 불가능한 메소드를 호출했을 경우</ko>
274
275
  * @property {number} NOT_INITIALIZED When the {@link Flicking#init} is not called before but is needed<ko>{@link Flicking#init}의 호출이 필요하나, 아직 호출되지 않았을 경우</ko>
275
276
  * @property {number} NO_ACTIVE When there're no active panel that flicking has selected. This may be due to the absence of any panels<ko>현재 Flicking이 선택한 패널이 없을 경우. 일반적으로 패널이 하나도 없는 경우에 발생할 수 있습니다</ko>
277
+ * @property {number} NOT_ALLOWED_IN_VIRTUAL When the non-allowed method is called while the virtual option is enabled<ko>virtual 옵션이 활성화된 상태에서 사용 불가능한 메소드가 호출되었을 경우</ko>
276
278
  */
277
279
  var CODE = {
278
280
  WRONG_TYPE: 0,
@@ -288,7 +290,8 @@ var CODE = {
288
290
  ANIMATION_ALREADY_PLAYING: 10,
289
291
  NOT_ALLOWED_IN_FRAMEWORK: 11,
290
292
  NOT_INITIALIZED: 12,
291
- NO_ACTIVE: 13
293
+ NO_ACTIVE: 13,
294
+ NOT_ALLOWED_IN_VIRTUAL: 14
292
295
  };
293
296
  var MESSAGE = {
294
297
  WRONG_TYPE: function (wrongVal, correctTypes) {
@@ -302,9 +305,7 @@ var MESSAGE = {
302
305
  VAL_MUST_NOT_NULL: function (val, name) {
303
306
  return name + " should be provided. Given: " + val;
304
307
  },
305
- NOT_ATTACHED_TO_FLICKING: function (name) {
306
- return name + " is not attached to the Flicking instance. \"init()\" should be called first.";
307
- },
308
+ NOT_ATTACHED_TO_FLICKING: "This module is not attached to the Flicking instance. \"init()\" should be called first.",
308
309
  WRONG_OPTION: function (optionName, val) {
309
310
  return "Option \"" + optionName + "\" is not in correct format, given: " + val;
310
311
  },
@@ -320,7 +321,8 @@ var MESSAGE = {
320
321
  ANIMATION_ALREADY_PLAYING: "Animation is already playing.",
321
322
  NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular.",
322
323
  NOT_INITIALIZED: "Flicking is not initialized yet, call init() first.",
323
- NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels."
324
+ NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels.",
325
+ NOT_ALLOWED_IN_VIRTUAL: "This behavior is not allowed when the virtual option is enabled"
324
326
  };
325
327
 
326
328
  /*
@@ -416,7 +418,26 @@ var MOVE_TYPE = {
416
418
  FREE_SCROLL: "freeScroll",
417
419
  STRICT: "strict"
418
420
  };
421
+ var CLASS = {
422
+ VERTICAL: "vertical",
423
+ HIDDEN: "flicking-hidden",
424
+ DEFAULT_VIRTUAL: "flicking-panel"
425
+ };
426
+
427
+ var merge = function (target) {
428
+ var sources = [];
429
+
430
+ for (var _i = 1; _i < arguments.length; _i++) {
431
+ sources[_i - 1] = arguments[_i];
432
+ }
419
433
 
434
+ sources.forEach(function (source) {
435
+ Object.keys(source).forEach(function (key) {
436
+ target[key] = source[key];
437
+ });
438
+ });
439
+ return target;
440
+ };
420
441
  var getElement = function (el, parent) {
421
442
  var targetEl = null;
422
443
 
@@ -447,9 +468,9 @@ var checkExistence = function (value, nameOnErrMsg) {
447
468
  var clamp = function (x, min, max) {
448
469
  return Math.max(Math.min(x, max), min);
449
470
  };
450
- var getFlickingAttached = function (val, nameToThrowOnError) {
471
+ var getFlickingAttached = function (val) {
451
472
  if (!val) {
452
- throw new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING(nameToThrowOnError), CODE.NOT_ATTACHED_TO_FLICKING);
473
+ throw new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING);
453
474
  }
454
475
 
455
476
  return val;
@@ -565,6 +586,12 @@ var parseArithmeticExpression = function (cssValue) {
565
586
 
566
587
  return parsed;
567
588
  };
589
+ var parseCSSSizeValue = function (val) {
590
+ return isString(val) ? val : val + "px";
591
+ };
592
+ var parsePanelAlign = function (align) {
593
+ return typeof align === "object" ? align.panel : align;
594
+ };
568
595
  var getDirection = function (start, end) {
569
596
  if (start === end) return DIRECTION.NONE;
570
597
  return start < end ? DIRECTION.NEXT : DIRECTION.PREV;
@@ -658,6 +685,17 @@ var find = function (array, checker) {
658
685
 
659
686
  return null;
660
687
  };
688
+ var findRight = function (array, checker) {
689
+ for (var idx = array.length - 1; idx >= 0; idx--) {
690
+ var val = array[idx];
691
+
692
+ if (checker(val)) {
693
+ return val;
694
+ }
695
+ }
696
+
697
+ return null;
698
+ };
661
699
  var findIndex = function (array, checker) {
662
700
  for (var idx = 0; idx < array.length; idx++) {
663
701
  if (checker(array[idx])) {
@@ -674,6 +712,26 @@ var getProgress = function (pos, prev, next) {
674
712
  var getStyle = function (el) {
675
713
  return window.getComputedStyle(el) || el.currentStyle;
676
714
  };
715
+ var setSize = function (el, _a) {
716
+ var width = _a.width,
717
+ height = _a.height;
718
+
719
+ if (width != null) {
720
+ if (isString(width)) {
721
+ el.style.width = width;
722
+ } else {
723
+ el.style.width = width + "px";
724
+ }
725
+ }
726
+
727
+ if (height != null) {
728
+ if (isString(height)) {
729
+ el.style.height = height;
730
+ } else {
731
+ el.style.height = height + "px";
732
+ }
733
+ }
734
+ };
677
735
  var isBetween = function (val, min, max) {
678
736
  return val >= min && val <= max;
679
737
  };
@@ -686,6 +744,15 @@ var circulateIndex = function (index, max) {
686
744
  return index;
687
745
  }
688
746
  };
747
+ var range = function (end) {
748
+ var arr = new Array(end);
749
+
750
+ for (var i = 0; i < end; i++) {
751
+ arr[i] = i;
752
+ }
753
+
754
+ return arr;
755
+ };
689
756
  var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
690
757
  obj.__proto__ = proto;
691
758
  return obj;
@@ -714,7 +781,9 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
714
781
  * ```
715
782
  */
716
783
 
717
- var FlickingError = function (_super) {
784
+ var FlickingError =
785
+ /*#__PURE__*/
786
+ function (_super) {
718
787
  __extends(FlickingError, _super);
719
788
  /**
720
789
  * @param message Error message<ko>에러 메시지</ko>
@@ -743,7 +812,9 @@ var FlickingError = function (_super) {
743
812
  * @ko 뷰포트 크기 정보를 담당하는 컴포넌트
744
813
  */
745
814
 
746
- var Viewport = function () {
815
+ var Viewport =
816
+ /*#__PURE__*/
817
+ function () {
747
818
  /**
748
819
  * @param el A viewport element<ko>뷰포트 엘리먼트</ko>
749
820
  */
@@ -866,10 +937,10 @@ var Viewport = function () {
866
937
  this._width = el.clientWidth;
867
938
  this._height = el.clientHeight;
868
939
  this._padding = {
869
- left: parseFloat(elStyle.paddingLeft),
870
- right: parseFloat(elStyle.paddingRight),
871
- top: parseFloat(elStyle.paddingTop),
872
- bottom: parseFloat(elStyle.paddingBottom)
940
+ left: elStyle.paddingLeft ? parseFloat(elStyle.paddingLeft) : 0,
941
+ right: elStyle.paddingRight ? parseFloat(elStyle.paddingRight) : 0,
942
+ top: elStyle.paddingTop ? parseFloat(elStyle.paddingTop) : 0,
943
+ bottom: elStyle.paddingBottom ? parseFloat(elStyle.paddingBottom) : 0
873
944
  };
874
945
  this._isBorderBoxSizing = elStyle.boxSizing === "border-box";
875
946
  };
@@ -877,128 +948,536 @@ var Viewport = function () {
877
948
  return Viewport;
878
949
  }();
879
950
 
951
+ var AutoResizer =
952
+ /*#__PURE__*/
953
+ function () {
954
+ function AutoResizer(flicking) {
955
+ var _this = this;
956
+
957
+ this._onResize = function () {
958
+ void _this._flicking.resize();
959
+ }; // eslint-disable-next-line @typescript-eslint/member-ordering
960
+
961
+
962
+ this._skipFirstResize = function () {
963
+ var isFirstResize = true;
964
+ return function () {
965
+ if (isFirstResize) {
966
+ isFirstResize = false;
967
+ return;
968
+ }
969
+
970
+ _this._onResize();
971
+ };
972
+ }();
973
+
974
+ this._flicking = flicking;
975
+ this._enabled = false;
976
+ this._resizeObserver = null;
977
+ }
978
+
979
+ var __proto = AutoResizer.prototype;
980
+ Object.defineProperty(__proto, "enabled", {
981
+ get: function () {
982
+ return this._enabled;
983
+ },
984
+ enumerable: false,
985
+ configurable: true
986
+ });
987
+
988
+ __proto.enable = function () {
989
+ var flicking = this._flicking;
990
+ var viewport = flicking.viewport;
991
+
992
+ if (this._enabled) {
993
+ this.disable();
994
+ }
995
+
996
+ if (flicking.useResizeObserver && !!window.ResizeObserver) {
997
+ var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
998
+ var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
999
+ resizeObserver.observe(flicking.viewport.element);
1000
+ this._resizeObserver = resizeObserver;
1001
+ } else {
1002
+ window.addEventListener("resize", this._onResize);
1003
+ }
1004
+
1005
+ this._enabled = true;
1006
+ return this;
1007
+ };
1008
+
1009
+ __proto.disable = function () {
1010
+ if (!this._enabled) return this;
1011
+ var resizeObserver = this._resizeObserver;
1012
+
1013
+ if (resizeObserver) {
1014
+ resizeObserver.disconnect();
1015
+ this._resizeObserver = null;
1016
+ } else {
1017
+ window.removeEventListener("resize", this._onResize);
1018
+ }
1019
+
1020
+ this._enabled = false;
1021
+ return this;
1022
+ };
1023
+
1024
+ return AutoResizer;
1025
+ }();
1026
+
880
1027
  /**
881
- * All possible @egjs/axes event keys
882
1028
  * @internal
883
1029
  */
884
- var EVENT = {
885
- HOLD: "hold",
886
- CHANGE: "change",
887
- RELEASE: "release",
888
- ANIMATION_END: "animationEnd",
889
- FINISH: "finish"
890
- };
1030
+ var VanillaElementProvider =
1031
+ /*#__PURE__*/
1032
+ function () {
1033
+ function VanillaElementProvider(element) {
1034
+ this._element = element;
1035
+ this._rendered = true;
1036
+ }
1037
+
1038
+ var __proto = VanillaElementProvider.prototype;
1039
+ Object.defineProperty(__proto, "element", {
1040
+ get: function () {
1041
+ return this._element;
1042
+ },
1043
+ enumerable: false,
1044
+ configurable: true
1045
+ });
1046
+ Object.defineProperty(__proto, "rendered", {
1047
+ get: function () {
1048
+ return this._rendered;
1049
+ },
1050
+ enumerable: false,
1051
+ configurable: true
1052
+ });
1053
+
1054
+ __proto.show = function (flicking) {
1055
+ var el = this.element;
1056
+ var cameraEl = flicking.camera.element;
1057
+
1058
+ if (el.parentElement !== cameraEl) {
1059
+ cameraEl.appendChild(el);
1060
+ this._rendered = true;
1061
+ }
1062
+ };
1063
+
1064
+ __proto.hide = function (flicking) {
1065
+ var el = this.element;
1066
+ var cameraEl = flicking.camera.element;
1067
+
1068
+ if (el.parentElement === cameraEl) {
1069
+ cameraEl.removeChild(el);
1070
+ this._rendered = false;
1071
+ }
1072
+ };
1073
+
1074
+ return VanillaElementProvider;
1075
+ }();
1076
+
1077
+ /*
1078
+ * Copyright (c) 2015 NAVER Corp.
1079
+ * egjs projects are licensed under the MIT license
1080
+ */
1081
+
891
1082
  /**
892
- * An Axis key that Flicking uses
893
1083
  * @internal
894
1084
  */
1085
+ var VirtualElementProvider =
1086
+ /*#__PURE__*/
1087
+ function () {
1088
+ function VirtualElementProvider(flicking) {
1089
+ this._flicking = flicking;
1090
+ }
895
1091
 
896
- var POSITION_KEY = "flick";
1092
+ var __proto = VirtualElementProvider.prototype;
1093
+ Object.defineProperty(__proto, "element", {
1094
+ get: function () {
1095
+ return this._virtualElement.nativeElement;
1096
+ },
1097
+ enumerable: false,
1098
+ configurable: true
1099
+ });
1100
+ Object.defineProperty(__proto, "rendered", {
1101
+ get: function () {
1102
+ return this._virtualElement.visible;
1103
+ },
1104
+ enumerable: false,
1105
+ configurable: true
1106
+ });
1107
+ Object.defineProperty(__proto, "_virtualElement", {
1108
+ get: function () {
1109
+ var flicking = this._flicking;
1110
+ var elIndex = this._panel.elementIndex;
1111
+ var virtualElements = flicking.virtual.elements;
1112
+ return virtualElements[elIndex];
1113
+ },
1114
+ enumerable: false,
1115
+ configurable: true
1116
+ });
897
1117
 
898
- var STATE_TYPE;
1118
+ __proto.init = function (panel) {
1119
+ this._panel = panel;
1120
+ };
1121
+
1122
+ __proto.show = function () {// DO_NOTHING
1123
+ // Actual element visibility is controlled by VirtualManager
1124
+ };
1125
+
1126
+ __proto.hide = function () {// DO_NOTHING
1127
+ // Actual element visibility is controlled by VirtualManager
1128
+ };
1129
+
1130
+ return VirtualElementProvider;
1131
+ }();
899
1132
 
900
- (function (STATE_TYPE) {
901
- STATE_TYPE[STATE_TYPE["IDLE"] = 0] = "IDLE";
902
- STATE_TYPE[STATE_TYPE["HOLDING"] = 1] = "HOLDING";
903
- STATE_TYPE[STATE_TYPE["DRAGGING"] = 2] = "DRAGGING";
904
- STATE_TYPE[STATE_TYPE["ANIMATING"] = 3] = "ANIMATING";
905
- STATE_TYPE[STATE_TYPE["DISABLED"] = 4] = "DISABLED";
906
- })(STATE_TYPE || (STATE_TYPE = {}));
907
1133
  /**
908
- * A component that shows the current status of the user input or the animation
909
- * @ko 현재 사용자 입력 또는 애니메이션 상태를 나타내는 컴포넌트
910
- * @internal
1134
+ * A manager class to add / remove virtual panels
911
1135
  */
912
1136
 
1137
+ var VirtualManager =
1138
+ /*#__PURE__*/
1139
+ function () {
1140
+ function VirtualManager(flicking, options) {
1141
+ var _a, _b, _c, _d;
913
1142
 
914
- var State = function () {
915
- function State() {
916
- this._delta = 0;
917
- this._targetPanel = null;
1143
+ this._flicking = flicking;
1144
+ this._renderPanel = (_a = options === null || options === void 0 ? void 0 : options.renderPanel) !== null && _a !== void 0 ? _a : function () {
1145
+ return "";
1146
+ };
1147
+ this._initialPanelCount = (_b = options === null || options === void 0 ? void 0 : options.initialPanelCount) !== null && _b !== void 0 ? _b : -1;
1148
+ this._cache = (_c = options === null || options === void 0 ? void 0 : options.cache) !== null && _c !== void 0 ? _c : false;
1149
+ this._panelClass = (_d = options === null || options === void 0 ? void 0 : options.panelClass) !== null && _d !== void 0 ? _d : CLASS.DEFAULT_VIRTUAL;
1150
+ this._elements = [];
918
1151
  }
919
1152
 
920
- var __proto = State.prototype;
921
- Object.defineProperty(__proto, "delta", {
1153
+ var __proto = VirtualManager.prototype;
1154
+ Object.defineProperty(__proto, "elements", {
1155
+ get: function () {
1156
+ return this._elements;
1157
+ },
1158
+ enumerable: false,
1159
+ configurable: true
1160
+ });
1161
+ Object.defineProperty(__proto, "renderPanel", {
1162
+ // Options
1163
+
922
1164
  /**
923
- * A sum of delta values of change events from the last hold event of Axes
924
- * @ko 이전 hold이벤트부터 change에 의해 발생한 이동 delta값의 합산
925
- * @type {number}
926
- * @readonly
1165
+ * A rendering function for the panel element's innerHTML
1166
+ * @ko 패널 엘리먼트의 innerHTML을 렌더링하는 함수
1167
+ * @type {function}
1168
+ * @param {VirtualPanel} panel Instance of the panel<ko>패널 인스턴스</ko>
1169
+ * @param {number} index Index of the panel<ko>패널 인덱스</ko>
1170
+ * @default "() => {}"
927
1171
  */
928
1172
  get: function () {
929
- return this._delta;
1173
+ return this._renderPanel;
1174
+ },
1175
+ set: function (val) {
1176
+ this._renderPanel = val;
1177
+
1178
+ this._flicking.renderer.panels.forEach(function (panel) {
1179
+ return panel.uncacheRenderResult();
1180
+ });
930
1181
  },
931
1182
  enumerable: false,
932
1183
  configurable: true
933
1184
  });
934
- Object.defineProperty(__proto, "targetPanel", {
1185
+ Object.defineProperty(__proto, "initialPanelCount", {
935
1186
  /**
936
- * A panel to set as {@link Control#activePanel} after the animation is finished
937
- * @ko 애니메이션 종료시 {@link Control#activePanel}로 설정할 패널
938
- * @type {number}
1187
+ * Initial panel count to render
1188
+ * @ko 최초로 렌더링할 패널의 개수
939
1189
  * @readonly
1190
+ * @type {number}
1191
+ * @default -1
940
1192
  */
941
1193
  get: function () {
942
- return this._targetPanel;
1194
+ return this._initialPanelCount;
1195
+ },
1196
+ enumerable: false,
1197
+ configurable: true
1198
+ });
1199
+ Object.defineProperty(__proto, "cache", {
1200
+ /**
1201
+ * Whether to cache rendered panel's innerHTML
1202
+ * @ko 렌더링된 패널의 innerHTML 정보를 캐시할지 여부
1203
+ * @type {boolean}
1204
+ * @default false
1205
+ */
1206
+ get: function () {
1207
+ return this._cache;
943
1208
  },
944
1209
  set: function (val) {
945
- this._targetPanel = val;
1210
+ this._cache = val;
1211
+ },
1212
+ enumerable: false,
1213
+ configurable: true
1214
+ });
1215
+ Object.defineProperty(__proto, "panelClass", {
1216
+ /**
1217
+ * The class name that will be applied to rendered panel elements
1218
+ * @ko 렌더링되는 패널 엘리먼트에 적용될 클래스 이름
1219
+ * @type {string}
1220
+ * @default "flicking-panel"
1221
+ */
1222
+ get: function () {
1223
+ return this._panelClass;
1224
+ },
1225
+ set: function (val) {
1226
+ this._panelClass = val;
946
1227
  },
947
1228
  enumerable: false,
948
1229
  configurable: true
949
1230
  });
950
- /**
951
- * An callback which is called when state has changed to this state
952
- * @ko 현재 상태로 돌입했을때 호출되는 콜백 함수
953
- * @param {State} prevState An previous state<ko>이전 상태값</ko>
954
- * @return {void}
955
- */
956
1231
 
957
- __proto.onEnter = function (prevState) {
958
- this._delta = prevState._delta;
959
- this._targetPanel = prevState._targetPanel;
1232
+ __proto.init = function () {
1233
+ var flicking = this._flicking;
1234
+ if (!flicking.virtualEnabled) return;
1235
+
1236
+ if (!flicking.externalRenderer && !flicking.renderExternal) {
1237
+ this._initVirtualElements();
1238
+ }
1239
+
1240
+ var virtualElements = flicking.camera.children;
1241
+ this._elements = virtualElements.map(function (el) {
1242
+ return {
1243
+ nativeElement: el,
1244
+ visible: true
1245
+ };
1246
+ });
960
1247
  };
961
- /**
962
- * An event handler for Axes's {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} event
963
- * @ko Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} 이벤트 핸들러
964
- * @param {object} [ctx] Event context<ko>이벤트 콘텍스트</ko>
965
- * @param {Flicking} [ctx.flicking] An instance of Flicking<ko>Flicking 인스턴스</ko>
966
- * @param {object} [ctx.axesEvent] A {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} event of Axes
967
- * <ko>Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} 이벤트</ko>
968
- * @param {function} [ctx.transitTo] A function for changing current state to other state<ko>다른 상태로 변경하기 위한 함수</ko>
969
- * @return {void}
970
- */
971
1248
 
1249
+ __proto.show = function (index) {
1250
+ var el = this._elements[index];
1251
+ var nativeEl = el.nativeElement;
1252
+ el.visible = true;
972
1253
 
973
- __proto.onHold = function (ctx) {// DO NOTHING
1254
+ if (nativeEl.style.display) {
1255
+ nativeEl.style.display = "";
1256
+ }
1257
+ };
1258
+
1259
+ __proto.hide = function (index) {
1260
+ var el = this._elements[index];
1261
+ var nativeEl = el.nativeElement;
1262
+ el.visible = false;
1263
+ nativeEl.style.display = "none";
974
1264
  };
975
1265
  /**
976
- * An event handler for Axes's {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} event
977
- * @ko Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} 이벤트 핸들러
978
- * @param {object} [ctx] Event context<ko>이벤트 콘텍스트</ko>
979
- * @param {Flicking} [ctx.flicking] An instance of Flicking<ko>Flicking 인스턴스</ko>
980
- * @param {object} [ctx.axesEvent] A {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} event of Axes
981
- * <ko>Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} 이벤트</ko>
982
- * @param {function} [ctx.transitTo] A function for changing current state to other state<ko>다른 상태로 변경하기 위한 함수</ko>
983
- * @return {void}
1266
+ * Add new virtual panels at the end of the list
1267
+ * @ko 새로운 가상 패널들을 리스트의 끝에 추가합니다
1268
+ * @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
1269
+ * @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
984
1270
  */
985
1271
 
986
1272
 
987
- __proto.onChange = function (ctx) {// DO NOTHING
1273
+ __proto.append = function (count) {
1274
+ if (count === void 0) {
1275
+ count = 1;
1276
+ }
1277
+
1278
+ var flicking = this._flicking;
1279
+ return this.insert(flicking.panels.length, count);
988
1280
  };
989
1281
  /**
990
- * An event handler for Axes's {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} event
991
- * @ko Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} 이벤트 핸들러
992
- * @param {object} [ctx] Event context<ko>이벤트 콘텍스트</ko>
993
- * @param {Flicking} [ctx.flicking] An instance of Flicking<ko>Flicking 인스턴스</ko>
994
- * @param {object} [ctx.axesEvent] A {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} event of Axes
995
- * <ko>Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} 이벤트</ko>
996
- * @param {function} [ctx.transitTo] A function for changing current state to other state<ko>다른 상태로 변경하기 위한 함수</ko>
997
- * @return {void}
1282
+ * Add new virtual panels at the start of the list
1283
+ * @ko 새로운 가상 패널들을 리스트의 시작에 추가합니다
1284
+ * @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
1285
+ * @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
998
1286
  */
999
1287
 
1000
1288
 
1001
- __proto.onRelease = function (ctx) {// DO NOTHING
1289
+ __proto.prepend = function (count) {
1290
+ if (count === void 0) {
1291
+ count = 1;
1292
+ }
1293
+
1294
+ return this.insert(0, count);
1295
+ };
1296
+ /**
1297
+ * Add new virtual panels at the given index
1298
+ * @ko 새로운 가상 패널들을 주어진 인덱스에 추가합니다
1299
+ * @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
1300
+ * @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
1301
+ */
1302
+
1303
+
1304
+ __proto.insert = function (index, count) {
1305
+ if (count === void 0) {
1306
+ count = 1;
1307
+ }
1308
+
1309
+ if (count <= 0) return [];
1310
+ var flicking = this._flicking;
1311
+ return flicking.renderer.batchInsert({
1312
+ index: index,
1313
+ elements: range(count),
1314
+ hasDOMInElements: false
1315
+ });
1316
+ };
1317
+ /**
1318
+ * Remove panels at the given index
1319
+ * @ko 주어진 인덱스에서 패널들을 삭제합니다
1320
+ * @param {number} count The number of panels to remove<ko>삭제할 패널의 개수</ko>
1321
+ * @returns {Array<VirtualPanel>} The panels removed<ko>삭제된 패널들</ko>
1322
+ */
1323
+
1324
+
1325
+ __proto.remove = function (index, count) {
1326
+ if (count <= 0) return [];
1327
+ var flicking = this._flicking;
1328
+ return flicking.renderer.batchRemove({
1329
+ index: index,
1330
+ deleteCount: count,
1331
+ hasDOMInElements: false
1332
+ });
1333
+ };
1334
+
1335
+ __proto._initVirtualElements = function () {
1336
+ var _this = this;
1337
+
1338
+ var flicking = this._flicking;
1339
+ var cameraElement = flicking.camera.element;
1340
+ var panelsPerView = flicking.panelsPerView;
1341
+ var fragment = document.createDocumentFragment();
1342
+ var newElements = range(panelsPerView + 1).map(function (idx) {
1343
+ var panelEl = document.createElement("div");
1344
+ panelEl.className = _this._panelClass;
1345
+ panelEl.dataset.elementIndex = idx.toString();
1346
+ return panelEl;
1347
+ });
1348
+ newElements.forEach(function (el) {
1349
+ fragment.appendChild(el);
1350
+ });
1351
+ cameraElement.appendChild(fragment);
1352
+ };
1353
+
1354
+ return VirtualManager;
1355
+ }();
1356
+
1357
+ /**
1358
+ * All possible @egjs/axes event keys
1359
+ * @internal
1360
+ */
1361
+ var EVENT = {
1362
+ HOLD: "hold",
1363
+ CHANGE: "change",
1364
+ RELEASE: "release",
1365
+ ANIMATION_END: "animationEnd",
1366
+ FINISH: "finish"
1367
+ };
1368
+ /**
1369
+ * An Axis key that Flicking uses
1370
+ * @internal
1371
+ */
1372
+
1373
+ var POSITION_KEY = "flick";
1374
+
1375
+ var STATE_TYPE;
1376
+
1377
+ (function (STATE_TYPE) {
1378
+ STATE_TYPE[STATE_TYPE["IDLE"] = 0] = "IDLE";
1379
+ STATE_TYPE[STATE_TYPE["HOLDING"] = 1] = "HOLDING";
1380
+ STATE_TYPE[STATE_TYPE["DRAGGING"] = 2] = "DRAGGING";
1381
+ STATE_TYPE[STATE_TYPE["ANIMATING"] = 3] = "ANIMATING";
1382
+ STATE_TYPE[STATE_TYPE["DISABLED"] = 4] = "DISABLED";
1383
+ })(STATE_TYPE || (STATE_TYPE = {}));
1384
+ /**
1385
+ * A component that shows the current status of the user input or the animation
1386
+ * @ko 현재 사용자 입력 또는 애니메이션 상태를 나타내는 컴포넌트
1387
+ * @internal
1388
+ */
1389
+
1390
+
1391
+ var State =
1392
+ /*#__PURE__*/
1393
+ function () {
1394
+ function State() {
1395
+ this._delta = 0;
1396
+ this._targetPanel = null;
1397
+ }
1398
+
1399
+ var __proto = State.prototype;
1400
+ Object.defineProperty(__proto, "delta", {
1401
+ /**
1402
+ * A sum of delta values of change events from the last hold event of Axes
1403
+ * @ko 이전 hold이벤트부터 change에 의해 발생한 이동 delta값의 합산
1404
+ * @type {number}
1405
+ * @readonly
1406
+ */
1407
+ get: function () {
1408
+ return this._delta;
1409
+ },
1410
+ enumerable: false,
1411
+ configurable: true
1412
+ });
1413
+ Object.defineProperty(__proto, "targetPanel", {
1414
+ /**
1415
+ * A panel to set as {@link Control#activePanel} after the animation is finished
1416
+ * @ko 애니메이션 종료시 {@link Control#activePanel}로 설정할 패널
1417
+ * @type {number}
1418
+ * @readonly
1419
+ */
1420
+ get: function () {
1421
+ return this._targetPanel;
1422
+ },
1423
+ set: function (val) {
1424
+ this._targetPanel = val;
1425
+ },
1426
+ enumerable: false,
1427
+ configurable: true
1428
+ });
1429
+ /**
1430
+ * An callback which is called when state has changed to this state
1431
+ * @ko 현재 상태로 돌입했을때 호출되는 콜백 함수
1432
+ * @param {State} prevState An previous state<ko>이전 상태값</ko>
1433
+ * @return {void}
1434
+ */
1435
+
1436
+ __proto.onEnter = function (prevState) {
1437
+ this._delta = prevState._delta;
1438
+ this._targetPanel = prevState._targetPanel;
1439
+ };
1440
+ /**
1441
+ * An event handler for Axes's {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} event
1442
+ * @ko Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} 이벤트 핸들러
1443
+ * @param {object} [ctx] Event context<ko>이벤트 콘텍스트</ko>
1444
+ * @param {Flicking} [ctx.flicking] An instance of Flicking<ko>Flicking 인스턴스</ko>
1445
+ * @param {object} [ctx.axesEvent] A {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} event of Axes
1446
+ * <ko>Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:hold hold} 이벤트</ko>
1447
+ * @param {function} [ctx.transitTo] A function for changing current state to other state<ko>다른 상태로 변경하기 위한 함수</ko>
1448
+ * @return {void}
1449
+ */
1450
+
1451
+
1452
+ __proto.onHold = function (ctx) {// DO NOTHING
1453
+ };
1454
+ /**
1455
+ * An event handler for Axes's {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} event
1456
+ * @ko Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} 이벤트 핸들러
1457
+ * @param {object} [ctx] Event context<ko>이벤트 콘텍스트</ko>
1458
+ * @param {Flicking} [ctx.flicking] An instance of Flicking<ko>Flicking 인스턴스</ko>
1459
+ * @param {object} [ctx.axesEvent] A {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} event of Axes
1460
+ * <ko>Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:change change} 이벤트</ko>
1461
+ * @param {function} [ctx.transitTo] A function for changing current state to other state<ko>다른 상태로 변경하기 위한 함수</ko>
1462
+ * @return {void}
1463
+ */
1464
+
1465
+
1466
+ __proto.onChange = function (ctx) {// DO NOTHING
1467
+ };
1468
+ /**
1469
+ * An event handler for Axes's {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} event
1470
+ * @ko Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} 이벤트 핸들러
1471
+ * @param {object} [ctx] Event context<ko>이벤트 콘텍스트</ko>
1472
+ * @param {Flicking} [ctx.flicking] An instance of Flicking<ko>Flicking 인스턴스</ko>
1473
+ * @param {object} [ctx.axesEvent] A {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} event of Axes
1474
+ * <ko>Axes의 {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:release release} 이벤트</ko>
1475
+ * @param {function} [ctx.transitTo] A function for changing current state to other state<ko>다른 상태로 변경하기 위한 함수</ko>
1476
+ * @return {void}
1477
+ */
1478
+
1479
+
1480
+ __proto.onRelease = function (ctx) {// DO NOTHING
1002
1481
  };
1003
1482
  /**
1004
1483
  * An event handler for Axes's {@link https://naver.github.io/egjs-axes/release/latest/doc/eg.Axes.html#event:animationEnd animationEnd} event
@@ -1068,7 +1547,9 @@ var State = function () {
1068
1547
  * @internal
1069
1548
  */
1070
1549
 
1071
- var IdleState = function (_super) {
1550
+ var IdleState =
1551
+ /*#__PURE__*/
1552
+ function (_super) {
1072
1553
  __extends(IdleState, _super);
1073
1554
 
1074
1555
  function IdleState() {
@@ -1155,7 +1636,9 @@ var IdleState = function (_super) {
1155
1636
  * @internal
1156
1637
  */
1157
1638
 
1158
- var HoldingState = function (_super) {
1639
+ var HoldingState =
1640
+ /*#__PURE__*/
1641
+ function (_super) {
1159
1642
  __extends(HoldingState, _super);
1160
1643
 
1161
1644
  function HoldingState() {
@@ -1308,7 +1791,9 @@ var HoldingState = function (_super) {
1308
1791
  * @internal
1309
1792
  */
1310
1793
 
1311
- var DraggingState = function (_super) {
1794
+ var DraggingState =
1795
+ /*#__PURE__*/
1796
+ function (_super) {
1312
1797
  __extends(DraggingState, _super);
1313
1798
 
1314
1799
  function DraggingState() {
@@ -1371,7 +1856,9 @@ var DraggingState = function (_super) {
1371
1856
  * @internal
1372
1857
  */
1373
1858
 
1374
- var AnimatingState = function (_super) {
1859
+ var AnimatingState =
1860
+ /*#__PURE__*/
1861
+ function (_super) {
1375
1862
  __extends(AnimatingState, _super);
1376
1863
 
1377
1864
  function AnimatingState() {
@@ -1445,7 +1932,9 @@ var AnimatingState = function (_super) {
1445
1932
  * @internal
1446
1933
  */
1447
1934
 
1448
- var DisabledState = function (_super) {
1935
+ var DisabledState =
1936
+ /*#__PURE__*/
1937
+ function (_super) {
1449
1938
  __extends(DisabledState, _super);
1450
1939
 
1451
1940
  function DisabledState() {
@@ -1501,7 +1990,9 @@ var DisabledState = function (_super) {
1501
1990
  * @internal
1502
1991
  */
1503
1992
 
1504
- var StateMachine = function () {
1993
+ var StateMachine =
1994
+ /*#__PURE__*/
1995
+ function () {
1505
1996
  function StateMachine() {
1506
1997
  var _this = this;
1507
1998
 
@@ -1590,7 +2081,9 @@ var StateMachine = function () {
1590
2081
  * @internal
1591
2082
  */
1592
2083
 
1593
- var AxesController = function () {
2084
+ var AxesController =
2085
+ /*#__PURE__*/
2086
+ function () {
1594
2087
  /** */
1595
2088
  function AxesController() {
1596
2089
  var _this = this;
@@ -1819,11 +2312,15 @@ var AxesController = function () {
1819
2312
 
1820
2313
 
1821
2314
  __proto.destroy = function () {
1822
- var _a, _b;
2315
+ var _a;
2316
+
2317
+ if (this._axes) {
2318
+ this.removePreventClickHandler();
1823
2319
 
1824
- this.removePreventClickHandler();
1825
- (_a = this._axes) === null || _a === void 0 ? void 0 : _a.destroy();
1826
- (_b = this._panInput) === null || _b === void 0 ? void 0 : _b.destroy();
2320
+ this._axes.destroy();
2321
+ }
2322
+
2323
+ (_a = this._panInput) === null || _a === void 0 ? void 0 : _a.destroy();
1827
2324
 
1828
2325
  this._resetInternalValues();
1829
2326
  };
@@ -1869,7 +2366,7 @@ var AxesController = function () {
1869
2366
  __proto.update = function (controlParams) {
1870
2367
  var _a;
1871
2368
 
1872
- var flicking = getFlickingAttached(this._flicking, "Control");
2369
+ var flicking = getFlickingAttached(this._flicking);
1873
2370
  var camera = flicking.camera;
1874
2371
  var axes = this._axes;
1875
2372
  var axis = axes.axis[POSITION_KEY];
@@ -1887,7 +2384,7 @@ var AxesController = function () {
1887
2384
 
1888
2385
 
1889
2386
  __proto.addPreventClickHandler = function () {
1890
- var flicking = getFlickingAttached(this._flicking, "Control");
2387
+ var flicking = getFlickingAttached(this._flicking);
1891
2388
  var axes = this._axes;
1892
2389
  var cameraEl = flicking.camera.element;
1893
2390
  axes.on(EVENT.HOLD, this._onAxesHold);
@@ -1903,7 +2400,7 @@ var AxesController = function () {
1903
2400
 
1904
2401
 
1905
2402
  __proto.removePreventClickHandler = function () {
1906
- var flicking = getFlickingAttached(this._flicking, "Control");
2403
+ var flicking = getFlickingAttached(this._flicking);
1907
2404
  var axes = this._axes;
1908
2405
  var cameraEl = flicking.camera.element;
1909
2406
  axes.off(EVENT.HOLD, this._onAxesHold);
@@ -1939,17 +2436,25 @@ var AxesController = function () {
1939
2436
 
1940
2437
  var _this = this;
1941
2438
 
2439
+ var _b;
2440
+
1942
2441
  var axes = this._axes;
2442
+ var state = this._stateMachine.state;
1943
2443
 
1944
2444
  if (!axes) {
1945
- return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING("Control"), CODE.NOT_ATTACHED_TO_FLICKING));
2445
+ return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING));
1946
2446
  }
1947
2447
 
1948
2448
  var startPos = axes.get([POSITION_KEY])[POSITION_KEY];
1949
2449
 
1950
2450
  if (startPos === position) {
1951
- var flicking = getFlickingAttached(this._flicking, "Control");
2451
+ var flicking = getFlickingAttached(this._flicking);
1952
2452
  flicking.camera.lookAt(position);
2453
+
2454
+ if (state.targetPanel) {
2455
+ flicking.control.setActive(state.targetPanel, flicking.control.activePanel, (_b = axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) !== null && _b !== void 0 ? _b : false);
2456
+ }
2457
+
1953
2458
  return Promise.resolve();
1954
2459
  }
1955
2460
 
@@ -1980,7 +2485,7 @@ var AxesController = function () {
1980
2485
  };
1981
2486
 
1982
2487
  if (duration === 0) {
1983
- var flicking = getFlickingAttached(this._flicking, "Control");
2488
+ var flicking = getFlickingAttached(this._flicking);
1984
2489
  var camera = flicking.camera;
1985
2490
  animate();
1986
2491
  var newPos = flicking.circularEnabled ? circulatePosition(position, camera.range.min, camera.range.max) : position;
@@ -2025,7 +2530,9 @@ var AxesController = function () {
2025
2530
  * @ko Flicking의 입력 장치 & 애니메이션을 담당하는 컴포넌트
2026
2531
  */
2027
2532
 
2028
- var Control = function () {
2533
+ var Control =
2534
+ /*#__PURE__*/
2535
+ function () {
2029
2536
  /** */
2030
2537
  function Control() {
2031
2538
  this._flicking = null;
@@ -2169,7 +2676,7 @@ var Control = function () {
2169
2676
 
2170
2677
 
2171
2678
  __proto.updatePosition = function (_progressInPanel) {
2172
- var flicking = getFlickingAttached(this._flicking, "Control");
2679
+ var flicking = getFlickingAttached(this._flicking);
2173
2680
  var camera = flicking.camera;
2174
2681
  var activePanel = this._activePanel;
2175
2682
 
@@ -2186,7 +2693,7 @@ var Control = function () {
2186
2693
 
2187
2694
 
2188
2695
  __proto.updateInput = function () {
2189
- var flicking = getFlickingAttached(this._flicking, "Control");
2696
+ var flicking = getFlickingAttached(this._flicking);
2190
2697
  var camera = flicking.camera;
2191
2698
 
2192
2699
  this._controller.update(camera.controlParams);
@@ -2253,7 +2760,7 @@ var Control = function () {
2253
2760
  return __awaiter(this, void 0, void 0, function () {
2254
2761
  var flicking, camera, position, nearestAnchor, camPos_1, camRangeDiff, possiblePositions;
2255
2762
  return __generator(this, function (_c) {
2256
- flicking = getFlickingAttached(this._flicking, "Control");
2763
+ flicking = getFlickingAttached(this._flicking);
2257
2764
  camera = flicking.camera;
2258
2765
  position = panel.position;
2259
2766
  nearestAnchor = camera.findNearestAnchor(position);
@@ -2305,7 +2812,7 @@ var Control = function () {
2305
2812
  __proto.setActive = function (newActivePanel, prevActivePanel, isTrusted) {
2306
2813
  var _a;
2307
2814
 
2308
- var flicking = getFlickingAttached(this._flicking, "Control");
2815
+ var flicking = getFlickingAttached(this._flicking);
2309
2816
  this._activePanel = newActivePanel;
2310
2817
  flicking.camera.updateAdaptiveHeight();
2311
2818
 
@@ -2328,7 +2835,7 @@ var Control = function () {
2328
2835
  __proto._triggerIndexChangeEvent = function (panel, position, axesEvent) {
2329
2836
  var _a;
2330
2837
 
2331
- var flicking = getFlickingAttached(this._flicking, "Control");
2838
+ var flicking = getFlickingAttached(this._flicking);
2332
2839
  var triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
2333
2840
  var camera = flicking.camera;
2334
2841
  var activePanel = this._activePanel;
@@ -2356,7 +2863,7 @@ var Control = function () {
2356
2863
  var _this = this;
2357
2864
 
2358
2865
  return __generator(this, function (_b) {
2359
- flicking = getFlickingAttached(this._flicking, "Control");
2866
+ flicking = getFlickingAttached(this._flicking);
2360
2867
 
2361
2868
  animate = function () {
2362
2869
  return _this._controller.animateTo(position, duration, axesEvent);
@@ -2406,7 +2913,9 @@ var Control = function () {
2406
2913
  * A data component that has actual position where the camera should be stopped at
2407
2914
  * @ko 카메라가 정지해야하는 실제 위치를 담고 있는 데이터 컴포넌트
2408
2915
  */
2409
- var AnchorPoint = function () {
2916
+ var AnchorPoint =
2917
+ /*#__PURE__*/
2918
+ function () {
2410
2919
  /**
2411
2920
  * @param {object} options An options object<ko>옵션 객체</ko>
2412
2921
  * @param {number} [options.index] Index of AnchorPoint<ko>AnchorPoint의 인덱스</ko>
@@ -2470,7 +2979,9 @@ var AnchorPoint = function () {
2470
2979
  * @ko 입력을 중단한 시점의 가속도에 영향받아 도달할 패널을 계산하는 이동 방식을 사용하는 {@link Control}
2471
2980
  */
2472
2981
 
2473
- var SnapControl = function (_super) {
2982
+ var SnapControl =
2983
+ /*#__PURE__*/
2984
+ function (_super) {
2474
2985
  __extends(SnapControl, _super);
2475
2986
  /** */
2476
2987
 
@@ -2544,7 +3055,7 @@ var SnapControl = function (_super) {
2544
3055
  return __awaiter(this, void 0, void 0, function () {
2545
3056
  var flicking, camera, activeAnchor, anchorAtCamera, state, snapThreshold, posDelta, absPosDelta, snapDelta, targetAnchor;
2546
3057
  return __generator(this, function (_a) {
2547
- flicking = getFlickingAttached(this._flicking, "Control");
3058
+ flicking = getFlickingAttached(this._flicking);
2548
3059
  camera = flicking.camera;
2549
3060
  activeAnchor = camera.findActiveAnchor();
2550
3061
  anchorAtCamera = camera.findNearestAnchor(camera.position);
@@ -2587,7 +3098,7 @@ var SnapControl = function (_super) {
2587
3098
  };
2588
3099
 
2589
3100
  __proto._findSnappedAnchor = function (position, anchorAtCamera) {
2590
- var flicking = getFlickingAttached(this._flicking, "Control");
3101
+ var flicking = getFlickingAttached(this._flicking);
2591
3102
  var camera = flicking.camera;
2592
3103
  var count = this._count;
2593
3104
  var currentPos = camera.position;
@@ -2647,7 +3158,7 @@ var SnapControl = function (_super) {
2647
3158
  __proto._findAdjacentAnchor = function (posDelta, anchorAtCamera) {
2648
3159
  var _a;
2649
3160
 
2650
- var flicking = getFlickingAttached(this._flicking, "Control");
3161
+ var flicking = getFlickingAttached(this._flicking);
2651
3162
  var camera = flicking.camera;
2652
3163
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
2653
3164
  return adjacentAnchor;
@@ -2676,7 +3187,9 @@ var SnapControl = function (_super) {
2676
3187
  * @ko 패널이 정해진 지점에 정렬되지 않고, 자유롭게 스크롤할 수 있는 이동 방식을 사용하는 {@link Control}
2677
3188
  */
2678
3189
 
2679
- var FreeControl = function (_super) {
3190
+ var FreeControl =
3191
+ /*#__PURE__*/
3192
+ function (_super) {
2680
3193
  __extends(FreeControl, _super);
2681
3194
  /** */
2682
3195
 
@@ -2721,7 +3234,7 @@ var FreeControl = function (_super) {
2721
3234
  */
2722
3235
 
2723
3236
  __proto.updatePosition = function (progressInPanel) {
2724
- var flicking = getFlickingAttached(this._flicking, "Control");
3237
+ var flicking = getFlickingAttached(this._flicking);
2725
3238
  var camera = flicking.camera;
2726
3239
  var activePanel = this._activePanel;
2727
3240
 
@@ -2773,7 +3286,7 @@ var FreeControl = function (_super) {
2773
3286
  return __awaiter(this, void 0, void 0, function () {
2774
3287
  var flicking, camera, targetPos, anchorAtPosition, targetPanel;
2775
3288
  return __generator(this, function (_a) {
2776
- flicking = getFlickingAttached(this._flicking, "Control");
3289
+ flicking = getFlickingAttached(this._flicking);
2777
3290
  camera = flicking.camera;
2778
3291
  targetPos = camera.clampToReachablePosition(position);
2779
3292
  anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
@@ -2810,7 +3323,9 @@ var FreeControl = function (_super) {
2810
3323
  * @ko 한번에 최대로 이동할 패널의 개수를 선택 가능한 {@link Control}
2811
3324
  */
2812
3325
 
2813
- var StrictControl = function (_super) {
3326
+ var StrictControl =
3327
+ /*#__PURE__*/
3328
+ function (_super) {
2814
3329
  __extends(StrictControl, _super);
2815
3330
  /** */
2816
3331
 
@@ -2874,7 +3389,7 @@ var StrictControl = function (_super) {
2874
3389
  __proto.updateInput = function () {
2875
3390
  var _a;
2876
3391
 
2877
- var flicking = getFlickingAttached(this._flicking, "Control");
3392
+ var flicking = getFlickingAttached(this._flicking);
2878
3393
  var camera = flicking.camera;
2879
3394
  var renderer = flicking.renderer;
2880
3395
  var controller = this._controller;
@@ -2983,7 +3498,7 @@ var StrictControl = function (_super) {
2983
3498
  return __awaiter(this, void 0, void 0, function () {
2984
3499
  var flicking, camera, activePanel, axesRange, indexRange, cameraRange, clampedPosition, anchorAtPosition, prevPos, isOverThreshold, adjacentAnchor, targetPos, targetPanel, anchors, firstAnchor, lastAnchor, shouldBounceToFirst, shouldBounceToLast, targetAnchor;
2985
3500
  return __generator(this, function (_a) {
2986
- flicking = getFlickingAttached(this._flicking, "Control");
3501
+ flicking = getFlickingAttached(this._flicking);
2987
3502
  camera = flicking.camera;
2988
3503
  activePanel = this._activePanel;
2989
3504
  axesRange = this._controller.range;
@@ -3054,7 +3569,9 @@ var StrictControl = function (_super) {
3054
3569
  * @ko 뷰포트 내에서의 실제 움직임을 담당하는 컴포넌트
3055
3570
  */
3056
3571
 
3057
- var Camera = function () {
3572
+ var Camera =
3573
+ /*#__PURE__*/
3574
+ function () {
3058
3575
  /** */
3059
3576
  function Camera(_a) {
3060
3577
  var _this = this;
@@ -3110,8 +3627,8 @@ var Camera = function () {
3110
3627
  // Internal states getter
3111
3628
 
3112
3629
  /**
3113
- * The camera(`.flicking-camera`) element
3114
- * @ko 카메라(`.flicking-camera`) 엘리먼트
3630
+ * The camera element(`.flicking-camera`)
3631
+ * @ko 카메라 엘리먼트(`.flicking-camera`)
3115
3632
  * @type {HTMLElement}
3116
3633
  * @readonly
3117
3634
  */
@@ -3121,6 +3638,19 @@ var Camera = function () {
3121
3638
  enumerable: false,
3122
3639
  configurable: true
3123
3640
  });
3641
+ Object.defineProperty(__proto, "children", {
3642
+ /**
3643
+ * An array of the child elements of the camera element(`.flicking-camera`)
3644
+ * @ko 카메라 엘리먼트(`.flicking-camera`)의 자식 엘리먼트 배열
3645
+ * @type {HTMLElement[]}
3646
+ * @readonly
3647
+ */
3648
+ get: function () {
3649
+ return toArray(this._el.children);
3650
+ },
3651
+ enumerable: false,
3652
+ configurable: true
3653
+ });
3124
3654
  Object.defineProperty(__proto, "position", {
3125
3655
  /**
3126
3656
  * Current position of the camera
@@ -3404,7 +3934,7 @@ var Camera = function () {
3404
3934
 
3405
3935
  this._checkReachEnd(prevPos, pos);
3406
3936
 
3407
- this._applyTransform();
3937
+ this.applyTransform();
3408
3938
  };
3409
3939
  /**
3410
3940
  * Return a previous {@link AnchorPoint} of given {@link AnchorPoint}
@@ -3504,7 +4034,7 @@ var Camera = function () {
3504
4034
 
3505
4035
 
3506
4036
  __proto.findActiveAnchor = function () {
3507
- var flicking = getFlickingAttached(this._flicking, "Camera");
4037
+ var flicking = getFlickingAttached(this._flicking);
3508
4038
  var activeIndex = flicking.control.activeIndex;
3509
4039
  return find(this._anchors, function (anchor) {
3510
4040
  return anchor.panel.index === activeIndex;
@@ -3547,7 +4077,7 @@ var Camera = function () {
3547
4077
  __proto.canSee = function (panel) {
3548
4078
  var visibleRange = this.visibleRange; // Should not include margin, as we don't declare what the margin is visible as what the panel is visible.
3549
4079
 
3550
- return panel.includeRange(visibleRange.min, visibleRange.max, false);
4080
+ return panel.isVisibleOnRange(visibleRange.min, visibleRange.max);
3551
4081
  };
3552
4082
  /**
3553
4083
  * Update Camera's {@link Camera#alignPosition alignPosition}
@@ -3575,7 +4105,7 @@ var Camera = function () {
3575
4105
 
3576
4106
 
3577
4107
  __proto.updateAnchors = function () {
3578
- var flicking = getFlickingAttached(this._flicking, "Camera");
4108
+ var flicking = getFlickingAttached(this._flicking);
3579
4109
  var panels = flicking.renderer.panels;
3580
4110
  this._anchors = panels.map(function (panel, index) {
3581
4111
  return new AnchorPoint({
@@ -3598,27 +4128,34 @@ var Camera = function () {
3598
4128
 
3599
4129
 
3600
4130
  __proto.updateAdaptiveHeight = function () {
3601
- var flicking = getFlickingAttached(this._flicking, "Camera");
4131
+ var flicking = getFlickingAttached(this._flicking);
3602
4132
  var activePanel = flicking.control.activePanel;
3603
4133
  if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
3604
4134
  flicking.viewport.setSize({
3605
4135
  height: activePanel.height
3606
4136
  });
3607
4137
  };
4138
+ /**
4139
+ * Update current offset of the camera
4140
+ * @ko 현재 카메라의 오프셋을 업데이트합니다
4141
+ * @chainable
4142
+ * @return {this}
4143
+ */
4144
+
3608
4145
 
3609
4146
  __proto.updateOffset = function () {
3610
- var flicking = getFlickingAttached(this._flicking, "Camera");
4147
+ var flicking = getFlickingAttached(this._flicking);
4148
+ var position = this._position;
3611
4149
  var unRenderedPanels = flicking.panels.filter(function (panel) {
3612
4150
  return !panel.rendered;
3613
4151
  });
3614
- var position = this._position;
3615
4152
  this._offset = unRenderedPanels.filter(function (panel) {
3616
4153
  return panel.position + panel.offset < position;
3617
4154
  }).reduce(function (offset, panel) {
3618
4155
  return offset + panel.sizeIncludingMargin;
3619
4156
  }, 0);
3620
-
3621
- this._applyTransform();
4157
+ this.applyTransform();
4158
+ return this;
3622
4159
  };
3623
4160
  /**
3624
4161
  * Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
@@ -3635,6 +4172,21 @@ var Camera = function () {
3635
4172
  };
3636
4173
  return this;
3637
4174
  };
4175
+ /**
4176
+ * Apply "transform" style with the current position to camera element
4177
+ * @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
4178
+ * @chainable
4179
+ * @return {this}
4180
+ */
4181
+
4182
+
4183
+ __proto.applyTransform = function () {
4184
+ var el = this._el;
4185
+ var flicking = getFlickingAttached(this._flicking);
4186
+ var actualPosition = this._position - this._alignPos - this._offset;
4187
+ el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4188
+ return this;
4189
+ };
3638
4190
 
3639
4191
  __proto._resetInternalValues = function () {
3640
4192
  this._position = 0;
@@ -3655,7 +4207,7 @@ var Camera = function () {
3655
4207
  __proto._refreshVisiblePanels = function () {
3656
4208
  var _this = this;
3657
4209
 
3658
- var flicking = getFlickingAttached(this._flicking, "Camera");
4210
+ var flicking = getFlickingAttached(this._flicking);
3659
4211
  var panels = flicking.renderer.panels;
3660
4212
  var newVisiblePanels = panels.filter(function (panel) {
3661
4213
  return _this.canSee(panel);
@@ -3683,7 +4235,7 @@ var Camera = function () {
3683
4235
  __proto._checkNeedPanel = function () {
3684
4236
  var needPanelTriggered = this._needPanelTriggered;
3685
4237
  if (needPanelTriggered.prev && needPanelTriggered.next) return;
3686
- var flicking = getFlickingAttached(this._flicking, "Camera");
4238
+ var flicking = getFlickingAttached(this._flicking);
3687
4239
  var panels = flicking.renderer.panels;
3688
4240
 
3689
4241
  if (panels.length <= 0) {
@@ -3737,7 +4289,7 @@ var Camera = function () {
3737
4289
  };
3738
4290
 
3739
4291
  __proto._checkReachEnd = function (prevPos, newPos) {
3740
- var flicking = getFlickingAttached(this._flicking, "Camera");
4292
+ var flicking = getFlickingAttached(this._flicking);
3741
4293
  var range = this._range;
3742
4294
  var wasBetweenRange = prevPos > range.min && prevPos < range.max;
3743
4295
  var isBetweenRange = newPos > range.min && newPos < range.max;
@@ -3748,13 +4300,6 @@ var Camera = function () {
3748
4300
  }));
3749
4301
  };
3750
4302
 
3751
- __proto._applyTransform = function () {
3752
- var el = this._el;
3753
- var flicking = getFlickingAttached(this._flicking, "Camera");
3754
- var actualPosition = this._position - this._alignPos - this._offset;
3755
- el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
3756
- };
3757
-
3758
4303
  return Camera;
3759
4304
  }();
3760
4305
 
@@ -3763,7 +4308,9 @@ var Camera = function () {
3763
4308
  * @ko 첫번째 패널의 좌표로부터 마지막 패널의 좌표로까지 이동할 수 있는 종류의 {@link Camera}
3764
4309
  */
3765
4310
 
3766
- var LinearCamera = function (_super) {
4311
+ var LinearCamera =
4312
+ /*#__PURE__*/
4313
+ function (_super) {
3767
4314
  __extends(LinearCamera, _super);
3768
4315
 
3769
4316
  function LinearCamera() {
@@ -3785,7 +4332,7 @@ var LinearCamera = function (_super) {
3785
4332
  __proto.updateRange = function () {
3786
4333
  var _a, _b;
3787
4334
 
3788
- var flicking = getFlickingAttached(this._flicking, "Camera");
4335
+ var flicking = getFlickingAttached(this._flicking);
3789
4336
  var renderer = flicking.renderer;
3790
4337
  var firstPanel = renderer.getPanel(0);
3791
4338
  var lastPanel = renderer.getPanel(renderer.panelCount - 1);
@@ -3804,7 +4351,9 @@ var LinearCamera = function (_super) {
3804
4351
  * @ko 첫번째 패널과 마지막 패널이 이어진 상태로, 무한히 회전할 수 있는 종류의 {@link Camera}
3805
4352
  */
3806
4353
 
3807
- var CircularCamera = function (_super) {
4354
+ var CircularCamera =
4355
+ /*#__PURE__*/
4356
+ function (_super) {
3808
4357
  __extends(CircularCamera, _super);
3809
4358
 
3810
4359
  function CircularCamera() {
@@ -3862,12 +4411,32 @@ var CircularCamera = function (_super) {
3862
4411
  __proto.findAnchorIncludePosition = function (position) {
3863
4412
  if (!this._circularEnabled) return _super.prototype.findAnchorIncludePosition.call(this, position);
3864
4413
  var range = this._range;
4414
+ var anchors = this._anchors;
4415
+ var rangeDiff = this.rangeDiff;
4416
+ var anchorCount = anchors.length;
3865
4417
  var positionInRange = circulatePosition(position, range.min, range.max);
3866
4418
 
3867
4419
  var anchorInRange = _super.prototype.findAnchorIncludePosition.call(this, positionInRange);
3868
4420
 
4421
+ if (anchorCount > 0 && (position === range.min || position === range.max)) {
4422
+ var possibleAnchors = [anchorInRange, new AnchorPoint({
4423
+ index: 0,
4424
+ position: anchors[0].position + rangeDiff,
4425
+ panel: anchors[0].panel
4426
+ }), new AnchorPoint({
4427
+ index: anchorCount - 1,
4428
+ position: anchors[anchorCount - 1].position - rangeDiff,
4429
+ panel: anchors[anchorCount - 1].panel
4430
+ })].filter(function (anchor) {
4431
+ return !!anchor;
4432
+ });
4433
+ anchorInRange = possibleAnchors.reduce(function (nearest, anchor) {
4434
+ if (!nearest) return anchor;
4435
+ return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
4436
+ }, null);
4437
+ }
4438
+
3869
4439
  if (!anchorInRange) return null;
3870
- var rangeDiff = this.rangeDiff;
3871
4440
 
3872
4441
  if (position < range.min) {
3873
4442
  var loopCount = -Math.floor((range.min - position) / rangeDiff) - 1;
@@ -3912,9 +4481,9 @@ var CircularCamera = function (_super) {
3912
4481
 
3913
4482
 
3914
4483
  if (visibleRange.min < range.min) {
3915
- return visibleInCurrentRange || panel.includeRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff, false);
4484
+ return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff);
3916
4485
  } else if (visibleRange.max > range.max) {
3917
- return visibleInCurrentRange || panel.includeRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff, false);
4486
+ return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff);
3918
4487
  }
3919
4488
 
3920
4489
  return visibleInCurrentRange;
@@ -3931,7 +4500,7 @@ var CircularCamera = function (_super) {
3931
4500
 
3932
4501
 
3933
4502
  __proto.updateRange = function () {
3934
- var flicking = getFlickingAttached(this._flicking, "Camera");
4503
+ var flicking = getFlickingAttached(this._flicking);
3935
4504
  var renderer = flicking.renderer;
3936
4505
  var panels = renderer.panels;
3937
4506
 
@@ -3967,13 +4536,20 @@ var CircularCamera = function (_super) {
3967
4536
  };
3968
4537
  }
3969
4538
 
4539
+ this.updateOffset();
4540
+ return this;
4541
+ };
4542
+
4543
+ __proto.updateOffset = function () {
3970
4544
  this._updateCircularOffset();
3971
4545
 
3972
- return this;
4546
+ return _super.prototype.updateOffset.call(this);
3973
4547
  };
3974
4548
 
3975
4549
  __proto.lookAt = function (pos) {
3976
- var flicking = getFlickingAttached(this._flicking, "Camera");
4550
+ var _this = this;
4551
+
4552
+ var flicking = getFlickingAttached(this._flicking);
3977
4553
  var prevPos = this._position;
3978
4554
  if (pos === prevPos) return _super.prototype.lookAt.call(this, pos);
3979
4555
  var panels = flicking.renderer.panels;
@@ -3982,22 +4558,23 @@ var CircularCamera = function (_super) {
3982
4558
  });
3983
4559
  this._position = pos;
3984
4560
 
4561
+ _super.prototype.lookAt.call(this, pos);
4562
+
3985
4563
  if (toggled.some(function (isToggled) {
3986
4564
  return isToggled;
3987
4565
  })) {
3988
- this._updateCircularOffset();
3989
-
3990
- void flicking.renderer.render();
4566
+ void flicking.renderer.render().then(function () {
4567
+ _this.updateOffset();
4568
+ });
3991
4569
  }
3992
-
3993
- return _super.prototype.lookAt.call(this, pos);
3994
4570
  };
3995
4571
 
3996
- __proto._applyTransform = function () {
4572
+ __proto.applyTransform = function () {
3997
4573
  var el = this._el;
3998
- var flicking = getFlickingAttached(this._flicking, "Camera");
4574
+ var flicking = getFlickingAttached(this._flicking);
3999
4575
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
4000
4576
  el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4577
+ return this;
4001
4578
  };
4002
4579
 
4003
4580
  __proto._resetInternalValues = function () {
@@ -4019,17 +4596,15 @@ var CircularCamera = function (_super) {
4019
4596
  return;
4020
4597
  }
4021
4598
 
4022
- var flicking = getFlickingAttached(this._flicking, "Camera");
4023
- var toggledPrev = [];
4024
- var toggledNext = [];
4025
- flicking.panels.filter(function (panel) {
4599
+ var flicking = getFlickingAttached(this._flicking);
4600
+ var toggled = flicking.panels.filter(function (panel) {
4026
4601
  return panel.toggled;
4027
- }).forEach(function (panel) {
4028
- if (panel.toggleDirection === DIRECTION.PREV) {
4029
- toggledPrev.push(panel);
4030
- } else {
4031
- toggledNext.push(panel);
4032
- }
4602
+ });
4603
+ var toggledPrev = toggled.filter(function (panel) {
4604
+ return panel.toggleDirection === DIRECTION.PREV;
4605
+ });
4606
+ var toggledNext = toggled.filter(function (panel) {
4607
+ return panel.toggleDirection === DIRECTION.NEXT;
4033
4608
  });
4034
4609
  this._circularOffset = this._calcPanelAreaSum(toggledPrev) - this._calcPanelAreaSum(toggledNext);
4035
4610
  };
@@ -4042,7 +4617,9 @@ var CircularCamera = function (_super) {
4042
4617
  * @ko 첫번째와 마지막 패널 밖으로 넘어가지 못하도록 범위를 설정하여, 첫번째/마지막 패널 전/후의 빈 공간을 보이지 않도록 하는 종류의 {@link Camera}
4043
4618
  */
4044
4619
 
4045
- var BoundCamera = function (_super) {
4620
+ var BoundCamera =
4621
+ /*#__PURE__*/
4622
+ function (_super) {
4046
4623
  __extends(BoundCamera, _super);
4047
4624
 
4048
4625
  function BoundCamera() {
@@ -4062,7 +4639,7 @@ var BoundCamera = function (_super) {
4062
4639
  var __proto = BoundCamera.prototype;
4063
4640
 
4064
4641
  __proto.updateRange = function () {
4065
- var flicking = getFlickingAttached(this._flicking, "Camera");
4642
+ var flicking = getFlickingAttached(this._flicking);
4066
4643
  var renderer = flicking.renderer;
4067
4644
  var alignPos = this._alignPos;
4068
4645
  var firstPanel = renderer.getPanel(0);
@@ -4105,7 +4682,7 @@ var BoundCamera = function (_super) {
4105
4682
  __proto.updateAnchors = function () {
4106
4683
  var _this = this;
4107
4684
 
4108
- var flicking = getFlickingAttached(this._flicking, "Camera");
4685
+ var flicking = getFlickingAttached(this._flicking);
4109
4686
  var panels = flicking.renderer.panels;
4110
4687
 
4111
4688
  if (panels.length <= 0) {
@@ -4214,20 +4791,23 @@ var BoundCamera = function (_super) {
4214
4791
  * @ko {@link Panel}과 그 엘리먼트들을 관리하는 컴포넌트
4215
4792
  */
4216
4793
 
4217
- var Renderer = function () {
4794
+ var Renderer =
4795
+ /*#__PURE__*/
4796
+ function () {
4218
4797
  /**
4219
4798
  * @param {object} options An options object<ko>옵션 오브젝트</ko>
4220
- * @param {Constants.ALIGN | string | number} [options.align] An {@link Flicking#align align} value that will be applied to all panels<ko>전체 패널에 적용될 {@link Flicking#align align} 값</ko>
4799
+ * @param {Constants.ALIGN | string | number} [options.align="center"] An {@link Flicking#align align} value that will be applied to all panels<ko>전체 패널에 적용될 {@link Flicking#align align} 값</ko>
4800
+ * @param {object} [options.strategy] An instance of RenderingStrategy(internal module)<ko>RenderingStrategy의 인스턴스(내부 모듈)</ko>
4221
4801
  */
4222
4802
  function Renderer(_a) {
4223
- var _b = _a === void 0 ? {} : _a,
4224
- _c = _b.align,
4225
- align = _c === void 0 ? ALIGN.CENTER : _c;
4226
-
4803
+ var _b = _a.align,
4804
+ align = _b === void 0 ? ALIGN.CENTER : _b,
4805
+ strategy = _a.strategy;
4227
4806
  this._flicking = null;
4228
4807
  this._panels = []; // Bind options
4229
4808
 
4230
4809
  this._align = align;
4810
+ this._strategy = strategy;
4231
4811
  }
4232
4812
 
4233
4813
  var __proto = Renderer.prototype;
@@ -4260,6 +4840,16 @@ var Renderer = function () {
4260
4840
  enumerable: false,
4261
4841
  configurable: true
4262
4842
  });
4843
+ Object.defineProperty(__proto, "strategy", {
4844
+ /**
4845
+ * @internal
4846
+ */
4847
+ get: function () {
4848
+ return this._strategy;
4849
+ },
4850
+ enumerable: false,
4851
+ configurable: true
4852
+ });
4263
4853
  Object.defineProperty(__proto, "align", {
4264
4854
  // Options Getter
4265
4855
 
@@ -4274,8 +4864,7 @@ var Renderer = function () {
4274
4864
  // Options Setter
4275
4865
  set: function (val) {
4276
4866
  this._align = val;
4277
-
4278
- var panelAlign = this._getPanelAlign();
4867
+ var panelAlign = parsePanelAlign(val);
4279
4868
 
4280
4869
  this._panels.forEach(function (panel) {
4281
4870
  panel.align = panelAlign;
@@ -4321,6 +4910,14 @@ var Renderer = function () {
4321
4910
  __proto.getPanel = function (index) {
4322
4911
  return this._panels[index] || null;
4323
4912
  };
4913
+
4914
+ __proto.forceRenderAllPanels = function () {
4915
+ this._panels.forEach(function (panel) {
4916
+ return panel.markForShow();
4917
+ });
4918
+
4919
+ return Promise.resolve();
4920
+ };
4324
4921
  /**
4325
4922
  * Update all panel sizes
4326
4923
  * @ko 모든 패널의 크기를 업데이트합니다
@@ -4330,10 +4927,15 @@ var Renderer = function () {
4330
4927
 
4331
4928
 
4332
4929
  __proto.updatePanelSize = function () {
4333
- var flicking = getFlickingAttached(this._flicking, "Renderer");
4930
+ var flicking = getFlickingAttached(this._flicking);
4931
+ var panels = this._panels;
4932
+ if (panels.length <= 0) return this;
4334
4933
 
4335
4934
  if (flicking.panelsPerView > 0) {
4336
- this._updatePanelSizeByGrid(flicking);
4935
+ var firstPanel = panels[0];
4936
+ firstPanel.resize();
4937
+
4938
+ this._updatePanelSizeByGrid(firstPanel, panels);
4337
4939
  } else {
4338
4940
  flicking.panels.forEach(function (panel) {
4339
4941
  return panel.resize();
@@ -4347,8 +4949,10 @@ var Renderer = function () {
4347
4949
  * This will increase index of panels after by the number of panels added
4348
4950
  * @ko 주어진 인덱스에 새로운 패널들을 추가합니다
4349
4951
  * 해당 인덱스보다 같거나 큰 인덱스를 가진 기존 패널들은 추가한 패널의 개수만큼 인덱스가 증가합니다.
4350
- * @param {number} index Index to insert new panels at<ko>새로 패널들을 추가할 인덱스</ko>
4351
- * @param {any[]} elements An array of element or framework component with element in it<ko>엘리먼트의 배열 혹은 프레임워크에서 엘리먼트를 포함한 컴포넌트들의 배열</ko>
4952
+ * @param {Array<object>} items An array of items to insert<ko>추가할 아이템들의 배열</ko>
4953
+ * @param {number} [items.index] Index to insert new panels at<ko>새로 패널들을 추가할 인덱스</ko>
4954
+ * @param {any[]} [items.elements] An array of element or framework component with element in it<ko>엘리먼트의 배열 혹은 프레임워크에서 엘리먼트를 포함한 컴포넌트들의 배열</ko>
4955
+ * @param {boolean} [items.hasDOMInElements] Whether it contains actual DOM elements. If set to true, renderer will add them to the camera element<ko>내부에 실제 DOM 엘리먼트들을 포함하고 있는지 여부. true로 설정할 경우, 렌더러는 해당 엘리먼트들을 카메라 엘리먼트 내부에 추가합니다</ko>
4352
4956
  * @return {Panel[]} An array of prepended panels<ko>추가된 패널들의 배열</ko>
4353
4957
  */
4354
4958
 
@@ -4363,11 +4967,10 @@ var Renderer = function () {
4363
4967
  }
4364
4968
 
4365
4969
  var panels = this._panels;
4366
- var flicking = getFlickingAttached(this._flicking, "Renderer");
4970
+ var flicking = getFlickingAttached(this._flicking);
4367
4971
  var control = flicking.control;
4368
-
4369
- var align = this._getPanelAlign();
4370
-
4972
+ var prevFirstPanel = panels[0];
4973
+ var align = parsePanelAlign(this._align);
4371
4974
  var allPanelsInserted = items.reduce(function (addedPanels, item) {
4372
4975
  var _a;
4373
4976
 
@@ -4380,23 +4983,30 @@ var Renderer = function () {
4380
4983
  flicking: flicking
4381
4984
  });
4382
4985
  });
4383
- panels.splice.apply(panels, __spreadArray([insertingIdx, 0], __read(panelsInserted))); // Insert the actual elements as camera element's children
4986
+ panels.splice.apply(panels, __spreadArray([insertingIdx, 0], __read(panelsInserted)));
4384
4987
 
4385
- _this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) !== null && _a !== void 0 ? _a : null); // Resize the newly added panels
4988
+ if (item.hasDOMInElements) {
4989
+ // Insert the actual elements as camera element's children
4990
+ _this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) !== null && _a !== void 0 ? _a : null);
4991
+ } // Resize the newly added panels
4386
4992
 
4387
4993
 
4388
- panelsInserted.forEach(function (panel) {
4389
- return panel.resize();
4390
- });
4994
+ if (flicking.panelsPerView > 0) {
4995
+ var firstPanel = prevFirstPanel || panelsInserted[0].resize();
4391
4996
 
4392
- var insertedSize = _this._getPanelSizeSum(panelsInserted); // Update panel indexes & positions
4997
+ _this._updatePanelSizeByGrid(firstPanel, panelsInserted);
4998
+ } else {
4999
+ panelsInserted.forEach(function (panel) {
5000
+ return panel.resize();
5001
+ });
5002
+ } // Update panel indexes & positions
4393
5003
 
4394
5004
 
4395
5005
  panelsPushed.forEach(function (panel) {
4396
5006
  panel.increaseIndex(panelsInserted.length);
4397
- panel.increasePosition(insertedSize);
5007
+ panel.updatePosition();
4398
5008
  });
4399
- return __spreadArray(__spreadArray([], __read(addedPanels)), __read(panelsInserted));
5009
+ return __spreadArray(__spreadArray([], __read(addedPanels), false), __read(panelsInserted));
4400
5010
  }, []);
4401
5011
  if (allPanelsInserted.length <= 0) return []; // Update camera & control
4402
5012
 
@@ -4418,6 +5028,7 @@ var Renderer = function () {
4418
5028
  added: allPanelsInserted,
4419
5029
  removed: []
4420
5030
  }));
5031
+ this.checkPanelContentsReady(allPanelsInserted);
4421
5032
  return allPanelsInserted;
4422
5033
  };
4423
5034
  /**
@@ -4425,8 +5036,10 @@ var Renderer = function () {
4425
5036
  * This will decrease index of panels after by the number of panels removed
4426
5037
  * @ko 주어진 인덱스의 패널을 제거합니다
4427
5038
  * 해당 인덱스보다 큰 인덱스를 가진 기존 패널들은 제거한 패널의 개수만큼 인덱스가 감소합니다
4428
- * @param {number} index Index of panel to remove<ko>제거할 패널의 인덱스</ko>
4429
- * @param {number} [deleteCount=1] Number of panels to remove from index<ko>`index` 이후로 제거할 패널의 개수</ko>
5039
+ * @param {Array<object>} items An array of items to remove<ko>제거할 아이템들의 배열</ko>
5040
+ * @param {number} [items.index] Index of panel to remove<ko>제거할 패널의 인덱스</ko>
5041
+ * @param {number} [items.deleteCount=1] Number of panels to remove from index<ko>`index` 이후로 제거할 패널의 개수</ko>
5042
+ * @param {boolean} [items.hasDOMInElements=1] Whether it contains actual DOM elements. If set to true, renderer will remove them from the camera element<ko>내부에 실제 DOM 엘리먼트들을 포함하고 있는지 여부. true로 설정할 경우, 렌더러는 해당 엘리먼트들을 카메라 엘리먼트 내부에서 제거합니다</ko>
4430
5043
  * @return An array of removed panels<ko>제거된 패널들의 배열</ko>
4431
5044
  */
4432
5045
 
@@ -4441,7 +5054,7 @@ var Renderer = function () {
4441
5054
  }
4442
5055
 
4443
5056
  var panels = this._panels;
4444
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5057
+ var flicking = getFlickingAttached(this._flicking);
4445
5058
  var camera = flicking.camera,
4446
5059
  control = flicking.control;
4447
5060
  var activePanel = control.activePanel;
@@ -4454,28 +5067,29 @@ var Renderer = function () {
4454
5067
  var panelsRemoved = panels.splice(removingIdx, deleteCount);
4455
5068
  if (panelsRemoved.length <= 0) return []; // Update panel indexes & positions
4456
5069
 
4457
- var removedSize = _this._getPanelSizeSum(panelsRemoved);
4458
-
4459
5070
  panelsPulled.forEach(function (panel) {
4460
5071
  panel.decreaseIndex(panelsRemoved.length);
4461
- panel.decreasePosition(removedSize);
5072
+ panel.updatePosition();
4462
5073
  });
4463
5074
 
4464
- _this._removePanelElements(panelsRemoved); // Remove panel elements
5075
+ if (item.hasDOMInElements) {
5076
+ _this._removePanelElements(panelsRemoved);
5077
+ } // Remove panel elements
4465
5078
 
4466
5079
 
4467
5080
  panelsRemoved.forEach(function (panel) {
4468
5081
  return panel.destroy();
4469
- }); // Update camera & control
4470
-
4471
- _this._updateCameraAndControl();
5082
+ });
4472
5083
 
4473
5084
  if (includes(panelsRemoved, activePanel)) {
4474
5085
  control.resetActive();
4475
5086
  }
4476
5087
 
4477
- return __spreadArray(__spreadArray([], __read(removed)), __read(panelsRemoved));
4478
- }, []);
5088
+ return __spreadArray(__spreadArray([], __read(removed), false), __read(panelsRemoved));
5089
+ }, []); // Update camera & control
5090
+
5091
+ this._updateCameraAndControl();
5092
+
4479
5093
  void this.render(); // FIXME: fix for animating case
4480
5094
 
4481
5095
  if (allPanelsRemoved.length > 0 && !control.animating) {
@@ -4500,21 +5114,79 @@ var Renderer = function () {
4500
5114
  }));
4501
5115
  return allPanelsRemoved;
4502
5116
  };
5117
+ /**
5118
+ * @internal
5119
+ */
4503
5120
 
4504
- __proto._getPanelAlign = function () {
4505
- var align = this._align;
4506
- return typeof align === "object" ? align.panel : align;
4507
- };
4508
5121
 
4509
- __proto._getPanelSizeSum = function (panels) {
4510
- var firstPanel = panels[0];
4511
- var lastPanel = panels[panels.length - 1];
4512
- var marginDiff = lastPanel.margin.next - firstPanel.margin.prev;
4513
- return lastPanel.range.max - firstPanel.range.min + marginDiff;
5122
+ __proto.checkPanelContentsReady = function (checkingPanels) {
5123
+ var _this = this;
5124
+
5125
+ var flicking = getFlickingAttached(this._flicking);
5126
+ var resizeOnContentsReady = flicking.resizeOnContentsReady;
5127
+ var panels = this._panels;
5128
+ if (!resizeOnContentsReady || flicking.virtualEnabled) return;
5129
+
5130
+ var hasContents = function (panel) {
5131
+ return !!panel.element.querySelector("img, video");
5132
+ };
5133
+
5134
+ checkingPanels = checkingPanels.filter(function (panel) {
5135
+ return hasContents(panel);
5136
+ });
5137
+ if (checkingPanels.length <= 0) return;
5138
+ var contentsReadyChecker = new ImReady();
5139
+ checkingPanels.forEach(function (panel) {
5140
+ panel.loading = true;
5141
+ });
5142
+ contentsReadyChecker.on("readyElement", function (e) {
5143
+ if (!_this._flicking) {
5144
+ // Renderer's destroy() is called before
5145
+ contentsReadyChecker.destroy();
5146
+ return;
5147
+ }
5148
+
5149
+ var panel = checkingPanels[e.index];
5150
+ var camera = flicking.camera;
5151
+ var control = flicking.control;
5152
+ var prevProgressInPanel = control.activePanel ? camera.getProgressInPanel(control.activePanel) : 0;
5153
+ panel.loading = false;
5154
+ panel.resize();
5155
+ panels.slice(panel.index + 1).forEach(function (panelBehind) {
5156
+ return panelBehind.updatePosition();
5157
+ });
5158
+ if (!flicking.initialized) return;
5159
+ camera.updateRange();
5160
+ camera.updateAnchors();
5161
+
5162
+ if (control.animating) ; else {
5163
+ control.updatePosition(prevProgressInPanel);
5164
+ control.updateInput();
5165
+ }
5166
+ });
5167
+ contentsReadyChecker.on("preReady", function (e) {
5168
+ if (_this._flicking) {
5169
+ void _this.render();
5170
+ }
5171
+
5172
+ if (e.readyCount === e.totalCount) {
5173
+ contentsReadyChecker.destroy();
5174
+ }
5175
+ });
5176
+ contentsReadyChecker.on("ready", function () {
5177
+ if (_this._flicking) {
5178
+ void _this.render();
5179
+ }
5180
+
5181
+ contentsReadyChecker.destroy();
5182
+ });
5183
+ contentsReadyChecker.check(checkingPanels.map(function (panel) {
5184
+ return panel.element;
5185
+ }));
4514
5186
  };
4515
5187
 
4516
5188
  __proto._updateCameraAndControl = function () {
4517
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5189
+ var flicking = getFlickingAttached(this._flicking);
4518
5190
  var camera = flicking.camera,
4519
5191
  control = flicking.control;
4520
5192
  camera.updateRange();
@@ -4523,18 +5195,6 @@ var Renderer = function () {
4523
5195
  control.updateInput();
4524
5196
  };
4525
5197
 
4526
- __proto._updateRenderingPanels = function () {
4527
- var flicking = getFlickingAttached(this._flicking, "Renderer");
4528
-
4529
- if (flicking.renderOnlyVisible) {
4530
- this._showOnlyVisiblePanels(flicking);
4531
- } else {
4532
- flicking.panels.forEach(function (panel) {
4533
- return panel.markForShow();
4534
- });
4535
- }
4536
- };
4537
-
4538
5198
  __proto._showOnlyVisiblePanels = function (flicking) {
4539
5199
  var panels = flicking.renderer.panels;
4540
5200
  var camera = flicking.camera;
@@ -4543,7 +5203,7 @@ var Renderer = function () {
4543
5203
  return visibles;
4544
5204
  }, {});
4545
5205
  panels.forEach(function (panel) {
4546
- if (panel.index in visibleIndexes) {
5206
+ if (panel.index in visibleIndexes || panel.loading) {
4547
5207
  panel.markForShow();
4548
5208
  } else if (!flicking.holding) {
4549
5209
  // During the input sequence,
@@ -4551,23 +5211,19 @@ var Renderer = function () {
4551
5211
  panel.markForHide();
4552
5212
  }
4553
5213
  });
4554
- camera.updateOffset();
4555
5214
  };
4556
5215
 
4557
- __proto._updatePanelSizeByGrid = function (flicking) {
4558
- var panels = flicking.panels;
5216
+ __proto._updatePanelSizeByGrid = function (referencePanel, panels) {
5217
+ var flicking = getFlickingAttached(this._flicking);
4559
5218
  var panelsPerView = flicking.panelsPerView;
4560
5219
 
4561
5220
  if (panelsPerView <= 0) {
4562
5221
  throw new FlickingError(MESSAGE.WRONG_OPTION("panelsPerView", panelsPerView), CODE.WRONG_OPTION);
4563
5222
  }
4564
5223
 
4565
- if (panels.length <= 0) return; // resize only the first panel
4566
-
4567
- var firstPanel = panels[0];
4568
- firstPanel.resize();
5224
+ if (panels.length <= 0) return;
4569
5225
  var viewportSize = flicking.camera.size;
4570
- var gap = firstPanel.margin.prev + firstPanel.margin.next;
5226
+ var gap = referencePanel.margin.prev + referencePanel.margin.next;
4571
5227
  var panelSize = (viewportSize - gap * (panelsPerView - 1)) / panelsPerView;
4572
5228
  var panelSizeObj = flicking.horizontal ? {
4573
5229
  width: panelSize
@@ -4576,14 +5232,12 @@ var Renderer = function () {
4576
5232
  };
4577
5233
  var firstPanelSizeObj = {
4578
5234
  size: panelSize,
4579
- height: firstPanel.height,
4580
- margin: firstPanel.margin
5235
+ height: referencePanel.height,
5236
+ margin: referencePanel.margin
4581
5237
  };
4582
5238
 
4583
5239
  if (!flicking.noPanelStyleOverride) {
4584
- flicking.panels.forEach(function (panel) {
4585
- return panel.setSize(panelSizeObj);
4586
- });
5240
+ this._strategy.updatePanelSizes(flicking, panelSizeObj);
4587
5241
  }
4588
5242
 
4589
5243
  flicking.panels.forEach(function (panel) {
@@ -4591,29 +5245,202 @@ var Renderer = function () {
4591
5245
  });
4592
5246
  };
4593
5247
 
5248
+ __proto._removeAllChildsFromCamera = function () {
5249
+ var flicking = getFlickingAttached(this._flicking);
5250
+ var cameraElement = flicking.camera.element; // Remove other elements
5251
+
5252
+ while (cameraElement.firstChild) {
5253
+ cameraElement.removeChild(cameraElement.firstChild);
5254
+ }
5255
+ };
5256
+
5257
+ __proto._insertPanelElements = function (panels, nextSibling) {
5258
+ if (nextSibling === void 0) {
5259
+ nextSibling = null;
5260
+ }
5261
+
5262
+ var flicking = getFlickingAttached(this._flicking);
5263
+ var camera = flicking.camera;
5264
+ var cameraElement = camera.element;
5265
+ var nextSiblingElement = (nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.element) || null;
5266
+ var fragment = document.createDocumentFragment();
5267
+ panels.forEach(function (panel) {
5268
+ return fragment.appendChild(panel.element);
5269
+ });
5270
+ cameraElement.insertBefore(fragment, nextSiblingElement);
5271
+ };
5272
+
5273
+ __proto._removePanelElements = function (panels) {
5274
+ var flicking = getFlickingAttached(this._flicking);
5275
+ var cameraElement = flicking.camera.element;
5276
+ panels.forEach(function (panel) {
5277
+ cameraElement.removeChild(panel.element);
5278
+ });
5279
+ };
5280
+
4594
5281
  return Renderer;
4595
5282
  }();
4596
5283
 
4597
- var Panel = function () {
5284
+ /**
5285
+ *
5286
+ */
5287
+
5288
+ var VanillaRenderer =
5289
+ /*#__PURE__*/
5290
+ function (_super) {
5291
+ __extends(VanillaRenderer, _super);
5292
+
5293
+ function VanillaRenderer() {
5294
+ return _super !== null && _super.apply(this, arguments) || this;
5295
+ } // eslint-disable-next-line @typescript-eslint/require-await
5296
+
5297
+
5298
+ var __proto = VanillaRenderer.prototype;
5299
+
5300
+ __proto.render = function () {
5301
+ return __awaiter(this, void 0, void 0, function () {
5302
+ var flicking, strategy;
5303
+ return __generator(this, function (_a) {
5304
+ flicking = getFlickingAttached(this._flicking);
5305
+ strategy = this._strategy;
5306
+ strategy.updateRenderingPanels(flicking);
5307
+ strategy.renderPanels(flicking);
5308
+
5309
+ this._resetPanelElementOrder();
5310
+
5311
+ return [2
5312
+ /*return*/
5313
+ ];
5314
+ });
5315
+ });
5316
+ };
5317
+
5318
+ __proto._collectPanels = function () {
5319
+ var flicking = getFlickingAttached(this._flicking);
5320
+ var camera = flicking.camera;
5321
+
5322
+ this._removeAllTextNodes();
5323
+
5324
+ this._panels = this._strategy.collectPanels(flicking, camera.children);
5325
+ };
5326
+
5327
+ __proto._createPanel = function (el, options) {
5328
+ return this._strategy.createPanel(el, options);
5329
+ };
5330
+
5331
+ __proto._resetPanelElementOrder = function () {
5332
+ var flicking = getFlickingAttached(this._flicking);
5333
+ var cameraEl = flicking.camera.element; // We're using reversed panels here as last panel should be the last element of camera element
5334
+
5335
+ var reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
5336
+
5337
+ reversedElements.forEach(function (el, idx) {
5338
+ var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
5339
+
5340
+ if (el.nextElementSibling !== nextEl) {
5341
+ cameraEl.insertBefore(el, nextEl);
5342
+ }
5343
+ });
5344
+ };
5345
+
5346
+ __proto._removeAllTextNodes = function () {
5347
+ var flicking = getFlickingAttached(this._flicking);
5348
+ var cameraElement = flicking.camera.element; // Remove all text nodes in the camera element
5349
+
5350
+ toArray(cameraElement.childNodes).forEach(function (node) {
5351
+ if (node.nodeType === Node.TEXT_NODE) {
5352
+ cameraElement.removeChild(node);
5353
+ }
5354
+ });
5355
+ };
5356
+
5357
+ return VanillaRenderer;
5358
+ }(Renderer);
5359
+
5360
+ /**
5361
+ * @internal
5362
+ */
5363
+
5364
+ var ExternalRenderer =
5365
+ /*#__PURE__*/
5366
+ function (_super) {
5367
+ __extends(ExternalRenderer, _super);
5368
+
5369
+ function ExternalRenderer() {
5370
+ return _super !== null && _super.apply(this, arguments) || this;
5371
+ }
5372
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5373
+
5374
+
5375
+ var __proto = ExternalRenderer.prototype;
5376
+
5377
+ __proto._removePanelElements = function (panels) {// DO NOTHING, overrided to prevent an unexpected error
5378
+ };
5379
+
5380
+ __proto._removeAllChildsFromCamera = function () {// DO NOTHING, overrided to prevent an unexpected error
5381
+ };
5382
+
5383
+ return ExternalRenderer;
5384
+ }(Renderer);
5385
+
5386
+ /**
5387
+ * A slide data component that holds information of a single HTMLElement
5388
+ * @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
5389
+ */
5390
+
5391
+ var Panel =
5392
+ /*#__PURE__*/
5393
+ function () {
4598
5394
  /**
4599
5395
  * @param {object} options An options object<ko>옵션 오브젝트</ko>
4600
5396
  * @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
4601
5397
  * @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
4602
5398
  * @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
5399
+ * @param {Flicking} [options.elementProvider] A provider instance that redirects elements<ko>실제 엘리먼트를 반환하는 엘리먼트 공급자의 인스턴스</ko>
4603
5400
  */
4604
5401
  function Panel(_a) {
4605
5402
  var index = _a.index,
4606
5403
  align = _a.align,
4607
- flicking = _a.flicking;
5404
+ flicking = _a.flicking,
5405
+ elementProvider = _a.elementProvider;
4608
5406
  this._index = index;
4609
5407
  this._flicking = flicking;
5408
+ this._elProvider = elementProvider;
4610
5409
  this._align = align;
4611
5410
  this._removed = false;
5411
+ this._rendered = true;
5412
+ this._loading = false;
4612
5413
 
4613
5414
  this._resetInternalStates();
4614
5415
  }
4615
5416
 
4616
5417
  var __proto = Panel.prototype;
5418
+ Object.defineProperty(__proto, "element", {
5419
+ // Internal States Getter
5420
+
5421
+ /**
5422
+ * `HTMLElement` that panel's referencing
5423
+ * @ko 패널이 참조하고 있는 `HTMLElement`
5424
+ * @type {HTMLElement}
5425
+ * @readonly
5426
+ */
5427
+ get: function () {
5428
+ return this._elProvider.element;
5429
+ },
5430
+ enumerable: false,
5431
+ configurable: true
5432
+ });
5433
+ Object.defineProperty(__proto, "elementProvider", {
5434
+ /**
5435
+ * @internal
5436
+ * @readonly
5437
+ */
5438
+ get: function () {
5439
+ return this._elProvider;
5440
+ },
5441
+ enumerable: false,
5442
+ configurable: true
5443
+ });
4617
5444
  Object.defineProperty(__proto, "index", {
4618
5445
  /**
4619
5446
  * Index of the panel
@@ -4726,6 +5553,35 @@ var Panel = function () {
4726
5553
  enumerable: false,
4727
5554
  configurable: true
4728
5555
  });
5556
+ Object.defineProperty(__proto, "rendered", {
5557
+ /**
5558
+ * A value indicating whether the panel's element is being rendered on the screen
5559
+ * @ko 패널의 엘리먼트가 화면상에 렌더링되고있는지 여부를 나타내는 값
5560
+ * @type {boolean}
5561
+ * @readonly
5562
+ */
5563
+ get: function () {
5564
+ return this._rendered;
5565
+ },
5566
+ enumerable: false,
5567
+ configurable: true
5568
+ });
5569
+ Object.defineProperty(__proto, "loading", {
5570
+ /**
5571
+ * A value indicating whether the panel's image/video is not loaded and waiting for resize
5572
+ * @ko 패널 내부의 이미지/비디오가 아직 로드되지 않아 {@link Panel#resize resize}될 것인지를 나타내는 값
5573
+ * @type {boolean}
5574
+ * @readonly
5575
+ */
5576
+ get: function () {
5577
+ return this._loading;
5578
+ },
5579
+ set: function (val) {
5580
+ this._loading = val;
5581
+ },
5582
+ enumerable: false,
5583
+ configurable: true
5584
+ });
4729
5585
  Object.defineProperty(__proto, "range", {
4730
5586
  /**
4731
5587
  * Panel element's range of the bounding box
@@ -4874,13 +5730,34 @@ var Panel = function () {
4874
5730
  get: function () {
4875
5731
  return this._align;
4876
5732
  },
4877
- // Options Getter
5733
+ // Options Setter
4878
5734
  set: function (val) {
4879
5735
  this._align = val;
4880
5736
  },
4881
5737
  enumerable: false,
4882
5738
  configurable: true
4883
5739
  });
5740
+ /**
5741
+ * Mark panel element to be appended on the camera element
5742
+ * @internal
5743
+ */
5744
+
5745
+ __proto.markForShow = function () {
5746
+ this._rendered = true;
5747
+
5748
+ this._elProvider.show(this._flicking);
5749
+ };
5750
+ /**
5751
+ * Mark panel element to be removed from the camera element
5752
+ * @internal
5753
+ */
5754
+
5755
+
5756
+ __proto.markForHide = function () {
5757
+ this._rendered = false;
5758
+
5759
+ this._elProvider.hide(this._flicking);
5760
+ };
4884
5761
  /**
4885
5762
  * Update size of the panel
4886
5763
  * @ko 패널의 크기를 갱신합니다
@@ -4889,18 +5766,18 @@ var Panel = function () {
4889
5766
  * @return {this}
4890
5767
  */
4891
5768
 
5769
+
4892
5770
  __proto.resize = function (cached) {
4893
5771
  var el = this.element;
4894
- var elStyle = getStyle(el);
4895
5772
  var flicking = this._flicking;
4896
5773
  var horizontal = flicking.horizontal;
4897
- var prevPanel = flicking.renderer.panels[this._index - 1];
4898
5774
 
4899
5775
  if (cached) {
4900
5776
  this._size = cached.size;
4901
5777
  this._margin = __assign({}, cached.margin);
4902
5778
  this._height = cached.height;
4903
5779
  } else {
5780
+ var elStyle = getStyle(el);
4904
5781
  this._size = horizontal ? el.offsetWidth : el.offsetHeight;
4905
5782
  this._margin = horizontal ? {
4906
5783
  prev: parseFloat(elStyle.marginLeft || "0"),
@@ -4912,7 +5789,7 @@ var Panel = function () {
4912
5789
  this._height = horizontal ? el.offsetHeight : this._size;
4913
5790
  }
4914
5791
 
4915
- this._pos = prevPanel ? prevPanel.range.max + prevPanel.margin.next + this._margin.prev : this._margin.prev;
5792
+ this.updatePosition();
4916
5793
 
4917
5794
  this._updateAlignPos();
4918
5795
 
@@ -4929,27 +5806,8 @@ var Panel = function () {
4929
5806
  */
4930
5807
 
4931
5808
 
4932
- __proto.setSize = function (_a) {
4933
- var width = _a.width,
4934
- height = _a.height;
4935
- var el = this.element;
4936
-
4937
- if (width != null) {
4938
- if (isString(width)) {
4939
- el.style.width = width;
4940
- } else {
4941
- el.style.width = width + "px";
4942
- }
4943
- }
4944
-
4945
- if (height != null) {
4946
- if (isString(height)) {
4947
- el.style.height = height;
4948
- } else {
4949
- el.style.height = height + "px";
4950
- }
4951
- }
4952
-
5809
+ __proto.setSize = function (size) {
5810
+ setSize(this.element, size);
4953
5811
  return this;
4954
5812
  };
4955
5813
  /**
@@ -4994,7 +5852,7 @@ var Panel = function () {
4994
5852
  return this.includeRange(pos, pos, includeMargin);
4995
5853
  };
4996
5854
  /**
4997
- * Check whether the given range is fully included in this panel's area
5855
+ * Check whether the given range is fully included in this panel's area (inclusive)
4998
5856
  * @ko 주어진 범위가 이 패널 내부에 완전히 포함되는지를 반환합니다
4999
5857
  * @param {number} min Minimum value of the range to check<ko>확인하고자 하는 최소 범위</ko>
5000
5858
  * @param {number} max Maximum value of the range to check<ko>확인하고자 하는 최대 범위</ko>
@@ -5018,6 +5876,19 @@ var Panel = function () {
5018
5876
 
5019
5877
  return max >= panelRange.min && min <= panelRange.max;
5020
5878
  };
5879
+ /**
5880
+ * Check whether the panel is visble in the given range (exclusive)
5881
+ * @ko 주어진 범위 내에서 이 패널의 일부가 보여지는지를 반환합니다
5882
+ * @param {number} min Minimum value of the range to check<ko>확인하고자 하는 최소 범위</ko>
5883
+ * @param {number} max Maximum value of the range to check<ko>확인하고자 하는 최대 범위</ko>
5884
+ * @returns {boolean} A Boolean value indicating whether the panel is visible<ko>해당 범위 내에서 패널을 볼 수 있는지 여부</ko>
5885
+ */
5886
+
5887
+
5888
+ __proto.isVisibleOnRange = function (min, max) {
5889
+ var panelRange = this.range;
5890
+ return max > panelRange.min && min < panelRange.max;
5891
+ };
5021
5892
  /**
5022
5893
  * Move {@link Camera} to this panel
5023
5894
  * @ko {@link Camera}를 이 패널로 이동합니다
@@ -5092,33 +5963,13 @@ var Panel = function () {
5092
5963
  return this;
5093
5964
  };
5094
5965
  /**
5095
- * Increase panel's position by the given value
5096
- * @ko 패널의 위치를 주어진 값만큼 증가시킵니다
5097
- * @internal
5098
- * @chainable
5099
- * @param val An integer greater than or equal to 0<ko>0보다 같거나 큰 정수</ko>
5100
- * @returns {this}
5101
- */
5102
-
5103
-
5104
- __proto.increasePosition = function (val) {
5105
- this._moveBy(Math.max(val, 0));
5106
-
5107
- return this;
5108
- };
5109
- /**
5110
- * Decrease panel's position by the given value
5111
- * @ko 패널의위치를 주어진 값만큼 감소시킵니다
5112
5966
  * @internal
5113
- * @chainable
5114
- * @param val An integer greater than or equal to 0<ko>0보다 같거나 큰 정수</ko>
5115
- * @returns {this}
5116
5967
  */
5117
5968
 
5118
5969
 
5119
- __proto.decreasePosition = function (val) {
5120
- this._moveBy(-Math.max(val, 0));
5121
-
5970
+ __proto.updatePosition = function () {
5971
+ var prevPanel = this._flicking.renderer.panels[this._index - 1];
5972
+ this._pos = prevPanel ? prevPanel.range.max + prevPanel.margin.next + this._margin.prev : this._margin.prev;
5122
5973
  return this;
5123
5974
  };
5124
5975
  /**
@@ -5186,11 +6037,6 @@ var Panel = function () {
5186
6037
  return this;
5187
6038
  };
5188
6039
 
5189
- __proto._moveBy = function (val) {
5190
- this._pos += val;
5191
- return this;
5192
- };
5193
-
5194
6040
  __proto._updateAlignPos = function () {
5195
6041
  this._alignPos = parseAlign$1(this._align, this._size);
5196
6042
  };
@@ -5209,7 +6055,103 @@ var Panel = function () {
5209
6055
  this._toggleDirection = DIRECTION.NONE;
5210
6056
  };
5211
6057
 
5212
- return Panel;
6058
+ return Panel;
6059
+ }();
6060
+
6061
+ var NormalRenderingStrategy =
6062
+ /*#__PURE__*/
6063
+ function () {
6064
+ function NormalRenderingStrategy(_a) {
6065
+ var providerCtor = _a.providerCtor;
6066
+ this._providerCtor = providerCtor;
6067
+ }
6068
+
6069
+ var __proto = NormalRenderingStrategy.prototype;
6070
+
6071
+ __proto.renderPanels = function () {// DO_NOTHING
6072
+ };
6073
+
6074
+ __proto.getRenderingIndexesByOrder = function (flicking) {
6075
+ var renderedPanels = flicking.renderer.panels.filter(function (panel) {
6076
+ return panel.rendered;
6077
+ });
6078
+ var toggledPrev = renderedPanels.filter(function (panel) {
6079
+ return panel.toggled && panel.toggleDirection === DIRECTION.PREV;
6080
+ });
6081
+ var toggledNext = renderedPanels.filter(function (panel) {
6082
+ return panel.toggled && panel.toggleDirection === DIRECTION.NEXT;
6083
+ });
6084
+ var notToggled = renderedPanels.filter(function (panel) {
6085
+ return !panel.toggled;
6086
+ });
6087
+ return __spreadArray(__spreadArray(__spreadArray([], __read(toggledPrev), false), __read(notToggled), false), __read(toggledNext)).map(function (panel) {
6088
+ return panel.index;
6089
+ });
6090
+ };
6091
+
6092
+ __proto.getRenderingElementsByOrder = function (flicking) {
6093
+ var panels = flicking.panels;
6094
+ return this.getRenderingIndexesByOrder(flicking).map(function (index) {
6095
+ return panels[index].element;
6096
+ });
6097
+ };
6098
+
6099
+ __proto.updateRenderingPanels = function (flicking) {
6100
+ if (flicking.renderOnlyVisible) {
6101
+ this._showOnlyVisiblePanels(flicking);
6102
+ } else {
6103
+ flicking.panels.forEach(function (panel) {
6104
+ return panel.markForShow();
6105
+ });
6106
+ }
6107
+ };
6108
+
6109
+ __proto.collectPanels = function (flicking, elements) {
6110
+ var _this = this;
6111
+
6112
+ var align = parsePanelAlign(flicking.renderer.align);
6113
+ return elements.map(function (el, index) {
6114
+ return new Panel({
6115
+ index: index,
6116
+ elementProvider: new _this._providerCtor(el),
6117
+ align: align,
6118
+ flicking: flicking
6119
+ });
6120
+ });
6121
+ };
6122
+
6123
+ __proto.createPanel = function (element, options) {
6124
+ return new Panel(__assign(__assign({}, options), {
6125
+ elementProvider: new this._providerCtor(element)
6126
+ }));
6127
+ };
6128
+
6129
+ __proto.updatePanelSizes = function (flicking, size) {
6130
+ flicking.panels.forEach(function (panel) {
6131
+ return panel.setSize(size);
6132
+ });
6133
+ };
6134
+
6135
+ __proto._showOnlyVisiblePanels = function (flicking) {
6136
+ var panels = flicking.renderer.panels;
6137
+ var camera = flicking.camera;
6138
+ var visibleIndexes = camera.visiblePanels.reduce(function (visibles, panel) {
6139
+ visibles[panel.index] = true;
6140
+ return visibles;
6141
+ }, {});
6142
+ panels.forEach(function (panel) {
6143
+ if (panel.index in visibleIndexes || panel.loading) {
6144
+ panel.markForShow();
6145
+ } else if (!flicking.holding) {
6146
+ // During the input sequence,
6147
+ // Do not remove panel elements as it won't trigger touchend event.
6148
+ panel.markForHide();
6149
+ }
6150
+ });
6151
+ camera.updateOffset();
6152
+ };
6153
+
6154
+ return NormalRenderingStrategy;
5213
6155
  }();
5214
6156
 
5215
6157
  /**
@@ -5217,26 +6159,28 @@ var Panel = function () {
5217
6159
  * @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
5218
6160
  */
5219
6161
 
5220
- var ElementPanel = function (_super) {
5221
- __extends(ElementPanel, _super);
6162
+ var VirtualPanel =
6163
+ /*#__PURE__*/
6164
+ function (_super) {
6165
+ __extends(VirtualPanel, _super);
5222
6166
  /**
5223
6167
  * @param {object} options An options object<ko>옵션 오브젝트</ko>
5224
- * @param {HTMLElement} [options.el] A `HTMLElement` panel's referencing<ko>패널이 참조하는 `HTMLElement`</ko>
5225
6168
  * @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
5226
6169
  * @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
5227
6170
  * @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
5228
6171
  */
5229
6172
 
5230
6173
 
5231
- function ElementPanel(options) {
6174
+ function VirtualPanel(options) {
5232
6175
  var _this = _super.call(this, options) || this;
5233
6176
 
5234
- _this._el = options.el;
5235
- _this._rendered = true;
6177
+ options.elementProvider.init(_this);
6178
+ _this._elProvider = options.elementProvider;
6179
+ _this._cachedInnerHTML = null;
5236
6180
  return _this;
5237
6181
  }
5238
6182
 
5239
- var __proto = ElementPanel.prototype;
6183
+ var __proto = VirtualPanel.prototype;
5240
6184
  Object.defineProperty(__proto, "element", {
5241
6185
  /**
5242
6186
  * `HTMLElement` that panel's referencing
@@ -5245,211 +6189,189 @@ var ElementPanel = function (_super) {
5245
6189
  * @readonly
5246
6190
  */
5247
6191
  get: function () {
5248
- return this._el;
6192
+ return this._elProvider.element;
5249
6193
  },
5250
6194
  enumerable: false,
5251
6195
  configurable: true
5252
6196
  });
5253
- Object.defineProperty(__proto, "rendered", {
6197
+ Object.defineProperty(__proto, "cachedInnerHTML", {
6198
+ /**
6199
+ * Cached innerHTML by the previous render function
6200
+ * @ko 이전 렌더링에서 캐시된 innerHTML 정보
6201
+ * @type {string|null}
6202
+ * @readonly
6203
+ */
5254
6204
  get: function () {
5255
- return this._rendered;
6205
+ return this._cachedInnerHTML;
5256
6206
  },
5257
6207
  enumerable: false,
5258
6208
  configurable: true
5259
6209
  });
6210
+ Object.defineProperty(__proto, "elementIndex", {
6211
+ /**
6212
+ * An number for indexing which element it will be rendered on
6213
+ * @ko 몇 번째 엘리먼트에 렌더링될 것인지를 나타내는 숫자
6214
+ * @type {number}
6215
+ * @readonly
6216
+ */
6217
+ get: function () {
6218
+ var flicking = this._flicking;
6219
+ var virtualElCount = flicking.panelsPerView + 1;
6220
+ var panelCount = flicking.panelCount;
6221
+ var index = this._index;
5260
6222
 
5261
- __proto.markForShow = function () {
5262
- this._rendered = true;
5263
- };
5264
-
5265
- __proto.markForHide = function () {
5266
- this._rendered = false;
5267
- };
5268
-
5269
- return ElementPanel;
5270
- }(Panel);
5271
-
5272
- /**
5273
- *
5274
- */
5275
-
5276
- var VanillaRenderer = function (_super) {
5277
- __extends(VanillaRenderer, _super);
6223
+ if (this._toggled) {
6224
+ // To prevent element duplication
6225
+ index = this._toggleDirection === DIRECTION.NEXT ? index + panelCount : index - panelCount;
6226
+ }
5278
6227
 
5279
- function VanillaRenderer() {
5280
- return _super !== null && _super.apply(this, arguments) || this;
5281
- } // eslint-disable-next-line @typescript-eslint/require-await
6228
+ return circulateIndex(index, virtualElCount);
6229
+ },
6230
+ enumerable: false,
6231
+ configurable: true
6232
+ });
5282
6233
 
6234
+ __proto.cacheRenderResult = function (result) {
6235
+ this._cachedInnerHTML = result;
6236
+ };
5283
6237
 
5284
- var __proto = VanillaRenderer.prototype;
6238
+ __proto.uncacheRenderResult = function () {
6239
+ this._cachedInnerHTML = null;
6240
+ };
5285
6241
 
5286
6242
  __proto.render = function () {
5287
- return __awaiter(this, void 0, void 0, function () {
5288
- var flicking, cameraEl, wasRenderedPanels, renderingPanels;
5289
- return __generator(this, function (_a) {
5290
- flicking = getFlickingAttached(this._flicking, "Renderer");
5291
- cameraEl = flicking.camera.element;
5292
- wasRenderedPanels = this._panels.filter(function (panel) {
5293
- return panel.element.parentElement === cameraEl;
5294
- });
5295
-
5296
- this._updateRenderingPanels();
5297
-
5298
- renderingPanels = this._getRenderingPanelsByOrder();
6243
+ var flicking = this._flicking;
6244
+ var _a = flicking.virtual,
6245
+ renderPanel = _a.renderPanel,
6246
+ cache = _a.cache;
6247
+ var element = this._elProvider.element;
6248
+ var newInnerHTML = this._cachedInnerHTML || renderPanel(this, this._index);
6249
+ if (newInnerHTML === element.innerHTML) return;
6250
+ element.innerHTML = newInnerHTML;
6251
+
6252
+ if (cache) {
6253
+ this.cacheRenderResult(newInnerHTML);
6254
+ }
6255
+ };
5299
6256
 
5300
- this._removePanelElements(wasRenderedPanels.filter(function (panel) {
5301
- return !panel.rendered;
5302
- }));
6257
+ __proto.increaseIndex = function (val) {
6258
+ this.uncacheRenderResult();
6259
+ return _super.prototype.increaseIndex.call(this, val);
6260
+ };
5303
6261
 
5304
- this._insertPanelElements(renderingPanels.filter(function (panel) {
5305
- return panel.element.parentElement !== cameraEl;
5306
- }), null);
6262
+ __proto.decreaseIndex = function (val) {
6263
+ this.uncacheRenderResult();
6264
+ return _super.prototype.decreaseIndex.call(this, val);
6265
+ };
5307
6266
 
5308
- this._resetPanelElementOrder(renderingPanels);
6267
+ return VirtualPanel;
6268
+ }(Panel);
5309
6269
 
5310
- return [2
5311
- /*return*/
5312
- ];
5313
- });
6270
+ var VirtualRenderingStrategy =
6271
+ /*#__PURE__*/
6272
+ function () {
6273
+ function VirtualRenderingStrategy() {}
6274
+
6275
+ var __proto = VirtualRenderingStrategy.prototype;
6276
+
6277
+ __proto.renderPanels = function (flicking) {
6278
+ var virtualManager = flicking.virtual;
6279
+ var visiblePanels = flicking.visiblePanels;
6280
+ var invisibleIndexes = range(flicking.panelsPerView + 1);
6281
+ visiblePanels.forEach(function (panel) {
6282
+ var elementIndex = panel.elementIndex;
6283
+ panel.render();
6284
+ virtualManager.show(elementIndex);
6285
+ invisibleIndexes[elementIndex] = -1;
5314
6286
  });
5315
- }; // eslint-disable-next-line @typescript-eslint/require-await
5316
-
5317
-
5318
- __proto.forceRenderAllPanels = function () {
5319
- return __awaiter(this, void 0, void 0, function () {
5320
- var flicking, camera, cameraElement, fragment;
5321
- return __generator(this, function (_a) {
5322
- flicking = getFlickingAttached(this._flicking, "Renderer");
5323
- camera = flicking.camera;
5324
- cameraElement = camera.element;
5325
- fragment = document.createDocumentFragment();
5326
-
5327
- this._panels.forEach(function (panel) {
5328
- return fragment.appendChild(panel.element);
5329
- });
5330
-
5331
- this._removeAllChildsFromCamera();
5332
-
5333
- cameraElement.appendChild(fragment);
5334
- return [2
5335
- /*return*/
5336
- ];
5337
- });
6287
+ invisibleIndexes.filter(function (val) {
6288
+ return val >= 0;
6289
+ }).forEach(function (idx) {
6290
+ virtualManager.hide(idx);
5338
6291
  });
5339
6292
  };
5340
6293
 
5341
- __proto._collectPanels = function () {
5342
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5343
- var cameraElement = flicking.camera.element; // Remove all text nodes in the camera element
6294
+ __proto.getRenderingIndexesByOrder = function (flicking) {
6295
+ var virtualManager = flicking.virtual;
5344
6296
 
5345
- toArray(cameraElement.childNodes).forEach(function (node) {
5346
- if (node.nodeType === Node.TEXT_NODE) {
5347
- cameraElement.removeChild(node);
5348
- }
6297
+ var visiblePanels = __spreadArray([], __read(flicking.visiblePanels)).filter(function (panel) {
6298
+ return panel.rendered;
6299
+ }).sort(function (panel1, panel2) {
6300
+ return panel1.position + panel1.offset - (panel2.position + panel2.offset);
5349
6301
  });
5350
6302
 
5351
- var align = this._getPanelAlign();
5352
-
5353
- var cameraChilds = toArray(cameraElement.children);
5354
- this._panels = cameraChilds.map(function (el, index) {
5355
- return new ElementPanel({
5356
- flicking: flicking,
5357
- el: el,
5358
- index: index,
5359
- align: align
6303
+ if (visiblePanels.length <= 0) return virtualManager.elements.map(function (_, idx) {
6304
+ return idx;
6305
+ });
6306
+ var visibleIndexes = visiblePanels.map(function (panel) {
6307
+ return panel.elementIndex;
6308
+ });
6309
+ var invisibleIndexes = virtualManager.elements.map(function (el, idx) {
6310
+ return __assign(__assign({}, el), {
6311
+ idx: idx
5360
6312
  });
6313
+ }).filter(function (el) {
6314
+ return !el.visible;
6315
+ }).map(function (el) {
6316
+ return el.idx;
5361
6317
  });
6318
+ return __spreadArray(__spreadArray([], __read(visibleIndexes), false), __read(invisibleIndexes));
5362
6319
  };
5363
6320
 
5364
- __proto._createPanel = function (el, options) {
5365
- return new ElementPanel(__assign({
5366
- el: el
5367
- }, options));
5368
- };
5369
-
5370
- __proto._insertPanelElements = function (panels, nextSibling) {
5371
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5372
- var camera = flicking.camera;
5373
- var cameraElement = camera.element;
5374
- var nextSiblingElement = (nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.element) || null;
5375
- var fragment = document.createDocumentFragment();
5376
- panels.forEach(function (panel) {
5377
- return fragment.appendChild(panel.element);
6321
+ __proto.getRenderingElementsByOrder = function (flicking) {
6322
+ var virtualManager = flicking.virtual;
6323
+ var elements = virtualManager.elements;
6324
+ return this.getRenderingIndexesByOrder(flicking).map(function (index) {
6325
+ return elements[index].nativeElement;
5378
6326
  });
5379
- cameraElement.insertBefore(fragment, nextSiblingElement);
5380
- return this;
5381
6327
  };
5382
6328
 
5383
- __proto._removePanelElements = function (panels) {
5384
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5385
- var cameraElement = flicking.camera.element;
6329
+ __proto.updateRenderingPanels = function (flicking) {
6330
+ var panels = flicking.renderer.panels;
6331
+ var camera = flicking.camera;
6332
+ var visibleIndexes = camera.visiblePanels.reduce(function (visibles, panel) {
6333
+ visibles[panel.index] = true;
6334
+ return visibles;
6335
+ }, {});
5386
6336
  panels.forEach(function (panel) {
5387
- cameraElement.removeChild(panel.element);
6337
+ if (panel.index in visibleIndexes || panel.loading) {
6338
+ panel.markForShow();
6339
+ } else {
6340
+ panel.markForHide();
6341
+ }
5388
6342
  });
5389
- return this;
6343
+ camera.updateOffset();
5390
6344
  };
5391
6345
 
5392
- __proto._resetPanelElementOrder = function (panels) {
5393
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5394
- var cameraEl = flicking.camera.element; // We're using reversed panels here as last panel should be the last element of camera element
5395
-
5396
- var reversedPanels = __spreadArray([], __read(panels)).reverse();
5397
-
5398
- reversedPanels.forEach(function (panel, idx) {
5399
- var nextPanel = reversedPanels[idx - 1];
5400
- var nextPanelEl = nextPanel ? nextPanel.element : null;
5401
-
5402
- if (panel.element.nextElementSibling !== nextPanelEl) {
5403
- cameraEl.insertBefore(panel.element, nextPanelEl);
5404
- }
6346
+ __proto.collectPanels = function (flicking) {
6347
+ var align = parsePanelAlign(flicking.renderer.align);
6348
+ return range(flicking.virtual.initialPanelCount).map(function (index) {
6349
+ return new VirtualPanel({
6350
+ index: index,
6351
+ elementProvider: new VirtualElementProvider(flicking),
6352
+ align: align,
6353
+ flicking: flicking
6354
+ });
5405
6355
  });
5406
6356
  };
5407
6357
 
5408
- __proto._removeAllChildsFromCamera = function () {
5409
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5410
- var cameraElement = flicking.camera.element; // Remove other elements
5411
-
5412
- while (cameraElement.firstChild) {
5413
- cameraElement.removeChild(cameraElement.firstChild);
5414
- }
6358
+ __proto.createPanel = function (_el, options) {
6359
+ return new VirtualPanel(__assign(__assign({}, options), {
6360
+ elementProvider: new VirtualElementProvider(options.flicking)
6361
+ }));
5415
6362
  };
5416
6363
 
5417
- __proto._getRenderingPanelsByOrder = function () {
5418
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5419
- var panels = flicking.renderer.panels;
5420
- return panels.filter(function (panel) {
5421
- return panel.rendered;
5422
- }).sort(function (a, b) {
5423
- return a.position + a.offset - (b.position + b.offset);
6364
+ __proto.updatePanelSizes = function (flicking, size) {
6365
+ flicking.virtual.elements.forEach(function (el) {
6366
+ setSize(el.nativeElement, size);
6367
+ });
6368
+ flicking.panels.forEach(function (panel) {
6369
+ return panel.setSize(size);
5424
6370
  });
5425
6371
  };
5426
6372
 
5427
- return VanillaRenderer;
5428
- }(Renderer);
5429
-
5430
- /**
5431
- *
5432
- */
5433
-
5434
- var ExternalRenderer = function (_super) {
5435
- __extends(ExternalRenderer, _super);
5436
-
5437
- function ExternalRenderer() {
5438
- return _super !== null && _super.apply(this, arguments) || this;
5439
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
5440
-
5441
-
5442
- var __proto = ExternalRenderer.prototype;
5443
-
5444
- __proto._insertPanelElements = function (panels, nextSibling) {// DO NOTHING
5445
- }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
5446
-
5447
-
5448
- __proto._removePanelElements = function (panels) {// DO NOTHING
5449
- };
5450
-
5451
- return ExternalRenderer;
5452
- }(Renderer);
6373
+ return VirtualRenderingStrategy;
6374
+ }();
5453
6375
 
5454
6376
  /**
5455
6377
  * @extends Component
@@ -5458,7 +6380,9 @@ var ExternalRenderer = function (_super) {
5458
6380
  * @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
5459
6381
  */
5460
6382
 
5461
- var Flicking = function (_super) {
6383
+ var Flicking =
6384
+ /*#__PURE__*/
6385
+ function (_super) {
5462
6386
  __extends(Flicking, _super);
5463
6387
  /**
5464
6388
  * @param root A root HTMLElement to initialize Flicking on it. When it's a typeof `string`, it should be a css selector string
@@ -5508,42 +6432,50 @@ var Flicking = function (_super) {
5508
6432
  panelsPerView = _j === void 0 ? -1 : _j,
5509
6433
  _k = _b.noPanelStyleOverride,
5510
6434
  noPanelStyleOverride = _k === void 0 ? false : _k,
5511
- _l = _b.needPanelThreshold,
5512
- needPanelThreshold = _l === void 0 ? 0 : _l,
5513
- _m = _b.preventEventsBeforeInit,
5514
- preventEventsBeforeInit = _m === void 0 ? true : _m,
5515
- _o = _b.deceleration,
5516
- deceleration = _o === void 0 ? 0.0075 : _o,
5517
- _p = _b.duration,
5518
- duration = _p === void 0 ? 500 : _p,
5519
- _q = _b.easing,
5520
- easing = _q === void 0 ? function (x) {
6435
+ _l = _b.resizeOnContentsReady,
6436
+ resizeOnContentsReady = _l === void 0 ? false : _l,
6437
+ _m = _b.needPanelThreshold,
6438
+ needPanelThreshold = _m === void 0 ? 0 : _m,
6439
+ _o = _b.preventEventsBeforeInit,
6440
+ preventEventsBeforeInit = _o === void 0 ? true : _o,
6441
+ _p = _b.deceleration,
6442
+ deceleration = _p === void 0 ? 0.0075 : _p,
6443
+ _q = _b.duration,
6444
+ duration = _q === void 0 ? 500 : _q,
6445
+ _r = _b.easing,
6446
+ easing = _r === void 0 ? function (x) {
5521
6447
  return 1 - Math.pow(1 - x, 3);
5522
- } : _q,
5523
- _r = _b.inputType,
5524
- inputType = _r === void 0 ? ["mouse", "touch"] : _r,
5525
- _s = _b.moveType,
5526
- moveType = _s === void 0 ? "snap" : _s,
5527
- _t = _b.threshold,
5528
- threshold = _t === void 0 ? 40 : _t,
5529
- _u = _b.interruptable,
5530
- interruptable = _u === void 0 ? true : _u,
5531
- _v = _b.bounce,
5532
- bounce = _v === void 0 ? "20%" : _v,
5533
- _w = _b.iOSEdgeSwipeThreshold,
5534
- iOSEdgeSwipeThreshold = _w === void 0 ? 30 : _w,
5535
- _x = _b.preventClickOnDrag,
5536
- preventClickOnDrag = _x === void 0 ? true : _x,
5537
- _y = _b.disableOnInit,
5538
- disableOnInit = _y === void 0 ? false : _y,
5539
- _z = _b.renderOnlyVisible,
5540
- renderOnlyVisible = _z === void 0 ? false : _z,
5541
- _0 = _b.autoInit,
5542
- autoInit = _0 === void 0 ? true : _0,
5543
- _1 = _b.autoResize,
5544
- autoResize = _1 === void 0 ? true : _1,
5545
- _2 = _b.renderExternal,
5546
- renderExternal = _2 === void 0 ? null : _2;
6448
+ } : _r,
6449
+ _s = _b.inputType,
6450
+ inputType = _s === void 0 ? ["mouse", "touch"] : _s,
6451
+ _t = _b.moveType,
6452
+ moveType = _t === void 0 ? "snap" : _t,
6453
+ _u = _b.threshold,
6454
+ threshold = _u === void 0 ? 40 : _u,
6455
+ _v = _b.interruptable,
6456
+ interruptable = _v === void 0 ? true : _v,
6457
+ _w = _b.bounce,
6458
+ bounce = _w === void 0 ? "20%" : _w,
6459
+ _x = _b.iOSEdgeSwipeThreshold,
6460
+ iOSEdgeSwipeThreshold = _x === void 0 ? 30 : _x,
6461
+ _y = _b.preventClickOnDrag,
6462
+ preventClickOnDrag = _y === void 0 ? true : _y,
6463
+ _z = _b.disableOnInit,
6464
+ disableOnInit = _z === void 0 ? false : _z,
6465
+ _0 = _b.renderOnlyVisible,
6466
+ renderOnlyVisible = _0 === void 0 ? false : _0,
6467
+ _1 = _b.virtual,
6468
+ virtual = _1 === void 0 ? null : _1,
6469
+ _2 = _b.autoInit,
6470
+ autoInit = _2 === void 0 ? true : _2,
6471
+ _3 = _b.autoResize,
6472
+ autoResize = _3 === void 0 ? true : _3,
6473
+ _4 = _b.useResizeObserver,
6474
+ useResizeObserver = _4 === void 0 ? true : _4,
6475
+ _5 = _b.externalRenderer,
6476
+ externalRenderer = _5 === void 0 ? null : _5,
6477
+ _6 = _b.renderExternal,
6478
+ renderExternal = _6 === void 0 ? null : _6;
5547
6479
 
5548
6480
  var _this = _super.call(this) || this; // Internal states
5549
6481
 
@@ -5559,6 +6491,8 @@ var Flicking = function (_super) {
5559
6491
  _this._adaptive = adaptive;
5560
6492
  _this._panelsPerView = panelsPerView;
5561
6493
  _this._noPanelStyleOverride = noPanelStyleOverride;
6494
+ _this._resizeOnContentsReady = resizeOnContentsReady;
6495
+ _this._virtual = virtual;
5562
6496
  _this._needPanelThreshold = needPanelThreshold;
5563
6497
  _this._preventEventsBeforeInit = preventEventsBeforeInit;
5564
6498
  _this._deceleration = deceleration;
@@ -5573,15 +6507,18 @@ var Flicking = function (_super) {
5573
6507
  _this._preventClickOnDrag = preventClickOnDrag;
5574
6508
  _this._disableOnInit = disableOnInit;
5575
6509
  _this._renderOnlyVisible = renderOnlyVisible;
5576
- _this._autoResize = autoResize;
5577
6510
  _this._autoInit = autoInit;
6511
+ _this._autoResize = autoResize;
6512
+ _this._useResizeObserver = useResizeObserver;
6513
+ _this._externalRenderer = externalRenderer;
5578
6514
  _this._renderExternal = renderExternal; // Create core components
5579
6515
 
5580
6516
  _this._viewport = new Viewport(getElement(root));
6517
+ _this._autoResizer = new AutoResizer(_this);
5581
6518
  _this._renderer = _this._createRenderer();
5582
6519
  _this._camera = _this._createCamera();
5583
6520
  _this._control = _this._createControl();
5584
- _this.resize = _this.resize.bind(_this);
6521
+ _this._virtualManager = new VirtualManager(_this, virtual);
5585
6522
 
5586
6523
  if (_this._autoInit) {
5587
6524
  void _this.init();
@@ -5693,6 +6630,22 @@ var Flicking = function (_super) {
5693
6630
  enumerable: false,
5694
6631
  configurable: true
5695
6632
  });
6633
+ Object.defineProperty(__proto, "virtualEnabled", {
6634
+ /**
6635
+ * Whether the `virtual` option is enabled.
6636
+ * The {@link Flicking#virtual virtual} option can't be enabled when {@link Flicking#panelsPerView panelsPerView} is less or equal than zero.
6637
+ * @ko {@link Flicking#virtual virtual} 옵션이 활성화되었는지 여부를 나타내는 멤버 변수.
6638
+ * {@link Flicking#virtual virtual} 옵션은 {@link Flicking#panelsPerView panelsPerView} 옵션의 값이 0보다 같거나 작으면 비활성화됩니다.
6639
+ * @type {boolean}
6640
+ * @default false
6641
+ * @readonly
6642
+ */
6643
+ get: function () {
6644
+ return this._panelsPerView > 0 && this._virtual != null;
6645
+ },
6646
+ enumerable: false,
6647
+ configurable: true
6648
+ });
5696
6649
  Object.defineProperty(__proto, "index", {
5697
6650
  /**
5698
6651
  * Index number of the {@link Flicking#currentPanel currentPanel}
@@ -5974,6 +6927,24 @@ var Flicking = function (_super) {
5974
6927
  enumerable: false,
5975
6928
  configurable: true
5976
6929
  });
6930
+ Object.defineProperty(__proto, "resizeOnContentsReady", {
6931
+ /**
6932
+ * Enabling this option will automatically call {@link Flicking#resize} when all image/video inside panels are loaded.
6933
+ * This can be useful when you have contents inside Flicking that changes its size when it's loaded
6934
+ * @ko 이 옵션을 활성화할 경우, Flicking 패널 내부의 이미지/비디오들이 로드되었을 때 자동으로 {@link Flicking#resize}를 호출합니다.
6935
+ * 이 동작은 Flicking 내부에 로드 전/후로 크기가 변하는 콘텐츠를 포함하고 있을 때 유용하게 사용하실 수 있습니다.
6936
+ * @type {boolean}
6937
+ * @default false
6938
+ */
6939
+ get: function () {
6940
+ return this._resizeOnContentsReady;
6941
+ },
6942
+ set: function (val) {
6943
+ this._resizeOnContentsReady = val;
6944
+ },
6945
+ enumerable: false,
6946
+ configurable: true
6947
+ });
5977
6948
  Object.defineProperty(__proto, "needPanelThreshold", {
5978
6949
  // EVENTS
5979
6950
 
@@ -6257,8 +7228,8 @@ var Flicking = function (_super) {
6257
7228
  // PERFORMANCE
6258
7229
 
6259
7230
  /**
6260
- * Whether to render visible panels only. This can dramatically increase performance when there're many panels.
6261
- * @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수 있습니다.
7231
+ * Whether to render visible panels only. This can dramatically increase performance when there're many panels
7232
+ * @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수 있습니다
6262
7233
  * @type {boolean}
6263
7234
  * @default false
6264
7235
  */
@@ -6272,6 +7243,44 @@ var Flicking = function (_super) {
6272
7243
  enumerable: false,
6273
7244
  configurable: true
6274
7245
  });
7246
+ Object.defineProperty(__proto, "virtual", {
7247
+ /**
7248
+ * By enabling this option, it will reduce memory consumption by restricting the number of DOM elements to `panelsPerView + 1`
7249
+ * Must be used with `panelsPerview`.
7250
+ * After Flicking's initialized, this property can be used to add/remove the panel count.
7251
+ * @ko 이 옵션을 활성화할 경우 패널 엘리먼트의 개수를 `panelsPerView + 1` 개로 고정함으로써, 메모리 사용량을 줄일 수 있습니다.
7252
+ * `panelsPerView` 옵션과 함께 사용되어야만 합니다.
7253
+ * Flicking 초기화 이후에, 이 프로퍼티는 렌더링하는 패널의 개수를 추가/제거하기 위해 사용될 수 있습니다.
7254
+ * @type {VirtualManager}
7255
+ * @property {function} renderPanel A rendering function for the panel element's innerHTML<ko>패널 엘리먼트의 innerHTML을 렌더링하는 함수</ko>
7256
+ * @property {number} initialPanelCount Initial panel count to render<ko>최초로 렌더링할 패널의 개수</ko>
7257
+ * @property {boolean} [cache=false] Whether to cache rendered panel's innerHTML<ko>렌더링된 패널의 innerHTML 정보를 캐시할지 여부</ko>
7258
+ * @property {string} [panelClass="flicking-panel"] The class name that will be applied to rendered panel elements<ko>렌더링되는 패널 엘리먼트에 적용될 클래스 이름</ko>
7259
+ * @example
7260
+ * ```ts
7261
+ * import Flicking, { VirtualPanel } from "@egjs/flicking";
7262
+ *
7263
+ * const flicking = new Flicking("#some_el", {
7264
+ * panelsPerView: 3,
7265
+ * virtual: {
7266
+ * renderPanel: (panel: VirtualPanel, index: number) => `Panel ${index}`,
7267
+ * initialPanelCount: 100
7268
+ * }
7269
+ * });
7270
+ *
7271
+ * // Add 100 virtual panels (at the end)
7272
+ * flicking.virtual.append(100);
7273
+ *
7274
+ * // Remove 100 virtual panels from 0 to 100
7275
+ * flicking.virtual.remove(0, 100);
7276
+ * ```
7277
+ */
7278
+ get: function () {
7279
+ return this._virtualManager;
7280
+ },
7281
+ enumerable: false,
7282
+ configurable: true
7283
+ });
6275
7284
  Object.defineProperty(__proto, "autoInit", {
6276
7285
  // OTHERS
6277
7286
 
@@ -6290,10 +7299,8 @@ var Flicking = function (_super) {
6290
7299
  });
6291
7300
  Object.defineProperty(__proto, "autoResize", {
6292
7301
  /**
6293
- * Attach Flicking's {@link Flicking#resize resize} method to window's resize event.
6294
- * Flicking will automatically call {@link Flicking#resize resize} window size and orientation change.
6295
- * @ko Flicking의 {@link Flicking#resize resize} 메소드를 window의 resize 이벤트 핸들러로 등록합니다.
6296
- * 설정시 window 창 크기 및 orientation 변경에 의해 자동으로 {@link Flicking#resize resize}를 호출합니다.
7302
+ * Whether to automatically call {@link Flicking#resize resize()} when the viewport element(.flicking-viewport)'s size is changed
7303
+ * @ko 뷰포트 엘리먼트(.flicking-viewport)의 크기 변경시 {@link Flicking#resize resize()} 메소드를 자동으로 호출할지 여부를 설정합니다
6297
7304
  * @type {boolean}
6298
7305
  * @default true
6299
7306
  */
@@ -6303,6 +7310,46 @@ var Flicking = function (_super) {
6303
7310
  // OTHERS
6304
7311
  set: function (val) {
6305
7312
  this._autoResize = val;
7313
+
7314
+ if (val) {
7315
+ this._autoResizer.enable();
7316
+ } else {
7317
+ this._autoResizer.disable();
7318
+ }
7319
+ },
7320
+ enumerable: false,
7321
+ configurable: true
7322
+ });
7323
+ Object.defineProperty(__proto, "useResizeObserver", {
7324
+ /**
7325
+ * Whether to listen {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}'s event instead of Window's {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} event when using the `autoResize` option
7326
+ * @ko autoResize 옵션 사용시 {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}의 이벤트를 Window객체의 {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} 이벤트 대신 수신할지 여부를 설정합니다
7327
+ * @type {boolean}
7328
+ * @default true
7329
+ */
7330
+ get: function () {
7331
+ return this._useResizeObserver;
7332
+ },
7333
+ set: function (val) {
7334
+ this._useResizeObserver = val;
7335
+
7336
+ if (this._autoResize) {
7337
+ this._autoResizer.enable();
7338
+ }
7339
+ },
7340
+ enumerable: false,
7341
+ configurable: true
7342
+ });
7343
+ Object.defineProperty(__proto, "externalRenderer", {
7344
+ /**
7345
+ * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
7346
+ * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
7347
+ * @default null
7348
+ * @internal
7349
+ * @readonly
7350
+ */
7351
+ get: function () {
7352
+ return this._externalRenderer;
6306
7353
  },
6307
7354
  enumerable: false,
6308
7355
  configurable: true
@@ -6311,10 +7358,10 @@ var Flicking = function (_super) {
6311
7358
  /**
6312
7359
  * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
6313
7360
  * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
6314
- * @type {boolean}
6315
- * @default false
7361
+ * @default null
6316
7362
  * @internal
6317
7363
  * @readonly
7364
+ * @deprecated
6318
7365
  */
6319
7366
  get: function () {
6320
7367
  return this._renderExternal;
@@ -6333,7 +7380,7 @@ var Flicking = function (_super) {
6333
7380
 
6334
7381
  __proto.init = function () {
6335
7382
  return __awaiter(this, void 0, void 0, function () {
6336
- var camera, renderer, control, originalTrigger, preventEventsBeforeInit;
7383
+ var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
6337
7384
 
6338
7385
  var _this = this;
6339
7386
 
@@ -6346,9 +7393,11 @@ var Flicking = function (_super) {
6346
7393
  camera = this._camera;
6347
7394
  renderer = this._renderer;
6348
7395
  control = this._control;
7396
+ virtualManager = this._virtualManager;
6349
7397
  originalTrigger = this.trigger;
6350
7398
  preventEventsBeforeInit = this._preventEventsBeforeInit;
6351
7399
  camera.init(this);
7400
+ virtualManager.init();
6352
7401
  renderer.init(this);
6353
7402
  control.init(this);
6354
7403
 
@@ -6375,7 +7424,7 @@ var Flicking = function (_super) {
6375
7424
  _a.sent();
6376
7425
 
6377
7426
  if (this._autoResize) {
6378
- window.addEventListener("resize", this.resize);
7427
+ this._autoResizer.enable();
6379
7428
  }
6380
7429
 
6381
7430
  if (this._preventClickOnDrag) {
@@ -6386,6 +7435,8 @@ var Flicking = function (_super) {
6386
7435
  this.disableInput();
6387
7436
  }
6388
7437
 
7438
+ renderer.checkPanelContentsReady(renderer.panels);
7439
+
6389
7440
  this._plugins.forEach(function (plugin) {
6390
7441
  return plugin.init(_this);
6391
7442
  }); // Done initializing & emit ready event
@@ -6413,9 +7464,9 @@ var Flicking = function (_super) {
6413
7464
 
6414
7465
 
6415
7466
  __proto.destroy = function () {
6416
- if (!this._initialized) return;
6417
7467
  this.off();
6418
- window.removeEventListener("resize", this.resize);
7468
+
7469
+ this._autoResizer.disable();
6419
7470
 
6420
7471
  this._control.destroy();
6421
7472
 
@@ -6632,7 +7683,7 @@ var Flicking = function (_super) {
6632
7683
  * @param {boolean} [options.includePanelHTML=false] Include panel's `outerHTML` to the returning status<ko>패널의 `outerHTML`을 반환값에 포함시킵니다</ko>
6633
7684
  * @param {boolean} [options.visiblePanelsOnly=false] Include only {@link Flicking#visiblePanel visiblePanel}'s HTML. This option is available only when the `includePanelHTML` is true
6634
7685
  * <ko>현재 보이는 패널({@link Flicking#visiblePanel visiblePanel})의 HTML만 반환합니다. `includePanelHTML`이 `true`일 경우에만 동작합니다.</ko>
6635
- * @return {Partial<Status>} An object with current status value information<ko>현재 상태값 정보를 가진 객체.</ko>
7686
+ * @return {Status} An object with current status value information<ko>현재 상태값 정보를 가진 객체.</ko>
6636
7687
  */
6637
7688
 
6638
7689
 
@@ -6712,13 +7763,15 @@ var Flicking = function (_super) {
6712
7763
  if (((_a = panels[0]) === null || _a === void 0 ? void 0 : _a.html) && !this._renderExternal) {
6713
7764
  renderer.batchRemove({
6714
7765
  index: 0,
6715
- deleteCount: this.panels.length
7766
+ deleteCount: this.panels.length,
7767
+ hasDOMInElements: true
6716
7768
  });
6717
7769
  renderer.batchInsert({
6718
7770
  index: 0,
6719
7771
  elements: parseElement(panels.map(function (panel) {
6720
7772
  return panel.html;
6721
- }))
7773
+ })),
7774
+ hasDOMInElements: true
6722
7775
  });
6723
7776
  }
6724
7777
 
@@ -6955,7 +8008,8 @@ var Flicking = function (_super) {
6955
8008
 
6956
8009
  return this._renderer.batchInsert({
6957
8010
  index: index,
6958
- elements: parseElement(element)
8011
+ elements: parseElement(element),
8012
+ hasDOMInElements: true
6959
8013
  });
6960
8014
  };
6961
8015
  /**
@@ -6980,7 +8034,8 @@ var Flicking = function (_super) {
6980
8034
 
6981
8035
  return this._renderer.batchRemove({
6982
8036
  index: index,
6983
- deleteCount: deleteCount
8037
+ deleteCount: deleteCount,
8038
+ hasDOMInElements: true
6984
8039
  });
6985
8040
  };
6986
8041
 
@@ -7030,11 +8085,33 @@ var Flicking = function (_super) {
7030
8085
  };
7031
8086
 
7032
8087
  __proto._createRenderer = function () {
7033
- var rendererOptions = {
8088
+ var externalRenderer = this._externalRenderer;
8089
+
8090
+ if (this._virtual && this._panelsPerView <= 0) {
8091
+ // eslint-disable-next-line no-console
8092
+ console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
8093
+ }
8094
+
8095
+ return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
8096
+ };
8097
+
8098
+ __proto._createExternalRenderer = function () {
8099
+ var _a = this._renderExternal,
8100
+ renderer = _a.renderer,
8101
+ rendererOptions = _a.rendererOptions;
8102
+ return new renderer(__assign({
7034
8103
  align: this._align
7035
- };
7036
- var renderExternal = this._renderExternal;
7037
- return renderExternal ? new renderExternal.renderer(__assign(__assign({}, rendererOptions), renderExternal.rendererOptions)) : new VanillaRenderer(rendererOptions);
8104
+ }, rendererOptions));
8105
+ };
8106
+
8107
+ __proto._createVanillaRenderer = function () {
8108
+ var virtual = this.virtualEnabled;
8109
+ return new VanillaRenderer({
8110
+ align: this._align,
8111
+ strategy: virtual ? new VirtualRenderingStrategy() : new NormalRenderingStrategy({
8112
+ providerCtor: VanillaElementProvider
8113
+ })
8114
+ });
7038
8115
  };
7039
8116
 
7040
8117
  __proto._moveToInitialPanel = function () {
@@ -7047,6 +8124,7 @@ var Flicking = function (_super) {
7047
8124
  if (!initialPanel) return [2
7048
8125
  /*return*/
7049
8126
  ];
8127
+ control.setActive(initialPanel, null, false);
7050
8128
  return [2
7051
8129
  /*return*/
7052
8130
  , control.moveToPanel(initialPanel, {
@@ -7067,36 +8145,10 @@ var Flicking = function (_super) {
7067
8145
  */
7068
8146
 
7069
8147
 
7070
- Flicking.VERSION = "4.2.5";
8148
+ Flicking.VERSION = "4.4.1";
7071
8149
  return Flicking;
7072
8150
  }(Component);
7073
8151
 
7074
- /**
7075
- * An slide data component that holds information of a single HTMLElement
7076
- * @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
7077
- */
7078
-
7079
- var ExternalPanel = function (_super) {
7080
- __extends(ExternalPanel, _super);
7081
- /**
7082
- * @param {object} options An options object<ko>옵션 오브젝트</ko>
7083
- * @param {HTMLElement} [options.el] A `HTMLElement` panel's referencing<ko>패널이 참조하는 `HTMLElement`</ko>
7084
- * @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
7085
- * @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
7086
- * @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
7087
- */
7088
-
7089
-
7090
- function ExternalPanel(options) {
7091
- var _this = _super.call(this, options) || this;
7092
-
7093
- _this._externalComponent = options.externalComponent;
7094
- return _this;
7095
- }
7096
-
7097
- return ExternalPanel;
7098
- }(Panel);
7099
-
7100
8152
  /**
7101
8153
  * Decorator that makes the method of flicking available in the framework.
7102
8154
  * @ko 프레임워크에서 플리킹의 메소드를 사용할 수 있게 하는 데코레이터.
@@ -7248,7 +8300,8 @@ var batchInsert = function (renderer, diffResult, rendered, startIdx, endIdx) {
7248
8300
  renderer.batchInsert.apply(renderer, __spreadArray([], __read(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
7249
8301
  return {
7250
8302
  index: index,
7251
- elements: [rendered[elIdx + diffResult.prevList.length]]
8303
+ elements: [rendered[elIdx + diffResult.prevList.length]],
8304
+ hasDOMInElements: false
7252
8305
  };
7253
8306
  }))));
7254
8307
  };
@@ -7257,7 +8310,8 @@ var batchRemove = function (renderer, startIdx, endIdx) {
7257
8310
  var removed = renderer.panels.slice(startIdx, endIdx);
7258
8311
  renderer.batchRemove({
7259
8312
  index: startIdx,
7260
- deleteCount: removed.length
8313
+ deleteCount: removed.length,
8314
+ hasDOMInElements: false
7261
8315
  });
7262
8316
  };
7263
8317
 
@@ -7281,7 +8335,7 @@ var getRenderingPanels = (function (flicking, diffResult) {
7281
8335
  return panel1.position + panel1.offset - (panel2.position + panel2.offset);
7282
8336
  }).map(function (panel) {
7283
8337
  return diffResult.list[maintainedMap[panel.index]];
7284
- }))), __read(diffResult.added.map(function (idx) {
8338
+ })), false), __read(diffResult.added.map(function (idx) {
7285
8339
  return diffResult.list[idx];
7286
8340
  })));
7287
8341
  });
@@ -7337,5 +8391,5 @@ var parseAlign = function (alignVal) {
7337
8391
  * egjs projects are licensed under the MIT license
7338
8392
  */
7339
8393
 
7340
- export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCamera, Camera, CircularCamera, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ElementPanel, ExternalPanel, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCamera, MOVE_TYPE, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaRenderer, Viewport, Flicking as default, getDefaultCameraTransform, getRenderingPanels, sync, withFlickingMethods };
8394
+ export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCamera, CLASS, Camera, CircularCamera, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCamera, MOVE_TYPE, NormalRenderingStrategy, 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, 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 };
7341
8395
  //# sourceMappingURL=flicking.esm.js.map