@egjs/flicking 4.7.3 → 4.8.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/TODO.md ADDED
@@ -0,0 +1,3 @@
1
+ ## React 18 대응
2
+ - [] updateoffset을 미루기
3
+ - render가 완료되기 전에 updateOffset이 3번 호출되었음
@@ -56,6 +56,7 @@ export interface FlickingOptions {
56
56
  iOSEdgeSwipeThreshold: number;
57
57
  preventClickOnDrag: boolean;
58
58
  disableOnInit: boolean;
59
+ changeOnHold: boolean;
59
60
  renderOnlyVisible: boolean;
60
61
  virtual: VirtualOptions | null;
61
62
  autoInit: boolean;
@@ -102,6 +103,7 @@ declare class Flicking extends Component<FlickingEvents> {
102
103
  private _iOSEdgeSwipeThreshold;
103
104
  private _preventClickOnDrag;
104
105
  private _disableOnInit;
106
+ private _changeOnHold;
105
107
  private _renderOnlyVisible;
106
108
  private _autoInit;
107
109
  private _autoResize;
@@ -155,6 +157,7 @@ declare class Flicking extends Component<FlickingEvents> {
155
157
  get iOSEdgeSwipeThreshold(): FlickingOptions["iOSEdgeSwipeThreshold"];
156
158
  get preventClickOnDrag(): FlickingOptions["preventClickOnDrag"];
157
159
  get disableOnInit(): FlickingOptions["disableOnInit"];
160
+ get changeOnHold(): FlickingOptions["changeOnHold"];
158
161
  get renderOnlyVisible(): FlickingOptions["renderOnlyVisible"];
159
162
  get virtual(): VirtualManager;
160
163
  get autoInit(): boolean;
@@ -190,10 +193,11 @@ declare class Flicking extends Component<FlickingEvents> {
190
193
  set iOSEdgeSwipeThreshold(val: FlickingOptions["iOSEdgeSwipeThreshold"]);
191
194
  set preventClickOnDrag(val: FlickingOptions["preventClickOnDrag"]);
192
195
  set disableOnInit(val: FlickingOptions["disableOnInit"]);
196
+ set changeOnHold(val: FlickingOptions["changeOnHold"]);
193
197
  set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]);
194
198
  set autoResize(val: FlickingOptions["autoResize"]);
195
199
  set useResizeObserver(val: FlickingOptions["useResizeObserver"]);
196
- constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, disableOnInit, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, maxResizeDebounce, externalRenderer, renderExternal }?: Partial<FlickingOptions>);
200
+ constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, nested, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, disableOnInit, changeOnHold, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, resizeDebounce, maxResizeDebounce, externalRenderer, renderExternal }?: Partial<FlickingOptions>);
197
201
  init(): Promise<void>;
198
202
  destroy(): void;
199
203
  prev(duration?: number): Promise<void>;
@@ -4,7 +4,7 @@ name: @egjs/flicking
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-flicking
7
- version: 4.7.3
7
+ version: 4.8.0
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
@@ -781,7 +781,7 @@ var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
781
781
  * @ko Flicking 내부에서 알려진 오류 발생시 throw되는 에러
782
782
  * @property {number} code Error code<ko>에러 코드</ko>
783
783
  * @property {string} message Error message<ko>에러 메시지</ko>
784
- * @see {@link Constants.ERROR_CODE ERROR_CODE}
784
+ * @see {@link ERROR_CODE ERROR_CODE}
785
785
  * @example
