@egjs/flicking 4.16.0 → 4.16.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flicking.cjs.js +271 -190
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +271 -190
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +273 -192
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +1 -1
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +273 -192
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +1 -1
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/flicking.esm.js
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __reflectGet = Reflect.get;
|
|
9
|
+
var __pow = Math.pow;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
var fulfilled = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.next(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var rejected = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.throw(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
1
44
|
import Component, { ComponentEvent } from "@egjs/component";
|
|
2
45
|
import Axes, { PanInput } from "@egjs/axes";
|
|
3
46
|
import ImReady from "@egjs/imready";
|
|
@@ -830,10 +873,11 @@ class LinearCameraMode extends CameraMode {
|
|
|
830
873
|
return true;
|
|
831
874
|
}
|
|
832
875
|
getRange() {
|
|
876
|
+
var _a, _b;
|
|
833
877
|
const renderer = this._flicking.renderer;
|
|
834
878
|
const firstPanel = renderer.getPanel(0);
|
|
835
879
|
const lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
836
|
-
return { min: firstPanel
|
|
880
|
+
return { min: (_a = firstPanel == null ? void 0 : firstPanel.position) != null ? _a : 0, max: (_b = lastPanel == null ? void 0 : lastPanel.position) != null ? _b : 0 };
|
|
837
881
|
}
|
|
838
882
|
}
|
|
839
883
|
class Camera {
|
|
@@ -1162,10 +1206,11 @@ class Camera {
|
|
|
1162
1206
|
* @returns The {@link AnchorPoint} that matches current panel
|
|
1163
1207
|
*/
|
|
1164
1208
|
findActiveAnchor() {
|
|
1209
|
+
var _a;
|
|
1165
1210
|
const flicking = getFlickingAttached(this._flicking);
|
|
1166
1211
|
const activePanel = flicking.control.activePanel;
|
|
1167
1212
|
if (!activePanel) return null;
|
|
1168
|
-
return find(this._anchors, (anchor) => anchor.panel.index === activePanel.index)
|
|
1213
|
+
return (_a = find(this._anchors, (anchor) => anchor.panel.index === activePanel.index)) != null ? _a : this.findNearestAnchor(activePanel.position);
|
|
1169
1214
|
}
|
|
1170
1215
|
/**
|
|
1171
1216
|
* Clamp the given position between camera's range
|
|
@@ -1796,7 +1841,7 @@ class StateMachine {
|
|
|
1796
1841
|
}
|
|
1797
1842
|
fire(eventType, externalCtx) {
|
|
1798
1843
|
const currentState = this._state;
|
|
1799
|
-
const ctx = {
|
|
1844
|
+
const ctx = __spreadProps(__spreadValues({}, externalCtx), { transitTo: this.transitTo });
|
|
1800
1845
|
switch (eventType) {
|
|
1801
1846
|
case EVENT.HOLD:
|
|
1802
1847
|
currentState.onHold(ctx);
|
|
@@ -1822,7 +1867,8 @@ class AxesController {
|
|
|
1822
1867
|
this._dragged = false;
|
|
1823
1868
|
};
|
|
1824
1869
|
this._onAxesChange = () => {
|
|
1825
|
-
|
|
1870
|
+
var _a;
|
|
1871
|
+
this._dragged = !!((_a = this._panInput) == null ? void 0 : _a.isEnabled());
|
|
1826
1872
|
};
|
|
1827
1873
|
this._preventClickWhenDragged = (e) => {
|
|
1828
1874
|
if (this._dragged) {
|
|
@@ -1893,28 +1939,32 @@ class AxesController {
|
|
|
1893
1939
|
* @readonly
|
|
1894
1940
|
*/
|
|
1895
1941
|
get enabled() {
|
|
1896
|
-
|
|
1942
|
+
var _a, _b;
|
|
1943
|
+
return (_b = (_a = this._panInput) == null ? void 0 : _a.isEnabled()) != null ? _b : false;
|
|
1897
1944
|
}
|
|
1898
1945
|
/**
|
|
1899
1946
|
* Current position value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
1900
1947
|
* @readonly
|
|
1901
1948
|
*/
|
|
1902
1949
|
get position() {
|
|
1903
|
-
|
|
1950
|
+
var _a, _b;
|
|
1951
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
|
|
1904
1952
|
}
|
|
1905
1953
|
/**
|
|
1906
1954
|
* Current range value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
1907
1955
|
* @readonly
|
|
1908
1956
|
*/
|
|
1909
1957
|
get range() {
|
|
1910
|
-
|
|
1958
|
+
var _a, _b;
|
|
1959
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].range) != null ? _b : [0, 0];
|
|
1911
1960
|
}
|
|
1912
1961
|
/**
|
|
1913
1962
|
* Actual bounce size(px)
|
|
1914
1963
|
* @readonly
|
|
1915
1964
|
*/
|
|
1916
1965
|
get bounce() {
|
|
1917
|
-
|
|
1966
|
+
var _a;
|
|
1967
|
+
return (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].bounce;
|
|
1918
1968
|
}
|
|
1919
1969
|
/**
|
|
1920
1970
|
* Initialize AxesController
|
|
@@ -1967,11 +2017,12 @@ class AxesController {
|
|
|
1967
2017
|
* This method destroys the Axes and PanInput instances and removes all event handlers.
|
|
1968
2018
|
*/
|
|
1969
2019
|
destroy() {
|
|
2020
|
+
var _a;
|
|
1970
2021
|
if (this._axes) {
|
|
1971
2022
|
this.removePreventClickHandler();
|
|
1972
2023
|
this._axes.destroy();
|
|
1973
2024
|
}
|
|
1974
|
-
this._panInput
|
|
2025
|
+
(_a = this._panInput) == null ? void 0 : _a.destroy();
|
|
1975
2026
|
this._resetInternalValues();
|
|
1976
2027
|
}
|
|
1977
2028
|
/**
|
|
@@ -1981,7 +2032,8 @@ class AxesController {
|
|
|
1981
2032
|
* @returns The current instance for method chaining
|
|
1982
2033
|
*/
|
|
1983
2034
|
enable() {
|
|
1984
|
-
|
|
2035
|
+
var _a;
|
|
2036
|
+
(_a = this._panInput) == null ? void 0 : _a.enable();
|
|
1985
2037
|
return this;
|
|
1986
2038
|
}
|
|
1987
2039
|
/**
|
|
@@ -1991,7 +2043,8 @@ class AxesController {
|
|
|
1991
2043
|
* @returns The current instance for method chaining
|
|
1992
2044
|
*/
|
|
1993
2045
|
disable() {
|
|
1994
|
-
|
|
2046
|
+
var _a;
|
|
2047
|
+
(_a = this._panInput) == null ? void 0 : _a.disable();
|
|
1995
2048
|
return this;
|
|
1996
2049
|
}
|
|
1997
2050
|
/**
|
|
@@ -2001,7 +2054,8 @@ class AxesController {
|
|
|
2001
2054
|
* @returns The current instance for method chaining
|
|
2002
2055
|
*/
|
|
2003
2056
|
release() {
|
|
2004
|
-
|
|
2057
|
+
var _a;
|
|
2058
|
+
(_a = this._panInput) == null ? void 0 : _a.release();
|
|
2005
2059
|
return this;
|
|
2006
2060
|
}
|
|
2007
2061
|
/**
|
|
@@ -2013,11 +2067,11 @@ class AxesController {
|
|
|
2013
2067
|
* @returns The current instance for method chaining
|
|
2014
2068
|
*/
|
|
2015
2069
|
updateAnimation(position, duration) {
|
|
2016
|
-
|
|
2017
|
-
|
|
2070
|
+
var _a;
|
|
2071
|
+
this._animatingContext = __spreadProps(__spreadValues({}, this._animatingContext), {
|
|
2018
2072
|
end: position
|
|
2019
|
-
};
|
|
2020
|
-
this._axes
|
|
2073
|
+
});
|
|
2074
|
+
(_a = this._axes) == null ? void 0 : _a.updateAnimation({
|
|
2021
2075
|
destPos: { [POSITION_KEY]: position },
|
|
2022
2076
|
duration
|
|
2023
2077
|
});
|
|
@@ -2030,7 +2084,8 @@ class AxesController {
|
|
|
2030
2084
|
* @returns The current instance for method chaining
|
|
2031
2085
|
*/
|
|
2032
2086
|
stopAnimation() {
|
|
2033
|
-
|
|
2087
|
+
var _a;
|
|
2088
|
+
(_a = this._axes) == null ? void 0 : _a.stopAnimation();
|
|
2034
2089
|
return this;
|
|
2035
2090
|
}
|
|
2036
2091
|
/**
|
|
@@ -2093,6 +2148,7 @@ class AxesController {
|
|
|
2093
2148
|
* @returns A Promise which will be resolved after reaching the target position
|
|
2094
2149
|
*/
|
|
2095
2150
|
animateTo(position, duration, axesEvent) {
|
|
2151
|
+
var _a;
|
|
2096
2152
|
const axes = this._axes;
|
|
2097
2153
|
const state = this._stateMachine.state;
|
|
2098
2154
|
if (!axes) {
|
|
@@ -2105,7 +2161,7 @@ class AxesController {
|
|
|
2105
2161
|
const flicking = getFlickingAttached(this._flicking);
|
|
2106
2162
|
flicking.camera.lookAt(position);
|
|
2107
2163
|
if (state.targetPanel) {
|
|
2108
|
-
flicking.control.setActive(state.targetPanel, flicking.control.activePanel, axesEvent
|
|
2164
|
+
flicking.control.setActive(state.targetPanel, flicking.control.activePanel, (_a = axesEvent == null ? void 0 : axesEvent.isTrusted) != null ? _a : false);
|
|
2109
2165
|
}
|
|
2110
2166
|
return Promise.resolve();
|
|
2111
2167
|
}
|
|
@@ -2143,7 +2199,8 @@ class AxesController {
|
|
|
2143
2199
|
* Returns the current axes position
|
|
2144
2200
|
*/
|
|
2145
2201
|
getCurrentPosition() {
|
|
2146
|
-
|
|
2202
|
+
var _a, _b;
|
|
2203
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
|
|
2147
2204
|
}
|
|
2148
2205
|
updateDirection() {
|
|
2149
2206
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -2180,7 +2237,8 @@ class Control {
|
|
|
2180
2237
|
* @readonly
|
|
2181
2238
|
*/
|
|
2182
2239
|
get activeIndex() {
|
|
2183
|
-
|
|
2240
|
+
var _a, _b;
|
|
2241
|
+
return (_b = (_a = this._activePanel) == null ? void 0 : _a.index) != null ? _b : -1;
|
|
2184
2242
|
}
|
|
2185
2243
|
/**
|
|
2186
2244
|
* An active panel
|
|
@@ -2272,7 +2330,7 @@ class Control {
|
|
|
2272
2330
|
*/
|
|
2273
2331
|
updateAnimation(panel, duration, direction) {
|
|
2274
2332
|
const state = this._controller.state;
|
|
2275
|
-
const position = this._getPosition(panel, direction
|
|
2333
|
+
const position = this._getPosition(panel, direction != null ? direction : DIRECTION.NONE);
|
|
2276
2334
|
state.targetPanel = panel;
|
|
2277
2335
|
this._controller.updateAnimation(position, duration);
|
|
2278
2336
|
return this;
|
|
@@ -2334,10 +2392,12 @@ class Control {
|
|
|
2334
2392
|
* @throws {@link MovementErrors}
|
|
2335
2393
|
* @returns A Promise which will be resolved after reaching the target panel
|
|
2336
2394
|
*/
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2395
|
+
moveToPanel(_0, _1) {
|
|
2396
|
+
return __async(this, arguments, function* (panel, { duration, direction = DIRECTION.NONE, axesEvent }) {
|
|
2397
|
+
const position = this._getPosition(panel, direction);
|
|
2398
|
+
this._triggerIndexChangeEvent(panel, panel.position, axesEvent, direction);
|
|
2399
|
+
return this._animateToPosition({ position, duration, newActivePanel: panel, axesEvent });
|
|
2400
|
+
});
|
|
2341
2401
|
}
|
|
2342
2402
|
/**
|
|
2343
2403
|
* @internal
|
|
@@ -2345,6 +2405,7 @@ class Control {
|
|
|
2345
2405
|
* Sets the active panel and triggers {@link ChangedEvent} or {@link RestoredEvent} based on whether the panel changed.
|
|
2346
2406
|
*/
|
|
2347
2407
|
setActive(newActivePanel, prevActivePanel, isTrusted) {
|
|
2408
|
+
var _a;
|
|
2348
2409
|
const flicking = getFlickingAttached(this._flicking);
|
|
2349
2410
|
this._activePanel = newActivePanel;
|
|
2350
2411
|
this._nextPanel = null;
|
|
@@ -2354,7 +2415,7 @@ class Control {
|
|
|
2354
2415
|
new ComponentEvent(EVENTS.CHANGED, {
|
|
2355
2416
|
index: newActivePanel.index,
|
|
2356
2417
|
panel: newActivePanel,
|
|
2357
|
-
prevIndex: prevActivePanel
|
|
2418
|
+
prevIndex: (_a = prevActivePanel == null ? void 0 : prevActivePanel.index) != null ? _a : -1,
|
|
2358
2419
|
prevPanel: prevActivePanel,
|
|
2359
2420
|
isTrusted,
|
|
2360
2421
|
direction: prevActivePanel ? getDirection(prevActivePanel.position, newActivePanel.position) : DIRECTION.NONE
|
|
@@ -2384,6 +2445,7 @@ class Control {
|
|
|
2384
2445
|
* Triggers {@link WillChangeEvent} or {@link WillRestoreEvent} based on whether the target panel differs from the active panel.
|
|
2385
2446
|
*/
|
|
2386
2447
|
_triggerIndexChangeEvent(panel, position, axesEvent, direction) {
|
|
2448
|
+
var _a;
|
|
2387
2449
|
const flicking = getFlickingAttached(this._flicking);
|
|
2388
2450
|
const triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
|
|
2389
2451
|
const camera = flicking.camera;
|
|
@@ -2391,8 +2453,8 @@ class Control {
|
|
|
2391
2453
|
const event = new ComponentEvent(triggeringEvent, {
|
|
2392
2454
|
index: panel.index,
|
|
2393
2455
|
panel,
|
|
2394
|
-
isTrusted: axesEvent
|
|
2395
|
-
direction: direction
|
|
2456
|
+
isTrusted: (axesEvent == null ? void 0 : axesEvent.isTrusted) || false,
|
|
2457
|
+
direction: direction != null ? direction : getDirection((_a = activePanel == null ? void 0 : activePanel.position) != null ? _a : camera.position, position)
|
|
2396
2458
|
});
|
|
2397
2459
|
this._nextPanel = panel;
|
|
2398
2460
|
flicking.trigger(event);
|
|
@@ -2405,32 +2467,34 @@ class Control {
|
|
|
2405
2467
|
* @privateRemarks
|
|
2406
2468
|
* Animates the camera to the target position and handles animation completion or interruption.
|
|
2407
2469
|
*/
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
nextDuration
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2470
|
+
_animateToPosition(_0) {
|
|
2471
|
+
return __async(this, arguments, function* ({
|
|
2472
|
+
position,
|
|
2473
|
+
duration,
|
|
2474
|
+
newActivePanel,
|
|
2475
|
+
axesEvent
|
|
2476
|
+
}) {
|
|
2477
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
2478
|
+
let nextDuration = duration;
|
|
2479
|
+
if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
|
|
2480
|
+
nextDuration = 0;
|
|
2481
|
+
}
|
|
2482
|
+
const animate = () => this._controller.animateTo(position, nextDuration, axesEvent);
|
|
2483
|
+
const state = this._controller.state;
|
|
2484
|
+
state.targetPanel = newActivePanel;
|
|
2485
|
+
if (nextDuration <= 0) {
|
|
2486
|
+
return animate();
|
|
2487
|
+
} else {
|
|
2488
|
+
return animate().then(() => __async(this, null, function* () {
|
|
2489
|
+
if (flicking.initialized) {
|
|
2490
|
+
yield flicking.renderer.render();
|
|
2491
|
+
}
|
|
2492
|
+
})).catch((err) => {
|
|
2493
|
+
if (axesEvent && err instanceof FlickingError && err.code === CODE.ANIMATION_INTERRUPTED) return;
|
|
2494
|
+
throw err;
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2434
2498
|
}
|
|
2435
2499
|
/**
|
|
2436
2500
|
* @internal
|
|
@@ -2652,6 +2716,7 @@ class SnapControl extends Control {
|
|
|
2652
2716
|
* Finds the adjacent anchor point based on the movement direction.
|
|
2653
2717
|
*/
|
|
2654
2718
|
_findAdjacentAnchor(position, posDelta, anchorAtCamera) {
|
|
2719
|
+
var _a;
|
|
2655
2720
|
const flicking = getFlickingAttached(this._flicking);
|
|
2656
2721
|
const camera = flicking.camera;
|
|
2657
2722
|
if (camera.circularEnabled) {
|
|
@@ -2660,7 +2725,7 @@ class SnapControl extends Control {
|
|
|
2660
2725
|
return anchorIncludePosition;
|
|
2661
2726
|
}
|
|
2662
2727
|
}
|
|
2663
|
-
const adjacentAnchor = (posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera))
|
|
2728
|
+
const adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) != null ? _a : anchorAtCamera;
|
|
2664
2729
|
return adjacentAnchor;
|
|
2665
2730
|
}
|
|
2666
2731
|
/**
|
|
@@ -2716,13 +2781,14 @@ class StrictControl extends Control {
|
|
|
2716
2781
|
* @returns The current instance for method chaining
|
|
2717
2782
|
*/
|
|
2718
2783
|
updateInput() {
|
|
2784
|
+
var _a;
|
|
2719
2785
|
const flicking = getFlickingAttached(this._flicking);
|
|
2720
2786
|
const camera = flicking.camera;
|
|
2721
2787
|
const renderer = flicking.renderer;
|
|
2722
2788
|
const controller = this._controller;
|
|
2723
2789
|
const controlParams = camera.controlParams;
|
|
2724
2790
|
const count = this._count;
|
|
2725
|
-
const activePanel = controller.state.animating ? camera.findNearestAnchor(camera.position)
|
|
2791
|
+
const activePanel = controller.state.animating ? (_a = camera.findNearestAnchor(camera.position)) == null ? void 0 : _a.panel : this._activePanel;
|
|
2726
2792
|
if (!activePanel) {
|
|
2727
2793
|
controller.update(controlParams);
|
|
2728
2794
|
this._resetIndexRange();
|
|
@@ -2770,12 +2836,14 @@ class StrictControl extends Control {
|
|
|
2770
2836
|
};
|
|
2771
2837
|
return this;
|
|
2772
2838
|
}
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2839
|
+
moveToPanel(panel, options) {
|
|
2840
|
+
return __async(this, null, function* () {
|
|
2841
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
2842
|
+
const camera = flicking.camera;
|
|
2843
|
+
const controller = this._controller;
|
|
2844
|
+
controller.update(camera.controlParams);
|
|
2845
|
+
return __superGet(StrictControl.prototype, this, "moveToPanel").call(this, panel, options);
|
|
2846
|
+
});
|
|
2779
2847
|
}
|
|
2780
2848
|
/**
|
|
2781
2849
|
* Move {@link Camera} to the given position
|
|
@@ -2789,9 +2857,10 @@ class StrictControl extends Control {
|
|
|
2789
2857
|
* @returns A Promise which will be resolved after reaching the target position
|
|
2790
2858
|
*/
|
|
2791
2859
|
moveToPosition(position, duration, axesEvent) {
|
|
2860
|
+
var _a;
|
|
2792
2861
|
const flicking = getFlickingAttached(this._flicking);
|
|
2793
2862
|
const camera = flicking.camera;
|
|
2794
|
-
const currentPanel = this._nextPanel
|
|
2863
|
+
const currentPanel = (_a = this._nextPanel) != null ? _a : this._activePanel;
|
|
2795
2864
|
const axesRange = this._controller.range;
|
|
2796
2865
|
const indexRange = this._indexRange;
|
|
2797
2866
|
const cameraRange = camera.range;
|
|
@@ -3195,11 +3264,12 @@ class VirtualManager {
|
|
|
3195
3264
|
this._panelClass = val;
|
|
3196
3265
|
}
|
|
3197
3266
|
constructor(flicking, options) {
|
|
3267
|
+
var _a, _b, _c, _d;
|
|
3198
3268
|
this._flicking = flicking;
|
|
3199
|
-
this._renderPanel = options
|
|
3200
|
-
this._initialPanelCount = options
|
|
3201
|
-
this._cache = options
|
|
3202
|
-
this._panelClass = options
|
|
3269
|
+
this._renderPanel = (_a = options == null ? void 0 : options.renderPanel) != null ? _a : (() => "");
|
|
3270
|
+
this._initialPanelCount = (_b = options == null ? void 0 : options.initialPanelCount) != null ? _b : -1;
|
|
3271
|
+
this._cache = (_c = options == null ? void 0 : options.cache) != null ? _c : false;
|
|
3272
|
+
this._panelClass = (_d = options == null ? void 0 : options.panelClass) != null ? _d : CLASS.DEFAULT_VIRTUAL;
|
|
3203
3273
|
this._elements = [];
|
|
3204
3274
|
}
|
|
3205
3275
|
init() {
|
|
@@ -3425,6 +3495,7 @@ class Renderer {
|
|
|
3425
3495
|
const prevFirstPanel = panels[0];
|
|
3426
3496
|
const align = parsePanelAlign(this._align);
|
|
3427
3497
|
const allPanelsInserted = items.reduce((addedPanels, item) => {
|
|
3498
|
+
var _a;
|
|
3428
3499
|
const insertingIdx = getMinusCompensatedIndex(item.index, panels.length);
|
|
3429
3500
|
const panelsPushed = panels.slice(insertingIdx);
|
|
3430
3501
|
const panelsInserted = item.elements.map(
|
|
@@ -3432,7 +3503,7 @@ class Renderer {
|
|
|
3432
3503
|
);
|
|
3433
3504
|
panels.splice(insertingIdx, 0, ...panelsInserted);
|
|
3434
3505
|
if (item.hasDOMInElements) {
|
|
3435
|
-
this._insertPanelElements(panelsInserted, panelsPushed[0]
|
|
3506
|
+
this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) != null ? _a : null);
|
|
3436
3507
|
}
|
|
3437
3508
|
if (flicking.panelsPerView > 0) {
|
|
3438
3509
|
const firstPanel = prevFirstPanel || panelsInserted[0].resize();
|
|
@@ -3499,6 +3570,7 @@ class Renderer {
|
|
|
3499
3570
|
* Updates camera, control, and triggers {@link PanelChangeEvent} after panels are added or removed.
|
|
3500
3571
|
*/
|
|
3501
3572
|
updateAfterPanelChange(panelsAdded, panelsRemoved) {
|
|
3573
|
+
var _a;
|
|
3502
3574
|
const flicking = getFlickingAttached(this._flicking);
|
|
3503
3575
|
const { camera, control } = flicking;
|
|
3504
3576
|
const panels = this._panels;
|
|
@@ -3522,7 +3594,7 @@ class Renderer {
|
|
|
3522
3594
|
if (panels.length <= 0) {
|
|
3523
3595
|
camera.lookAt(0);
|
|
3524
3596
|
} else {
|
|
3525
|
-
let targetIndex = activePanel
|
|
3597
|
+
let targetIndex = (_a = activePanel == null ? void 0 : activePanel.index) != null ? _a : 0;
|
|
3526
3598
|
if (targetIndex > panels.length - 1) {
|
|
3527
3599
|
targetIndex = panels.length - 1;
|
|
3528
3600
|
}
|
|
@@ -3652,11 +3724,10 @@ class Renderer {
|
|
|
3652
3724
|
const gap = referencePanel.margin.prev + referencePanel.margin.next;
|
|
3653
3725
|
const panelSize = (viewportSize - gap * (panelsPerView - 1)) / panelsPerView;
|
|
3654
3726
|
const panelSizeObj = flicking.horizontal ? { width: panelSize } : { height: panelSize };
|
|
3655
|
-
const firstPanelSizeObj = {
|
|
3727
|
+
const firstPanelSizeObj = __spreadValues({
|
|
3656
3728
|
size: panelSize,
|
|
3657
|
-
margin: referencePanel.margin
|
|
3658
|
-
|
|
3659
|
-
};
|
|
3729
|
+
margin: referencePanel.margin
|
|
3730
|
+
}, !flicking.horizontal && { height: referencePanel.height });
|
|
3660
3731
|
if (!flicking.noPanelStyleOverride) {
|
|
3661
3732
|
this._strategy.updatePanelSizes(flicking, panelSizeObj);
|
|
3662
3733
|
}
|
|
@@ -3683,7 +3754,7 @@ class Renderer {
|
|
|
3683
3754
|
const flicking = getFlickingAttached(this._flicking);
|
|
3684
3755
|
const camera = flicking.camera;
|
|
3685
3756
|
const cameraElement = camera.element;
|
|
3686
|
-
const nextSiblingElement = nextSibling
|
|
3757
|
+
const nextSiblingElement = (nextSibling == null ? void 0 : nextSibling.element) || null;
|
|
3687
3758
|
const fragment = document.createDocumentFragment();
|
|
3688
3759
|
panels.forEach((panel) => fragment.appendChild(panel.element));
|
|
3689
3760
|
cameraElement.insertBefore(fragment, nextSiblingElement);
|
|
@@ -3728,13 +3799,15 @@ class ExternalRenderer extends Renderer {
|
|
|
3728
3799
|
}
|
|
3729
3800
|
class VanillaRenderer extends Renderer {
|
|
3730
3801
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3802
|
+
render() {
|
|
3803
|
+
return __async(this, null, function* () {
|
|
3804
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
3805
|
+
const strategy = this._strategy;
|
|
3806
|
+
strategy.updateRenderingPanels(flicking);
|
|
3807
|
+
strategy.renderPanels(flicking);
|
|
3808
|
+
this._resetPanelElementOrder();
|
|
3809
|
+
this._afterRender();
|
|
3810
|
+
});
|
|
3738
3811
|
}
|
|
3739
3812
|
_collectPanels() {
|
|
3740
3813
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -4006,6 +4079,7 @@ class Panel {
|
|
|
4006
4079
|
* @returns The current instance for method chaining
|
|
4007
4080
|
*/
|
|
4008
4081
|
resize(cached) {
|
|
4082
|
+
var _a;
|
|
4009
4083
|
const el = this.element;
|
|
4010
4084
|
const flicking = this._flicking;
|
|
4011
4085
|
const { horizontal, useFractionalSize } = flicking;
|
|
@@ -4014,8 +4088,8 @@ class Panel {
|
|
|
4014
4088
|
}
|
|
4015
4089
|
if (cached) {
|
|
4016
4090
|
this._size = cached.size;
|
|
4017
|
-
this._margin = {
|
|
4018
|
-
this._height = cached.height
|
|
4091
|
+
this._margin = __spreadValues({}, cached.margin);
|
|
4092
|
+
this._height = (_a = cached.height) != null ? _a : getElementSize({
|
|
4019
4093
|
el,
|
|
4020
4094
|
horizontal: false,
|
|
4021
4095
|
useFractionalSize,
|
|
@@ -4069,7 +4143,8 @@ class Panel {
|
|
|
4069
4143
|
* @returns A Boolean value indicating the element is inside of this panel {@link Panel.element | element}
|
|
4070
4144
|
*/
|
|
4071
4145
|
contains(element) {
|
|
4072
|
-
|
|
4146
|
+
var _a;
|
|
4147
|
+
return !!((_a = this.element) == null ? void 0 : _a.contains(element));
|
|
4073
4148
|
}
|
|
4074
4149
|
/**
|
|
4075
4150
|
* Reset internal state and set {@link Panel.removed | removed} to `true`
|
|
@@ -4304,10 +4379,9 @@ class NormalRenderingStrategy {
|
|
|
4304
4379
|
);
|
|
4305
4380
|
}
|
|
4306
4381
|
createPanel(element, options) {
|
|
4307
|
-
return new Panel({
|
|
4308
|
-
...options,
|
|
4382
|
+
return new Panel(__spreadProps(__spreadValues({}, options), {
|
|
4309
4383
|
elementProvider: new this._providerCtor(element)
|
|
4310
|
-
});
|
|
4384
|
+
}));
|
|
4311
4385
|
}
|
|
4312
4386
|
updatePanelSizes(flicking, size) {
|
|
4313
4387
|
flicking.panels.forEach((panel) => panel.setSize(size));
|
|
@@ -4418,7 +4492,7 @@ class VirtualRenderingStrategy {
|
|
|
4418
4492
|
});
|
|
4419
4493
|
if (visiblePanels.length <= 0) return virtualManager.elements.map((_, idx) => idx);
|
|
4420
4494
|
const visibleIndexes = visiblePanels.map((panel) => panel.elementIndex);
|
|
4421
|
-
const invisibleIndexes = virtualManager.elements.map((el, idx) => ({
|
|
4495
|
+
const invisibleIndexes = virtualManager.elements.map((el, idx) => __spreadProps(__spreadValues({}, el), { idx })).filter((el) => !el.visible).map((el) => el.idx);
|
|
4422
4496
|
return [...visibleIndexes, ...invisibleIndexes];
|
|
4423
4497
|
}
|
|
4424
4498
|
getRenderingElementsByOrder(flicking) {
|
|
@@ -4454,10 +4528,9 @@ class VirtualRenderingStrategy {
|
|
|
4454
4528
|
);
|
|
4455
4529
|
}
|
|
4456
4530
|
createPanel(_el, options) {
|
|
4457
|
-
return new VirtualPanel({
|
|
4458
|
-
...options,
|
|
4531
|
+
return new VirtualPanel(__spreadProps(__spreadValues({}, options), {
|
|
4459
4532
|
elementProvider: new VirtualElementProvider(options.flicking)
|
|
4460
|
-
});
|
|
4533
|
+
}));
|
|
4461
4534
|
}
|
|
4462
4535
|
updatePanelSizes(flicking, size) {
|
|
4463
4536
|
flicking.virtual.elements.forEach((el) => {
|
|
@@ -4501,7 +4574,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
4501
4574
|
preventEventsBeforeInit = true,
|
|
4502
4575
|
deceleration = 75e-4,
|
|
4503
4576
|
duration = 500,
|
|
4504
|
-
easing = (x) => 1 - (1 - x
|
|
4577
|
+
easing = (x) => 1 - __pow(1 - x, 3),
|
|
4505
4578
|
inputType = ["mouse", "touch"],
|
|
4506
4579
|
moveType = "snap",
|
|
4507
4580
|
threshold = 40,
|
|
@@ -5356,7 +5429,8 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5356
5429
|
* @returns Promise that resolves after reaching the previous panel
|
|
5357
5430
|
*/
|
|
5358
5431
|
prev(duration = this._duration) {
|
|
5359
|
-
|
|
5432
|
+
var _a, _b, _c;
|
|
5433
|
+
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);
|
|
5360
5434
|
}
|
|
5361
5435
|
/**
|
|
5362
5436
|
* Move to the next panel (current index + 1).
|
|
@@ -5366,7 +5440,8 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5366
5440
|
* @returns Promise that resolves after reaching the next panel
|
|
5367
5441
|
*/
|
|
5368
5442
|
next(duration = this._duration) {
|
|
5369
|
-
|
|
5443
|
+
var _a, _b, _c;
|
|
5444
|
+
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);
|
|
5370
5445
|
}
|
|
5371
5446
|
/**
|
|
5372
5447
|
* Move to the panel with the given index.
|
|
@@ -5477,6 +5552,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5477
5552
|
* @returns Status object that can be used with {@link Flicking.setStatus} to restore the state
|
|
5478
5553
|
*/
|
|
5479
5554
|
getStatus(options = {}) {
|
|
5555
|
+
var _a, _b;
|
|
5480
5556
|
const { index = true, position = true, includePanelHTML = false, visiblePanelsOnly = false } = options;
|
|
5481
5557
|
const camera = this._camera;
|
|
5482
5558
|
const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
|
|
@@ -5503,7 +5579,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5503
5579
|
}
|
|
5504
5580
|
if (visiblePanelsOnly) {
|
|
5505
5581
|
const visiblePanels = this.visiblePanels;
|
|
5506
|
-
status.visibleOffset = visiblePanels[0]
|
|
5582
|
+
status.visibleOffset = (_b = (_a = visiblePanels[0]) == null ? void 0 : _a.index) != null ? _b : 0;
|
|
5507
5583
|
}
|
|
5508
5584
|
return status;
|
|
5509
5585
|
}
|
|
@@ -5513,13 +5589,14 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5513
5589
|
* @throws {@link StatusRestoreErrors}
|
|
5514
5590
|
*/
|
|
5515
5591
|
setStatus(status) {
|
|
5592
|
+
var _a;
|
|
5516
5593
|
if (!this._initialized) {
|
|
5517
5594
|
throw new FlickingError(MESSAGE.NOT_INITIALIZED, CODE.NOT_INITIALIZED);
|
|
5518
5595
|
}
|
|
5519
5596
|
const { index, position, visibleOffset, panels } = status;
|
|
5520
5597
|
const renderer = this._renderer;
|
|
5521
5598
|
const control = this._control;
|
|
5522
|
-
if (panels[0]
|
|
5599
|
+
if (((_a = panels[0]) == null ? void 0 : _a.html) && !this._renderExternal) {
|
|
5523
5600
|
renderer.batchRemove({
|
|
5524
5601
|
index: 0,
|
|
5525
5602
|
deleteCount: this.panels.length,
|
|
@@ -5581,78 +5658,80 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5581
5658
|
* @fires {@link ResizeEvents}
|
|
5582
5659
|
* @returns Promise that resolves when resize is complete
|
|
5583
5660
|
*/
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
if (this._isResizing) {
|
|
5589
|
-
this._scheduleResize = true;
|
|
5590
|
-
return;
|
|
5591
|
-
}
|
|
5592
|
-
this._scheduleResize = false;
|
|
5593
|
-
this._isResizing = true;
|
|
5594
|
-
const viewport = this._viewport;
|
|
5595
|
-
const renderer = this._renderer;
|
|
5596
|
-
const camera = this._camera;
|
|
5597
|
-
const control = this._control;
|
|
5598
|
-
const activePanel = control.activePanel;
|
|
5599
|
-
const prevWidth = viewport.width;
|
|
5600
|
-
const prevHeight = viewport.height;
|
|
5601
|
-
const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
|
|
5602
|
-
this.trigger(
|
|
5603
|
-
new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
5604
|
-
width: prevWidth,
|
|
5605
|
-
height: prevHeight,
|
|
5606
|
-
element: viewport.element
|
|
5607
|
-
})
|
|
5608
|
-
);
|
|
5609
|
-
viewport.resize();
|
|
5610
|
-
if (this._optimizeSizeUpdate) {
|
|
5611
|
-
if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
|
|
5612
|
-
await renderer.forceRenderAllPanels();
|
|
5661
|
+
resize() {
|
|
5662
|
+
return __async(this, null, function* () {
|
|
5663
|
+
if (!this._initialized) {
|
|
5664
|
+
return;
|
|
5613
5665
|
}
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
}
|
|
5631
|
-
if (control.animating) ;
|
|
5632
|
-
else {
|
|
5633
|
-
control.updatePosition(prevProgressInPanel);
|
|
5634
|
-
control.updateInput();
|
|
5635
|
-
}
|
|
5636
|
-
const newWidth = viewport.width;
|
|
5637
|
-
const newHeight = viewport.height;
|
|
5638
|
-
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
5639
|
-
this.trigger(
|
|
5640
|
-
new ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
5641
|
-
width: viewport.width,
|
|
5642
|
-
height: viewport.height,
|
|
5643
|
-
prev: {
|
|
5666
|
+
if (this._isResizing) {
|
|
5667
|
+
this._scheduleResize = true;
|
|
5668
|
+
return;
|
|
5669
|
+
}
|
|
5670
|
+
this._scheduleResize = false;
|
|
5671
|
+
this._isResizing = true;
|
|
5672
|
+
const viewport = this._viewport;
|
|
5673
|
+
const renderer = this._renderer;
|
|
5674
|
+
const camera = this._camera;
|
|
5675
|
+
const control = this._control;
|
|
5676
|
+
const activePanel = control.activePanel;
|
|
5677
|
+
const prevWidth = viewport.width;
|
|
5678
|
+
const prevHeight = viewport.height;
|
|
5679
|
+
const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
|
|
5680
|
+
this.trigger(
|
|
5681
|
+
new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
5644
5682
|
width: prevWidth,
|
|
5645
|
-
height: prevHeight
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5683
|
+
height: prevHeight,
|
|
5684
|
+
element: viewport.element
|
|
5685
|
+
})
|
|
5686
|
+
);
|
|
5687
|
+
viewport.resize();
|
|
5688
|
+
if (this._optimizeSizeUpdate) {
|
|
5689
|
+
if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
|
|
5690
|
+
yield renderer.forceRenderAllPanels();
|
|
5691
|
+
}
|
|
5692
|
+
} else {
|
|
5693
|
+
yield renderer.forceRenderAllPanels();
|
|
5694
|
+
}
|
|
5695
|
+
if (!this._initialized) {
|
|
5696
|
+
return;
|
|
5697
|
+
}
|
|
5698
|
+
renderer.updatePanelSize();
|
|
5699
|
+
camera.updateAlignPos();
|
|
5700
|
+
camera.updateRange();
|
|
5701
|
+
camera.updateAnchors();
|
|
5702
|
+
camera.updateAdaptiveHeight();
|
|
5703
|
+
camera.updatePanelOrder();
|
|
5704
|
+
camera.updateOffset();
|
|
5705
|
+
yield renderer.render();
|
|
5706
|
+
if (!this._initialized) {
|
|
5707
|
+
return;
|
|
5708
|
+
}
|
|
5709
|
+
if (control.animating) ;
|
|
5710
|
+
else {
|
|
5711
|
+
control.updatePosition(prevProgressInPanel);
|
|
5712
|
+
control.updateInput();
|
|
5713
|
+
}
|
|
5714
|
+
const newWidth = viewport.width;
|
|
5715
|
+
const newHeight = viewport.height;
|
|
5716
|
+
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
5717
|
+
this.trigger(
|
|
5718
|
+
new ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
5719
|
+
width: viewport.width,
|
|
5720
|
+
height: viewport.height,
|
|
5721
|
+
prev: {
|
|
5722
|
+
width: prevWidth,
|
|
5723
|
+
height: prevHeight
|
|
5724
|
+
},
|
|
5725
|
+
sizeChanged,
|
|
5726
|
+
element: viewport.element
|
|
5727
|
+
})
|
|
5728
|
+
);
|
|
5729
|
+
this._isResizing = false;
|
|
5730
|
+
if (this._scheduleResize) {
|
|
5731
|
+
void this.resize();
|
|
5732
|
+
}
|
|
5733
|
+
return;
|
|
5734
|
+
});
|
|
5656
5735
|
}
|
|
5657
5736
|
/**
|
|
5658
5737
|
* Add new panels after the last panel.
|
|
@@ -5741,10 +5820,11 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5741
5820
|
* Throws error if moveType is invalid.
|
|
5742
5821
|
*/
|
|
5743
5822
|
_createControl() {
|
|
5823
|
+
var _a;
|
|
5744
5824
|
const moveType = this._moveType;
|
|
5745
5825
|
const moveTypes = Object.keys(MOVE_TYPE).map((key) => MOVE_TYPE[key]);
|
|
5746
5826
|
const moveTypeStr = Array.isArray(moveType) ? moveType[0] : moveType;
|
|
5747
|
-
const moveTypeOptions = Array.isArray(moveType) ? moveType[1]
|
|
5827
|
+
const moveTypeOptions = Array.isArray(moveType) ? (_a = moveType[1]) != null ? _a : {} : {};
|
|
5748
5828
|
if (!includes(moveTypes, moveTypeStr)) {
|
|
5749
5829
|
throw new FlickingError(
|
|
5750
5830
|
MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)),
|
|
@@ -5797,7 +5877,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5797
5877
|
*/
|
|
5798
5878
|
_createExternalRenderer() {
|
|
5799
5879
|
const { renderer, rendererOptions } = this._renderExternal;
|
|
5800
|
-
return new renderer({ align: this._align,
|
|
5880
|
+
return new renderer(__spreadValues({ align: this._align }, rendererOptions));
|
|
5801
5881
|
}
|
|
5802
5882
|
/**
|
|
5803
5883
|
* Factory method to create VanillaRenderer for vanilla JavaScript rendering.
|
|
@@ -5888,7 +5968,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5888
5968
|
);
|
|
5889
5969
|
}
|
|
5890
5970
|
};
|
|
5891
|
-
_Flicking.VERSION = "4.16.0";
|
|
5971
|
+
_Flicking.VERSION = "4.16.1-beta.0";
|
|
5892
5972
|
let Flicking = _Flicking;
|
|
5893
5973
|
const SIDE_EVENTS = {
|
|
5894
5974
|
HOLD_START: "sideHoldStart",
|
|
@@ -6071,10 +6151,9 @@ class CrossFlicking extends Flicking {
|
|
|
6071
6151
|
Object.keys(SIDE_EVENTS).forEach((name) => {
|
|
6072
6152
|
flicking.on(EVENTS[name], (event) => {
|
|
6073
6153
|
this.trigger(
|
|
6074
|
-
new ComponentEvent(SIDE_EVENTS[name], {
|
|
6075
|
-
mainIndex
|
|
6076
|
-
|
|
6077
|
-
})
|
|
6154
|
+
new ComponentEvent(SIDE_EVENTS[name], __spreadValues({
|
|
6155
|
+
mainIndex
|
|
6156
|
+
}, event))
|
|
6078
6157
|
);
|
|
6079
6158
|
});
|
|
6080
6159
|
});
|
|
@@ -6175,12 +6254,11 @@ class CrossFlicking extends Flicking {
|
|
|
6175
6254
|
}
|
|
6176
6255
|
_createSideFlicking() {
|
|
6177
6256
|
return this.sideState.map((state, i) => {
|
|
6178
|
-
return new Flicking(this.camera.children[i], {
|
|
6179
|
-
...this.sideOptions,
|
|
6257
|
+
return new Flicking(this.camera.children[i], __spreadProps(__spreadValues({}, this.sideOptions), {
|
|
6180
6258
|
horizontal: false,
|
|
6181
6259
|
panelsPerView: 1,
|
|
6182
6260
|
defaultIndex: state.start
|
|
6183
|
-
});
|
|
6261
|
+
}));
|
|
6184
6262
|
});
|
|
6185
6263
|
}
|
|
6186
6264
|
}
|
|
@@ -6327,13 +6405,15 @@ const withFlickingMethods = (prototype, flickingName) => {
|
|
|
6327
6405
|
const getterDescriptor = {};
|
|
6328
6406
|
if (descriptor.get) {
|
|
6329
6407
|
getterDescriptor.get = function() {
|
|
6408
|
+
var _a;
|
|
6330
6409
|
const flicking = this[flickingName];
|
|
6331
|
-
return flicking && descriptor.get
|
|
6410
|
+
return flicking && ((_a = descriptor.get) == null ? void 0 : _a.call(flicking));
|
|
6332
6411
|
};
|
|
6333
6412
|
}
|
|
6334
6413
|
if (descriptor.set) {
|
|
6335
6414
|
getterDescriptor.set = function(...args) {
|
|
6336
|
-
|
|
6415
|
+
var _a;
|
|
6416
|
+
return (_a = descriptor.set) == null ? void 0 : _a.call(this[flickingName], ...args);
|
|
6337
6417
|
};
|
|
6338
6418
|
}
|
|
6339
6419
|
Object.defineProperty(prototype, name, getterDescriptor);
|
|
@@ -6763,12 +6843,13 @@ const getIndexProgress = (flicking) => {
|
|
|
6763
6843
|
return indexProgress;
|
|
6764
6844
|
};
|
|
6765
6845
|
const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps }) => {
|
|
6846
|
+
var _a, _b, _c;
|
|
6766
6847
|
let flicking;
|
|
6767
6848
|
const moveTo = (i) => {
|
|
6768
6849
|
if (flicking == null) {
|
|
6769
6850
|
return Promise.reject(new Error("Flicking instance is not available"));
|
|
6770
6851
|
}
|
|
6771
|
-
if (flicking
|
|
6852
|
+
if (flicking == null ? void 0 : flicking.animating) {
|
|
6772
6853
|
return Promise.resolve();
|
|
6773
6854
|
}
|
|
6774
6855
|
return flicking.moveTo(i);
|
|
@@ -6776,12 +6857,12 @@ const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps })
|
|
|
6776
6857
|
setMethods(["moveTo"]);
|
|
6777
6858
|
const options = getProps().options;
|
|
6778
6859
|
const reactiveObj = reactive({
|
|
6779
|
-
isReachStart: options
|
|
6780
|
-
isReachEnd: options
|
|
6781
|
-
totalPanelCount: options
|
|
6782
|
-
currentPanelIndex: options
|
|
6860
|
+
isReachStart: (options == null ? void 0 : options.defaultIndex) ? (options == null ? void 0 : options.defaultIndex) === 0 : true,
|
|
6861
|
+
isReachEnd: (options == null ? void 0 : options.totalPanelCount) && (options == null ? void 0 : options.defaultIndex) ? options.defaultIndex === options.totalPanelCount - 1 : false,
|
|
6862
|
+
totalPanelCount: (_a = options == null ? void 0 : options.totalPanelCount) != null ? _a : 0,
|
|
6863
|
+
currentPanelIndex: (_b = options == null ? void 0 : options.defaultIndex) != null ? _b : 0,
|
|
6783
6864
|
progress: 0,
|
|
6784
|
-
indexProgress: options
|
|
6865
|
+
indexProgress: (_c = options == null ? void 0 : options.defaultIndex) != null ? _c : 0,
|
|
6785
6866
|
moveTo
|
|
6786
6867
|
});
|
|
6787
6868
|
const onChanged = () => {
|
|
@@ -6808,14 +6889,14 @@ const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps })
|
|
|
6808
6889
|
reactiveObj.currentPanelIndex = getCurrentPanelIndex(flicking);
|
|
6809
6890
|
reactiveObj.progress = getProgress(flicking);
|
|
6810
6891
|
reactiveObj.totalPanelCount = getTotalPanelCount(flicking);
|
|
6811
|
-
flicking
|
|
6812
|
-
flicking
|
|
6813
|
-
flicking
|
|
6892
|
+
flicking == null ? void 0 : flicking.on("changed", onChanged);
|
|
6893
|
+
flicking == null ? void 0 : flicking.on("panelChange", onPanelChange);
|
|
6894
|
+
flicking == null ? void 0 : flicking.on("move", onMove);
|
|
6814
6895
|
});
|
|
6815
6896
|
onDestroy(() => {
|
|
6816
|
-
flicking
|
|
6817
|
-
flicking
|
|
6818
|
-
flicking
|
|
6897
|
+
flicking == null ? void 0 : flicking.off("changed", onChanged);
|
|
6898
|
+
flicking == null ? void 0 : flicking.off("panelChange", onPanelChange);
|
|
6899
|
+
flicking == null ? void 0 : flicking.off("move", onMove);
|
|
6819
6900
|
});
|
|
6820
6901
|
return reactiveObj;
|
|
6821
6902
|
};
|