@egjs/flicking 4.16.0 → 4.16.1

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.
@@ -1,7 +1,50 @@
1
1
  (function(global, factory) {
2
2
  typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.Flicking = factory());
3
3
  })(this, (function() {
4
- "use strict";
4
+ "use strict";var __defProp = Object.defineProperty;
5
+ var __defProps = Object.defineProperties;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __reflectGet = Reflect.get;
12
+ var __pow = Math.pow;
13
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues = (a, b) => {
15
+ for (var prop in b || (b = {}))
16
+ if (__hasOwnProp.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ }
23
+ return a;
24
+ };
25
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
+ var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
27
+ var __async = (__this, __arguments, generator) => {
28
+ return new Promise((resolve, reject) => {
29
+ var fulfilled = (value) => {
30
+ try {
31
+ step(generator.next(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var rejected = (value) => {
37
+ try {
38
+ step(generator.throw(value));
39
+ } catch (e) {
40
+ reject(e);
41
+ }
42
+ };
43
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
44
+ step((generator = generator.apply(__this, __arguments)).next());
45
+ });
46
+ };
47
+
5
48
  function __values(o) {
6
49
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
7
50
  if (m) return m.call(o);
@@ -1056,10 +1099,11 @@
1056
1099
  return true;
1057
1100
  }
1058
1101
  getRange() {
1102
+ var _a, _b;
1059
1103
  const renderer = this._flicking.renderer;
1060
1104
  const firstPanel = renderer.getPanel(0);
1061
1105
  const lastPanel = renderer.getPanel(renderer.panelCount - 1);
1062
- return { min: firstPanel?.position ?? 0, max: lastPanel?.position ?? 0 };
1106
+ return { min: (_a = firstPanel == null ? void 0 : firstPanel.position) != null ? _a : 0, max: (_b = lastPanel == null ? void 0 : lastPanel.position) != null ? _b : 0 };
1063
1107
  }
1064
1108
  }
1065
1109
  let Camera$1 = class Camera {
@@ -1388,10 +1432,11 @@
1388
1432
  * @returns The {@link AnchorPoint} that matches current panel
1389
1433
  */
1390
1434
  findActiveAnchor() {
1435
+ var _a;
1391
1436
  const flicking = getFlickingAttached(this._flicking);
1392
1437
  const activePanel = flicking.control.activePanel;
1393
1438
  if (!activePanel) return null;
1394
- return find$1(this._anchors, (anchor) => anchor.panel.index === activePanel.index) ?? this.findNearestAnchor(activePanel.position);
1439
+ return (_a = find$1(this._anchors, (anchor) => anchor.panel.index === activePanel.index)) != null ? _a : this.findNearestAnchor(activePanel.position);
1395
1440
  }
1396
1441
  /**
1397
1442
  * Clamp the given position between camera's range
@@ -4743,7 +4788,7 @@
4743
4788
  }
4744
4789
  fire(eventType, externalCtx) {
4745
4790
  const currentState = this._state;
4746
- const ctx = { ...externalCtx, transitTo: this.transitTo };
4791
+ const ctx = __spreadProps(__spreadValues({}, externalCtx), { transitTo: this.transitTo });
4747
4792
  switch (eventType) {
4748
4793
  case EVENT.HOLD:
4749
4794
  currentState.onHold(ctx);
@@ -4769,7 +4814,8 @@
4769
4814
  this._dragged = false;
4770
4815
  };
4771
4816
  this._onAxesChange = () => {
4772
- this._dragged = !!this._panInput?.isEnabled();
4817
+ var _a;
4818
+ this._dragged = !!((_a = this._panInput) == null ? void 0 : _a.isEnabled());
4773
4819
  };
4774
4820
  this._preventClickWhenDragged = (e) => {
4775
4821
  if (this._dragged) {
@@ -4840,28 +4886,32 @@
4840
4886
  * @readonly
4841
4887
  */
4842
4888
  get enabled() {
4843
- return this._panInput?.isEnabled() ?? false;
4889
+ var _a, _b;
4890
+ return (_b = (_a = this._panInput) == null ? void 0 : _a.isEnabled()) != null ? _b : false;
4844
4891
  }
4845
4892
  /**
4846
4893
  * Current position value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
4847
4894
  * @readonly
4848
4895
  */
4849
4896
  get position() {
4850
- return this._axes?.get([POSITION_KEY])[POSITION_KEY] ?? 0;
4897
+ var _a, _b;
4898
+ return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
4851
4899
  }
4852
4900
  /**
4853
4901
  * Current range value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
4854
4902
  * @readonly
4855
4903
  */
4856
4904
  get range() {
4857
- return this._axes?.axis[POSITION_KEY].range ?? [0, 0];
4905
+ var _a, _b;
4906
+ return (_b = (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].range) != null ? _b : [0, 0];
4858
4907
  }
4859
4908
  /**
4860
4909
  * Actual bounce size(px)
4861
4910
  * @readonly
4862
4911
  */
4863
4912
  get bounce() {
4864
- return this._axes?.axis[POSITION_KEY].bounce;
4913
+ var _a;
4914
+ return (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].bounce;
4865
4915
  }
4866
4916
  /**
4867
4917
  * Initialize AxesController
@@ -4914,11 +4964,12 @@
4914
4964
  * This method destroys the Axes and PanInput instances and removes all event handlers.
4915
4965
  */
4916
4966
  destroy() {
4967
+ var _a;
4917
4968
  if (this._axes) {
4918
4969
  this.removePreventClickHandler();
4919
4970
  this._axes.destroy();
4920
4971
  }
4921
- this._panInput?.destroy();
4972
+ (_a = this._panInput) == null ? void 0 : _a.destroy();
4922
4973
  this._resetInternalValues();
4923
4974
  }
4924
4975
  /**
@@ -4928,7 +4979,8 @@
4928
4979
  * @returns The current instance for method chaining
4929
4980
  */
4930
4981
  enable() {
4931
- this._panInput?.enable();
4982
+ var _a;
4983
+ (_a = this._panInput) == null ? void 0 : _a.enable();
4932
4984
  return this;
4933
4985
  }
4934
4986
  /**
@@ -4938,7 +4990,8 @@
4938
4990
  * @returns The current instance for method chaining
4939
4991
  */
4940
4992
  disable() {
4941
- this._panInput?.disable();
4993
+ var _a;
4994
+ (_a = this._panInput) == null ? void 0 : _a.disable();
4942
4995
  return this;
4943
4996
  }
4944
4997
  /**
@@ -4948,7 +5001,8 @@
4948
5001
  * @returns The current instance for method chaining
4949
5002
  */
4950
5003
  release() {
4951
- this._panInput?.release();
5004
+ var _a;
5005
+ (_a = this._panInput) == null ? void 0 : _a.release();
4952
5006
  return this;
4953
5007
  }
4954
5008
  /**
@@ -4960,11 +5014,11 @@
4960
5014
  * @returns The current instance for method chaining
4961
5015
  */
4962
5016
  updateAnimation(position, duration) {
4963
- this._animatingContext = {
4964
- ...this._animatingContext,
5017
+ var _a;
5018
+ this._animatingContext = __spreadProps(__spreadValues({}, this._animatingContext), {
4965
5019
  end: position
4966
- };
4967
- this._axes?.updateAnimation({
5020
+ });
5021
+ (_a = this._axes) == null ? void 0 : _a.updateAnimation({
4968
5022
  destPos: { [POSITION_KEY]: position },
4969
5023
  duration
4970
5024
  });
@@ -4977,7 +5031,8 @@
4977
5031
  * @returns The current instance for method chaining
4978
5032
  */
4979
5033
  stopAnimation() {
4980
- this._axes?.stopAnimation();
5034
+ var _a;
5035
+ (_a = this._axes) == null ? void 0 : _a.stopAnimation();
4981
5036
  return this;
4982
5037
  }
4983
5038
  /**
@@ -5040,6 +5095,7 @@
5040
5095
  * @returns A Promise which will be resolved after reaching the target position
5041
5096
  */
5042
5097
  animateTo(position, duration, axesEvent) {
5098
+ var _a;
5043
5099
  const axes = this._axes;
5044
5100
  const state = this._stateMachine.state;
5045
5101
  if (!axes) {
@@ -5052,7 +5108,7 @@
5052
5108
  const flicking = getFlickingAttached(this._flicking);
5053
5109
  flicking.camera.lookAt(position);
5054
5110
  if (state.targetPanel) {
5055
- flicking.control.setActive(state.targetPanel, flicking.control.activePanel, axesEvent?.isTrusted ?? false);
5111
+ flicking.control.setActive(state.targetPanel, flicking.control.activePanel, (_a = axesEvent == null ? void 0 : axesEvent.isTrusted) != null ? _a : false);
5056
5112
  }
5057
5113
  return Promise.resolve();
5058
5114
  }
@@ -5090,7 +5146,8 @@
5090
5146
  * Returns the current axes position
5091
5147
  */
5092
5148
  getCurrentPosition() {
5093
- return this._axes?.get([POSITION_KEY])[POSITION_KEY] ?? 0;
5149
+ var _a, _b;
5150
+ return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
5094
5151
  }
5095
5152
  updateDirection() {
5096
5153
  const flicking = getFlickingAttached(this._flicking);
@@ -5127,7 +5184,8 @@
5127
5184
  * @readonly
5128
5185
  */
5129
5186
  get activeIndex() {
5130
- return this._activePanel?.index ?? -1;
5187
+ var _a, _b;
5188
+ return (_b = (_a = this._activePanel) == null ? void 0 : _a.index) != null ? _b : -1;
5131
5189
  }
5132
5190
  /**
5133
5191
  * An active panel
@@ -5219,7 +5277,7 @@
5219
5277
  */
5220
5278
  updateAnimation(panel, duration, direction) {
5221
5279
  const state = this._controller.state;
5222
- const position = this._getPosition(panel, direction ?? DIRECTION.NONE);
5280
+ const position = this._getPosition(panel, direction != null ? direction : DIRECTION.NONE);
5223
5281
  state.targetPanel = panel;
5224
5282
  this._controller.updateAnimation(position, duration);
5225
5283
  return this;
@@ -5281,10 +5339,12 @@
5281
5339
  * @throws {@link MovementErrors}
5282
5340
  * @returns A Promise which will be resolved after reaching the target panel
5283
5341
  */
5284
- async moveToPanel(panel, { duration, direction = DIRECTION.NONE, axesEvent }) {
5285
- const position = this._getPosition(panel, direction);
5286
- this._triggerIndexChangeEvent(panel, panel.position, axesEvent, direction);
5287
- return this._animateToPosition({ position, duration, newActivePanel: panel, axesEvent });
5342
+ moveToPanel(_0, _1) {
5343
+ return __async(this, arguments, function* (panel, { duration, direction = DIRECTION.NONE, axesEvent }) {
5344
+ const position = this._getPosition(panel, direction);
5345
+ this._triggerIndexChangeEvent(panel, panel.position, axesEvent, direction);
5346
+ return this._animateToPosition({ position, duration, newActivePanel: panel, axesEvent });
5347
+ });
5288
5348
  }
5289
5349
  /**
5290
5350
  * @internal
@@ -5292,6 +5352,7 @@
5292
5352
  * Sets the active panel and triggers {@link ChangedEvent} or {@link RestoredEvent} based on whether the panel changed.
5293
5353
  */
5294
5354
  setActive(newActivePanel, prevActivePanel, isTrusted) {
5355
+ var _a;
5295
5356
  const flicking = getFlickingAttached(this._flicking);
5296
5357
  this._activePanel = newActivePanel;
5297
5358
  this._nextPanel = null;
@@ -5301,7 +5362,7 @@
5301
5362
  new ComponentEvent$1(EVENTS.CHANGED, {
5302
5363
  index: newActivePanel.index,
5303
5364
  panel: newActivePanel,
5304
- prevIndex: prevActivePanel?.index ?? -1,
5365
+ prevIndex: (_a = prevActivePanel == null ? void 0 : prevActivePanel.index) != null ? _a : -1,
5305
5366
  prevPanel: prevActivePanel,
5306
5367
  isTrusted,
5307
5368
  direction: prevActivePanel ? getDirection$1(prevActivePanel.position, newActivePanel.position) : DIRECTION.NONE
@@ -5331,6 +5392,7 @@
5331
5392
  * Triggers {@link WillChangeEvent} or {@link WillRestoreEvent} based on whether the target panel differs from the active panel.
5332
5393
  */
5333
5394
  _triggerIndexChangeEvent(panel, position, axesEvent, direction) {
5395
+ var _a;
5334
5396
  const flicking = getFlickingAttached(this._flicking);
5335
5397
  const triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
5336
5398
  const camera = flicking.camera;
@@ -5338,8 +5400,8 @@
5338
5400
  const event = new ComponentEvent$1(triggeringEvent, {
5339
5401
  index: panel.index,
5340
5402
  panel,
5341
- isTrusted: axesEvent?.isTrusted || false,
5342
- direction: direction ?? getDirection$1(activePanel?.position ?? camera.position, position)
5403
+ isTrusted: (axesEvent == null ? void 0 : axesEvent.isTrusted) || false,
5404
+ direction: direction != null ? direction : getDirection$1((_a = activePanel == null ? void 0 : activePanel.position) != null ? _a : camera.position, position)
5343
5405
  });
5344
5406
  this._nextPanel = panel;
5345
5407
  flicking.trigger(event);
@@ -5352,32 +5414,34 @@
5352
5414
  * @privateRemarks
5353
5415
  * Animates the camera to the target position and handles animation completion or interruption.
5354
5416
  */
5355
- async _animateToPosition({
5356
- position,
5357
- duration,
5358
- newActivePanel,
5359
- axesEvent
5360
- }) {
5361
- const flicking = getFlickingAttached(this._flicking);
5362
- let nextDuration = duration;
5363
- if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
5364
- nextDuration = 0;
5365
- }
5366
- const animate = () => this._controller.animateTo(position, nextDuration, axesEvent);
5367
- const state = this._controller.state;
5368
- state.targetPanel = newActivePanel;
5369
- if (nextDuration <= 0) {
5370
- return animate();
5371
- } else {
5372
- return animate().then(async () => {
5373
- if (flicking.initialized) {
5374
- await flicking.renderer.render();
5375
- }
5376
- }).catch((err) => {
5377
- if (axesEvent && err instanceof FlickingError && err.code === CODE.ANIMATION_INTERRUPTED) return;
5378
- throw err;
5379
- });
5380
- }
5417
+ _animateToPosition(_0) {
5418
+ return __async(this, arguments, function* ({
5419
+ position,
5420
+ duration,
5421
+ newActivePanel,
5422
+ axesEvent
5423
+ }) {
5424
+ const flicking = getFlickingAttached(this._flicking);
5425
+ let nextDuration = duration;
5426
+ if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
5427
+ nextDuration = 0;
5428
+ }
5429
+ const animate = () => this._controller.animateTo(position, nextDuration, axesEvent);
5430
+ const state = this._controller.state;
5431
+ state.targetPanel = newActivePanel;
5432
+ if (nextDuration <= 0) {
5433
+ return animate();
5434
+ } else {
5435
+ return animate().then(() => __async(this, null, function* () {
5436
+ if (flicking.initialized) {
5437
+ yield flicking.renderer.render();
5438
+ }
5439
+ })).catch((err) => {
5440
+ if (axesEvent && err instanceof FlickingError && err.code === CODE.ANIMATION_INTERRUPTED) return;
5441
+ throw err;
5442
+ });
5443
+ }
5444
+ });
5381
5445
  }
5382
5446
  /**
5383
5447
  * @internal
@@ -5599,6 +5663,7 @@
5599
5663
  * Finds the adjacent anchor point based on the movement direction.
5600
5664
  */
5601
5665
  _findAdjacentAnchor(position, posDelta, anchorAtCamera) {
5666
+ var _a;
5602
5667
  const flicking = getFlickingAttached(this._flicking);
5603
5668
  const camera = flicking.camera;
5604
5669
  if (camera.circularEnabled) {
@@ -5607,7 +5672,7 @@
5607
5672
  return anchorIncludePosition;
5608
5673
  }
5609
5674
  }
5610
- const adjacentAnchor = (posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) ?? anchorAtCamera;
5675
+ const adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) != null ? _a : anchorAtCamera;
5611
5676
  return adjacentAnchor;
5612
5677
  }
5613
5678
  /**
@@ -5663,13 +5728,14 @@
5663
5728
  * @returns The current instance for method chaining
5664
5729
  */
5665
5730
  updateInput() {
5731
+ var _a;
5666
5732
  const flicking = getFlickingAttached(this._flicking);
5667
5733
  const camera = flicking.camera;
5668
5734
  const renderer = flicking.renderer;
5669
5735
  const controller = this._controller;
5670
5736
  const controlParams = camera.controlParams;
5671
5737
  const count = this._count;
5672
- const activePanel = controller.state.animating ? camera.findNearestAnchor(camera.position)?.panel : this._activePanel;
5738
+ const activePanel = controller.state.animating ? (_a = camera.findNearestAnchor(camera.position)) == null ? void 0 : _a.panel : this._activePanel;
5673
5739
  if (!activePanel) {
5674
5740
  controller.update(controlParams);
5675
5741
  this._resetIndexRange();
@@ -5717,12 +5783,14 @@
5717
5783
  };
5718
5784
  return this;
5719
5785
  }
5720
- async moveToPanel(panel, options) {
5721
- const flicking = getFlickingAttached(this._flicking);
5722
- const camera = flicking.camera;
5723
- const controller = this._controller;
5724
- controller.update(camera.controlParams);
5725
- return super.moveToPanel(panel, options);
5786
+ moveToPanel(panel, options) {
5787
+ return __async(this, null, function* () {
5788
+ const flicking = getFlickingAttached(this._flicking);
5789
+ const camera = flicking.camera;
5790
+ const controller = this._controller;
5791
+ controller.update(camera.controlParams);
5792
+ return __superGet(StrictControl.prototype, this, "moveToPanel").call(this, panel, options);
5793
+ });
5726
5794
  }
5727
5795
  /**
5728
5796
  * Move {@link Camera} to the given position
@@ -5736,9 +5804,10 @@
5736
5804
  * @returns A Promise which will be resolved after reaching the target position
5737
5805
  */
5738
5806
  moveToPosition(position, duration, axesEvent) {
5807
+ var _a;
5739
5808
  const flicking = getFlickingAttached(this._flicking);
5740
5809
  const camera = flicking.camera;
5741
- const currentPanel = this._nextPanel ?? this._activePanel;
5810
+ const currentPanel = (_a = this._nextPanel) != null ? _a : this._activePanel;
5742
5811
  const axesRange = this._controller.range;
5743
5812
  const indexRange = this._indexRange;
5744
5813
  const cameraRange = camera.range;
@@ -6157,11 +6226,12 @@
6157
6226
  this._panelClass = val;
6158
6227
  }
6159
6228
  constructor(flicking, options) {
6229
+ var _a, _b, _c, _d;
6160
6230
  this._flicking = flicking;
6161
- this._renderPanel = options?.renderPanel ?? (() => "");
6162
- this._initialPanelCount = options?.initialPanelCount ?? -1;
6163
- this._cache = options?.cache ?? false;
6164
- this._panelClass = options?.panelClass ?? CLASS.DEFAULT_VIRTUAL;
6231
+ this._renderPanel = (_a = options == null ? void 0 : options.renderPanel) != null ? _a : (() => "");
6232
+ this._initialPanelCount = (_b = options == null ? void 0 : options.initialPanelCount) != null ? _b : -1;
6233
+ this._cache = (_c = options == null ? void 0 : options.cache) != null ? _c : false;
6234
+ this._panelClass = (_d = options == null ? void 0 : options.panelClass) != null ? _d : CLASS.DEFAULT_VIRTUAL;
6165
6235
  this._elements = [];
6166
6236
  }
6167
6237
  init() {
@@ -6978,6 +7048,7 @@
6978
7048
  const prevFirstPanel = panels[0];
6979
7049
  const align = parsePanelAlign(this._align);
6980
7050
  const allPanelsInserted = items.reduce((addedPanels, item) => {
7051
+ var _a;
6981
7052
  const insertingIdx = getMinusCompensatedIndex(item.index, panels.length);
6982
7053
  const panelsPushed = panels.slice(insertingIdx);
6983
7054
  const panelsInserted = item.elements.map(
@@ -6985,7 +7056,7 @@
6985
7056
  );
6986
7057
  panels.splice(insertingIdx, 0, ...panelsInserted);
6987
7058
  if (item.hasDOMInElements) {
6988
- this._insertPanelElements(panelsInserted, panelsPushed[0] ?? null);
7059
+ this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) != null ? _a : null);
6989
7060
  }
6990
7061
  if (flicking.panelsPerView > 0) {
6991
7062
  const firstPanel = prevFirstPanel || panelsInserted[0].resize();
@@ -7052,6 +7123,7 @@
7052
7123
  * Updates camera, control, and triggers {@link PanelChangeEvent} after panels are added or removed.
7053
7124
  */
7054
7125
  updateAfterPanelChange(panelsAdded, panelsRemoved) {
7126
+ var _a;
7055
7127
  const flicking = getFlickingAttached(this._flicking);
7056
7128
  const { camera, control } = flicking;
7057
7129
  const panels = this._panels;
@@ -7075,7 +7147,7 @@
7075
7147
  if (panels.length <= 0) {
7076
7148
  camera.lookAt(0);
7077
7149
  } else {
7078
- let targetIndex = activePanel?.index ?? 0;
7150
+ let targetIndex = (_a = activePanel == null ? void 0 : activePanel.index) != null ? _a : 0;
7079
7151
  if (targetIndex > panels.length - 1) {
7080
7152
  targetIndex = panels.length - 1;
7081
7153
  }
@@ -7205,11 +7277,10 @@
7205
7277
  const gap = referencePanel.margin.prev + referencePanel.margin.next;
7206
7278
  const panelSize = (viewportSize - gap * (panelsPerView - 1)) / panelsPerView;
7207
7279
  const panelSizeObj = flicking.horizontal ? { width: panelSize } : { height: panelSize };
7208
- const firstPanelSizeObj = {
7280
+ const firstPanelSizeObj = __spreadValues({
7209
7281
  size: panelSize,
7210
- margin: referencePanel.margin,
7211
- ...!flicking.horizontal && { height: referencePanel.height }
7212
- };
7282
+ margin: referencePanel.margin
7283
+ }, !flicking.horizontal && { height: referencePanel.height });
7213
7284
  if (!flicking.noPanelStyleOverride) {
7214
7285
  this._strategy.updatePanelSizes(flicking, panelSizeObj);
7215
7286
  }
@@ -7236,7 +7307,7 @@
7236
7307
  const flicking = getFlickingAttached(this._flicking);
7237
7308
  const camera = flicking.camera;
7238
7309
  const cameraElement = camera.element;
7239
- const nextSiblingElement = nextSibling?.element || null;
7310
+ const nextSiblingElement = (nextSibling == null ? void 0 : nextSibling.element) || null;
7240
7311
  const fragment = document.createDocumentFragment();
7241
7312
  panels.forEach((panel) => fragment.appendChild(panel.element));
7242
7313
  cameraElement.insertBefore(fragment, nextSiblingElement);
@@ -7281,13 +7352,15 @@
7281
7352
  }
7282
7353
  class VanillaRenderer extends Renderer$1 {
7283
7354
  // eslint-disable-next-line @typescript-eslint/require-await
7284
- async render() {
7285
- const flicking = getFlickingAttached(this._flicking);
7286
- const strategy = this._strategy;
7287
- strategy.updateRenderingPanels(flicking);
7288
- strategy.renderPanels(flicking);
7289
- this._resetPanelElementOrder();
7290
- this._afterRender();
7355
+ render() {
7356
+ return __async(this, null, function* () {
7357
+ const flicking = getFlickingAttached(this._flicking);
7358
+ const strategy = this._strategy;
7359
+ strategy.updateRenderingPanels(flicking);
7360
+ strategy.renderPanels(flicking);
7361
+ this._resetPanelElementOrder();
7362
+ this._afterRender();
7363
+ });
7291
7364
  }
7292
7365
  _collectPanels() {
7293
7366
  const flicking = getFlickingAttached(this._flicking);
@@ -7559,6 +7632,7 @@
7559
7632
  * @returns The current instance for method chaining
7560
7633
  */
7561
7634
  resize(cached) {
7635
+ var _a;
7562
7636
  const el = this.element;
7563
7637
  const flicking = this._flicking;
7564
7638
  const { horizontal, useFractionalSize } = flicking;
@@ -7567,8 +7641,8 @@
7567
7641
  }
7568
7642
  if (cached) {
7569
7643
  this._size = cached.size;
7570
- this._margin = { ...cached.margin };
7571
- this._height = cached.height ?? getElementSize({
7644
+ this._margin = __spreadValues({}, cached.margin);
7645
+ this._height = (_a = cached.height) != null ? _a : getElementSize({
7572
7646
  el,
7573
7647
  horizontal: false,
7574
7648
  useFractionalSize,
@@ -7622,7 +7696,8 @@
7622
7696
  * @returns A Boolean value indicating the element is inside of this panel {@link Panel.element | element}
7623
7697
  */
7624
7698
  contains(element) {
7625
- return !!this.element?.contains(element);
7699
+ var _a;
7700
+ return !!((_a = this.element) == null ? void 0 : _a.contains(element));
7626
7701
  }
7627
7702
  /**
7628
7703
  * Reset internal state and set {@link Panel.removed | removed} to `true`
@@ -7857,10 +7932,9 @@
7857
7932
  );
7858
7933
  }
7859
7934
  createPanel(element, options) {
7860
- return new Panel({
7861
- ...options,
7935
+ return new Panel(__spreadProps(__spreadValues({}, options), {
7862
7936
  elementProvider: new this._providerCtor(element)
7863
- });
7937
+ }));
7864
7938
  }
7865
7939
  updatePanelSizes(flicking, size) {
7866
7940
  flicking.panels.forEach((panel) => panel.setSize(size));
@@ -7971,7 +8045,7 @@
7971
8045
  });
7972
8046
  if (visiblePanels.length <= 0) return virtualManager.elements.map((_, idx) => idx);
7973
8047
  const visibleIndexes = visiblePanels.map((panel) => panel.elementIndex);
7974
- const invisibleIndexes = virtualManager.elements.map((el, idx) => ({ ...el, idx })).filter((el) => !el.visible).map((el) => el.idx);
8048
+ const invisibleIndexes = virtualManager.elements.map((el, idx) => __spreadProps(__spreadValues({}, el), { idx })).filter((el) => !el.visible).map((el) => el.idx);
7975
8049
  return [...visibleIndexes, ...invisibleIndexes];
7976
8050
  }
7977
8051
  getRenderingElementsByOrder(flicking) {
@@ -8007,10 +8081,9 @@
8007
8081
  );
8008
8082
  }
8009
8083
  createPanel(_el, options) {
8010
- return new VirtualPanel({
8011
- ...options,
8084
+ return new VirtualPanel(__spreadProps(__spreadValues({}, options), {
8012
8085
  elementProvider: new VirtualElementProvider(options.flicking)
8013
- });
8086
+ }));
8014
8087
  }
8015
8088
  updatePanelSizes(flicking, size) {
8016
8089
  flicking.virtual.elements.forEach((el) => {
@@ -8062,7 +8135,7 @@
8062
8135
  preventEventsBeforeInit = true,
8063
8136
  deceleration = 75e-4,
8064
8137
  duration = 500,
8065
- easing = (x) => 1 - (1 - x) ** 3,
8138
+ easing = (x) => 1 - __pow(1 - x, 3),
8066
8139
  inputType = ["mouse", "touch"],
8067
8140
  moveType = "snap",
8068
8141
  threshold = 40,
@@ -8917,7 +8990,8 @@
8917
8990
  * @returns Promise that resolves after reaching the previous panel
8918
8991
  */
8919
8992
  prev(duration = this._duration) {
8920
- return this.moveTo(this._control.activePanel?.prev()?.index ?? -1, duration, DIRECTION.PREV);
8993
+ var _a, _b, _c;
8994
+ return this.moveTo((_c = (_b = (_a = this._control.activePanel) == null ? void 0 : _a.prev()) == null ? void 0 : _b.index) != null ? _c : -1, duration, DIRECTION.PREV);
8921
8995
  }
8922
8996
  /**
8923
8997
  * Move to the next panel (current index + 1).
@@ -8927,7 +9001,8 @@
8927
9001
  * @returns Promise that resolves after reaching the next panel
8928
9002
  */
8929
9003
  next(duration = this._duration) {
8930
- return this.moveTo(this._control.activePanel?.next()?.index ?? this._renderer.panelCount, duration, DIRECTION.NEXT);
9004
+ var _a, _b, _c;
9005
+ return this.moveTo((_c = (_b = (_a = this._control.activePanel) == null ? void 0 : _a.next()) == null ? void 0 : _b.index) != null ? _c : this._renderer.panelCount, duration, DIRECTION.NEXT);
8931
9006
  }
8932
9007
  /**
8933
9008
  * Move to the panel with the given index.
@@ -9038,6 +9113,7 @@
9038
9113
  * @returns Status object that can be used with {@link Flicking.setStatus} to restore the state
9039
9114
  */
9040
9115
  getStatus(options = {}) {
9116
+ var _a, _b;
9041
9117
  const { index = true, position = true, includePanelHTML = false, visiblePanelsOnly = false } = options;
9042
9118
  const camera = this._camera;
9043
9119
  const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
@@ -9064,7 +9140,7 @@
9064
9140
  }
9065
9141
  if (visiblePanelsOnly) {
9066
9142
  const visiblePanels = this.visiblePanels;
9067
- status.visibleOffset = visiblePanels[0]?.index ?? 0;
9143
+ status.visibleOffset = (_b = (_a = visiblePanels[0]) == null ? void 0 : _a.index) != null ? _b : 0;
9068
9144
  }
9069
9145
  return status;
9070
9146
  }
@@ -9074,13 +9150,14 @@
9074
9150
  * @throws {@link StatusRestoreErrors}
9075
9151
  */
9076
9152
  setStatus(status) {
9153
+ var _a;
9077
9154
  if (!this._initialized) {
9078
9155
  throw new FlickingError(MESSAGE.NOT_INITIALIZED, CODE.NOT_INITIALIZED);
9079
9156
  }
9080
9157
  const { index, position, visibleOffset, panels } = status;
9081
9158
  const renderer = this._renderer;
9082
9159
  const control = this._control;
9083
- if (panels[0]?.html && !this._renderExternal) {
9160
+ if (((_a = panels[0]) == null ? void 0 : _a.html) && !this._renderExternal) {
9084
9161
  renderer.batchRemove({
9085
9162
  index: 0,
9086
9163
  deleteCount: this.panels.length,
@@ -9142,78 +9219,80 @@
9142
9219
  * @fires {@link ResizeEvents}
9143
9220
  * @returns Promise that resolves when resize is complete
9144
9221
  */
9145
- async resize() {
9146
- if (!this._initialized) {
9147
- return;
9148
- }
9149
- if (this._isResizing) {
9150
- this._scheduleResize = true;
9151
- return;
9152
- }
9153
- this._scheduleResize = false;
9154
- this._isResizing = true;
9155
- const viewport = this._viewport;
9156
- const renderer = this._renderer;
9157
- const camera = this._camera;
9158
- const control = this._control;
9159
- const activePanel = control.activePanel;
9160
- const prevWidth = viewport.width;
9161
- const prevHeight = viewport.height;
9162
- const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
9163
- this.trigger(
9164
- new ComponentEvent$1(EVENTS.BEFORE_RESIZE, {
9165
- width: prevWidth,
9166
- height: prevHeight,
9167
- element: viewport.element
9168
- })
9169
- );
9170
- viewport.resize();
9171
- if (this._optimizeSizeUpdate) {
9172
- if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
9173
- await renderer.forceRenderAllPanels();
9222
+ resize() {
9223
+ return __async(this, null, function* () {
9224
+ if (!this._initialized) {
9225
+ return;
9174
9226
  }
9175
- } else {
9176
- await renderer.forceRenderAllPanels();
9177
- }
9178
- if (!this._initialized) {
9179
- return;
9180
- }
9181
- renderer.updatePanelSize();
9182
- camera.updateAlignPos();
9183
- camera.updateRange();
9184
- camera.updateAnchors();
9185
- camera.updateAdaptiveHeight();
9186
- camera.updatePanelOrder();
9187
- camera.updateOffset();
9188
- await renderer.render();
9189
- if (!this._initialized) {
9190
- return;
9191
- }
9192
- if (control.animating) ;
9193
- else {
9194
- control.updatePosition(prevProgressInPanel);
9195
- control.updateInput();
9196
- }
9197
- const newWidth = viewport.width;
9198
- const newHeight = viewport.height;
9199
- const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
9200
- this.trigger(
9201
- new ComponentEvent$1(EVENTS.AFTER_RESIZE, {
9202
- width: viewport.width,
9203
- height: viewport.height,
9204
- prev: {
9227
+ if (this._isResizing) {
9228
+ this._scheduleResize = true;
9229
+ return;
9230
+ }
9231
+ this._scheduleResize = false;
9232
+ this._isResizing = true;
9233
+ const viewport = this._viewport;
9234
+ const renderer = this._renderer;
9235
+ const camera = this._camera;
9236
+ const control = this._control;
9237
+ const activePanel = control.activePanel;
9238
+ const prevWidth = viewport.width;
9239
+ const prevHeight = viewport.height;
9240
+ const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
9241
+ this.trigger(
9242
+ new ComponentEvent$1(EVENTS.BEFORE_RESIZE, {
9205
9243
  width: prevWidth,
9206
- height: prevHeight
9207
- },
9208
- sizeChanged,
9209
- element: viewport.element
9210
- })
9211
- );
9212
- this._isResizing = false;
9213
- if (this._scheduleResize) {
9214
- void this.resize();
9215
- }
9216
- return;
9244
+ height: prevHeight,
9245
+ element: viewport.element
9246
+ })
9247
+ );
9248
+ viewport.resize();
9249
+ if (this._optimizeSizeUpdate) {
9250
+ if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
9251
+ yield renderer.forceRenderAllPanels();
9252
+ }
9253
+ } else {
9254
+ yield renderer.forceRenderAllPanels();
9255
+ }
9256
+ if (!this._initialized) {
9257
+ return;
9258
+ }
9259
+ renderer.updatePanelSize();
9260
+ camera.updateAlignPos();
9261
+ camera.updateRange();
9262
+ camera.updateAnchors();
9263
+ camera.updateAdaptiveHeight();
9264
+ camera.updatePanelOrder();
9265
+ camera.updateOffset();
9266
+ yield renderer.render();
9267
+ if (!this._initialized) {
9268
+ return;
9269
+ }
9270
+ if (control.animating) ;
9271
+ else {
9272
+ control.updatePosition(prevProgressInPanel);
9273
+ control.updateInput();
9274
+ }
9275
+ const newWidth = viewport.width;
9276
+ const newHeight = viewport.height;
9277
+ const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
9278
+ this.trigger(
9279
+ new ComponentEvent$1(EVENTS.AFTER_RESIZE, {
9280
+ width: viewport.width,
9281
+ height: viewport.height,
9282
+ prev: {
9283
+ width: prevWidth,
9284
+ height: prevHeight
9285
+ },
9286
+ sizeChanged,
9287
+ element: viewport.element
9288
+ })
9289
+ );
9290
+ this._isResizing = false;
9291
+ if (this._scheduleResize) {
9292
+ void this.resize();
9293
+ }
9294
+ return;
9295
+ });
9217
9296
  }
9218
9297
  /**
9219
9298
  * Add new panels after the last panel.
@@ -9302,10 +9381,11 @@
9302
9381
  * Throws error if moveType is invalid.
9303
9382
  */
9304
9383
  _createControl() {
9384
+ var _a;
9305
9385
  const moveType = this._moveType;
9306
9386
  const moveTypes = Object.keys(MOVE_TYPE).map((key) => MOVE_TYPE[key]);
9307
9387
  const moveTypeStr = Array.isArray(moveType) ? moveType[0] : moveType;
9308
- const moveTypeOptions = Array.isArray(moveType) ? moveType[1] ?? {} : {};
9388
+ const moveTypeOptions = Array.isArray(moveType) ? (_a = moveType[1]) != null ? _a : {} : {};
9309
9389
  if (!includes(moveTypes, moveTypeStr)) {
9310
9390
  throw new FlickingError(
9311
9391
  MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)),
@@ -9358,7 +9438,7 @@
9358
9438
  */
9359
9439
  _createExternalRenderer() {
9360
9440
  const { renderer, rendererOptions } = this._renderExternal;
9361
- return new renderer({ align: this._align, ...rendererOptions });
9441
+ return new renderer(__spreadValues({ align: this._align }, rendererOptions));
9362
9442
  }
9363
9443
  /**
9364
9444
  * Factory method to create VanillaRenderer for vanilla JavaScript rendering.
@@ -9449,7 +9529,7 @@
9449
9529
  );
9450
9530
  }
9451
9531
  };
9452
- _Flicking.VERSION = "4.16.0";
9532
+ _Flicking.VERSION = "4.16.1";
9453
9533
  let Flicking = _Flicking;
9454
9534
  const SIDE_EVENTS = {
9455
9535
  HOLD_START: "sideHoldStart",
@@ -9632,10 +9712,9 @@
9632
9712
  Object.keys(SIDE_EVENTS).forEach((name) => {
9633
9713
  flicking.on(EVENTS[name], (event) => {
9634
9714
  this.trigger(
9635
- new ComponentEvent$1(SIDE_EVENTS[name], {
9636
- mainIndex,
9637
- ...event
9638
- })
9715
+ new ComponentEvent$1(SIDE_EVENTS[name], __spreadValues({
9716
+ mainIndex
9717
+ }, event))
9639
9718
  );
9640
9719
  });
9641
9720
  });
@@ -9736,12 +9815,11 @@
9736
9815
  }
9737
9816
  _createSideFlicking() {
9738
9817
  return this.sideState.map((state, i) => {
9739
- return new Flicking(this.camera.children[i], {
9740
- ...this.sideOptions,
9818
+ return new Flicking(this.camera.children[i], __spreadProps(__spreadValues({}, this.sideOptions), {
9741
9819
  horizontal: false,
9742
9820
  panelsPerView: 1,
9743
9821
  defaultIndex: state.start
9744
- });
9822
+ }));
9745
9823
  });
9746
9824
  }
9747
9825
  }
@@ -9903,13 +9981,15 @@
9903
9981
  const getterDescriptor = {};
9904
9982
  if (descriptor.get) {
9905
9983
  getterDescriptor.get = function() {
9984
+ var _a;
9906
9985
  const flicking = this[flickingName];
9907
- return flicking && descriptor.get?.call(flicking);
9986
+ return flicking && ((_a = descriptor.get) == null ? void 0 : _a.call(flicking));
9908
9987
  };
9909
9988
  }
9910
9989
  if (descriptor.set) {
9911
9990
  getterDescriptor.set = function(...args) {
9912
- return descriptor.set?.call(this[flickingName], ...args);
9991
+ var _a;
9992
+ return (_a = descriptor.set) == null ? void 0 : _a.call(this[flickingName], ...args);
9913
9993
  };
9914
9994
  }
9915
9995
  Object.defineProperty(prototype, name, getterDescriptor);
@@ -9970,12 +10050,13 @@
9970
10050
  return indexProgress;
9971
10051
  };
9972
10052
  const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps }) => {
10053
+ var _a, _b, _c;
9973
10054
  let flicking;
9974
10055
  const moveTo = (i) => {
9975
10056
  if (flicking == null) {
9976
10057
  return Promise.reject(new Error("Flicking instance is not available"));
9977
10058
  }
9978
- if (flicking?.animating) {
10059
+ if (flicking == null ? void 0 : flicking.animating) {
9979
10060
  return Promise.resolve();
9980
10061
  }
9981
10062
  return flicking.moveTo(i);
@@ -9983,12 +10064,12 @@
9983
10064
  setMethods(["moveTo"]);
9984
10065
  const options = getProps().options;
9985
10066
  const reactiveObj = reactive({
9986
- isReachStart: options?.defaultIndex ? options?.defaultIndex === 0 : true,
9987
- isReachEnd: options?.totalPanelCount && options?.defaultIndex ? options.defaultIndex === options.totalPanelCount - 1 : false,
9988
- totalPanelCount: options?.totalPanelCount ?? 0,
9989
- currentPanelIndex: options?.defaultIndex ?? 0,
10067
+ isReachStart: (options == null ? void 0 : options.defaultIndex) ? (options == null ? void 0 : options.defaultIndex) === 0 : true,
10068
+ isReachEnd: (options == null ? void 0 : options.totalPanelCount) && (options == null ? void 0 : options.defaultIndex) ? options.defaultIndex === options.totalPanelCount - 1 : false,
10069
+ totalPanelCount: (_a = options == null ? void 0 : options.totalPanelCount) != null ? _a : 0,
10070
+ currentPanelIndex: (_b = options == null ? void 0 : options.defaultIndex) != null ? _b : 0,
9990
10071
  progress: 0,
9991
- indexProgress: options?.defaultIndex ?? 0,
10072
+ indexProgress: (_c = options == null ? void 0 : options.defaultIndex) != null ? _c : 0,
9992
10073
  moveTo
9993
10074
  });
9994
10075
  const onChanged = () => {
@@ -10015,14 +10096,14 @@
10015
10096
  reactiveObj.currentPanelIndex = getCurrentPanelIndex(flicking);
10016
10097
  reactiveObj.progress = getProgress(flicking);
10017
10098
  reactiveObj.totalPanelCount = getTotalPanelCount(flicking);
10018
- flicking?.on("changed", onChanged);
10019
- flicking?.on("panelChange", onPanelChange);
10020
- flicking?.on("move", onMove);
10099
+ flicking == null ? void 0 : flicking.on("changed", onChanged);
10100
+ flicking == null ? void 0 : flicking.on("panelChange", onPanelChange);
10101
+ flicking == null ? void 0 : flicking.on("move", onMove);
10021
10102
  });
10022
10103
  onDestroy(() => {
10023
- flicking?.off("changed", onChanged);
10024
- flicking?.off("panelChange", onPanelChange);
10025
- flicking?.off("move", onMove);
10104
+ flicking == null ? void 0 : flicking.off("changed", onChanged);
10105
+ flicking == null ? void 0 : flicking.off("panelChange", onPanelChange);
10106
+ flicking == null ? void 0 : flicking.off("move", onMove);
10026
10107
  });
10027
10108
  return reactiveObj;
10028
10109
  };
@@ -10038,7 +10119,7 @@
10038
10119
  connectFlickingReactiveAPI,
10039
10120
  flickingReactiveAPIAdapter
10040
10121
  }, Symbol.toStringTag, { value: "Module" }));
10041
- const Constants = { ...Events, ...Values };
10122
+ const Constants = __spreadValues(__spreadValues({}, Events), Values);
10042
10123
  merge(Flicking, Core);
10043
10124
  merge(Flicking, Camera);
10044
10125
  merge(Flicking, Control);