786
786
  * ```ts
787
787
  * import Flicking, { FlickingError, ERROR_CODES } from "@egjs/flicking";
@@ -1940,8 +1940,15 @@ function (_super) {
1940
1940
  var flicking = ctx.flicking,
1941
1941
  axesEvent = ctx.axesEvent,
1942
1942
  transitTo = ctx.transitTo;
1943
+ var targetPanel = this._targetPanel;
1944
+ var control = flicking.control;
1943
1945
  this._delta = 0;
1944
1946
  flicking.control.updateInput();
1947
+
1948
+ if (flicking.changeOnHold && targetPanel) {
1949
+ control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
1950
+ }
1951
+
1945
1952
  var holdStartEvent = new ComponentEvent(EVENTS.HOLD_START, {
1946
1953
  axesEvent: axesEvent
1947
1954
  });
@@ -3111,7 +3118,7 @@ function (_super) {
3111
3118
  var camera = flicking.camera;
3112
3119
  var activeAnchor = camera.findActiveAnchor();
3113
3120
  var anchorAtCamera = camera.findNearestAnchor(camera.position);
3114
- var state = flicking.control.controller.state;
3121
+ var state = this._controller.state;
3115
3122
 
3116
3123
  if (!activeAnchor || !anchorAtCamera) {
3117
3124
  return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
@@ -3553,6 +3560,7 @@ function (_super) {
3553
3560
  var axesRange = this._controller.range;
3554
3561
  var indexRange = this._indexRange;
3555
3562
  var cameraRange = camera.range;
3563
+ var state = this._controller.state;
3556
3564
  var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
3557
3565
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
3558
3566
 
@@ -3561,7 +3569,8 @@ function (_super) {
3561
3569
  }
3562
3570
 
3563
3571
  var prevPos = activePanel.position;
3564
- var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
3572
+ var posDelta = flicking.animating ? state.delta : position - camera.position;
3573
+ var isOverThreshold = Math.abs(posDelta) >= flicking.threshold;
3565
3574
  var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
3566
3575
  var targetPos;
3567
3576
  var targetPanel;
@@ -6662,24 +6671,26 @@ function (_super) {
6662
6671
  preventClickOnDrag = _0 === void 0 ? true : _0,
6663
6672
  _1 = _b.disableOnInit,
6664
6673
  disableOnInit = _1 === void 0 ? false : _1,
6665
- _2 = _b.renderOnlyVisible,
6666
- renderOnlyVisible = _2 === void 0 ? false : _2,
6667
- _3 = _b.virtual,
6668
- virtual = _3 === void 0 ? null : _3,
6669
- _4 = _b.autoInit,
6670
- autoInit = _4 === void 0 ? true : _4,
6671
- _5 = _b.autoResize,
6672
- autoResize = _5 === void 0 ? true : _5,
6673
- _6 = _b.useResizeObserver,
6674
- useResizeObserver = _6 === void 0 ? true : _6,
6675
- _7 = _b.resizeDebounce,
6676
- resizeDebounce = _7 === void 0 ? 0 : _7,
6677
- _8 = _b.maxResizeDebounce,
6678
- maxResizeDebounce = _8 === void 0 ? 100 : _8,
6679
- _9 = _b.externalRenderer,
6680
- externalRenderer = _9 === void 0 ? null : _9,
6681
- _10 = _b.renderExternal,
6682
- renderExternal = _10 === void 0 ? null : _10;
6674
+ _2 = _b.changeOnHold,
6675
+ changeOnHold = _2 === void 0 ? false : _2,
6676
+ _3 = _b.renderOnlyVisible,
6677
+ renderOnlyVisible = _3 === void 0 ? false : _3,
6678
+ _4 = _b.virtual,
6679
+ virtual = _4 === void 0 ? null : _4,
6680
+ _5 = _b.autoInit,
6681
+ autoInit = _5 === void 0 ? true : _5,
6682
+ _6 = _b.autoResize,
6683
+ autoResize = _6 === void 0 ? true : _6,
6684
+ _7 = _b.useResizeObserver,
6685
+ useResizeObserver = _7 === void 0 ? true : _7,
6686
+ _8 = _b.resizeDebounce,
6687
+ resizeDebounce = _8 === void 0 ? 0 : _8,
6688
+ _9 = _b.maxResizeDebounce,
6689
+ maxResizeDebounce = _9 === void 0 ? 100 : _9,
6690
+ _10 = _b.externalRenderer,
6691
+ externalRenderer = _10 === void 0 ? null : _10,
6692
+ _11 = _b.renderExternal,
6693
+ renderExternal = _11 === void 0 ? null : _11;
6683
6694
 
6684
6695
  var _this = _super.call(this) || this; // Internal states
6685
6696
 
@@ -6712,6 +6723,7 @@ function (_super) {
6712
6723
  _this._iOSEdgeSwipeThreshold = iOSEdgeSwipeThreshold;
6713
6724
  _this._preventClickOnDrag = preventClickOnDrag;
6714
6725
  _this._disableOnInit = disableOnInit;
6726
+ _this._changeOnHold = changeOnHold;
6715
6727
  _this._renderOnlyVisible = renderOnlyVisible;
6716
6728
  _this._autoInit = autoInit;
6717
6729
  _this._autoResize = autoResize;
@@ -7468,6 +7480,24 @@ function (_super) {
7468
7480
  enumerable: false,
7469
7481
  configurable: true
7470
7482
  });
7483
+ Object.defineProperty(__proto, "changeOnHold", {
7484
+ /**
7485
+ * Change active panel index on mouse/touch hold while animating.
7486
+ * `index` of the `willChange`/`willRestore` event will be used as new index.
7487
+ * @ko 애니메이션 도중 마우스/터치 입력시 현재 활성화된 패널의 인덱스를 변경합니다.
7488
+ * `willChange`/`willRestore` 이벤트의 `index`값이 새로운 인덱스로 사용될 것입니다.
7489
+ * @type {boolean}
7490
+ * @default false
7491
+ */
7492
+ get: function () {
7493
+ return this._changeOnHold;
7494
+ },
7495
+ set: function (val) {
7496
+ this._changeOnHold = val;
7497
+ },
7498
+ enumerable: false,
7499
+ configurable: true
7500
+ });
7471
7501
  Object.defineProperty(__proto, "renderOnlyVisible", {
7472
7502
  // PERFORMANCE
7473
7503
 
@@ -8148,6 +8178,8 @@ function (_super) {
8148
8178
  camera.updateAlignPos();
8149
8179
  camera.updateRange();
8150
8180
  camera.updateAnchors();
8181
+ camera.updateAdaptiveHeight();
8182
+ camera.updateOffset();
8151
8183
  return [4
8152
8184
  /*yield*/
8153
8185
  , renderer.render()];
@@ -8425,7 +8457,7 @@ function (_super) {
8425
8457
  */
8426
8458
 
8427
8459
 
8428
- Flicking.VERSION = "4.7.3";
8460
+ Flicking.VERSION = "4.8.0";
8429
8461
  return Flicking;
8430
8462
  }(Component);
8431
8463