@egjs/flicking 4.3.0 → 4.4.2

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 -2
  2. package/declaration/Flicking.d.ts +23 -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 +13 -7
  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 +17 -12
  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 +1401 -421
  28. package/dist/flicking.esm.js.map +1 -1
  29. package/dist/flicking.js +1429 -425
  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 +8683 -8061
  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 +9 -22
  38. package/src/Flicking.ts +146 -30
  39. package/src/camera/BoundCamera.ts +2 -2
  40. package/src/camera/Camera.ts +50 -27
  41. package/src/camera/CircularCamera.ts +52 -27
  42. package/src/camera/LinearCamera.ts +1 -1
  43. package/src/cfc/sync.ts +10 -5
  44. package/src/const/error.ts +6 -3
  45. package/src/const/external.ts +6 -0
  46. package/src/control/AxesController.ts +11 -6
  47. package/src/control/Control.ts +6 -6
  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 +54 -34
  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 +106 -65
  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
package/dist/flicking.js CHANGED
@@ -4,13 +4,13 @@ name: @egjs/flicking
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-flicking
7
- version: 4.3.0
7
+ version: 4.4.2
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
11
11
  typeof define === 'function' && define.amd ? define(['@egjs/component', '@egjs/axes', '@egjs/imready'], factory) :
