@egjs/flicking 4.13.2-beta.0 → 4.14.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.
package/src/Flicking.ts CHANGED
@@ -10,13 +10,52 @@ import AutoResizer from "./core/AutoResizer";
10
10
  import { Panel } from "./core/panel";
11
11
  import { VanillaElementProvider } from "./core/panel/provider";
12
12
  import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
13
- import { Control, SnapControl, SnapControlOptions, FreeControl, StrictControl, FreeControlOptions, StrictControlOptions } from "./control";
13
+ import {
14
+ Control,
15
+ SnapControl,
16
+ SnapControlOptions,
17
+ FreeControl,
18
+ StrictControl,
19
+ FreeControlOptions,
20
+ StrictControlOptions
21
+ } from "./control";
14
22
  import { Camera } from "./camera";
15
- import { Renderer, VanillaRenderer, ExternalRenderer, RendererOptions, NormalRenderingStrategy, VirtualRenderingStrategy } from "./renderer";
16
- import { EVENTS, ALIGN, MOVE_TYPE, DIRECTION, CIRCULAR_FALLBACK } from "./const/external";
23
+ import {
24
+ Renderer,
25
+ VanillaRenderer,
26
+ ExternalRenderer,
27
+ RendererOptions,
28
+ NormalRenderingStrategy,
29
+ VirtualRenderingStrategy
30
+ } from "./renderer";
31
+ import {
32
+ EVENTS,
33
+ ALIGN,
34
+ MOVE_TYPE,
35
+ DIRECTION,
36
+ CIRCULAR_FALLBACK
37
+ } from "./const/external";
17
38
  import * as ERROR from "./const/error";
18
39
  import { findIndex, getElement, includes, parseElement } from "./utils";
19
- import { HoldStartEvent, HoldEndEvent, MoveStartEvent, SelectEvent, MoveEvent, MoveEndEvent, WillChangeEvent, WillRestoreEvent, NeedPanelEvent, VisibleChangeEvent, ReachEdgeEvent, ReadyEvent, AfterResizeEvent, BeforeResizeEvent, ChangedEvent, RestoredEvent, PanelChangeEvent } from "./type/event";
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";
20
59
  import { LiteralUnion, ValueOf } from "./type/internal";
21
60
  import { ElementLike, Plugin, Status, MoveTypeOptions } from "./type/external";
22
61
 
