@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.cjs.js
CHANGED
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __reflectGet = Reflect.get;
|
|
10
|
+
var __pow = Math.pow;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
25
|
+
var __async = (__this, __arguments, generator) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
var fulfilled = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.next(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var rejected = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.throw(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
42
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
2
45
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
46
|
const Component = require("@egjs/component");
|
|
4
47
|
const Axes = require("@egjs/axes");
|
|
@@ -832,10 +875,11 @@ class LinearCameraMode extends CameraMode {
|
|
|
832
875
|
return true;
|
|
833
876
|
}
|
|
834
877
|
getRange() {
|
|
878
|
+
var _a, _b;
|
|
835
879
|
const renderer = this._flicking.renderer;
|
|
836
880
|
const firstPanel = renderer.getPanel(0);
|
|
837
881
|
const lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
838
|
-
return { min: firstPanel
|
|
882
|
+
return { min: (_a = firstPanel == null ? void 0 : firstPanel.position) != null ? _a : 0, max: (_b = lastPanel == null ? void 0 : lastPanel.position) != null ? _b : 0 };
|
|
839
883
|
}
|
|
840
884
|
}
|
|
841
885
|
class Camera {
|
|
@@ -1164,10 +1208,11 @@ class Camera {
|
|
|
1164
1208
|
* @returns The {@link AnchorPoint} that matches current panel
|
|
1165
1209
|
*/
|
|
1166
1210
|
findActiveAnchor() {
|
|
1211
|
+
var _a;
|
|
1167
1212
|
const flicking = getFlickingAttached(this._flicking);
|
|
1168
1213
|
const activePanel = flicking.control.activePanel;
|
|
1169
1214
|
if (!activePanel) return null;
|
|
1170
|
-
return find(this._anchors, (anchor) => anchor.panel.index === activePanel.index)
|
|
1215
|
+
return (_a = find(this._anchors, (anchor) => anchor.panel.index === activePanel.index)) != null ? _a : this.findNearestAnchor(activePanel.position);
|
|
1171
1216
|
}
|
|
1172
1217
|
/**
|
|
1173
1218
|
* Clamp the given position between camera's range
|
|
@@ -1798,7 +1843,7 @@ class StateMachine {
|
|
|
1798
1843
|
}
|
|
1799
1844
|
fire(eventType, externalCtx) {
|
|
1800
1845
|
const currentState = this._state;
|
|
1801
|
-
const ctx = {
|
|
1846
|
+
const ctx = __spreadProps(__spreadValues({}, externalCtx), { transitTo: this.transitTo });
|
|
1802
1847
|
switch (eventType) {
|
|
1803
1848
|
case EVENT.HOLD:
|
|
1804
1849
|
currentState.onHold(ctx);
|
|
@@ -1824,7 +1869,8 @@ class AxesController {
|
|
|
1824
1869
|
this._dragged = false;
|
|
1825
1870
|
};
|
|
1826
1871
|
this._onAxesChange = () => {
|
|
1827
|
-
|
|
1872
|
+
var _a;
|
|
1873
|
+
this._dragged = !!((_a = this._panInput) == null ? void 0 : _a.isEnabled());
|
|
1828
1874
|
};
|
|
1829
1875
|
this._preventClickWhenDragged = (e) => {
|
|
1830
1876
|
if (this._dragged) {
|
|
@@ -1895,28 +1941,32 @@ class AxesController {
|
|
|
1895
1941
|
* @readonly
|
|
1896
1942
|
*/
|
|
1897
1943
|
get enabled() {
|
|
1898
|
-
|
|
1944
|
+
var _a, _b;
|
|
1945
|
+
return (_b = (_a = this._panInput) == null ? void 0 : _a.isEnabled()) != null ? _b : false;
|
|
1899
1946
|
}
|
|
1900
1947
|
/**
|
|
1901
1948
|
* Current position value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
1902
1949
|
* @readonly
|
|
1903
1950
|
*/
|
|
1904
1951
|
get position() {
|
|
1905
|
-
|
|
1952
|
+
var _a, _b;
|
|
1953
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
|
|
1906
1954
|
}
|
|
1907
1955
|
/**
|
|
1908
1956
|
* Current range value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
1909
1957
|
* @readonly
|
|
1910
1958
|
*/
|
|
1911
1959
|
get range() {
|
|
1912
|
-
|
|
1960
|
+
var _a, _b;
|
|
1961
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].range) != null ? _b : [0, 0];
|
|
1913
1962
|
}
|
|
1914
1963
|
/**
|
|
1915
1964
|
* Actual bounce size(px)
|
|
1916
1965
|
* @readonly
|
|
1917
1966
|
*/
|
|
1918
1967
|
get bounce() {
|
|
1919
|
-
|
|
1968
|
+
var _a;
|
|
1969
|
+
return (_a = this._axes) == null ? void 0 : _a.axis[POSITION_KEY].bounce;
|
|
1920
1970
|
}
|
|
1921
1971
|
/**
|
|
1922
1972
|
* Initialize AxesController
|
|
@@ -1969,11 +2019,12 @@ class AxesController {
|
|
|
1969
2019
|
* This method destroys the Axes and PanInput instances and removes all event handlers.
|
|
1970
2020
|
*/
|
|
1971
2021
|
destroy() {
|
|
2022
|
+
var _a;
|
|
1972
2023
|
if (this._axes) {
|
|
1973
2024
|
this.removePreventClickHandler();
|
|
1974
2025
|
this._axes.destroy();
|
|
1975
2026
|
}
|
|
1976
|
-
this._panInput
|
|
2027
|
+
(_a = this._panInput) == null ? void 0 : _a.destroy();
|
|
1977
2028
|
this._resetInternalValues();
|
|
1978
2029
|
}
|
|
1979
2030
|
/**
|
|
@@ -1983,7 +2034,8 @@ class AxesController {
|
|
|
1983
2034
|
* @returns The current instance for method chaining
|
|
1984
2035
|
*/
|
|
1985
2036
|
enable() {
|
|
1986
|
-
|
|
2037
|
+
var _a;
|
|
2038
|
+
(_a = this._panInput) == null ? void 0 : _a.enable();
|
|
1987
2039
|
return this;
|
|
1988
2040
|
}
|
|
1989
2041
|
/**
|
|
@@ -1993,7 +2045,8 @@ class AxesController {
|
|
|
1993
2045
|
* @returns The current instance for method chaining
|
|
1994
2046
|
*/
|
|
1995
2047
|
disable() {
|
|
1996
|
-
|
|
2048
|
+
var _a;
|
|
2049
|
+
(_a = this._panInput) == null ? void 0 : _a.disable();
|
|
1997
2050
|
return this;
|
|
1998
2051
|
}
|
|
1999
2052
|
/**
|
|
@@ -2003,7 +2056,8 @@ class AxesController {
|
|
|
2003
2056
|
* @returns The current instance for method chaining
|
|
2004
2057
|
*/
|
|
2005
2058
|
release() {
|
|
2006
|
-
|
|
2059
|
+
var _a;
|
|
2060
|
+
(_a = this._panInput) == null ? void 0 : _a.release();
|
|
2007
2061
|
return this;
|
|
2008
2062
|
}
|
|
2009
2063
|
/**
|
|
@@ -2015,11 +2069,11 @@ class AxesController {
|
|
|
2015
2069
|
* @returns The current instance for method chaining
|
|
2016
2070
|
*/
|
|
2017
2071
|
updateAnimation(position, duration) {
|
|
2018
|
-
|
|
2019
|
-
|
|
2072
|
+
var _a;
|
|
2073
|
+
this._animatingContext = __spreadProps(__spreadValues({}, this._animatingContext), {
|
|
2020
2074
|
end: position
|
|
2021
|
-
};
|
|
2022
|
-
this._axes
|
|
2075
|
+
});
|
|
2076
|
+
(_a = this._axes) == null ? void 0 : _a.updateAnimation({
|
|
2023
2077
|
destPos: { [POSITION_KEY]: position },
|
|
2024
2078
|
duration
|
|
2025
2079
|
});
|
|
@@ -2032,7 +2086,8 @@ class AxesController {
|
|
|
2032
2086
|
* @returns The current instance for method chaining
|
|
2033
2087
|
*/
|
|
2034
2088
|
stopAnimation() {
|
|
2035
|
-
|
|
2089
|
+
var _a;
|
|
2090
|
+
(_a = this._axes) == null ? void 0 : _a.stopAnimation();
|
|
2036
2091
|
return this;
|
|
2037
2092
|
}
|
|
2038
2093
|
/**
|
|
@@ -2095,6 +2150,7 @@ class AxesController {
|
|
|
2095
2150
|
* @returns A Promise which will be resolved after reaching the target position
|
|
2096
2151
|
*/
|
|
2097
2152
|
animateTo(position, duration, axesEvent) {
|
|
2153
|
+
var _a;
|
|
2098
2154
|
const axes = this._axes;
|
|
2099
2155
|
const state = this._stateMachine.state;
|
|
2100
2156
|
if (!axes) {
|
|
@@ -2107,7 +2163,7 @@ class AxesController {
|
|
|
2107
2163
|
const flicking = getFlickingAttached(this._flicking);
|
|
2108
2164
|
flicking.camera.lookAt(position);
|
|
2109
2165
|
if (state.targetPanel) {
|
|
2110
|
-
flicking.control.setActive(state.targetPanel, flicking.control.activePanel, axesEvent
|
|
2166
|
+
flicking.control.setActive(state.targetPanel, flicking.control.activePanel, (_a = axesEvent == null ? void 0 : axesEvent.isTrusted) != null ? _a : false);
|
|
2111
2167
|
}
|
|
2112
2168
|
return Promise.resolve();
|
|
2113
2169
|
}
|
|
@@ -2145,7 +2201,8 @@ class AxesController {
|
|
|
2145
2201
|
* Returns the current axes position
|
|
2146
2202
|
*/
|
|
2147
2203
|
getCurrentPosition() {
|
|
2148
|
-
|
|
2204
|
+
var _a, _b;
|
|
2205
|
+
return (_b = (_a = this._axes) == null ? void 0 : _a.get([POSITION_KEY])[POSITION_KEY]) != null ? _b : 0;
|
|
2149
2206
|
}
|
|
2150
2207
|
updateDirection() {
|
|
2151
2208
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -2182,7 +2239,8 @@ class Control {
|
|
|
2182
2239
|
* @readonly
|
|
2183
2240
|
*/
|
|
2184
2241
|
get activeIndex() {
|
|
2185
|
-
|
|
2242
|
+
var _a, _b;
|
|
2243
|
+
return (_b = (_a = this._activePanel) == null ? void 0 : _a.index) != null ? _b : -1;
|
|
2186
2244
|
}
|
|
2187
2245
|
/**
|
|
2188
2246
|
* An active panel
|
|
@@ -2274,7 +2332,7 @@ class Control {
|
|
|
2274
2332
|
*/
|
|
2275
2333
|
updateAnimation(panel, duration, direction) {
|
|
2276
2334
|
const state = this._controller.state;
|
|
2277
|
-
const position = this._getPosition(panel, direction
|
|
2335
|
+
const position = this._getPosition(panel, direction != null ? direction : DIRECTION.NONE);
|
|
2278
2336
|
state.targetPanel = panel;
|
|
2279
2337
|
this._controller.updateAnimation(position, duration);
|
|
2280
2338
|
return this;
|
|
@@ -2336,10 +2394,12 @@ class Control {
|
|
|
2336
2394
|
* @throws {@link MovementErrors}
|
|
2337
2395
|
* @returns A Promise which will be resolved after reaching the target panel
|
|
2338
2396
|
*/
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2397
|
+
moveToPanel(_0, _1) {
|
|
2398
|
+
return __async(this, arguments, function* (panel, { duration, direction = DIRECTION.NONE, axesEvent }) {
|
|
2399
|
+
const position = this._getPosition(panel, direction);
|
|
2400
|
+
this._triggerIndexChangeEvent(panel, panel.position, axesEvent, direction);
|
|
2401
|
+
return this._animateToPosition({ position, duration, newActivePanel: panel, axesEvent });
|
|
2402
|
+
});
|
|
2343
2403
|
}
|
|
2344
2404
|
/**
|
|
2345
2405
|
* @internal
|
|
@@ -2347,6 +2407,7 @@ class Control {
|
|
|
2347
2407
|
* Sets the active panel and triggers {@link ChangedEvent} or {@link RestoredEvent} based on whether the panel changed.
|
|
2348
2408
|
*/
|
|
2349
2409
|
setActive(newActivePanel, prevActivePanel, isTrusted) {
|
|
2410
|
+
var _a;
|
|
2350
2411
|
const flicking = getFlickingAttached(this._flicking);
|
|
2351
2412
|
this._activePanel = newActivePanel;
|
|
2352
2413
|
this._nextPanel = null;
|
|
@@ -2356,7 +2417,7 @@ class Control {
|
|
|
2356
2417
|
new Component.ComponentEvent(EVENTS.CHANGED, {
|
|
2357
2418
|
index: newActivePanel.index,
|
|
2358
2419
|
panel: newActivePanel,
|
|
2359
|
-
prevIndex: prevActivePanel
|
|
2420
|
+
prevIndex: (_a = prevActivePanel == null ? void 0 : prevActivePanel.index) != null ? _a : -1,
|
|
2360
2421
|
prevPanel: prevActivePanel,
|
|
2361
2422
|
isTrusted,
|
|
2362
2423
|
direction: prevActivePanel ? getDirection(prevActivePanel.position, newActivePanel.position) : DIRECTION.NONE
|
|
@@ -2386,6 +2447,7 @@ class Control {
|
|
|
2386
2447
|
* Triggers {@link WillChangeEvent} or {@link WillRestoreEvent} based on whether the target panel differs from the active panel.
|
|
2387
2448
|
*/
|
|
2388
2449
|
_triggerIndexChangeEvent(panel, position, axesEvent, direction) {
|
|
2450
|
+
var _a;
|
|
2389
2451
|
const flicking = getFlickingAttached(this._flicking);
|
|
2390
2452
|
const triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
|
|
2391
2453
|
const camera = flicking.camera;
|
|
@@ -2393,8 +2455,8 @@ class Control {
|
|
|
2393
2455
|
const event = new Component.ComponentEvent(triggeringEvent, {
|
|
2394
2456
|
index: panel.index,
|
|
2395
2457
|
panel,
|
|
2396
|
-
isTrusted: axesEvent
|
|
2397
|
-
direction: direction
|
|
2458
|
+
isTrusted: (axesEvent == null ? void 0 : axesEvent.isTrusted) || false,
|
|
2459
|
+
direction: direction != null ? direction : getDirection((_a = activePanel == null ? void 0 : activePanel.position) != null ? _a : camera.position, position)
|
|
2398
2460
|
});
|
|
2399
2461
|
this._nextPanel = panel;
|
|
2400
2462
|
flicking.trigger(event);
|
|
@@ -2407,32 +2469,34 @@ class Control {
|
|
|
2407
2469
|
* @privateRemarks
|
|
2408
2470
|
* Animates the camera to the target position and handles animation completion or interruption.
|
|
2409
2471
|
*/
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
nextDuration
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2472
|
+
_animateToPosition(_0) {
|
|
2473
|
+
return __async(this, arguments, function* ({
|
|
2474
|
+
position,
|
|
2475
|
+
duration,
|
|
2476
|
+
newActivePanel,
|
|
2477
|
+
axesEvent
|
|
2478
|
+
}) {
|
|
2479
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
2480
|
+
let nextDuration = duration;
|
|
2481
|
+
if (Math.abs(nextDuration - position) < flicking.animationThreshold) {
|
|
2482
|
+
nextDuration = 0;
|
|
2483
|
+
}
|
|
2484
|
+
const animate = () => this._controller.animateTo(position, nextDuration, axesEvent);
|
|
2485
|
+
const state = this._controller.state;
|
|
2486
|
+
state.targetPanel = newActivePanel;
|
|
2487
|
+
if (nextDuration <= 0) {
|
|
2488
|
+
return animate();
|
|
2489
|
+
} else {
|
|
2490
|
+
return animate().then(() => __async(this, null, function* () {
|
|
2491
|
+
if (flicking.initialized) {
|
|
2492
|
+
yield flicking.renderer.render();
|
|
2493
|
+
}
|
|
2494
|
+
})).catch((err) => {
|
|
2495
|
+
if (axesEvent && err instanceof FlickingError && err.code === CODE.ANIMATION_INTERRUPTED) return;
|
|
2496
|
+
throw err;
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2436
2500
|
}
|
|
2437
2501
|
/**
|
|
2438
2502
|
* @internal
|
|
@@ -2654,6 +2718,7 @@ class SnapControl extends Control {
|
|
|
2654
2718
|
* Finds the adjacent anchor point based on the movement direction.
|
|
2655
2719
|
*/
|
|
2656
2720
|
_findAdjacentAnchor(position, posDelta, anchorAtCamera) {
|
|
2721
|
+
var _a;
|
|
2657
2722
|
const flicking = getFlickingAttached(this._flicking);
|
|
2658
2723
|
const camera = flicking.camera;
|
|
2659
2724
|
if (camera.circularEnabled) {
|
|
@@ -2662,7 +2727,7 @@ class SnapControl extends Control {
|
|
|
2662
2727
|
return anchorIncludePosition;
|
|
2663
2728
|
}
|
|
2664
2729
|
}
|
|
2665
|
-
const adjacentAnchor = (posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera))
|
|
2730
|
+
const adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) != null ? _a : anchorAtCamera;
|
|
2666
2731
|
return adjacentAnchor;
|
|
2667
2732
|
}
|
|
2668
2733
|
/**
|
|
@@ -2718,13 +2783,14 @@ class StrictControl extends Control {
|
|
|
2718
2783
|
* @returns The current instance for method chaining
|
|
2719
2784
|
*/
|
|
2720
2785
|
updateInput() {
|
|
2786
|
+
var _a;
|
|
2721
2787
|
const flicking = getFlickingAttached(this._flicking);
|
|
2722
2788
|
const camera = flicking.camera;
|
|
2723
2789
|
const renderer = flicking.renderer;
|
|
2724
2790
|
const controller = this._controller;
|
|
2725
2791
|
const controlParams = camera.controlParams;
|
|
2726
2792
|
const count = this._count;
|
|
2727
|
-
const activePanel = controller.state.animating ? camera.findNearestAnchor(camera.position)
|
|
2793
|
+
const activePanel = controller.state.animating ? (_a = camera.findNearestAnchor(camera.position)) == null ? void 0 : _a.panel : this._activePanel;
|
|
2728
2794
|
if (!activePanel) {
|
|
2729
2795
|
controller.update(controlParams);
|
|
2730
2796
|
this._resetIndexRange();
|
|
@@ -2772,12 +2838,14 @@ class StrictControl extends Control {
|
|
|
2772
2838
|
};
|
|
2773
2839
|
return this;
|
|
2774
2840
|
}
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2841
|
+
moveToPanel(panel, options) {
|
|
2842
|
+
return __async(this, null, function* () {
|
|
2843
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
2844
|
+
const camera = flicking.camera;
|
|
2845
|
+
const controller = this._controller;
|
|
2846
|
+
controller.update(camera.controlParams);
|
|
2847
|
+
return __superGet(StrictControl.prototype, this, "moveToPanel").call(this, panel, options);
|
|
2848
|
+
});
|
|
2781
2849
|
}
|
|
2782
2850
|
/**
|
|
2783
2851
|
* Move {@link Camera} to the given position
|
|
@@ -2791,9 +2859,10 @@ class StrictControl extends Control {
|
|
|
2791
2859
|
* @returns A Promise which will be resolved after reaching the target position
|
|
2792
2860
|
*/
|
|
2793
2861
|
moveToPosition(position, duration, axesEvent) {
|
|
2862
|
+
var _a;
|
|
2794
2863
|
const flicking = getFlickingAttached(this._flicking);
|
|
2795
2864
|
const camera = flicking.camera;
|
|
2796
|
-
const currentPanel = this._nextPanel
|
|
2865
|
+
const currentPanel = (_a = this._nextPanel) != null ? _a : this._activePanel;
|
|
2797
2866
|
const axesRange = this._controller.range;
|
|
2798
2867
|
const indexRange = this._indexRange;
|
|
2799
2868
|
const cameraRange = camera.range;
|
|
@@ -3197,11 +3266,12 @@ class VirtualManager {
|
|
|
3197
3266
|
this._panelClass = val;
|
|
3198
3267
|
}
|
|
3199
3268
|
constructor(flicking, options) {
|
|
3269
|
+
var _a, _b, _c, _d;
|
|
3200
3270
|
this._flicking = flicking;
|
|
3201
|
-
this._renderPanel = options
|
|
3202
|
-
this._initialPanelCount = options
|
|
3203
|
-
this._cache = options
|
|
3204
|
-
this._panelClass = options
|
|
3271
|
+
this._renderPanel = (_a = options == null ? void 0 : options.renderPanel) != null ? _a : (() => "");
|
|
3272
|
+
this._initialPanelCount = (_b = options == null ? void 0 : options.initialPanelCount) != null ? _b : -1;
|
|
3273
|
+
this._cache = (_c = options == null ? void 0 : options.cache) != null ? _c : false;
|
|
3274
|
+
this._panelClass = (_d = options == null ? void 0 : options.panelClass) != null ? _d : CLASS.DEFAULT_VIRTUAL;
|
|
3205
3275
|
this._elements = [];
|
|
3206
3276
|
}
|
|
3207
3277
|
init() {
|
|
@@ -3427,6 +3497,7 @@ class Renderer {
|
|
|
3427
3497
|
const prevFirstPanel = panels[0];
|
|
3428
3498
|
const align = parsePanelAlign(this._align);
|
|
3429
3499
|
const allPanelsInserted = items.reduce((addedPanels, item) => {
|
|
3500
|
+
var _a;
|
|
3430
3501
|
const insertingIdx = getMinusCompensatedIndex(item.index, panels.length);
|
|
3431
3502
|
const panelsPushed = panels.slice(insertingIdx);
|
|
3432
3503
|
const panelsInserted = item.elements.map(
|
|
@@ -3434,7 +3505,7 @@ class Renderer {
|
|
|
3434
3505
|
);
|
|
3435
3506
|
panels.splice(insertingIdx, 0, ...panelsInserted);
|
|
3436
3507
|
if (item.hasDOMInElements) {
|
|
3437
|
-
this._insertPanelElements(panelsInserted, panelsPushed[0]
|
|
3508
|
+
this._insertPanelElements(panelsInserted, (_a = panelsPushed[0]) != null ? _a : null);
|
|
3438
3509
|
}
|
|
3439
3510
|
if (flicking.panelsPerView > 0) {
|
|
3440
3511
|
const firstPanel = prevFirstPanel || panelsInserted[0].resize();
|
|
@@ -3501,6 +3572,7 @@ class Renderer {
|
|
|
3501
3572
|
* Updates camera, control, and triggers {@link PanelChangeEvent} after panels are added or removed.
|
|
3502
3573
|
*/
|
|
3503
3574
|
updateAfterPanelChange(panelsAdded, panelsRemoved) {
|
|
3575
|
+
var _a;
|
|
3504
3576
|
const flicking = getFlickingAttached(this._flicking);
|
|
3505
3577
|
const { camera, control } = flicking;
|
|
3506
3578
|
const panels = this._panels;
|
|
@@ -3524,7 +3596,7 @@ class Renderer {
|
|
|
3524
3596
|
if (panels.length <= 0) {
|
|
3525
3597
|
camera.lookAt(0);
|
|
3526
3598
|
} else {
|
|
3527
|
-
let targetIndex = activePanel
|
|
3599
|
+
let targetIndex = (_a = activePanel == null ? void 0 : activePanel.index) != null ? _a : 0;
|
|
3528
3600
|
if (targetIndex > panels.length - 1) {
|
|
3529
3601
|
targetIndex = panels.length - 1;
|
|
3530
3602
|
}
|
|
@@ -3654,11 +3726,10 @@ class Renderer {
|
|
|
3654
3726
|
const gap = referencePanel.margin.prev + referencePanel.margin.next;
|
|
3655
3727
|
const panelSize = (viewportSize - gap * (panelsPerView - 1)) / panelsPerView;
|
|
3656
3728
|
const panelSizeObj = flicking.horizontal ? { width: panelSize } : { height: panelSize };
|
|
3657
|
-
const firstPanelSizeObj = {
|
|
3729
|
+
const firstPanelSizeObj = __spreadValues({
|
|
3658
3730
|
size: panelSize,
|
|
3659
|
-
margin: referencePanel.margin
|
|
3660
|
-
|
|
3661
|
-
};
|
|
3731
|
+
margin: referencePanel.margin
|
|
3732
|
+
}, !flicking.horizontal && { height: referencePanel.height });
|
|
3662
3733
|
if (!flicking.noPanelStyleOverride) {
|
|
3663
3734
|
this._strategy.updatePanelSizes(flicking, panelSizeObj);
|
|
3664
3735
|
}
|
|
@@ -3685,7 +3756,7 @@ class Renderer {
|
|
|
3685
3756
|
const flicking = getFlickingAttached(this._flicking);
|
|
3686
3757
|
const camera = flicking.camera;
|
|
3687
3758
|
const cameraElement = camera.element;
|
|
3688
|
-
const nextSiblingElement = nextSibling
|
|
3759
|
+
const nextSiblingElement = (nextSibling == null ? void 0 : nextSibling.element) || null;
|
|
3689
3760
|
const fragment = document.createDocumentFragment();
|
|
3690
3761
|
panels.forEach((panel) => fragment.appendChild(panel.element));
|
|
3691
3762
|
cameraElement.insertBefore(fragment, nextSiblingElement);
|
|
@@ -3730,13 +3801,15 @@ class ExternalRenderer extends Renderer {
|
|
|
3730
3801
|
}
|
|
3731
3802
|
class VanillaRenderer extends Renderer {
|
|
3732
3803
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3804
|
+
render() {
|
|
3805
|
+
return __async(this, null, function* () {
|
|
3806
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
3807
|
+
const strategy = this._strategy;
|
|
3808
|
+
strategy.updateRenderingPanels(flicking);
|
|
3809
|
+
strategy.renderPanels(flicking);
|
|
3810
|
+
this._resetPanelElementOrder();
|
|
3811
|
+
this._afterRender();
|
|
3812
|
+
});
|
|
3740
3813
|
}
|
|
3741
3814
|
_collectPanels() {
|
|
3742
3815
|
const flicking = getFlickingAttached(this._flicking);
|
|
@@ -4008,6 +4081,7 @@ class Panel {
|
|
|
4008
4081
|
* @returns The current instance for method chaining
|
|
4009
4082
|
*/
|
|
4010
4083
|
resize(cached) {
|
|
4084
|
+
var _a;
|
|
4011
4085
|
const el = this.element;
|
|
4012
4086
|
const flicking = this._flicking;
|
|
4013
4087
|
const { horizontal, useFractionalSize } = flicking;
|
|
@@ -4016,8 +4090,8 @@ class Panel {
|
|
|
4016
4090
|
}
|
|
4017
4091
|
if (cached) {
|
|
4018
4092
|
this._size = cached.size;
|
|
4019
|
-
this._margin = {
|
|
4020
|
-
this._height = cached.height
|
|
4093
|
+
this._margin = __spreadValues({}, cached.margin);
|
|
4094
|
+
this._height = (_a = cached.height) != null ? _a : getElementSize({
|
|
4021
4095
|
el,
|
|
4022
4096
|
horizontal: false,
|
|
4023
4097
|
useFractionalSize,
|
|
@@ -4071,7 +4145,8 @@ class Panel {
|
|
|
4071
4145
|
* @returns A Boolean value indicating the element is inside of this panel {@link Panel.element | element}
|
|
4072
4146
|
*/
|
|
4073
4147
|
contains(element) {
|
|
4074
|
-
|
|
4148
|
+
var _a;
|
|
4149
|
+
return !!((_a = this.element) == null ? void 0 : _a.contains(element));
|
|
4075
4150
|
}
|
|
4076
4151
|
/**
|
|
4077
4152
|
* Reset internal state and set {@link Panel.removed | removed} to `true`
|
|
@@ -4306,10 +4381,9 @@ class NormalRenderingStrategy {
|
|
|
4306
4381
|
);
|
|
4307
4382
|
}
|
|
4308
4383
|
createPanel(element, options) {
|
|
4309
|
-
return new Panel({
|
|
4310
|
-
...options,
|
|
4384
|
+
return new Panel(__spreadProps(__spreadValues({}, options), {
|
|
4311
4385
|
elementProvider: new this._providerCtor(element)
|
|
4312
|
-
});
|
|
4386
|
+
}));
|
|
4313
4387
|
}
|
|
4314
4388
|
updatePanelSizes(flicking, size) {
|
|
4315
4389
|
flicking.panels.forEach((panel) => panel.setSize(size));
|
|
@@ -4420,7 +4494,7 @@ class VirtualRenderingStrategy {
|
|
|
4420
4494
|
});
|
|
4421
4495
|
if (visiblePanels.length <= 0) return virtualManager.elements.map((_, idx) => idx);
|
|
4422
4496
|
const visibleIndexes = visiblePanels.map((panel) => panel.elementIndex);
|
|
4423
|
-
const invisibleIndexes = virtualManager.elements.map((el, idx) => ({
|
|
4497
|
+
const invisibleIndexes = virtualManager.elements.map((el, idx) => __spreadProps(__spreadValues({}, el), { idx })).filter((el) => !el.visible).map((el) => el.idx);
|
|
4424
4498
|
return [...visibleIndexes, ...invisibleIndexes];
|
|
4425
4499
|
}
|
|
4426
4500
|
getRenderingElementsByOrder(flicking) {
|
|
@@ -4456,10 +4530,9 @@ class VirtualRenderingStrategy {
|
|
|
4456
4530
|
);
|
|
4457
4531
|
}
|
|
4458
4532
|
createPanel(_el, options) {
|
|
4459
|
-
return new VirtualPanel({
|
|
4460
|
-
...options,
|
|
4533
|
+
return new VirtualPanel(__spreadProps(__spreadValues({}, options), {
|
|
4461
4534
|
elementProvider: new VirtualElementProvider(options.flicking)
|
|
4462
|
-
});
|
|
4535
|
+
}));
|
|
4463
4536
|
}
|
|
4464
4537
|
updatePanelSizes(flicking, size) {
|
|
4465
4538
|
flicking.virtual.elements.forEach((el) => {
|
|
@@ -4503,7 +4576,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
4503
4576
|
preventEventsBeforeInit = true,
|
|
4504
4577
|
deceleration = 75e-4,
|
|
4505
4578
|
duration = 500,
|
|
4506
|
-
easing = (x) => 1 - (1 - x
|
|
4579
|
+
easing = (x) => 1 - __pow(1 - x, 3),
|
|
4507
4580
|
inputType = ["mouse", "touch"],
|
|
4508
4581
|
moveType = "snap",
|
|
4509
4582
|
threshold = 40,
|
|
@@ -5358,7 +5431,8 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5358
5431
|
* @returns Promise that resolves after reaching the previous panel
|
|
5359
5432
|
*/
|
|
5360
5433
|
prev(duration = this._duration) {
|
|
5361
|
-
|
|
5434
|
+
var _a, _b, _c;
|
|
5435
|
+
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);
|
|
5362
5436
|
}
|
|
5363
5437
|
/**
|
|
5364
5438
|
* Move to the next panel (current index + 1).
|
|
@@ -5368,7 +5442,8 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5368
5442
|
* @returns Promise that resolves after reaching the next panel
|
|
5369
5443
|
*/
|
|
5370
5444
|
next(duration = this._duration) {
|
|
5371
|
-
|
|
5445
|
+
var _a, _b, _c;
|
|
5446
|
+
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);
|
|
5372
5447
|
}
|
|
5373
5448
|
/**
|
|
5374
5449
|
* Move to the panel with the given index.
|
|
@@ -5479,6 +5554,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5479
5554
|
* @returns Status object that can be used with {@link Flicking.setStatus} to restore the state
|
|
5480
5555
|
*/
|
|
5481
5556
|
getStatus(options = {}) {
|
|
5557
|
+
var _a, _b;
|
|
5482
5558
|
const { index = true, position = true, includePanelHTML = false, visiblePanelsOnly = false } = options;
|
|
5483
5559
|
const camera = this._camera;
|
|
5484
5560
|
const panels = visiblePanelsOnly ? this.visiblePanels : this.panels;
|
|
@@ -5505,7 +5581,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5505
5581
|
}
|
|
5506
5582
|
if (visiblePanelsOnly) {
|
|
5507
5583
|
const visiblePanels = this.visiblePanels;
|
|
5508
|
-
status.visibleOffset = visiblePanels[0]
|
|
5584
|
+
status.visibleOffset = (_b = (_a = visiblePanels[0]) == null ? void 0 : _a.index) != null ? _b : 0;
|
|
5509
5585
|
}
|
|
5510
5586
|
return status;
|
|
5511
5587
|
}
|
|
@@ -5515,13 +5591,14 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5515
5591
|
* @throws {@link StatusRestoreErrors}
|
|
5516
5592
|
*/
|
|
5517
5593
|
setStatus(status) {
|
|
5594
|
+
var _a;
|
|
5518
5595
|
if (!this._initialized) {
|
|
5519
5596
|
throw new FlickingError(MESSAGE.NOT_INITIALIZED, CODE.NOT_INITIALIZED);
|
|
5520
5597
|
}
|
|
5521
5598
|
const { index, position, visibleOffset, panels } = status;
|
|
5522
5599
|
const renderer = this._renderer;
|
|
5523
5600
|
const control = this._control;
|
|
5524
|
-
if (panels[0]
|
|
5601
|
+
if (((_a = panels[0]) == null ? void 0 : _a.html) && !this._renderExternal) {
|
|
5525
5602
|
renderer.batchRemove({
|
|
5526
5603
|
index: 0,
|
|
5527
5604
|
deleteCount: this.panels.length,
|
|
@@ -5583,78 +5660,80 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5583
5660
|
* @fires {@link ResizeEvents}
|
|
5584
5661
|
* @returns Promise that resolves when resize is complete
|
|
5585
5662
|
*/
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
if (this._isResizing) {
|
|
5591
|
-
this._scheduleResize = true;
|
|
5592
|
-
return;
|
|
5593
|
-
}
|
|
5594
|
-
this._scheduleResize = false;
|
|
5595
|
-
this._isResizing = true;
|
|
5596
|
-
const viewport = this._viewport;
|
|
5597
|
-
const renderer = this._renderer;
|
|
5598
|
-
const camera = this._camera;
|
|
5599
|
-
const control = this._control;
|
|
5600
|
-
const activePanel = control.activePanel;
|
|
5601
|
-
const prevWidth = viewport.width;
|
|
5602
|
-
const prevHeight = viewport.height;
|
|
5603
|
-
const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
|
|
5604
|
-
this.trigger(
|
|
5605
|
-
new Component.ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
5606
|
-
width: prevWidth,
|
|
5607
|
-
height: prevHeight,
|
|
5608
|
-
element: viewport.element
|
|
5609
|
-
})
|
|
5610
|
-
);
|
|
5611
|
-
viewport.resize();
|
|
5612
|
-
if (this._optimizeSizeUpdate) {
|
|
5613
|
-
if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
|
|
5614
|
-
await renderer.forceRenderAllPanels();
|
|
5663
|
+
resize() {
|
|
5664
|
+
return __async(this, null, function* () {
|
|
5665
|
+
if (!this._initialized) {
|
|
5666
|
+
return;
|
|
5615
5667
|
}
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
}
|
|
5633
|
-
if (control.animating) ;
|
|
5634
|
-
else {
|
|
5635
|
-
control.updatePosition(prevProgressInPanel);
|
|
5636
|
-
control.updateInput();
|
|
5637
|
-
}
|
|
5638
|
-
const newWidth = viewport.width;
|
|
5639
|
-
const newHeight = viewport.height;
|
|
5640
|
-
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
5641
|
-
this.trigger(
|
|
5642
|
-
new Component.ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
5643
|
-
width: viewport.width,
|
|
5644
|
-
height: viewport.height,
|
|
5645
|
-
prev: {
|
|
5668
|
+
if (this._isResizing) {
|
|
5669
|
+
this._scheduleResize = true;
|
|
5670
|
+
return;
|
|
5671
|
+
}
|
|
5672
|
+
this._scheduleResize = false;
|
|
5673
|
+
this._isResizing = true;
|
|
5674
|
+
const viewport = this._viewport;
|
|
5675
|
+
const renderer = this._renderer;
|
|
5676
|
+
const camera = this._camera;
|
|
5677
|
+
const control = this._control;
|
|
5678
|
+
const activePanel = control.activePanel;
|
|
5679
|
+
const prevWidth = viewport.width;
|
|
5680
|
+
const prevHeight = viewport.height;
|
|
5681
|
+
const prevProgressInPanel = activePanel ? camera.getProgressInPanel(activePanel) : 0;
|
|
5682
|
+
this.trigger(
|
|
5683
|
+
new Component.ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
5646
5684
|
width: prevWidth,
|
|
5647
|
-
height: prevHeight
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5685
|
+
height: prevHeight,
|
|
5686
|
+
element: viewport.element
|
|
5687
|
+
})
|
|
5688
|
+
);
|
|
5689
|
+
viewport.resize();
|
|
5690
|
+
if (this._optimizeSizeUpdate) {
|
|
5691
|
+
if (this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight) {
|
|
5692
|
+
yield renderer.forceRenderAllPanels();
|
|
5693
|
+
}
|
|
5694
|
+
} else {
|
|
5695
|
+
yield renderer.forceRenderAllPanels();
|
|
5696
|
+
}
|
|
5697
|
+
if (!this._initialized) {
|
|
5698
|
+
return;
|
|
5699
|
+
}
|
|
5700
|
+
renderer.updatePanelSize();
|
|
5701
|
+
camera.updateAlignPos();
|
|
5702
|
+
camera.updateRange();
|
|
5703
|
+
camera.updateAnchors();
|
|
5704
|
+
camera.updateAdaptiveHeight();
|
|
5705
|
+
camera.updatePanelOrder();
|
|
5706
|
+
camera.updateOffset();
|
|
5707
|
+
yield renderer.render();
|
|
5708
|
+
if (!this._initialized) {
|
|
5709
|
+
return;
|
|
5710
|
+
}
|
|
5711
|
+
if (control.animating) ;
|
|
5712
|
+
else {
|
|
5713
|
+
control.updatePosition(prevProgressInPanel);
|
|
5714
|
+
control.updateInput();
|
|
5715
|
+
}
|
|
5716
|
+
const newWidth = viewport.width;
|
|
5717
|
+
const newHeight = viewport.height;
|
|
5718
|
+
const sizeChanged = newWidth !== prevWidth || newHeight !== prevHeight;
|
|
5719
|
+
this.trigger(
|
|
5720
|
+
new Component.ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
5721
|
+
width: viewport.width,
|
|
5722
|
+
height: viewport.height,
|
|
5723
|
+
prev: {
|
|
5724
|
+
width: prevWidth,
|
|
5725
|
+
height: prevHeight
|
|
5726
|
+
},
|
|
5727
|
+
sizeChanged,
|
|
5728
|
+
element: viewport.element
|
|
5729
|
+
})
|
|
5730
|
+
);
|
|
5731
|
+
this._isResizing = false;
|
|
5732
|
+
if (this._scheduleResize) {
|
|
5733
|
+
void this.resize();
|
|
5734
|
+
}
|
|
5735
|
+
return;
|
|
5736
|
+
});
|
|
5658
5737
|
}
|
|
5659
5738
|
/**
|
|
5660
5739
|
* Add new panels after the last panel.
|
|
@@ -5743,10 +5822,11 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5743
5822
|
* Throws error if moveType is invalid.
|
|
5744
5823
|
*/
|
|
5745
5824
|
_createControl() {
|
|
5825
|
+
var _a;
|
|
5746
5826
|
const moveType = this._moveType;
|
|
5747
5827
|
const moveTypes = Object.keys(MOVE_TYPE).map((key) => MOVE_TYPE[key]);
|
|
5748
5828
|
const moveTypeStr = Array.isArray(moveType) ? moveType[0] : moveType;
|
|
5749
|
-
const moveTypeOptions = Array.isArray(moveType) ? moveType[1]
|
|
5829
|
+
const moveTypeOptions = Array.isArray(moveType) ? (_a = moveType[1]) != null ? _a : {} : {};
|
|
5750
5830
|
if (!includes(moveTypes, moveTypeStr)) {
|
|
5751
5831
|
throw new FlickingError(
|
|
5752
5832
|
MESSAGE.WRONG_OPTION("moveType", JSON.stringify(moveType)),
|
|
@@ -5799,7 +5879,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5799
5879
|
*/
|
|
5800
5880
|
_createExternalRenderer() {
|
|
5801
5881
|
const { renderer, rendererOptions } = this._renderExternal;
|
|
5802
|
-
return new renderer({ align: this._align,
|
|
5882
|
+
return new renderer(__spreadValues({ align: this._align }, rendererOptions));
|
|
5803
5883
|
}
|
|
5804
5884
|
/**
|
|
5805
5885
|
* Factory method to create VanillaRenderer for vanilla JavaScript rendering.
|
|
@@ -5890,7 +5970,7 @@ const _Flicking = class _Flicking extends Component {
|
|
|
5890
5970
|
);
|
|
5891
5971
|
}
|
|
5892
5972
|
};
|
|
5893
|
-
_Flicking.VERSION = "4.16.0";
|
|
5973
|
+
_Flicking.VERSION = "4.16.1-beta.0";
|
|
5894
5974
|
let Flicking = _Flicking;
|
|
5895
5975
|
const SIDE_EVENTS = {
|
|
5896
5976
|
HOLD_START: "sideHoldStart",
|
|
@@ -6073,10 +6153,9 @@ class CrossFlicking extends Flicking {
|
|
|
6073
6153
|
Object.keys(SIDE_EVENTS).forEach((name) => {
|
|
6074
6154
|
flicking.on(EVENTS[name], (event) => {
|
|
6075
6155
|
this.trigger(
|
|
6076
|
-
new Component.ComponentEvent(SIDE_EVENTS[name], {
|
|
6077
|
-
mainIndex
|
|
6078
|
-
|
|
6079
|
-
})
|
|
6156
|
+
new Component.ComponentEvent(SIDE_EVENTS[name], __spreadValues({
|
|
6157
|
+
mainIndex
|
|
6158
|
+
}, event))
|
|
6080
6159
|
);
|
|
6081
6160
|
});
|
|
6082
6161
|
});
|
|
@@ -6177,12 +6256,11 @@ class CrossFlicking extends Flicking {
|
|
|
6177
6256
|
}
|
|
6178
6257
|
_createSideFlicking() {
|
|
6179
6258
|
return this.sideState.map((state, i) => {
|
|
6180
|
-
return new Flicking(this.camera.children[i], {
|
|
6181
|
-
...this.sideOptions,
|
|
6259
|
+
return new Flicking(this.camera.children[i], __spreadProps(__spreadValues({}, this.sideOptions), {
|
|
6182
6260
|
horizontal: false,
|
|
6183
6261
|
panelsPerView: 1,
|
|
6184
6262
|
defaultIndex: state.start
|
|
6185
|
-
});
|
|
6263
|
+
}));
|
|
6186
6264
|
});
|
|
6187
6265
|
}
|
|
6188
6266
|
}
|
|
@@ -6329,13 +6407,15 @@ const withFlickingMethods = (prototype, flickingName) => {
|
|
|
6329
6407
|
const getterDescriptor = {};
|
|
6330
6408
|
if (descriptor.get) {
|
|
6331
6409
|
getterDescriptor.get = function() {
|
|
6410
|
+
var _a;
|
|
6332
6411
|
const flicking = this[flickingName];
|
|
6333
|
-
return flicking && descriptor.get
|
|
6412
|
+
return flicking && ((_a = descriptor.get) == null ? void 0 : _a.call(flicking));
|
|
6334
6413
|
};
|
|
6335
6414
|
}
|
|
6336
6415
|
if (descriptor.set) {
|
|
6337
6416
|
getterDescriptor.set = function(...args) {
|
|
6338
|
-
|
|
6417
|
+
var _a;
|
|
6418
|
+
return (_a = descriptor.set) == null ? void 0 : _a.call(this[flickingName], ...args);
|
|
6339
6419
|
};
|
|
6340
6420
|
}
|
|
6341
6421
|
Object.defineProperty(prototype, name, getterDescriptor);
|
|
@@ -6765,12 +6845,13 @@ const getIndexProgress = (flicking) => {
|
|
|
6765
6845
|
return indexProgress;
|
|
6766
6846
|
};
|
|
6767
6847
|
const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps }) => {
|
|
6848
|
+
var _a, _b, _c;
|
|
6768
6849
|
let flicking;
|
|
6769
6850
|
const moveTo = (i) => {
|
|
6770
6851
|
if (flicking == null) {
|
|
6771
6852
|
return Promise.reject(new Error("Flicking instance is not available"));
|
|
6772
6853
|
}
|
|
6773
|
-
if (flicking
|
|
6854
|
+
if (flicking == null ? void 0 : flicking.animating) {
|
|
6774
6855
|
return Promise.resolve();
|
|
6775
6856
|
}
|
|
6776
6857
|
return flicking.moveTo(i);
|
|
@@ -6778,12 +6859,12 @@ const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps })
|
|
|
6778
6859
|
setMethods(["moveTo"]);
|
|
6779
6860
|
const options = getProps().options;
|
|
6780
6861
|
const reactiveObj = reactive({
|
|
6781
|
-
isReachStart: options
|
|
6782
|
-
isReachEnd: options
|
|
6783
|
-
totalPanelCount: options
|
|
6784
|
-
currentPanelIndex: options
|
|
6862
|
+
isReachStart: (options == null ? void 0 : options.defaultIndex) ? (options == null ? void 0 : options.defaultIndex) === 0 : true,
|
|
6863
|
+
isReachEnd: (options == null ? void 0 : options.totalPanelCount) && (options == null ? void 0 : options.defaultIndex) ? options.defaultIndex === options.totalPanelCount - 1 : false,
|
|
6864
|
+
totalPanelCount: (_a = options == null ? void 0 : options.totalPanelCount) != null ? _a : 0,
|
|
6865
|
+
currentPanelIndex: (_b = options == null ? void 0 : options.defaultIndex) != null ? _b : 0,
|
|
6785
6866
|
progress: 0,
|
|
6786
|
-
indexProgress: options
|
|
6867
|
+
indexProgress: (_c = options == null ? void 0 : options.defaultIndex) != null ? _c : 0,
|
|
6787
6868
|
moveTo
|
|
6788
6869
|
});
|
|
6789
6870
|
const onChanged = () => {
|
|
@@ -6810,14 +6891,14 @@ const flickingReactiveAPIAdapter = ({ onInit, onDestroy, setMethods, getProps })
|
|
|
6810
6891
|
reactiveObj.currentPanelIndex = getCurrentPanelIndex(flicking);
|
|
6811
6892
|
reactiveObj.progress = getProgress(flicking);
|
|
6812
6893
|
reactiveObj.totalPanelCount = getTotalPanelCount(flicking);
|
|
6813
|
-
flicking
|
|
6814
|
-
flicking
|
|
6815
|
-
flicking
|
|
6894
|
+
flicking == null ? void 0 : flicking.on("changed", onChanged);
|
|
6895
|
+
flicking == null ? void 0 : flicking.on("panelChange", onPanelChange);
|
|
6896
|
+
flicking == null ? void 0 : flicking.on("move", onMove);
|
|
6816
6897
|
});
|
|
6817
6898
|
onDestroy(() => {
|
|
6818
|
-
flicking
|
|
6819
|
-
flicking
|
|
6820
|
-
flicking
|
|
6899
|
+
flicking == null ? void 0 : flicking.off("changed", onChanged);
|
|
6900
|
+
flicking == null ? void 0 : flicking.off("panelChange", onPanelChange);
|
|
6901
|
+
flicking == null ? void 0 : flicking.off("move", onMove);
|
|
6821
6902
|
});
|
|
6822
6903
|
return reactiveObj;
|
|
6823
6904
|
};
|