@egjs/flicking 4.10.4 → 4.10.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egjs/flicking",
3
- "version": "4.10.4",
3
+ "version": "4.10.5",
4
4
  "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
5
  "main": "dist/flicking.js",
6
6
  "module": "dist/flicking.esm.js",
package/src/Flicking.ts CHANGED
@@ -324,6 +324,7 @@ class Flicking extends Component<FlickingEvents> {
324
324
  * @property {ALIGN | string | number} panel The align value for each {@link Panel}s<ko>개개의 {@link Panel}에 적용할 값</ko>
325
325
  * @property {ALIGN | string | number} camera The align value for {@link Camera}<ko>{@link Camera}에 적용할 값</ko>
326
326
  * @default "center"
327
+ * @see {@link https://naver.github.io/egjs-flicking/Options#align align ( Options )}
327
328
  * @example
328
329
  * ```ts
329
330
  * const possibleOptions = [
@@ -350,6 +351,7 @@ class Flicking extends Component<FlickingEvents> {
350
351
  * @ko Flicking의 {@link Flicking#init init()}이 호출될 때 이동할 디폴트 패널의 인덱스로, 0부터 시작하는 정수입니다
351
352
  * @type {number}
352
353
  * @default 0
354
+ * @see {@link https://naver.github.io/egjs-flicking/Options#defaultindex defaultIndex ( Options )}
353
355
  */
354
356
  public get defaultIndex() { return this._defaultIndex; }
355
357
  /**
@@ -357,6 +359,7 @@ class Flicking extends Component<FlickingEvents> {
357
359
  * @ko 패널 이동 방향 (true: 가로방향, false: 세로방향)
358
360
  * @type {boolean}
359
361
  * @default true
362
+ * @see {@link https://naver.github.io/egjs-flicking/Options#horizontal horizontal ( Options )}
360
363
  */
361
364
  public get horizontal() { return this._horizontal; }
362
365
  /**
@@ -364,6 +367,7 @@ class Flicking extends Component<FlickingEvents> {
364
367
  * @ko 순환 모드를 활성화합니다. 순환 모드에서는 양 끝의 패널이 서로 연결되어 끊김없는 스크롤이 가능합니다.
365
368
  * @type {boolean}
366
369
  * @default false
370
+ * @see {@link https://naver.github.io/egjs-flicking/Options#circular circular ( Options )}
367
371
  */
368
372
  public get circular() { return this._circular; }
369
373
  /**
@@ -376,6 +380,7 @@ class Flicking extends Component<FlickingEvents> {
376
380
  * @see CIRCULAR_FALLBACK
377
381
  * @type {string}
378
382
  * @default "linear"
383
+ * @see {@link https://naver.github.io/egjs-flicking/Options#circularfallback circularFallback ( Options )}
379
384
  */
380
385
  public get circularFallback() { return this._circularFallback; }
381
386
  /**
@@ -385,6 +390,7 @@ class Flicking extends Component<FlickingEvents> {
385
390
  * `circular=false`인 경우에만 사용할 수 있습니다
386
391
  * @type {boolean}
387
392
  * @default false
393
+ * @see {@link https://naver.github.io/egjs-flicking/Options#bound bound ( Options )}
388
394
  */
389
395
  public get bound() { return this._bound; }
390
396
  /**
@@ -392,6 +398,7 @@ class Flicking extends Component<FlickingEvents> {
392
398
  * @ko 이동한 후 뷰포트 엘리먼트의 크기를 현재 패널의 높이와 동일하게 설정합니다. `horizontal=true`인 경우에만 사용할 수 있습니다.
393
399
  * @type {boolean}
394
400
  * @default false
401
+ * @see {@link https://naver.github.io/egjs-flicking/Options#adaptive adaptive ( Options )}
395
402
  */
396
403
  public get adaptive() { return this._adaptive; }
397
404
  /**
@@ -399,6 +406,7 @@ class Flicking extends Component<FlickingEvents> {
399
406
  * @ko 한 화면에 보이는 패널의 개수. 이 옵션을 활성화할 경우 패널의 크기를 강제로 재조정합니다
400
407
  * @type {number}
401
408
  * @default -1
409
+ * @see {@link https://naver.github.io/egjs-flicking/Options#panelsperview panelsPerView ( Options )}
402
410
  */
403
411
  public get panelsPerView() { return this._panelsPerView; }
404
412
  /**
@@ -417,6 +425,7 @@ class Flicking extends Component<FlickingEvents> {
417
425
  * 이 동작은 Flicking 내부에 로드 전/후로 크기가 변하는 콘텐츠를 포함하고 있을 때 유용하게 사용하실 수 있습니다.
418
426
  * @type {boolean}
419
427
  * @default false
428
+ * @see {@link https://naver.github.io/egjs-flicking/Options#resizeOnContentsReady resizeOnContentsReady ( Options )}
420
429
  */
421
430
  public get resizeOnContentsReady() { return this._resizeOnContentsReady; }
422
431
  /**
@@ -426,6 +435,7 @@ class Flicking extends Component<FlickingEvents> {
426
435
  * 만약 상위 Flicking과 하위 Flicking이 서로 다른 horizontal 옵션을 가지고 있다면 이 옵션을 설정할 필요가 없습니다.
427
436
  * @type {boolean}
428
437
  * @default false
438
+ * @see {@link https://naver.github.io/egjs-flicking/Options#nested nested ( Options )}
429
439
  */
430
440
  public get nested() { return this._nested; }
431
441
  // EVENTS
@@ -434,6 +444,7 @@ class Flicking extends Component<FlickingEvents> {
434
444
  * @ko `needPanel`이벤트가 발생하기 위한 뷰포트 끝으로부터의 최대 거리
435
445
  * @type {number}
436
446
  * @default 0
447
+ * @see {@link https://naver.github.io/egjs-flicking/Options#needpanelthreshold needPanelThreshold ( Options )}
437
448
  */
438
449
  public get needPanelThreshold() { return this._needPanelThreshold; }
439
450
  /**
@@ -441,6 +452,7 @@ class Flicking extends Component<FlickingEvents> {
441
452
  * @ko 활성화할 경우 초기화시 `ready` 이벤트 이전의 이벤트가 발생하지 않습니다.
442
453
  * @type {boolean}
443
454
  * @default true
455
+ * @see {@link https://naver.github.io/egjs-flicking/Options#preventeventsbeforeinit preventEventsBeforeInit ( Options )}
444
456
  */
445
457
  public get preventEventsBeforeInit() { return this._preventEventsBeforeInit; }
446
458
  // ANIMATION
@@ -449,6 +461,7 @@ class Flicking extends Component<FlickingEvents> {
449
461
  * @ko 사용자의 동작으로 가속도가 적용된 패널 이동 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아집니다
450
462
  * @type {number}
451
463
  * @default 0.0075
464
+ * @see {@link https://naver.github.io/egjs-flicking/Options#deceleration deceleration ( Options )}
452
465
  */
453
466
  public get deceleration() { return this._deceleration; }
454
467
  /**
@@ -457,6 +470,7 @@ class Flicking extends Component<FlickingEvents> {
457
470
  * @type {function}
458
471
  * @default x => 1 - Math.pow(1 - x, 3)
459
472
  * @see Easing Functions Cheat Sheet {@link http://easings.net/} <ko>이징 함수 Cheat Sheet {@link http://easings.net/}</ko>
473
+ * @see {@link https://naver.github.io/egjs-flicking/Options#easing Easing ( Options )}
460
474
  */
461
475
  public get easing() { return this._easing; }
462
476
  /**
@@ -464,6 +478,7 @@ class Flicking extends Component<FlickingEvents> {
464
478
  * @ko 디폴트 애니메이션 재생 시간 (ms)
465
479
  * @type {number}
466
480
  * @default 500
481
+ * @see {@link https://naver.github.io/egjs-flicking/Options#duration duration ( Options )}
467
482
  */
468
483
  public get duration() { return this._duration; }
469
484
  // INPUT
@@ -472,8 +487,9 @@ class Flicking extends Component<FlickingEvents> {
472
487
  * @ko 활성화할 입력 장치 종류
473
488
  * @type {string[]}
474
489
  * @default ["touch", "mouse"]
475
- * @see {@link https://naver.github.io/egjs-axes/release/latest/doc/global.html#PanInputOption Possible values (PanInputOption#inputType)}
476
- * <ko>{@link https://naver.github.io/egjs-axes/release/latest/doc/global.html#PanInputOption 가능한 값들 (PanInputOption#inputType)}</ko>
490
+ * @see {@link https://naver.github.io/egjs-axes/Options#paninput-options Possible values (PanInputOption#inputType)}
491
+ * <ko>{@link https://naver.github.io/egjs-axes/Options#paninput-options 가능한 값들 (PanInputOption#inputType)}</ko>
492
+ * @see {@link https://naver.github.io/egjs-flicking/Options#inputtype inputType ( Options )}
477
493
  */
478
494
  public get inputType() { return this._inputType; }
479
495
  /**
@@ -483,6 +499,7 @@ class Flicking extends Component<FlickingEvents> {
483
499
  * 상수 {@link MOVE_TYPE}에 정의된 값들을 이용할 수 있습니다
484
500
  * @type {MOVE_TYPE | Pair<string, object>}
485
501
  * @default "snap"
502
+ * @see {@link https://naver.github.io/egjs-flicking/Options#movetype moveType ( Options )}
486
503
  * @example
487
504
  * |moveType|control|options|
488
505
  * |:---:|:---:|:---:|
@@ -512,6 +529,7 @@ class Flicking extends Component<FlickingEvents> {
512
529
  * @ko 패널 변경을 위한 이동 임계값 (단위: px). 주어진 값 이상으로 스크롤해야만 패널 변경이 가능하다.
513
530
  * @type {number}
514
531
  * @default 40
532
+ * @see {@link https://naver.github.io/egjs-flicking/Options#threshold Threshold ( Options )}
515
533
  */
516
534
  public get threshold() { return this._threshold; }
517
535
  /**
@@ -519,6 +537,7 @@ class Flicking extends Component<FlickingEvents> {
519
537
  * @ko 사용자의 클릭/터치로 인해 애니메이션을 도중에 멈출 수 있도록 설정합니다.
520
538
  * @type {boolean}
521
539
  * @default true
540
+ * @see {@link https://naver.github.io/egjs-flicking/Options#interruptable Interruptable ( Options )}
522
541
  */
523
542
  public get interruptable() { return this._interruptable; }
524
543
  /**
@@ -532,6 +551,7 @@ class Flicking extends Component<FlickingEvents> {
532
551
  * 이 값을 변경시 {@link Control#updateInput}를 호출해야 합니다.
533
552
  * @type {string | number | Array<string | number>}
534
553
  * @default "20%"
554
+ * @see {@link https://naver.github.io/egjs-flicking/Options#bounce bounce ( Options )}
535
555
  * @example
536
556
  * ```ts
537
557
  * const possibleOptions = [
@@ -558,6 +578,7 @@ class Flicking extends Component<FlickingEvents> {
558
578
  * @ko iOS Safari에서 swipe를 통한 뒤로가기/앞으로가기를 활성화하는 오른쪽 끝으로부터의 영역의 크기 (px)
559
579
  * @type {number}
560
580
  * @default 30
581
+ * @see {@link https://naver.github.io/egjs-flicking/Options#iosedgeswipethreshold iOSEdgeSwipeThreshold ( Options )}
561
582
  */
562
583
  public get iOSEdgeSwipeThreshold() { return this._iOSEdgeSwipeThreshold; }
563
584
  /**
@@ -565,6 +586,7 @@ class Flicking extends Component<FlickingEvents> {
565
586
  * @ko 사용자가 뷰포트 영역을 1픽셀이라도 드래그했을 경우 자동으로 {@link https://developer.mozilla.org/ko/docs/Web/API/Element/click_event click} 이벤트를 취소합니다
566
587
  * @type {boolean}
567
588
  * @default true
589
+ * @see {@link https://naver.github.io/egjs-flicking/Options#preventclickondrag preventClickOnDrag ( Options )}
568
590
  */
569
591
  public get preventClickOnDrag() { return this._preventClickOnDrag; }
570
592
  /**
@@ -572,6 +594,7 @@ class Flicking extends Component<FlickingEvents> {
572
594
  * @ko Flicking init시에 {@link Flicking#disableInput disableInput()}을 바로 호출합니다
573
595
  * @type {boolean}
574
596
  * @default false
597
+ * @see {@link https://naver.github.io/egjs-flicking/Options#disableoninit disableOnInit ( Options )}
575
598
  */
576
599
  public get disableOnInit() { return this._disableOnInit; }
577
600
  /**
@@ -581,6 +604,7 @@ class Flicking extends Component<FlickingEvents> {
581
604
  * `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
582
605
  * @type {boolean}
583
606
  * @default false
607
+ * @see {@link https://naver.github.io/egjs-flicking/Options#changeonhold changeOnHold ( Options )}
584
608
  */
585
609
  public get changeOnHold() { return this._changeOnHold; }
586
610
  // PERFORMANCE
@@ -589,6 +613,7 @@ class Flicking extends Component<FlickingEvents> {
589
613
  * @ko 보이는 패널만 렌더링할지 여부를 설정합니다. 패널이 많을 경우에 퍼포먼스를 크게 향상시킬 수 있습니다
590
614
  * @type {boolean}
591
615
  * @default false
616
+ * @see {@link https://naver.github.io/egjs-flicking/Options#renderonlyvisible renderOnlyVisible ( Options )}
592
617
  */
593
618
  public get renderOnlyVisible() { return this._renderOnlyVisible; }
594
619
  /**
@@ -603,6 +628,7 @@ class Flicking extends Component<FlickingEvents> {
603
628
  * @property {number} initialPanelCount Initial panel count to render<ko>최초로 렌더링할 패널의 개수</ko>
604
629
  * @property {boolean} [cache=false] Whether to cache rendered panel's innerHTML<ko>렌더링된 패널의 innerHTML 정보를 캐시할지 여부</ko>
605
630
  * @property {string} [panelClass="flicking-panel"] The class name that will be applied to rendered panel elements<ko>렌더링되는 패널 엘리먼트에 적용될 클래스 이름</ko>
631
+ * @see {@link https://naver.github.io/egjs-flicking/Options#virtual virtual ( Options )}
606
632
  * @example
607
633
  * ```ts
608
634
  * import Flicking, { VirtualPanel } from "@egjs/flicking";
@@ -630,6 +656,7 @@ class Flicking extends Component<FlickingEvents> {
630
656
  * @ko Flicking 인스턴스를 생성할 때 자동으로 {@link Flicking#init init()}를 호출합니다
631
657
  * @type {boolean}
632
658
  * @default true
659
+ * @see {@link https://naver.github.io/egjs-flicking/Options#autoinit autoInit ( Options )}
633
660
  * @readonly
634
661
  */
635
662
  public get autoInit() { return this._autoInit; }
@@ -645,6 +672,7 @@ class Flicking extends Component<FlickingEvents> {
645
672
  * @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} 이벤트 대신 수신할지 여부를 설정합니다
646
673
  * @type {boolean}
647
674
  * @default true
675
+ * @see {@link https://naver.github.io/egjs-flicking/Options#useresizeobserver useResizeObserver ( Options )}
648
676
  */
649
677
  public get useResizeObserver() { return this._useResizeObserver; }
650
678
  /**
@@ -656,6 +684,7 @@ class Flicking extends Component<FlickingEvents> {
656
684
  * 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
657
685
  * @type {number}
658
686
  * @default 0
687
+ * @see {@link https://naver.github.io/egjs-flicking/Options#resizedebounce resizeDebounce ( Options )}
659
688
  */
660
689
  public get resizeDebounce() { return this._resizeDebounce; }
661
690
  /**
@@ -665,6 +694,7 @@ class Flicking extends Component<FlickingEvents> {
665
694
  * 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
666
695
  * @type {number}
667
696
  * @default 100
697
+ * @see {@link https://naver.github.io/egjs-flicking/Options#maxresizedebounce maxResizeDebounce ( Options )}
668
698
  */
669
699
  public get maxResizeDebounce() { return this._maxResizeDebounce; }
670
700
  /**
@@ -676,6 +706,7 @@ class Flicking extends Component<FlickingEvents> {
676
706
  * 모든 크기는 CSS {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform transform}이 엘리먼트에 적용되기 이전의 크기를 사용할 것입니다.
677
707
  * @type {boolean}
678
708
  * @default false
709
+ * @see {@link https://naver.github.io/egjs-flicking/Options#usefractionalsize useFractionalSize ( Options )}
679
710
  */
680
711
  public get useFractionalSize() { return this._useFractionalSize; }
681
712
  /**
@@ -113,8 +113,8 @@ class SnapControl extends Control {
113
113
  // Move to the adjacent panel
114
114
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
115
115
  } else {
116
- // Restore to active panel
117
- return this.moveToPanel(activeAnchor.panel, {
116
+ // Fallback to nearest panel from current camera
117
+ return this.moveToPanel(anchorAtCamera.panel, {
118
118
  duration,
119
119
  axesEvent
120
120
  });
@@ -242,9 +242,15 @@ class StrictControl extends Control {
242
242
  targetPanel = adjacentAnchor!.panel;
243
243
  targetPos = adjacentAnchor!.position;
244
244
  } else {
245
- // Restore to active panel
246
- targetPos = camera.clampToReachablePosition(activePanel.position);
247
- targetPanel = activePanel;
245
+ // Fallback to nearest panel from current camera
246
+ const anchorAtCamera = camera.findNearestAnchor(camera.position);
247
+ if (!anchorAtCamera) {
248
+ return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(position), ERROR.CODE.POSITION_NOT_REACHABLE));
249
+ }
250
+ return this.moveToPanel(anchorAtCamera.panel, {
251
+ duration,
252
+ axesEvent
253
+ });
248
254
  }
249
255
 
250
256
  this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
@@ -67,7 +67,7 @@ class ResizeWatcher {
67
67
  public destroy() {
68
68
  this._observer?.disconnect();
69
69
  if (this._options.useWindowResize) {
70
- window.removeEventListener("reisze", this._onResize);
70
+ window.removeEventListener("resize", this._onResize);
71
71
  }
72
72
  }
73
73