@egjs/flicking 4.14.2-beta.2 → 4.16.0-beta.0

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 (185) hide show
  1. package/README.md +6 -175
  2. package/{declaration → dist}/CrossFlicking.d.ts +7 -2
  3. package/dist/Flicking.d.ts +1231 -0
  4. package/dist/camera/Camera.d.ts +324 -0
  5. package/{declaration → dist}/camera/mode/BoundCameraMode.d.ts +5 -4
  6. package/{declaration → dist}/camera/mode/CameraMode.d.ts +7 -6
  7. package/{declaration → dist}/camera/mode/CircularCameraMode.d.ts +9 -5
  8. package/{declaration → dist}/camera/mode/LinearCameraMode.d.ts +2 -4
  9. package/{declaration → dist}/cfc/getDefaultCameraTransform.d.ts +1 -1
  10. package/dist/cfc/withFlickingMethods.d.ts +15 -0
  11. package/{declaration/const/axes.d.ts → dist/constants/internal.d.ts} +8 -0
  12. package/dist/constants/values.d.ts +67 -0
  13. package/dist/control/AxesController.d.ts +186 -0
  14. package/dist/control/Control.d.ts +185 -0
  15. package/dist/control/FreeControl.d.ts +44 -0
  16. package/dist/control/SnapControl.d.ts +54 -0
  17. package/{declaration → dist}/control/StateMachine.d.ts +3 -0
  18. package/dist/control/StrictControl.d.ts +60 -0
  19. package/{declaration → dist}/control/states/AnimatingState.d.ts +12 -0
  20. package/{declaration → dist}/control/states/DisabledState.d.ts +12 -0
  21. package/{declaration → dist}/control/states/DraggingState.d.ts +12 -0
  22. package/{declaration → dist}/control/states/HoldingState.d.ts +12 -0
  23. package/{declaration → dist}/control/states/IdleState.d.ts +12 -0
  24. package/dist/control/states/State.d.ts +86 -0
  25. package/dist/core/AnchorPoint.d.ts +40 -0
  26. package/{declaration → dist}/core/AutoResizer.d.ts +6 -0
  27. package/dist/core/Viewport.d.ts +60 -0
  28. package/dist/core/VirtualManager.d.ts +84 -0
  29. package/dist/core/index.d.ts +6 -0
  30. package/dist/core/panel/Panel.d.ts +298 -0
  31. package/dist/core/panel/VirtualPanel.d.ts +41 -0
  32. package/dist/core/panel/index.d.ts +5 -0
  33. package/{declaration → dist}/core/panel/provider/VanillaElementProvider.d.ts +3 -0
  34. package/{declaration → dist}/core/panel/provider/VirtualElementProvider.d.ts +3 -0
  35. package/dist/error/FlickingError.d.ts +25 -0
  36. package/dist/error/codes.d.ts +79 -0
  37. package/dist/error/groups.d.ts +94 -0
  38. package/dist/error/index.d.ts +4 -0
  39. package/dist/error/types.d.ts +516 -0
  40. package/dist/event/groups.d.ts +40 -0
  41. package/dist/event/index.d.ts +3 -0
  42. package/dist/event/names.d.ts +47 -0
  43. package/dist/event/types.d.ts +318 -0
  44. package/dist/flicking.cjs.js +5560 -7784
  45. package/dist/flicking.cjs.js.map +1 -1
  46. package/dist/flicking.esm.js +5638 -7692
  47. package/dist/flicking.esm.js.map +1 -1
  48. package/dist/flicking.js +6722 -8885
  49. package/dist/flicking.js.map +1 -1
  50. package/dist/flicking.min.js +1 -9
  51. package/dist/flicking.min.js.map +1 -1
  52. package/dist/flicking.pkgd.js +9661 -14078
  53. package/dist/flicking.pkgd.js.map +1 -1
  54. package/dist/flicking.pkgd.min.js +1 -9
  55. package/dist/flicking.pkgd.min.js.map +1 -1
  56. package/dist/index.d.ts +16 -0
  57. package/dist/reactive/index.d.ts +126 -0
  58. package/{declaration → dist}/renderer/ExternalRenderer.d.ts +3 -0
  59. package/dist/renderer/Renderer.d.ts +215 -0
  60. package/{declaration → dist}/renderer/VanillaRenderer.d.ts +6 -0
  61. package/{declaration → dist}/renderer/strategy/NormalRenderingStrategy.d.ts +5 -2
  62. package/{declaration → dist}/renderer/strategy/RenderingStrategy.d.ts +4 -1
  63. package/dist/types/external.d.ts +58 -0
  64. package/dist/types/params.d.ts +10 -0
  65. package/{declaration → dist}/utils.d.ts +7 -7
  66. package/package.json +35 -162
  67. package/src/CrossFlicking.ts +68 -96
  68. package/src/Flicking.ts +1055 -972
  69. package/src/camera/Camera.ts +217 -206
  70. package/src/camera/index.ts +2 -6
  71. package/src/camera/mode/BoundCameraMode.ts +38 -27
  72. package/src/camera/mode/CameraMode.ts +14 -12
  73. package/src/camera/mode/CircularCameraMode.ts +24 -16
  74. package/src/camera/mode/LinearCameraMode.ts +3 -1
  75. package/src/camera/mode/index.ts +4 -10
  76. package/src/cfc/getDefaultCameraTransform.ts +9 -11
  77. package/src/cfc/getRenderingPanels.ts +2 -5
  78. package/src/cfc/index.ts +4 -9
  79. package/src/cfc/sync.ts +11 -5
  80. package/src/cfc/withFlickingMethods.ts +6 -7
  81. package/src/{const/axes.ts → constants/internal.ts} +1 -0
  82. package/src/constants/values.ts +78 -0
  83. package/src/control/AxesController.ts +119 -110
  84. package/src/control/Control.ts +147 -180
  85. package/src/control/FreeControl.ts +36 -60
  86. package/src/control/SnapControl.ts +64 -68
  87. package/src/control/StateMachine.ts +14 -11
  88. package/src/control/StrictControl.ts +58 -73
  89. package/src/control/index.ts +9 -12
  90. package/src/control/states/AnimatingState.ts +8 -11
  91. package/src/control/states/DisabledState.ts +0 -5
  92. package/src/control/states/DraggingState.ts +8 -12
  93. package/src/control/states/HoldingState.ts +10 -15
  94. package/src/control/states/IdleState.ts +1 -6
  95. package/src/control/states/State.ts +46 -85
  96. package/src/core/AnchorPoint.ts +25 -23
  97. package/src/core/AutoResizer.ts +6 -15
  98. package/src/core/ResizeWatcher.ts +17 -16
  99. package/src/core/Viewport.ts +35 -46
  100. package/src/core/VirtualManager.ts +48 -36
  101. package/src/core/index.ts +6 -9
  102. package/src/core/panel/Panel.ts +190 -185
  103. package/src/core/panel/VirtualPanel.ts +17 -21
  104. package/src/core/panel/index.ts +4 -9
  105. package/src/core/panel/provider/VanillaElementProvider.ts +6 -2
  106. package/src/core/panel/provider/VirtualElementProvider.ts +6 -2
  107. package/src/core/panel/provider/index.ts +2 -7
  108. package/src/{core → error}/FlickingError.ts +5 -7
  109. package/src/error/codes.ts +164 -0
  110. package/src/error/groups.ts +124 -0
  111. package/src/error/index.ts +9 -0
  112. package/src/error/types.ts +535 -0
  113. package/src/event/groups.ts +61 -0
  114. package/src/event/index.ts +8 -0
  115. package/src/event/names.ts +52 -0
  116. package/src/event/types.ts +355 -0
  117. package/src/index.ts +9 -11
  118. package/src/index.umd.ts +9 -3
  119. package/src/reactive/index.ts +39 -74
  120. package/src/renderer/Renderer.ts +177 -119
  121. package/src/renderer/VanillaRenderer.ts +13 -10
  122. package/src/renderer/index.ts +4 -9
  123. package/src/renderer/strategy/NormalRenderingStrategy.ts +26 -22
  124. package/src/renderer/strategy/RenderingStrategy.ts +2 -1
  125. package/src/renderer/strategy/VirtualRenderingStrategy.ts +20 -13
  126. package/src/renderer/strategy/index.ts +4 -9
  127. package/src/types/external.ts +72 -0
  128. package/src/{type → types}/internal.ts +2 -5
  129. package/src/types/params.ts +15 -0
  130. package/src/utils.ts +37 -32
  131. package/CONTRIBUTING.md +0 -59
  132. package/NOTICE +0 -31
  133. package/core-packages-link.js +0 -75
  134. package/debug/reactive/index.html +0 -240
  135. package/declaration/Flicking.d.ts +0 -264
  136. package/declaration/camera/Camera.d.ts +0 -90
  137. package/declaration/cfc/withFlickingMethods.d.ts +0 -2
  138. package/declaration/const/error.d.ts +0 -34
  139. package/declaration/const/external.d.ts +0 -54
  140. package/declaration/control/AxesController.d.ts +0 -45
  141. package/declaration/control/Control.d.ts +0 -45
  142. package/declaration/control/FreeControl.d.ts +0 -14
  143. package/declaration/control/SnapControl.d.ts +0 -16
  144. package/declaration/control/StrictControl.d.ts +0 -20
  145. package/declaration/control/states/State.d.ts +0 -47
  146. package/declaration/core/AnchorPoint.d.ts +0 -15
  147. package/declaration/core/FlickingError.d.ts +0 -5
  148. package/declaration/core/Viewport.d.ts +0 -25
  149. package/declaration/core/VirtualManager.d.ts +0 -37
  150. package/declaration/core/index.d.ts +0 -6
  151. package/declaration/core/panel/Panel.d.ts +0 -89
  152. package/declaration/core/panel/VirtualPanel.d.ts +0 -19
  153. package/declaration/core/panel/index.d.ts +0 -5
  154. package/declaration/index.d.ts +0 -16
  155. package/declaration/reactive/index.d.ts +0 -25
  156. package/declaration/renderer/Renderer.d.ts +0 -60
  157. package/declaration/type/event.d.ts +0 -88
  158. package/declaration/type/external.d.ts +0 -31
  159. package/jsconfig.json +0 -5
  160. package/jsdoc-to-mdx.json +0 -7
  161. package/rollup.config.demo.js +0 -24
  162. package/rollup.config.dev.js +0 -12
  163. package/rollup.config.js +0 -57
  164. package/src/const/error.ts +0 -64
  165. package/src/const/external.ts +0 -138
  166. package/src/type/event.ts +0 -315
  167. package/src/type/external.ts +0 -78
  168. package/tsconfig.declaration.json +0 -17
  169. package/tsconfig.eslint.json +0 -10
  170. package/tsconfig.json +0 -23
  171. package/{declaration → dist}/camera/index.d.ts +0 -0
  172. package/{declaration → dist}/camera/mode/index.d.ts +2 -2
  173. package/{declaration → dist}/cfc/getRenderingPanels.d.ts +0 -0
  174. package/{declaration → dist}/cfc/index.d.ts +3 -3
  175. package/{declaration → dist}/cfc/sync.d.ts +0 -0
  176. package/{declaration → dist}/control/index.d.ts +7 -7
  177. package/{declaration → dist}/core/ResizeWatcher.d.ts +0 -0
  178. package/{declaration → dist}/core/panel/provider/ElementProvider.d.ts +0 -0
  179. package/{declaration → dist}/core/panel/provider/index.d.ts +0 -0
  180. package/{declaration → dist}/index.cjs.d.ts +0 -0
  181. package/{declaration → dist}/index.umd.d.ts +0 -0
  182. package/{declaration → dist}/renderer/index.d.ts +1 -1
  183. package/{declaration → dist}/renderer/strategy/VirtualRenderingStrategy.d.ts +1 -1
  184. package/{declaration → dist}/renderer/strategy/index.d.ts +1 -1
  185. /package/{declaration/type → dist/types}/internal.d.ts +0 -0
package/src/Flicking.ts CHANGED
@@ -3,147 +3,530 @@
3
3
  * egjs projects are licensed under the MIT license
4
4
  */
5
5
  import Component, { ComponentEvent } from "@egjs/component";
6
-
7
- import FlickingError from "./core/FlickingError";
8
- import Viewport from "./core/Viewport";
9
- import AutoResizer from "./core/AutoResizer";
10
- import { Panel } from "./core/panel";
11
- import { VanillaElementProvider } from "./core/panel/provider";
12
- import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
6
+ import { Camera } from "./camera";
7
+ import { ALIGN, CIRCULAR_FALLBACK, DIRECTION, MOVE_TYPE } from "./constants/values";
13
8
  import {
14
9
  Control,
10
+ FreeControl,
11
+ FreeControlOptions,
15
12
  SnapControl,
16
13
  SnapControlOptions,
17
- FreeControl,
18
14
  StrictControl,
19
- FreeControlOptions,
20
15
  StrictControlOptions
21
16
  } from "./control";
22
- import { Camera } from "./camera";
17
+ import AutoResizer from "./core/AutoResizer";
18
+ import { Panel } from "./core/panel";
19
+ import { VanillaElementProvider } from "./core/panel/provider";
20
+ import Viewport from "./core/Viewport";
21
+ import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
22
+ import * as ERROR from "./error/codes";
23
+ import FlickingError from "./error/FlickingError";
24
+ import { EVENTS } from "./event/names";
25
+ import { FlickingEvents } from "./event/types";
23
26
  import {
24
- Renderer,
25
- VanillaRenderer,
26
27
  ExternalRenderer,
27
- RendererOptions,
28
28
  NormalRenderingStrategy,
29
+ Renderer,
30
+ RendererOptions,
31
+ VanillaRenderer,
29
32
  VirtualRenderingStrategy
30
33
  } from "./renderer";
31
- import {
32
- EVENTS,
33
- ALIGN,
34
- MOVE_TYPE,
35
- DIRECTION,
36
- CIRCULAR_FALLBACK
37
- } from "./const/external";
38
- import * as ERROR from "./const/error";
34
+ import { ElementLike, MoveTypeOptions, Plugin, Status } from "./types/external";
35
+ import { LiteralUnion, ValueOf } from "./types/internal";
39
36
  import { findIndex, getElement, includes, parseElement } from "./utils";
40
- import {
41
- HoldStartEvent,
42
- HoldEndEvent,
43
- MoveStartEvent,
44
- SelectEvent,
45
- MoveEvent,
46
- MoveEndEvent,
47
- WillChangeEvent,
48
- WillRestoreEvent,
49
- NeedPanelEvent,
50
- VisibleChangeEvent,
51
- ReachEdgeEvent,
52
- ReadyEvent,
53
- AfterResizeEvent,
54
- BeforeResizeEvent,
55
- ChangedEvent,
56
- RestoredEvent,
57
- PanelChangeEvent
58
- } from "./type/event";
59
- import { LiteralUnion, ValueOf } from "./type/internal";
60
- import { ElementLike, Plugin, Status, MoveTypeOptions } from "./type/external";
61
37
 
62
38
  /**
63
- * @interface
64
- */
65
- export interface FlickingEvents {
66
- [EVENTS.READY]: ReadyEvent;
67
- [EVENTS.BEFORE_RESIZE]: BeforeResizeEvent;
68
- [EVENTS.AFTER_RESIZE]: AfterResizeEvent;
69
- [EVENTS.HOLD_START]: HoldStartEvent;
70
- [EVENTS.HOLD_END]: HoldEndEvent;
71
- [EVENTS.MOVE_START]: MoveStartEvent;
72
- [EVENTS.MOVE]: MoveEvent;
73
- [EVENTS.MOVE_END]: MoveEndEvent;
74
- [EVENTS.WILL_CHANGE]: WillChangeEvent;
75
- [EVENTS.CHANGED]: ChangedEvent;
76
- [EVENTS.WILL_RESTORE]: WillRestoreEvent;
77
- [EVENTS.RESTORED]: RestoredEvent;
78
- [EVENTS.SELECT]: SelectEvent;
79
- [EVENTS.NEED_PANEL]: NeedPanelEvent;
80
- [EVENTS.VISIBLE_CHANGE]: VisibleChangeEvent;
81
- [EVENTS.REACH_EDGE]: ReachEdgeEvent;
82
- [EVENTS.PANEL_CHANGE]: PanelChangeEvent;
83
- }
84
-
85
- /**
86
- * @interface
39
+ * Options for the Flicking component
40
+ * @public
87
41
  */