12
12
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Flicking = factory(global.eg.Component, global.eg.Axes, global.eg.ImReady));
13
- }(this, (function (Component, Axes, ImReady) { 'use strict';
13
+ })(this, (function (Component, Axes, ImReady) { 'use strict';
14
14
 
15
15
  /*! *****************************************************************************
16
16
  Copyright (c) Microsoft Corporation.
@@ -276,6 +276,7 @@ version: 4.3.0
276
276
  * <ko>프레임워크(React, Angular, Vue ...)에서 사용 불가능한 메소드를 호출했을 경우</ko>
277
277
  * @property {number} NOT_INITIALIZED When the {@link Flicking#init} is not called before but is needed<ko>{@link Flicking#init}의 호출이 필요하나, 아직 호출되지 않았을 경우</ko>
278
278
  * @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>
279
+ * @property {number} NOT_ALLOWED_IN_VIRTUAL When the non-allowed method is called while the virtual option is enabled<ko>virtual 옵션이 활성화된 상태에서 사용 불가능한 메소드가 호출되었을 경우</ko>
279
280
  */
280
281
  var CODE = {
281
282
  WRONG_TYPE: 0,
@@ -291,7 +292,8 @@ version: 4.3.0
291
292
  ANIMATION_ALREADY_PLAYING: 10,
292
293
  NOT_ALLOWED_IN_FRAMEWORK: 11,
293
294
  NOT_INITIALIZED: 12,
294
- NO_ACTIVE: 13
295
+ NO_ACTIVE: 13,
296
+ NOT_ALLOWED_IN_VIRTUAL: 14
295
297
  };
296
298
  var MESSAGE = {
297
299
  WRONG_TYPE: function (wrongVal, correctTypes) {
@@ -305,9 +307,7 @@ version: 4.3.0
305
307
  VAL_MUST_NOT_NULL: function (val, name) {
306
308
  return name + " should be provided. Given: " + val;
307
309
  },
308
- NOT_ATTACHED_TO_FLICKING: function (name) {
309
- return name + " is not attached to the Flicking instance. \"init()\" should be called first.";
310
- },
310
+ NOT_ATTACHED_TO_FLICKING: "This module is not attached to the Flicking instance. \"init()\" should be called first.",
311
311
  WRONG_OPTION: function (optionName, val) {
312
312
  return "Option \"" + optionName + "\" is not in correct format, given: " + val;
313
313
  },
@@ -323,7 +323,8 @@ version: 4.3.0
323
323
  ANIMATION_ALREADY_PLAYING: "Animation is already playing.",
324
324
  NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular.",
325
325
  NOT_INITIALIZED: "Flicking is not initialized yet, call init() first.",
326
- NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels."
326
+ NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels.",
327
+ NOT_ALLOWED_IN_VIRTUAL: "This behavior is not allowed when the virtual option is enabled"
327
328
  };
328
329
 
329
330
  /*
@@ -419,6 +420,11 @@ version: 4.3.0
419
420
  FREE_SCROLL: "freeScroll",
420
421
  STRICT: "strict"
421
422
  };
423
+ var CLASS = {
424
+ VERTICAL: "vertical",
425
+ HIDDEN: "flicking-hidden",
426
+ DEFAULT_VIRTUAL: "flicking-panel"
427
+ };
422
428
 
423
429
  var Constants = {
424
430
  __proto__: null,
@@ -426,6 +432,7 @@ version: 4.3.0
426
432
  ALIGN: ALIGN,
427
433
  DIRECTION: DIRECTION,
428
434
  MOVE_TYPE: MOVE_TYPE,
435
+ CLASS: CLASS,
429
436
  ERROR_CODE: CODE
430
437
  };
431
438
 
@@ -473,9 +480,9 @@ version: 4.3.0
473
480
  var clamp = function (x, min, max) {
474
481
  return Math.max(Math.min(x, max), min);
475
482
  };
476
- var getFlickingAttached = function (val, nameToThrowOnError) {
483
+ var getFlickingAttached = function (val) {
477
484
  if (!val) {
478
- throw new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING(nameToThrowOnError), CODE.NOT_ATTACHED_TO_FLICKING);
485
+ throw new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING);
479
486
  }
480
487
 
481
488
  return val;
@@ -591,6 +598,12 @@ version: 4.3.0
591
598
 
592
599
  return parsed;
593
600
  };
601
+ var parseCSSSizeValue = function (val) {
602
+ return isString(val) ? val : val + "px";
603
+ };
604
+ var parsePanelAlign = function (align) {
605
+ return typeof align === "object" ? align.panel : align;
606
+ };
594
607
  var getDirection = function (start, end) {
595
608
  if (start === end) return DIRECTION.NONE;
596
609
  return start < end ? DIRECTION.NEXT : DIRECTION.PREV;
@@ -684,6 +697,17 @@ version: 4.3.0
684
697
 
685
698
  return null;
686
699
  };
700
+ var findRight = function (array, checker) {
701
+ for (var idx = array.length - 1; idx >= 0; idx--) {
702
+ var val = array[idx];
703
+
704
+ if (checker(val)) {
705
+ return val;
706
+ }
707
+ }
708
+
709
+ return null;
710
+ };
687
711
  var findIndex = function (array, checker) {
688
712
  for (var idx = 0; idx < array.length; idx++) {
689
713
  if (checker(array[idx])) {
@@ -700,6 +724,26 @@ version: 4.3.0
700
724
  var getStyle = function (el) {
701
725
  return window.getComputedStyle(el) || el.currentStyle;
702
726
  };
727
+ var setSize = function (el, _a) {
728
+ var width = _a.width,
729
+ height = _a.height;
730
+
731
+ if (width != null) {
732
+ if (isString(width)) {
733
+ el.style.width = width;
734
+ } else {
735
+ el.style.width = width + "px";
736
+ }
737
+ }
738
+
739
+ if (height != null) {
740
+ if (isString(height)) {
741
+ el.style.height = height;
742
+ } else {
743
+ el.style.height = height + "px";
744
+ }
745
+ }
746
+ };
703
747
  var isBetween = function (val, min, max) {
704
748
  return val >= min && val <= max;
705
749
  };
@@ -712,11 +756,52 @@ version: 4.3.0
712
756
  return index;
713
757
  }
714
758
  };
759
+ var range = function (end) {
760
+ var arr = new Array(end);
761
+
762
+ for (var i = 0; i < end; i++) {
763
+ arr[i] = i;
764
+ }
765
+
766
+ return arr;
767
+ };
715
768
  var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
716
769
  obj.__proto__ = proto;
717
770
  return obj;
718
771
  };
719
772
 
773
+ var Utils = {
774
+ __proto__: null,
775
+ merge: merge,
776
+ getElement: getElement,
777
+ checkExistence: checkExistence,
778
+ clamp: clamp,
779
+ getFlickingAttached: getFlickingAttached,
780
+ toArray: toArray,
781
+ parseAlign: parseAlign$1,
782
+ parseBounce: parseBounce,
783
+ parseArithmeticSize: parseArithmeticSize,
784
+ parseArithmeticExpression: parseArithmeticExpression,
785
+ parseCSSSizeValue: parseCSSSizeValue,
786
+ parsePanelAlign: parsePanelAlign,
787
+ getDirection: getDirection,
788
+ parseElement: parseElement,
789
+ getMinusCompensatedIndex: getMinusCompensatedIndex,
790
+ includes: includes,
791
+ isString: isString,
792
+ circulatePosition: circulatePosition,
793
+ find: find,
794
+ findRight: findRight,
795
+ findIndex: findIndex,
796
+ getProgress: getProgress,
797
+ getStyle: getStyle,
798
+ setSize: setSize,
799
+ isBetween: isBetween,
800
+ circulateIndex: circulateIndex,
801
+ range: range,
802
+ setPrototypeOf: setPrototypeOf
803
+ };
804
+
720
805
  /*
721
806
  * Copyright (c) 2015 NAVER Corp.
722
807
  * egjs projects are licensed under the MIT license
@@ -740,7 +825,9 @@ version: 4.3.0
740
825
  * ```
741
826
  */
742
827
 
743
- var FlickingError = function (_super) {
828
+ var FlickingError =
829
+ /*#__PURE__*/
830
+ function (_super) {
744
831
  __extends(FlickingError, _super);
745
832
  /**
746
833
  * @param message Error message<ko>에러 메시지</ko>
@@ -769,7 +856,9 @@ version: 4.3.0
769
856
  * @ko 뷰포트 크기 정보를 담당하는 컴포넌트
770
857
  */
771
858
 
772
- var Viewport = function () {
859
+ var Viewport =
860
+ /*#__PURE__*/
861
+ function () {
773
862
  /**
774
863
  * @param el A viewport element<ko>뷰포트 엘리먼트</ko>
775
864
  */
@@ -892,10 +981,10 @@ version: 4.3.0
892
981
  this._width = el.clientWidth;
893
982
  this._height = el.clientHeight;
894
983
  this._padding = {
895
- left: parseFloat(elStyle.paddingLeft),
896
- right: parseFloat(elStyle.paddingRight),
897
- top: parseFloat(elStyle.paddingTop),
898
- bottom: parseFloat(elStyle.paddingBottom)
984
+ left: elStyle.paddingLeft ? parseFloat(elStyle.paddingLeft) : 0,
985
+ right: elStyle.paddingRight ? parseFloat(elStyle.paddingRight) : 0,
986
+ top: elStyle.paddingTop ? parseFloat(elStyle.paddingTop) : 0,
987
+ bottom: elStyle.paddingBottom ? parseFloat(elStyle.paddingBottom) : 0
899
988
  };
900
989
  this._isBorderBoxSizing = elStyle.boxSizing === "border-box";
901
990
  };
@@ -903,6 +992,412 @@ version: 4.3.0
903
992
  return Viewport;
904
993
  }();
905
994
 
995
+ var AutoResizer =
996
+ /*#__PURE__*/
997
+ function () {
998
+ function AutoResizer(flicking) {
999
+ var _this = this;
1000
+
1001
+ this._onResize = function () {
1002
+ void _this._flicking.resize();
1003
+ }; // eslint-disable-next-line @typescript-eslint/member-ordering
1004
+
1005
+
1006
+ this._skipFirstResize = function () {
1007
+ var isFirstResize = true;
1008
+ return function () {
1009
+ if (isFirstResize) {
1010
+ isFirstResize = false;
1011
+ return;
1012
+ }
1013
+
1014
+ _this._onResize();
1015
+ };
1016
+ }();
1017
+
1018
+ this._flicking = flicking;
1019
+ this._enabled = false;
1020
+ this._resizeObserver = null;
1021
+ }
1022
+
1023
+ var __proto = AutoResizer.prototype;
1024
+ Object.defineProperty(__proto, "enabled", {
1025
+ get: function () {
1026
+ return this._enabled;
1027
+ },
1028
+ enumerable: false,
1029
+ configurable: true
1030
+ });
1031
+
1032
+ __proto.enable = function () {
1033
+ var flicking = this._flicking;
1034
+ var viewport = flicking.viewport;
1035
+
1036
+ if (this._enabled) {
1037
+ this.disable();
1038
+ }
1039
+
1040
+ if (flicking.useResizeObserver && !!window.ResizeObserver) {
1041
+ var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
1042
+ var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
1043
+ resizeObserver.observe(flicking.viewport.element);
1044
+ this._resizeObserver = resizeObserver;
1045
+ } else {
1046
+ window.addEventListener("resize", this._onResize);
1047
+ }
1048
+
1049
+ this._enabled = true;
1050
+ return this;
1051
+ };
1052
+
1053
+ __proto.disable = function () {
1054
+ if (!this._enabled) return this;
1055
+ var resizeObserver = this._resizeObserver;
1056
+
1057
+ if (resizeObserver) {
1058
+ resizeObserver.disconnect();
1059
+ this._resizeObserver = null;
1060
+ } else {
1061
+ window.removeEventListener("resize", this._onResize);
1062
+ }
1063
+
1064
+ this._enabled = false;
1065
+ return this;
1066
+ };
1067
+
1068
+ return AutoResizer;
1069
+ }();
1070
+
1071
+ /**
1072
+ * @internal
1073
+ */
1074
+ var VanillaElementProvider =
1075
+ /*#__PURE__*/
1076
+ function () {
1077
+ function VanillaElementProvider(element) {
1078
+ this._element = element;
1079
+ this._rendered = true;
1080
+ }
1081
+
1082
+ var __proto = VanillaElementProvider.prototype;
1083
+ Object.defineProperty(__proto, "element", {
1084
+ get: function () {
1085
+ return this._element;
1086
+ },
1087
+ enumerable: false,
1088
+ configurable: true
1089
+ });
1090
+ Object.defineProperty(__proto, "rendered", {
1091
+ get: function () {
1092
+ return this._rendered;
1093
+ },
1094
+ enumerable: false,
1095
+ configurable: true
1096
+ });
1097
+
1098
+ __proto.show = function (flicking) {
1099
+ var el = this.element;
1100
+ var cameraEl = flicking.camera.element;
1101
+
1102
+ if (el.parentElement !== cameraEl) {
1103
+ cameraEl.appendChild(el);
1104
+ this._rendered = true;
1105
+ }
1106
+ };
1107
+
1108
+ __proto.hide = function (flicking) {
1109
+ var el = this.element;
1110
+ var cameraEl = flicking.camera.element;
1111
+
1112
+ if (el.parentElement === cameraEl) {
1113
+ cameraEl.removeChild(el);
1114
+ this._rendered = false;
1115
+ }
1116
+ };
1117
+
1118
+ return VanillaElementProvider;
1119
+ }();
1120
+
1121
+ /*
1122
+ * Copyright (c) 2015 NAVER Corp.
1123
+ * egjs projects are licensed under the MIT license
1124
+ */
1125
+
1126
+ /**
1127
+ * @internal
1128
+ */
1129
+ var VirtualElementProvider =
1130
+ /*#__PURE__*/
1131
+ function () {
1132
+ function VirtualElementProvider(flicking) {
1133
+ this._flicking = flicking;
1134
+ }
1135
+
1136
+ var __proto = VirtualElementProvider.prototype;
1137
+ Object.defineProperty(__proto, "element", {
1138
+ get: function () {
1139
+ return this._virtualElement.nativeElement;
1140
+ },
1141
+ enumerable: false,
1142
+ configurable: true
1143
+ });
1144
+ Object.defineProperty(__proto, "rendered", {
1145
+ get: function () {
1146
+ return this._virtualElement.visible;
1147
+ },
1148
+ enumerable: false,
1149
+ configurable: true
1150
+ });
1151
+ Object.defineProperty(__proto, "_virtualElement", {
1152
+ get: function () {
1153
+ var flicking = this._flicking;
1154
+ var elIndex = this._panel.elementIndex;
1155
+ var virtualElements = flicking.virtual.elements;
1156
+ return virtualElements[elIndex];
1157
+ },
1158
+ enumerable: false,
1159
+ configurable: true
1160
+ });
1161
+
1162
+ __proto.init = function (panel) {
1163
+ this._panel = panel;
1164
+ };
1165
+
1166
+ __proto.show = function () {// DO_NOTHING
1167
+ // Actual element visibility is controlled by VirtualManager
1168
+ };
1169
+
1170
+ __proto.hide = function () {// DO_NOTHING
1171
+ // Actual element visibility is controlled by VirtualManager
1172
+ };
1173
+
1174
+ return VirtualElementProvider;
1175
+ }();
1176
+
1177
+ /**
1178
+ * A manager class to add / remove virtual panels
1179
+ */
1180
+
1181
+ var VirtualManager =
1182
+ /*#__PURE__*/
1183
+ function () {
1184
+ function VirtualManager(flicking, options) {
1185
+ var _a, _b, _c, _d;
1186
+
1187
+ this._flicking = flicking;
1188
+ this._renderPanel = (_a = options === null || options === void 0 ? void 0 : options.renderPanel) !== null && _a !== void 0 ? _a : function () {
1189
+ return "";
1190
+ };
1191
+ this._initialPanelCount = (_b = options === null || options === void 0 ? void 0 : options.initialPanelCount) !== null && _b !== void 0 ? _b : -1;
1192
+ this._cache = (_c = options === null || options === void 0 ? void 0 : options.cache) !== null && _c !== void 0 ? _c : false;
1193
+ this._panelClass = (_d = options === null || options === void 0 ? void 0 : options.panelClass) !== null && _d !== void 0 ? _d : CLASS.DEFAULT_VIRTUAL;
1194
+ this._elements = [];
1195
+ }
1196
+
1197
+ var __proto = VirtualManager.prototype;
1198
+ Object.defineProperty(__proto, "elements", {
1199
+ get: function () {
1200
+ return this._elements;
1201
+ },
1202
+ enumerable: false,
1203
+ configurable: true
1204
+ });
1205
+ Object.defineProperty(__proto, "renderPanel", {
1206
+ // Options
1207
+
1208
+ /**
1209
+ * A rendering function for the panel element's innerHTML
1210
+ * @ko 패널 엘리먼트의 innerHTML을 렌더링하는 함수
1211
+ * @type {function}
1212
+ * @param {VirtualPanel} panel Instance of the panel<ko>패널 인스턴스</ko>
1213
+ * @param {number} index Index of the panel<ko>패널 인덱스</ko>
1214
+ * @default "() => {}"
1215
+ */
1216
+ get: function () {
1217
+ return this._renderPanel;
1218
+ },
1219
+ set: function (val) {
1220
+ this._renderPanel = val;
1221
+
1222
+ this._flicking.renderer.panels.forEach(function (panel) {
1223
+ return panel.uncacheRenderResult();
1224
+ });
1225
+ },
1226
+ enumerable: false,
1227
+ configurable: true
1228
+ });
1229
+ Object.defineProperty(__proto, "initialPanelCount", {
1230
+ /**
1231
+ * Initial panel count to render
1232
+ * @ko 최초로 렌더링할 패널의 개수
1233
+ * @readonly
1234
+ * @type {number}
1235
+ * @default -1
1236
+ */
1237
+ get: function () {
1238
+ return this._initialPanelCount;
1239
+ },
1240
+ enumerable: false,
1241
+ configurable: true
1242
+ });
1243
+ Object.defineProperty(__proto, "cache", {
1244
+ /**
1245
+ * Whether to cache rendered panel's innerHTML
1246
+ * @ko 렌더링된 패널의 innerHTML 정보를 캐시할지 여부
1247
+ * @type {boolean}
1248
+ * @default false
1249
+ */
1250
+ get: function () {
1251
+ return this._cache;
1252
+ },
1253
+ set: function (val) {
1254
+ this._cache = val;
1255
+ },
1256
+ enumerable: false,
1257
+ configurable: true
1258
+ });
1259
+ Object.defineProperty(__proto, "panelClass", {
1260
+ /**
1261
+ * The class name that will be applied to rendered panel elements
1262
+ * @ko 렌더링되는 패널 엘리먼트에 적용될 클래스 이름
1263
+ * @type {string}
1264
+ * @default "flicking-panel"
1265
+ */
1266
+ get: function () {
1267
+ return this._panelClass;
1268
+ },
1269
+ set: function (val) {
1270
+ this._panelClass = val;
1271
+ },
1272
+ enumerable: false,
1273
+ configurable: true
1274
+ });
1275
+
1276
+ __proto.init = function () {
1277
+ var flicking = this._flicking;
1278
+ if (!flicking.virtualEnabled) return;
1279
+
1280
+ if (!flicking.externalRenderer && !flicking.renderExternal) {
1281
+ this._initVirtualElements();
1282
+ }
1283
+
1284
+ var virtualElements = flicking.camera.children;
1285
+ this._elements = virtualElements.map(function (el) {
1286
+ return {
1287
+ nativeElement: el,
1288
+ visible: true
1289
+ };
1290
+ });
1291
+ };
1292
+
1293
+ __proto.show = function (index) {
1294
+ var el = this._elements[index];
1295
+ var nativeEl = el.nativeElement;
1296
+ el.visible = true;
1297
+
1298
+ if (nativeEl.style.display) {
1299
+ nativeEl.style.display = "";
1300
+ }
1301
+ };
1302
+
1303
+ __proto.hide = function (index) {
1304
+ var el = this._elements[index];
1305
+ var nativeEl = el.nativeElement;
1306
+ el.visible = false;
1307
+ nativeEl.style.display = "none";
1308
+ };
1309
+ /**
1310
+ * Add new virtual panels at the end of the list
1311
+ * @ko 새로운 가상 패널들을 리스트의 끝에 추가합니다
1312
+ * @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
1313
+ * @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
1314
+ */
1315
+
1316
+
1317
+ __proto.append = function (count) {
1318
+ if (count === void 0) {
1319
+ count = 1;
1320
+ }
1321
+
1322
+ var flicking = this._flicking;
1323
+ return this.insert(flicking.panels.length, count);
1324
+ };
1325
+ /**
1326
+ * Add new virtual panels at the start of the list
1327
+ * @ko 새로운 가상 패널들을 리스트의 시작에 추가합니다
1328
+ * @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
1329
+ * @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
1330
+ */
1331
+
1332
+
1333
+ __proto.prepend = function (count) {
1334
+ if (count === void 0) {
1335
+ count = 1;
1336
+ }
1337
+
1338
+ return this.insert(0, count);
1339
+ };
1340
+ /**
1341
+ * Add new virtual panels at the given index
1342
+ * @ko 새로운 가상 패널들을 주어진 인덱스에 추가합니다
1343
+ * @param {number} count The number of panels to add<ko>추가할 패널의 개수</ko>
1344
+ * @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
1345
+ */
1346
+
1347
+
1348
+ __proto.insert = function (index, count) {
1349
+ if (count === void 0) {
1350
+ count = 1;
1351
+ }
1352
+
1353
+ if (count <= 0) return [];
1354
+ var flicking = this._flicking;
1355
+ return flicking.renderer.batchInsert({
1356
+ index: index,
1357
+ elements: range(count),
1358
+ hasDOMInElements: false
1359
+ });
1360
+ };
1361
+ /**
1362
+ * Remove panels at the given index
1363
+ * @ko 주어진 인덱스에서 패널들을 삭제합니다
1364
+ * @param {number} count The number of panels to remove<ko>삭제할 패널의 개수</ko>
1365
+ * @returns {Array<VirtualPanel>} The panels removed<ko>삭제된 패널들</ko>
1366
+ */
1367
+
1368
+
1369
+ __proto.remove = function (index, count) {
1370
+ if (count <= 0) return [];
1371
+ var flicking = this._flicking;
1372
+ return flicking.renderer.batchRemove({
1373
+ index: index,
1374
+ deleteCount: count,
1375
+ hasDOMInElements: false
1376
+ });
1377
+ };
1378
+
1379
+ __proto._initVirtualElements = function () {
1380
+ var _this = this;
1381
+
1382
+ var flicking = this._flicking;
1383
+ var cameraElement = flicking.camera.element;
1384
+ var panelsPerView = flicking.panelsPerView;
1385
+ var fragment = document.createDocumentFragment();
1386
+ var newElements = range(panelsPerView + 1).map(function (idx) {
1387
+ var panelEl = document.createElement("div");
1388
+ panelEl.className = _this._panelClass;
1389
+ panelEl.dataset.elementIndex = idx.toString();
1390
+ return panelEl;
1391
+ });
1392
+ newElements.forEach(function (el) {
1393
+ fragment.appendChild(el);
1394
+ });
1395
+ cameraElement.appendChild(fragment);
1396
+ };
1397
+
1398
+ return VirtualManager;
1399
+ }();
1400
+
906
1401
  /**
907
1402
  * All possible @egjs/axes event keys
908
1403
  * @internal
@@ -937,7 +1432,9 @@ version: 4.3.0
937
1432
  */
938
1433
 
939
1434
 
940
- var State = function () {
1435
+ var State =
1436
+ /*#__PURE__*/
1437
+ function () {
941
1438
  function State() {
942
1439
  this._delta = 0;
943
1440
  this._targetPanel = null;
@@ -1094,7 +1591,9 @@ version: 4.3.0
1094
1591
  * @internal
1095
1592
  */
1096
1593
 
1097
- var IdleState = function (_super) {
1594
+ var IdleState =
1595
+ /*#__PURE__*/
1596
+ function (_super) {
1098
1597
  __extends(IdleState, _super);
1099
1598
 
1100
1599
  function IdleState() {
@@ -1181,7 +1680,9 @@ version: 4.3.0
1181
1680
  * @internal
1182
1681
  */
1183
1682
 
1184
- var HoldingState = function (_super) {
1683
+ var HoldingState =
1684
+ /*#__PURE__*/
1685
+ function (_super) {
1185
1686
  __extends(HoldingState, _super);
1186
1687
 
1187
1688
  function HoldingState() {
@@ -1334,7 +1835,9 @@ version: 4.3.0
1334
1835
  * @internal
1335
1836
  */
1336
1837
 
1337
- var DraggingState = function (_super) {
1838
+ var DraggingState =
1839
+ /*#__PURE__*/
1840
+ function (_super) {
1338
1841
  __extends(DraggingState, _super);
1339
1842
 
1340
1843
  function DraggingState() {
@@ -1397,7 +1900,9 @@ version: 4.3.0
1397
1900
  * @internal
1398
1901
  */
1399
1902
 
1400
- var AnimatingState = function (_super) {
1903
+ var AnimatingState =
1904
+ /*#__PURE__*/
1905
+ function (_super) {
1401
1906
  __extends(AnimatingState, _super);
1402
1907
 
1403
1908
  function AnimatingState() {
@@ -1471,7 +1976,9 @@ version: 4.3.0
1471
1976
  * @internal
1472
1977
  */
1473
1978
 
1474
- var DisabledState = function (_super) {
1979
+ var DisabledState =
1980
+ /*#__PURE__*/
1981
+ function (_super) {
1475
1982
  __extends(DisabledState, _super);
1476
1983
 
1477
1984
  function DisabledState() {
@@ -1527,7 +2034,9 @@ version: 4.3.0
1527
2034
  * @internal
1528
2035
  */
1529
2036
 
1530
- var StateMachine = function () {
2037
+ var StateMachine =
2038
+ /*#__PURE__*/
2039
+ function () {
1531
2040
  function StateMachine() {
1532
2041
  var _this = this;
1533
2042
 
@@ -1616,7 +2125,9 @@ version: 4.3.0
1616
2125
  * @internal
1617
2126
  */
1618
2127
 
1619
- var AxesController = function () {
2128
+ var AxesController =
2129
+ /*#__PURE__*/
2130
+ function () {
1620
2131
  /** */
1621
2132
  function AxesController() {
1622
2133
  var _this = this;
@@ -1899,7 +2410,7 @@ version: 4.3.0
1899
2410
  __proto.update = function (controlParams) {
1900
2411
  var _a;
1901
2412
 
1902
- var flicking = getFlickingAttached(this._flicking, "Control");
2413
+ var flicking = getFlickingAttached(this._flicking);
1903
2414
  var camera = flicking.camera;
1904
2415
  var axes = this._axes;
1905
2416
  var axis = axes.axis[POSITION_KEY];
@@ -1917,7 +2428,7 @@ version: 4.3.0
1917
2428
 
1918
2429
 
1919
2430
  __proto.addPreventClickHandler = function () {
1920
- var flicking = getFlickingAttached(this._flicking, "Control");
2431
+ var flicking = getFlickingAttached(this._flicking);
1921
2432
  var axes = this._axes;
1922
2433
  var cameraEl = flicking.camera.element;
1923
2434
  axes.on(EVENT.HOLD, this._onAxesHold);
@@ -1933,7 +2444,7 @@ version: 4.3.0
1933
2444
 
1934
2445
 
1935
2446
  __proto.removePreventClickHandler = function () {
1936
- var flicking = getFlickingAttached(this._flicking, "Control");
2447
+ var flicking = getFlickingAttached(this._flicking);
1937
2448
  var axes = this._axes;
1938
2449
  var cameraEl = flicking.camera.element;
1939
2450
  axes.off(EVENT.HOLD, this._onAxesHold);
@@ -1969,17 +2480,25 @@ version: 4.3.0
1969
2480
 
1970
2481
  var _this = this;
1971
2482
 
2483
+ var _b;
2484
+
1972
2485
  var axes = this._axes;
2486
+ var state = this._stateMachine.state;
1973
2487
 
1974
2488
  if (!axes) {
1975
- return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING("Control"), CODE.NOT_ATTACHED_TO_FLICKING));
2489
+ return Promise.reject(new FlickingError(MESSAGE.NOT_ATTACHED_TO_FLICKING, CODE.NOT_ATTACHED_TO_FLICKING));
1976
2490
  }
1977
2491
 
1978
2492
  var startPos = axes.get([POSITION_KEY])[POSITION_KEY];
1979
2493
 
1980
2494
  if (startPos === position) {
1981
- var flicking = getFlickingAttached(this._flicking, "Control");
2495
+ var flicking = getFlickingAttached(this._flicking);
1982
2496
  flicking.camera.lookAt(position);
2497
+
2498
+ if (state.targetPanel) {
2499
+ flicking.control.setActive(state.targetPanel, flicking.control.activePanel, (_b = axesEvent === null || axesEvent === void 0 ? void 0 : axesEvent.isTrusted) !== null && _b !== void 0 ? _b : false);
2500
+ }
2501
+
1983
2502
  return Promise.resolve();
1984
2503
  }
1985
2504
 
@@ -2010,7 +2529,7 @@ version: 4.3.0
2010
2529
  };
2011
2530
 
2012
2531
  if (duration === 0) {
2013
- var flicking = getFlickingAttached(this._flicking, "Control");
2532
+ var flicking = getFlickingAttached(this._flicking);
2014
2533
  var camera = flicking.camera;
2015
2534
  animate();
2016
2535
  var newPos = flicking.circularEnabled ? circulatePosition(position, camera.range.min, camera.range.max) : position;
@@ -2055,7 +2574,9 @@ version: 4.3.0
2055
2574
  * @ko Flicking의 입력 장치 & 애니메이션을 담당하는 컴포넌트
2056
2575
  */
2057
2576
 
2058
- var Control$1 = function () {
2577
+ var Control$1 =
2578
+ /*#__PURE__*/
2579
+ function () {
2059
2580
  /** */
2060
2581
  function Control() {
2061
2582
  this._flicking = null;
@@ -2199,7 +2720,7 @@ version: 4.3.0
2199
2720
 
2200
2721
 
2201
2722
  __proto.updatePosition = function (_progressInPanel) {
2202
- var flicking = getFlickingAttached(this._flicking, "Control");
2723
+ var flicking = getFlickingAttached(this._flicking);
2203
2724
  var camera = flicking.camera;
2204
2725
  var activePanel = this._activePanel;
2205
2726
 
@@ -2216,7 +2737,7 @@ version: 4.3.0
2216
2737
 
2217
2738
 
2218
2739
  __proto.updateInput = function () {
2219
- var flicking = getFlickingAttached(this._flicking, "Control");
2740
+ var flicking = getFlickingAttached(this._flicking);
2220
2741
  var camera = flicking.camera;
2221
2742
 
2222
2743
  this._controller.update(camera.controlParams);
@@ -2283,7 +2804,7 @@ version: 4.3.0
2283
2804
  return __awaiter(this, void 0, void 0, function () {
2284
2805
  var flicking, camera, position, nearestAnchor, camPos_1, camRangeDiff, possiblePositions;
2285
2806
  return __generator(this, function (_c) {
2286
- flicking = getFlickingAttached(this._flicking, "Control");
2807
+ flicking = getFlickingAttached(this._flicking);
2287
2808
  camera = flicking.camera;
2288
2809
  position = panel.position;
2289
2810
  nearestAnchor = camera.findNearestAnchor(position);
@@ -2335,7 +2856,7 @@ version: 4.3.0
2335
2856
  __proto.setActive = function (newActivePanel, prevActivePanel, isTrusted) {
2336
2857
  var _a;
2337
2858
 
2338
- var flicking = getFlickingAttached(this._flicking, "Control");
2859
+ var flicking = getFlickingAttached(this._flicking);
2339
2860
  this._activePanel = newActivePanel;
2340
2861
  flicking.camera.updateAdaptiveHeight();
2341
2862
 
@@ -2358,7 +2879,7 @@ version: 4.3.0
2358
2879
  __proto._triggerIndexChangeEvent = function (panel, position, axesEvent) {
2359
2880
  var _a;
2360
2881
 
2361
- var flicking = getFlickingAttached(this._flicking, "Control");
2882
+ var flicking = getFlickingAttached(this._flicking);
2362
2883
  var triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
2363
2884
  var camera = flicking.camera;
2364
2885
  var activePanel = this._activePanel;
@@ -2386,7 +2907,7 @@ version: 4.3.0
2386
2907
  var _this = this;
2387
2908
 
2388
2909
  return __generator(this, function (_b) {
2389
- flicking = getFlickingAttached(this._flicking, "Control");
2910
+ flicking = getFlickingAttached(this._flicking);
2390
2911
 
2391
2912
  animate = function () {
2392
2913
  return _this._controller.animateTo(position, duration, axesEvent);
@@ -2436,7 +2957,9 @@ version: 4.3.0
2436
2957
  * A data component that has actual position where the camera should be stopped at
2437
2958
  * @ko 카메라가 정지해야하는 실제 위치를 담고 있는 데이터 컴포넌트
2438
2959
  */
2439
- var AnchorPoint = function () {
2960
+ var AnchorPoint =
2961
+ /*#__PURE__*/
2962
+ function () {
2440
2963
  /**
2441
2964
  * @param {object} options An options object<ko>옵션 객체</ko>
2442
2965
  * @param {number} [options.index] Index of AnchorPoint<ko>AnchorPoint의 인덱스</ko>
@@ -2500,7 +3023,9 @@ version: 4.3.0
2500
3023
  * @ko 입력을 중단한 시점의 가속도에 영향받아 도달할 패널을 계산하는 이동 방식을 사용하는 {@link Control}
2501
3024
  */
2502
3025
 
2503
- var SnapControl = function (_super) {
3026
+ var SnapControl =
3027
+ /*#__PURE__*/
3028
+ function (_super) {
2504
3029
  __extends(SnapControl, _super);
2505
3030
  /** */
2506
3031
 
@@ -2574,7 +3099,7 @@ version: 4.3.0
2574
3099
  return __awaiter(this, void 0, void 0, function () {
2575
3100
  var flicking, camera, activeAnchor, anchorAtCamera, state, snapThreshold, posDelta, absPosDelta, snapDelta, targetAnchor;
2576
3101
  return __generator(this, function (_a) {
2577
- flicking = getFlickingAttached(this._flicking, "Control");
3102
+ flicking = getFlickingAttached(this._flicking);
2578
3103
  camera = flicking.camera;
2579
3104
  activeAnchor = camera.findActiveAnchor();
2580
3105
  anchorAtCamera = camera.findNearestAnchor(camera.position);
@@ -2617,7 +3142,7 @@ version: 4.3.0
2617
3142
  };
2618
3143
 
2619
3144
  __proto._findSnappedAnchor = function (position, anchorAtCamera) {
2620
- var flicking = getFlickingAttached(this._flicking, "Control");
3145
+ var flicking = getFlickingAttached(this._flicking);
2621
3146
  var camera = flicking.camera;
2622
3147
  var count = this._count;
2623
3148
  var currentPos = camera.position;
@@ -2677,7 +3202,7 @@ version: 4.3.0
2677
3202
  __proto._findAdjacentAnchor = function (posDelta, anchorAtCamera) {
2678
3203
  var _a;
2679
3204
 
2680
- var flicking = getFlickingAttached(this._flicking, "Control");
3205
+ var flicking = getFlickingAttached(this._flicking);
2681
3206
  var camera = flicking.camera;
2682
3207
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
2683
3208
  return adjacentAnchor;
@@ -2706,7 +3231,9 @@ version: 4.3.0
2706
3231
  * @ko 패널이 정해진 지점에 정렬되지 않고, 자유롭게 스크롤할 수 있는 이동 방식을 사용하는 {@link Control}
2707
3232
  */
2708
3233
 
2709
- var FreeControl = function (_super) {
3234
+ var FreeControl =
3235
+ /*#__PURE__*/
3236
+ function (_super) {
2710
3237
  __extends(FreeControl, _super);
2711
3238
  /** */
2712
3239
 
@@ -2751,7 +3278,7 @@ version: 4.3.0
2751
3278
  */
2752
3279
 
2753
3280
  __proto.updatePosition = function (progressInPanel) {
2754
- var flicking = getFlickingAttached(this._flicking, "Control");
3281
+ var flicking = getFlickingAttached(this._flicking);
2755
3282
  var camera = flicking.camera;
2756
3283
  var activePanel = this._activePanel;
2757
3284
 
@@ -2803,7 +3330,7 @@ version: 4.3.0
2803
3330
  return __awaiter(this, void 0, void 0, function () {
2804
3331
  var flicking, camera, targetPos, anchorAtPosition, targetPanel;
2805
3332
  return __generator(this, function (_a) {
2806
- flicking = getFlickingAttached(this._flicking, "Control");
3333
+ flicking = getFlickingAttached(this._flicking);
2807
3334
  camera = flicking.camera;
2808
3335
  targetPos = camera.clampToReachablePosition(position);
2809
3336
  anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
@@ -2840,7 +3367,9 @@ version: 4.3.0
2840
3367
  * @ko 한번에 최대로 이동할 패널의 개수를 선택 가능한 {@link Control}
2841
3368
  */
2842
3369
 
2843
- var StrictControl = function (_super) {
3370
+ var StrictControl =
3371
+ /*#__PURE__*/
3372
+ function (_super) {
2844
3373
  __extends(StrictControl, _super);
2845
3374
  /** */
2846
3375
 
@@ -2904,7 +3433,7 @@ version: 4.3.0
2904
3433
  __proto.updateInput = function () {
2905
3434
  var _a;
2906
3435
 
2907
- var flicking = getFlickingAttached(this._flicking, "Control");
3436
+ var flicking = getFlickingAttached(this._flicking);
2908
3437
  var camera = flicking.camera;
2909
3438
  var renderer = flicking.renderer;
2910
3439
  var controller = this._controller;
@@ -3013,7 +3542,7 @@ version: 4.3.0
3013
3542
  return __awaiter(this, void 0, void 0, function () {
3014
3543
  var flicking, camera, activePanel, axesRange, indexRange, cameraRange, clampedPosition, anchorAtPosition, prevPos, isOverThreshold, adjacentAnchor, targetPos, targetPanel, anchors, firstAnchor, lastAnchor, shouldBounceToFirst, shouldBounceToLast, targetAnchor;
3015
3544
  return __generator(this, function (_a) {
3016
- flicking = getFlickingAttached(this._flicking, "Control");
3545
+ flicking = getFlickingAttached(this._flicking);
3017
3546
  camera = flicking.camera;
3018
3547
  activePanel = this._activePanel;
3019
3548
  axesRange = this._controller.range;
@@ -3105,7 +3634,9 @@ version: 4.3.0
3105
3634
  * @ko 뷰포트 내에서의 실제 움직임을 담당하는 컴포넌트
3106
3635
  */
3107
3636
 
3108
- var Camera$1 = function () {
3637
+ var Camera$1 =
3638
+ /*#__PURE__*/
3639
+ function () {
3109
3640
  /** */
3110
3641
  function Camera(_a) {
3111
3642
  var _this = this;
@@ -3161,8 +3692,8 @@ version: 4.3.0
3161
3692
  // Internal states getter
3162
3693
 
3163
3694
  /**
3164
- * The camera(`.flicking-camera`) element
3165
- * @ko 카메라(`.flicking-camera`) 엘리먼트
3695
+ * The camera element(`.flicking-camera`)
3696
+ * @ko 카메라 엘리먼트(`.flicking-camera`)
3166
3697
  * @type {HTMLElement}
3167
3698
  * @readonly
3168
3699
  */
@@ -3172,6 +3703,19 @@ version: 4.3.0
3172
3703
  enumerable: false,
3173
3704
  configurable: true
3174
3705
  });
3706
+ Object.defineProperty(__proto, "children", {
3707
+ /**
3708
+ * An array of the child elements of the camera element(`.flicking-camera`)
3709
+ * @ko 카메라 엘리먼트(`.flicking-camera`)의 자식 엘리먼트 배열
3710
+ * @type {HTMLElement[]}
3711
+ * @readonly
3712
+ */
3713
+ get: function () {
3714
+ return toArray(this._el.children);
3715
+ },
3716
+ enumerable: false,
3717
+ configurable: true
3718
+ });
3175
3719
  Object.defineProperty(__proto, "position", {
3176
3720
  /**
3177
3721
  * Current position of the camera
@@ -3218,7 +3762,7 @@ version: 4.3.0
3218
3762
  * @ko Camera의 {@link Camera#position position}이 도달 가능한 범위
3219
3763
  * @type {object}
3220
3764
  * @property {number} min A minimum position<ko>최소 위치</ko>
3221
- * @property {number} min A maximum position<ko>최대 위치</ko>
3765
+ * @property {number} max A maximum position<ko>최대 위치</ko>
3222
3766
  * @readonly
3223
3767
  */
3224
3768
  get: function () {
@@ -3455,7 +3999,7 @@ version: 4.3.0
3455
3999
 
3456
4000
  this._checkReachEnd(prevPos, pos);
3457
4001
 
3458
- this._applyTransform();
4002
+ this.applyTransform();
3459
4003
  };
3460
4004
  /**
3461
4005
  * Return a previous {@link AnchorPoint} of given {@link AnchorPoint}
@@ -3555,7 +4099,7 @@ version: 4.3.0
3555
4099
 
3556
4100
 
3557
4101
  __proto.findActiveAnchor = function () {
3558
- var flicking = getFlickingAttached(this._flicking, "Camera");
4102
+ var flicking = getFlickingAttached(this._flicking);
3559
4103
  var activeIndex = flicking.control.activeIndex;
3560
4104
  return find(this._anchors, function (anchor) {
3561
4105
  return anchor.panel.index === activeIndex;
@@ -3598,7 +4142,7 @@ version: 4.3.0
3598
4142
  __proto.canSee = function (panel) {
3599
4143
  var visibleRange = this.visibleRange; // Should not include margin, as we don't declare what the margin is visible as what the panel is visible.
3600
4144
 
3601
- return panel.includeRange(visibleRange.min, visibleRange.max, false);
4145
+ return panel.isVisibleOnRange(visibleRange.min, visibleRange.max);
3602
4146
  };
3603
4147
  /**
3604
4148
  * Update Camera's {@link Camera#alignPosition alignPosition}
@@ -3626,7 +4170,7 @@ version: 4.3.0
3626
4170
 
3627
4171
 
3628
4172
  __proto.updateAnchors = function () {
3629
- var flicking = getFlickingAttached(this._flicking, "Camera");
4173
+ var flicking = getFlickingAttached(this._flicking);
3630
4174
  var panels = flicking.renderer.panels;
3631
4175
  this._anchors = panels.map(function (panel, index) {
3632
4176
  return new AnchorPoint({
@@ -3649,27 +4193,34 @@ version: 4.3.0
3649
4193
 
3650
4194
 
3651
4195
  __proto.updateAdaptiveHeight = function () {
3652
- var flicking = getFlickingAttached(this._flicking, "Camera");
4196
+ var flicking = getFlickingAttached(this._flicking);
3653
4197
  var activePanel = flicking.control.activePanel;
3654
4198
  if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
3655
4199
  flicking.viewport.setSize({
3656
4200
  height: activePanel.height
3657
4201
  });
3658
4202
  };
4203
+ /**
4204
+ * Update current offset of the camera
4205
+ * @ko 현재 카메라의 오프셋을 업데이트합니다
4206
+ * @chainable
4207
+ * @return {this}
4208
+ */
4209
+
3659
4210
 
3660
4211
  __proto.updateOffset = function () {
3661
- var flicking = getFlickingAttached(this._flicking, "Camera");
4212
+ var flicking = getFlickingAttached(this._flicking);
4213
+ var position = this._position;
3662
4214
  var unRenderedPanels = flicking.panels.filter(function (panel) {
3663
4215
  return !panel.rendered;
3664
4216
  });
3665
- var position = this._position;
3666
4217
  this._offset = unRenderedPanels.filter(function (panel) {
3667
4218
  return panel.position + panel.offset < position;
3668
4219
  }).reduce(function (offset, panel) {
3669
4220
  return offset + panel.sizeIncludingMargin;
3670
4221
  }, 0);
3671
-
3672
- this._applyTransform();
4222
+ this.applyTransform();
4223
+ return this;
3673
4224
  };
3674
4225
  /**
3675
4226
  * Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
@@ -3686,6 +4237,21 @@ version: 4.3.0
3686
4237
  };
3687
4238
  return this;
3688
4239
  };
4240
+ /**
4241
+ * Apply "transform" style with the current position to camera element
4242
+ * @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
4243
+ * @chainable
4244
+ * @return {this}
4245
+ */
4246
+
4247
+
4248
+ __proto.applyTransform = function () {
4249
+ var el = this._el;
4250
+ var flicking = getFlickingAttached(this._flicking);
4251
+ var actualPosition = this._position - this._alignPos - this._offset;
4252
+ el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4253
+ return this;
4254
+ };
3689
4255
 
3690
4256
  __proto._resetInternalValues = function () {
3691
4257
  this._position = 0;
@@ -3706,7 +4272,7 @@ version: 4.3.0
3706
4272
  __proto._refreshVisiblePanels = function () {
3707
4273
  var _this = this;
3708
4274
 
3709
- var flicking = getFlickingAttached(this._flicking, "Camera");
4275
+ var flicking = getFlickingAttached(this._flicking);
3710
4276
  var panels = flicking.renderer.panels;
3711
4277
  var newVisiblePanels = panels.filter(function (panel) {
3712
4278
  return _this.canSee(panel);
@@ -3734,7 +4300,7 @@ version: 4.3.0
3734
4300
  __proto._checkNeedPanel = function () {
3735
4301
  var needPanelTriggered = this._needPanelTriggered;
3736
4302
  if (needPanelTriggered.prev && needPanelTriggered.next) return;
3737
- var flicking = getFlickingAttached(this._flicking, "Camera");
4303
+ var flicking = getFlickingAttached(this._flicking);
3738
4304
  var panels = flicking.renderer.panels;
3739
4305
 
3740
4306
  if (panels.length <= 0) {
@@ -3788,7 +4354,7 @@ version: 4.3.0
3788
4354
  };
3789
4355
 
3790
4356
  __proto._checkReachEnd = function (prevPos, newPos) {
3791
- var flicking = getFlickingAttached(this._flicking, "Camera");
4357
+ var flicking = getFlickingAttached(this._flicking);
3792
4358
  var range = this._range;
3793
4359
  var wasBetweenRange = prevPos > range.min && prevPos < range.max;
3794
4360
  var isBetweenRange = newPos > range.min && newPos < range.max;
@@ -3799,13 +4365,6 @@ version: 4.3.0
3799
4365
  }));
3800
4366
  };
3801
4367
 
3802
- __proto._applyTransform = function () {
3803
- var el = this._el;
3804
- var flicking = getFlickingAttached(this._flicking, "Camera");
3805
- var actualPosition = this._position - this._alignPos - this._offset;
3806
- el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
3807
- };
3808
-
3809
4368
  return Camera;
3810
4369
  }();
3811
4370
 
@@ -3814,7 +4373,9 @@ version: 4.3.0
3814
4373
  * @ko 첫번째 패널의 좌표로부터 마지막 패널의 좌표로까지 이동할 수 있는 종류의 {@link Camera}
3815
4374
  */
3816
4375
 
3817
- var LinearCamera = function (_super) {
4376
+ var LinearCamera =
4377
+ /*#__PURE__*/
4378
+ function (_super) {
3818
4379
  __extends(LinearCamera, _super);
3819
4380
 
3820
4381
  function LinearCamera() {
@@ -3836,7 +4397,7 @@ version: 4.3.0
3836
4397
  __proto.updateRange = function () {
3837
4398
  var _a, _b;
3838
4399
 
3839
- var flicking = getFlickingAttached(this._flicking, "Camera");
4400
+ var flicking = getFlickingAttached(this._flicking);
3840
4401
  var renderer = flicking.renderer;
3841
4402
  var firstPanel = renderer.getPanel(0);
3842
4403
  var lastPanel = renderer.getPanel(renderer.panelCount - 1);
@@ -3855,7 +4416,9 @@ version: 4.3.0
3855
4416
  * @ko 첫번째 패널과 마지막 패널이 이어진 상태로, 무한히 회전할 수 있는 종류의 {@link Camera}
3856
4417
  */
3857
4418
 
3858
- var CircularCamera = function (_super) {
4419
+ var CircularCamera =
4420
+ /*#__PURE__*/
4421
+ function (_super) {
3859
4422
  __extends(CircularCamera, _super);
3860
4423
 
3861
4424
  function CircularCamera() {
@@ -3913,12 +4476,32 @@ version: 4.3.0
3913
4476
  __proto.findAnchorIncludePosition = function (position) {
3914
4477
  if (!this._circularEnabled) return _super.prototype.findAnchorIncludePosition.call(this, position);
3915
4478
  var range = this._range;
4479
+ var anchors = this._anchors;
4480
+ var rangeDiff = this.rangeDiff;
4481
+ var anchorCount = anchors.length;
3916
4482
  var positionInRange = circulatePosition(position, range.min, range.max);
3917
4483
 
3918
4484
  var anchorInRange = _super.prototype.findAnchorIncludePosition.call(this, positionInRange);
3919
4485
 
4486
+ if (anchorCount > 0 && (position === range.min || position === range.max)) {
4487
+ var possibleAnchors = [anchorInRange, new AnchorPoint({
4488
+ index: 0,
4489
+ position: anchors[0].position + rangeDiff,
4490
+ panel: anchors[0].panel
4491
+ }), new AnchorPoint({
4492
+ index: anchorCount - 1,
4493
+ position: anchors[anchorCount - 1].position - rangeDiff,
4494
+ panel: anchors[anchorCount - 1].panel
4495
+ })].filter(function (anchor) {
4496
+ return !!anchor;
4497
+ });
4498
+ anchorInRange = possibleAnchors.reduce(function (nearest, anchor) {
4499
+ if (!nearest) return anchor;
4500
+ return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
4501
+ }, null);
4502
+ }
4503
+
3920
4504
  if (!anchorInRange) return null;
3921
- var rangeDiff = this.rangeDiff;
3922
4505
 
3923
4506
  if (position < range.min) {
3924
4507
  var loopCount = -Math.floor((range.min - position) / rangeDiff) - 1;
@@ -3963,9 +4546,9 @@ version: 4.3.0
3963
4546
 
3964
4547
 
3965
4548
  if (visibleRange.min < range.min) {
3966
- return visibleInCurrentRange || panel.includeRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff, false);
4549
+ return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff);
3967
4550
  } else if (visibleRange.max > range.max) {
3968
- return visibleInCurrentRange || panel.includeRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff, false);
4551
+ return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff);
3969
4552
  }
3970
4553
 
3971
4554
  return visibleInCurrentRange;
@@ -3982,7 +4565,7 @@ version: 4.3.0
3982
4565
 
3983
4566
 
3984
4567
  __proto.updateRange = function () {
3985
- var flicking = getFlickingAttached(this._flicking, "Camera");
4568
+ var flicking = getFlickingAttached(this._flicking);
3986
4569
  var renderer = flicking.renderer;
3987
4570
  var panels = renderer.panels;
3988
4571
 
@@ -4018,13 +4601,20 @@ version: 4.3.0
4018
4601
  };
4019
4602
  }
4020
4603
 
4604
+ this.updateOffset();
4605
+ return this;
4606
+ };
4607
+
4608
+ __proto.updateOffset = function () {
4021
4609
  this._updateCircularOffset();
4022
4610
 
4023
- return this;
4611
+ return _super.prototype.updateOffset.call(this);
4024
4612
  };
4025
4613
 
4026
4614
  __proto.lookAt = function (pos) {
4027
- var flicking = getFlickingAttached(this._flicking, "Camera");
4615
+ var _this = this;
4616
+
4617
+ var flicking = getFlickingAttached(this._flicking);
4028
4618
  var prevPos = this._position;
4029
4619
  if (pos === prevPos) return _super.prototype.lookAt.call(this, pos);
4030
4620
  var panels = flicking.renderer.panels;
@@ -4033,22 +4623,23 @@ version: 4.3.0
4033
4623
  });
4034
4624
  this._position = pos;
4035
4625
 
4626
+ _super.prototype.lookAt.call(this, pos);
4627
+
4036
4628
  if (toggled.some(function (isToggled) {
4037
4629
  return isToggled;
4038
4630
  })) {
4039
- this._updateCircularOffset();
4040
-
4041
- void flicking.renderer.render();
4631
+ void flicking.renderer.render().then(function () {
4632
+ _this.updateOffset();
4633
+ });
4042
4634
  }
4043
-
4044
- return _super.prototype.lookAt.call(this, pos);
4045
4635
  };
4046
4636
 
4047
- __proto._applyTransform = function () {
4637
+ __proto.applyTransform = function () {
4048
4638
  var el = this._el;
4049
- var flicking = getFlickingAttached(this._flicking, "Camera");
4639
+ var flicking = getFlickingAttached(this._flicking);
4050
4640
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
4051
4641
  el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4642
+ return this;
4052
4643
  };
4053
4644
 
4054
4645
  __proto._resetInternalValues = function () {
@@ -4070,17 +4661,15 @@ version: 4.3.0
4070
4661
  return;
4071
4662
  }
4072
4663
 
4073
- var flicking = getFlickingAttached(this._flicking, "Camera");
4074
- var toggledPrev = [];
4075
- var toggledNext = [];
4076
- flicking.panels.filter(function (panel) {
4664
+ var flicking = getFlickingAttached(this._flicking);
4665
+ var toggled = flicking.panels.filter(function (panel) {
4077
4666
  return panel.toggled;
4078
- }).forEach(function (panel) {
4079
- if (panel.toggleDirection === DIRECTION.PREV) {
4080
- toggledPrev.push(panel);
4081
- } else {
4082
- toggledNext.push(panel);
4083
- }
4667
+ });
4668
+ var toggledPrev = toggled.filter(function (panel) {
4669
+ return panel.toggleDirection === DIRECTION.PREV;
4670
+ });
4671
+ var toggledNext = toggled.filter(function (panel) {
4672
+ return panel.toggleDirection === DIRECTION.NEXT;
4084
4673
  });
4085
4674
  this._circularOffset = this._calcPanelAreaSum(toggledPrev) - this._calcPanelAreaSum(toggledNext);
4086
4675
  };
@@ -4093,7 +4682,9 @@ version: 4.3.0
4093
4682
  * @ko 첫번째와 마지막 패널 밖으로 넘어가지 못하도록 범위를 설정하여, 첫번째/마지막 패널 전/후의 빈 공간을 보이지 않도록 하는 종류의 {@link Camera}
4094
4683
  */
4095
4684
 
4096
- var BoundCamera = function (_super) {
4685
+ var BoundCamera =
4686
+ /*#__PURE__*/
4687
+ function (_super) {
4097
4688
  __extends(BoundCamera, _super);
4098
4689
 
4099
4690
  function BoundCamera() {
@@ -4113,7 +4704,7 @@ version: 4.3.0
4113
4704
  var __proto = BoundCamera.prototype;
4114
4705
 
4115
4706
  __proto.updateRange = function () {
4116
- var flicking = getFlickingAttached(this._flicking, "Camera");
4707
+ var flicking = getFlickingAttached(this._flicking);
4117
4708
  var renderer = flicking.renderer;
4118
4709
  var alignPos = this._alignPos;
4119
4710
  var firstPanel = renderer.getPanel(0);
@@ -4156,7 +4747,7 @@ version: 4.3.0
4156
4747
  __proto.updateAnchors = function () {
4157
4748
  var _this = this;
4158
4749
 
4159
- var flicking = getFlickingAttached(this._flicking, "Camera");
4750
+ var flicking = getFlickingAttached(this._flicking);
4160
4751
  var panels = flicking.renderer.panels;
4161
4752
 
4162
4753
  if (panels.length <= 0) {
@@ -4278,20 +4869,23 @@ version: 4.3.0
4278
4869
  * @ko {@link Panel}과 그 엘리먼트들을 관리하는 컴포넌트
4279
4870
  */
4280
4871
 
4281
- var Renderer$1 = function () {
4872
+ var Renderer$1 =
4873
+ /*#__PURE__*/
4874
+ function () {
4282
4875
  /**
4283
4876
  * @param {object} options An options object<ko>옵션 오브젝트</ko>
4284
- * @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>
4877
+ * @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>
4878
+ * @param {object} [options.strategy] An instance of RenderingStrategy(internal module)<ko>RenderingStrategy의 인스턴스(내부 모듈)</ko>
4285
4879
  */
4286
4880
  function Renderer(_a) {
4287
- var _b = _a === void 0 ? {} : _a,
4288
- _c = _b.align,
4289
- align = _c === void 0 ? ALIGN.CENTER : _c;
4290
-
4881
+ var _b = _a.align,
4882
+ align = _b === void 0 ? ALIGN.CENTER : _b,
4883
+ strategy = _a.strategy;
4291
4884
  this._flicking = null;
4292
4885
  this._panels = []; // Bind options
4293
4886
 
4294
4887
  this._align = align;
4888
+ this._strategy = strategy;
4295
4889
  }
4296
4890
 
4297
4891
  var __proto = Renderer.prototype;
@@ -4324,6 +4918,16 @@ version: 4.3.0
4324
4918
  enumerable: false,
4325
4919
  configurable: true
4326
4920
  });
4921
+ Object.defineProperty(__proto, "strategy", {
4922
+ /**
4923
+ * @internal
4924
+ */
4925
+ get: function () {
4926
+ return this._strategy;
4927
+ },
4928
+ enumerable: false,
4929
+ configurable: true
4930
+ });
4327
4931
  Object.defineProperty(__proto, "align", {
4328
4932
  // Options Getter
4329
4933
 
@@ -4338,8 +4942,7 @@ version: 4.3.0
4338
4942
  // Options Setter
4339
4943
  set: function (val) {
4340
4944
  this._align = val;
4341
-
4342
- var panelAlign = this._getPanelAlign();
4945
+ var panelAlign = parsePanelAlign(val);
4343
4946
 
4344
4947
  this._panels.forEach(function (panel) {
4345
4948
  panel.align = panelAlign;
@@ -4385,6 +4988,14 @@ version: 4.3.0
4385
4988
  __proto.getPanel = function (index) {
4386
4989
  return this._panels[index] || null;
4387
4990
  };
4991
+
4992
+ __proto.forceRenderAllPanels = function () {
4993
+ this._panels.forEach(function (panel) {
4994
+ return panel.markForShow();
4995
+ });
4996
+
4997
+ return Promise.resolve();
4998
+ };
4388
4999
  /**
4389
5000
  * Update all panel sizes
4390
5001
  * @ko 모든 패널의 크기를 업데이트합니다
@@ -4394,10 +5005,15 @@ version: 4.3.0
4394
5005
 
4395
5006
 
4396
5007
  __proto.updatePanelSize = function () {
4397
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5008
+ var flicking = getFlickingAttached(this._flicking);
5009
+ var panels = this._panels;
5010
+ if (panels.length <= 0) return this;
4398
5011
 
4399
5012
  if (flicking.panelsPerView > 0) {
4400
- this._updatePanelSizeByGrid(flicking);
5013
+ var firstPanel = panels[0];
5014
+ firstPanel.resize();
5015
+
5016
+ this._updatePanelSizeByGrid(firstPanel, panels);
4401
5017
  } else {
4402
5018
  flicking.panels.forEach(function (panel) {
4403
5019
  return panel.resize();
@@ -4411,8 +5027,10 @@ version: 4.3.0
4411
5027
  * This will increase index of panels after by the number of panels added
4412
5028
  * @ko 주어진 인덱스에 새로운 패널들을 추가합니다
4413
5029
  * 해당 인덱스보다 같거나 큰 인덱스를 가진 기존 패널들은 추가한 패널의 개수만큼 인덱스가 증가합니다.
4414
- * @param {number} index Index to insert new panels at<ko>새로 패널들을 추가할 인덱스</ko>
4415
- * @param {any[]} elements An array of element or framework component with element in it<ko>엘리먼트의 배열 혹은 프레임워크에서 엘리먼트를 포함한 컴포넌트들의 배열</ko>
5030
+ * @param {Array<object>} items An array of items to insert<ko>추가할 아이템들의 배열</ko>
5031
+ * @param {number} [items.index] Index to insert new panels at<ko>새로 패널들을 추가할 인덱스</ko>
5032
+ * @param {any[]} [items.elements] An array of element or framework component with element in it<ko>엘리먼트의 배열 혹은 프레임워크에서 엘리먼트를 포함한 컴포넌트들의 배열</ko>
5033
+ * @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>
4416
5034
  * @return {Panel[]} An array of prepended panels<ko>추가된 패널들의 배열</ko>
4417
5035
  */
4418
5036
 
@@ -4427,11 +5045,10 @@ version: 4.3.0
4427
5045
  }
4428
5046
 
4429
5047
  var panels = this._panels;
4430
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5048
+ var flicking = getFlickingAttached(this._flicking);
4431
5049
  var control = flicking.control;
4432
-
4433
- var align = this._getPanelAlign();
4434
-
5050
+ var prevFirstPanel = panels[0];
5051
+ var align = parsePanelAlign(this._align);
4435
5052
  var allPanelsInserted = items.reduce(function (addedPanels, item) {
4436
5053
  var _a;
4437
5054
 
@@ -4444,20 +5061,30 @@ version: 4.3.0
4444
5061
  flicking: flicking
4445
5062
  });
4446
5063
  });
4447
- panels.splice.apply(panels, __spreadArray([insertingIdx, 0], __read(panelsInserted))); // Insert the actual elements as camera element's children
5064
+ panels.splice.apply(panels, __spreadArray([insertingIdx, 0], __read(panelsInserted)));
4448
5065
 
4449
- _this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) !== null && _a !== void 0 ? _a : null); // Resize the newly added panels
5066
+ if (item.hasDOMInElements) {
5067
+ // Insert the actual elements as camera element's children
5068
+ _this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) !== null && _a !== void 0 ? _a : null);
5069
+ } // Resize the newly added panels
4450
5070
 
4451
5071
 
4452
- panelsInserted.forEach(function (panel) {
4453
- return panel.resize();
4454
- }); // Update panel indexes & positions
5072
+ if (flicking.panelsPerView > 0) {
5073
+ var firstPanel = prevFirstPanel || panelsInserted[0].resize();
5074
+
5075
+ _this._updatePanelSizeByGrid(firstPanel, panelsInserted);
5076
+ } else {
5077
+ panelsInserted.forEach(function (panel) {
5078
+ return panel.resize();
5079
+ });
5080
+ } // Update panel indexes & positions
5081
+
4455
5082
 
4456
5083
  panelsPushed.forEach(function (panel) {
4457
5084
  panel.increaseIndex(panelsInserted.length);
4458
5085
  panel.updatePosition();
4459
5086
  });
4460
- return __spreadArray(__spreadArray([], __read(addedPanels)), __read(panelsInserted));
5087
+ return __spreadArray(__spreadArray([], __read(addedPanels), false), __read(panelsInserted));
4461
5088
  }, []);
4462
5089
  if (allPanelsInserted.length <= 0) return []; // Update camera & control
4463
5090
 
@@ -4487,8 +5114,10 @@ version: 4.3.0
4487
5114
  * This will decrease index of panels after by the number of panels removed
4488
5115
  * @ko 주어진 인덱스의 패널을 제거합니다
4489
5116
  * 해당 인덱스보다 큰 인덱스를 가진 기존 패널들은 제거한 패널의 개수만큼 인덱스가 감소합니다
4490
- * @param {number} index Index of panel to remove<ko>제거할 패널의 인덱스</ko>
4491
- * @param {number} [deleteCount=1] Number of panels to remove from index<ko>`index` 이후로 제거할 패널의 개수</ko>
5117
+ * @param {Array<object>} items An array of items to remove<ko>제거할 아이템들의 배열</ko>
5118
+ * @param {number} [items.index] Index of panel to remove<ko>제거할 패널의 인덱스</ko>
5119
+ * @param {number} [items.deleteCount=1] Number of panels to remove from index<ko>`index` 이후로 제거할 패널의 개수</ko>
5120
+ * @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>
4492
5121
  * @return An array of removed panels<ko>제거된 패널들의 배열</ko>
4493
5122
  */
4494
5123
 
@@ -4503,7 +5132,7 @@ version: 4.3.0
4503
5132
  }
4504
5133
 
4505
5134
  var panels = this._panels;
4506
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5135
+ var flicking = getFlickingAttached(this._flicking);
4507
5136
  var camera = flicking.camera,
4508
5137
  control = flicking.control;
4509
5138
  var activePanel = control.activePanel;
@@ -4521,21 +5150,24 @@ version: 4.3.0
4521
5150
  panel.updatePosition();
4522
5151
  });
4523
5152
 
4524
- _this._removePanelElements(panelsRemoved); // Remove panel elements
5153
+ if (item.hasDOMInElements) {
5154
+ _this._removePanelElements(panelsRemoved);
5155
+ } // Remove panel elements
4525
5156
 
4526
5157
 
4527
5158
  panelsRemoved.forEach(function (panel) {
4528
5159
  return panel.destroy();
4529
- }); // Update camera & control
4530
-
4531
- _this._updateCameraAndControl();
5160
+ });
4532
5161
 
4533
5162
  if (includes(panelsRemoved, activePanel)) {
4534
5163
  control.resetActive();
4535
5164
  }
4536
5165
 
4537
- return __spreadArray(__spreadArray([], __read(removed)), __read(panelsRemoved));
4538
- }, []);
5166
+ return __spreadArray(__spreadArray([], __read(removed), false), __read(panelsRemoved));
5167
+ }, []); // Update camera & control
5168
+
5169
+ this._updateCameraAndControl();
5170
+
4539
5171
  void this.render(); // FIXME: fix for animating case
4540
5172
 
4541
5173
  if (allPanelsRemoved.length > 0 && !control.animating) {
@@ -4568,9 +5200,10 @@ version: 4.3.0
4568
5200
  __proto.checkPanelContentsReady = function (checkingPanels) {
4569
5201
  var _this = this;
4570
5202
 
4571
- var resizeOnContentsReady = getFlickingAttached(this._flicking, "Renderer").resizeOnContentsReady;
5203
+ var flicking = getFlickingAttached(this._flicking);
5204
+ var resizeOnContentsReady = flicking.resizeOnContentsReady;
4572
5205
  var panels = this._panels;
4573
- if (!resizeOnContentsReady) return;
5206
+ if (!resizeOnContentsReady || flicking.virtualEnabled) return;
4574
5207
 
4575
5208
  var hasContents = function (panel) {
4576
5209
  return !!panel.element.querySelector("img, video");
@@ -4585,9 +5218,7 @@ version: 4.3.0
4585
5218
  panel.loading = true;
4586
5219
  });
4587
5220
  contentsReadyChecker.on("readyElement", function (e) {
4588
- var flicking = _this._flicking;
4589
-
4590
- if (!flicking) {
5221
+ if (!_this._flicking) {
4591
5222
  // Renderer's destroy() is called before
4592
5223
  contentsReadyChecker.destroy();
4593
5224
  return;
@@ -4632,13 +5263,8 @@ version: 4.3.0
4632
5263
  }));
4633
5264
  };
4634
5265
 
4635
- __proto._getPanelAlign = function () {
4636
- var align = this._align;
4637
- return typeof align === "object" ? align.panel : align;
4638
- };
4639
-
4640
5266
  __proto._updateCameraAndControl = function () {
4641
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5267
+ var flicking = getFlickingAttached(this._flicking);
4642
5268
  var camera = flicking.camera,
4643
5269
  control = flicking.control;
4644
5270
  camera.updateRange();
@@ -4647,18 +5273,6 @@ version: 4.3.0
4647
5273
  control.updateInput();
4648
5274
  };
4649
5275
 
4650
- __proto._updateRenderingPanels = function () {
4651
- var flicking = getFlickingAttached(this._flicking, "Renderer");
4652
-
4653
- if (flicking.renderOnlyVisible) {
4654
- this._showOnlyVisiblePanels(flicking);
4655
- } else {
4656
- flicking.panels.forEach(function (panel) {
4657
- return panel.markForShow();
4658
- });
4659
- }
4660
- };
4661
-
4662
5276
  __proto._showOnlyVisiblePanels = function (flicking) {
4663
5277
  var panels = flicking.renderer.panels;
4664
5278
  var camera = flicking.camera;
@@ -4675,23 +5289,19 @@ version: 4.3.0
4675
5289
  panel.markForHide();
4676
5290
  }
4677
5291
  });
4678
- camera.updateOffset();
4679
5292
  };
4680
5293
 
4681
- __proto._updatePanelSizeByGrid = function (flicking) {
4682
- var panels = flicking.panels;
5294
+ __proto._updatePanelSizeByGrid = function (referencePanel, panels) {
5295
+ var flicking = getFlickingAttached(this._flicking);
4683
5296
  var panelsPerView = flicking.panelsPerView;
4684
5297
 
4685
5298
  if (panelsPerView <= 0) {
4686
5299
  throw new FlickingError(MESSAGE.WRONG_OPTION("panelsPerView", panelsPerView), CODE.WRONG_OPTION);
4687
5300
  }
4688
5301
 
4689
- if (panels.length <= 0) return; // resize only the first panel
4690
-
4691
- var firstPanel = panels[0];
4692
- firstPanel.resize();
5302
+ if (panels.length <= 0) return;
4693
5303
  var viewportSize = flicking.camera.size;
4694
- var gap = firstPanel.margin.prev + firstPanel.margin.next;
5304
+ var gap = referencePanel.margin.prev + referencePanel.margin.next;
4695
5305
  var panelSize = (viewportSize - gap * (panelsPerView - 1)) / panelsPerView;
4696
5306
  var panelSizeObj = flicking.horizontal ? {
4697
5307
  width: panelSize
@@ -4700,14 +5310,12 @@ version: 4.3.0
4700
5310
  };
4701
5311
  var firstPanelSizeObj = {
4702
5312
  size: panelSize,
4703
- height: firstPanel.height,
4704
- margin: firstPanel.margin
5313
+ height: referencePanel.height,
5314
+ margin: referencePanel.margin
4705
5315
  };
4706
5316
 
4707
5317
  if (!flicking.noPanelStyleOverride) {
4708
- flicking.panels.forEach(function (panel) {
4709
- return panel.setSize(panelSizeObj);
4710
- });
5318
+ this._strategy.updatePanelSizes(flicking, panelSizeObj);
4711
5319
  }
4712
5320
 
4713
5321
  flicking.panels.forEach(function (panel) {
@@ -4715,30 +5323,202 @@ version: 4.3.0
4715
5323
  });
4716
5324
  };
4717
5325
 
5326
+ __proto._removeAllChildsFromCamera = function () {
5327
+ var flicking = getFlickingAttached(this._flicking);
5328
+ var cameraElement = flicking.camera.element; // Remove other elements
5329
+
5330
+ while (cameraElement.firstChild) {
5331
+ cameraElement.removeChild(cameraElement.firstChild);
5332
+ }
5333
+ };
5334
+
5335
+ __proto._insertPanelElements = function (panels, nextSibling) {
5336
+ if (nextSibling === void 0) {
5337
+ nextSibling = null;
5338
+ }
5339
+
5340
+ var flicking = getFlickingAttached(this._flicking);
5341
+ var camera = flicking.camera;
5342
+ var cameraElement = camera.element;
5343
+ var nextSiblingElement = (nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.element) || null;
5344
+ var fragment = document.createDocumentFragment();
5345
+ panels.forEach(function (panel) {
5346
+ return fragment.appendChild(panel.element);
5347
+ });
5348
+ cameraElement.insertBefore(fragment, nextSiblingElement);
5349
+ };
5350
+
5351
+ __proto._removePanelElements = function (panels) {
5352
+ var flicking = getFlickingAttached(this._flicking);
5353
+ var cameraElement = flicking.camera.element;
5354
+ panels.forEach(function (panel) {
5355
+ cameraElement.removeChild(panel.element);
5356
+ });
5357
+ };
5358
+
4718
5359
  return Renderer;
4719
5360
  }();
4720
5361
 
4721
- var Panel = function () {
5362
+ /**
5363
+ *
5364
+ */
5365
+
5366
+ var VanillaRenderer =
5367
+ /*#__PURE__*/
5368
+ function (_super) {
5369
+ __extends(VanillaRenderer, _super);
5370
+
5371
+ function VanillaRenderer() {
5372
+ return _super !== null && _super.apply(this, arguments) || this;
5373
+ } // eslint-disable-next-line @typescript-eslint/require-await
5374
+
5375
+
5376
+ var __proto = VanillaRenderer.prototype;
5377
+
5378
+ __proto.render = function () {
5379
+ return __awaiter(this, void 0, void 0, function () {
5380
+ var flicking, strategy;
5381
+ return __generator(this, function (_a) {
5382
+ flicking = getFlickingAttached(this._flicking);
5383
+ strategy = this._strategy;
5384
+ strategy.updateRenderingPanels(flicking);
5385
+ strategy.renderPanels(flicking);
5386
+
5387
+ this._resetPanelElementOrder();
5388
+
5389
+ return [2
5390
+ /*return*/
5391
+ ];
5392
+ });
5393
+ });
5394
+ };
5395
+
5396
+ __proto._collectPanels = function () {
5397
+ var flicking = getFlickingAttached(this._flicking);
5398
+ var camera = flicking.camera;
5399
+
5400
+ this._removeAllTextNodes();
5401
+
5402
+ this._panels = this._strategy.collectPanels(flicking, camera.children);
5403
+ };
5404
+
5405
+ __proto._createPanel = function (el, options) {
5406
+ return this._strategy.createPanel(el, options);
5407
+ };
5408
+
5409
+ __proto._resetPanelElementOrder = function () {
5410
+ var flicking = getFlickingAttached(this._flicking);
5411
+ var cameraEl = flicking.camera.element; // We're using reversed panels here as last panel should be the last element of camera element
5412
+
5413
+ var reversedElements = this._strategy.getRenderingElementsByOrder(flicking).reverse();
5414
+
5415
+ reversedElements.forEach(function (el, idx) {
5416
+ var nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
5417
+
5418
+ if (el.nextElementSibling !== nextEl) {
5419
+ cameraEl.insertBefore(el, nextEl);
5420
+ }
5421
+ });
5422
+ };
5423
+
5424
+ __proto._removeAllTextNodes = function () {
5425
+ var flicking = getFlickingAttached(this._flicking);
5426
+ var cameraElement = flicking.camera.element; // Remove all text nodes in the camera element
5427
+
5428
+ toArray(cameraElement.childNodes).forEach(function (node) {
5429
+ if (node.nodeType === Node.TEXT_NODE) {
5430
+ cameraElement.removeChild(node);
5431
+ }
5432
+ });
5433
+ };
5434
+
5435
+ return VanillaRenderer;
5436
+ }(Renderer$1);
5437
+
5438
+ /**
5439
+ * @internal
5440
+ */
5441
+
5442
+ var ExternalRenderer =
5443
+ /*#__PURE__*/
5444
+ function (_super) {
5445
+ __extends(ExternalRenderer, _super);
5446
+
5447
+ function ExternalRenderer() {
5448
+ return _super !== null && _super.apply(this, arguments) || this;
5449
+ }
5450
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5451
+
5452
+
5453
+ var __proto = ExternalRenderer.prototype;
5454
+
5455
+ __proto._removePanelElements = function (panels) {// DO NOTHING, overrided to prevent an unexpected error
5456
+ };
5457
+
5458
+ __proto._removeAllChildsFromCamera = function () {// DO NOTHING, overrided to prevent an unexpected error
5459
+ };
5460
+
5461
+ return ExternalRenderer;
5462
+ }(Renderer$1);
5463
+
5464
+ /**
5465
+ * A slide data component that holds information of a single HTMLElement
5466
+ * @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
5467
+ */
5468
+
5469
+ var Panel =
5470
+ /*#__PURE__*/
5471
+ function () {
4722
5472
  /**
4723
5473
  * @param {object} options An options object<ko>옵션 오브젝트</ko>
4724
5474
  * @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
4725
5475
  * @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
4726
5476
  * @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
5477
+ * @param {Flicking} [options.elementProvider] A provider instance that redirects elements<ko>실제 엘리먼트를 반환하는 엘리먼트 공급자의 인스턴스</ko>
4727
5478
  */
4728
5479
  function Panel(_a) {
4729
5480
  var index = _a.index,
4730
5481
  align = _a.align,
4731
- flicking = _a.flicking;
5482
+ flicking = _a.flicking,
5483
+ elementProvider = _a.elementProvider;
4732
5484
  this._index = index;
4733
5485
  this._flicking = flicking;
5486
+ this._elProvider = elementProvider;
4734
5487
  this._align = align;
4735
5488
  this._removed = false;
5489
+ this._rendered = true;
4736
5490
  this._loading = false;
4737
5491
 
4738
5492
  this._resetInternalStates();
4739
5493
  }
4740
5494
 
4741
5495
  var __proto = Panel.prototype;
5496
+ Object.defineProperty(__proto, "element", {
5497
+ // Internal States Getter
5498
+
5499
+ /**
5500
+ * `HTMLElement` that panel's referencing
5501
+ * @ko 패널이 참조하고 있는 `HTMLElement`
5502
+ * @type {HTMLElement}
5503
+ * @readonly
5504
+ */
5505
+ get: function () {
5506
+ return this._elProvider.element;
5507
+ },
5508
+ enumerable: false,
5509
+ configurable: true
5510
+ });
5511
+ Object.defineProperty(__proto, "elementProvider", {
5512
+ /**
5513
+ * @internal
5514
+ * @readonly
5515
+ */
5516
+ get: function () {
5517
+ return this._elProvider;
5518
+ },
5519
+ enumerable: false,
5520
+ configurable: true
5521
+ });
4742
5522
  Object.defineProperty(__proto, "index", {
4743
5523
  /**
4744
5524
  * Index of the panel
@@ -4851,6 +5631,19 @@ version: 4.3.0
4851
5631
  enumerable: false,
4852
5632
  configurable: true
4853
5633
  });
5634
+ Object.defineProperty(__proto, "rendered", {
5635
+ /**
5636
+ * A value indicating whether the panel's element is being rendered on the screen
5637
+ * @ko 패널의 엘리먼트가 화면상에 렌더링되고있는지 여부를 나타내는 값
5638
+ * @type {boolean}
5639
+ * @readonly
5640
+ */
5641
+ get: function () {
5642
+ return this._rendered;
5643
+ },
5644
+ enumerable: false,
5645
+ configurable: true
5646
+ });
4854
5647
  Object.defineProperty(__proto, "loading", {
4855
5648
  /**
4856
5649
  * A value indicating whether the panel's image/video is not loaded and waiting for resize
@@ -5022,6 +5815,27 @@ version: 4.3.0
5022
5815
  enumerable: false,
5023
5816
  configurable: true
5024
5817
  });
5818
+ /**
5819
+ * Mark panel element to be appended on the camera element
5820
+ * @internal
5821
+ */
5822
+
5823
+ __proto.markForShow = function () {
5824
+ this._rendered = true;
5825
+
5826
+ this._elProvider.show(this._flicking);
5827
+ };
5828
+ /**
5829
+ * Mark panel element to be removed from the camera element
5830
+ * @internal
5831
+ */
5832
+
5833
+
5834
+ __proto.markForHide = function () {
5835
+ this._rendered = false;
5836
+
5837
+ this._elProvider.hide(this._flicking);
5838
+ };
5025
5839
  /**
5026
5840
  * Update size of the panel
5027
5841
  * @ko 패널의 크기를 갱신합니다
@@ -5030,9 +5844,9 @@ version: 4.3.0
5030
5844
  * @return {this}
5031
5845
  */
5032
5846
 
5847
+
5033
5848
  __proto.resize = function (cached) {
5034
5849
  var el = this.element;
5035
- var elStyle = getStyle(el);
5036
5850
  var flicking = this._flicking;
5037
5851
  var horizontal = flicking.horizontal;
5038
5852
 
@@ -5041,6 +5855,7 @@ version: 4.3.0
5041
5855
  this._margin = __assign({}, cached.margin);
5042
5856
  this._height = cached.height;
5043
5857
  } else {
5858
+ var elStyle = getStyle(el);
5044
5859
  this._size = horizontal ? el.offsetWidth : el.offsetHeight;
5045
5860
  this._margin = horizontal ? {
5046
5861
  prev: parseFloat(elStyle.marginLeft || "0"),
@@ -5069,27 +5884,8 @@ version: 4.3.0
5069
5884
  */
5070
5885
 
5071
5886
 
5072
- __proto.setSize = function (_a) {
5073
- var width = _a.width,
5074
- height = _a.height;
5075
- var el = this.element;
5076
-
5077
- if (width != null) {
5078
- if (isString(width)) {
5079
- el.style.width = width;
5080
- } else {
5081
- el.style.width = width + "px";
5082
- }
5083
- }
5084
-
5085
- if (height != null) {
5086
- if (isString(height)) {
5087
- el.style.height = height;
5088
- } else {
5089
- el.style.height = height + "px";
5090
- }
5091
- }
5092
-
5887
+ __proto.setSize = function (size) {
5888
+ setSize(this.element, size);
5093
5889
  return this;
5094
5890
  };
5095
5891
  /**
@@ -5134,7 +5930,7 @@ version: 4.3.0
5134
5930
  return this.includeRange(pos, pos, includeMargin);
5135
5931
  };
5136
5932
  /**
5137
- * Check whether the given range is fully included in this panel's area
5933
+ * Check whether the given range is fully included in this panel's area (inclusive)
5138
5934
  * @ko 주어진 범위가 이 패널 내부에 완전히 포함되는지를 반환합니다
5139
5935
  * @param {number} min Minimum value of the range to check<ko>확인하고자 하는 최소 범위</ko>
5140
5936
  * @param {number} max Maximum value of the range to check<ko>확인하고자 하는 최대 범위</ko>
@@ -5158,6 +5954,19 @@ version: 4.3.0
5158
5954
 
5159
5955
  return max >= panelRange.min && min <= panelRange.max;
5160
5956
  };
5957
+ /**
5958
+ * Check whether the panel is visble in the given range (exclusive)
5959
+ * @ko 주어진 범위 내에서 이 패널의 일부가 보여지는지를 반환합니다
5960
+ * @param {number} min Minimum value of the range to check<ko>확인하고자 하는 최소 범위</ko>
5961
+ * @param {number} max Maximum value of the range to check<ko>확인하고자 하는 최대 범위</ko>
5962
+ * @returns {boolean} A Boolean value indicating whether the panel is visible<ko>해당 범위 내에서 패널을 볼 수 있는지 여부</ko>
5963
+ */
5964
+
5965
+
5966
+ __proto.isVisibleOnRange = function (min, max) {
5967
+ var panelRange = this.range;
5968
+ return max > panelRange.min && min < panelRange.max;
5969
+ };
5161
5970
  /**
5162
5971
  * Move {@link Camera} to this panel
5163
5972
  * @ko {@link Camera}를 이 패널로 이동합니다
@@ -5324,7 +6133,103 @@ version: 4.3.0
5324
6133
  this._toggleDirection = DIRECTION.NONE;
5325
6134
  };
5326
6135
 
5327
- return Panel;
6136
+ return Panel;
6137
+ }();
6138
+
6139
+ var NormalRenderingStrategy =
6140
+ /*#__PURE__*/
6141
+ function () {
6142
+ function NormalRenderingStrategy(_a) {
6143
+ var providerCtor = _a.providerCtor;
6144
+ this._providerCtor = providerCtor;
6145
+ }
6146
+
6147
+ var __proto = NormalRenderingStrategy.prototype;
6148
+
6149
+ __proto.renderPanels = function () {// DO_NOTHING
6150
+ };
6151
+
6152
+ __proto.getRenderingIndexesByOrder = function (flicking) {
6153
+ var renderedPanels = flicking.renderer.panels.filter(function (panel) {
6154
+ return panel.rendered;
6155
+ });
6156
+ var toggledPrev = renderedPanels.filter(function (panel) {
6157
+ return panel.toggled && panel.toggleDirection === DIRECTION.PREV;
6158
+ });
6159
+ var toggledNext = renderedPanels.filter(function (panel) {
6160
+ return panel.toggled && panel.toggleDirection === DIRECTION.NEXT;
6161
+ });
6162
+ var notToggled = renderedPanels.filter(function (panel) {
6163
+ return !panel.toggled;
6164
+ });
6165
+ return __spreadArray(__spreadArray(__spreadArray([], __read(toggledPrev), false), __read(notToggled), false), __read(toggledNext)).map(function (panel) {
6166
+ return panel.index;
6167
+ });
6168
+ };
6169
+
6170
+ __proto.getRenderingElementsByOrder = function (flicking) {
6171
+ var panels = flicking.panels;
6172
+ return this.getRenderingIndexesByOrder(flicking).map(function (index) {
6173
+ return panels[index].element;
6174
+ });
6175
+ };
6176
+
6177
+ __proto.updateRenderingPanels = function (flicking) {
6178
+ if (flicking.renderOnlyVisible) {
6179
+ this._showOnlyVisiblePanels(flicking);
6180
+ } else {
6181
+ flicking.panels.forEach(function (panel) {
6182
+ return panel.markForShow();
6183
+ });
6184
+ }
6185
+ };
6186
+
6187
+ __proto.collectPanels = function (flicking, elements) {
6188
+ var _this = this;
6189
+
6190
+ var align = parsePanelAlign(flicking.renderer.align);
6191
+ return elements.map(function (el, index) {
6192
+ return new Panel({
6193
+ index: index,
6194
+ elementProvider: new _this._providerCtor(el),
6195
+ align: align,
6196
+ flicking: flicking
6197
+ });
6198
+ });
6199
+ };
6200
+
6201
+ __proto.createPanel = function (element, options) {
6202
+ return new Panel(__assign(__assign({}, options), {
6203
+ elementProvider: new this._providerCtor(element)
6204
+ }));
6205
+ };
6206
+
6207
+ __proto.updatePanelSizes = function (flicking, size) {
6208
+ flicking.panels.forEach(function (panel) {
6209
+ return panel.setSize(size);
6210
+ });
6211
+ };
6212
+
6213
+ __proto._showOnlyVisiblePanels = function (flicking) {
6214
+ var panels = flicking.renderer.panels;
6215
+ var camera = flicking.camera;
6216
+ var visibleIndexes = camera.visiblePanels.reduce(function (visibles, panel) {
6217
+ visibles[panel.index] = true;
6218
+ return visibles;
6219
+ }, {});
6220
+ panels.forEach(function (panel) {
6221
+ if (panel.index in visibleIndexes || panel.loading) {
6222
+ panel.markForShow();
6223
+ } else if (!flicking.holding) {
6224
+ // During the input sequence,
6225
+ // Do not remove panel elements as it won't trigger touchend event.
6226
+ panel.markForHide();
6227
+ }
6228
+ });
6229
+ camera.updateOffset();
6230
+ };
6231
+
6232
+ return NormalRenderingStrategy;
5328
6233
  }();
5329
6234
 
5330
6235
  /**
@@ -5332,26 +6237,28 @@ version: 4.3.0
5332
6237
  * @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
5333
6238
  */
5334
6239
 
5335
- var ElementPanel = function (_super) {
5336
- __extends(ElementPanel, _super);
6240
+ var VirtualPanel =
6241
+ /*#__PURE__*/
6242
+ function (_super) {
6243
+ __extends(VirtualPanel, _super);
5337
6244
  /**
5338
6245
  * @param {object} options An options object<ko>옵션 오브젝트</ko>
5339
- * @param {HTMLElement} [options.el] A `HTMLElement` panel's referencing<ko>패널이 참조하는 `HTMLElement`</ko>
5340
6246
  * @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
5341
6247
  * @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
5342
6248
  * @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
5343
6249
  */
5344
6250
 
5345
6251
 
5346
- function ElementPanel(options) {
6252
+ function VirtualPanel(options) {
5347
6253
  var _this = _super.call(this, options) || this;
5348
6254
 
5349
- _this._el = options.el;
5350
- _this._rendered = true;
6255
+ options.elementProvider.init(_this);
6256
+ _this._elProvider = options.elementProvider;
6257
+ _this._cachedInnerHTML = null;
5351
6258
  return _this;
5352
6259
  }
5353
6260
 
5354
- var __proto = ElementPanel.prototype;
6261
+ var __proto = VirtualPanel.prototype;
5355
6262
  Object.defineProperty(__proto, "element", {
5356
6263
  /**
5357
6264
  * `HTMLElement` that panel's referencing
@@ -5360,211 +6267,189 @@ version: 4.3.0
5360
6267
  * @readonly
5361
6268
  */
5362
6269
  get: function () {
5363
- return this._el;
6270
+ return this._elProvider.element;
5364
6271
  },
5365
6272
  enumerable: false,
5366
6273
  configurable: true
5367
6274
  });
5368
- Object.defineProperty(__proto, "rendered", {
6275
+ Object.defineProperty(__proto, "cachedInnerHTML", {
6276
+ /**
6277
+ * Cached innerHTML by the previous render function
6278
+ * @ko 이전 렌더링에서 캐시된 innerHTML 정보
6279
+ * @type {string|null}
6280
+ * @readonly
6281
+ */
5369
6282
  get: function () {
5370
- return this._rendered;
6283
+ return this._cachedInnerHTML;
5371
6284
  },
5372
6285
  enumerable: false,
5373
6286
  configurable: true
5374
6287
  });
6288
+ Object.defineProperty(__proto, "elementIndex", {
6289
+ /**
6290
+ * An number for indexing which element it will be rendered on
6291
+ * @ko 몇 번째 엘리먼트에 렌더링될 것인지를 나타내는 숫자
6292
+ * @type {number}
6293
+ * @readonly
6294
+ */
6295
+ get: function () {
6296
+ var flicking = this._flicking;
6297
+ var virtualElCount = flicking.panelsPerView + 1;
6298
+ var panelCount = flicking.panelCount;
6299
+ var index = this._index;
5375
6300
 
5376
- __proto.markForShow = function () {
5377
- this._rendered = true;
5378
- };
5379
-
5380
- __proto.markForHide = function () {
5381
- this._rendered = false;
5382
- };
5383
-
5384
- return ElementPanel;
5385
- }(Panel);
5386
-
5387
- /**
5388
- *
5389
- */
5390
-
5391
- var VanillaRenderer = function (_super) {
5392
- __extends(VanillaRenderer, _super);
6301
+ if (this._toggled) {
6302
+ // To prevent element duplication
6303
+ index = this._toggleDirection === DIRECTION.NEXT ? index + panelCount : index - panelCount;
6304
+ }
5393
6305
 
5394
- function VanillaRenderer() {
5395
- return _super !== null && _super.apply(this, arguments) || this;
5396
- } // eslint-disable-next-line @typescript-eslint/require-await
6306
+ return circulateIndex(index, virtualElCount);
6307
+ },
6308
+ enumerable: false,
6309
+ configurable: true
6310
+ });
5397
6311
 
6312
+ __proto.cacheRenderResult = function (result) {
6313
+ this._cachedInnerHTML = result;
6314
+ };
5398
6315
 
5399
- var __proto = VanillaRenderer.prototype;
6316
+ __proto.uncacheRenderResult = function () {
6317
+ this._cachedInnerHTML = null;
6318
+ };
5400
6319
 
5401
6320
  __proto.render = function () {
5402
- return __awaiter(this, void 0, void 0, function () {
5403
- var flicking, cameraEl, wasRenderedPanels, renderingPanels;
5404
- return __generator(this, function (_a) {
5405
- flicking = getFlickingAttached(this._flicking, "Renderer");
5406
- cameraEl = flicking.camera.element;
5407
- wasRenderedPanels = this._panels.filter(function (panel) {
5408
- return panel.element.parentElement === cameraEl;
5409
- });
5410
-
5411
- this._updateRenderingPanels();
5412
-
5413
- renderingPanels = this._getRenderingPanelsByOrder();
6321
+ var flicking = this._flicking;
6322
+ var _a = flicking.virtual,
6323
+ renderPanel = _a.renderPanel,
6324
+ cache = _a.cache;
6325
+ var element = this._elProvider.element;
6326
+ var newInnerHTML = this._cachedInnerHTML || renderPanel(this, this._index);
6327
+ if (newInnerHTML === element.innerHTML) return;
6328
+ element.innerHTML = newInnerHTML;
6329
+
6330
+ if (cache) {
6331
+ this.cacheRenderResult(newInnerHTML);
6332
+ }
6333
+ };
5414
6334
 
5415
- this._removePanelElements(wasRenderedPanels.filter(function (panel) {
5416
- return !panel.rendered;
5417
- }));
6335
+ __proto.increaseIndex = function (val) {
6336
+ this.uncacheRenderResult();
6337
+ return _super.prototype.increaseIndex.call(this, val);
6338
+ };
5418
6339
 
5419
- this._insertPanelElements(renderingPanels.filter(function (panel) {
5420
- return panel.element.parentElement !== cameraEl;
5421
- }), null);
6340
+ __proto.decreaseIndex = function (val) {
6341
+ this.uncacheRenderResult();
6342
+ return _super.prototype.decreaseIndex.call(this, val);
6343
+ };
5422
6344
 
5423
- this._resetPanelElementOrder(renderingPanels);
6345
+ return VirtualPanel;
6346
+ }(Panel);
5424
6347
 
5425
- return [2
5426
- /*return*/
5427
- ];
5428
- });
6348
+ var VirtualRenderingStrategy =
6349
+ /*#__PURE__*/
6350
+ function () {
6351
+ function VirtualRenderingStrategy() {}
6352
+
6353
+ var __proto = VirtualRenderingStrategy.prototype;
6354
+
6355
+ __proto.renderPanels = function (flicking) {
6356
+ var virtualManager = flicking.virtual;
6357
+ var visiblePanels = flicking.visiblePanels;
6358
+ var invisibleIndexes = range(flicking.panelsPerView + 1);
6359
+ visiblePanels.forEach(function (panel) {
6360
+ var elementIndex = panel.elementIndex;
6361
+ panel.render();
6362
+ virtualManager.show(elementIndex);
6363
+ invisibleIndexes[elementIndex] = -1;
5429
6364
  });
5430
- }; // eslint-disable-next-line @typescript-eslint/require-await
5431
-
5432
-
5433
- __proto.forceRenderAllPanels = function () {
5434
- return __awaiter(this, void 0, void 0, function () {
5435
- var flicking, camera, cameraElement, fragment;
5436
- return __generator(this, function (_a) {
5437
- flicking = getFlickingAttached(this._flicking, "Renderer");
5438
- camera = flicking.camera;
5439
- cameraElement = camera.element;
5440
- fragment = document.createDocumentFragment();
5441
-
5442
- this._panels.forEach(function (panel) {
5443
- return fragment.appendChild(panel.element);
5444
- });
5445
-
5446
- this._removeAllChildsFromCamera();
5447
-
5448
- cameraElement.appendChild(fragment);
5449
- return [2
5450
- /*return*/
5451
- ];
5452
- });
6365
+ invisibleIndexes.filter(function (val) {
6366
+ return val >= 0;
6367
+ }).forEach(function (idx) {
6368
+ virtualManager.hide(idx);
5453
6369
  });
5454
6370
  };
5455
6371
 
5456
- __proto._collectPanels = function () {
5457
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5458
- var cameraElement = flicking.camera.element; // Remove all text nodes in the camera element
6372
+ __proto.getRenderingIndexesByOrder = function (flicking) {
6373
+ var virtualManager = flicking.virtual;
5459
6374
 
5460
- toArray(cameraElement.childNodes).forEach(function (node) {
5461
- if (node.nodeType === Node.TEXT_NODE) {
5462
- cameraElement.removeChild(node);
5463
- }
6375
+ var visiblePanels = __spreadArray([], __read(flicking.visiblePanels)).filter(function (panel) {
6376
+ return panel.rendered;
6377
+ }).sort(function (panel1, panel2) {
6378
+ return panel1.position + panel1.offset - (panel2.position + panel2.offset);
5464
6379
  });
5465
6380
 
5466
- var align = this._getPanelAlign();
5467
-
5468
- var cameraChilds = toArray(cameraElement.children);
5469
- this._panels = cameraChilds.map(function (el, index) {
5470
- return new ElementPanel({
5471
- flicking: flicking,
5472
- el: el,
5473
- index: index,
5474
- align: align
6381
+ if (visiblePanels.length <= 0) return virtualManager.elements.map(function (_, idx) {
6382
+ return idx;
6383
+ });
6384
+ var visibleIndexes = visiblePanels.map(function (panel) {
6385
+ return panel.elementIndex;
6386
+ });
6387
+ var invisibleIndexes = virtualManager.elements.map(function (el, idx) {
6388
+ return __assign(__assign({}, el), {
6389
+ idx: idx
5475
6390
  });
6391
+ }).filter(function (el) {
6392
+ return !el.visible;
6393
+ }).map(function (el) {
6394
+ return el.idx;
5476
6395
  });
6396
+ return __spreadArray(__spreadArray([], __read(visibleIndexes), false), __read(invisibleIndexes));
5477
6397
  };
5478
6398
 
5479
- __proto._createPanel = function (el, options) {
5480
- return new ElementPanel(__assign({
5481
- el: el
5482
- }, options));
5483
- };
5484
-
5485
- __proto._insertPanelElements = function (panels, nextSibling) {
5486
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5487
- var camera = flicking.camera;
5488
- var cameraElement = camera.element;
5489
- var nextSiblingElement = (nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.element) || null;
5490
- var fragment = document.createDocumentFragment();
5491
- panels.forEach(function (panel) {
5492
- return fragment.appendChild(panel.element);
6399
+ __proto.getRenderingElementsByOrder = function (flicking) {
6400
+ var virtualManager = flicking.virtual;
6401
+ var elements = virtualManager.elements;
6402
+ return this.getRenderingIndexesByOrder(flicking).map(function (index) {
6403
+ return elements[index].nativeElement;
5493
6404
  });
5494
- cameraElement.insertBefore(fragment, nextSiblingElement);
5495
- return this;
5496
6405
  };
5497
6406
 
5498
- __proto._removePanelElements = function (panels) {
5499
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5500
- var cameraElement = flicking.camera.element;
6407
+ __proto.updateRenderingPanels = function (flicking) {
6408
+ var panels = flicking.renderer.panels;
6409
+ var camera = flicking.camera;
6410
+ var visibleIndexes = camera.visiblePanels.reduce(function (visibles, panel) {
6411
+ visibles[panel.index] = true;
6412
+ return visibles;
6413
+ }, {});
5501
6414
  panels.forEach(function (panel) {
5502
- cameraElement.removeChild(panel.element);
6415
+ if (panel.index in visibleIndexes || panel.loading) {
6416
+ panel.markForShow();
6417
+ } else {
6418
+ panel.markForHide();
6419
+ }
5503
6420
  });
5504
- return this;
6421
+ camera.updateOffset();
5505
6422
  };
5506
6423
 
5507
- __proto._resetPanelElementOrder = function (panels) {
5508
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5509
- var cameraEl = flicking.camera.element; // We're using reversed panels here as last panel should be the last element of camera element
5510
-
5511
- var reversedPanels = __spreadArray([], __read(panels)).reverse();
5512
-
5513
- reversedPanels.forEach(function (panel, idx) {
5514
- var nextPanel = reversedPanels[idx - 1];
5515
- var nextPanelEl = nextPanel ? nextPanel.element : null;
5516
-
5517
- if (panel.element.nextElementSibling !== nextPanelEl) {
5518
- cameraEl.insertBefore(panel.element, nextPanelEl);
5519
- }
6424
+ __proto.collectPanels = function (flicking) {
6425
+ var align = parsePanelAlign(flicking.renderer.align);
6426
+ return range(flicking.virtual.initialPanelCount).map(function (index) {
6427
+ return new VirtualPanel({
6428
+ index: index,
6429
+ elementProvider: new VirtualElementProvider(flicking),
6430
+ align: align,
6431
+ flicking: flicking
6432
+ });
5520
6433
  });
5521
6434
  };
5522
6435
 
5523
- __proto._removeAllChildsFromCamera = function () {
5524
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5525
- var cameraElement = flicking.camera.element; // Remove other elements
5526
-
5527
- while (cameraElement.firstChild) {
5528
- cameraElement.removeChild(cameraElement.firstChild);
5529
- }
6436
+ __proto.createPanel = function (_el, options) {
6437
+ return new VirtualPanel(__assign(__assign({}, options), {
6438
+ elementProvider: new VirtualElementProvider(options.flicking)
6439
+ }));
5530
6440
  };
5531
6441
 
5532
- __proto._getRenderingPanelsByOrder = function () {
5533
- var flicking = getFlickingAttached(this._flicking, "Renderer");
5534
- var panels = flicking.renderer.panels;
5535
- return panels.filter(function (panel) {
5536
- return panel.rendered;
5537
- }).sort(function (a, b) {
5538
- return a.position + a.offset - (b.position + b.offset);
6442
+ __proto.updatePanelSizes = function (flicking, size) {
6443
+ flicking.virtual.elements.forEach(function (el) {
6444
+ setSize(el.nativeElement, size);
6445
+ });
6446
+ flicking.panels.forEach(function (panel) {
6447
+ return panel.setSize(size);
5539
6448
  });
5540
6449
  };
5541
6450
 
5542
- return VanillaRenderer;
5543
- }(Renderer$1);
5544
-
5545
- /**
5546
- *
5547
- */
5548
-
5549
- var ExternalRenderer = function (_super) {
5550
- __extends(ExternalRenderer, _super);
5551
-
5552
- function ExternalRenderer() {
5553
- return _super !== null && _super.apply(this, arguments) || this;
5554
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
5555
-
5556
-
5557
- var __proto = ExternalRenderer.prototype;
5558
-
5559
- __proto._insertPanelElements = function (panels, nextSibling) {// DO NOTHING
5560
- }; // eslint-disable-next-line @typescript-eslint/no-unused-vars
5561
-
5562
-
5563
- __proto._removePanelElements = function (panels) {// DO NOTHING
5564
- };
5565
-
5566
- return ExternalRenderer;
5567
- }(Renderer$1);
6451
+ return VirtualRenderingStrategy;
6452
+ }();
5568
6453
 
5569
6454
  /*
5570
6455
  * Copyright (c) 2015 NAVER Corp.
@@ -5575,7 +6460,9 @@ version: 4.3.0
5575
6460
  __proto__: null,
5576
6461
  Renderer: Renderer$1,
5577
6462
  VanillaRenderer: VanillaRenderer,
5578
- ExternalRenderer: ExternalRenderer
6463
+ ExternalRenderer: ExternalRenderer,
6464
+ NormalRenderingStrategy: NormalRenderingStrategy,
6465
+ VirtualRenderingStrategy: VirtualRenderingStrategy
5579
6466
  };
5580
6467
 
5581
6468
  /**
@@ -5585,7 +6472,9 @@ version: 4.3.0
5585
6472
  * @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
5586
6473
  */
5587
6474
 
5588
- var Flicking = function (_super) {
6475
+ var Flicking =
6476
+ /*#__PURE__*/
6477
+ function (_super) {
5589
6478
  __extends(Flicking, _super);
5590
6479
  /**
5591
6480
  * @param root A root HTMLElement to initialize Flicking on it. When it's a typeof `string`, it should be a css selector string
@@ -5667,12 +6556,18 @@ version: 4.3.0
5667
6556
  disableOnInit = _z === void 0 ? false : _z,
5668
6557
  _0 = _b.renderOnlyVisible,
5669
6558
  renderOnlyVisible = _0 === void 0 ? false : _0,
5670
- _1 = _b.autoInit,
5671
- autoInit = _1 === void 0 ? true : _1,
5672
- _2 = _b.autoResize,
5673
- autoResize = _2 === void 0 ? true : _2,
5674
- _3 = _b.renderExternal,
5675
- renderExternal = _3 === void 0 ? null : _3;
6559
+ _1 = _b.virtual,
6560
+ virtual = _1 === void 0 ? null : _1,
6561
+ _2 = _b.autoInit,
6562
+ autoInit = _2 === void 0 ? true : _2,
6563
+ _3 = _b.autoResize,
6564
+ autoResize = _3 === void 0 ? true : _3,
6565
+ _4 = _b.useResizeObserver,
6566
+ useResizeObserver = _4 === void 0 ? true : _4,
6567
+ _5 = _b.externalRenderer,
6568
+ externalRenderer = _5 === void 0 ? null : _5,
6569
+ _6 = _b.renderExternal,
6570
+ renderExternal = _6 === void 0 ? null : _6;
5676
6571
 
5677
6572
  var _this = _super.call(this) || this; // Internal states
5678
6573
 
@@ -5689,6 +6584,7 @@ version: 4.3.0
5689
6584
  _this._panelsPerView = panelsPerView;
5690
6585
  _this._noPanelStyleOverride = noPanelStyleOverride;
5691
6586
  _this._resizeOnContentsReady = resizeOnContentsReady;
6587
+ _this._virtual = virtual;
5692
6588
  _this._needPanelThreshold = needPanelThreshold;
5693
6589
  _this._preventEventsBeforeInit = preventEventsBeforeInit;
5694
6590
  _this._deceleration = deceleration;
@@ -5703,15 +6599,18 @@ version: 4.3.0
5703
6599
  _this._preventClickOnDrag = preventClickOnDrag;
5704
6600
  _this._disableOnInit = disableOnInit;
5705
6601
  _this._renderOnlyVisible = renderOnlyVisible;
5706
- _this._autoResize = autoResize;
5707
6602
  _this._autoInit = autoInit;
6603
+ _this._autoResize = autoResize;
6604
+ _this._useResizeObserver = useResizeObserver;
6605
+ _this._externalRenderer = externalRenderer;
5708
6606
  _this._renderExternal = renderExternal; // Create core components
5709
6607
 
5710
6608
  _this._viewport = new Viewport(getElement(root));
6609
+ _this._autoResizer = new AutoResizer(_this);
5711
6610
  _this._renderer = _this._createRenderer();
5712
6611
  _this._camera = _this._createCamera();
5713
6612
  _this._control = _this._createControl();
5714
- _this.resize = _this.resize.bind(_this);
6613
+ _this._virtualManager = new VirtualManager(_this, virtual);
5715
6614
 
5716
6615
  if (_this._autoInit) {
5717
6616
  void _this.init();
@@ -5823,6 +6722,22 @@ version: 4.3.0
5823
6722
  enumerable: false,
5824
6723
  configurable: true
5825
6724
  });
6725
+ Object.defineProperty(__proto, "virtualEnabled", {
6726
+ /**
6727
+ * Whether the `virtual` option is enabled.
6728
+ * The {@link Flicking#virtual virtual} option can't be enabled when {@link Flicking#panelsPerView panelsPerView} is less or equal than zero.
6729
+ * @ko {@link Flicking#virtual virtual} 옵션이 활성화되었는지 여부를 나타내는 멤버 변수.
6730
+ * {@link Flicking#virtual virtual} 옵션은 {@link Flicking#panelsPerView panelsPerView} 옵션의 값이 0보다 같거나 작으면 비활성화됩니다.
6731
+ * @type {boolean}
6732
+ * @default false
6733
+ * @readonly
6734
+ */
6735
+ get: function () {
6736
+ return this._panelsPerView > 0 && this._virtual != null;
6737
+ },
6738
+ enumerable: false,
6739
+ configurable: true
6740
+ });
5826
6741
  Object.defineProperty(__proto, "index", {
5827
6742
  /**
5828
6743
  * Index number of the {@link Flicking#currentPanel currentPanel}
@@ -6405,8 +7320,8 @@ version: 4.3.0
6405
7320
  // PERFORMANCE
6406
7321
 
6407
7322
  /**
6408
- * Whether to render visible panels only. This can dramatically increase performance when there're many panels.
6409
- * @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수 있습니다.
7323
+ * Whether to render visible panels only. This can dramatically increase performance when there're many panels
7324
+ * @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수 있습니다
6410
7325
  * @type {boolean}
6411
7326
  * @default false
6412
7327
  */
@@ -6420,6 +7335,44 @@ version: 4.3.0
6420
7335
  enumerable: false,
6421
7336
  configurable: true
6422
7337
  });
7338
+ Object.defineProperty(__proto, "virtual", {
7339
+ /**
7340
+ * By enabling this option, it will reduce memory consumption by restricting the number of DOM elements to `panelsPerView + 1`
7341
+ * Must be used with `panelsPerview`.
7342
+ * After Flicking's initialized, this property can be used to add/remove the panel count.
7343
+ * @ko 이 옵션을 활성화할 경우 패널 엘리먼트의 개수를 `panelsPerView + 1` 개로 고정함으로써, 메모리 사용량을 줄일 수 있습니다.
7344
+ * `panelsPerView` 옵션과 함께 사용되어야만 합니다.
7345
+ * Flicking 초기화 이후에, 이 프로퍼티는 렌더링하는 패널의 개수를 추가/제거하기 위해 사용될 수 있습니다.
7346
+ * @type {VirtualManager}
7347
+ * @property {function} renderPanel A rendering function for the panel element's innerHTML<ko>패널 엘리먼트의 innerHTML을 렌더링하는 함수</ko>
7348
+ * @property {number} initialPanelCount Initial panel count to render<ko>최초로 렌더링할 패널의 개수</ko>
7349
+ * @property {boolean} [cache=false] Whether to cache rendered panel's innerHTML<ko>렌더링된 패널의 innerHTML 정보를 캐시할지 여부</ko>
7350
+ * @property {string} [panelClass="flicking-panel"] The class name that will be applied to rendered panel elements<ko>렌더링되는 패널 엘리먼트에 적용될 클래스 이름</ko>
7351
+ * @example
7352
+ * ```ts
7353
+ * import Flicking, { VirtualPanel } from "@egjs/flicking";
7354
+ *
7355
+ * const flicking = new Flicking("#some_el", {
7356
+ * panelsPerView: 3,
7357
+ * virtual: {
7358
+ * renderPanel: (panel: VirtualPanel, index: number) => `Panel ${index}`,
7359
+ * initialPanelCount: 100
7360
+ * }
7361
+ * });
7362
+ *
7363
+ * // Add 100 virtual panels (at the end)
7364
+ * flicking.virtual.append(100);
7365
+ *
7366
+ * // Remove 100 virtual panels from 0 to 100
7367
+ * flicking.virtual.remove(0, 100);
7368
+ * ```
7369
+ */
7370
+ get: function () {
7371
+ return this._virtualManager;
7372
+ },
7373
+ enumerable: false,
7374
+ configurable: true
7375
+ });
6423
7376
  Object.defineProperty(__proto, "autoInit", {
6424
7377
  // OTHERS
6425
7378
 
@@ -6438,10 +7391,8 @@ version: 4.3.0
6438
7391
  });
6439
7392
  Object.defineProperty(__proto, "autoResize", {
6440
7393
  /**
6441
- * Attach Flicking's {@link Flicking#resize resize} method to window's resize event.
6442
- * Flicking will automatically call {@link Flicking#resize resize} window size and orientation change.
6443
- * @ko Flicking의 {@link Flicking#resize resize} 메소드를 window의 resize 이벤트 핸들러로 등록합니다.
6444
- * 설정시 window 창 크기 및 orientation 변경에 의해 자동으로 {@link Flicking#resize resize}를 호출합니다.
7394
+ * Whether to automatically call {@link Flicking#resize resize()} when the viewport element(.flicking-viewport)'s size is changed
7395
+ * @ko 뷰포트 엘리먼트(.flicking-viewport)의 크기 변경시 {@link Flicking#resize resize()} 메소드를 자동으로 호출할지 여부를 설정합니다
6445
7396
  * @type {boolean}
6446
7397
  * @default true
6447
7398
  */
@@ -6451,6 +7402,46 @@ version: 4.3.0
6451
7402
  // OTHERS
6452
7403
  set: function (val) {
6453
7404
  this._autoResize = val;
7405
+
7406
+ if (val) {
7407
+ this._autoResizer.enable();
7408
+ } else {
7409
+ this._autoResizer.disable();
7410
+ }
7411
+ },
7412
+ enumerable: false,
7413
+ configurable: true
7414
+ });
7415
+ Object.defineProperty(__proto, "useResizeObserver", {
7416
+ /**
7417
+ * 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
7418
+ * @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} 이벤트 대신 수신할지 여부를 설정합니다
7419
+ * @type {boolean}
7420
+ * @default true
7421
+ */
7422
+ get: function () {
7423
+ return this._useResizeObserver;
7424
+ },
7425
+ set: function (val) {
7426
+ this._useResizeObserver = val;
7427
+
7428
+ if (this._autoResize) {
7429
+ this._autoResizer.enable();
7430
+ }
7431
+ },
7432
+ enumerable: false,
7433
+ configurable: true
7434
+ });
7435
+ Object.defineProperty(__proto, "externalRenderer", {
7436
+ /**
7437
+ * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
7438
+ * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
7439
+ * @default null
7440
+ * @internal
7441
+ * @readonly
7442
+ */
7443
+ get: function () {
7444
+ return this._externalRenderer;
6454
7445
  },
6455
7446
  enumerable: false,
6456
7447
  configurable: true
@@ -6459,10 +7450,10 @@ version: 4.3.0
6459
7450
  /**
6460
7451
  * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
6461
7452
  * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
6462
- * @type {boolean}
6463
- * @default false
7453
+ * @default null
6464
7454
  * @internal
6465
7455
  * @readonly
7456
+ * @deprecated
6466
7457
  */
6467
7458
  get: function () {
6468
7459
  return this._renderExternal;
@@ -6481,7 +7472,7 @@ version: 4.3.0
6481
7472
 
6482
7473
  __proto.init = function () {
6483
7474
  return __awaiter(this, void 0, void 0, function () {
6484
- var camera, renderer, control, originalTrigger, preventEventsBeforeInit;
7475
+ var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
6485
7476
 
6486
7477
  var _this = this;
6487
7478
 
@@ -6494,9 +7485,11 @@ version: 4.3.0
6494
7485
  camera = this._camera;
6495
7486
  renderer = this._renderer;
6496
7487
  control = this._control;
7488
+ virtualManager = this._virtualManager;
6497
7489
  originalTrigger = this.trigger;
6498
7490
  preventEventsBeforeInit = this._preventEventsBeforeInit;
6499
7491
  camera.init(this);
7492
+ virtualManager.init();
6500
7493
  renderer.init(this);
6501
7494
  control.init(this);
6502
7495
 
@@ -6523,7 +7516,7 @@ version: 4.3.0
6523
7516
  _a.sent();
6524
7517
 
6525
7518
  if (this._autoResize) {
6526
- window.addEventListener("resize", this.resize);
7519
+ this._autoResizer.enable();
6527
7520
  }
6528
7521
 
6529
7522
  if (this._preventClickOnDrag) {
@@ -6564,7 +7557,8 @@ version: 4.3.0
6564
7557
 
6565
7558
  __proto.destroy = function () {
6566
7559
  this.off();
6567
- window.removeEventListener("resize", this.resize);
7560
+
7561
+ this._autoResizer.disable();
6568
7562
 
6569
7563
  this._control.destroy();
6570
7564
 
@@ -6781,7 +7775,7 @@ version: 4.3.0
6781
7775
  * @param {boolean} [options.includePanelHTML=false] Include panel's `outerHTML` to the returning status<ko>패널의 `outerHTML`을 반환값에 포함시킵니다</ko>
6782
7776
  * @param {boolean} [options.visiblePanelsOnly=false] Include only {@link Flicking#visiblePanel visiblePanel}'s HTML. This option is available only when the `includePanelHTML` is true
6783
7777
  * <ko>현재 보이는 패널({@link Flicking#visiblePanel visiblePanel})의 HTML만 반환합니다. `includePanelHTML`이 `true`일 경우에만 동작합니다.</ko>
6784
- * @return {Partial<Status>} An object with current status value information<ko>현재 상태값 정보를 가진 객체.</ko>
7778
+ * @return {Status} An object with current status value information<ko>현재 상태값 정보를 가진 객체.</ko>
6785
7779
  */
6786
7780
 
6787
7781
 
@@ -6861,13 +7855,15 @@ version: 4.3.0
6861
7855
  if (((_a = panels[0]) === null || _a === void 0 ? void 0 : _a.html) && !this._renderExternal) {
6862
7856
  renderer.batchRemove({
6863
7857
  index: 0,
6864
- deleteCount: this.panels.length
7858
+ deleteCount: this.panels.length,
7859
+ hasDOMInElements: true
6865
7860
  });
6866
7861
  renderer.batchInsert({
6867
7862
  index: 0,
6868
7863
  elements: parseElement(panels.map(function (panel) {
6869
7864
  return panel.html;
6870
- }))
7865
+ })),
7866
+ hasDOMInElements: true
6871
7867
  });
6872
7868
  }
6873
7869
 
@@ -7104,7 +8100,8 @@ version: 4.3.0
7104
8100
 
7105
8101
  return this._renderer.batchInsert({
7106
8102
  index: index,
7107
- elements: parseElement(element)
8103
+ elements: parseElement(element),
8104
+ hasDOMInElements: true
7108
8105
  });
7109
8106
  };
7110
8107
  /**
@@ -7129,7 +8126,8 @@ version: 4.3.0
7129
8126
 
7130
8127
  return this._renderer.batchRemove({
7131
8128
  index: index,
7132
- deleteCount: deleteCount
8129
+ deleteCount: deleteCount,
8130
+ hasDOMInElements: true
7133
8131
  });
7134
8132
  };
7135
8133
 
@@ -7179,11 +8177,33 @@ version: 4.3.0
7179
8177
  };
7180
8178
 
7181
8179
  __proto._createRenderer = function () {
7182
- var rendererOptions = {
8180
+ var externalRenderer = this._externalRenderer;
8181
+
8182
+ if (this._virtual && this._panelsPerView <= 0) {
8183
+ // eslint-disable-next-line no-console
8184
+ console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
8185
+ }
8186
+
8187
+ return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
8188
+ };
8189
+
8190
+ __proto._createExternalRenderer = function () {
8191
+ var _a = this._renderExternal,
8192
+ renderer = _a.renderer,
8193
+ rendererOptions = _a.rendererOptions;
8194
+ return new renderer(__assign({
7183
8195
  align: this._align
7184
- };
7185
- var renderExternal = this._renderExternal;
7186
- return renderExternal ? new renderExternal.renderer(__assign(__assign({}, rendererOptions), renderExternal.rendererOptions)) : new VanillaRenderer(rendererOptions);
8196
+ }, rendererOptions));
8197
+ };
8198
+
8199
+ __proto._createVanillaRenderer = function () {
8200
+ var virtual = this.virtualEnabled;
8201
+ return new VanillaRenderer({
8202
+ align: this._align,
8203
+ strategy: virtual ? new VirtualRenderingStrategy() : new NormalRenderingStrategy({
8204
+ providerCtor: VanillaElementProvider
8205
+ })
8206
+ });
7187
8207
  };
7188
8208
 
7189
8209
  __proto._moveToInitialPanel = function () {
@@ -7217,36 +8237,10 @@ version: 4.3.0
7217
8237
  */
7218
8238
 
7219
8239
 
7220
- Flicking.VERSION = "4.3.0";
8240
+ Flicking.VERSION = "4.4.2";
7221
8241
  return Flicking;
7222
8242
  }(Component);
7223
8243
 
7224
- /**
7225
- * An slide data component that holds information of a single HTMLElement
7226
- * @ko 슬라이드 데이터 컴포넌트로, 단일 HTMLElement의 정보를 갖고 있습니다
7227
- */
7228
-
7229
- var ExternalPanel = function (_super) {
7230
- __extends(ExternalPanel, _super);
7231
- /**
7232
- * @param {object} options An options object<ko>옵션 오브젝트</ko>
7233
- * @param {HTMLElement} [options.el] A `HTMLElement` panel's referencing<ko>패널이 참조하는 `HTMLElement`</ko>
7234
- * @param {number} [options.index] An initial index of the panel<ko>패널의 초기 인덱스</ko>
7235
- * @param {Constants.ALIGN | string | number} [options.align] An initial {@link Flicking#align align} value of the panel<ko>패널의 초기 {@link Flicking#align align}값</ko>
7236
- * @param {Flicking} [options.flicking] A Flicking instance panel's referencing<ko>패널이 참조하는 {@link Flicking} 인스턴스</ko>
7237
- */
7238
-
7239
-
7240
- function ExternalPanel(options) {
7241
- var _this = _super.call(this, options) || this;
7242
-
7243
- _this._externalComponent = options.externalComponent;
7244
- return _this;
7245
- }
7246
-
7247
- return ExternalPanel;
7248
- }(Panel);
7249
-
7250
8244
  /*
7251
8245
  * Copyright (c) 2015 NAVER Corp.
7252
8246
  * egjs projects are licensed under the MIT license
@@ -7257,9 +8251,11 @@ version: 4.3.0
7257
8251
  Viewport: Viewport,
7258
8252
  FlickingError: FlickingError,
7259
8253
  AnchorPoint: AnchorPoint,
8254
+ VirtualManager: VirtualManager,
8255
+ VanillaElementProvider: VanillaElementProvider,
8256
+ VirtualElementProvider: VirtualElementProvider,
7260
8257
  Panel: Panel,
7261
- ElementPanel: ElementPanel,
7262
- ExternalPanel: ExternalPanel
8258
+ VirtualPanel: VirtualPanel
7263
8259
  };
7264
8260
 
7265
8261
  /**
@@ -7335,6 +8331,8 @@ version: 4.3.0
7335
8331
  var renderer = flicking.renderer;
7336
8332
  var panels = renderer.panels;
7337
8333
 
8334
+ var prevList = __spreadArray([], __read(diffResult.prevList));
8335
+
7338
8336
  if (diffResult.removed.length > 0) {
7339
8337
  var endIdx_1 = -1;
7340
8338
  var prevIdx_1 = -1;
@@ -7350,6 +8348,8 @@ version: 4.3.0
7350
8348
  } else {
7351
8349
  prevIdx_1 = removedIdx;
7352
8350
  }
8351
+
8352
+ prevList.splice(removedIdx, 1);
7353
8353
  });
7354
8354
  batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
7355
8355
  }
@@ -7389,13 +8389,14 @@ version: 4.3.0
7389
8389
  if (diffResult.added.length > 0) {
7390
8390
  var startIdx_1 = -1;
7391
8391
  var prevIdx_2 = -1;
8392
+ var addedElements_1 = rendered.slice(prevList.length);
7392
8393
  diffResult.added.forEach(function (addedIdx, idx) {
7393
8394
  if (startIdx_1 < 0) {
7394
8395
  startIdx_1 = idx;
7395
8396
  }
7396
8397
 
7397
8398
  if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
7398
- batchInsert(renderer, diffResult, rendered, startIdx_1, idx + 1);
8399
+ batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
7399
8400
  startIdx_1 = -1;
7400
8401
  prevIdx_2 = -1;
7401
8402
  } else {
@@ -7404,16 +8405,17 @@ version: 4.3.0
7404
8405
  });
7405
8406
 
7406
8407
  if (startIdx_1 >= 0) {
7407
- batchInsert(renderer, diffResult, rendered, startIdx_1);
8408
+ batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
7408
8409
  }
7409
8410
  }
7410
8411
  });
7411
8412
 
7412
- var batchInsert = function (renderer, diffResult, rendered, startIdx, endIdx) {
8413
+ var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
7413
8414
  renderer.batchInsert.apply(renderer, __spreadArray([], __read(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
7414
8415
  return {
7415
8416
  index: index,
7416
- elements: [rendered[elIdx + diffResult.prevList.length]]
8417
+ elements: [addedElements[elIdx]],
8418
+ hasDOMInElements: false
7417
8419
  };
7418
8420
  }))));
7419
8421
  };
@@ -7422,7 +8424,8 @@ version: 4.3.0
7422
8424
  var removed = renderer.panels.slice(startIdx, endIdx);
7423
8425
  renderer.batchRemove({
7424
8426
  index: startIdx,
7425
- deleteCount: removed.length
8427
+ deleteCount: removed.length,
8428
+ hasDOMInElements: false
7426
8429
  });
7427
8430
  };
7428
8431
 
@@ -7446,7 +8449,7 @@ version: 4.3.0
7446
8449
  return panel1.position + panel1.offset - (panel2.position + panel2.offset);
7447
8450
  }).map(function (panel) {
7448
8451
  return diffResult.list[maintainedMap[panel.index]];
7449
- }))), __read(diffResult.added.map(function (idx) {
8452
+ })), false), __read(diffResult.added.map(function (idx) {
7450
8453
  return diffResult.list[idx];
7451
8454
  })));
7452
8455
  });
@@ -7515,8 +8518,9 @@ version: 4.3.0
7515
8518
  merge(Flicking, Renderer);
7516
8519
  merge(Flicking, Constants);
7517
8520
  merge(Flicking, CFC);
8521
+ merge(Flicking, Utils);
7518
8522
 
7519
8523
  return Flicking;
7520
8524
 
7521
- })));
8525
+ }));
7522
8526
  //# sourceMappingURL=flicking.js.map