@@ -48,7 +87,10 @@ export interface FlickingEvents {
48
87
  */
49
88
  export interface FlickingOptions {
50
89
  // UI / LAYOUT
51
- align: LiteralUnion<ValueOf<typeof ALIGN>> | number | { panel: number | string; camera: number | string };
90
+ align:
91
+ | LiteralUnion<ValueOf<typeof ALIGN>>
92
+ | number
93
+ | { panel: number | string; camera: number | string };
52
94
  defaultIndex: number;
53
95
  horizontal: boolean;
54
96
  circular: boolean;
@@ -71,7 +113,9 @@ export interface FlickingOptions {
71
113
 
72
114
  // INPUT
73
115
  inputType: string[];
74
- moveType: ValueOf<typeof MOVE_TYPE> | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
116
+ moveType:
117
+ | ValueOf<typeof MOVE_TYPE>
118
+ | MoveTypeOptions<ValueOf<typeof MOVE_TYPE>>;
75
119
  threshold: number;
76
120
  dragThreshold: number;
77
121
  interruptable: boolean;
@@ -91,9 +135,11 @@ export interface FlickingOptions {
91
135
  autoResize: boolean;
92
136
  useResizeObserver: boolean;
93
137
  resizeDebounce: number;
138
+ observePanelResize: boolean;
94
139
  maxResizeDebounce: number;
95
140
  useFractionalSize: boolean;
96
141
  externalRenderer: ExternalRenderer | null;
142
+ optimizeSizeUpdate: boolean;
97
143
 
98
144
  // @deprecated
99
145
  renderExternal: {
@@ -168,14 +214,17 @@ class Flicking extends Component<FlickingEvents> {
168
214
  private _autoResize: FlickingOptions["autoResize"];
169
215
  private _useResizeObserver: FlickingOptions["useResizeObserver"];
170
216
  private _resizeDebounce: FlickingOptions["resizeDebounce"];
217
+ private _observePanelResize: FlickingOptions["observePanelResize"];
171
218
  private _maxResizeDebounce: FlickingOptions["maxResizeDebounce"];
172
219
  private _useFractionalSize: FlickingOptions["useFractionalSize"];
173
220
  private _externalRenderer: FlickingOptions["externalRenderer"];
174
221
  private _renderExternal: FlickingOptions["renderExternal"];
222
+ private _optimizeSizeUpdate: FlickingOptions["optimizeSizeUpdate"];
175
223
 
176
224
  // Internal State
177
225
  private _initialized: boolean;
178
226
  private _plugins: Plugin[];
227
+ private _isResizing: boolean;
179
228
 
180
229
  // Components
181
230
  /**
@@ -188,7 +237,10 @@ class Flicking extends Component<FlickingEvents> {
188
237
  * @see SnapControl
189
238
  * @see FreeControl
190
239
  */
191
- public get control() { return this._control; }
240
+ public get control() {
241
+ return this._control;
242
+ }
243
+
192
244
  /**
193
245
  * {@link Camera} instance of the Flicking
194
246
  * @ko 현재 Flicking에 활성화된 {@link Camera} 인스턴스
@@ -200,7 +252,10 @@ class Flicking extends Component<FlickingEvents> {
200
252
  * @see BoundCamera
201
253
  * @see CircularCamera
202
254
  */
203
- public get camera() { return this._camera; }
255
+ public get camera() {
256
+ return this._camera;
257
+ }
258
+
204
259
  /**
205
260
  * {@link Renderer} instance of the Flicking
206
261
  * @ko 현재 Flicking에 활성화된 {@link Renderer} 인스턴스
@@ -211,7 +266,10 @@ class Flicking extends Component<FlickingEvents> {
211
266
  * @see VanillaRenderer
212
267
  * @see ExternalRenderer
213
268
  */
214
- public get renderer() { return this._renderer; }
269
+ public get renderer() {
270
+ return this._renderer;
271
+ }
272
+
215
273
  /**
216
274
  * A component that manages viewport size
217
275
  * @ko 뷰포트 크기 정보를 담당하는 컴포넌트
@@ -220,6 +278,13 @@ class Flicking extends Component<FlickingEvents> {
220
278
  * @see Viewport
221
279
  */
222
280
  public get viewport() { return this._viewport; }
281
+ /**
282
+ * {@link AutoResizer} instance of the Flicking
283
+ * @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
284
+ * @internal
285
+ * @readonly
286
+ */
287
+ public get autoResizer() { return this._autoResizer; }
223
288
  // Internal States
224
289
  /**
225
290
  * Whether Flicking's {@link Flicking#init init()} is called.
@@ -230,7 +295,10 @@ class Flicking extends Component<FlickingEvents> {
230
295
  * @default false
231
296
  * @readonly
232
297
  */
233
- public get initialized() { return this._initialized; }
298
+ public get initialized() {
299
+ return this._initialized;
300
+ }
301
+
234
302
  /**
235
303
  * Whether the `circular` option is enabled.
236
304
  * The {@link Flicking#circular circular} option can't be enabled when sum of the panel sizes are too small.
@@ -240,7 +308,10 @@ class Flicking extends Component<FlickingEvents> {
240
308
  * @default false
241
309
  * @readonly
242
310
  */
243
- public get circularEnabled() { return this._camera.circularEnabled; }
311
+ public get circularEnabled() {
312
+ return this._camera.circularEnabled;
313
+ }
314
+
244
315
  /**
245
316
  * Whether the `virtual` option is enabled.
246
317
  * The {@link Flicking#virtual virtual} option can't be enabled when {@link Flicking#panelsPerView panelsPerView} is less or equal than zero.
@@ -250,7 +321,10 @@ class Flicking extends Component<FlickingEvents> {
250
321
  * @default false
251
322
  * @readonly
252
323
  */
253
- public get virtualEnabled() { return this._panelsPerView > 0 && this._virtual != null; }
324
+ public get virtualEnabled() {
325
+ return this._panelsPerView > 0 && this._virtual != null;
326
+ }
327
+
254
328
  /**
255
329
  * Index number of the {@link Flicking#currentPanel currentPanel}
256
330
  * @ko {@link Flicking#currentPanel currentPanel}의 인덱스 번호
@@ -258,14 +332,20 @@ class Flicking extends Component<FlickingEvents> {
258
332
  * @default 0
259
333
  * @readonly
260
334
  */
261
- public get index() { return this._control.activeIndex; }
335
+ public get index() {
336
+ return this._control.activeIndex;
337
+ }
338
+
262
339
  /**
263
340
  * The root(`.flicking-viewport`) element
264
341
  * @ko root(`.flicking-viewport`) 엘리먼트
265
342
  * @type {HTMLElement}
266
343
  * @readonly
267
344
  */
268
- public get element() { return this._viewport.element; }
345
+ public get element() {
346
+ return this._viewport.element;
347
+ }
348
+
269
349
  /**
270
350
  * Currently active panel
271
351
  * @ko 현재 선택된 패널
@@ -273,7 +353,10 @@ class Flicking extends Component<FlickingEvents> {
273
353
  * @readonly
274
354
  * @see Panel
275
355
  */
276
- public get currentPanel() { return this._control.activePanel; }
356
+ public get currentPanel() {
357
+ return this._control.activePanel;
358
+ }
359
+
277
360
  /**
278
361
  * Array of panels
279
362
  * @ko 전체 패널들의 배열
@@ -281,14 +364,20 @@ class Flicking extends Component<FlickingEvents> {
281
364
  * @readonly
282
365
  * @see Panel
283
366
  */
284
- public get panels() { return this._renderer.panels; }
367
+ public get panels() {
368
+ return this._renderer.panels;
369
+ }
370
+
285
371
  /**
286
372
  * Count of panels
287
373
  * @ko 전체 패널의 개수
288
374
  * @type {number}
289
375
  * @readonly
290
376
  */
291
- public get panelCount() { return this._renderer.panelCount; }
377
+ public get panelCount() {
378
+ return this._renderer.panelCount;
379
+ }
380
+
292
381
  /**
293
382
  * Array of panels that is visible at the current position
294
383
  * @ko 현재 보이는 패널의 배열
@@ -296,28 +385,39 @@ class Flicking extends Component<FlickingEvents> {
296
385
  * @readonly
297
386
  * @see Panel
298
387
  */
299
- public get visiblePanels() { return this._camera.visiblePanels; }
388
+ public get visiblePanels() {
389
+ return this._camera.visiblePanels;
390
+ }
391
+
300
392
  /**
301
393
  * Whether Flicking's animating
302
394
  * @ko 현재 애니메이션 동작 여부
303
395
  * @type {boolean}
304
396
  * @readonly
305
397
  */
306
- public get animating() { return this._control.animating; }
398
+ public get animating() {
399
+ return this._control.animating;
400
+ }
401
+
307
402
  /**
308
403
  * Whether user is clicking or touching
309
404
  * @ko 현재 사용자가 클릭/터치중인지 여부
310
405
  * @type {boolean}
311
406
  * @readonly
312
407
  */
313
- public get holding() { return this._control.holding; }
408
+ public get holding() {
409
+ return this._control.holding;
410
+ }
411
+
314
412
  /**
315
413
  * A current list of activated plugins
316
414
  * @ko 현재 활성화된 플러그인 목록
317
415
  * @type {Plugin[]}
318
416
  * @readonly
319
417
  */
320
- public get activePlugins() { return this._plugins; }
418
+ public get activePlugins() {
419
+ return this._plugins;
420
+ }
321
421
 
322
422
  // Options Getter
323
423
  // UI / LAYOUT
@@ -349,7 +449,10 @@ class Flicking extends Component<FlickingEvents> {
349
449
  * });
350
450
  * ```
351
451
  */
352
- public get align() { return this._align; }
452
+ public get align() {
453
+ return this._align;
454
+ }
455
+
353
456
  /**
354
457
  * Index of the panel to move when Flicking's {@link Flicking#init init()} is called. A zero-based integer
355
458
  * @ko Flicking의 {@link Flicking#init init()}이 호출될 때 이동할 디폴트 패널의 인덱스로, 0부터 시작하는 정수입니다.
@@ -357,7 +460,10 @@ class Flicking extends Component<FlickingEvents> {
357
460
  * @default 0
358
461
  * @see {@link https://naver.github.io/egjs-flicking/Options#defaultindex defaultIndex ( Options )}
359
462
  */
360
- public get defaultIndex() { return this._defaultIndex; }
463
+ public get defaultIndex() {
464
+ return this._defaultIndex;
465
+ }
466
+
361
467
  /**
362
468
  * Direction of panel movement (true: horizontal, false: vertical)
363
469
  * @ko 패널 이동 방향 (true: 가로방향, false: 세로방향)
@@ -365,7 +471,10 @@ class Flicking extends Component<FlickingEvents> {
365
471
  * @default true
366
472
  * @see {@link https://naver.github.io/egjs-flicking/Options#horizontal horizontal ( Options )}
367
473
  */
368
- public get horizontal() { return this._horizontal; }
474
+ public get horizontal() {
475
+ return this._horizontal;
476
+ }
477
+
369
478
  /**
370
479
  * Enables circular(continuous loop) mode, which connects first/last panel for continuous scrolling.
371
480
  * @ko 순환 모드를 활성화합니다. 순환 모드에서는 양 끝의 패널이 서로 연결되어 끊김없는 스크롤이 가능합니다.
@@ -373,7 +482,10 @@ class Flicking extends Component<FlickingEvents> {
373
482
  * @default false
374
483
  * @see {@link https://naver.github.io/egjs-flicking/Options#circular circular ( Options )}
375
484
  */
376
- public get circular() { return this._circular; }
485
+ public get circular() {
486
+ return this._circular;
487
+ }
488
+
377
489
  /**
378
490
  * Set panel control mode for the case when circular cannot be enabled.
379
491
  * "linear" will set the view's range from the top of the first panel to the top of the last panel.
@@ -386,7 +498,10 @@ class Flicking extends Component<FlickingEvents> {
386
498
  * @default "linear"
387
499
  * @see {@link https://naver.github.io/egjs-flicking/Options#circularfallback circularFallback ( Options )}
388
500
  */
389
- public get circularFallback() { return this._circularFallback; }
501
+ public get circularFallback() {
502
+ return this._circularFallback;
503
+ }
504
+
390
505
  /**
391
506
  * 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
392
507
  * Only can be enabled when `circular=false`
@@ -396,7 +511,10 @@ class Flicking extends Component<FlickingEvents> {
396
511
  * @default false
397
512
  * @see {@link https://naver.github.io/egjs-flicking/Options#bound bound ( Options )}
398
513
  */
399
- public get bound() { return this._bound; }
514
+ public get bound() {
515
+ return this._bound;
516
+ }
517
+
400
518
  /**
401
519
  * Update height of the viewport element after movement same to the height of the panel below. This can be only enabled when `horizontal=true`
402
520
  * @ko 이동한 후 뷰포트 엘리먼트의 크기를 현재 패널의 높이와 동일하게 설정합니다. `horizontal=true`인 경우에만 사용할 수 있습니다.
@@ -404,7 +522,10 @@ class Flicking extends Component<FlickingEvents> {
404
522
  * @default false
405
523
  * @see {@link https://naver.github.io/egjs-flicking/Options#adaptive adaptive ( Options )}
406
524
  */
407
- public get adaptive() { return this._adaptive; }
525
+ public get adaptive() {
526
+ return this._adaptive;
527
+ }
528
+
408
529
  /**
409
530
  * A visible number of panels on viewport. Enabling this option will automatically resize panel size
410
531
  * @ko 한 화면에 보이는 패널의 개수. 이 옵션을 활성화할 경우 패널의 크기를 강제로 재조정합니다
@@ -412,7 +533,10 @@ class Flicking extends Component<FlickingEvents> {
412
533
  * @default -1
413
534
  * @see {@link https://naver.github.io/egjs-flicking/Options#panelsperview panelsPerView ( Options )}
414
535
  */
415
- public get panelsPerView() { return this._panelsPerView; }
536
+ public get panelsPerView() {
537
+ return this._panelsPerView;
538
+ }
539
+
416
540
  /**
417
541
  * Enabling this option will not change `width/height` style of the panels if {@link Flicking#panelsPerView} is enabled.
418
542
  * This behavior can be useful in terms of performance when you're manually managing all panel sizes
@@ -421,7 +545,10 @@ class Flicking extends Component<FlickingEvents> {
421
545
  * @type {boolean}
422
546
  * @default false
423
547
  */
424
- public get noPanelStyleOverride() { return this._noPanelStyleOverride; }
548
+ public get noPanelStyleOverride() {
549
+ return this._noPanelStyleOverride;
550
+ }
551
+
425
552
  /**
426
553
  * Enabling this option will automatically call {@link Flicking#resize} when all image/video inside panels are loaded.
427
554
  * This can be useful when you have contents inside Flicking that changes its size when it's loaded
@@ -431,7 +558,10 @@ class Flicking extends Component<FlickingEvents> {
431
558
  * @default false
432
559
  * @see {@link https://naver.github.io/egjs-flicking/Options#resizeOnContentsReady resizeOnContentsReady ( Options )}
433
560
  */
434
- public get resizeOnContentsReady() { return this._resizeOnContentsReady; }
561
+ public get resizeOnContentsReady() {
562
+ return this._resizeOnContentsReady;
563
+ }
564
+
435
565
  /**
436
566
  * 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.
437
567
  * If the parent Flicking and child Flicking have different horizontal option, you do not need to set this option.
@@ -441,7 +571,10 @@ class Flicking extends Component<FlickingEvents> {
441
571
  * @default false
442
572
  * @see {@link https://naver.github.io/egjs-flicking/Options#nested nested ( Options )}
443
573
  */
444
- public get nested() { return this._nested; }
574
+ public get nested() {
575
+ return this._nested;
576
+ }
577
+
445
578
  // EVENTS
446
579
  /**
447
580
  * A Threshold from viewport edge before triggering `needPanel` event
@@ -450,7 +583,10 @@ class Flicking extends Component<FlickingEvents> {
450
583
  * @default 0
451
584
  * @see {@link https://naver.github.io/egjs-flicking/Options#needpanelthreshold needPanelThreshold ( Options )}
452
585
  */
453
- public get needPanelThreshold() { return this._needPanelThreshold; }
586
+ public get needPanelThreshold() {
587
+ return this._needPanelThreshold;
588
+ }
589
+
454
590
  /**
455
591
  * When enabled, events are not triggered before `ready` when initializing
456
592
  * @ko 활성화할 경우 초기화시 `ready` 이벤트 이전의 이벤트가 발생하지 않습니다.
@@ -458,7 +594,10 @@ class Flicking extends Component<FlickingEvents> {
458
594
  * @default true
459
595
  * @see {@link https://naver.github.io/egjs-flicking/Options#preventeventsbeforeinit preventEventsBeforeInit ( Options )}
460
596
  */
461
- public get preventEventsBeforeInit() { return this._preventEventsBeforeInit; }
597
+ public get preventEventsBeforeInit() {
598
+ return this._preventEventsBeforeInit;
599
+ }
600
+
462
601
  // ANIMATION
463
602
  /**
464
603
  * Deceleration value for panel movement animation which is triggered by user input. A higher value means a shorter animation time
@@ -467,7 +606,10 @@ class Flicking extends Component<FlickingEvents> {
467
606
  * @default 0.0075
468
607
  * @see {@link https://naver.github.io/egjs-flicking/Options#deceleration deceleration ( Options )}
469
608
  */
470
- public get deceleration() { return this._deceleration; }
609
+ public get deceleration() {
610
+ return this._deceleration;
611
+ }
612
+
471
613
  /**
472
614
  * An easing function applied to the panel movement animation. Default value is `easeOutCubic`
473
615
  * @ko 패널 이동 애니메이션에 적용할 easing 함수. 기본값은 `easeOutCubic`이다
@@ -476,7 +618,10 @@ class Flicking extends Component<FlickingEvents> {
476
618
  * @see Easing Functions Cheat Sheet {@link http://easings.net/} <ko>이징 함수 Cheat Sheet {@link http://easings.net/}</ko>
477
619
  * @see {@link https://naver.github.io/egjs-flicking/Options#easing Easing ( Options )}
478
620
  */
479
- public get easing() { return this._easing; }
621
+ public get easing() {
622
+ return this._easing;
623
+ }
624
+
480
625
  /**
481
626
  * Default duration of the animation (ms)
482
627
  * @ko 디폴트 애니메이션 재생 시간 (ms)
@@ -484,7 +629,10 @@ class Flicking extends Component<FlickingEvents> {
484
629
  * @default 500
485
630
  * @see {@link https://naver.github.io/egjs-flicking/Options#duration duration ( Options )}
486
631
  */
487
- public get duration() { return this._duration; }
632
+ public get duration() {
633
+ return this._duration;
634
+ }
635
+
488
636
  // INPUT
489
637
  /**
490
638
  * Types of input devices to enable
@@ -495,7 +643,10 @@ class Flicking extends Component<FlickingEvents> {
495
643
  * <ko>{@link https://naver.github.io/egjs-axes/Options#paninput-options 가능한 값들 (PanInputOption#inputType)}</ko>
496
644
  * @see {@link https://naver.github.io/egjs-flicking/Options#inputtype inputType ( Options )}
497
645
  */
498
- public get inputType() { return this._inputType; }
646
+ public get inputType() {
647
+ return this._inputType;
648
+ }
649
+
499
650
  /**
500
651
  * Movement style by user input. This will change instance type of {@link Flicking#control}
501
652
  * You can use the values of the constant {@link MOVE_TYPE}
@@ -527,7 +678,10 @@ class Flicking extends Component<FlickingEvents> {
527
678
  * });
528
679
  * ```
529
680
  */
530
- public get moveType() { return this._moveType; }
681
+ public get moveType() {
682
+ return this._moveType;
683
+ }
684
+
531
685
  /**
532
686
  * Movement threshold to change panel (unit: px). It should be dragged above the threshold to change the current panel.
533
687
  * @ko 패널 변경을 위한 이동 임계값 (단위: px). 주어진 값 이상으로 스크롤해야만 패널 변경이 가능합니다.
@@ -535,7 +689,10 @@ class Flicking extends Component<FlickingEvents> {
535
689
  * @default 40
536
690
  * @see {@link https://naver.github.io/egjs-flicking/Options#threshold Threshold ( Options )}
537
691
  */
538
- public get threshold() { return this._threshold; }
692
+ public get threshold() {
693
+ return this._threshold;
694
+ }
695
+
539
696
  /**
540
697
  * Minimal distance of user input before recognizing (unit: px). It should be dragged above the dragThreshold to move the panel.
541
698
  * @ko 사용자의 입력을 인식하기 위한 최소한의 거리 (단위: px). 주어진 값 이상으로 스크롤해야만 패널이 움직입니다.
@@ -543,7 +700,10 @@ class Flicking extends Component<FlickingEvents> {
543
700
  * @default 1
544
701
  * @see {@link https://naver.github.io/egjs-flicking/Options#dragThreshold dragThreshold ( Options )}
545
702
  */
546
- public get dragThreshold() { return this._dragThreshold; }
703
+ public get dragThreshold() {
704
+ return this._dragThreshold;
705
+ }
706
+
547
707
  /**
548
708
  * Set animation to be interruptable by click/touch.
549
709
  * @ko 사용자의 클릭/터치로 인해 애니메이션을 도중에 멈출 수 있도록 설정합니다.
@@ -551,7 +711,10 @@ class Flicking extends Component<FlickingEvents> {
551
711
  * @default true
552
712
  * @see {@link https://naver.github.io/egjs-flicking/Options#interruptable Interruptable ( Options )}
553
713
  */
554
- public get interruptable() { return this._interruptable; }
714
+ public get interruptable() {
715
+ return this._interruptable;
716
+ }
717
+
555
718
  /**
556
719
  * The size value of the bounce area. Only can be enabled when `circular=false`.
557
720
  * You can set different bounce value for prev/next direction by using array.
@@ -584,7 +747,10 @@ class Flicking extends Component<FlickingEvents> {
584
747
  * flicking.control.updateInput(); // Call this to update!
585
748
  * ```
586
749
  */
587
- public get bounce() { return this._bounce; }
750
+ public get bounce() {
751
+ return this._bounce;
752
+ }
753
+
588
754
  /**
589
755
  * Size of the area from the right edge in iOS safari (in px) which enables swipe-back or swipe-forward
590
756
  * @ko iOS Safari에서 swipe를 통한 뒤로가기/앞으로가기를 활성화하는 오른쪽 끝으로부터의 영역의 크기 (px)
@@ -592,7 +758,10 @@ class Flicking extends Component<FlickingEvents> {
592
758
  * @default 30
593
759
  * @see {@link https://naver.github.io/egjs-flicking/Options#iosedgeswipethreshold iOSEdgeSwipeThreshold ( Options )}
594
760
  */
595
- public get iOSEdgeSwipeThreshold() { return this._iOSEdgeSwipeThreshold; }
761
+ public get iOSEdgeSwipeThreshold() {
762
+ return this._iOSEdgeSwipeThreshold;
763
+ }
764
+
596
765
  /**
597
766
  * Automatically prevent `click` event if the user has dragged at least a single pixel on the viewport element
598
767
  * @ko 사용자가 뷰포트 영역을 1픽셀이라도 드래그했을 경우 자동으로 {@link https://developer.mozilla.org/ko/docs/Web/API/Element/click_event click} 이벤트를 취소합니다
@@ -600,7 +769,10 @@ class Flicking extends Component<FlickingEvents> {
600
769
  * @default true
601
770
  * @see {@link https://naver.github.io/egjs-flicking/Options#preventclickondrag preventClickOnDrag ( Options )}
602
771
  */
603
- public get preventClickOnDrag() { return this._preventClickOnDrag; }
772
+ public get preventClickOnDrag() {
773
+ return this._preventClickOnDrag;
774
+ }
775
+
604
776
  /**
605
777
  * Whether to use the {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} when the user starts dragging
606
778
  * @ko 사용자가 드래그를 시작할 때 {@link https://developer.mozilla.org/ko/docs/Web/API/Event/preventDefault preventDefault} 실행 여부
@@ -608,7 +780,10 @@ class Flicking extends Component<FlickingEvents> {
608
780
  * @default false
609
781
  * @see {@link https://naver.github.io/egjs-flicking/Options#preventDefaultOnDrag preventDefaultOnDrag ( Options )}
610
782
  */
611
- public get preventDefaultOnDrag() { return this._preventDefaultOnDrag; }
783
+ public get preventDefaultOnDrag() {
784
+ return this._preventDefaultOnDrag;
785
+ }
786
+
612
787
  /**
613
788
  * Automatically call {@link Flicking#disableInput disableInput()} on initialization
614
789
  * @ko Flicking init시에 {@link Flicking#disableInput disableInput()}을 바로 호출합니다
@@ -616,7 +791,10 @@ class Flicking extends Component<FlickingEvents> {
616
791
  * @default false
617
792
  * @see {@link https://naver.github.io/egjs-flicking/Options#disableoninit disableOnInit ( Options )}
618
793
  */
619
- public get disableOnInit() { return this._disableOnInit; }
794
+ public get disableOnInit() {
795
+ return this._disableOnInit;
796
+ }
797
+
620
798
  /**
621
799
  * Change active panel index on mouse/touch hold while animating.
622
800
  * `index` of the `willChange`/`willRestore` event will be used as new index.
@@ -626,7 +804,10 @@ class Flicking extends Component<FlickingEvents> {
626
804
  * @default false
627
805
  * @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
628
806
  */
629
- public get changeOnHold() { return this._changeOnHold; }
807
+ public get changeOnHold() {
808
+ return this._changeOnHold;
809
+ }
810
+
630
811
  // PERFORMANCE
631
812
  /**
632
813
  * Whether to render visible panels only. This can dramatically increase performance when there're many panels
@@ -635,7 +816,10 @@ class Flicking extends Component<FlickingEvents> {
635
816
  * @default false
636
817
  * @see {@link https://naver.github.io/egjs-flicking/Options#renderonlyvisible renderOnlyVisible ( Options )}
637
818
  */
638
- public get renderOnlyVisible() { return this._renderOnlyVisible; }
819
+ public get renderOnlyVisible() {
820
+ return this._renderOnlyVisible;
821
+ }
822
+
639
823
  /**
640
824
  * By enabling this option, it will reduce memory consumption by restricting the number of DOM elements to `panelsPerView + 1`
641
825
  * Must be used with `panelsPerview`.
@@ -668,7 +852,9 @@ class Flicking extends Component<FlickingEvents> {
668
852
  * flicking.virtual.remove(0, 100);
669
853
  * ```
670
854
  */
671
- public get virtual() { return this._virtualManager; }
855
+ public get virtual() {
856
+ return this._virtualManager;
857
+ }
672
858
 
673
859
  // OTHERS
674
860
  /**
@@ -679,14 +865,20 @@ class Flicking extends Component<FlickingEvents> {
679
865
  * @see {@link https://naver.github.io/egjs-flicking/Options#autoinit autoInit ( Options )}
680
866
  * @readonly
681
867
  */
682
- public get autoInit() { return this._autoInit; }
868
+ public get autoInit() {
869
+ return this._autoInit;
870
+ }
871
+
683
872
  /**
684
873
  * Whether to automatically call {@link Flicking#resize resize()} when the viewport element(.flicking-viewport)'s size is changed
685
874
  * @ko 뷰포트 엘리먼트(.flicking-viewport)의 크기 변경시 {@link Flicking#resize resize()} 메소드를 자동으로 호출할지 여부를 설정합니다
686
875
  * @type {boolean}
687
876
  * @default true
688
877
  */
689
- public get autoResize() { return this._autoResize; }
878
+ public get autoResize() {
879
+ return this._autoResize;
880
+ }
881
+
690
882
  /**
691
883
  * 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
692
884
  * @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} 이벤트 대신 수신할지 여부를 설정합니다
@@ -695,6 +887,15 @@ class Flicking extends Component<FlickingEvents> {
695
887
  * @see {@link https://naver.github.io/egjs-flicking/Options#useresizeobserver useResizeObserver ( Options )}
696
888
  */
697
889
  public get useResizeObserver() { return this._useResizeObserver; }
890
+ /**
891
+ * Whether to use {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver} to observe the size of the panel element
892
+ * This is only available when `useResizeObserver` is enabled.
893
+ * This option garantees that the resize event is triggered when the size of the panel element is changed.
894
+ * @ko 이 옵션을 활성화할 경우, {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}를 사용하여 패널 엘리먼트의 크기를 추적합니다.
895
+ * 이 옵션은 `useResizeObserver` 옵션이 활성화된 경우에만 사용할 수 있습니다.
896
+ * 이 옵션은 패널 엘리먼트의 크기가 변경될 경우 resize 이벤트가 발생하도록 보장합니다.
897
+ */
898
+ public get observePanelResize() { return this._observePanelResize; }
698
899
  /**
699
900
  * Delays size recalculation from `autoResize` by the given time in milisecond.
700
901
  * If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
@@ -706,7 +907,10 @@ class Flicking extends Component<FlickingEvents> {
706
907
  * @default 0
707
908
  * @see {@link https://naver.github.io/egjs-flicking/Options#resizedebounce resizeDebounce ( Options )}
708
909
  */
709
- public get resizeDebounce() { return this._resizeDebounce; }
910
+ public get resizeDebounce() {
911
+ return this._resizeDebounce;
912
+ }
913
+
710
914
  /**
711
915
  * The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
712
916
  * This guarantees that size recalculation is performed at least once every (n)ms.
@@ -716,7 +920,10 @@ class Flicking extends Component<FlickingEvents> {
716
920
  * @default 100
717
921
  * @see {@link https://naver.github.io/egjs-flicking/Options#maxresizedebounce maxResizeDebounce ( Options )}
718
922
  */
719
- public get maxResizeDebounce() { return this._maxResizeDebounce; }
923
+ public get maxResizeDebounce() {
924
+ return this._maxResizeDebounce;
925
+ }
926
+
720
927
  /**
721
928
  * By enabling this, Flicking will calculate all internal size with CSS width computed with getComputedStyle.
722
929
  * This can prevent 1px offset issue in some cases where panel size has the fractional part.
@@ -728,7 +935,10 @@ class Flicking extends Component<FlickingEvents> {
728
935
  * @default false
729
936
  * @see {@link https://naver.github.io/egjs-flicking/Options#usefractionalsize useFractionalSize ( Options )}
730
937
  */
731
- public get useFractionalSize() { return this._useFractionalSize; }
938
+ public get useFractionalSize() {
939
+ return this._useFractionalSize;
940
+ }
941
+
732
942
  /**
733
943
  * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
734
944
  * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
@@ -736,7 +946,10 @@ class Flicking extends Component<FlickingEvents> {
736
946
  * @internal
737
947
  * @readonly
738
948
  */
739
- public get externalRenderer() { return this._externalRenderer; }
949
+ public get externalRenderer() {
950
+ return this._externalRenderer;
951
+ }
952
+
740
953
  /**
741
954
  * This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
742
955
  * @ko 프레임워크(React, Vue, Angular, ...)에서만 사용하는 옵션으로, 자동으로 설정되므로 따로 사용하실 필요 없습니다!
@@ -745,7 +958,27 @@ class Flicking extends Component<FlickingEvents> {
745
958
  * @readonly
746
959
  * @deprecated
747
960
  */
748
- public get renderExternal() { return this._renderExternal; }
961
+ public get renderExternal() {
962
+ return this._renderExternal;
963
+ }
964
+
965
+ /**
966
+ * This option works only when autoResize is set to true.
967
+ * By default, autoResize listens to changes in both the viewport's width and height, updating all panel sizes accordingly.
968
+ * When optimizeSizeUpdate is enabled, the update behavior is optimized based on the flicking direction:
969
+ * If direction is "horizontal", only changes in width will trigger panel size updates.
970
+ * If direction is "vertical", only changes in height will do so.
971
+ * 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.
972
+ * @ko optimizeSizeUpdate는 autoResize가 true일 때만 동작합니다.
973
+ * 기본적으로 autoResize는 뷰포트의 width와 height 변화를 모두 감지하여 패널들의 사이즈를 업데이트합니다.
974
+ * 이 옵션을 활성화하면 플리킹 방향에 따라 필요한 차원(horizontal → width, vertical → height)에 대해서만 사이즈를 업데이트합니다.
975
+ * 내부 패널의 높이가 서로 다를 때, 플리킹 중 과도한 리사이징으로 인한 깜빡임 현상을 줄이는 데 유용합니다.
976
+ * @type {boolean}
977
+ * @default false
978
+ */
979
+ public get optimizeSizeUpdate() {
980
+ return this._optimizeSizeUpdate;
981
+ }
749
982
 
750
983
  // Options Setter
751
984
  // UI / LAYOUT
@@ -756,7 +989,10 @@ class Flicking extends Component<FlickingEvents> {
756
989
  void this.resize();
757
990
  }
758
991
 
759
- public set defaultIndex(val: FlickingOptions["defaultIndex"]) { this._defaultIndex = val; }
992
+ public set defaultIndex(val: FlickingOptions["defaultIndex"]) {
993
+ this._defaultIndex = val;
994
+ }
995
+
760
996
  public set horizontal(val: FlickingOptions["horizontal"]) {
761
997
  this._horizontal = val;
762
998
  this._control.controller.updateDirection();
@@ -783,12 +1019,16 @@ class Flicking extends Component<FlickingEvents> {
783
1019
  void this.resize();
784
1020
  }
785
1021
 
786
- public set noPanelStyleOverride(val: FlickingOptions["noPanelStyleOverride"]) {
1022
+ public set noPanelStyleOverride(
1023
+ val: FlickingOptions["noPanelStyleOverride"]
1024
+ ) {
787
1025
  this._noPanelStyleOverride = val;
788
1026
  void this.resize();
789
1027
  }
790
1028
 
791
- public set resizeOnContentsReady(val: FlickingOptions["resizeOnContentsReady"]) {
1029
+ public set resizeOnContentsReady(
1030
+ val: FlickingOptions["resizeOnContentsReady"]
1031
+ ) {
792
1032
  this._resizeOnContentsReady = val;
793
1033
  if (val) {
794
1034
  this._renderer.checkPanelContentsReady(this._renderer.panels);
@@ -805,8 +1045,16 @@ class Flicking extends Component<FlickingEvents> {
805
1045
  }
806
1046
 
807
1047
  // EVENTS
808
- public set needPanelThreshold(val: FlickingOptions["needPanelThreshold"]) { this._needPanelThreshold = val; }
809
- public set preventEventsBeforeInit(val: FlickingOptions["preventEventsBeforeInit"]) { this._preventEventsBeforeInit = val; }
1048
+ public set needPanelThreshold(val: FlickingOptions["needPanelThreshold"]) {
1049
+ this._needPanelThreshold = val;
1050
+ }
1051
+
1052
+ public set preventEventsBeforeInit(
1053
+ val: FlickingOptions["preventEventsBeforeInit"]
1054
+ ) {
1055
+ this._preventEventsBeforeInit = val;
1056
+ }
1057
+
810
1058
  // ANIMATION
811
1059
  public set deceleration(val: FlickingOptions["deceleration"]) {
812
1060
  this._deceleration = val;
@@ -826,7 +1074,10 @@ class Flicking extends Component<FlickingEvents> {
826
1074
  }
827
1075
  }
828
1076
 
829
- public set duration(val: FlickingOptions["duration"]) { this._duration = val; }
1077
+ public set duration(val: FlickingOptions["duration"]) {
1078
+ this._duration = val;
1079
+ }
1080
+
830
1081
  // INPUT
831
1082
  public set inputType(val: FlickingOptions["inputType"]) {
832
1083
  this._inputType = val;
@@ -854,7 +1105,9 @@ class Flicking extends Component<FlickingEvents> {
854
1105
  this._control.updateInput();
855
1106
  }
856
1107
 
857
- public set threshold(val: FlickingOptions["threshold"]) { this._threshold = val; }
1108
+ public set threshold(val: FlickingOptions["threshold"]) {
1109
+ this._threshold = val;
1110
+ }
858
1111
 
859
1112
  public set dragThreshold(val: FlickingOptions["dragThreshold"]) {
860
1113
  this._dragThreshold = val;
@@ -880,7 +1133,9 @@ class Flicking extends Component<FlickingEvents> {
880
1133
  this._control.updateInput();
881
1134
  }
882
1135
 
883
- public set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]) {
1136
+ public set iOSEdgeSwipeThreshold(
1137
+ val: FlickingOptions["iOSEdgeSwipeThreshold"]
1138
+ ) {
884
1139
  this._iOSEdgeSwipeThreshold = val;
885
1140
  const panInput = this._control.controller.panInput;
886
1141
 
@@ -905,7 +1160,9 @@ class Flicking extends Component<FlickingEvents> {
905
1160
  this._preventClickOnDrag = val;
906
1161
  }
907
1162
 
908
- public set preventDefaultOnDrag(val: FlickingOptions["preventDefaultOnDrag"]) {
1163
+ public set preventDefaultOnDrag(
1164
+ val: FlickingOptions["preventDefaultOnDrag"]
1165
+ ) {
909
1166
  this._preventDefaultOnDrag = val;
910
1167
  const panInput = this._control.controller.panInput;
911
1168
 
@@ -914,8 +1171,14 @@ class Flicking extends Component<FlickingEvents> {
914
1171
  }
915
1172
  }
916
1173
 
917
- public set disableOnInit(val: FlickingOptions["disableOnInit"]) { this._disableOnInit = val; }
918
- public set changeOnHold(val: FlickingOptions["changeOnHold"]) { this._changeOnHold = val; }
1174
+ public set disableOnInit(val: FlickingOptions["disableOnInit"]) {
1175
+ this._disableOnInit = val;
1176
+ }
1177
+
1178
+ public set changeOnHold(val: FlickingOptions["changeOnHold"]) {
1179
+ this._changeOnHold = val;
1180
+ }
1181
+
919
1182
  // PERFORMANCE
920
1183
  public set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]) {
921
1184
  this._renderOnlyVisible = val;
@@ -926,6 +1189,10 @@ class Flicking extends Component<FlickingEvents> {
926
1189
  public set autoResize(val: FlickingOptions["autoResize"]) {
927
1190
  this._autoResize = val;
928
1191
 
1192
+ if (!this._initialized) {
1193
+ return;
1194
+ }
1195
+
929
1196
  if (val) {
930
1197
  this._autoResizer.enable();
931
1198
  } else {
@@ -936,11 +1203,27 @@ class Flicking extends Component<FlickingEvents> {
936
1203
  public set useResizeObserver(val: FlickingOptions["useResizeObserver"]) {
937
1204
  this._useResizeObserver = val;
938
1205
 
939
- if (this._autoResize) {
1206
+ if (this._initialized && this._autoResize) {
940
1207
  this._autoResizer.enable();
941
1208
  }
942
1209
  }
943
1210
 
1211
+ public set observePanelResize(val: FlickingOptions["observePanelResize"]) {
1212
+ this._observePanelResize = val;
1213
+
1214
+ if (this._initialized && this._autoResize) {
1215
+ if (val) {
1216
+ this._autoResizer.observePanels();
1217
+ } else {
1218
+ this._autoResizer.unobservePanels();
1219
+ }
1220
+ }
1221
+ }
1222
+
1223
+ public set optimizeSizeUpdate(val: FlickingOptions["optimizeSizeUpdate"]) {
1224
+ this._optimizeSizeUpdate = val;
1225
+ }
1226
+
944
1227
  /**
945
1228
  * @param root A root HTMLElement to initialize Flicking on it. When it's a typeof `string`, it should be a css selector string
946
1229
  * <ko>Flicking을 초기화할 HTMLElement로, `string` 타입으로 지정시 css 선택자 문자열을 지정해야 합니다.</ko>
@@ -1003,16 +1286,19 @@ class Flicking extends Component<FlickingEvents> {
1003
1286
  autoResize = true,
1004
1287
  useResizeObserver = true,
1005
1288
  resizeDebounce = 0,
1289
+ observePanelResize = false,
1006
1290
  maxResizeDebounce = 100,
1007
1291
  useFractionalSize = false,
1008
1292
  externalRenderer = null,
1009
- renderExternal = null
1293
+ renderExternal = null,
1294
+ optimizeSizeUpdate = false
1010
1295
  }: Partial<FlickingOptions> = {}) {
1011
1296
  super();
1012
1297
 
1013
1298
  // Internal states
1014
1299
  this._initialized = false;
1015
1300
  this._plugins = [];
1301
+ this._isResizing = false;
1016
1302
 
1017
1303
  // Bind options
1018
1304
  this._align = align;
@@ -1049,9 +1335,11 @@ class Flicking extends Component<FlickingEvents> {
1049
1335
  this._useResizeObserver = useResizeObserver;
1050
1336
  this._resizeDebounce = resizeDebounce;
1051
1337
  this._maxResizeDebounce = maxResizeDebounce;
1338
+ this._observePanelResize = observePanelResize;
1052
1339
  this._useFractionalSize = useFractionalSize;
1053
1340
  this._externalRenderer = externalRenderer;
1054
1341
  this._renderExternal = renderExternal;
1342
+ this._optimizeSizeUpdate = optimizeSizeUpdate;
1055
1343
 
1056
1344
  // Create core components
1057
1345
  this._viewport = new Viewport(this, getElement(root));
@@ -1111,7 +1399,7 @@ class Flicking extends Component<FlickingEvents> {
1111
1399
 
1112
1400
  return renderer.render().then(() => {
1113
1401
  // Done initializing & emit ready event
1114
- this._plugins.forEach(plugin => plugin.init(this));
1402
+ this._plugins.forEach((plugin) => plugin.init(this));
1115
1403
 
1116
1404
  if (preventEventsBeforeInit) {
1117
1405
  this.trigger = originalTrigger;
@@ -1133,7 +1421,7 @@ class Flicking extends Component<FlickingEvents> {
1133
1421
  this._camera.destroy();
1134
1422
  this._renderer.destroy();
1135
1423
 
1136
- this._plugins.forEach(plugin => plugin.destroy());
1424
+ this._plugins.forEach((plugin) => plugin.destroy());
1137
1425
 
1138
1426
  this._initialized = false;
1139
1427
  }
@@ -1172,7 +1460,11 @@ class Flicking extends Component<FlickingEvents> {
1172
1460
  * @return {Promise<void>} A Promise which will be resolved after reaching the previous panel<ko>이전 패널 도달시에 resolve되는 Promise</ko>
1173
1461
  */
1174
1462
  public prev(duration: number = this._duration): Promise<void> {
1175
- return this.moveTo(this._control.activePanel?.prev()?.index ?? -1, duration, DIRECTION.PREV);
1463
+ return this.moveTo(
1464
+ this._control.activePanel?.prev()?.index ?? -1,
1465
+ duration,
1466
+ DIRECTION.PREV
1467
+ );
1176
1468
  }
1177
1469
 
1178
1470
  /**
@@ -1210,7 +1502,11 @@ class Flicking extends Component<FlickingEvents> {
1210
1502
  * @return {Promise<void>} A Promise which will be resolved after reaching the next panel<ko>다음 패널 도달시에 resolve되는 Promise</ko>
1211
1503
  */
1212
1504
  public next(duration: number = this._duration) {
1213
- return this.moveTo(this._control.activePanel?.next()?.index ?? this._renderer.panelCount, duration, DIRECTION.NEXT);
1505
+ return this.moveTo(
1506
+ this._control.activePanel?.next()?.index ?? this._renderer.panelCount,
1507
+ duration,
1508
+ DIRECTION.NEXT
1509
+ );
1214
1510
  }
1215
1511
 
1216
1512
  /**
@@ -1249,18 +1545,32 @@ class Flicking extends Component<FlickingEvents> {
1249
1545
  * </ko>
1250
1546
  * @return {Promise<void>} A Promise which will be resolved after reaching the target panel<ko>해당 패널 도달시에 resolve되는 Promise</ko>
1251
1547
  */
1252
- public moveTo(index: number, duration: number = this._duration, direction: ValueOf<typeof DIRECTION> = DIRECTION.NONE) {
1548
+ public moveTo(
1549
+ index: number,
1550
+ duration: number = this._duration,
1551
+ direction: ValueOf<typeof DIRECTION> = DIRECTION.NONE
1552
+ ) {
1253
1553
  const renderer = this._renderer;
1254
1554
  const panelCount = renderer.panelCount;
1255
1555
 
1256
1556
  const panel = renderer.getPanel(index);
1257
1557
 
1258
1558
  if (!panel) {
1259
- return Promise.reject(new FlickingError(ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1), ERROR.CODE.INDEX_OUT_OF_RANGE));
1559
+ return Promise.reject(
1560
+ new FlickingError(
1561
+ ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1),
1562
+ ERROR.CODE.INDEX_OUT_OF_RANGE
1563
+ )
1564
+ );
1260
1565
  }
1261
1566
 
1262
1567
  if (this._control.animating) {
1263
- return Promise.reject(new FlickingError(ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING, ERROR.CODE.ANIMATION_ALREADY_PLAYING));
1568
+ return Promise.reject(
1569
+ new FlickingError(
1570
+ ERROR.MESSAGE.ANIMATION_ALREADY_PLAYING,
1571
+ ERROR.CODE.ANIMATION_ALREADY_PLAYING
1572
+ )
1573
+ );
1264
1574
  }
1265
1575
 
1266
1576
  if (this._control.holding) {
@@ -1284,7 +1594,11 @@ class Flicking extends Component<FlickingEvents> {
1284
1594
  * <ko>{@link ERROR_CODE INDEX_OUT_OF_RANGE} 해당 인덱스를 가진 패널이 존재하지 않을 경우</ko>
1285
1595
  * @return {void}
1286
1596
  */
1287
- public updateAnimation(index: number, duration?: number, direction?: ValueOf<typeof DIRECTION>): void {
1597
+ public updateAnimation(
1598
+ index: number,
1599
+ duration?: number,
1600
+ direction?: ValueOf<typeof DIRECTION>
1601
+ ): void {
1288
1602
  if (!this._control.animating) {
1289
1603
  return;
1290
1604
  }
@@ -1295,7 +1609,10 @@ class Flicking extends Component<FlickingEvents> {
1295
1609
  const panel = renderer.getPanel(index);
1296
1610
 
1297
1611
  if (!panel) {
1298
- throw new FlickingError(ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1), ERROR.CODE.INDEX_OUT_OF_RANGE);
1612
+ throw new FlickingError(
1613
+ ERROR.MESSAGE.INDEX_OUT_OF_RANGE(index, 0, panelCount - 1),
1614
+ ERROR.CODE.INDEX_OUT_OF_RANGE
1615
+ );
1299
1616
  }
1300
1617
 
1301
1618
  this._control.updateAnimation(panel, duration, direction);
@@ -1377,7 +1694,7 @@ class Flicking extends Component<FlickingEvents> {
1377
1694
  const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
1378
1695
 
1379
1696
  const status: Status = {
1380
- panels: panels.map(panel => {
1697
+ panels: panels.map((panel) => {
1381
1698
  const panelInfo: Status["panels"][0] = { index: panel.index };
1382
1699
 
1383
1700
  if (includePanelHTML) {
@@ -1400,7 +1717,6 @@ class Flicking extends Component<FlickingEvents> {
1400
1717
  progressInPanel: camera.getProgressInPanel(nearestAnchor.panel)
1401
1718
  };
1402
1719
  }
1403
-
1404
1720
  }
1405
1721
 
1406
1722
  if (visiblePanelsOnly) {
@@ -1420,40 +1736,43 @@ class Flicking extends Component<FlickingEvents> {
1420
1736
  */
1421
1737
  public setStatus(status: Status): void {
1422
1738
  if (!this._initialized) {
1423
- throw new FlickingError(ERROR.MESSAGE.NOT_INITIALIZED, ERROR.CODE.NOT_INITIALIZED);
1739
+ throw new FlickingError(
1740
+ ERROR.MESSAGE.NOT_INITIALIZED,
1741
+ ERROR.CODE.NOT_INITIALIZED
1742
+ );
1424
1743
  }
1425
1744
 
1426
- const {
1427
- index,
1428
- position,
1429
- visibleOffset,
1430
- panels
1431
- } = status;
1745
+ const { index, position, visibleOffset, panels } = status;
1432
1746
 
1433
1747
  const renderer = this._renderer;
1434
1748
  const control = this._control;
1435
1749
 
1436
1750
  // Can't add/remove panels on external rendering
1437
1751
  if (panels[0]?.html && !this._renderExternal) {
1438
- renderer.batchRemove({ index: 0, deleteCount: this.panels.length, hasDOMInElements: true });
1439
- renderer.batchInsert({ index: 0, elements: parseElement(panels.map(panel => panel.html!)), hasDOMInElements: true });
1752
+ renderer.batchRemove({
1753
+ index: 0,
1754
+ deleteCount: this.panels.length,
1755
+ hasDOMInElements: true
1756
+ });
1757
+ renderer.batchInsert({
1758
+ index: 0,
1759
+ elements: parseElement(panels.map((panel) => panel.html!)),
1760
+ hasDOMInElements: true
1761
+ });
1440
1762
  }
1441
1763
 
1442
1764
  if (index != null) {
1443
- const panelIndex = visibleOffset
1444
- ? index - visibleOffset
1445
- : index;
1765
+ const panelIndex = visibleOffset ? index - visibleOffset : index;
1446
1766
 
1447
1767
  void this.moveTo(panelIndex, 0).catch(() => void 0);
1448
1768
  }
1449
1769
 
1450
1770
  if (position && this._moveType === MOVE_TYPE.FREE_SCROLL) {
1451
1771
  const { panel, progressInPanel } = position;
1452
- const panelIndex = visibleOffset
1453
- ? panel - visibleOffset
1454
- : panel;
1772
+ const panelIndex = visibleOffset ? panel - visibleOffset : panel;
1455
1773
  const panelRange = renderer.panels[panelIndex].range;
1456
- const newCameraPos = panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
1774
+ const newCameraPos =
1775
+ panelRange.min + (panelRange.max - panelRange.min) * progressInPanel;
1457
1776
 
1458
1777
  void control.moveToPosition(newCameraPos, 0).catch(() => void 0);
1459
1778
  }
@@ -1468,7 +1787,7 @@ class Flicking extends Component<FlickingEvents> {
1468
1787
  */
1469
1788
  public addPlugins(...plugins: Plugin[]) {
1470
1789
  if (this._initialized) {
1471
- plugins.forEach(item => item.init(this));
1790
+ plugins.forEach((item) => item.init(this));
1472
1791
  }
1473
1792
 
1474
1793
  this._plugins.push(...plugins);
@@ -1484,8 +1803,8 @@ class Flicking extends Component<FlickingEvents> {
1484
1803
  * @see https://github.com/naver/egjs-flicking-plugins
1485
1804
  */
1486
1805
  public removePlugins(...plugins: Plugin[]) {
1487
- plugins.forEach(item => {
1488
- const foundIndex = findIndex(this._plugins, val => val === item);
1806
+ plugins.forEach((item) => {
1807
+ const foundIndex = findIndex(this._plugins, (val) => val === item);
1489
1808
 
1490
1809
  if (foundIndex >= 0) {
1491
1810
  item.destroy();
@@ -1505,6 +1824,10 @@ class Flicking extends Component<FlickingEvents> {
1505
1824
  * @return {this}
1506
1825
  */
1507
1826
  public async resize(): Promise<void> {
1827
+ if (this._isResizing) return;
1828
+
1829
+ this._isResizing = true;
1830
+
1508
1831
  const viewport = this._viewport;
1509
1832
  const renderer = this._renderer;
1510
1833
  const camera = this._camera;
@@ -1517,14 +1840,27 @@ class Flicking extends Component<FlickingEvents> {
1517
1840
  ? camera.getProgressInPanel(activePanel)
1518
1841
  : 0;
1519
1842
 
1520
- this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
1521
- width: prevWidth,
1522
- height: prevHeight,
1523
- element: viewport.element
1524
- }));
1843
+ this.trigger(
1844
+ new ComponentEvent(EVENTS.BEFORE_RESIZE, {
1845
+ width: prevWidth,
1846
+ height: prevHeight,
1847
+ element: viewport.element
1848
+ })
1849
+ );
1525
1850
 
1526
1851
  viewport.resize();
1527
- await renderer.forceRenderAllPanels(); // Render all panel elements, to update sizes
1852
+
1853
+ // 뷰포트 사이즈가 변경되었을 때 내부의 패널 사이즈들도 전부 업데이트 되어야 하므로 패널들을 전부 리렌더링한다.
1854
+ // optimizeSizeUpdate가 true일 경우에는 플리킹 방향에 대응되는 뷰포트 사이즈 요소가 변경되었을 때만 패널들을 리렌더링한다.
1855
+ // 자세한 사항은 optimizeSizeUpdate 옵션의 설명을 참고.
1856
+ if (this._optimizeSizeUpdate) {
1857
+ if ((this.horizontal && viewport.width !== prevWidth) || (!this.horizontal && viewport.height !== prevHeight)) {
1858
+ await renderer.forceRenderAllPanels();
1859
+ }
1860
+ } else {
1861
+ await renderer.forceRenderAllPanels(); // Render all panel elements, to update sizes
1862
+ }
1863
+
1528
1864
  if (!this._initialized) {
1529
1865
  return;
1530
1866
  }
@@ -1551,16 +1887,20 @@ class Flicking extends Component<FlickingEvents> {
1551
1887
  const newHeight = viewport.height;
1552
1888
  const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
1553
1889
 
1554
- this.trigger(new ComponentEvent(EVENTS.AFTER_RESIZE, {
1555
- width: viewport.width,
1556
- height: viewport.height,
1557
- prev: {
1558
- width: prevWidth,
1559
- height: prevHeight
1560
- },
1561
- sizeChanged,
1562
- element: viewport.element
1563
- }));
1890
+ this.trigger(
1891
+ new ComponentEvent(EVENTS.AFTER_RESIZE, {
1892
+ width: viewport.width,
1893
+ height: viewport.height,
1894
+ prev: {
1895
+ width: prevWidth,
1896
+ height: prevHeight
1897
+ },
1898
+ sizeChanged,
1899
+ element: viewport.element
1900
+ })
1901
+ );
1902
+
1903
+ this._isResizing = false;
1564
1904
  }
1565
1905
 
1566
1906
  /**
@@ -1634,10 +1974,17 @@ class Flicking extends Component<FlickingEvents> {
1634
1974
  */
1635
1975
  public insert(index: number, element: ElementLike | ElementLike[]): Panel[] {
1636
1976
  if (this._renderExternal) {
1637
- throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
1977
+ throw new FlickingError(
1978
+ ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
1979
+ ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
1980
+ );
1638
1981
  }
1639
1982
 
1640
- return this._renderer.batchInsert({ index, elements: parseElement(element), hasDOMInElements: true });
1983
+ return this._renderer.batchInsert({
1984
+ index,
1985
+ elements: parseElement(element),
1986
+ hasDOMInElements: true
1987
+ });
1641
1988
  }
1642
1989
 
1643
1990
  /**
@@ -1651,26 +1998,34 @@ class Flicking extends Component<FlickingEvents> {
1651
1998
  */
1652
1999
  public remove(index: number, deleteCount: number = 1): Panel[] {
1653
2000
  if (this._renderExternal) {
1654
- throw new FlickingError(ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK, ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK);
2001
+ throw new FlickingError(
2002
+ ERROR.MESSAGE.NOT_ALLOWED_IN_FRAMEWORK,
2003
+ ERROR.CODE.NOT_ALLOWED_IN_FRAMEWORK
2004
+ );
1655
2005
  }
1656
2006
 
1657
- return this._renderer.batchRemove({ index, deleteCount, hasDOMInElements: true });
2007
+ return this._renderer.batchRemove({
2008
+ index,
2009
+ deleteCount,
2010
+ hasDOMInElements: true
2011
+ });
1658
2012
  }
1659
2013
 
1660
2014
  private _createControl(): Control {
1661
2015
  const moveType = this._moveType;
1662
- const moveTypes = Object.keys(MOVE_TYPE).map(key => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>);
2016
+ const moveTypes = Object.keys(MOVE_TYPE).map(
2017
+ (key) => MOVE_TYPE[key] as ValueOf<typeof MOVE_TYPE>
2018
+ );
1663
2019
 
1664
- const moveTypeStr = Array.isArray(moveType)
1665
- ? moveType[0]
1666
- : moveType;
2020
+ const moveTypeStr = Array.isArray(moveType) ? moveType[0] : moveType;
1667
2021
 
1668
- const moveTypeOptions = Array.isArray(moveType)
1669
- ? moveType[1] ?? {}
1670
- : {};
2022
+ const moveTypeOptions = Array.isArray(moveType) ? moveType[1] ?? {} : {};
1671
2023
 
1672
2024
  if (!includes(moveTypes, moveTypeStr)) {
1673
- throw new FlickingError(ERROR.MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)), ERROR.CODE.WRONG_OPTION);
2025
+ throw new FlickingError(
2026
+ ERROR.MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)),
2027
+ ERROR.CODE.WRONG_OPTION
2028
+ );
1674
2029
  }
1675
2030
 
1676
2031
  switch (moveTypeStr) {
@@ -1686,7 +2041,9 @@ class Flicking extends Component<FlickingEvents> {
1686
2041
  private _createCamera(): Camera {
1687
2042
  if (this._circular && this._bound) {
1688
2043
  // eslint-disable-next-line no-console
1689
- console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
2044
+ console.warn(
2045
+ "\"circular\" and \"bound\" option cannot be used together, ignoring bound."
2046
+ );
1690
2047
  }
1691
2048
 
1692
2049
  return new Camera(this, {
@@ -1698,7 +2055,9 @@ class Flicking extends Component<FlickingEvents> {
1698
2055
  const externalRenderer = this._externalRenderer;
1699
2056
  if (this._virtual && this._panelsPerView <= 0) {
1700
2057
  // eslint-disable-next-line no-console
1701
- console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
2058
+ console.warn(
2059
+ "\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual."
2060
+ );
1702
2061
  }
1703
2062
 
1704
2063
  return externalRenderer
@@ -1709,12 +2068,9 @@ class Flicking extends Component<FlickingEvents> {
1709
2068
  }
1710
2069
 
1711
2070
  private _createExternalRenderer(): ExternalRenderer {
1712
- const {
1713
- renderer,
1714
- rendererOptions
1715
- } = this._renderExternal!;
2071
+ const { renderer, rendererOptions } = this._renderExternal!;
1716
2072
 
1717
- return new (renderer)({ align: this._align, ...rendererOptions });
2073
+ return new renderer({ align: this._align, ...rendererOptions });
1718
2074
  }
1719
2075
 
1720
2076
  private _createVanillaRenderer(): VanillaRenderer {
@@ -1734,16 +2090,25 @@ class Flicking extends Component<FlickingEvents> {
1734
2090
  const renderer = this._renderer;
1735
2091
  const control = this._control;
1736
2092
  const camera = this._camera;
1737
- const defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
2093
+ const defaultPanel =
2094
+ renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
1738
2095
 
1739
2096
  if (!defaultPanel) return;
1740
2097
 
1741
2098
  const nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
1742
- const initialPanel = (nearestAnchor && defaultPanel.position !== nearestAnchor.panel.position && defaultPanel.index !== nearestAnchor.panel.index) ? nearestAnchor.panel : defaultPanel;
2099
+ const initialPanel =
2100
+ nearestAnchor &&
2101
+ defaultPanel.position !== nearestAnchor.panel.position &&
2102
+ defaultPanel.index !== nearestAnchor.panel.index
2103
+ ? nearestAnchor.panel
2104
+ : defaultPanel;
1743
2105
  control.setActive(initialPanel, null, false);
1744
2106
 
1745
2107
  if (!nearestAnchor) {
1746
- throw new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), ERROR.CODE.POSITION_NOT_REACHABLE);
2108
+ throw new FlickingError(
2109
+ ERROR.MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position),
2110
+ ERROR.CODE.POSITION_NOT_REACHABLE
2111
+ );
1747
2112
  }
1748
2113
 
1749
2114
  let position = initialPanel.position;
@@ -1763,11 +2128,13 @@ class Flicking extends Component<FlickingEvents> {
1763
2128
  const camera = this._camera;
1764
2129
  const control = this._control;
1765
2130
 
1766
- this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
1767
- width: 0,
1768
- height: 0,
1769
- element: viewport.element
1770
- }));
2131
+ this.trigger(
2132
+ new ComponentEvent(EVENTS.BEFORE_RESIZE, {
2133
+ width: 0,
2134
+ height: 0,
2135
+ element: viewport.element
2136
+ })
2137
+ );
1771
2138
 
1772
2139
  viewport.resize();
1773
2140
  renderer.updatePanelSize();
@@ -1781,16 +2148,18 @@ class Flicking extends Component<FlickingEvents> {
1781
2148
  const newHeight = viewport.height;
1782
2149
  const sizeChanged = newWidth !== 0 || newHeight !== 0;
1783
2150
 
1784
- this.trigger(new ComponentEvent(EVENTS.AFTER_RESIZE, {
1785
- width: viewport.width,
1786
- height: viewport.height,
1787
- prev: {
1788
- width: 0,
1789
- height: 0
1790
- },
1791
- sizeChanged,
1792
- element: viewport.element
1793
- }));
2151
+ this.trigger(
2152
+ new ComponentEvent(EVENTS.AFTER_RESIZE, {
2153
+ width: viewport.width,
2154
+ height: viewport.height,
2155
+ prev: {
2156
+ width: 0,
2157
+ height: 0
2158
+ },
2159
+ sizeChanged,
2160
+ element: viewport.element
2161
+ })
2162
+ );
1794
2163
  }
1795
2164
  }
1796
2165