88
42
  export interface FlickingOptions {
89
43
  // UI / LAYOUT
90
- align:
91
- | LiteralUnion<ValueOf<typeof ALIGN>>
92
- | number
93
- | { panel: number | string; camera: number | string };
44
+ /**
45
+ * Align position of the panels within viewport. You can set different values each for the panel and camera.
46
+ * @remarks
47
+ * Possible values include
48
+ *
49
+ * - literal strings ("prev", "center", "next")
50
+ *
51
+ * - percentage values ("0%", "25%")
52
+ *
53
+ * - pixel values ("0px", "100px")
54
+ *
55
+ * - arithmetic expressions ("50% - 25px")
56
+ *
57
+ * - numbers
58
+ *
59
+ * - an object with separate `panel` and `camera` alignment values
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const possibleOptions = [
64
+ * // Literal strings
65
+ * "prev", "center", "next",
66
+ * // % values, applied to both panel & camera
67
+ * "0%", "25%", "42%",
68
+ * // px values, arithmetic calculation with (+/-) is also allowed.
69
+ * "0px", "100px", "50% - 25px",
70
+ * // numbers, same to number + px ("0px", "100px")
71
+ * 0, 100, 1000,
72
+ * // Setting a different value for panel & camera
73
+ * { panel: "10%", camera: "25%" }
74
+ * ];
75
+ *
76
+ * possibleOptions.forEach(align => {
77
+ * new Flicking("#el", { align });
78
+ * });
79
+ * ```
80
+ * @accepts {@link ALIGN}
81
+ * @defaultValue "center"
82
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/alignment | Demo: Alignment}
83
+ */
84
+ align: LiteralUnion<ValueOf<typeof ALIGN>> | number | { panel: number | string; camera: number | string };
85
+
86
+ /**
87
+ * Index of the panel to move when Flicking's {@link Flicking.init | init()} is called. A zero-based integer.
88
+ * @defaultValue 0
89
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/default-index | Demo: Default Index}
90
+ */
94
91
  defaultIndex: number;
92
+
93
+ /**
94
+ * Direction of panel movement. `true` for horizontal, `false` for vertical.
95
+ *
96
+ * @remarks
97
+ * In vanilla JS, you must manually add the `vertical` class to the viewport element when using vertical mode.
98
+ * React and Vue wrappers add this class automatically.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * // Vanilla JS: add "vertical" class to the viewport element
103
+ * // <div class="flicking-viewport vertical">
104
+ * // <div class="flicking-camera">...</div>
105
+ * // </div>
106
+ * const flicking = new Flicking("#my-flicking", {
107
+ * horizontal: false
108
+ * });
109
+ * ```
110
+ *
111
+ * @defaultValue true
112
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/vertical | Demo: Vertical}
113
+ */
95
114
  horizontal: boolean;
115
+
116
+ /**
117
+ * Enables circular (continuous loop) mode, which connects first/last panel for continuous scrolling.
118
+ * @dependency Mutual Exclusive - {@link FlickingOptions.bound | bound}. When both are true, circular takes precedence and bound will be ignored.
119
+ * @dependency Conditional - Total panel size must be ≥ viewport size. If not met, automatically falls back to {@link FlickingOptions.circularFallback | circularFallback} mode.
120
+ * @dependency Related - {@link FlickingOptions.circularFallback | circularFallback} determines fallback behavior when circular cannot be enabled
121
+ *
122
+ * @defaultValue false
123
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/circular | Demo: Circular}
124
+ */
96
125
  circular: boolean;
126
+
127
+ /**
128
+ * Set panel control mode for the case when circular cannot be enabled.
129
+ * @dependency Requires - Only takes effect when {@link FlickingOptions.circular | circular} is true but activation requirements are not met (total panel size < viewport size)
130
+ *
131
+ * @remarks
132
+ * - "linear": The view's range is set from the top of the first panel to the top of the last panel.
133
+ * - "bound": Prevents the view from going out of the first/last panel, hiding empty spaces.
134
+ *
135
+ * @accepts {@link CIRCULAR_FALLBACK}
136
+ * @defaultValue "linear"
137
+ *
138
+ * @since 4.5.0
139
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/circular | Demo: Circular}
140
+ */
97
141
  circularFallback: LiteralUnion<ValueOf<typeof CIRCULAR_FALLBACK>>;
142
+
143
+ /**
144
+ * Prevent the view (camera element) from going out of the first/last panel.
145
+ * @dependency Mutual Exclusive - {@link FlickingOptions.circular | circular}. When circular is true, this option is ignored.
146
+ * @dependency Related - Works with {@link FlickingOptions.bounce | bounce} for bounce effect at boundaries
147
+ *
148
+ * @defaultValue false
149
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/bound | Demo: Bound}
150
+ */
98
151
  bound: boolean;
152
+
153
+ /**
154
+ * Update height of the viewport element after movement same to the height of the panel below.
155
+ * @dependency Conditional - Only works when {@link FlickingOptions.horizontal | horizontal} is true. When horizontal is false, this option has no effect.
156
+ *
157
+ * @defaultValue false
158
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/adaptive | Demo: Adaptive}
159
+ */
99
160
  adaptive: boolean;
161
+
162
+ /**
163
+ * A visible number of panels on viewport. Enabling this option will force the panel to resize.
164
+ * @remarks
165
+ * When set to -1, automatically calculates based on panel sizes.
166
+ *
167
+ * @dependency Related - Affects how {@link FlickingOptions.align | align} calculates panel positions
168
+ * @dependency Requires - Required for {@link FlickingOptions.virtual | virtual} to work (must be > 0)
169
+ * @dependency Related - Works with {@link FlickingOptions.noPanelStyleOverride | noPanelStyleOverride} to prevent style modifications
170
+ *
171
+ * @defaultValue -1
172
+ *
173
+ * @since 4.2.0
174
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/panels-per-view | Demo: Panels Per View}
175
+ */
100
176
  panelsPerView: number;
177
+
178
+ /**
179
+ * When enabled, prevents modifying the panel's `width/height` styles when {@link Flicking.panelsPerView | panelsPerView} is enabled.
180
+ * Enabling this option can improve performance if you are manually managing all panel sizes.
181
+ * @defaultValue false
182
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/panels-per-view | Demo: Panels Per View}
183
+ */
101
184
  noPanelStyleOverride: boolean;
185
+
186
+ /**
187
+ * When enabled, automatically calls {@link Flicking.resize} when images/videos inside Flicking panels are loaded.
188
+ * This is useful when Flicking contains content that changes size before and after loading.
189
+ * @defaultValue false
190
+ * @since 4.3.0
191
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/resize-on-contents-ready | Demo: Resize On Contents Ready}
192
+ */
102
193
  resizeOnContentsReady: boolean;
194
+
195
+ /**
196
+ * Enable nested Flicking mode to allow parent Flicking to move when reaching boundaries.
197
+ * @remarks
198
+ * When Flicking is nested inside another Flicking, enabling this option allows the parent
199
+ * Flicking to move in the same direction after the nested Flicking reaches the first or last panel.
200
+ *
201
+ * This option is not required if the parent and nested Flicking have different horizontal options.
202
+ *
203
+ * @defaultValue false
204
+ *
205
+ * @since 4.7.0
206
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/nested | Demo: Nested}
207
+ */
103
208
  nested: boolean;
104
209
 
105
210
  // EVENT
211
+ /**
212
+ * A threshold from the viewport edge to trigger the `needPanel` event.
213
+ * @defaultValue 0
214
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/infinite-scroll | Demo: Infinite Scroll}
215
+ */
106
216
  needPanelThreshold: number;
217
+
218
+ /**
219
+ * When enabled, disables events before the `ready` event during initialization.
220
+ * @defaultValue true
221
+ * @since 4.2.0
222
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/auto-init | Demo: Auto Init}
223
+ */
107
224
  preventEventsBeforeInit: boolean;
108
225
 
109
226
  // ANIMATION
227
+ /**
228
+ * Deceleration of panel movement animation with momentum applied by user interaction (input).
229
+ * Higher values result in a shorter animation duration.
230
+ * @defaultValue 0.0075
231
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/deceleration | Demo: Deceleration}
232
+ */
110
233
  deceleration: number;
234
+
235
+ /**
236
+ * Default duration of the animation in milliseconds.
237
+ * @defaultValue 500
238
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/duration | Demo: Duration}
239
+ */
111
240
  duration: number;
241
+
242
+ /**
243
+ * An easing function applied to the panel movement animation.
244
+ * @defaultValue "easeOutCubic" (x => 1 - Math.pow(1 - x, 3))
245
+ * @see {@link http://easings.net/ | Easing Functions Cheat Sheet}
246
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/easing | Demo: Easing}
247
+ */
112
248
  easing: (x: number) => number;
113
249
 
114
250
  // INPUT
251
+ /**
252
+ * Types of input devices to enable.
253
+ * @defaultValue ["touch", "mouse"]
254
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/input-type | Demo: Input Type}
255
+ */
115
256
  inputType: string[];
116
- moveType:
117
- | ValueOf<typeof MOVE_TYPE>
118
- | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
257
+
258
+ /**
259
+ * Movement style by user input. Determines the instance type of {@link Flicking.control | control}.
260
+ * @remarks
261
+ * - "snap": Uses {@link SnapControl}
262
+ *
263
+ * - "freeScroll": Uses {@link FreeControl} with {@link FreeControlOptions}
264
+ *
265
+ * - "strict": Uses {@link StrictControl} with {@link StrictControlOptions}
266
+ * @accepts {@link MOVE_TYPE}
267
+ * @example
268
+ * ```ts
269
+ * import Flicking, { MOVE_TYPE } from "@egjs/flicking";
270
+ *
271
+ * const flicking = new Flicking({
272
+ * moveType: MOVE_TYPE.SNAP
273
+ * });
274
+ * ```
275
+ *
276
+ * ```ts
277
+ * const flicking = new Flicking({
278
+ * // If you want more specific settings for the moveType
279
+ * // [moveType, options for that moveType]
280
+ * // In this case, it's ["freeScroll", FreeControlOptions]
281
+ * moveType: [MOVE_TYPE.FREE_SCROLL, { stopAtEdge: true }]
282
+ * });
283
+ * ```
284
+ * @defaultValue "snap"
285
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/movement-types | Demo: Movement Types}
286
+ */
287
+ moveType: ValueOf<typeof MOVE_TYPE> | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
288
+
289
+ /**
290
+ * Movement threshold to change panels (unit: px). Panels will only change after scrolling beyond this value.
291
+ * @defaultValue 40
292
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/threshold | Demo: Threshold}
293
+ */
119
294
  threshold: number;
295
+
296
+ /**
297
+ * Minimum distance to recognize user input (unit: px). Panels will only move after scrolling beyond this value.
298
+ * @defaultValue 1
299
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/threshold | Demo: Threshold}
300
+ */
120
301
  dragThreshold: number;
302
+
303
+ /**
304
+ * The minimum distance for animation to proceed.
305
+ * @remarks
306
+ * If the distance to be moved is less than `animationThreshold`, the movement proceeds immediately without animation (duration: 0).
307
+ * @defaultValue 0.5
308
+ * @since 4.15.0
309
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/animation-threshold | Demo: Animation Threshold}
310
+ */
121
311
  animationThreshold: number;
312
+
313
+ /**
314
+ * Using `useCSSOrder` does not change the DOM order, but the `order` CSS property changes the order on the screen.
315
+ * @remarks
316
+ * When `circular` is used, the DOM order changes depending on the position.
317
+ * When using `iframe`, you can prevent reloading when the DOM order changes.
318
+ * In svelte, CSS order is always used.
319
+ * @defaultValue false
320
+ * @since 4.15.0
321
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/use-css-order | Demo: CSS Order}
322
+ */
122
323
  useCSSOrder: boolean;
324
+
325
+ /**
326
+ * Allows stopping animations with user click/touch input.
327
+ * @defaultValue true
328
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/interruptable | Demo: Interruptable}
329
+ */
123
330
  interruptable: boolean;
331
+
332
+ /**
333
+ * The size value of the bounce area.
334
+ * @dependency Conditional - Only can be enabled when {@link FlickingOptions.circular | circular} is false
335
+ * @dependency Related - Works with {@link FlickingOptions.bound | bound} to provide bounce effect at panel boundaries
336
+ *
337
+ * @remarks
338
+ * You can set different bounce value for prev/next direction by using array.
339
+ * Use `number` for px value, and `string` for px or % value relative to viewport size.
340
+ * You have to call {@link Control.updateInput | updateInput()} after changing this value to take effect.
341
+ *
342
+ * @example
343
+ * ```ts
344
+ * const possibleOptions = [
345
+ * "0%", "25%", "42%", // % values
346
+ * "0px", "100px", "50% - 25px", // px values with arithmetic
347
+ * 0, 100, 1000 // numbers (same as px)
348
+ * ];
349
+ * ```
350
+ *
351
+ * @defaultValue "20%"
352
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/bound | Demo: Bound}
353
+ */
124
354
  bounce: number | string | [number | string, number | string];
355
+
356
+ /**
357
+ * Size of the area from the right edge in iOS Safari (in px) that enables swipe-back or swipe-forward.
358
+ * @defaultValue 30
359
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/input-type | Demo: Input Type}
360
+ */
125
361
  iOSEdgeSwipeThreshold: number;
362
+
363
+ /**
364
+ * Automatically cancels {@link https://developer.mozilla.org/ko/docs/Web/API/Element/click_event | click} events when the user drags the viewport by any amount.
365
+ * @defaultValue true
366
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/prevent-click | Demo: Prevent Click}
367
+ */
126
368
  preventClickOnDrag: boolean;
369
+
370
+ /**
371
+ * Whether to use the {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault | preventDefault} when the user starts dragging
372
+ * @defaultValue false
373
+ * @since 4.11.0
374
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/prevent-click | Demo: Prevent Click}
375
+ */
127
376
  preventDefaultOnDrag: boolean;
377
+
378
+ /**
379
+ * Automatically call {@link Flicking.disableInput | disableInput()} during initialization.
380
+ * @defaultValue false
381
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/disable-input | Demo: Disable Input}
382
+ */
128
383
  disableOnInit: boolean;
384
+
385
+ /**
386
+ * Change active panel index on mouse/touch hold while animating.
387
+ * @remarks
388
+ * `index` of the `willChange`/`willRestore` event will be used as new index.
389
+ * @defaultValue false
390
+ * @since 4.8.0
391
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/interruptable | Demo: Interruptable}
392
+ */
129
393
  changeOnHold: boolean;
130
394
 
131
395
  // PERFORMANCE
396
+ /**
397
+ * When enabled, only renders visible panels. Can significantly improve performance with many panels.
398
+ * @defaultValue false
399
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/render-only-visible | Demo: Render Only Visible}
400
+ */
132
401
  renderOnlyVisible: boolean;
402
+
403
+ /**
404
+ * When enabled, restricts the number of panel elements to `panelsPerView + 1` to reduce memory usage.
405
+ * @dependency Requires - Must be used with {@link FlickingOptions.panelsPerView | panelsPerView}. When panelsPerView is -1 (auto), this option is ignored.
406
+ *
407
+ * @remarks
408
+ * After Flicking initialization, this property can be used to add or remove the number of rendered panels.
409
+ *
410
+ * The option object contains:
411
+ * - `renderPanel`: A rendering function for the panel element's innerHTML
412
+ * - `initialPanelCount`: Initial panel count to render
413
+ * - `cache` (optional, default: false): Whether to cache rendered panel's innerHTML
414
+ * - `panelClass` (optional, default: "flicking-panel"): The class name for rendered panel elements
415
+ *
416
+ * @example
417
+ * ```ts
418
+ * import Flicking, { VirtualPanel } from "@egjs/flicking";
419
+ *
420
+ * const flicking = new Flicking("#some_el", {
421
+ * panelsPerView: 3,
422
+ * virtual: {
423
+ * renderPanel: (panel: VirtualPanel, index: number) => `Panel ${index}`,
424
+ * initialPanelCount: 100
425
+ * }
426
+ * });
427
+ *
428
+ * // Add 100 virtual panels (at the end)
429
+ * flicking.virtual.append(100);
430
+ *
431
+ * // Remove 100 virtual panels from 0 to 100
432
+ * flicking.virtual.remove(0, 100);
433
+ * ```
434
+ *
435
+ * @defaultValue null
436
+ *
437
+ * @since 4.4.0
438
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/virtual-scroll | Demo: Virtual Scroll}
439
+ */
133
440
  virtual: VirtualOptions | null;
134
441
 
135
442
  // OTHERS
443
+ /**
444
+ * Call {@link Flicking.init | init()} automatically when creating Flicking's instance.
445
+ * @defaultValue true
446
+ * @readonly
447
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/basic/auto-init | Demo: Auto Init}
448
+ */
136
449
  autoInit: boolean;
450
+
451
+ /**
452
+ * Whether to automatically call {@link Flicking.resize | resize()} when the viewport element (.flicking-viewport) size is changed.
453
+ * @defaultValue true
454
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/auto-resize | Demo: Auto Resize}
455
+ */
137
456
  autoResize: boolean;
457
+
458
+ /**
459
+ * 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
460
+ * @defaultValue true
461
+ * @since 4.4.0
462
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/auto-resize | Demo: Auto Resize}
463
+ */
138
464
  useResizeObserver: boolean;
465
+
466
+ /**
467
+ * Delays size recalculation from `autoResize` by the given time in milliseconds.
468
+ * @remarks
469
+ * If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
470
+ * This can increase performance by preventing `resize` being called too often.
471
+ * @defaultValue 0
472
+ * @since 4.6.0
473
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/resize-debounce | Demo: Resize Debounce}
474
+ */
139
475
  resizeDebounce: number;
476
+
477
+ /**
478
+ * Whether to use ResizeObserver to observe the size of the panel element.
479
+ * @dependency Conditional - Only available when {@link FlickingOptions.useResizeObserver | useResizeObserver} is enabled
480
+ *
481
+ * @remarks
482
+ * This option guarantees that the resize event is triggered when the size of the panel element is changed.
483
+ *
484
+ * @since 4.13.1
485
+ * @defaultValue false
486
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/observe-panel-resize | Demo: Observe Panel Resize}
487
+ */
140
488
  observePanelResize: boolean;
489
+
490
+ /**
491
+ * The maximum time for size recalculation delay when using `resizeDebounce`, in milliseconds.
492
+ * @remarks
493
+ * This guarantees that size recalculation is performed at least once every (n)ms.
494
+ * @defaultValue 100
495
+ * @since 4.6.0
496
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/resize-debounce | Demo: Resize Debounce}
497
+ */
141
498
  maxResizeDebounce: number;
499
+
500
+ /**
501
+ * By enabling this, Flicking will calculate all internal size with CSS width computed with getComputedStyle.
502
+ * @remarks
503
+ * This can prevent 1px offset issue in some cases where panel size has the fractional part.
504
+ * All sizes will have the original size before CSS {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform | transform} is applied on the element.
505
+ * @defaultValue false
506
+ * @since 4.9.0
507
+ * @see {@link https://naver.github.io/egjs-flicking/docs/demos/advanced/fractional-size | Demo: Fractional Size}
508
+ */
142
509
  useFractionalSize: boolean;
510
+
511
+ /**
512
+ * This is an option for the frameworks (React, Vue, Angular, ...).
513
+ * Don't set it as it's automatically managed by Flicking.
514
+ * @defaultValue null
515
+ * @internal
516
+ * @readonly
517
+ */
143
518
  externalRenderer: ExternalRenderer | null;
519
+
520
+ /**
521
+ * This option works only when autoResize is set to true.
522
+ * @internal
523
+ * @defaultValue false
524
+ */
144
525
  optimizeSizeUpdate: boolean;
145
526
 
146
- // @deprecated
527
+ /**
528
+ * @deprecated Use {@link FlickingOptions.externalRenderer | externalRenderer} instead
529
+ */
147
530
  renderExternal: {
148
531
  renderer: new (options: RendererOptions) => ExternalRenderer;
149
532
  rendererOptions: RendererOptions;
@@ -151,23 +534,41 @@ export interface FlickingOptions {
151
534
  }
152
535
 
153
536
  /**
154
- * @extends Component
155
- * @support {"ie": "9+(with polyfill)", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "4.X+"}
156
- * @requires {@link https://github.com/naver/egjs-component|@egjs/component}
157
- * @requires {@link https://github.com/naver/egjs-axes|@egjs/axes}
537
+ * Parameters for {@link Flicking.getStatus}
538
+ * @public
158
539
  */
540
+ export interface GetStatusParams {
541
+ /**
542
+ * Include current panel index
543
+ * @defaultValue true
544
+ */
545
+ index?: boolean;
546
+ /**
547
+ * Include camera position. Only works when {@link FlickingOptions.moveType | moveType} is `freeScroll`
548
+ * @defaultValue true
549
+ */
550
+ position?: boolean;
551
+ /**
552
+ * Include panel's `outerHTML`
553
+ * @defaultValue false
554
+ */
555
+ includePanelHTML?: boolean;
556
+ /**
557
+ * Include only visible panels' HTML. Only available when `includePanelHTML` is `true`
558
+ * @defaultValue false
559
+ */
560
+ visiblePanelsOnly?: boolean;
561
+ }
562
+
159
563
  class Flicking extends Component<FlickingEvents> {
160
564
  /**
161
565
  * Version info string
162
- * @ko 버전정보 문자열
163
- * @type {string}
164
- * @readonly
165
566
  * @example
166
567
  * ```ts
167
568
  * Flicking.VERSION; // ex) 4.0.0
168
569
  * ```
169
570
  */
170
- public static VERSION = "#__VERSION__#";
571
+ public static readonly VERSION: string = "#__VERSION__#";
171
572
 
172
573
  // Core components
173
574
  private _viewport: Viewport;
@@ -204,7 +605,6 @@ class Flicking extends Component<FlickingEvents> {
204
605
  private _dragThreshold: FlickingOptions["dragThreshold"];
205
606
  private _animationThreshold: FlickingOptions["animationThreshold"];
206
607
  private _useCSSOrder: FlickingOptions["useCSSOrder"];
207
-
208
608
  private _interruptable: FlickingOptions["interruptable"];
209
609
  private _bounce: FlickingOptions["bounce"];
210
610
  private _iOSEdgeSwipeThreshold: FlickingOptions["iOSEdgeSwipeThreshold"];
@@ -234,784 +634,466 @@ class Flicking extends Component<FlickingEvents> {
234
634
 
235
635
  // Components
236
636
  /**
237
- * {@link Control} instance of the Flicking
238
- * @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
239
- * @type {Control}
240
- * @default SnapControl
637
+ * {@link Control} instance that manages user input and panel movement animations
638
+ * @remarks
639
+ * The concrete Control implementation is selected based on {@link FlickingOptions.moveType | moveType} option.
640
+ * @privateRemarks
641
+ * The control instance is created during construction by {@link Flicking._createControl}.
241
642
  * @readonly
242
- * @see Control
243
- * @see SnapControl
244
- * @see FreeControl
245
643
  */
246
- public get control() {
644
+ public get control(): Control {
247
645
  return this._control;
248
646
  }
249
647
 
250
648
  /**
251
- * {@link Camera} instance of the Flicking
252
- * @ko 현재 Flicking에 활성화된 {@link Camera} 인스턴스
253
- * @type {Camera}
254
- * @default LinearCamera
649
+ * {@link Camera} instance that manages actual movement and positioning inside the viewport
650
+ * @remarks
651
+ * The concrete Camera implementation is selected based on {@link FlickingOptions.circular} and {@link FlickingOptions.bound} options.
652
+ * @privateRemarks
653
+ * The camera instance is created during construction by {@link Flicking._createCamera}.
255
654
  * @readonly
256
- * @see Camera
257
- * @see LinearCamera
258
- * @see BoundCamera
259
- * @see CircularCamera
260
655
  */
261
- public get camera() {
656
+ public get camera(): Camera {
262
657
  return this._camera;
263
658
  }
264
659
 
265
660
  /**
266
- * {@link Renderer} instance of the Flicking
267
- * @ko 현재 Flicking에 활성화된 {@link Renderer} 인스턴스
268
- * @type {Renderer}
269
- * @default VanillaRenderer
661
+ * {@link Renderer} instance that manages panels and their elements
662
+ * @remarks
663
+ * The concrete Renderer implementation is selected based on {@link Flicking.externalRenderer} and {@link FlickingOptions.virtual} options.
664
+ * @privateRemarks
665
+ * The renderer instance is created during construction by {@link Flicking._createRenderer}.
270
666
  * @readonly
271
- * @see Renderer
272
- * @see VanillaRenderer
273
- * @see ExternalRenderer
274
667
  */
275
- public get renderer() {
668
+ public get renderer(): Renderer {
276
669
  return this._renderer;
277
670
  }
278
671
 
279
672
  /**
280
- * A component that manages viewport size
281
- * @ko 뷰포트 크기 정보를 담당하는 컴포넌트
282
- * @type {Viewport}
673
+ * {@link Viewport} instance that manages viewport size and element
674
+ * @privateRemarks
675
+ * The viewport instance is created during construction by {@link Flicking} constructor.
283
676
  * @readonly
284
- * @see Viewport
285
677
  */
286
- public get viewport() { return this._viewport; }
678
+ public get viewport(): Viewport {
679
+ return this._viewport;
680
+ }
681
+
287
682
  /**
288
- * {@link AutoResizer} instance of the Flicking
289
- * @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
290
- * @internal
683
+ * {@link AutoResizer} instance that detects size changes and triggers resize when {@link FlickingOptions.autoResize | autoResize} option is enabled
684
+ * @privateRemarks
685
+ * The autoResizer instance is created during construction by {@link Flicking} constructor.
291
686
  * @readonly
292
687
  */
293
- public get autoResizer() { return this._autoResizer; }
688
+ public get autoResizer(): AutoResizer {
689
+ return this._autoResizer;
690
+ }
691
+
294
692
  // Internal States
295
693
  /**
296
- * Whether Flicking's {@link Flicking#init init()} is called.
297
- * This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
298
- * @ko Flicking의 {@link Flicking#init init()} 호출되었는지를 나타내는 멤버 변수.
299
- * 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
300
- * @type {boolean}
301
- * @default false
694
+ * Whether Flicking's {@link Flicking.init} is called.
695
+ * @remarks
696
+ * This is `true` when {@link Flicking.init} is called, and is `false` after calling {@link Flicking.destroy}.
697
+ * Use this to check if Flicking is ready before calling certain methods that require initialization.
698
+ * @defaultValue false
302
699
  * @readonly
700
+ * @example
701
+ * ```ts
702
+ * if (flicking.initialized) {
703
+ * flicking.setStatus(status);
704
+ * } else {
705
+ * await flicking.init();
706
+ * flicking.setStatus(status);
707
+ * }
708
+ * ```
303
709
  */
304
- public get initialized() {
710
+ public get initialized(): boolean {
305
711
  return this._initialized;
306
712
  }
307
713
 
308
714
  /**
309
- * Whether the `circular` option is enabled.
310
- * The {@link Flicking#circular circular} option can't be enabled when sum of the panel sizes are too small.
311
- * @ko {@link Flicking#circular circular} 옵션이 활성화되었는지 여부를 나타내는 멤버 변수.
312
- * {@link Flicking#circular circular} 옵션은 패널의 크기의 합이 충분하지 않을 경우 비활성화됩니다.
313
- * @type {boolean}
314
- * @default false
715
+ * Whether the circular mode is actually enabled.
716
+ * @remarks
717
+ * The {@link FlickingOptions.circular} option may not be enabled when the sum of panel sizes is too small.
718
+ * This property reflects the actual enabled state, which may differ from the {@link FlickingOptions.circular} option value.
719
+ * @defaultValue false
315
720
  * @readonly
316
721
  */
317
- public get circularEnabled() {
722
+ public get circularEnabled(): boolean {
318
723
  return this._camera.circularEnabled;
319
724
  }
320
725
 
321
726
  /**
322
- * Whether the `virtual` option is enabled.
323
- * The {@link Flicking#virtual virtual} option can't be enabled when {@link Flicking#panelsPerView panelsPerView} is less or equal than zero.
324
- * @ko {@link Flicking#virtual virtual} 옵션이 활성화되었는지 여부를 나타내는 멤버 변수.
325
- * {@link Flicking#virtual virtual} 옵션은 {@link Flicking#panelsPerView panelsPerView} 옵션의 값이 0보다 같거나 작으면 비활성화됩니다.
326
- * @type {boolean}
327
- * @default false
727
+ * Whether the virtual mode is actually enabled.
728
+ * @remarks
729
+ * The {@link FlickingOptions.virtual} option may not be enabled when {@link FlickingOptions.panelsPerView} is less than or equal to zero.
730
+ * This property reflects the actual enabled state, which may differ from the {@link FlickingOptions.virtual} option value.
731
+ * @defaultValue false
328
732
  * @readonly
329
733
  */
330
- public get virtualEnabled() {
734
+ public get virtualEnabled(): boolean {
331
735
  return this._panelsPerView > 0 && this._virtual != null;
332
736
  }
333
737
 
334
738
  /**
335
- * Index number of the {@link Flicking#currentPanel currentPanel}
336
- * @ko {@link Flicking#currentPanel currentPanel}의 인덱스 번호
337
- * @type {number}
338
- * @default 0
739
+ * Index of the currently active panel.
740
+ * @remarks
741
+ * Returns -1 when there is no active panel. This is a shorthand for `Flicking.currentPanel.index`.
339
742
  * @readonly
340
743
  */
341
- public get index() {
744
+ public get index(): number {
342
745
  return this._control.activeIndex;
343
746
  }
344
747
 
345
748
  /**
346
- * The root(`.flicking-viewport`) element
347
- * @ko root(`.flicking-viewport`) 엘리먼트
348
- * @type {HTMLElement}
749
+ * The root viewport element (`.flicking-viewport`).
750
+ * @remarks
751
+ * This is the element passed to the Flicking constructor. It is a shorthand for `Flicking.viewport.element`.
349
752
  * @readonly
350
753
  */
351
- public get element() {
754
+ public get element(): HTMLElement {
352
755
  return this._viewport.element;
353
756
  }
354
757
 
355
758
  /**
356
- * Currently active panel
357
- * @ko 현재 선택된 패널
358
- * @type {Panel}
759
+ * The currently active panel.
760
+ * @remarks
761
+ * Returns `null` when there is no active panel. This is a shorthand for `Flicking.control.activePanel`.
359
762
  * @readonly
360
- * @see Panel
361
763
  */
362
- public get currentPanel() {
764
+ public get currentPanel(): Panel | null {
363
765
  return this._control.activePanel;
364
766
  }
365
767
 
366
768
  /**
367
- * Array of panels
368
- * @ko 전체 패널들의 배열
369
- * @type {Panel[]}
769
+ * Array of all panels.
770
+ * @remarks
771
+ * This is a shorthand for `Flicking.renderer.panels`.
370
772
  * @readonly
371
- * @see Panel
372
773
  */
373
- public get panels() {
774
+ public get panels(): Panel[] {
374
775
  return this._renderer.panels;
375
776
  }
376
777
 
377
778
  /**
378
- * Count of panels
379
- * @ko 전체 패널의 개수
380
- * @type {number}
779
+ * Total number of panels.
780
+ * @remarks
781
+ * This is a shorthand for `Flicking.renderer.panelCount`.
381
782
  * @readonly
382
783
  */
383
- public get panelCount() {
784
+ public get panelCount(): number {
384
785
  return this._renderer.panelCount;
385
786
  }
386
787
 
387
788
  /**
388
- * Array of panels that is visible at the current position
389
- * @ko 현재 보이는 패널의 배열
390
- * @type {Panel[]}
789
+ * Array of panels that are currently visible in the viewport.
790
+ * @remarks
791
+ * This is a shorthand for `Flicking.camera.visiblePanels`.
391
792
  * @readonly
392
- * @see Panel
393
793
  */
394
- public get visiblePanels() {
794
+ public get visiblePanels(): Panel[] {
395
795
  return this._camera.visiblePanels;
396
796
  }
397
797
 
398
798
  /**
399
- * Whether Flicking's animating
400
- * @ko 현재 애니메이션 동작 여부
401
- * @type {boolean}
799
+ * Whether Flicking is currently animating.
800
+ * @remarks
801
+ * This is a shorthand for `Flicking.control.animating`.
402
802
  * @readonly
403
803
  */
404
- public get animating() {
804
+ public get animating(): boolean {
405
805
  return this._control.animating;
406
806
  }
407
807
 
408
808
  /**
409
- * Whether user is clicking or touching
410
- * @ko 현재 사용자가 클릭/터치중인지 여부
411
- * @type {boolean}
809
+ * Whether the user is currently clicking or touching the viewport.
810
+ * @remarks
811
+ * This is a shorthand for `Flicking.control.holding`.
412
812
  * @readonly
413
813
  */
414
- public get holding() {
814
+ public get holding(): boolean {
415
815
  return this._control.holding;
416
816
  }
417
817
 
418
818
  /**
419
- * A current list of activated plugins
420
- * @ko 현재 활성화된 플러그인 목록
421
- * @type {Plugin[]}
819
+ * Array of currently activated plugins.
820
+ * @remarks
821
+ * Plugins are added via {@link Flicking.addPlugins} and removed via {@link Flicking.removePlugins}.
422
822
  * @readonly
423
823
  */
424
- public get activePlugins() {
824
+ public get activePlugins(): Plugin[] {
425
825
  return this._plugins;
426
826
  }
427
827
 
428
828
  // Options Getter
429
829
  // UI / LAYOUT
430
- /**
431
- * Align position of the panels within viewport. You can set different values each for the panel and camera
432
- * @ko 뷰포트 내에서 패널 정렬방식을 설정하는 옵션. 카메라와 패널 개별로 옵션을 설정할 수도 있습니다
433
- * @type {ALIGN | string | number | { panel: string | number, camera: string | number }}
434
- * @property {ALIGN | string | number} panel The align value for each {@link Panel}s<ko>개개의 {@link Panel}에 적용할 값</ko>
435
- * @property {ALIGN | string | number} camera The align value for {@link Camera}<ko>{@link Camera}에 적용할 값</ko>
436
- * @default "center"
437
- * @see {@link https://naver.github.io/egjs-flicking/Options#align align ( Options )}
438
- * @example
439
- * ```ts
440
- * const possibleOptions = [
441
- * // Literal strings
442
- * "prev", "center", "next",
443
- * // % values, applied to both panel & camera
444
- * "0%", "25%", "42%",
445
- * // px values, arithmetic calculation with (+/-) is also allowed.
446
- * "0px", "100px", "50% - 25px",
447
- * // numbers, same to number + px ("0px", "100px")
448
- * 0, 100, 1000,
449
- * // Setting a different value for panel & camera
450
- * { panel: "10%", camera: "25%" }
451
- * ];
452
- *
453
- * possibleOptions.forEach(align => {
454
- * new Flicking("#el", { align });
455
- * });
456
- * ```
457
- */
458
- public get align() {
830
+ /** Current value of the {@link FlickingOptions.align | align} option. */
831
+ public get align(): FlickingOptions["align"] {
459
832
  return this._align;
460
833
  }
461
834
 
462
- /**
463
- * Index of the panel to move when Flicking's {@link Flicking#init init()} is called. A zero-based integer
464
- * @ko Flicking의 {@link Flicking#init init()}이 호출될 때 이동할 디폴트 패널의 인덱스로, 0부터 시작하는 정수입니다.
465
- * @type {number}
466
- * @default 0
467
- * @see {@link https://naver.github.io/egjs-flicking/Options#defaultindex defaultIndex ( Options )}
468
- */
469
- public get defaultIndex() {
835
+ /** Current value of the {@link FlickingOptions.defaultIndex | defaultIndex} option. */
836
+ public get defaultIndex(): FlickingOptions["defaultIndex"] {
470
837
  return this._defaultIndex;
471
838
  }
472
839
 
473
- /**
474
- * Direction of panel movement (true: horizontal, false: vertical)
475
- * @ko 패널 이동 방향 (true: 가로방향, false: 세로방향)
476
- * @type {boolean}
477
- * @default true
478
- * @see {@link https://naver.github.io/egjs-flicking/Options#horizontal horizontal ( Options )}
479
- */
480
- public get horizontal() {
840
+ /** Current value of the {@link FlickingOptions.horizontal | horizontal} option. */
841
+ public get horizontal(): FlickingOptions["horizontal"] {
481
842
  return this._horizontal;
482
843
  }
483
844
 
484
- /**
485
- * Enables circular(continuous loop) mode, which connects first/last panel for continuous scrolling.
486
- * @ko 순환 모드를 활성화합니다. 순환 모드에서는 양 끝의 패널이 서로 연결되어 끊김없는 스크롤이 가능합니다.
487
- * @type {boolean}
488
- * @default false
489
- * @see {@link https://naver.github.io/egjs-flicking/Options#circular circular ( Options )}
490
- */
491
- public get circular() {
845
+ /** Current value of the {@link FlickingOptions.circular | circular} option. */
846
+ public get circular(): FlickingOptions["circular"] {
492
847
  return this._circular;
493
848
  }
494
849
 
495
850
  /**
496
- * Set panel control mode for the case when circular cannot be enabled.
497
- * "linear" will set the view's range from the top of the first panel to the top of the last panel.
498
- * "bound" will prevent the view from going out of the first/last panel, so it won't show empty spaces before/after the first/last panel.
499
- * @ko 순환 모드 사용 불가능시 사용할 패널 조작 범위 설정 방식을 변경합니다.
500
- * "linear" 사용시 시점이 첫번째 엘리먼트 위에서부터 마지막 엘리먼트 위까지 움직일 수 있도록 설정합니다.
501
- * "bound" 사용시 시점이 첫번째 엘리먼트와 마지막 엘리먼트의 끝과 끝 사이에서 움직일 수 있도록 설정합니다.
502
- * @see CIRCULAR_FALLBACK
503
- * @type {string}
504
- * @default "linear"
505
- * @see {@link https://naver.github.io/egjs-flicking/Options#circularfallback circularFallback ( Options )}
506
- */
507
- public get circularFallback() {
851
+ * Current value of the {@link FlickingOptions.circularFallback | circularFallback} option.
852
+ * @since 4.5.0
853
+ */
854
+ public get circularFallback(): FlickingOptions["circularFallback"] {
508
855
  return this._circularFallback;
509
856
  }
510
857
 
511
- /**
512
- * Prevent the view(camera element) from going out of the first/last panel, so it won't show empty spaces before/after the first/last panel
513
- * Only can be enabled when `circular=false`
514
- * @ko 뷰(카메라 엘리먼트)가 첫번째와 마지막 패널 밖으로 넘어가지 못하게 하여, 첫번째/마지막 패널 전/후의 빈 공간을 보이지 않도록 하는 옵션입니다
515
- * `circular=false`인 경우에만 사용할 수 있습니다
516
- * @type {boolean}
517
- * @default false
518
- * @see {@link https://naver.github.io/egjs-flicking/Options#bound bound ( Options )}
519
- */
520
- public get bound() {
858
+ /** Current value of the {@link FlickingOptions.bound | bound} option. */
859
+ public get bound(): FlickingOptions["bound"] {
521
860
  return this._bound;
522
861
  }
523
862
 
524
- /**
525
- * Update height of the viewport element after movement same to the height of the panel below. This can be only enabled when `horizontal=true`
526
- * @ko 이동한 후 뷰포트 엘리먼트의 크기를 현재 패널의 높이와 동일하게 설정합니다. `horizontal=true`인 경우에만 사용할 수 있습니다.
527
- * @type {boolean}
528
- * @default false
529
- * @see {@link https://naver.github.io/egjs-flicking/Options#adaptive adaptive ( Options )}
530
- */
531
- public get adaptive() {
863
+ /** Current value of the {@link FlickingOptions.adaptive | adaptive} option. */
864
+ public get adaptive(): FlickingOptions["adaptive"] {
532
865
  return this._adaptive;
533
866
  }
534
867
 
535
868
  /**
536
- * A visible number of panels on viewport. Enabling this option will automatically resize panel size
537
- * @ko 한 화면에 보이는 패널의 개수. 이 옵션을 활성화할 경우 패널의 크기를 강제로 재조정합니다
538
- * @type {number}
539
- * @default -1
540
- * @see {@link https://naver.github.io/egjs-flicking/Options#panelsperview panelsPerView ( Options )}
869
+ * Current value of the {@link FlickingOptions.panelsPerView | panelsPerView} option.
870
+ * @since 4.2.0
541
871
  */
542
- public get panelsPerView() {
872
+ public get panelsPerView(): FlickingOptions["panelsPerView"] {
543
873
  return this._panelsPerView;
544
874
  }
545
875
 
546
- /**
547
- * Enabling this option will not change `width/height` style of the panels if {@link Flicking#panelsPerView} is enabled.
548
- * This behavior can be useful in terms of performance when you're manually managing all panel sizes
549
- * @ko 이 옵션을 활성화할 경우, {@link Flicking#panelsPerView} 옵션이 활성화되었을 때 패널의 `width/height` 스타일을 변경하지 않도록 설정합니다.
550
- * 모든 패널들의 크기를 직접 관리하고 있을 경우, 이 옵션을 활성화하면 성능면에서 유리할 수 있습니다
551
- * @type {boolean}
552
- * @default false
553
- */
554
- public get noPanelStyleOverride() {
876
+ /** Current value of the {@link FlickingOptions.noPanelStyleOverride | noPanelStyleOverride} option. */
877
+ public get noPanelStyleOverride(): FlickingOptions["noPanelStyleOverride"] {
555
878
  return this._noPanelStyleOverride;
556
879
  }
557
880
 
558
881
  /**
559
- * Enabling this option will automatically call {@link Flicking#resize} when all image/video inside panels are loaded.
560
- * This can be useful when you have contents inside Flicking that changes its size when it's loaded
561
- * @ko 이 옵션을 활성화할 경우, Flicking 패널 내부의 이미지/비디오들이 로드되었을 때 자동으로 {@link Flicking#resize}를 호출합니다.
562
- * 이 동작은 Flicking 내부에 로드 전/후로 크기가 변하는 콘텐츠를 포함하고 있을 때 유용하게 사용하실 수 있습니다.
563
- * @type {boolean}
564
- * @default false
565
- * @see {@link https://naver.github.io/egjs-flicking/Options#resizeOnContentsReady resizeOnContentsReady ( Options )}
882
+ * Current value of the {@link FlickingOptions.resizeOnContentsReady | resizeOnContentsReady} option.
883
+ * @since 4.3.0
566
884
  */
567
- public get resizeOnContentsReady() {
885
+ public get resizeOnContentsReady(): FlickingOptions["resizeOnContentsReady"] {
568
886
  return this._resizeOnContentsReady;
569
887
  }
570
888
 
571
889
  /**
572
- * If you enable this option on child Flicking when the Flicking is placed inside the Flicking, the parent Flicking will move in the same direction after the child Flicking reaches the first/last panel.
573
- * If the parent Flicking and child Flicking have different horizontal option, you do not need to set this option.
574
- * @ko Flicking 내부에 Flicking이 배치될 때 하위 Flicking에서 이 옵션을 활성화하면 하위 Flicking이 첫/마지막 패널에 도달한 뒤부터 같은 방향으로 상위 Flicking이 움직입니다.
575
- * 만약 상위 Flicking과 하위 Flicking이 서로 다른 horizontal 옵션을 가지고 있다면 이 옵션을 설정할 필요가 없습니다.
576
- * @type {boolean}
577
- * @default false
578
- * @see {@link https://naver.github.io/egjs-flicking/Options#nested nested ( Options )}
890
+ * Current value of the {@link FlickingOptions.nested | nested} option.
891
+ * @since 4.7.0
579
892
  */
580
- public get nested() {
893
+ public get nested(): FlickingOptions["nested"] {
581
894
  return this._nested;
582
895
  }
583
896
 
584
897
  // EVENTS
585
- /**
586
- * A Threshold from viewport edge before triggering `needPanel` event
587
- * @ko `needPanel`이벤트가 발생하기 위한 뷰포트 끝으로부터의 최대 거리
588
- * @type {number}
589
- * @default 0
590
- * @see {@link https://naver.github.io/egjs-flicking/Options#needpanelthreshold needPanelThreshold ( Options )}
591
- */
592
- public get needPanelThreshold() {
898
+ /** Current value of the {@link FlickingOptions.needPanelThreshold | needPanelThreshold} option. */
899
+ public get needPanelThreshold(): FlickingOptions["needPanelThreshold"] {
593
900
  return this._needPanelThreshold;
594
901
  }
595
902
 
596
903
  /**
597
- * When enabled, events are not triggered before `ready` when initializing
598
- * @ko 활성화할 경우 초기화시 `ready` 이벤트 이전의 이벤트가 발생하지 않습니다.
599
- * @type {boolean}
600
- * @default true
601
- * @see {@link https://naver.github.io/egjs-flicking/Options#preventeventsbeforeinit preventEventsBeforeInit ( Options )}
904
+ * Current value of the {@link FlickingOptions.preventEventsBeforeInit | preventEventsBeforeInit} option.
905
+ * @since 4.2.0
602
906
  */
603
- public get preventEventsBeforeInit() {
907
+ public get preventEventsBeforeInit(): FlickingOptions["preventEventsBeforeInit"] {
604
908
  return this._preventEventsBeforeInit;
605
909
  }
606
910
 
607
911
  // ANIMATION
608
- /**
609
- * Deceleration value for panel movement animation which is triggered by user input. A higher value means a shorter animation time
610
- * @ko 사용자의 동작으로 가속도가 적용된 패널 이동 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아집니다
611
- * @type {number}
612
- * @default 0.0075
613
- * @see {@link https://naver.github.io/egjs-flicking/Options#deceleration deceleration ( Options )}
614
- */
615
- public get deceleration() {
912
+ /** Current value of the {@link FlickingOptions.deceleration | deceleration} option. */
913
+ public get deceleration(): FlickingOptions["deceleration"] {
616
914
  return this._deceleration;
617
915
  }
618
916
 
619
- /**
620
- * An easing function applied to the panel movement animation. Default value is `easeOutCubic`
621
- * @ko 패널 이동 애니메이션에 적용할 easing 함수. 기본값은 `easeOutCubic`이다
622
- * @type {function}
623
- * @default x => 1 - Math.pow(1 - x, 3)
624
- * @see Easing Functions Cheat Sheet {@link http://easings.net/} <ko>이징 함수 Cheat Sheet {@link http://easings.net/}</ko>
625
- * @see {@link https://naver.github.io/egjs-flicking/Options#easing Easing ( Options )}
626
- */
627
- public get easing() {
917
+ /** Current value of the {@link FlickingOptions.easing | easing} option. */
918
+ public get easing(): FlickingOptions["easing"] {
628
919
  return this._easing;
629
920
  }
630
921
 
631
- /**
632
- * Default duration of the animation (ms)
633
- * @ko 디폴트 애니메이션 재생 시간 (ms)
634
- * @type {number}
635
- * @default 500
636
- * @see {@link https://naver.github.io/egjs-flicking/Options#duration duration ( Options )}
637
- */
638
- public get duration() {
922
+ /** Current value of the {@link FlickingOptions.duration | duration} option. */
923
+ public get duration(): FlickingOptions["duration"] {
639
924
  return this._duration;
640
925
  }
641
926
 
642
927
  // INPUT
643
- /**
644
- * Types of input devices to enable
645
- * @ko 활성화할 입력 장치 종류
646
- * @type {string[]}
647
- * @default ["touch", "mouse"]
648
- * @see {@link https://naver.github.io/egjs-axes/Options#paninput-options Possible values (PanInputOption#inputType)}
649
- * <ko>{@link https://naver.github.io/egjs-axes/Options#paninput-options 가능한 값들 (PanInputOption#inputType)}</ko>
650
- * @see {@link https://naver.github.io/egjs-flicking/Options#inputtype inputType ( Options )}
651
- */
652
- public get inputType() {
928
+ /** Current value of the {@link FlickingOptions.inputType | inputType} option. */
929
+ public get inputType(): FlickingOptions["inputType"] {
653
930
  return this._inputType;
654
931
  }
655
932
 
656
- /**
657
- * Movement style by user input. This will change instance type of {@link Flicking#control}
658
- * You can use the values of the constant {@link MOVE_TYPE}
659
- * @ko 사용자 입력에 의한 이동 방식. 이 값에 따라 {@link Flicking#control}의 인스턴스 타입이 결정됩니다
660
- * 상수 {@link MOVE_TYPE}에 정의된 값들을 이용할 수 있습니다
661
- * @type {MOVE_TYPE | Pair<string, object>}
662
- * @default "snap"
663
- * @see {@link https://naver.github.io/egjs-flicking/Options#movetype moveType ( Options )}
664
- * @example
665
- * |moveType|control|options|
666
- * |:---:|:---:|:---:|
667
- * |"snap"|{@link SnapControl}||
668
- * |"freeScroll"|{@link FreeControl}|{@link FreeControlOptions}|
669
- *
670
- * ```ts
671
- * import Flicking, { MOVE_TYPE } from "@egjs/flicking";
672
- *
673
- * const flicking = new Flicking({
674
- * moveType: MOVE_TYPE.SNAP
675
- * });
676
- * ```
677
- *
678
- * ```ts
679
- * const flicking = new Flicking({
680
- * // If you want more specific settings for the moveType
681
- * // [moveType, options for that moveType]
682
- * // In this case, it's ["freeScroll", FreeControlOptions]
683
- * moveType: [MOVE_TYPE.FREE_SCROLL, { stopAtEdge: true }]
684
- * });
685
- * ```
686
- */
687
- public get moveType() {
933
+ /** Current value of the {@link FlickingOptions.moveType | moveType} option. */
934
+ public get moveType(): FlickingOptions["moveType"] {
688
935
  return this._moveType;
689
936
  }
690
937
 
691
- /**
692
- * Movement threshold to change panel (unit: px). It should be dragged above the threshold to change the current panel.
693
- * @ko 패널 변경을 위한 이동 임계값 (단위: px). 주어진 값 이상으로 스크롤해야만 패널 변경이 가능합니다.
694
- * @type {number}
695
- * @default 40
696
- * @see {@link https://naver.github.io/egjs-flicking/Options#threshold Threshold ( Options )}
697
- */
698
- public get threshold() {
938
+ /** Current value of the {@link FlickingOptions.threshold | threshold} option. */
939
+ public get threshold(): FlickingOptions["threshold"] {
699
940
  return this._threshold;
700
941
  }
701
942
 
702
- /**
703
- * Minimal distance of user input before recognizing (unit: px). It should be dragged above the dragThreshold to move the panel.
704
- * @ko 사용자의 입력을 인식하기 위한 최소한의 거리 (단위: px). 주어진 값 이상으로 스크롤해야만 패널이 움직입니다.
705
- * @type {number}
706
- * @default 1
707
- * @see {@link https://naver.github.io/egjs-flicking/Options#dragThreshold dragThreshold ( Options )}
708
- */
709
- public get dragThreshold() {
943
+ /** Current value of the {@link FlickingOptions.dragThreshold | dragThreshold} option. */
944
+ public get dragThreshold(): FlickingOptions["dragThreshold"] {
710
945
  return this._dragThreshold;
711
946
  }
947
+
712
948
  /**
713
- * The minimum distance for animation to proceed. If the distance to be moved is less than `animationThreshold`, the movement proceeds immediately without animation (duration: 0).
714
- * @ko animation이 진행되기 위한 최소한의 거리. 이동하려는 거리가 `animationThreshold`보다 적으면 애니메이션 없이(duration: 0) 즉시 이동한다.
715
- * @type {number}
716
- * @default 0.5
717
- * @see {@link https://naver.github.io/egjs-flicking/Options#animationThreshold animationThreshold ( Options )}
949
+ * Current value of the {@link FlickingOptions.animationThreshold | animationThreshold} option.
950
+ * @since 4.15.0
718
951
  */
719
952
  public get animationThreshold() {
720
953
  return this._animationThreshold;
721
954
  }
955
+
722
956
  /**
723
- * Using `useCSSOrder` does not change the DOM order, but the `order` CSS property changes the order on the screen. (When `circular` is used, the DOM order changes depending on the position.)
724
- * When using `iframe`, you can prevent reloading when the DOM order changes.
725
- * In svelte, CSS order is always used.
726
- * @ko `useCSSOrder`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다. (`circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다.)
727
- * `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
728
- * svelte에서는 css order를 무조건 사용한다.
729
- * @type {boolean}
730
- * @default false
731
- * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrder useCSSOrder ( Options )}
957
+ * Current value of the {@link FlickingOptions.useCSSOrder | useCSSOrder} option.
958
+ * @since 4.15.0
732
959
  */
733
960
  public get useCSSOrder() {
734
961
  return this._useCSSOrder;
735
962
  }
736
963
 
737
- /**
738
- * Set animation to be interruptable by click/touch.
739
- * @ko 사용자의 클릭/터치로 인해 애니메이션을 도중에 멈출 수 있도록 설정합니다.
740
- * @type {boolean}
741
- * @default true
742
- * @see {@link https://naver.github.io/egjs-flicking/Options#interruptable Interruptable ( Options )}
743
- */
744
- public get interruptable() {
964
+ /** Current value of the {@link FlickingOptions.interruptable | interruptable} option. */
965
+ public get interruptable(): FlickingOptions["interruptable"] {
745
966
  return this._interruptable;
746
967
  }
747
968
 
748
- /**
749
- * The size value of the bounce area. Only can be enabled when `circular=false`.
750
- * You can set different bounce value for prev/next direction by using array.
751
- * `number` for px value, and `string` for px, and % value relative to viewport size.
752
- * You have to call {@link Control#updateInput} after changing this to take effect.
753
- * @ko Flicking이 최대 영역을 넘어서 갈 수 있는 최대 크기. `circular=false`인 경우에만 사용할 수 있습니다.
754
- * 배열을 통해 prev/next 방향에 대해 서로 다른 바운스 값을 지정할 수 있습니다.
755
- * `number`를 통해 px값을, `stirng`을 통해 px 혹은 뷰포트 크기 대비 %값을 사용할 수 있습니다.
756
- * 이 값을 변경시 {@link Control#updateInput}를 호출해야 합니다.
757
- * @type {string | number | Array<string | number>}
758
- * @default "20%"
759
- * @see {@link https://naver.github.io/egjs-flicking/Options#bounce bounce ( Options )}
760
- * @example
761
- * ```ts
762
- * const possibleOptions = [
763
- * // % values, relative to viewport element(".flicking-viewport")'s size
764
- * "0%", "25%", "42%",
765
- * // px values, arithmetic calculation with (+/-) is also allowed.
766
- * "0px", "100px", "50% - 25px",
767
- * // numbers, same to number + px ("0px", "100px")
768
- * 0, 100, 1000
769
- * ];
770
- * ```
771
- *
772
- * @example
773
- * ```ts
774
- * const flicking = new Flicking("#el", { bounce: "20%" });
775
- *
776
- * flicking.bounce = "100%";
777
- * flicking.control.updateInput(); // Call this to update!
778
- * ```
779
- */
780
- public get bounce() {
969
+ /** Current value of the {@link FlickingOptions.bounce | bounce} option. */
970
+ public get bounce(): FlickingOptions["bounce"] {
781
971
  return this._bounce;
782
972
  }
783
973
 
784
- /**
785
- * Size of the area from the right edge in iOS safari (in px) which enables swipe-back or swipe-forward
786
- * @ko iOS Safari에서 swipe를 통한 뒤로가기/앞으로가기를 활성화하는 오른쪽 끝으로부터의 영역의 크기 (px)
787
- * @type {number}
788
- * @default 30
789
- * @see {@link https://naver.github.io/egjs-flicking/Options#iosedgeswipethreshold iOSEdgeSwipeThreshold ( Options )}
790
- */
791
- public get iOSEdgeSwipeThreshold() {
974
+ /** Current value of the {@link FlickingOptions.iOSEdgeSwipeThreshold | iOSEdgeSwipeThreshold} option. */
975
+ public get iOSEdgeSwipeThreshold(): FlickingOptions["iOSEdgeSwipeThreshold"] {
792
976
  return this._iOSEdgeSwipeThreshold;
793
977
  }
794
978
 
795
- /**
796
- * Automatically prevent `click` event if the user has dragged at least a single pixel on the viewport element
797
- * @ko 사용자가 뷰포트 영역을 1픽셀이라도 드래그했을 경우 자동으로 {@link https://developer.mozilla.org/ko/docs/Web/API/Element/click_event click} 이벤트를 취소합니다
798
- * @type {boolean}
799
- * @default true
800
- * @see {@link https://naver.github.io/egjs-flicking/Options#preventclickondrag preventClickOnDrag ( Options )}
801
- */
802
- public get preventClickOnDrag() {
979
+ /** Current value of the {@link FlickingOptions.preventClickOnDrag | preventClickOnDrag} option. */
980
+ public get preventClickOnDrag(): FlickingOptions["preventClickOnDrag"] {
803
981
  return this._preventClickOnDrag;
804
982
  }
805
983
 
806
984
  /**
807
- * Whether to use the {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} when the user starts dragging
808
- * @ko 사용자가 드래그를 시작할 때 {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} 실행 여부
809
- * @type {boolean}
810
- * @default false
811
- * @see {@link https://naver.github.io/egjs-flicking/Options#preventDefaultOnDrag preventDefaultOnDrag ( Options )}
985
+ * Current value of the {@link FlickingOptions.preventDefaultOnDrag | preventDefaultOnDrag} option.
986
+ * @since 4.11.0
812
987
  */
813
- public get preventDefaultOnDrag() {
988
+ public get preventDefaultOnDrag(): FlickingOptions["preventDefaultOnDrag"] {
814
989
  return this._preventDefaultOnDrag;
815
990
  }
816
991
 
817
- /**
818
- * Automatically call {@link Flicking#disableInput disableInput()} on initialization
819
- * @ko Flicking init시에 {@link Flicking#disableInput disableInput()}을 바로 호출합니다
820
- * @type {boolean}
821
- * @default false
822
- * @see {@link https://naver.github.io/egjs-flicking/Options#disableoninit disableOnInit ( Options )}
823
- */
824
- public get disableOnInit() {
992
+ /** Current value of the {@link FlickingOptions.disableOnInit | disableOnInit} option. */
993
+ public get disableOnInit(): FlickingOptions["disableOnInit"] {
825
994
  return this._disableOnInit;
826
995
  }
827
996
 
828
997
  /**
829
- * Change active panel index on mouse/touch hold while animating.
830
- * `index` of the `willChange`/`willRestore` event will be used as new index.
831
- * @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
832
- * `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
833
- * @type {boolean}
834
- * @default false
835
- * @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
998
+ * Current value of the {@link FlickingOptions.changeOnHold | changeOnHold} option.
999
+ * @since 4.8.0
836
1000
  */
837
- public get changeOnHold() {
1001
+ public get changeOnHold(): FlickingOptions["changeOnHold"] {
838
1002
  return this._changeOnHold;
839
1003
  }
840
1004
 
841
1005
  // PERFORMANCE
842
- /**
843
- * Whether to render visible panels only. This can dramatically increase performance when there're many panels
844
- * @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수 있습니다
845
- * @type {boolean}
846
- * @default false
847
- * @see {@link https://naver.github.io/egjs-flicking/Options#renderonlyvisible renderOnlyVisible ( Options )}
848
- */
849
- public get renderOnlyVisible() {
1006
+ /** Current value of the {@link FlickingOptions.renderOnlyVisible | renderOnlyVisible} option. */
1007
+ public get renderOnlyVisible(): FlickingOptions["renderOnlyVisible"] {
850
1008
  return this._renderOnlyVisible;
851
1009
  }
852
1010
 
853
1011
  /**
854
- * By enabling this option, it will reduce memory consumption by restricting the number of DOM elements to `panelsPerView + 1`
855
- * Must be used with `panelsPerview`.
856
- * After Flicking's initialized, this property can be used to add/remove the panel count.
857
- * @ko 이 옵션을 활성화할 경우 패널 엘리먼트의 개수를 `panelsPerView + 1` 개로 고정함으로써, 메모리 사용량을 줄일 수 있습니다.
858
- * `panelsPerView` 옵션과 함께 사용되어야만 합니다.
859
- * Flicking 초기화 이후에, 이 프로퍼티는 렌더링하는 패널의 개수를 추가/제거하기 위해 사용될 수 있습니다.
860
- * @type {VirtualManager}
861
- * @property {function} renderPanel A rendering function for the panel element's innerHTML<ko>패널 엘리먼트의 innerHTML을 렌더링하는 함수</ko>
862
- * @property {number} initialPanelCount Initial panel count to render<ko>최초로 렌더링할 패널의 개수</ko>
863
- * @property {boolean} [cache=false] Whether to cache rendered panel's innerHTML<ko>렌더링된 패널의 innerHTML 정보를 캐시할지 여부</ko>
864
- * @property {string} [panelClass="flicking-panel"] The class name that will be applied to rendered panel elements<ko>렌더링되는 패널 엘리먼트에 적용될 클래스 이름</ko>
865
- * @see {@link https://naver.github.io/egjs-flicking/Options#virtual virtual ( Options )}
866
- * @example
867
- * ```ts
868
- * import Flicking, { VirtualPanel } from "@egjs/flicking";
869
- *
870
- * const flicking = new Flicking("#some_el", {
871
- * panelsPerView: 3,
872
- * virtual: {
873
- * renderPanel: (panel: VirtualPanel, index: number) => `Panel ${index}`,
874
- * initialPanelCount: 100
875
- * }
876
- * });
877
- *
878
- * // Add 100 virtual panels (at the end)
879
- * flicking.virtual.append(100);
880
- *
881
- * // Remove 100 virtual panels from 0 to 100
882
- * flicking.virtual.remove(0, 100);
883
- * ```
1012
+ * {@link VirtualManager} instance that manages virtual panels
1013
+ * @privateRemarks
1014
+ * The virtualManager instance is created during construction by {@link Flicking} constructor.
1015
+ * @readonly
884
1016
  */
885
- public get virtual() {
1017
+ public get virtual(): VirtualManager {
886
1018
  return this._virtualManager;
887
1019
  }
888
1020
 
889
1021
  // OTHERS
890
- /**
891
- * Call {@link Flicking#init init()} automatically when creating Flicking's instance
892
- * @ko Flicking 인스턴스를 생성할 때 자동으로 {@link Flicking#init init()}를 호출합니다
893
- * @type {boolean}
894
- * @default true
895
- * @see {@link https://naver.github.io/egjs-flicking/Options#autoinit autoInit ( Options )}
896
- * @readonly
897
- */
898
- public get autoInit() {
1022
+ /** Current value of the {@link FlickingOptions.autoInit | autoInit} option. */
1023
+ public get autoInit(): FlickingOptions["autoInit"] {
899
1024
  return this._autoInit;
900
1025
  }
901
1026
 
902
- /**
903
- * Whether to automatically call {@link Flicking#resize resize()} when the viewport element(.flicking-viewport)'s size is changed
904
- * @ko 뷰포트 엘리먼트(.flicking-viewport)의 크기 변경시 {@link Flicking#resize resize()} 메소드를 자동으로 호출할지 여부를 설정합니다
905
- * @type {boolean}
906
- * @default true
907
- */
908
- public get autoResize() {
1027
+ /** Current value of the {@link FlickingOptions.autoResize | autoResize} option. */
1028
+ public get autoResize(): FlickingOptions["autoResize"] {
909
1029
  return this._autoResize;
910
1030
  }
911
1031
 
912
1032
  /**
913
- * 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
914
- * @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} 이벤트 대신 수신할지 여부를 설정합니다
915
- * @type {boolean}
916
- * @default true
917
- * @see {@link https://naver.github.io/egjs-flicking/Options#useresizeobserver useResizeObserver ( Options )}
1033
+ * Current value of the {@link FlickingOptions.useResizeObserver | useResizeObserver} option.
1034
+ * @since 4.4.0
918
1035
  */
919
- public get useResizeObserver() { return this._useResizeObserver; }
1036
+ public get useResizeObserver(): FlickingOptions["useResizeObserver"] {
1037
+ return this._useResizeObserver;
1038
+ }
1039
+
920
1040
  /**
921
- * Whether to use {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver} to observe the size of the panel element
922
- * This is only available when `useResizeObserver` is enabled.
923
- * This option garantees that the resize event is triggered when the size of the panel element is changed.
924
- * @ko 이 옵션을 활성화할 경우, {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}를 사용하여 패널 엘리먼트의 크기를 추적합니다.
925
- * 이 옵션은 `useResizeObserver` 옵션이 활성화된 경우에만 사용할 수 있습니다.
926
- * 이 옵션은 패널 엘리먼트의 크기가 변경될 경우 resize 이벤트가 발생하도록 보장합니다.
1041
+ * Current value of the {@link FlickingOptions.observePanelResize | observePanelResize} option.
1042
+ * @since 4.13.1
927
1043
  */
928
- public get observePanelResize() { return this._observePanelResize; }
1044
+ public get observePanelResize(): FlickingOptions["observePanelResize"] {
1045
+ return this._observePanelResize;
1046
+ }
1047
+
929
1048
  /**
930
- * Delays size recalculation from `autoResize` by the given time in milisecond.
931
- * If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
932
- * This can increase performance by preventing `resize` being called too often.
933
- * @ko `autoResize` 설정시에 호출되는 크기 재계산을 주어진 시간(단위: ms)만큼 지연시킵니다.
934
- * 지연시키는 도중 크기가 다시 변경되었을 경우, 이전 것을 취소하고 주어진 시간만큼 다시 지연시킵니다.
935
- * 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
936
- * @type {number}
937
- * @default 0
938
- * @see {@link https://naver.github.io/egjs-flicking/Options#resizedebounce resizeDebounce ( Options )}
939
- */
940
- public get resizeDebounce() {
1049
+ * Current value of the {@link FlickingOptions.resizeDebounce | resizeDebounce} option.
1050
+ * @since 4.6.0
1051
+ */
1052
+ public get resizeDebounce(): FlickingOptions["resizeDebounce"] {
941
1053
  return this._resizeDebounce;
942
1054
  }
943
1055
 
944
1056
  /**
945
- * The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
946
- * This guarantees that size recalculation is performed at least once every (n)ms.
947
- * @ko `resizeDebounce` 사용시에 크기 재계산이 지연되는 최대 시간을 지정합니다. (단위: ms)
948
- * 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
949
- * @type {number}
950
- * @default 100
951
- * @see {@link https://naver.github.io/egjs-flicking/Options#maxresizedebounce maxResizeDebounce ( Options )}
1057
+ * Current value of the {@link FlickingOptions.maxResizeDebounce | maxResizeDebounce} option.
1058
+ * @since 4.6.0
952
1059
  */
953
- public get maxResizeDebounce() {
1060
+ public get maxResizeDebounce(): FlickingOptions["maxResizeDebounce"] {
954
1061
  return this._maxResizeDebounce;
955
1062
  }
956
1063
 
957
1064
  /**
958
- * By enabling this, Flicking will calculate all internal size with CSS width computed with getComputedStyle.
959
- * This can prevent 1px offset issue in some cases where panel size has the fractional part.
960
- * All sizes will have the original size before CSS {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform transform} is applied on the element.
961
- * @ko 옵션을 활성화할 경우, Flicking은 내부의 모든 크기를 {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect getBoundingClientRect}를 이용하여 계산합니다.
962
- * 이를 통해, 패널 크기에 소수점을 포함할 경우에 발생할 수 있는 일부 1px 오프셋 이슈를 해결 가능합니다.
963
- * 모든 크기는 CSS {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform transform}이 엘리먼트에 적용되기 이전의 크기를 사용할 것입니다.
964
- * @type {boolean}
965
- * @default false
966
- * @see {@link https://naver.github.io/egjs-flicking/Options#usefractionalsize useFractionalSize ( Options )}
967
- */
968
- public get useFractionalSize() {
1065
+ * Current value of the {@link FlickingOptions.useFractionalSize | useFractionalSize} option.
1066
+ * @since 4.9.0
1067
+ */
1068
+ public get useFractionalSize(): FlickingOptions["useFractionalSize"] {
969
1069
  return this._useFractionalSize;
970
1070
  }
971
1071
 
972
- /**
973
- * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
974
- * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
975
- * @default null
976
- * @internal
977
- * @readonly
978
- */
979
- public get externalRenderer() {
1072
+ /** Current value of the {@link FlickingOptions.externalRenderer | externalRenderer} option. */
1073
+ public get externalRenderer(): FlickingOptions["externalRenderer"] {
980
1074
  return this._externalRenderer;
981
1075
  }
982
1076
 
983
1077
  /**
984
- * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
985
- * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
986
- * @default null
987
- * @internal
988
- * @readonly
989
- * @deprecated
1078
+ * @deprecated Use {@link Flicking.externalRenderer | externalRenderer} instead.
1079
+ * Current value of the {@link FlickingOptions.renderExternal | renderExternal} option.
990
1080
  */
991
- public get renderExternal() {
1081
+ public get renderExternal(): FlickingOptions["renderExternal"] {
992
1082
  return this._renderExternal;
993
1083
  }
994
1084
 
995
- /**
996
- * This option works only when autoResize is set to true.
997
- * By default, autoResize listens to changes in both the viewport's width and height, updating all panel sizes accordingly.
998
- * When optimizeSizeUpdate is enabled, the update behavior is optimized based on the flicking direction:
999
- * If direction is "horizontal", only changes in width will trigger panel size updates.
1000
- * If direction is "vertical", only changes in height will do so.
1001
- * This option is useful when panel heights vary and unwanted flickering occurs due to frequent size recalculations during flicking. Enabling optimizeSizeUpdate prevents unnecessary updates and helps maintain visual stability.
1002
- * @ko optimizeSizeUpdate는 autoResize가 true일 때만 동작합니다.
1003
- * 기본적으로 autoResize는 뷰포트의 width와 height 변화를 모두 감지하여 패널들의 사이즈를 업데이트합니다.
1004
- * 이 옵션을 활성화하면 플리킹 방향에 따라 필요한 차원(horizontal → width, vertical → height)에 대해서만 사이즈를 업데이트합니다.
1005
- * 내부 패널의 높이가 서로 다를 때, 플리킹 중 과도한 리사이징으로 인한 깜빡임 현상을 줄이는 데 유용합니다.
1006
- * @type {boolean}
1007
- * @default false
1008
- */
1009
- public get optimizeSizeUpdate() {
1085
+ /** @internal */
1086
+ public get optimizeSizeUpdate(): FlickingOptions["optimizeSizeUpdate"] {
1010
1087
  return this._optimizeSizeUpdate;
1011
1088
  }
1012
1089
 
1013
1090
  // Options Setter
1014
1091
  // UI / LAYOUT
1092
+ /**
1093
+ * Sets {@link FlickingOptions.align}.
1094
+ * @privateRemarks
1095
+ * Setting this value updates the renderer and camera alignment, and triggers a resize operation.
1096
+ */
1015
1097
  public set align(val: FlickingOptions["align"]) {
1016
1098
  this._align = val;
1017
1099
  this._renderer.align = val;
@@ -1023,48 +1105,84 @@ class Flicking extends Component<FlickingEvents> {
1023
1105
  this._defaultIndex = val;
1024
1106
  }
1025
1107
 
1108
+ /**
1109
+ * Sets {@link FlickingOptions.horizontal}.
1110
+ * @privateRemarks
1111
+ * Setting this value updates the control direction and triggers a resize operation.
1112
+ */
1026
1113
  public set horizontal(val: FlickingOptions["horizontal"]) {
1027
1114
  this._horizontal = val;
1028
1115
  this._control.controller.updateDirection();
1029
1116
  void this.resize();
1030
1117
  }
1031
1118
 
1119
+ /**
1120
+ * Sets {@link FlickingOptions.circular}.
1121
+ * @privateRemarks
1122
+ * Setting this value triggers a resize operation to recalculate panel positions.
1123
+ */
1032
1124
  public set circular(val: FlickingOptions["circular"]) {
1033
1125
  this._circular = val;
1034
1126
  void this.resize();
1035
1127
  }
1036
1128
 
1129
+ /**
1130
+ * Sets {@link FlickingOptions.bound}.
1131
+ * @privateRemarks
1132
+ * Setting this value triggers a resize operation to recalculate panel positions.
1133
+ */
1037
1134
  public set bound(val: FlickingOptions["bound"]) {
1038
1135
  this._bound = val;
1039
1136
  void this.resize();
1040
1137
  }
1041
1138
 
1139
+ /**
1140
+ * Sets {@link FlickingOptions.adaptive}.
1141
+ * @privateRemarks
1142
+ * Setting this value triggers a resize operation to recalculate panel sizes.
1143
+ */
1042
1144
  public set adaptive(val: FlickingOptions["adaptive"]) {
1043
1145
  this._adaptive = val;
1044
1146
  void this.resize();
1045
1147
  }
1046
1148
 
1149
+ /**
1150
+ * Sets {@link FlickingOptions.panelsPerView}.
1151
+ * @privateRemarks
1152
+ * Setting this value triggers a resize operation to recalculate panel sizes.
1153
+ */
1047
1154
  public set panelsPerView(val: FlickingOptions["panelsPerView"]) {
1048
1155
  this._panelsPerView = val;
1049
1156
  void this.resize();
1050
1157
  }
1051
1158
 
1052
- public set noPanelStyleOverride(
1053
- val: FlickingOptions["noPanelStyleOverride"]
1054
- ) {
1159
+ /**
1160
+ * Sets {@link FlickingOptions.noPanelStyleOverride}.
1161
+ * @privateRemarks
1162
+ * Setting this value triggers a resize operation to update panel styles.
1163
+ */
1164
+ public set noPanelStyleOverride(val: FlickingOptions["noPanelStyleOverride"]) {
1055
1165
  this._noPanelStyleOverride = val;
1056
1166
  void this.resize();
1057
1167
  }
1058
1168
 
1059
- public set resizeOnContentsReady(
1060
- val: FlickingOptions["resizeOnContentsReady"]
1061
- ) {
1169
+ /**
1170
+ * Sets {@link FlickingOptions.resizeOnContentsReady}.
1171
+ * @privateRemarks
1172
+ * When set to `true`, immediately checks all panels for content readiness.
1173
+ */
1174
+ public set resizeOnContentsReady(val: FlickingOptions["resizeOnContentsReady"]) {
1062
1175
  this._resizeOnContentsReady = val;
1063
1176
  if (val) {
1064
1177
  this._renderer.checkPanelContentsReady(this._renderer.panels);
1065
1178
  }
1066
1179
  }
1067
1180
 
1181
+ /**
1182
+ * Sets {@link FlickingOptions.nested}.
1183
+ * @privateRemarks
1184
+ * Setting this value updates the control's axes options.
1185
+ */
1068
1186
  public set nested(val: FlickingOptions["nested"]) {
1069
1187
  this._nested = val;
1070
1188
  const axes = this._control.controller.axes;
@@ -1079,13 +1197,16 @@ class Flicking extends Component<FlickingEvents> {
1079
1197
  this._needPanelThreshold = val;
1080
1198
  }
1081
1199
 
1082
- public set preventEventsBeforeInit(
1083
- val: FlickingOptions["preventEventsBeforeInit"]
1084
- ) {
1200
+ public set preventEventsBeforeInit(val: FlickingOptions["preventEventsBeforeInit"]) {
1085
1201
  this._preventEventsBeforeInit = val;
1086
1202
  }
1087
1203
 
1088
1204
  // ANIMATION
1205
+ /**
1206
+ * Sets {@link FlickingOptions.deceleration}.
1207
+ * @privateRemarks
1208
+ * Setting this value updates the control's axes deceleration option.
1209
+ */
1089
1210
  public set deceleration(val: FlickingOptions["deceleration"]) {
1090
1211
  this._deceleration = val;
1091
1212
  const axes = this._control.controller.axes;
@@ -1095,6 +1216,11 @@ class Flicking extends Component<FlickingEvents> {
1095
1216
  }
1096
1217
  }
1097
1218
 
1219
+ /**
1220
+ * Sets {@link FlickingOptions.easing}.
1221
+ * @privateRemarks
1222
+ * Setting this value updates the control's axes easing option.
1223
+ */
1098
1224
  public set easing(val: FlickingOptions["easing"]) {
1099
1225
  this._easing = val;
1100
1226
  const axes = this._control.controller.axes;
@@ -1109,6 +1235,11 @@ class Flicking extends Component<FlickingEvents> {
1109
1235
  }
1110
1236
 
1111
1237
  // INPUT
1238
+ /**
1239
+ * Sets {@link FlickingOptions.inputType}.
1240
+ * @privateRemarks
1241
+ * Setting this value updates the control's pan input options.
1242
+ */
1112
1243
  public set inputType(val: FlickingOptions["inputType"]) {
1113
1244
  this._inputType = val;
1114
1245
  const panInput = this._control.controller.panInput;
@@ -1118,6 +1249,11 @@ class Flicking extends Component<FlickingEvents> {
1118
1249
  }
1119
1250
  }
1120
1251
 
1252
+ /**
1253
+ * Sets {@link FlickingOptions.moveType}.
1254
+ * @privateRemarks
1255
+ * Setting this value creates a new Control instance based on the moveType and preserves the current panel position and progress.
1256
+ */
1121
1257
  public set moveType(val: FlickingOptions["moveType"]) {
1122
1258
  this._moveType = val;
1123
1259
 
@@ -1126,9 +1262,7 @@ class Flicking extends Component<FlickingEvents> {
1126
1262
  const activePanel = prevControl.activePanel;
1127
1263
  newControl.copy(prevControl);
1128
1264
 
1129
- const prevProgressInPanel = activePanel
1130
- ? this._camera.getProgressInPanel(activePanel)
1131
- : 0;
1265
+ const prevProgressInPanel = activePanel ? this._camera.getProgressInPanel(activePanel) : 0;
1132
1266
 
1133
1267
  this._control = newControl;
1134
1268
  this._control.updatePosition(prevProgressInPanel);
@@ -1139,6 +1273,11 @@ class Flicking extends Component<FlickingEvents> {
1139
1273
  this._threshold = val;
1140
1274
  }
1141
1275
 
1276
+ /**
1277
+ * Sets {@link FlickingOptions.dragThreshold}.
1278
+ * @privateRemarks
1279
+ * Setting this value updates the control's pan input threshold option.
1280
+ */
1142
1281
  public set dragThreshold(val: FlickingOptions["dragThreshold"]) {
1143
1282
  this._dragThreshold = val;
1144
1283
  const panInput = this._control.controller.panInput;
@@ -1147,13 +1286,26 @@ class Flicking extends Component<FlickingEvents> {
1147
1286
  panInput.options.threshold = val;
1148
1287
  }
1149
1288
  }
1289
+
1290
+ /**
1291
+ * Sets {@link FlickingOptions.animationThreshold}.
1292
+ */
1150
1293
  public set animationThreshold(val: FlickingOptions["animationThreshold"]) {
1151
1294
  this._animationThreshold = val;
1152
1295
  }
1296
+
1297
+ /**
1298
+ * Sets {@link FlickingOptions.useCSSOrder}.
1299
+ */
1153
1300
  public set useCSSOrder(val: FlickingOptions["useCSSOrder"]) {
1154
1301
  this._useCSSOrder = val;
1155
1302
  }
1156
1303
 
1304
+ /**
1305
+ * Sets {@link FlickingOptions.interruptable}.
1306
+ * @privateRemarks
1307
+ * Setting this value updates the control's axes interruptable option.
1308
+ */
1157
1309
  public set interruptable(val: FlickingOptions["interruptable"]) {
1158
1310
  this._interruptable = val;
1159
1311
 
@@ -1164,14 +1316,22 @@ class Flicking extends Component<FlickingEvents> {
1164
1316
  }
1165
1317
  }
1166
1318
 
1319
+ /**
1320
+ * Sets {@link FlickingOptions.bounce}.
1321
+ * @privateRemarks
1322
+ * Setting this value updates the control input configuration.
1323
+ */
1167
1324
  public set bounce(val: FlickingOptions["bounce"]) {
1168
1325
  this._bounce = val;
1169
1326
  this._control.updateInput();
1170
1327
  }
1171
1328
 
1172
- public set iOSEdgeSwipeThreshold(
1173
- val: FlickingOptions["iOSEdgeSwipeThreshold"]
1174
- ) {
1329
+ /**
1330
+ * Sets {@link FlickingOptions.iOSEdgeSwipeThreshold}.
1331
+ * @privateRemarks
1332
+ * Setting this value updates the control's pan input iOS edge swipe threshold option.
1333
+ */
1334
+ public set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]) {
1175
1335
  this._iOSEdgeSwipeThreshold = val;
1176
1336
  const panInput = this._control.controller.panInput;
1177
1337
 
@@ -1180,6 +1340,11 @@ class Flicking extends Component<FlickingEvents> {
1180
1340
  }
1181
1341
  }
1182
1342
 
1343
+ /**
1344
+ * Sets {@link FlickingOptions.preventClickOnDrag}.
1345
+ * @privateRemarks
1346
+ * Setting this value adds or removes the prevent click handler from the control.
1347
+ */
1183
1348
  public set preventClickOnDrag(val: FlickingOptions["preventClickOnDrag"]) {
1184
1349
  const prevVal = this._preventClickOnDrag;
1185
1350
 
@@ -1196,9 +1361,12 @@ class Flicking extends Component<FlickingEvents> {
1196
1361
  this._preventClickOnDrag = val;
1197
1362
  }
1198
1363
 
1199
- public set preventDefaultOnDrag(
1200
- val: FlickingOptions["preventDefaultOnDrag"]
1201
- ) {
1364
+ /**
1365
+ * Sets {@link FlickingOptions.preventDefaultOnDrag}.
1366
+ * @privateRemarks
1367
+ * Setting this value updates the control's pan input preventDefaultOnDrag option.
1368
+ */
1369
+ public set preventDefaultOnDrag(val: FlickingOptions["preventDefaultOnDrag"]) {
1202
1370
  this._preventDefaultOnDrag = val;
1203
1371
  const panInput = this._control.controller.panInput;
1204
1372
 
@@ -1216,12 +1384,22 @@ class Flicking extends Component<FlickingEvents> {
1216
1384
  }
1217
1385
 
1218
1386
  // PERFORMANCE
1387
+ /**
1388
+ * Sets {@link FlickingOptions.renderOnlyVisible}.
1389
+ * @privateRemarks
1390
+ * Setting this value triggers an immediate render operation.
1391
+ */
1219
1392
  public set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]) {
1220
1393
  this._renderOnlyVisible = val;
1221
1394
  void this._renderer.render();
1222
1395
  }
1223
1396
 
1224
1397
  // OTHERS
1398
+ /**
1399
+ * Sets {@link FlickingOptions.autoResize}.
1400
+ * @privateRemarks
1401
+ * Setting this value enables or disables the auto resizer if Flicking is already initialized.
1402
+ */
1225
1403
  public set autoResize(val: FlickingOptions["autoResize"]) {
1226
1404
  this._autoResize = val;
1227
1405
 
@@ -1236,6 +1414,11 @@ class Flicking extends Component<FlickingEvents> {
1236
1414
  }
1237
1415
  }
1238
1416
 
1417
+ /**
1418
+ * Sets {@link FlickingOptions.useResizeObserver}.
1419
+ * @privateRemarks
1420
+ * Setting this value re-enables the auto resizer if Flicking is initialized and autoResize is enabled.
1421
+ */
1239
1422
  public set useResizeObserver(val: FlickingOptions["useResizeObserver"]) {
1240
1423
  this._useResizeObserver = val;
1241
1424
 
@@ -1244,6 +1427,11 @@ class Flicking extends Component<FlickingEvents> {
1244
1427
  }
1245
1428
  }
1246
1429
 
1430
+ /**
1431
+ * Sets {@link FlickingOptions.observePanelResize}.
1432
+ * @privateRemarks
1433
+ * Setting this value starts or stops observing panel sizes if Flicking is initialized and autoResize is enabled.
1434
+ */
1247
1435
  public set observePanelResize(val: FlickingOptions["observePanelResize"]) {
1248
1436
  this._observePanelResize = val;
1249
1437
 
@@ -1260,23 +1448,10 @@ class Flicking extends Component<FlickingEvents> {
1260
1448
  this._optimizeSizeUpdate = val;
1261
1449
  }
1262
1450
 
1263
- /**
1264
- * @param root A root HTMLElement to initialize Flicking on it. When it's a typeof `string`, it should be a css selector string
1265
- * <ko>Flicking을 초기화할 HTMLElement로, `string` 타입으로 지정시 css 선택자 문자열을 지정해야 합니다.</ko>
1266
- * @param {object} [options={}] An options object for Flicking.<ko>Flicking에 적용할 옵션 오브젝트</ko>
1267
- * @throws {FlickingError}
1268
- * |code|condition|
1269
- * |---|---|
1270
- * |{@link ERROR_CODE WRONG_TYPE}|When the root is not either string or HTMLElement|
1271
- * |{@link ERROR_CODE ELEMENT_NOT_FOUND}|When the element with given CSS selector does not exist|
1272
- * <ko>
1273
- *
1274
- * |code|조건|
1275
- * |---|---|
1276
- * |{@link ERROR_CODE WRONG_TYPE}|루트 엘리먼트가 string이나 HTMLElement가 아닐 경우|
1277
- * |{@link ERROR_CODE ELEMENT_NOT_FOUND}|주어진 CSS selector로 엘리먼트를 찾지 못했을 경우|
1278
- *
1279
- * </ko>
1451
+ /** Creates a new Flicking instance
1452
+ * @param root - A root HTMLElement to initialize Flicking on it. When it's a typeof `string`, it should be a css selector string
1453
+ * @param options - A {@link FlickingOptions} object
1454
+ * @throws {@link InitializationErrors}
1280
1455
  * @example
1281
1456
  * ```ts
1282
1457
  * import Flicking from "@egjs/flicking";
@@ -1288,51 +1463,54 @@ class Flicking extends Component<FlickingEvents> {
1288
1463
  * const flicking2 = new Flicking(".flicking-viewport", { circular: true });
1289
1464
  * ```
1290
1465
  */
1291
- public constructor(root: HTMLElement | string, {
1292
- align = ALIGN.CENTER,
1293
- defaultIndex = 0,
1294
- horizontal = true,
1295
- circular = false,
1296
- circularFallback = CIRCULAR_FALLBACK.LINEAR,
1297
- bound = false,
1298
- adaptive = false,
1299
- panelsPerView = -1,
1300
- noPanelStyleOverride = false,
1301
- resizeOnContentsReady = false,
1302
- nested = false,
1303
- needPanelThreshold = 0,
1304
- preventEventsBeforeInit = true,
1305
- deceleration = 0.0075,
1306
- duration = 500,
1307
- easing = x => 1 - Math.pow(1 - x, 3),
1308
- inputType = ["mouse", "touch"],
1309
- moveType = "snap",
1310
- threshold = 40,
1311
- dragThreshold = 1,
1312
- interruptable = true,
1313
- bounce = "20%",
1314
- iOSEdgeSwipeThreshold = 30,
1315
- preventClickOnDrag = true,
1316
- preventDefaultOnDrag = false,
1317
- disableOnInit = false,
1318
- changeOnHold = false,
1319
- renderOnlyVisible = false,
1320
- virtual = null,
1321
- autoInit = true,
1322
- autoResize = true,
1323
- useResizeObserver = true,
1324
- resizeDebounce = 0,
1325
- observePanelResize = false,
1326
- maxResizeDebounce = 100,
1327
- useFractionalSize = false,
1328
- externalRenderer = null,
1329
- renderExternal = null,
1330
- optimizeSizeUpdate = false,
1331
- animationThreshold = 0.5,
1332
- useCSSOrder = false,
1333
- }: Partial<FlickingOptions> = {}) {
1466
+ public constructor(root: HTMLElement | string, options: Partial<FlickingOptions> = {}) {
1334
1467
  super();
1335
1468
 
1469
+ // Destructure options with default values
1470
+ const {
1471
+ align = ALIGN.CENTER,
1472
+ defaultIndex = 0,
1473
+ horizontal = true,
1474
+ circular = false,
1475
+ circularFallback = CIRCULAR_FALLBACK.LINEAR,
1476
+ bound = false,
1477
+ adaptive = false,
1478
+ panelsPerView = -1,
1479
+ noPanelStyleOverride = false,
1480
+ resizeOnContentsReady = false,
1481
+ nested = false,
1482
+ needPanelThreshold = 0,
1483
+ preventEventsBeforeInit = true,
1484
+ deceleration = 0.0075,
1485
+ duration = 500,
1486
+ easing = x => 1 - (1 - x) ** 3,
1487
+ inputType = ["mouse", "touch"],
1488
+ moveType = "snap",
1489
+ threshold = 40,
1490
+ dragThreshold = 1,
1491
+ interruptable = true,
1492
+ bounce = "20%",
1493
+ iOSEdgeSwipeThreshold = 30,
1494
+ preventClickOnDrag = true,
1495
+ preventDefaultOnDrag = false,
1496
+ disableOnInit = false,
1497
+ changeOnHold = false,
1498
+ renderOnlyVisible = false,
1499
+ virtual = null,
1500
+ autoInit = true,
1501
+ autoResize = true,
1502
+ useResizeObserver = true,
1503
+ resizeDebounce = 0,
1504
+ observePanelResize = false,
1505
+ maxResizeDebounce = 100,
1506
+ useFractionalSize = false,
1507
+ externalRenderer = null,
1508
+ renderExternal = null,
1509
+ optimizeSizeUpdate = false,
1510
+ animationThreshold = 0.5,
1511
+ useCSSOrder = false
1512
+ } = options;
1513
+
1336
1514
  // Internal states
1337
1515
  this._initialized = false;
1338
1516
  this._plugins = [];
@@ -1395,12 +1573,12 @@ class Flicking extends Component<FlickingEvents> {
1395
1573
  }
1396
1574
 
1397
1575
  /**
1398
- * Initialize Flicking and move to the default index
1399
- * This is automatically called on Flicking's constructor when `autoInit` is true(default)
1400
- * @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
1401
- * 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 자동으로 호출됩니다
1402
- * @fires Flicking#ready
1403
- * @return {Promise<void>}
1576
+ * Initialize Flicking and move to the default index.
1577
+ * @remarks
1578
+ * This method is automatically called in the constructor when {@link FlickingOptions.autoInit | autoInit} is `true` (default).
1579
+ * If Flicking is already initialized, this method returns immediately without doing anything.
1580
+ * @fires {@link ReadyEvent}
1581
+ * @returns Promise that resolves when initialization is complete
1404
1582
  */
1405
1583
  public init(): Promise<void> {
1406
1584
  if (this._initialized) return Promise.resolve();
@@ -1439,7 +1617,7 @@ class Flicking extends Component<FlickingEvents> {
1439
1617
 
1440
1618
  return renderer.render().then(() => {
1441
1619
  // Done initializing & emit ready event
1442
- this._plugins.forEach((plugin) => plugin.init(this));
1620
+ this._plugins.forEach(plugin => plugin.init(this));
1443
1621
 
1444
1622
  if (preventEventsBeforeInit) {
1445
1623
  this.trigger = originalTrigger;
@@ -1449,9 +1627,10 @@ class Flicking extends Component<FlickingEvents> {
1449
1627
  }
1450
1628
 
1451
1629
  /**
1452
- * Destroy Flicking and remove all event handlers
1453
- * @ko Flicking과 하위 컴포넌트들을 초기 상태로 되돌리고, 부착된 모든 이벤트 핸들러를 제거합니다
1454
- * @return {void}
1630
+ * Destroy Flicking and remove all event handlers.
1631
+ * @remarks
1632
+ * This method cleans up all resources including event handlers, components, and plugins.
1633
+ * After calling this method, {@link Flicking.initialized} will be `false` and the instance should not be used.
1455
1634
  */
1456
1635
  public destroy(): void {
1457
1636
  this.off();
@@ -1461,7 +1640,7 @@ class Flicking extends Component<FlickingEvents> {
1461
1640
  this._camera.destroy();
1462
1641
  this._renderer.destroy();
1463
1642
 
1464
- this._plugins.forEach((plugin) => plugin.destroy());
1643
+ this._plugins.forEach(plugin => plugin.destroy());
1465
1644
 
1466
1645
  this._scheduleResize = false;
1467
1646
  this._initialized = false;
@@ -1469,129 +1648,41 @@ class Flicking extends Component<FlickingEvents> {
1469
1648
  }
1470
1649
 
1471
1650
  /**
1472
- * Move to the previous panel (current index - 1)
1473
- * @ko 이전 패널로 이동합니다 (현재 인덱스 - 1)
1474
- * @param {number} [duration={@link Flicking#duration options.duration}] Duration of the panel movement animation (unit: ms)<ko>패널 이동 애니메이션 진행 시간 (단위: ms)</ko>
1475
- * @async
1476
- * @fires Flicking#moveStart
1477
- * @fires Flicking#move
1478
- * @fires Flicking#moveEnd
1479
- * @fires Flicking#willChange
1480
- * @fires Flicking#changed
1481
- * @fires Flicking#willRestore
1482
- * @fires Flicking#restored
1483
- * @fires Flicking#needPanel
1484
- * @fires Flicking#visibleChange
1485
- * @fires Flicking#reachEdge
1486
- * @throws {FlickingError}
1487
- * |code|condition|
1488
- * |---|---|
1489
- * |{@link ERROR_CODE INDEX_OUT_OF_RANGE}|When the previous panel does not exist|
1490
- * |{@link ERROR_CODE ANIMATION_ALREADY_PLAYING}|When the animation is already playing|
1491
- * |{@link ERROR_CODE ANIMATION_INTERRUPTED}|When the animation is interrupted by user input|
1492
- * |{@link ERROR_CODE STOP_CALLED_BY_USER}|When the any of the event's `stop()` is called|
1493
- * <ko>
1494
- *
1495
- * |code|condition|
1496
- * |---|---|
1497
- * |{@link ERROR_CODE INDEX_OUT_OF_RANGE}|이전 패널이 존재하지 않을 경우|
1498
- * |{@link ERROR_CODE ANIMATION_ALREADY_PLAYING}|애니메이션이 이미 진행중인 경우|
1499
- * |{@link ERROR_CODE ANIMATION_INTERRUPTED}|사용자 입력에 의해 애니메이션이 중단된 경우|
1500
- * |{@link ERROR_CODE STOP_CALLED_BY_USER}|발생된 이벤트들 중 하나라도 `stop()`이 호출된 경우|
1501
- * </ko>
1502
- * @return {Promise<void>} A Promise which will be resolved after reaching the previous panel<ko>이전 패널 도달시에 resolve되는 Promise</ko>
1651
+ * Move to the previous panel (current index - 1).
1652
+ * @param duration - Duration of the panel movement animation (unit: ms). Defaults to {@link FlickingOptions.duration}
1653
+ * @fires {@link MovementEvents}
1654
+ * @throws {@link MovementErrors}
1655
+ * @returns Promise that resolves after reaching the previous panel
1503
1656
  */
1504
1657
  public prev(duration: number = this._duration): Promise<void> {
1505
- return this.moveTo(
1506
- this._control.activePanel?.prev()?.index ?? -1,
1507
- duration,
1508
- DIRECTION.PREV
1509
- );
1658
+ return this.moveTo(this._control.activePanel?.prev()?.index ?? -1, duration, DIRECTION.PREV);
1510
1659
  }
1511
1660
 
1512
1661
  /**
1513
- * Move to the next panel (current index + 1)
1514
- * @ko 다음 패널로 이동합니다 (현재 인덱스 + 1)
1515
- * @param {number} [duration={@link Flicking#duration options.duration}] Duration of the panel movement animation (unit: ms).<ko>패널 이동 애니메이션 진행 시간 (단위: ms)</ko>
1516
- * @async
1517
- * @fires Flicking#moveStart
1518
- * @fires Flicking#move
1519
- * @fires Flicking#moveEnd
1520
- * @fires Flicking#willChange
1521
- * @fires Flicking#changed
1522
- * @fires Flicking#willRestore
1523
- * @fires Flicking#restored
1524
- * @fires Flicking#needPanel
1525
- * @fires Flicking#visibleChange
1526
- * @fires Flicking#reachEdge
1527
- * @throws {FlickingError}
1528
- * |code|condition|
1529
- * |---|---|
1530
- * |{@link ERROR_CODE INDEX_OUT_OF_RANGE}|When the next panel does not exist|
1531
- * |{@link ERROR_CODE ANIMATION_ALREADY_PLAYING}|When the animation is already playing|
1532
- * |{@link ERROR_CODE ANIMATION_INTERRUPTED}|When the animation is interrupted by user input|
1533
- * |{@link ERROR_CODE STOP_CALLED_BY_USER}|When the any of the event's `stop()` is called|
1534
- * <ko>
1535
- *
1536
- * |code|condition|
1537
- * |---|---|
1538
- * |{@link ERROR_CODE INDEX_OUT_OF_RANGE}|다음 패널이 존재하지 않을 경우|
1539
- * |{@link ERROR_CODE ANIMATION_ALREADY_PLAYING}|애니메이션이 이미 진행중인 경우|
1540
- * |{@link ERROR_CODE ANIMATION_INTERRUPTED}|사용자 입력에 의해 애니메이션이 중단된 경우|
1541
- * |{@link ERROR_CODE STOP_CALLED_BY_USER}|발생된 이벤트들 중 하나라도 `stop()`이 호출된 경우|
1542
- *
1543
- * </ko>
1544
- * @return {Promise<void>} A Promise which will be resolved after reaching the next panel<ko>다음 패널 도달시에 resolve되는 Promise</ko>
1662
+ * Move to the next panel (current index + 1).
1663
+ * @param duration - Duration of the panel movement animation (unit: ms). Defaults to {@link FlickingOptions.duration}
1664
+ * @fires {@link MovementEvents}
1665
+ * @throws {@link MovementErrors}
1666
+ * @returns Promise that resolves after reaching the next panel
1545
1667
  */
1546
- public next(duration: number = this._duration) {
1547
- return this.moveTo(
1548
- this._control.activePanel?.next()?.index ?? this._renderer.panelCount,
1549
- duration,
1550
- DIRECTION.NEXT
1551
- );
1668
+ public next(duration: number = this._duration): Promise<void> {
1669
+ return this.moveTo(this._control.activePanel?.next()?.index ?? this._renderer.panelCount, duration, DIRECTION.NEXT);
1552
1670
  }
1553
1671
 
1554
1672
  /**
1555
- * Move to the panel with given index
1556
- * @ko 주어진 인덱스에 해당하는 패널로 이동합니다
1557
- * @param {number} index The index of the panel to move<ko>이동할 패널의 인덱스</ko>
1558
- * @param {number} [duration={@link Flicking#duration options.duration}] Duration of the animation (unit: ms)<ko>애니메이션 진행 시간 (단위: ms)</ko>
1559
- * @param {DIRECTION} [direction=DIRECTION.NONE] Direction to move, only available in the {@link Flicking#circular circular} mode<ko>이동할 방향. {@link Flicking#circular circular} 옵션 활성화시에만 사용 가능합니다</ko>
1560
- * @async
1561
- * @fires Flicking#moveStart
1562
- * @fires Flicking#move
1563
- * @fires Flicking#moveEnd
1564
- * @fires Flicking#willChange
1565
- * @fires Flicking#changed
1566
- * @fires Flicking#willRestore
1567
- * @fires Flicking#restored
1568
- * @fires Flicking#needPanel
1569
- * @fires Flicking#visibleChange
1570
- * @fires Flicking#reachEdge
1571
- * @throws {FlickingError}
1572
- * |code|condition|
1573
- * |---|---|
1574
- * |{@link ERROR_CODE INDEX_OUT_OF_RANGE}|When the root is not either string or HTMLElement|
1575
- * |{@link ERROR_CODE ANIMATION_ALREADY_PLAYING}|When the animation is already playing|
1576
- * |{@link ERROR_CODE ANIMATION_INTERRUPTED}|When the animation is interrupted by user input|
1577
- * |{@link ERROR_CODE STOP_CALLED_BY_USER}|When the any of the event's `stop()` is called|
1578
- * <ko>
1579
- *
1580
- * |code|condition|
1581
- * |---|---|
1582
- * |{@link ERROR_CODE INDEX_OUT_OF_RANGE}|해당 인덱스를 가진 패널이 존재하지 않을 경우|
1583
- * |{@link ERROR_CODE ANIMATION_ALREADY_PLAYING}|애니메이션이 이미 진행중인 경우|
1584
- * |{@link ERROR_CODE ANIMATION_INTERRUPTED}|사용자 입력에 의해 애니메이션이 중단된 경우|
1585
- * |{@link ERROR_CODE STOP_CALLED_BY_USER}|발생된 이벤트들 중 하나라도 `stop()`이 호출된 경우|
1586
- *
1587
- * </ko>
1588
- * @return {Promise<void>} A Promise which will be resolved after reaching the target panel<ko>해당 패널 도달시에 resolve되는 Promise</ko>
1673
+ * Move to the panel with the given index.
1674
+ * @param index - The index of the panel to move to
1675
+ * @param duration - Duration of the animation (unit: ms). Defaults to {@link FlickingOptions.duration}
1676
+ * @param direction - Direction to move (circular mode only). Defaults to {@link DIRECTION.NONE}
1677
+ * @fires {@link MovementEvents}
1678
+ * @throws {@link MovementErrors}
1679
+ * @returns Promise that resolves after reaching the target panel
1589
1680
  */
1590
1681
  public moveTo(
1591
1682
  index: number,
1592
1683
  duration: number = this._duration,
1593
1684
  direction: ValueOf<typeof DIRECTION> = DIRECTION.NONE
1594
- ) {
1685
+ ): Promise<void> {
1595
1686
  const renderer = this._renderer;
1596
1687
  const panelCount = renderer.panelCount;
1597
1688
 
@@ -1599,19 +1690,13 @@ class Flicking extends Component<FlickingEvents> {
1599
1690
 
1600
1691
  if (!panel) {
1601
1692
  return Promise.reject(
1602
- new FlickingError(
1603
- ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1),
1604
- ERROR.CODE.INDEX_OUT_OF_RANGE
1605
- )
1693
+ new FlickingError(ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1), ERROR.CODE.INDEX_OUT_OF_RANGE)
1606
1694
  );
1607
1695
  }
1608
1696
 
1609
1697
  if (this._control.animating) {
1610
1698
  return Promise.reject(
1611
- new FlickingError(
1612
- ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING,
1613
- ERROR.CODE.ANIMATION_ALREADY_PLAYING
1614
- )
1699
+ new FlickingError(ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING, ERROR.CODE.ANIMATION_ALREADY_PLAYING)
1615
1700
  );
1616
1701
  }
1617
1702
 
@@ -1626,21 +1711,16 @@ class Flicking extends Component<FlickingEvents> {
1626
1711
  }
1627
1712
 
1628
1713
  /**
1629
- * Change the destination and duration of the animation currently playing
1630
- * @ko 재생 중인 애니메이션의 목적지와 재생 시간을 변경합니다
1631
- * @param {number} index The index of the panel to move<ko>이동할 패널의 인덱스</ko>
1632
- * @param {number} duration Duration of the animation (unit: ms)<ko>애니메이션 진행 시간 (단위: ms)</ko>
1633
- * @param {DIRECTION} direction Direction to move, only available in the {@link Flicking#circular circular} mode<ko>이동할 방향. {@link Flicking#circular circular} 옵션 활성화시에만 사용 가능합니다</ko>
1634
- * @throws {FlickingError}
1635
- * {@link ERROR_CODE INDEX_OUT_OF_RANGE} When the root is not either string or HTMLElement
1636
- * <ko>{@link ERROR_CODE INDEX_OUT_OF_RANGE} 해당 인덱스를 가진 패널이 존재하지 않을 경우</ko>
1637
- * @return {void}
1714
+ * Change the destination and duration of the animation currently playing.
1715
+ * @remarks
1716
+ * This method does nothing if no animation is currently playing.
1717
+ * @param index - The index of the panel to move to
1718
+ * @param duration - Duration of the animation (unit: ms)
1719
+ * @param direction - Direction to move. Only available when {@link FlickingOptions.circular} is enabled
1720
+ * @since 4.10.0
1721
+ * @throws {@link AnimationUpdateErrors}
1638
1722
  */
1639
- public updateAnimation(
1640
- index: number,
1641
- duration?: number,
1642
- direction?: ValueOf<typeof DIRECTION>
1643
- ): void {
1723
+ public updateAnimation(index: number, duration?: number, direction?: ValueOf<typeof DIRECTION>): void {
1644
1724
  if (!this._control.animating) {
1645
1725
  return;
1646
1726
  }
@@ -1661,10 +1741,11 @@ class Flicking extends Component<FlickingEvents> {
1661
1741
  }
1662
1742
 
1663
1743
  /**
1664
- * Stops the animation currently playing
1665
- * @ko 재생 중인 애니메이션을 중단시킵니다
1666
- * @fires Flicking#moveEnd
1667
- * @return {void}
1744
+ * Stop the animation currently playing.
1745
+ * @remarks
1746
+ * This method does nothing if no animation is currently playing.
1747
+ * @since 4.10.0
1748
+ * @fires {@link MoveEndEvent}
1668
1749
  */
1669
1750
  public stopAnimation(): void {
1670
1751
  if (!this._control.animating) {
@@ -1675,10 +1756,9 @@ class Flicking extends Component<FlickingEvents> {
1675
1756
  }
1676
1757
 
1677
1758
  /**
1678
- * Return the {@link Panel} at the given index. `null` if it doesn't exists.
1679
- * @ko 주어진 인덱스에 해당하는 {@link Panel}을 반환합니다. 주어진 인덱스에 해당하는 패널이 존재하지 않을 경우 `null`을 반환합니다.
1680
- * @return {Panel | null} Panel at the given index<ko>주어진 인덱스에 해당하는 패널</ko>
1681
- * @see Panel
1759
+ * Get the panel at the given index.
1760
+ * @param index - The index of the panel to get
1761
+ * @returns The panel at the given index, or `null` if it doesn't exist. This is a shorthand for `Flicking.renderer.getPanel(index)`.
1682
1762
  * @example
1683
1763
  * ```ts
1684
1764
  * const panel = flicking.getPanel(0);
@@ -1691,9 +1771,10 @@ class Flicking extends Component<FlickingEvents> {
1691
1771
  }
1692
1772
 
1693
1773
  /**
1694
- * Enable input from the user (mouse/touch)
1695
- * @ko 사용자의 입력(마우스/터치)를 활성화합니다
1696
- * @return {this}
1774
+ * Enable user input (mouse/touch).
1775
+ * @remarks
1776
+ * This is a shorthand for `Flicking.control.enable`.
1777
+ * @returns The current instance for method chaining
1697
1778
  */
1698
1779
  public enableInput(): this {
1699
1780
  this._control.enable();
@@ -1701,9 +1782,10 @@ class Flicking extends Component<FlickingEvents> {
1701
1782
  }
1702
1783
 
1703
1784
  /**
1704
- * Disable input from the user (mouse/touch)
1705
- * @ko 사용자의 입력(마우스/터치)를 막습니다
1706
- * @return {this}
1785
+ * Disable user input (mouse/touch).
1786
+ * @remarks
1787
+ * This is a shorthand for `Flicking.control.disable`.
1788
+ * @returns The current instance for method chaining
1707
1789
  */
1708
1790
  public disableInput(): this {
1709
1791
  this._control.disable();
@@ -1711,32 +1793,19 @@ class Flicking extends Component<FlickingEvents> {
1711
1793
  }
1712
1794
 
1713
1795
  /**
1714
- * Get current flicking status. You can restore current state by giving returned value to {@link Flicking#setStatus setStatus()}
1715
- * @ko 현재 상태를 반환합니다. 반환받은 값을 {@link Flicking#setStatus setStatus()} 메소드의 인자로 지정하면 현재 상태를 복원할 수 있습니다
1716
- * @param {object} options Status retrieving options<ko>Status 반환 옵션</ko>
1717
- * @param {boolean} [options.index=true] Include current panel index to the returning status. Camera will automatically move to the given index when the {@link Flicking#setStatus setStatus} is called<ko>현재 패널 인덱스를 반환값에 포함시킵니다. {@link Flicking#setStatus setStatus} 호출시 자동으로 해당 인덱스로 카메라를 움직입니다</ko>
1718
- * @param {boolean} [options.position=true] Include camera position to the returning status. This works only when the {@link Flicking#moveType moveType} is `freeScroll`<ko>카메라의 현재 위치를 반환값에 포함시킵니다. 이 옵션은 {@link Flicking#moveType moveType}이 `freeScroll`일 경우에만 동작합니다</ko>
1719
- * @param {boolean} [options.includePanelHTML=false] Include panel's `outerHTML` to the returning status<ko>패널의 `outerHTML`을 반환값에 포함시킵니다</ko>
1720
- * @param {boolean} [options.visiblePanelsOnly=false] Include only {@link Flicking#visiblePanel visiblePanel}'s HTML. This option is available only when the `includePanelHTML` is true
1721
- * <ko>현재 보이는 패널({@link Flicking#visiblePanel visiblePanel})의 HTML만 반환합니다. `includePanelHTML`이 `true`일 경우에만 동작합니다.</ko>
1722
- * @return {Status} An object with current status value information<ko>현재 상태값 정보를 가진 객체.</ko>
1723
- */
1724
- public getStatus({
1725
- index = true,
1726
- position = true,
1727
- includePanelHTML = false,
1728
- visiblePanelsOnly = false
1729
- }: Partial<{
1730
- index: boolean;
1731
- position: boolean;
1732
- includePanelHTML: boolean;
1733
- visiblePanelsOnly: boolean;
1734
- }> = {}): Status {
1796
+ * Get the current Flicking status.
1797
+ * @param options - {@link GetStatusParams}
1798
+ * @returns Status object that can be used with {@link Flicking.setStatus} to restore the state
1799
+ */
1800
+ public getStatus(options: GetStatusParams = {}): Status {
1801
+ // Destructure options with default values
1802
+ const { index = true, position = true, includePanelHTML = false, visiblePanelsOnly = false } = options;
1803
+
1735
1804
  const camera = this._camera;
1736
1805
  const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
1737
1806
 
1738
1807
  const status: Status = {
1739
- panels: panels.map((panel) => {
1808
+ panels: panels.map(panel => {
1740
1809
  const panelInfo: Status["panels"][0] = { index: panel.index };
1741
1810
 
1742
1811
  if (includePanelHTML) {
@@ -1771,17 +1840,13 @@ class Flicking extends Component<FlickingEvents> {
1771
1840
  }
1772
1841
 
1773
1842
  /**
1774
- * Restore to the state of the given {@link Status}
1775
- * @ko 주어진 {@link Status}의 상태로 복원합니다
1776
- * @param {Partial<Status>} status Status value to be restored. You should use the return value of the {@link Flicking#getStatus getStatus()} method<ko>복원할 상태 값. {@link Flicking#getStatus getStatus()} 메서드의 반환값을 지정하면 됩니다</ko>
1777
- * @return {void}
1843
+ * Restore Flicking to the state of the given {@link Status}.
1844
+ * @param status - {@link Status}
1845
+ * @throws {@link StatusRestoreErrors}
1778
1846
  */
1779
1847
  public setStatus(status: Status): void {
1780
1848
  if (!this._initialized) {
1781
- throw new FlickingError(
1782
- ERROR.MESSAGE.NOT_INITIALIZED,
1783
- ERROR.CODE.NOT_INITIALIZED
1784
- );
1849
+ throw new FlickingError(ERROR.MESSAGE.NOT_INITIALIZED, ERROR.CODE.NOT_INITIALIZED);
1785
1850
  }
1786
1851
 
1787
1852
  const { index, position, visibleOffset, panels } = status;
@@ -1798,7 +1863,7 @@ class Flicking extends Component<FlickingEvents> {
1798
1863
  });
1799
1864
  renderer.batchInsert({
1800
1865
  index: 0,
1801
- elements: parseElement(panels.map((panel) => panel.html!)),
1866
+ elements: parseElement(panels.map(panel => panel.html!)),
1802
1867
  hasDOMInElements: true
1803
1868
  });
1804
1869
  }
@@ -1813,23 +1878,23 @@ class Flicking extends Component<FlickingEvents> {
1813
1878
  const { panel, progressInPanel } = position;
1814
1879
  const panelIndex = visibleOffset ? panel - visibleOffset : panel;
1815
1880
  const panelRange = renderer.panels[panelIndex].range;
1816
- const newCameraPos =
1817
- panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
1881
+ const newCameraPos = panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
1818
1882
 
1819
1883
  void control.moveToPosition(newCameraPos, 0).catch(() => void 0);
1820
1884
  }
1821
1885
  }
1822
1886
 
1823
1887
  /**
1824
- * Add plugins that can have different effects on Flicking
1825
- * @ko 플리킹에 다양한 효과를 부여할 수 있는 플러그인을 추가합니다
1826
- * @param {...Plugin} plugins The plugin(s) to add<ko>추가할 플러그인(들)</ko>
1827
- * @return {this}
1888
+ * Add plugins to Flicking.
1889
+ * @remarks
1890
+ * Plugins are automatically initialized if Flicking is already initialized.
1891
+ * @param plugins - {@link Plugin}
1892
+ * @returns The current instance for method chaining
1828
1893
  * @see https://github.com/naver/egjs-flicking-plugins
1829
1894
  */
1830
- public addPlugins(...plugins: Plugin[]) {
1895
+ public addPlugins(...plugins: Plugin[]): this {
1831
1896
  if (this._initialized) {
1832
- plugins.forEach((item) => item.init(this));
1897
+ plugins.forEach(item => item.init(this));
1833
1898
  }
1834
1899
 
1835
1900
  this._plugins.push(...plugins);
@@ -1839,14 +1904,13 @@ class Flicking extends Component<FlickingEvents> {
1839
1904
 
1840
1905
  /**
1841
1906
  * Remove plugins from Flicking.
1842
- * @ko 플리킹으로부터 플러그인들을 제거합니다.
1843
- * @param {...Plugin} plugin The plugin(s) to remove.<ko>제거 플러그인(들).</ko>
1844
- * @return {this}
1907
+ * @param plugins - {@link Plugin}
1908
+ * @returns The current instance for method chaining
1845
1909
  * @see https://github.com/naver/egjs-flicking-plugins
1846
1910
  */
1847
- public removePlugins(...plugins: Plugin[]) {
1848
- plugins.forEach((item) => {
1849
- const foundIndex = findIndex(this._plugins, (val) => val === item);
1911
+ public removePlugins(...plugins: Plugin[]): this {
1912
+ plugins.forEach(item => {
1913
+ const foundIndex = findIndex(this._plugins, val => val === item);
1850
1914
 
1851
1915
  if (foundIndex >= 0) {
1852
1916
  item.destroy();
@@ -1858,21 +1922,23 @@ class Flicking extends Component<FlickingEvents> {
1858
1922
  }
1859
1923
 
1860
1924
  /**
1861
- * Update viewport/panel sizes
1862
- * @ko 패널 및 뷰포트의 크기를 갱신합니다
1863
- * @method
1864
- * @fires Flicking#beforeResize
1865
- * @fires Flicking#afterResize
1866
- * @return {boolean}
1925
+ * Update viewport and panel sizes.
1926
+ * @remarks
1927
+ * This method does nothing if a resize is already in progress.
1928
+ * @fires {@link ResizeEvents}
1929
+ * @returns Promise that resolves when resize is complete
1867
1930
  */
1868
1931
  public async resize(): Promise<void> {
1869
1932
  if (!this._initialized) {
1870
1933
  return;
1871
1934
  }
1872
1935
  if (this._isResizing) {
1936
+ // resize를 연속으로 발생하면 무시하기에 마지막 viewport를 사이즈를 알 수 없음.
1937
+ // resize를 1번 더 실행할 수 잇는 스케줄링 등록
1873
1938
  this._scheduleResize = true;
1874
1939
  return;
1875
1940
  }
1941
+
1876
1942
  this._scheduleResize = false;
1877
1943
  this._isResizing = true;
1878
1944
 
@@ -1884,9 +1950,7 @@ class Flicking extends Component<FlickingEvents> {
1884
1950
  const activePanel = control.activePanel;
1885
1951
  const prevWidth = viewport.width;
1886
1952
  const prevHeight = viewport.height;
1887
- const prevProgressInPanel = activePanel
1888
- ? camera.getProgressInPanel(activePanel)
1889
- : 0;
1953
+ const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
1890
1954
 
1891
1955
  this.trigger(
1892
1956
  new ComponentEvent(EVENTS.BEFORE_RESIZE, {
@@ -1951,30 +2015,24 @@ class Flicking extends Component<FlickingEvents> {
1951
2015
 
1952
2016
  this._isResizing = false;
1953
2017
 
2018
+ // 연속으로 resize를 호출하는 경우를 대비하기 위해서 스케줄링 반영
1954
2019
  if (this._scheduleResize) {
1955
- this.resize();
2020
+ void this.resize();
1956
2021
  }
1957
2022
  return;
1958
2023
  }
1959
2024
 
1960
2025
  /**
1961
- * Add new panels after the last panel
1962
- * @ko 패널 목록의 제일 끝에 새로운 패널들을 추가합니다
1963
- * @param {ElementLike | ElementLike[]} element A new HTMLElement, a outerHTML of element, or an array of both
1964
- * <ko>새로운 HTMLElement, 혹은 엘리먼트의 outerHTML, 혹은 그것들의 배열</ko>
1965
- * @return {Panel[]} An array of appended panels<ko>추가된 패널들의 배열</ko>
1966
- * @see Panel
1967
- * @see ElementLike
1968
- * @throws {FlickingError} {@link ERROR_CODE ERROR_CODE.NOT_ALLOWED_IN_FRAMEWORK} if called on frameworks (React, Angular, Vue...)
2026
+ * Add new panels after the last panel.
2027
+ * @param element - A new HTMLElement, outerHTML string, or an array of both
2028
+ * @throws {@link DOMManipulationErrors}
2029
+ * @returns Array of appended panels
1969
2030
  * @example
1970
2031
  * ```ts
1971
2032
  * const flicking = new Flicking("#flick");
1972
- * // These are possible parameters
1973
2033
  * flicking.append(document.createElement("div"));
1974
- * flicking.append("\<div\>Panel\</div\>");
1975
- * flicking.append(["\<div\>Panel\</div\>", document.createElement("div")]);
1976
- * // Even this is possible
1977
- * flicking.append("\<div\>Panel 1\</div\>\<div\>Panel 2\</div\>");
2034
+ * flicking.append("<div>Panel</div>");
2035
+ * flicking.append(["<div>Panel</div>", document.createElement("div")]);
1978
2036
  * ```
1979
2037
  */
1980
2038
  public append(element: ElementLike | ElementLike[]): Panel[] {
@@ -1982,24 +2040,18 @@ class Flicking extends Component<FlickingEvents> {
1982
2040
  }
1983
2041
 
1984
2042
  /**
1985
- * Add new panels before the first panel
1986
- * This will increase index of panels after by the number of panels added
1987
- * @ko 패널 목록의 제일 앞(index 0)에 새로운 패널들을 추가합니다
1988
- * 추가한 패널의 개수만큼 기존 패널들의 인덱스가 증가합니다.
1989
- * @param {ElementLike | ElementLike[]} element A new HTMLElement, a outerHTML of element, or an array of both
1990
- * <ko>새로운 HTMLElement, 혹은 엘리먼트의 outerHTML, 혹은 그것들의 배열</ko>
1991
- * @return {Panel[]} An array of prepended panels<ko>추가된 패널들의 배열</ko>
1992
- * @see Panel
1993
- * @see ElementLike
1994
- * @throws {FlickingError} {@link ERROR_CODE ERROR_CODE.NOT_ALLOWED_IN_FRAMEWORK} if called on frameworks (React, Angular, Vue...)
2043
+ * Add new panels before the first panel.
2044
+ * @remarks
2045
+ * This will increase the index of existing panels by the number of panels added.
2046
+ * @param element - A new HTMLElement, outerHTML string, or an array of both
2047
+ * @throws {@link DOMManipulationErrors}
2048
+ * @returns Array of prepended panels
1995
2049
  * @example
1996
2050
  * ```ts
1997
- * const flicking = new eg.Flicking("#flick");
2051
+ * const flicking = new Flicking("#flick");
1998
2052
  * flicking.prepend(document.createElement("div"));
1999
- * flicking.prepend("\<div\>Panel\</div\>");
2000
- * flicking.prepend(["\<div\>Panel\</div\>", document.createElement("div")]);
2001
- * // Even this is possible
2002
- * flicking.prepend("\<div\>Panel 1\</div\>\<div\>Panel 2\</div\>");
2053
+ * flicking.prepend("<div>Panel</div>");
2054
+ * flicking.prepend(["<div>Panel</div>", document.createElement("div")]);
2003
2055
  * ```
2004
2056
  */
2005
2057
  public prepend(element: ElementLike | ElementLike[]): Panel[] {
@@ -2007,31 +2059,24 @@ class Flicking extends Component<FlickingEvents> {
2007
2059
  }
2008
2060
 
2009
2061
  /**
2010
- * Insert new panels at given index
2011
- * This will increase index of panels after by the number of panels added
2012
- * @ko 주어진 인덱스에 새로운 패널들을 추가합니다
2013
- * 해당 인덱스보다 같거나 인덱스를 가진 기존 패널들은 추가한 패널의 개수만큼 인덱스가 증가합니다.
2014
- * @param {number} index Index to insert new panels at<ko>새로 패널들을 추가할 인덱스</ko>
2015
- * @param {ElementLike | ElementLike[]} element A new HTMLElement, a outerHTML of element, or an array of both
2016
- * <ko>새로운 HTMLElement, 혹은 엘리먼트의 outerHTML, 혹은 그것들의 배열</ko>
2017
- * @return {Panel[]} An array of prepended panels<ko>추가된 패널들의 배열</ko>
2018
- * @throws {FlickingError} {@link ERROR_CODE ERROR_CODE.NOT_ALLOWED_IN_FRAMEWORK} if called on frameworks (React, Angular, Vue...)
2062
+ * Insert new panels at the given index.
2063
+ * @remarks
2064
+ * This will increase the index of panels at or after the given index by the number of panels added.
2065
+ * @param index - Index to insert new panels at
2066
+ * @param element - A new HTMLElement, outerHTML string, or an array of both
2067
+ * @throws {@link DOMManipulationErrors}
2068
+ * @returns Array of inserted panels
2019
2069
  * @example
2020
2070
  * ```ts
2021
- * const flicking = new eg.Flicking("#flick");
2071
+ * const flicking = new Flicking("#flick");
2022
2072
  * flicking.insert(0, document.createElement("div"));
2023
- * flicking.insert(2, "\<div\>Panel\</div\>");
2024
- * flicking.insert(1, ["\<div\>Panel\</div\>", document.createElement("div")]);
2025
- * // Even this is possible
2026
- * flicking.insert(3, "\<div\>Panel 1\</div\>\<div\>Panel 2\</div\>");
2073
+ * flicking.insert(2, "<div>Panel</div>");
2074
+ * flicking.insert(1, ["<div>Panel</div>", document.createElement("div")]);
2027
2075
  * ```
2028
2076
  */
2029
2077
  public insert(index: number, element: ElementLike | ElementLike[]): Panel[] {
2030
2078
  if (this._renderExternal) {
2031
- throw new FlickingError(
2032
- ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
2033
- ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
2034
- );
2079
+ throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
2035
2080
  }
2036
2081
 
2037
2082
  return this._renderer.batchInsert({
@@ -2042,20 +2087,17 @@ class Flicking extends Component<FlickingEvents> {
2042
2087
  }
2043
2088
 
2044
2089
  /**
2045
- * Remove the panel at the given index
2046
- * This will decrease index of panels after by the number of panels removed
2047
- * @ko 주어진 인덱스의 패널을 제거합니다
2048
- * 해당 인덱스보다 인덱스를 가진 기존 패널들은 제거한 패널의 개수만큼 인덱스가 감소합니다
2049
- * @param {number} index Index of panel to remove<ko>제거할 패널의 인덱스</ko>
2050
- * @param {number} [deleteCount=1] Number of panels to remove from index<ko>`index` 이후로 제거할 패널의 개수</ko>
2051
- * @return {Panel[]} An array of removed panels<ko>제거된 패널들의 배열</ko>
2090
+ * Remove panels starting from the given index.
2091
+ * @remarks
2092
+ * This will decrease the index of panels after the removed ones by the number of panels removed.
2093
+ * @param index - Index of the first panel to remove
2094
+ * @param deleteCount - Number of panels to remove. Defaults to `1`
2095
+ * @throws {@link DOMManipulationErrors}
2096
+ * @returns Array of removed panels
2052
2097
  */
2053
2098
  public remove(index: number, deleteCount: number = 1): Panel[] {
2054
2099
  if (this._renderExternal) {
2055
- throw new FlickingError(
2056
- ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
2057
- ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
2058
- );
2100
+ throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
2059
2101
  }
2060
2102
 
2061
2103
  return this._renderer.batchRemove({
@@ -2065,15 +2107,20 @@ class Flicking extends Component<FlickingEvents> {
2065
2107
  });
2066
2108
  }
2067
2109
 
2110
+ /**
2111
+ * Factory method to create the appropriate Control implementation based on moveType option.
2112
+ * @internal
2113
+ * @privateRemarks
2114
+ * Called during constructor and when moveType option is changed. The moveType option must be set before calling this method.
2115
+ * Throws error if moveType is invalid.
2116
+ */
2068
2117
  private _createControl(): Control {
2069
2118
  const moveType = this._moveType;
2070
- const moveTypes = Object.keys(MOVE_TYPE).map(
2071
- (key) => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>
2072
- );
2119
+ const moveTypes = Object.keys(MOVE_TYPE).map(key => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>);
2073
2120
 
2074
2121
  const moveTypeStr = Array.isArray(moveType) ? moveType[0] : moveType;
2075
2122
 
2076
- const moveTypeOptions = Array.isArray(moveType) ? moveType[1] ?? {} : {};
2123
+ const moveTypeOptions = Array.isArray(moveType) ? (moveType[1] ?? {}) : {};
2077
2124
 
2078
2125
  if (!includes(moveTypes, moveTypeStr)) {
2079
2126
  throw new FlickingError(
@@ -2092,12 +2139,17 @@ class Flicking extends Component<FlickingEvents> {
2092
2139
  }
2093
2140
  }
2094
2141
 
2142
+ /**
2143
+ * Factory method to create Camera instance for managing viewport movement and positioning.
2144
+ * @internal
2145
+ * @privateRemarks
2146
+ * Called during constructor. The align option must be set before calling this method.
2147
+ * Warns if both circular and bound options are enabled (bound is ignored).
2148
+ */
2095
2149
  private _createCamera(): Camera {
2096
2150
  if (this._circular && this._bound) {
2097
2151
  // eslint-disable-next-line no-console
2098
- console.warn(
2099
- "\"circular\" and \"bound\" option cannot be used together, ignoring bound."
2100
- );
2152
+ console.warn('"circular" and "bound" option cannot be used together, ignoring bound.');
2101
2153
  }
2102
2154
 
2103
2155
  return new Camera(this, {
@@ -2105,13 +2157,18 @@ class Flicking extends Component<FlickingEvents> {
2105
2157
  });
2106
2158
  }
2107
2159
 
2160
+ /**
2161
+ * Factory method to create the appropriate Renderer implementation based on externalRenderer and virtual options.
2162
+ * @internal
2163
+ * @privateRemarks
2164
+ * Called during constructor. Selects ExternalRenderer if externalRenderer is provided, otherwise creates VanillaRenderer or ExternalRenderer based on renderExternal option.
2165
+ * Warns if virtual is enabled without panelsPerView.
2166
+ */
2108
2167
  private _createRenderer(): Renderer {
2109
2168
  const externalRenderer = this._externalRenderer;
2110
2169
  if (this._virtual && this._panelsPerView <= 0) {
2111
2170
  // eslint-disable-next-line no-console
2112
- console.warn(
2113
- "\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual."
2114
- );
2171
+ console.warn('"virtual" and "panelsPerView" option should be used together, ignoring virtual.');
2115
2172
  }
2116
2173
 
2117
2174
  return externalRenderer
@@ -2121,12 +2178,25 @@ class Flicking extends Component<FlickingEvents> {
2121
2178
  : this._createVanillaRenderer();
2122
2179
  }
2123
2180
 
2181
+ /**
2182
+ * Factory method to create ExternalRenderer from renderExternal option (deprecated).
2183
+ * @internal
2184
+ * @privateRemarks
2185
+ * Called by _createRenderer when renderExternal option is set. The renderExternal option must not be null and must contain renderer class and options.
2186
+ */
2124
2187
  private _createExternalRenderer(): ExternalRenderer {
2125
2188
  const { renderer, rendererOptions } = this._renderExternal!;
2126
2189
 
2127
2190
  return new renderer({ align: this._align, ...rendererOptions });
2128
2191
  }
2129
2192
 
2193
+ /**
2194
+ * Factory method to create VanillaRenderer for vanilla JavaScript rendering.
2195
+ * @internal
2196
+ * @privateRemarks
2197
+ * Called by _createRenderer when neither externalRenderer nor renderExternal is set.
2198
+ * Uses VirtualRenderingStrategy if virtual is enabled, otherwise NormalRenderingStrategy.
2199
+ */
2130
2200
  private _createVanillaRenderer(): VanillaRenderer {
2131
2201
  const virtual = this.virtualEnabled;
2132
2202
 
@@ -2135,25 +2205,31 @@ class Flicking extends Component<FlickingEvents> {
2135
2205
  strategy: virtual
2136
2206
  ? new VirtualRenderingStrategy()
2137
2207
  : new NormalRenderingStrategy({
2138
- providerCtor: VanillaElementProvider
2139
- })
2208
+ providerCtor: VanillaElementProvider
2209
+ })
2140
2210
  });
2141
2211
  }
2142
2212
 
2213
+ /**
2214
+ * Move camera to the initial panel position based on defaultIndex option.
2215
+ * @internal
2216
+ * @privateRemarks
2217
+ * Called during init() method, after _initialResize(). Requires camera, renderer, and control to be already initialized.
2218
+ * Throws error if the initial panel position is not reachable.
2219
+ */
2143
2220
  private _moveToInitialPanel(): void {
2144
2221
  const renderer = this._renderer;
2145
2222
  const control = this._control;
2146
2223
  const camera = this._camera;
2147
- const defaultPanel =
2148
- renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
2224
+ const defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
2149
2225
 
2150
2226
  if (!defaultPanel) return;
2151
2227
 
2152
2228
  const nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
2153
2229
  const initialPanel =
2154
2230
  nearestAnchor &&
2155
- defaultPanel.position !== nearestAnchor.panel.position &&
2156
- defaultPanel.index !== nearestAnchor.panel.index
2231
+ defaultPanel.position !== nearestAnchor.panel.position &&
2232
+ defaultPanel.index !== nearestAnchor.panel.index
2157
2233
  ? nearestAnchor.panel
2158
2234
  : defaultPanel;
2159
2235
  control.setActive(initialPanel, null, false);
@@ -2176,6 +2252,13 @@ class Flicking extends Component<FlickingEvents> {
2176
2252
  camera.updateOffset();
2177
2253
  }
2178
2254
 
2255
+ /**
2256
+ * Calculate initial viewport and panel sizes during initialization.
2257
+ * @internal
2258
+ * @privateRemarks
2259
+ * Called during init() method, before _moveToInitialPanel(). This is separate from the regular resize() to avoid triggering events before initialization is complete.
2260
+ * Requires viewport, renderer, camera, and control to be already initialized. Triggers BEFORE_RESIZE and AFTER_RESIZE events.
2261
+ */
2179
2262
  private _initialResize() {
2180
2263
  const viewport = this._viewport;
2181
2264
  const renderer = this._renderer;