@kolserdav/swiper 1.0.0 → 1.0.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.
- package/dist/index.css +20 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.js +121 -6
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +125 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/navigate_next_black_24dp~NBZptwCk.svg +1 -0
- package/dist/navigate_next_black_24dp~kmANFsMv.svg +1 -0
- package/dist/navigate_next_black_48dp~bfNeNKBt.svg +1 -0
- package/dist/navigate_next_black_48dp~kmANFsMv.svg +1 -0
- package/package.json +3 -3
package/dist/index.css
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
._3_Zua {
|
|
15
|
-
background-color:
|
|
15
|
+
background-color: #fff;
|
|
16
16
|
border-radius: 1rem;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
left: 100%;
|
|
33
33
|
}
|
|
34
34
|
._uQNyq {
|
|
35
|
-
transition: left 0.
|
|
35
|
+
transition: left 0.4s ease-in 0s;
|
|
36
36
|
}
|
|
37
37
|
._8240d {
|
|
38
38
|
transition: left 0.4s ease-out 0s;
|
|
@@ -45,3 +45,21 @@
|
|
|
45
45
|
height: calc(100% - 48px);
|
|
46
46
|
box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
._7_rsx {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
position: absolute;
|
|
52
|
+
width: auto;
|
|
53
|
+
height: auto;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
._2kk22 {
|
|
59
|
+
right: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
._B1K5l {
|
|
63
|
+
left: 0;
|
|
64
|
+
transform: rotate(180deg);
|
|
65
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import React, { RefObject } from 'react';
|
|
|
4
4
|
*/
|
|
5
5
|
export interface Swipe {
|
|
6
6
|
id: number;
|
|
7
|
-
children: React.ReactElement | React.ReactElement[];
|
|
7
|
+
children: React.ReactElement | React.ReactElement[] | null;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Callback for get next or previous card content
|
|
11
11
|
*/
|
|
12
|
-
export declare type GetSwipeHandler = (oldId: number) => Swipe | Promise<Swipe>;
|
|
12
|
+
export declare type GetSwipeHandler = (oldId: number) => Swipe | null | Promise<Swipe | null>;
|
|
13
13
|
/**
|
|
14
14
|
* Props of Swiper component
|
|
15
15
|
*/
|
|
@@ -41,17 +41,17 @@ interface SwiperProps {
|
|
|
41
41
|
/**
|
|
42
42
|
* Button for swipe to next
|
|
43
43
|
*/
|
|
44
|
-
nextButtonRef?: RefObject<HTMLButtonElement | undefined>;
|
|
44
|
+
nextButtonRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
|
|
45
45
|
/**
|
|
46
46
|
* Button for swipe to previous
|
|
47
47
|
*/
|
|
48
|
-
prevButtonRef?: RefObject<HTMLButtonElement | undefined>;
|
|
48
|
+
prevButtonRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Swiper component
|
|
52
52
|
*/
|
|
53
53
|
declare const Swiper: {
|
|
54
|
-
(props: SwiperProps):
|
|
54
|
+
(props: SwiperProps): React.ReactElement;
|
|
55
55
|
defaultProps: {
|
|
56
56
|
className: string;
|
|
57
57
|
};
|
package/dist/index.js
CHANGED
|
@@ -197,7 +197,74 @@ function _switch(discriminant, cases) {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
var styles = {"container":"_p6aGD","paper":"_3_Zua","card":"_7l_j0","prev":"_2S9j_","next":"_2T1oW","back":"_uQNyq","go":"_8240d","content":"_1EOHv"};
|
|
200
|
+
var styles = {"container":"_p6aGD","paper":"_3_Zua","card":"_7l_j0","prev":"_2S9j_","next":"_2T1oW","back":"_uQNyq","go":"_8240d","content":"_1EOHv","button":"_7_rsx","button_next":"_2kk22","button_prev":"_B1K5l"};
|
|
201
|
+
|
|
202
|
+
var _path, _path2;
|
|
203
|
+
|
|
204
|
+
function _extends$1() {
|
|
205
|
+
_extends$1 = Object.assign || function (target) {
|
|
206
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
207
|
+
var source = arguments[i];
|
|
208
|
+
|
|
209
|
+
for (var key in source) {
|
|
210
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
211
|
+
target[key] = source[key];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return target;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
return _extends$1.apply(this, arguments);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function SvgNavigateNextBlack24Dp(props) {
|
|
223
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
224
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
225
|
+
height: 24,
|
|
226
|
+
width: 24
|
|
227
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
228
|
+
d: "M0 0h24v24H0V0z",
|
|
229
|
+
fill: "none"
|
|
230
|
+
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
231
|
+
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
232
|
+
})));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
var _path$1, _path2$1;
|
|
236
|
+
|
|
237
|
+
function _extends$2() {
|
|
238
|
+
_extends$2 = Object.assign || function (target) {
|
|
239
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
240
|
+
var source = arguments[i];
|
|
241
|
+
|
|
242
|
+
for (var key in source) {
|
|
243
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
244
|
+
target[key] = source[key];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return target;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
return _extends$2.apply(this, arguments);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function SvgNavigateNextBlack48Dp(props) {
|
|
256
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
257
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
258
|
+
height: 48,
|
|
259
|
+
viewBox: "0 0 24 24",
|
|
260
|
+
width: 48
|
|
261
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
262
|
+
d: "M0 0h24v24H0V0z",
|
|
263
|
+
fill: "none"
|
|
264
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
|
|
265
|
+
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
266
|
+
})));
|
|
267
|
+
}
|
|
201
268
|
|
|
202
269
|
var ANIMATION_TIMEOUT = 400;
|
|
203
270
|
|
|
@@ -256,7 +323,16 @@ var Swiper = function Swiper(props) {
|
|
|
256
323
|
left = _useState8[0],
|
|
257
324
|
setLeft = _useState8[1];
|
|
258
325
|
|
|
259
|
-
var
|
|
326
|
+
var _useState9 = React.useState(),
|
|
327
|
+
isMobile = _useState9[0],
|
|
328
|
+
setIsMobile = _useState9[1];
|
|
329
|
+
|
|
330
|
+
var containerRef = React.useRef(null);
|
|
331
|
+
|
|
332
|
+
var _buttonPrevRef = React.useRef(null);
|
|
333
|
+
|
|
334
|
+
var _buttonNextRef = React.useRef(null);
|
|
335
|
+
|
|
260
336
|
var swipes = React.useMemo(function () {
|
|
261
337
|
return getSwipes(_prev || prev, _current || current, _next || next);
|
|
262
338
|
}, [_next]);
|
|
@@ -412,7 +488,8 @@ var Swiper = function Swiper(props) {
|
|
|
412
488
|
|
|
413
489
|
var clickNextHandler = clickHandler('next');
|
|
414
490
|
var clickPrevHandler = clickHandler('prev');
|
|
415
|
-
|
|
491
|
+
|
|
492
|
+
var resizeHandler = function resizeHandler() {
|
|
416
493
|
var _containerRef$current, _containerRef$current2, _containerRef$current3, _containerRef$current4, _containerRef$current5, _containerRef$current6, _containerRef$current7, _containerRef$current8, _containerRef$current9;
|
|
417
494
|
|
|
418
495
|
var _width = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.parentElement) === null || _containerRef$current2 === void 0 ? void 0 : (_containerRef$current3 = _containerRef$current2.getBoundingClientRect()) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.width;
|
|
@@ -421,8 +498,34 @@ var Swiper = function Swiper(props) {
|
|
|
421
498
|
|
|
422
499
|
var __left = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current7 = containerRef.current) === null || _containerRef$current7 === void 0 ? void 0 : (_containerRef$current8 = _containerRef$current7.parentElement) === null || _containerRef$current8 === void 0 ? void 0 : (_containerRef$current9 = _containerRef$current8.getBoundingClientRect()) === null || _containerRef$current9 === void 0 ? void 0 : _containerRef$current9.left;
|
|
423
500
|
|
|
424
|
-
var
|
|
425
|
-
|
|
501
|
+
var _windowWidth = document.body.clientWidth;
|
|
502
|
+
|
|
503
|
+
if (_width && _height) {
|
|
504
|
+
console.log(_width);
|
|
505
|
+
setWidth(_width);
|
|
506
|
+
setHeight(_height);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (__left) {
|
|
510
|
+
setLeft(__left);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if (_windowWidth) {
|
|
514
|
+
setWindowWidth(_windowWidth);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
React.useEffect(function () {
|
|
519
|
+
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18;
|
|
520
|
+
|
|
521
|
+
var _width = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current10 = containerRef.current) === null || _containerRef$current10 === void 0 ? void 0 : (_containerRef$current11 = _containerRef$current10.parentElement) === null || _containerRef$current11 === void 0 ? void 0 : (_containerRef$current12 = _containerRef$current11.getBoundingClientRect()) === null || _containerRef$current12 === void 0 ? void 0 : _containerRef$current12.width;
|
|
522
|
+
|
|
523
|
+
var _height = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current13 = containerRef.current) === null || _containerRef$current13 === void 0 ? void 0 : (_containerRef$current14 = _containerRef$current13.parentElement) === null || _containerRef$current14 === void 0 ? void 0 : (_containerRef$current15 = _containerRef$current14.getBoundingClientRect()) === null || _containerRef$current15 === void 0 ? void 0 : _containerRef$current15.height;
|
|
524
|
+
|
|
525
|
+
var __left = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current16 = containerRef.current) === null || _containerRef$current16 === void 0 ? void 0 : (_containerRef$current17 = _containerRef$current16.parentElement) === null || _containerRef$current17 === void 0 ? void 0 : (_containerRef$current18 = _containerRef$current17.getBoundingClientRect()) === null || _containerRef$current18 === void 0 ? void 0 : _containerRef$current18.left;
|
|
526
|
+
|
|
527
|
+
var prevButton = prevButtonRef ? prevButtonRef === null || prevButtonRef === void 0 ? void 0 : prevButtonRef.current : _buttonPrevRef.current;
|
|
528
|
+
var nextButton = nextButtonRef ? nextButtonRef === null || nextButtonRef === void 0 ? void 0 : nextButtonRef.current : _buttonNextRef.current;
|
|
426
529
|
var _windowWidth = document.body.clientWidth;
|
|
427
530
|
|
|
428
531
|
if (_width && !width && _height && !height) {
|
|
@@ -444,11 +547,17 @@ var Swiper = function Swiper(props) {
|
|
|
444
547
|
setPrev(prev);
|
|
445
548
|
}
|
|
446
549
|
|
|
550
|
+
if (typeof isMobile === 'undefined') {
|
|
551
|
+
setIsMobile('ontouchstart' in window || typeof navigator.msMaxTouchPoints !== 'undefined');
|
|
552
|
+
}
|
|
553
|
+
|
|
447
554
|
prevButton === null || prevButton === void 0 ? void 0 : prevButton.addEventListener('click', clickPrevHandler);
|
|
448
555
|
nextButton === null || nextButton === void 0 ? void 0 : nextButton.addEventListener('click', clickNextHandler);
|
|
556
|
+
window.addEventListener('resize', resizeHandler);
|
|
449
557
|
return function () {
|
|
450
558
|
prevButton === null || prevButton === void 0 ? void 0 : prevButton.removeEventListener('click', clickPrevHandler);
|
|
451
559
|
nextButton === null || nextButton === void 0 ? void 0 : nextButton.removeEventListener('click', clickNextHandler);
|
|
560
|
+
window.removeEventListener('resize', resizeHandler);
|
|
452
561
|
};
|
|
453
562
|
}, [_next]);
|
|
454
563
|
return React__default.createElement("div", {
|
|
@@ -479,7 +588,13 @@ var Swiper = function Swiper(props) {
|
|
|
479
588
|
}, React__default.createElement("div", {
|
|
480
589
|
className: clsx(styles.content, className)
|
|
481
590
|
}, item.children));
|
|
482
|
-
})
|
|
591
|
+
}), !isMobile && !prevButtonRef && React__default.createElement("div", {
|
|
592
|
+
className: clsx(styles.button, styles.button_prev),
|
|
593
|
+
ref: _buttonPrevRef
|
|
594
|
+
}, windowWidth < 3000 ? React__default.createElement(SvgNavigateNextBlack24Dp, null) : React__default.createElement(SvgNavigateNextBlack48Dp, null)), !isMobile && !nextButtonRef && React__default.createElement("div", {
|
|
595
|
+
className: clsx(styles.button, styles.button_next),
|
|
596
|
+
ref: _buttonNextRef
|
|
597
|
+
}, windowWidth < 3000 ? React__default.createElement(SvgNavigateNextBlack24Dp, null) : React__default.createElement(SvgNavigateNextBlack48Dp, null)));
|
|
483
598
|
};
|
|
484
599
|
|
|
485
600
|
Swiper.defaultProps = {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.tsx"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import React, { useMemo, useState, createRef, RefObject, useEffect, TouchEvent } from 'react';\nimport clsx from 'clsx';\nimport styles from './index.module.css';\n\nconst ANIMATION_TIMEOUT = 400;\n\n/**\n * One of swipe card\n */\nexport interface Swipe {\n id: number;\n children: React.ReactElement | React.ReactElement[];\n}\n\n/**\n * Callback for get next or previous card content\n */\nexport type GetSwipeHandler = (oldId: number) => Swipe | Promise<Swipe>;\n\n/**\n * One of swipe card internal\n */\ninterface SwipeFull extends Swipe {\n type: 'next' | 'current' | 'prev';\n}\n\n/**\n * Event touch name\n */\ntype TouchName = 'onTouchMove' | 'onTouchStart' | 'onTouchEnd';\n\n/**\n * Props of Swiper component\n */\ninterface SwiperProps {\n /**\n * Current card content\n */\n current: Swipe;\n\n /**\n * Next card content\n */\n next: Swipe;\n\n /**\n * Previous card content\n */\n prev: Swipe;\n\n /**\n * Get next card handler\n */\n getNext: GetSwipeHandler;\n\n /**\n * Get previous card handler\n */\n getPrev: GetSwipeHandler;\n\n /**\n * Class name for content block\n */\n className?: string;\n\n /**\n * Button for swipe to next\n */\n nextButtonRef?: RefObject<HTMLButtonElement | undefined>;\n\n /**\n * Button for swipe to previous\n */\n prevButtonRef?: RefObject<HTMLButtonElement | undefined>;\n}\n\n/**\n * Create swipe list from values\n */\nconst getSwipes = (__prev: Swipe, __current: Swipe, __next: Swipe): SwipeFull[] => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any[] = [1, 2, 3].map((id) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const item: any = id === 1 ? { ...__prev } : id === 2 ? { ...__current } : { ...__next };\n item.type = id === 1 ? 'prev' : id === 2 ? 'current' : 'next';\n return item;\n });\n return result;\n};\n\nconst refs: {\n [key: number]: RefObject<HTMLDivElement>;\n} = {};\n\nlet startClientX: number;\nlet lastLeft: number;\n\n/**\n * Swiper component\n */\nconst Swiper = (props: SwiperProps) => {\n const { current, next, prev, getNext, getPrev, className, prevButtonRef, nextButtonRef } = props;\n\n const [_current, setCurrent] = useState<Swipe>();\n const [_prev, setPrev] = useState<Swipe>();\n const [_next, setNext] = useState<Swipe>();\n const [windowWidth, setWindowWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const [width, setWidth] = useState<number>(0);\n const [_left, _setLeft] = useState<number>(0);\n const [left, setLeft] = useState<number>(0);\n\n const containerRef = createRef<HTMLDivElement>();\n\n /**\n * Create memoized swipes\n */\n const swipes = useMemo(\n () => getSwipes(_prev || prev, _current || current, _next || next),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [_next]\n );\n\n /**\n * Get new or exists ref by id\n */\n const getRef = (id: number): typeof refs[0] => {\n refs[id] = refs[id] ? refs[id] : createRef<HTMLDivElement>();\n return refs[id];\n };\n\n /**\n * Set to cards classes for in animation\n */\n const setGoClass = () => {\n getRef(_next?.id || 0).current?.classList.add(styles.go);\n getRef(_prev?.id || 0).current?.classList.add(styles.go);\n getRef(_current?.id || 0).current?.classList.add(styles.go);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.go);\n getRef(_prev?.id || 0).current?.classList.remove(styles.go);\n getRef(_current?.id || 0).current?.classList.remove(styles.go);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Set to cards classes for out animation\n */\n const setBackClass = () => {\n getRef(_next?.id || 0).current?.classList.add(styles.back);\n getRef(_prev?.id || 0).current?.classList.add(styles.back);\n getRef(_current?.id || 0).current?.classList.add(styles.back);\n setLeft(0);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.back);\n getRef(_prev?.id || 0).current?.classList.remove(styles.back);\n getRef(_current?.id || 0).current?.classList.remove(styles.back);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Run swipe animation\n */\n const swipe = async (_lastLeft: number) => {\n if (Math.abs(_lastLeft) > width / 3) {\n setLeft(0);\n if (_lastLeft < 0) {\n setPrev(_current);\n setCurrent(_next);\n setNext(await getNext(_next?.id || 0));\n } else {\n setPrev(await getPrev(_prev?.id || 0));\n setCurrent(_prev);\n setNext(_current);\n }\n setGoClass();\n } else {\n setBackClass();\n }\n };\n\n /**\n * Touch event handler\n */\n const onTouchHandler = async (name: TouchName, e: TouchEvent) => {\n const { touches } = e;\n const clientX = touches[0]?.clientX;\n startClientX = startClientX || 0;\n switch (name) {\n case 'onTouchStart':\n startClientX = clientX;\n break;\n case 'onTouchMove':\n lastLeft = _left - (startClientX - clientX);\n setLeft(lastLeft);\n break;\n case 'onTouchEnd':\n await swipe(lastLeft);\n break;\n default:\n }\n };\n\n /**\n * Wait helper\n */\n const wait = async (miliseconds: number) => {\n await new Promise((resolve) => {\n setTimeout(() => {\n resolve(0);\n }, miliseconds);\n });\n };\n\n /**\n * Touch event wrapper\n */\n const onTouchWrapper =\n (name: TouchName): ((event: TouchEvent<HTMLDivElement>) => void) =>\n (e) => {\n onTouchHandler(name, e);\n };\n\n /**\n * On next or previous button click handler\n */\n const clickHandler = (origin: 'next' | 'prev') => {\n const isNext = origin === 'next';\n return async () => {\n const coeff = isNext ? -1 : 1;\n const leftVal = width * coeff;\n if (isNext) {\n setGoClass();\n } else {\n setBackClass();\n }\n setLeft(leftVal);\n await wait(ANIMATION_TIMEOUT / 2);\n await swipe(leftVal);\n };\n };\n\n /**\n * Wrapper for next button click handler\n */\n const clickNextHandler = clickHandler('next');\n\n /**\n * Wrapper for previous button click handler\n */\n const clickPrevHandler = clickHandler('prev');\n\n useEffect(() => {\n const _width = containerRef?.current?.parentElement?.getBoundingClientRect()?.width;\n const _height = containerRef?.current?.parentElement?.getBoundingClientRect()?.height;\n const __left = containerRef?.current?.parentElement?.getBoundingClientRect()?.left;\n const prevButton = prevButtonRef?.current;\n const nextButton = nextButtonRef?.current;\n const _windowWidth = document.body.clientWidth;\n if (_width && !width && _height && !height) {\n setWidth(_width);\n setHeight(_height);\n }\n // save container left\n if (__left && !left) {\n _setLeft(__left);\n }\n // save window width\n if (!windowWidth && _windowWidth) {\n setWindowWidth(_windowWidth);\n }\n // set start cards\n if (!_current || !_prev || !_next) {\n setCurrent(current);\n setNext(next);\n setPrev(prev);\n }\n prevButton?.addEventListener('click', clickPrevHandler);\n nextButton?.addEventListener('click', clickNextHandler);\n return () => {\n prevButton?.removeEventListener('click', clickPrevHandler);\n nextButton?.removeEventListener('click', clickNextHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_next]);\n\n return (\n <div className={styles.container} ref={containerRef}>\n {/** absolute position cards */}\n {swipes.map((item) => (\n <div\n onTouchMove={onTouchWrapper('onTouchMove')}\n onTouchStart={onTouchWrapper('onTouchStart')}\n onTouchEnd={onTouchWrapper('onTouchEnd')}\n key={item.id}\n id={item.id.toString()}\n style={\n item.type === 'current'\n ? { width, height, left }\n : item.type === 'prev'\n ? { width, height, left: left - windowWidth }\n : { width, height, left: left + windowWidth }\n }\n className={clsx(\n styles.card,\n item.type === 'prev' ? styles.prev : item.type === 'next' ? styles.next : ''\n )}\n ref={getRef(item.id)}\n >\n {/** Block of content */}\n <div className={clsx(styles.content, className)}>{item.children}</div>\n </div>\n ))}\n </div>\n );\n};\n\nSwiper.defaultProps = {\n className: '',\n};\n\nexport default Swiper;\n"],"names":["ANIMATION_TIMEOUT","getSwipes","__prev","__current","__next","result","map","id","item","type","refs","startClientX","lastLeft","Swiper","props","current","next","prev","getNext","getPrev","className","prevButtonRef","nextButtonRef","useState","_current","setCurrent","_prev","setPrev","_next","setNext","windowWidth","setWindowWidth","height","setHeight","width","setWidth","_left","_setLeft","left","setLeft","containerRef","createRef","swipes","useMemo","getRef","setGoClass","classList","add","styles","go","setTimeout","remove","setBackClass","back","swipe","_lastLeft","Math","abs","onTouchHandler","name","e","touches","clientX","wait","miliseconds","Promise","resolve","onTouchWrapper","clickHandler","origin","isNext","coeff","leftVal","clickNextHandler","clickPrevHandler","useEffect","_width","parentElement","getBoundingClientRect","_height","__left","prevButton","nextButton","_windowWidth","document","body","clientWidth","addEventListener","removeEventListener","React","container","ref","onTouchMove","onTouchStart","onTouchEnd","key","toString","style","clsx","card","content","children","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAM,KAAK,gB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AEyB,QAAAA,KAAK,EAALA,KAAF;AAASF,QAAAA,MAAM,EAANA,MAAT;AAAiBM,QAAAA,IAAI,EAAJA;AAAjB,OADJ,GAEI9B,IAAI,CAACC,IAAL,KAAc,MAAd,GACA;AAAEyB,QAAAA,KAAK,EAALA,KAAF;AAASF,QAAAA,MAAM,EAANA,MAAT;AAAiBM,QAAAA,IAAI,EAAEA,IAAI,GAAGR;AAA9B,OADA,GAEA;AAAEI,QAAAA,KAAK,EAALA,KAAF;AAASF,QAAAA,MAAM,EAANA,MAAT;AAAiBM,QAAAA,IAAI,EAAEA,IAAI,GAAGR;AAA9B;AAENV,MAAAA,SAAS,EAAE8E,IAAI,CACblD,MAAM,CAACmD,IADM,EAEb3F,IAAI,CAACC,IAAL,KAAc,MAAd,GAAuBuC,MAAM,CAAC/B,IAA9B,GAAqCT,IAAI,CAACC,IAAL,KAAc,MAAd,GAAuBuC,MAAM,CAAChC,IAA9B,GAAqC,EAF7D;AAIf2E,MAAAA,GAAG,EAAE/C,MAAM,CAACpC,IAAI,CAACD,EAAN;KAjBb,EAoBEkF,4BAAA,MAAA;AAAKrE,MAAAA,SAAS,EAAE8E,IAAI,CAAClD,MAAM,CAACoD,OAAR,EAAiBhF,SAAjB;KAApB,EAAkDZ,IAAI,CAAC6F,QAAvD,CApBF,CADU;AAAA,GAAX,CAFH,CADF;AA6BD,CAvND;;AAyNAxF,MAAM,CAACyF,YAAP,GAAsB;AACpBlF,EAAAA,SAAS,EAAE;AADS,CAAtB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.tsx"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import React, {\n useMemo,\n useState,\n useRef,\n createRef,\n RefObject,\n useEffect,\n TouchEvent,\n} from 'react';\nimport clsx from 'clsx';\nimport styles from './index.module.css';\nimport { ReactComponent as NextIcon } from './icons/navigate_next_black_24dp.svg';\nimport { ReactComponent as NextBigIcon } from './icons/navigate_next_black_48dp.svg';\n\nconst ANIMATION_TIMEOUT = 400;\n\n/**\n * One of swipe card\n */\nexport interface Swipe {\n id: number;\n children: React.ReactElement | React.ReactElement[] | null;\n}\n\n/**\n * Callback for get next or previous card content\n */\nexport type GetSwipeHandler = (oldId: number) => Swipe | null | Promise<Swipe | null>;\n\n/**\n * One of swipe card internal\n */\ninterface SwipeFull extends Swipe {\n type: 'next' | 'current' | 'prev';\n}\n\n/**\n * Event touch name\n */\ntype TouchName = 'onTouchMove' | 'onTouchStart' | 'onTouchEnd';\n\n/**\n * Props of Swiper component\n */\ninterface SwiperProps {\n /**\n * Current card content\n */\n current: Swipe;\n\n /**\n * Next card content\n */\n next: Swipe;\n\n /**\n * Previous card content\n */\n prev: Swipe;\n\n /**\n * Get next card handler\n */\n getNext: GetSwipeHandler;\n\n /**\n * Get previous card handler\n */\n getPrev: GetSwipeHandler;\n\n /**\n * Class name for content block\n */\n className?: string;\n\n /**\n * Button for swipe to next\n */\n nextButtonRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;\n\n /**\n * Button for swipe to previous\n */\n prevButtonRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;\n}\n\n/**\n * Create swipe list from values\n */\nconst getSwipes = (__prev: Swipe, __current: Swipe, __next: Swipe): SwipeFull[] => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any[] = [1, 2, 3].map((id) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const item: any = id === 1 ? { ...__prev } : id === 2 ? { ...__current } : { ...__next };\n item.type = id === 1 ? 'prev' : id === 2 ? 'current' : 'next';\n return item;\n });\n return result;\n};\n\nconst refs: {\n [key: number]: RefObject<HTMLDivElement>;\n} = {};\n\nlet startClientX: number;\nlet lastLeft: number;\n\n/**\n * Swiper component\n */\nconst Swiper = (props: SwiperProps): React.ReactElement => {\n const { current, next, prev, getNext, getPrev, className, prevButtonRef, nextButtonRef } = props;\n\n const [_current, setCurrent] = useState<Swipe | null>();\n const [_prev, setPrev] = useState<Swipe | null>();\n const [_next, setNext] = useState<Swipe | null>();\n const [windowWidth, setWindowWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const [width, setWidth] = useState<number>(0);\n const [_left, _setLeft] = useState<number>(0);\n const [left, setLeft] = useState<number>(0);\n const [isMobile, setIsMobile] = useState<boolean>();\n\n const containerRef = useRef<HTMLDivElement>(null);\n const _buttonPrevRef = useRef<HTMLDivElement>(null);\n const _buttonNextRef = useRef<HTMLDivElement>(null);\n\n /**\n * Create memoized swipes\n */\n const swipes = useMemo(\n () => getSwipes(_prev || prev, _current || current, _next || next),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [_next]\n );\n\n /**\n * Get new or exists ref by id\n */\n const getRef = (id: number): typeof refs[0] => {\n refs[id] = refs[id] ? refs[id] : createRef<HTMLDivElement>();\n return refs[id];\n };\n\n /**\n * Set to cards classes for in animation\n */\n const setGoClass = (): void => {\n getRef(_next?.id || 0).current?.classList.add(styles.go);\n getRef(_prev?.id || 0).current?.classList.add(styles.go);\n getRef(_current?.id || 0).current?.classList.add(styles.go);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.go);\n getRef(_prev?.id || 0).current?.classList.remove(styles.go);\n getRef(_current?.id || 0).current?.classList.remove(styles.go);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Set to cards classes for out animation\n */\n const setBackClass = (): void => {\n getRef(_next?.id || 0).current?.classList.add(styles.back);\n getRef(_prev?.id || 0).current?.classList.add(styles.back);\n getRef(_current?.id || 0).current?.classList.add(styles.back);\n setLeft(0);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.back);\n getRef(_prev?.id || 0).current?.classList.remove(styles.back);\n getRef(_current?.id || 0).current?.classList.remove(styles.back);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Run swipe animation\n */\n const swipe = async (_lastLeft: number): Promise<void> => {\n if (Math.abs(_lastLeft) > width / 3) {\n setLeft(0);\n if (_lastLeft < 0) {\n setPrev(_current);\n setCurrent(_next);\n setNext(await getNext(_next?.id || 0));\n } else {\n setPrev(await getPrev(_prev?.id || 0));\n setCurrent(_prev);\n setNext(_current);\n }\n setGoClass();\n } else {\n setBackClass();\n }\n };\n\n /**\n * Touch event handler\n */\n const onTouchHandler = async (name: TouchName, e: TouchEvent): Promise<void> => {\n const { touches } = e;\n const clientX = touches[0]?.clientX;\n startClientX = startClientX || 0;\n switch (name) {\n case 'onTouchStart':\n startClientX = clientX;\n break;\n case 'onTouchMove':\n lastLeft = _left - (startClientX - clientX);\n setLeft(lastLeft);\n break;\n case 'onTouchEnd':\n await swipe(lastLeft);\n break;\n default:\n }\n };\n\n /**\n * Wait helper\n */\n const wait = async (miliseconds: number): Promise<void> => {\n await new Promise((resolve) => {\n setTimeout(() => {\n resolve(0);\n }, miliseconds);\n });\n };\n\n /**\n * Touch event wrapper\n */\n const onTouchWrapper =\n (name: TouchName): ((event: TouchEvent<HTMLDivElement>) => void) =>\n (e): void => {\n onTouchHandler(name, e);\n };\n\n /**\n * On next or previous button click handler\n */\n const clickHandler = (origin: 'next' | 'prev'): (() => Promise<void>) => {\n const isNext = origin === 'next';\n return async (): Promise<void> => {\n const coeff = isNext ? -1 : 1;\n const leftVal = width * coeff;\n if (isNext) {\n setGoClass();\n } else {\n setBackClass();\n }\n setLeft(leftVal);\n await wait(ANIMATION_TIMEOUT / 2);\n await swipe(leftVal);\n };\n };\n\n /**\n * Wrapper for next button click handler\n */\n const clickNextHandler = clickHandler('next');\n\n /**\n * Wrapper for previous button click handler\n */\n const clickPrevHandler = clickHandler('prev');\n\n const resizeHandler = (): void => {\n const _width = containerRef?.current?.parentElement?.getBoundingClientRect()?.width;\n const _height = containerRef?.current?.parentElement?.getBoundingClientRect()?.height;\n const __left = containerRef?.current?.parentElement?.getBoundingClientRect()?.left;\n const _windowWidth = document.body.clientWidth;\n if (_width && _height) {\n console.log(_width);\n setWidth(_width);\n setHeight(_height);\n }\n if (__left) {\n setLeft(__left);\n }\n if (_windowWidth) {\n setWindowWidth(_windowWidth);\n }\n };\n\n useEffect(() => {\n const _width = containerRef?.current?.parentElement?.getBoundingClientRect()?.width;\n const _height = containerRef?.current?.parentElement?.getBoundingClientRect()?.height;\n const __left = containerRef?.current?.parentElement?.getBoundingClientRect()?.left;\n const prevButton = prevButtonRef ? prevButtonRef?.current : _buttonPrevRef.current;\n const nextButton = nextButtonRef ? nextButtonRef?.current : _buttonNextRef.current;\n const _windowWidth = document.body.clientWidth;\n if (_width && !width && _height && !height) {\n setWidth(_width);\n setHeight(_height);\n }\n // save container left\n if (__left && !left) {\n _setLeft(__left);\n }\n // save window width\n if (!windowWidth && _windowWidth) {\n setWindowWidth(_windowWidth);\n }\n // set start cards\n if (!_current || !_prev || !_next) {\n setCurrent(current);\n setNext(next);\n setPrev(prev);\n }\n // set is mobile\n if (typeof isMobile === 'undefined') {\n setIsMobile('ontouchstart' in window || typeof navigator.msMaxTouchPoints !== 'undefined');\n }\n prevButton?.addEventListener('click', clickPrevHandler);\n nextButton?.addEventListener('click', clickNextHandler);\n window.addEventListener('resize', resizeHandler);\n return (): void => {\n prevButton?.removeEventListener('click', clickPrevHandler);\n nextButton?.removeEventListener('click', clickNextHandler);\n window.removeEventListener('resize', resizeHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_next]);\n\n return (\n <div className={styles.container} ref={containerRef}>\n {/** absolute position cards */}\n {swipes.map((item) => (\n <div\n onTouchMove={onTouchWrapper('onTouchMove')}\n onTouchStart={onTouchWrapper('onTouchStart')}\n onTouchEnd={onTouchWrapper('onTouchEnd')}\n key={item.id}\n id={item.id.toString()}\n style={\n item.type === 'current'\n ? { width, height, left }\n : item.type === 'prev'\n ? { width, height, left: left - windowWidth }\n : { width, height, left: left + windowWidth }\n }\n className={clsx(\n styles.card,\n item.type === 'prev' ? styles.prev : item.type === 'next' ? styles.next : ''\n )}\n ref={getRef(item.id)}\n >\n {/** Block of content */}\n <div className={clsx(styles.content, className)}>{item.children}</div>\n </div>\n ))}\n {!isMobile && !prevButtonRef && (\n <div className={clsx(styles.button, styles.button_prev)} ref={_buttonPrevRef}>\n {windowWidth < 3000 ? <NextIcon /> : <NextBigIcon />}\n </div>\n )}\n {!isMobile && !nextButtonRef && (\n <div className={clsx(styles.button, styles.button_next)} ref={_buttonNextRef}>\n {windowWidth < 3000 ? <NextIcon /> : <NextBigIcon />}\n </div>\n )}\n </div>\n );\n};\n\nSwiper.defaultProps = {\n className: '',\n};\n\nexport default Swiper;\n"],"names":["ANIMATION_TIMEOUT","getSwipes","__prev","__current","__next","result","map","id","item","type","refs","startClientX","lastLeft","Swiper","props","current","next","prev","getNext","getPrev","className","prevButtonRef","nextButtonRef","useState","_current","setCurrent","_prev","setPrev","_next","setNext","windowWidth","setWindowWidth","height","setHeight","width","setWidth","_left","_setLeft","left","setLeft","isMobile","setIsMobile","containerRef","useRef","_buttonPrevRef","_buttonNextRef","swipes","useMemo","getRef","createRef","setGoClass","classList","add","styles","go","setTimeout","remove","setBackClass","back","swipe","_lastLeft","Math","abs","onTouchHandler","name","e","touches","clientX","wait","miliseconds","Promise","resolve","onTouchWrapper","clickHandler","origin","isNext","coeff","leftVal","clickNextHandler","clickPrevHandler","resizeHandler","_width","parentElement","getBoundingClientRect","_height","__left","_windowWidth","document","body","clientWidth","console","log","useEffect","prevButton","nextButton","window","navigator","msMaxTouchPoints","addEventListener","removeEventListener","React","container","ref","onTouchMove","onTouchStart","onTouchEnd","key","toString","style","clsx","card","content","children","button","button_prev","NextIcon","NextBigIcon","button_next","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAM,KAAK,gBAAgB,CAAC,WAAW;AAC9C,CAAC,SAAS,KAAK,GAAG,EAAE;AACpB,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,WAAW,EAAE,UAAU,EAAE;AAC1D,EAAE,MAAM,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;AAC7B,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;AACvB,EAAE,IAAI,KAAK,EAAE;AACb,GAAG,MAAM,Q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BAAA,MAAA;AAAKhF,IAAAA,SAAS,EAAEyF,IAAI,CAACxD,MAAM,CAAC4D,MAAR,EAAgB5D,MAAM,CAACgE,WAAvB;AAAqCf,IAAAA,GAAG,EAAEzD;GAA9D,EACGf,WAAW,GAAG,IAAd,GAAqBsE,4BAAA,CAACe,wBAAD,MAAA,CAArB,GAAoCf,4BAAA,CAACgB,wBAAD,MAAA,CADvC,CAhCJ,CADF;AAuCD,CA5PD;;AA8PAvG,MAAM,CAACyG,YAAP,GAAsB;AACpBlG,EAAAA,SAAS,EAAE;AADS,CAAtB;;;;"}
|
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { createElement, useState, useRef, useMemo, useEffect, createRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
|
|
4
4
|
function _extends() {
|
|
@@ -194,7 +194,74 @@ function _switch(discriminant, cases) {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
var styles = {"container":"_p6aGD","paper":"_3_Zua","card":"_7l_j0","prev":"_2S9j_","next":"_2T1oW","back":"_uQNyq","go":"_8240d","content":"_1EOHv"};
|
|
197
|
+
var styles = {"container":"_p6aGD","paper":"_3_Zua","card":"_7l_j0","prev":"_2S9j_","next":"_2T1oW","back":"_uQNyq","go":"_8240d","content":"_1EOHv","button":"_7_rsx","button_next":"_2kk22","button_prev":"_B1K5l"};
|
|
198
|
+
|
|
199
|
+
var _path, _path2;
|
|
200
|
+
|
|
201
|
+
function _extends$1() {
|
|
202
|
+
_extends$1 = Object.assign || function (target) {
|
|
203
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
204
|
+
var source = arguments[i];
|
|
205
|
+
|
|
206
|
+
for (var key in source) {
|
|
207
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
208
|
+
target[key] = source[key];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return target;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
return _extends$1.apply(this, arguments);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function SvgNavigateNextBlack24Dp(props) {
|
|
220
|
+
return /*#__PURE__*/createElement("svg", _extends$1({
|
|
221
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
222
|
+
height: 24,
|
|
223
|
+
width: 24
|
|
224
|
+
}, props), _path || (_path = /*#__PURE__*/createElement("path", {
|
|
225
|
+
d: "M0 0h24v24H0V0z",
|
|
226
|
+
fill: "none"
|
|
227
|
+
})), _path2 || (_path2 = /*#__PURE__*/createElement("path", {
|
|
228
|
+
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
229
|
+
})));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var _path$1, _path2$1;
|
|
233
|
+
|
|
234
|
+
function _extends$2() {
|
|
235
|
+
_extends$2 = Object.assign || function (target) {
|
|
236
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
237
|
+
var source = arguments[i];
|
|
238
|
+
|
|
239
|
+
for (var key in source) {
|
|
240
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
241
|
+
target[key] = source[key];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return target;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
return _extends$2.apply(this, arguments);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function SvgNavigateNextBlack48Dp(props) {
|
|
253
|
+
return /*#__PURE__*/createElement("svg", _extends$2({
|
|
254
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
255
|
+
height: 48,
|
|
256
|
+
viewBox: "0 0 24 24",
|
|
257
|
+
width: 48
|
|
258
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/createElement("path", {
|
|
259
|
+
d: "M0 0h24v24H0V0z",
|
|
260
|
+
fill: "none"
|
|
261
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/createElement("path", {
|
|
262
|
+
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
263
|
+
})));
|
|
264
|
+
}
|
|
198
265
|
|
|
199
266
|
var ANIMATION_TIMEOUT = 400;
|
|
200
267
|
|
|
@@ -253,7 +320,16 @@ var Swiper = function Swiper(props) {
|
|
|
253
320
|
left = _useState8[0],
|
|
254
321
|
setLeft = _useState8[1];
|
|
255
322
|
|
|
256
|
-
var
|
|
323
|
+
var _useState9 = useState(),
|
|
324
|
+
isMobile = _useState9[0],
|
|
325
|
+
setIsMobile = _useState9[1];
|
|
326
|
+
|
|
327
|
+
var containerRef = useRef(null);
|
|
328
|
+
|
|
329
|
+
var _buttonPrevRef = useRef(null);
|
|
330
|
+
|
|
331
|
+
var _buttonNextRef = useRef(null);
|
|
332
|
+
|
|
257
333
|
var swipes = useMemo(function () {
|
|
258
334
|
return getSwipes(_prev || prev, _current || current, _next || next);
|
|
259
335
|
}, [_next]);
|
|
@@ -409,7 +485,8 @@ var Swiper = function Swiper(props) {
|
|
|
409
485
|
|
|
410
486
|
var clickNextHandler = clickHandler('next');
|
|
411
487
|
var clickPrevHandler = clickHandler('prev');
|
|
412
|
-
|
|
488
|
+
|
|
489
|
+
var resizeHandler = function resizeHandler() {
|
|
413
490
|
var _containerRef$current, _containerRef$current2, _containerRef$current3, _containerRef$current4, _containerRef$current5, _containerRef$current6, _containerRef$current7, _containerRef$current8, _containerRef$current9;
|
|
414
491
|
|
|
415
492
|
var _width = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.parentElement) === null || _containerRef$current2 === void 0 ? void 0 : (_containerRef$current3 = _containerRef$current2.getBoundingClientRect()) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.width;
|
|
@@ -418,8 +495,34 @@ var Swiper = function Swiper(props) {
|
|
|
418
495
|
|
|
419
496
|
var __left = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current7 = containerRef.current) === null || _containerRef$current7 === void 0 ? void 0 : (_containerRef$current8 = _containerRef$current7.parentElement) === null || _containerRef$current8 === void 0 ? void 0 : (_containerRef$current9 = _containerRef$current8.getBoundingClientRect()) === null || _containerRef$current9 === void 0 ? void 0 : _containerRef$current9.left;
|
|
420
497
|
|
|
421
|
-
var
|
|
422
|
-
|
|
498
|
+
var _windowWidth = document.body.clientWidth;
|
|
499
|
+
|
|
500
|
+
if (_width && _height) {
|
|
501
|
+
console.log(_width);
|
|
502
|
+
setWidth(_width);
|
|
503
|
+
setHeight(_height);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
if (__left) {
|
|
507
|
+
setLeft(__left);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (_windowWidth) {
|
|
511
|
+
setWindowWidth(_windowWidth);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
useEffect(function () {
|
|
516
|
+
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18;
|
|
517
|
+
|
|
518
|
+
var _width = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current10 = containerRef.current) === null || _containerRef$current10 === void 0 ? void 0 : (_containerRef$current11 = _containerRef$current10.parentElement) === null || _containerRef$current11 === void 0 ? void 0 : (_containerRef$current12 = _containerRef$current11.getBoundingClientRect()) === null || _containerRef$current12 === void 0 ? void 0 : _containerRef$current12.width;
|
|
519
|
+
|
|
520
|
+
var _height = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current13 = containerRef.current) === null || _containerRef$current13 === void 0 ? void 0 : (_containerRef$current14 = _containerRef$current13.parentElement) === null || _containerRef$current14 === void 0 ? void 0 : (_containerRef$current15 = _containerRef$current14.getBoundingClientRect()) === null || _containerRef$current15 === void 0 ? void 0 : _containerRef$current15.height;
|
|
521
|
+
|
|
522
|
+
var __left = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current16 = containerRef.current) === null || _containerRef$current16 === void 0 ? void 0 : (_containerRef$current17 = _containerRef$current16.parentElement) === null || _containerRef$current17 === void 0 ? void 0 : (_containerRef$current18 = _containerRef$current17.getBoundingClientRect()) === null || _containerRef$current18 === void 0 ? void 0 : _containerRef$current18.left;
|
|
523
|
+
|
|
524
|
+
var prevButton = prevButtonRef ? prevButtonRef === null || prevButtonRef === void 0 ? void 0 : prevButtonRef.current : _buttonPrevRef.current;
|
|
525
|
+
var nextButton = nextButtonRef ? nextButtonRef === null || nextButtonRef === void 0 ? void 0 : nextButtonRef.current : _buttonNextRef.current;
|
|
423
526
|
var _windowWidth = document.body.clientWidth;
|
|
424
527
|
|
|
425
528
|
if (_width && !width && _height && !height) {
|
|
@@ -441,18 +544,24 @@ var Swiper = function Swiper(props) {
|
|
|
441
544
|
setPrev(prev);
|
|
442
545
|
}
|
|
443
546
|
|
|
547
|
+
if (typeof isMobile === 'undefined') {
|
|
548
|
+
setIsMobile('ontouchstart' in window || typeof navigator.msMaxTouchPoints !== 'undefined');
|
|
549
|
+
}
|
|
550
|
+
|
|
444
551
|
prevButton === null || prevButton === void 0 ? void 0 : prevButton.addEventListener('click', clickPrevHandler);
|
|
445
552
|
nextButton === null || nextButton === void 0 ? void 0 : nextButton.addEventListener('click', clickNextHandler);
|
|
553
|
+
window.addEventListener('resize', resizeHandler);
|
|
446
554
|
return function () {
|
|
447
555
|
prevButton === null || prevButton === void 0 ? void 0 : prevButton.removeEventListener('click', clickPrevHandler);
|
|
448
556
|
nextButton === null || nextButton === void 0 ? void 0 : nextButton.removeEventListener('click', clickNextHandler);
|
|
557
|
+
window.removeEventListener('resize', resizeHandler);
|
|
449
558
|
};
|
|
450
559
|
}, [_next]);
|
|
451
|
-
return
|
|
560
|
+
return React__default.createElement("div", {
|
|
452
561
|
className: styles.container,
|
|
453
562
|
ref: containerRef
|
|
454
563
|
}, swipes.map(function (item) {
|
|
455
|
-
return
|
|
564
|
+
return React__default.createElement("div", {
|
|
456
565
|
onTouchMove: onTouchWrapper('onTouchMove'),
|
|
457
566
|
onTouchStart: onTouchWrapper('onTouchStart'),
|
|
458
567
|
onTouchEnd: onTouchWrapper('onTouchEnd'),
|
|
@@ -473,10 +582,16 @@ var Swiper = function Swiper(props) {
|
|
|
473
582
|
},
|
|
474
583
|
className: clsx(styles.card, item.type === 'prev' ? styles.prev : item.type === 'next' ? styles.next : ''),
|
|
475
584
|
ref: getRef(item.id)
|
|
476
|
-
},
|
|
585
|
+
}, React__default.createElement("div", {
|
|
477
586
|
className: clsx(styles.content, className)
|
|
478
587
|
}, item.children));
|
|
479
|
-
})
|
|
588
|
+
}), !isMobile && !prevButtonRef && React__default.createElement("div", {
|
|
589
|
+
className: clsx(styles.button, styles.button_prev),
|
|
590
|
+
ref: _buttonPrevRef
|
|
591
|
+
}, windowWidth < 3000 ? React__default.createElement(SvgNavigateNextBlack24Dp, null) : React__default.createElement(SvgNavigateNextBlack48Dp, null)), !isMobile && !nextButtonRef && React__default.createElement("div", {
|
|
592
|
+
className: clsx(styles.button, styles.button_next),
|
|
593
|
+
ref: _buttonNextRef
|
|
594
|
+
}, windowWidth < 3000 ? React__default.createElement(SvgNavigateNextBlack24Dp, null) : React__default.createElement(SvgNavigateNextBlack48Dp, null)));
|
|
480
595
|
};
|
|
481
596
|
|
|
482
597
|
Swiper.defaultProps = {
|
package/dist/index.modern.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.tsx"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import React, { useMemo, useState, createRef, RefObject, useEffect, TouchEvent } from 'react';\nimport clsx from 'clsx';\nimport styles from './index.module.css';\n\nconst ANIMATION_TIMEOUT = 400;\n\n/**\n * One of swipe card\n */\nexport interface Swipe {\n id: number;\n children: React.ReactElement | React.ReactElement[];\n}\n\n/**\n * Callback for get next or previous card content\n */\nexport type GetSwipeHandler = (oldId: number) => Swipe | Promise<Swipe>;\n\n/**\n * One of swipe card internal\n */\ninterface SwipeFull extends Swipe {\n type: 'next' | 'current' | 'prev';\n}\n\n/**\n * Event touch name\n */\ntype TouchName = 'onTouchMove' | 'onTouchStart' | 'onTouchEnd';\n\n/**\n * Props of Swiper component\n */\ninterface SwiperProps {\n /**\n * Current card content\n */\n current: Swipe;\n\n /**\n * Next card content\n */\n next: Swipe;\n\n /**\n * Previous card content\n */\n prev: Swipe;\n\n /**\n * Get next card handler\n */\n getNext: GetSwipeHandler;\n\n /**\n * Get previous card handler\n */\n getPrev: GetSwipeHandler;\n\n /**\n * Class name for content block\n */\n className?: string;\n\n /**\n * Button for swipe to next\n */\n nextButtonRef?: RefObject<HTMLButtonElement | undefined>;\n\n /**\n * Button for swipe to previous\n */\n prevButtonRef?: RefObject<HTMLButtonElement | undefined>;\n}\n\n/**\n * Create swipe list from values\n */\nconst getSwipes = (__prev: Swipe, __current: Swipe, __next: Swipe): SwipeFull[] => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any[] = [1, 2, 3].map((id) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const item: any = id === 1 ? { ...__prev } : id === 2 ? { ...__current } : { ...__next };\n item.type = id === 1 ? 'prev' : id === 2 ? 'current' : 'next';\n return item;\n });\n return result;\n};\n\nconst refs: {\n [key: number]: RefObject<HTMLDivElement>;\n} = {};\n\nlet startClientX: number;\nlet lastLeft: number;\n\n/**\n * Swiper component\n */\nconst Swiper = (props: SwiperProps) => {\n const { current, next, prev, getNext, getPrev, className, prevButtonRef, nextButtonRef } = props;\n\n const [_current, setCurrent] = useState<Swipe>();\n const [_prev, setPrev] = useState<Swipe>();\n const [_next, setNext] = useState<Swipe>();\n const [windowWidth, setWindowWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const [width, setWidth] = useState<number>(0);\n const [_left, _setLeft] = useState<number>(0);\n const [left, setLeft] = useState<number>(0);\n\n const containerRef = createRef<HTMLDivElement>();\n\n /**\n * Create memoized swipes\n */\n const swipes = useMemo(\n () => getSwipes(_prev || prev, _current || current, _next || next),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [_next]\n );\n\n /**\n * Get new or exists ref by id\n */\n const getRef = (id: number): typeof refs[0] => {\n refs[id] = refs[id] ? refs[id] : createRef<HTMLDivElement>();\n return refs[id];\n };\n\n /**\n * Set to cards classes for in animation\n */\n const setGoClass = () => {\n getRef(_next?.id || 0).current?.classList.add(styles.go);\n getRef(_prev?.id || 0).current?.classList.add(styles.go);\n getRef(_current?.id || 0).current?.classList.add(styles.go);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.go);\n getRef(_prev?.id || 0).current?.classList.remove(styles.go);\n getRef(_current?.id || 0).current?.classList.remove(styles.go);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Set to cards classes for out animation\n */\n const setBackClass = () => {\n getRef(_next?.id || 0).current?.classList.add(styles.back);\n getRef(_prev?.id || 0).current?.classList.add(styles.back);\n getRef(_current?.id || 0).current?.classList.add(styles.back);\n setLeft(0);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.back);\n getRef(_prev?.id || 0).current?.classList.remove(styles.back);\n getRef(_current?.id || 0).current?.classList.remove(styles.back);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Run swipe animation\n */\n const swipe = async (_lastLeft: number) => {\n if (Math.abs(_lastLeft) > width / 3) {\n setLeft(0);\n if (_lastLeft < 0) {\n setPrev(_current);\n setCurrent(_next);\n setNext(await getNext(_next?.id || 0));\n } else {\n setPrev(await getPrev(_prev?.id || 0));\n setCurrent(_prev);\n setNext(_current);\n }\n setGoClass();\n } else {\n setBackClass();\n }\n };\n\n /**\n * Touch event handler\n */\n const onTouchHandler = async (name: TouchName, e: TouchEvent) => {\n const { touches } = e;\n const clientX = touches[0]?.clientX;\n startClientX = startClientX || 0;\n switch (name) {\n case 'onTouchStart':\n startClientX = clientX;\n break;\n case 'onTouchMove':\n lastLeft = _left - (startClientX - clientX);\n setLeft(lastLeft);\n break;\n case 'onTouchEnd':\n await swipe(lastLeft);\n break;\n default:\n }\n };\n\n /**\n * Wait helper\n */\n const wait = async (miliseconds: number) => {\n await new Promise((resolve) => {\n setTimeout(() => {\n resolve(0);\n }, miliseconds);\n });\n };\n\n /**\n * Touch event wrapper\n */\n const onTouchWrapper =\n (name: TouchName): ((event: TouchEvent<HTMLDivElement>) => void) =>\n (e) => {\n onTouchHandler(name, e);\n };\n\n /**\n * On next or previous button click handler\n */\n const clickHandler = (origin: 'next' | 'prev') => {\n const isNext = origin === 'next';\n return async () => {\n const coeff = isNext ? -1 : 1;\n const leftVal = width * coeff;\n if (isNext) {\n setGoClass();\n } else {\n setBackClass();\n }\n setLeft(leftVal);\n await wait(ANIMATION_TIMEOUT / 2);\n await swipe(leftVal);\n };\n };\n\n /**\n * Wrapper for next button click handler\n */\n const clickNextHandler = clickHandler('next');\n\n /**\n * Wrapper for previous button click handler\n */\n const clickPrevHandler = clickHandler('prev');\n\n useEffect(() => {\n const _width = containerRef?.current?.parentElement?.getBoundingClientRect()?.width;\n const _height = containerRef?.current?.parentElement?.getBoundingClientRect()?.height;\n const __left = containerRef?.current?.parentElement?.getBoundingClientRect()?.left;\n const prevButton = prevButtonRef?.current;\n const nextButton = nextButtonRef?.current;\n const _windowWidth = document.body.clientWidth;\n if (_width && !width && _height && !height) {\n setWidth(_width);\n setHeight(_height);\n }\n // save container left\n if (__left && !left) {\n _setLeft(__left);\n }\n // save window width\n if (!windowWidth && _windowWidth) {\n setWindowWidth(_windowWidth);\n }\n // set start cards\n if (!_current || !_prev || !_next) {\n setCurrent(current);\n setNext(next);\n setPrev(prev);\n }\n prevButton?.addEventListener('click', clickPrevHandler);\n nextButton?.addEventListener('click', clickNextHandler);\n return () => {\n prevButton?.removeEventListener('click', clickPrevHandler);\n nextButton?.removeEventListener('click', clickNextHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_next]);\n\n return (\n <div className={styles.container} ref={containerRef}>\n {/** absolute position cards */}\n {swipes.map((item) => (\n <div\n onTouchMove={onTouchWrapper('onTouchMove')}\n onTouchStart={onTouchWrapper('onTouchStart')}\n onTouchEnd={onTouchWrapper('onTouchEnd')}\n key={item.id}\n id={item.id.toString()}\n style={\n item.type === 'current'\n ? { width, height, left }\n : item.type === 'prev'\n ? { width, height, left: left - windowWidth }\n : { width, height, left: left + windowWidth }\n }\n className={clsx(\n styles.card,\n item.type === 'prev' ? styles.prev : item.type === 'next' ? styles.next : ''\n )}\n ref={getRef(item.id)}\n >\n {/** Block of content */}\n <div className={clsx(styles.content, className)}>{item.children}</div>\n </div>\n ))}\n </div>\n );\n};\n\nSwiper.defaultProps = {\n className: '',\n};\n\nexport default Swiper;\n"],"names":["ANIMATION_TIMEOUT","getSwipes","__prev","__current","__next","result","map","id","item","type","refs","startClientX","lastLeft","Swiper","props","current","next","prev","getNext","getPrev","className","prevButtonRef","nextButtonRef","useState","_current","setCurrent","_prev","setPrev","_next","setNext","windowWidth","setWindowWidth","height","setHeight","width","setWidth","_left","_setLeft","left","setLeft","containerRef","createRef","swipes","useMemo","getRef","setGoClass","classList","add","styles","go","setTimeout","remove","setBackClass","back","swipe","_lastLeft","Math","abs","onTouchHandler","name","e","touches","clientX","wait","miliseconds","Promise","resolve","onTouchWrapper","clickHandler","origin","isNext","coeff","leftVal","clickNextHandler","clickPrevHandler","useEffect","_width","parentElement","getBoundingClientRect","_height","__left","prevButton","nextButton","_windowWidth","document","body","clientWidth","addEventListener","removeEventListener","React","container","ref","onTouchMove","onTouchStart","onTouchEnd","key","toString","style","clsx","card","content","children","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAM,KAAK,gBAAgB,CAAC,WAAW;AAC9C,CAAC,SAAS,KAAK,GAAG,EAAE;AACpB,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,WAAW,EAAE,UAAU,EAAE;AAC1D,EAAE,MAAM,MAAM,GAAG,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AAK,EAALA,KAAF;AAASF,QAAAA,MAAM,EAANA,MAAT;AAAiBM,QAAAA,IAAI,EAAEA,IAAI,GAAGR;AAA9B,OADA,GAEA;AAAEI,QAAAA,KAAK,EAALA,KAAF;AAASF,QAAAA,MAAM,EAANA,MAAT;AAAiBM,QAAAA,IAAI,EAAEA,IAAI,GAAGR;AAA9B;AAENV,MAAAA,SAAS,EAAE8E,IAAI,CACblD,MAAM,CAACmD,IADM,EAEb3F,IAAI,CAACC,IAAL,KAAc,MAAd,GAAuBuC,MAAM,CAAC/B,IAA9B,GAAqCT,IAAI,CAACC,IAAL,KAAc,MAAd,GAAuBuC,MAAM,CAAChC,IAA9B,GAAqC,EAF7D;AAIf2E,MAAAA,GAAG,EAAE/C,MAAM,CAACpC,IAAI,CAACD,EAAN;KAjBb,EAoBEkF,mBAAA,MAAA;AAAKrE,MAAAA,SAAS,EAAE8E,IAAI,CAAClD,MAAM,CAACoD,OAAR,EAAiBhF,SAAjB;KAApB,EAAkDZ,IAAI,CAAC6F,QAAvD,CApBF,CADU;AAAA,GAAX,CAFH,CADF;AA6BD,CAvND;;AAyNAxF,MAAM,CAACyF,YAAP,GAAsB;AACpBlF,EAAAA,SAAS,EAAE;AADS,CAAtB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.modern.js","sources":["../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.tsx"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import React, {\n useMemo,\n useState,\n useRef,\n createRef,\n RefObject,\n useEffect,\n TouchEvent,\n} from 'react';\nimport clsx from 'clsx';\nimport styles from './index.module.css';\nimport { ReactComponent as NextIcon } from './icons/navigate_next_black_24dp.svg';\nimport { ReactComponent as NextBigIcon } from './icons/navigate_next_black_48dp.svg';\n\nconst ANIMATION_TIMEOUT = 400;\n\n/**\n * One of swipe card\n */\nexport interface Swipe {\n id: number;\n children: React.ReactElement | React.ReactElement[] | null;\n}\n\n/**\n * Callback for get next or previous card content\n */\nexport type GetSwipeHandler = (oldId: number) => Swipe | null | Promise<Swipe | null>;\n\n/**\n * One of swipe card internal\n */\ninterface SwipeFull extends Swipe {\n type: 'next' | 'current' | 'prev';\n}\n\n/**\n * Event touch name\n */\ntype TouchName = 'onTouchMove' | 'onTouchStart' | 'onTouchEnd';\n\n/**\n * Props of Swiper component\n */\ninterface SwiperProps {\n /**\n * Current card content\n */\n current: Swipe;\n\n /**\n * Next card content\n */\n next: Swipe;\n\n /**\n * Previous card content\n */\n prev: Swipe;\n\n /**\n * Get next card handler\n */\n getNext: GetSwipeHandler;\n\n /**\n * Get previous card handler\n */\n getPrev: GetSwipeHandler;\n\n /**\n * Class name for content block\n */\n className?: string;\n\n /**\n * Button for swipe to next\n */\n nextButtonRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;\n\n /**\n * Button for swipe to previous\n */\n prevButtonRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;\n}\n\n/**\n * Create swipe list from values\n */\nconst getSwipes = (__prev: Swipe, __current: Swipe, __next: Swipe): SwipeFull[] => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any[] = [1, 2, 3].map((id) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const item: any = id === 1 ? { ...__prev } : id === 2 ? { ...__current } : { ...__next };\n item.type = id === 1 ? 'prev' : id === 2 ? 'current' : 'next';\n return item;\n });\n return result;\n};\n\nconst refs: {\n [key: number]: RefObject<HTMLDivElement>;\n} = {};\n\nlet startClientX: number;\nlet lastLeft: number;\n\n/**\n * Swiper component\n */\nconst Swiper = (props: SwiperProps): React.ReactElement => {\n const { current, next, prev, getNext, getPrev, className, prevButtonRef, nextButtonRef } = props;\n\n const [_current, setCurrent] = useState<Swipe | null>();\n const [_prev, setPrev] = useState<Swipe | null>();\n const [_next, setNext] = useState<Swipe | null>();\n const [windowWidth, setWindowWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const [width, setWidth] = useState<number>(0);\n const [_left, _setLeft] = useState<number>(0);\n const [left, setLeft] = useState<number>(0);\n const [isMobile, setIsMobile] = useState<boolean>();\n\n const containerRef = useRef<HTMLDivElement>(null);\n const _buttonPrevRef = useRef<HTMLDivElement>(null);\n const _buttonNextRef = useRef<HTMLDivElement>(null);\n\n /**\n * Create memoized swipes\n */\n const swipes = useMemo(\n () => getSwipes(_prev || prev, _current || current, _next || next),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [_next]\n );\n\n /**\n * Get new or exists ref by id\n */\n const getRef = (id: number): typeof refs[0] => {\n refs[id] = refs[id] ? refs[id] : createRef<HTMLDivElement>();\n return refs[id];\n };\n\n /**\n * Set to cards classes for in animation\n */\n const setGoClass = (): void => {\n getRef(_next?.id || 0).current?.classList.add(styles.go);\n getRef(_prev?.id || 0).current?.classList.add(styles.go);\n getRef(_current?.id || 0).current?.classList.add(styles.go);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.go);\n getRef(_prev?.id || 0).current?.classList.remove(styles.go);\n getRef(_current?.id || 0).current?.classList.remove(styles.go);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Set to cards classes for out animation\n */\n const setBackClass = (): void => {\n getRef(_next?.id || 0).current?.classList.add(styles.back);\n getRef(_prev?.id || 0).current?.classList.add(styles.back);\n getRef(_current?.id || 0).current?.classList.add(styles.back);\n setLeft(0);\n setTimeout(() => {\n getRef(_next?.id || 0).current?.classList.remove(styles.back);\n getRef(_prev?.id || 0).current?.classList.remove(styles.back);\n getRef(_current?.id || 0).current?.classList.remove(styles.back);\n }, ANIMATION_TIMEOUT);\n };\n\n /**\n * Run swipe animation\n */\n const swipe = async (_lastLeft: number): Promise<void> => {\n if (Math.abs(_lastLeft) > width / 3) {\n setLeft(0);\n if (_lastLeft < 0) {\n setPrev(_current);\n setCurrent(_next);\n setNext(await getNext(_next?.id || 0));\n } else {\n setPrev(await getPrev(_prev?.id || 0));\n setCurrent(_prev);\n setNext(_current);\n }\n setGoClass();\n } else {\n setBackClass();\n }\n };\n\n /**\n * Touch event handler\n */\n const onTouchHandler = async (name: TouchName, e: TouchEvent): Promise<void> => {\n const { touches } = e;\n const clientX = touches[0]?.clientX;\n startClientX = startClientX || 0;\n switch (name) {\n case 'onTouchStart':\n startClientX = clientX;\n break;\n case 'onTouchMove':\n lastLeft = _left - (startClientX - clientX);\n setLeft(lastLeft);\n break;\n case 'onTouchEnd':\n await swipe(lastLeft);\n break;\n default:\n }\n };\n\n /**\n * Wait helper\n */\n const wait = async (miliseconds: number): Promise<void> => {\n await new Promise((resolve) => {\n setTimeout(() => {\n resolve(0);\n }, miliseconds);\n });\n };\n\n /**\n * Touch event wrapper\n */\n const onTouchWrapper =\n (name: TouchName): ((event: TouchEvent<HTMLDivElement>) => void) =>\n (e): void => {\n onTouchHandler(name, e);\n };\n\n /**\n * On next or previous button click handler\n */\n const clickHandler = (origin: 'next' | 'prev'): (() => Promise<void>) => {\n const isNext = origin === 'next';\n return async (): Promise<void> => {\n const coeff = isNext ? -1 : 1;\n const leftVal = width * coeff;\n if (isNext) {\n setGoClass();\n } else {\n setBackClass();\n }\n setLeft(leftVal);\n await wait(ANIMATION_TIMEOUT / 2);\n await swipe(leftVal);\n };\n };\n\n /**\n * Wrapper for next button click handler\n */\n const clickNextHandler = clickHandler('next');\n\n /**\n * Wrapper for previous button click handler\n */\n const clickPrevHandler = clickHandler('prev');\n\n const resizeHandler = (): void => {\n const _width = containerRef?.current?.parentElement?.getBoundingClientRect()?.width;\n const _height = containerRef?.current?.parentElement?.getBoundingClientRect()?.height;\n const __left = containerRef?.current?.parentElement?.getBoundingClientRect()?.left;\n const _windowWidth = document.body.clientWidth;\n if (_width && _height) {\n console.log(_width);\n setWidth(_width);\n setHeight(_height);\n }\n if (__left) {\n setLeft(__left);\n }\n if (_windowWidth) {\n setWindowWidth(_windowWidth);\n }\n };\n\n useEffect(() => {\n const _width = containerRef?.current?.parentElement?.getBoundingClientRect()?.width;\n const _height = containerRef?.current?.parentElement?.getBoundingClientRect()?.height;\n const __left = containerRef?.current?.parentElement?.getBoundingClientRect()?.left;\n const prevButton = prevButtonRef ? prevButtonRef?.current : _buttonPrevRef.current;\n const nextButton = nextButtonRef ? nextButtonRef?.current : _buttonNextRef.current;\n const _windowWidth = document.body.clientWidth;\n if (_width && !width && _height && !height) {\n setWidth(_width);\n setHeight(_height);\n }\n // save container left\n if (__left && !left) {\n _setLeft(__left);\n }\n // save window width\n if (!windowWidth && _windowWidth) {\n setWindowWidth(_windowWidth);\n }\n // set start cards\n if (!_current || !_prev || !_next) {\n setCurrent(current);\n setNext(next);\n setPrev(prev);\n }\n // set is mobile\n if (typeof isMobile === 'undefined') {\n setIsMobile('ontouchstart' in window || typeof navigator.msMaxTouchPoints !== 'undefined');\n }\n prevButton?.addEventListener('click', clickPrevHandler);\n nextButton?.addEventListener('click', clickNextHandler);\n window.addEventListener('resize', resizeHandler);\n return (): void => {\n prevButton?.removeEventListener('click', clickPrevHandler);\n nextButton?.removeEventListener('click', clickNextHandler);\n window.removeEventListener('resize', resizeHandler);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_next]);\n\n return (\n <div className={styles.container} ref={containerRef}>\n {/** absolute position cards */}\n {swipes.map((item) => (\n <div\n onTouchMove={onTouchWrapper('onTouchMove')}\n onTouchStart={onTouchWrapper('onTouchStart')}\n onTouchEnd={onTouchWrapper('onTouchEnd')}\n key={item.id}\n id={item.id.toString()}\n style={\n item.type === 'current'\n ? { width, height, left }\n : item.type === 'prev'\n ? { width, height, left: left - windowWidth }\n : { width, height, left: left + windowWidth }\n }\n className={clsx(\n styles.card,\n item.type === 'prev' ? styles.prev : item.type === 'next' ? styles.next : ''\n )}\n ref={getRef(item.id)}\n >\n {/** Block of content */}\n <div className={clsx(styles.content, className)}>{item.children}</div>\n </div>\n ))}\n {!isMobile && !prevButtonRef && (\n <div className={clsx(styles.button, styles.button_prev)} ref={_buttonPrevRef}>\n {windowWidth < 3000 ? <NextIcon /> : <NextBigIcon />}\n </div>\n )}\n {!isMobile && !nextButtonRef && (\n <div className={clsx(styles.button, styles.button_next)} ref={_buttonNextRef}>\n {windowWidth < 3000 ? <NextIcon /> : <NextBigIcon />}\n </div>\n )}\n </div>\n );\n};\n\nSwiper.defaultProps = {\n className: '',\n};\n\nexport default Swiper;\n"],"names":["ANIMATION_TIMEOUT","getSwipes","__prev","__current","__next","result","map","id","item","type","refs","startClientX","lastLeft","Swiper","props","current","next","prev","getNext","getPrev","className","prevButtonRef","nextButtonRef","useState","_current","setCurrent","_prev","setPrev","_next","setNext","windowWidth","setWindowWidth","height","setHeight","width","setWidth","_left","_setLeft","left","setLeft","isMobile","setIsMobile","containerRef","useRef","_buttonPrevRef","_buttonNextRef","swipes","useMemo","getRef","createRef","setGoClass","classList","add","styles","go","setTimeout","remove","setBackClass","back","swipe","_lastLeft","Math","abs","onTouchHandler","name","e","touches","clientX","wait","miliseconds","Promise","resolve","onTouchWrapper","clickHandler","origin","isNext","coeff","leftVal","clickNextHandler","clickPrevHandler","resizeHandler","_width","parentElement","getBoundingClientRect","_height","__left","_windowWidth","document","body","clientWidth","console","log","useEffect","prevButton","nextButton","window","navigator","msMaxTouchPoints","addEventListener","removeEventListener","React","container","ref","onTouchMove","onTouchStart","onTouchEnd","key","toString","style","clsx","card","content","children","button","button_prev","NextIcon","NextBigIcon","button_next","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACO,MAAM,KAAK,gBAAgB,CAAC,WAAW;AAC9C,CAAC,SAAS,KAAK,GAAG,EAAE;AACpB,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,WAAW,EAAE,UAAU,EAAE;AAC1D,EAAE,MAAM,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;AAC7B,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;AACvB,EAAE,IAAI,KAAK,EAAE;AACb,GAAG,MAAM,QAAQ,GAAG,KAAK,GAAG,CAAC,GAAG,WAAW,GAAG,UAAU,CAAC;AACzD,GAAG,IAAI,QAAQ,EAAE;AACjB,IAAI,IAAI;AACR,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,C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d,GAAqBsE,4BAAA,CAACe,wBAAD,MAAA,CAArB,GAAoCf,4BAAA,CAACgB,wBAAD,MAAA,CADvC,CAhCJ,CADF;AAuCD,CA5PD;;AA8PAvG,MAAM,CAACyG,YAAP,GAAsB;AACpBlG,EAAAA,SAAS,EAAE;AADS,CAAtB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 48 48" width="48px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"/></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolserdav/swiper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Simple and powerfull react swiper component",
|
|
5
5
|
"author": "kolserdav",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,11 +36,9 @@
|
|
|
36
36
|
"@types/react-dom": "^16.9.7",
|
|
37
37
|
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
|
38
38
|
"@typescript-eslint/parser": "^2.26.0",
|
|
39
|
-
"airbnb": "^0.0.2",
|
|
40
39
|
"babel-eslint": "^10.0.3",
|
|
41
40
|
"cross-env": "^7.0.2",
|
|
42
41
|
"eslint": "^6.8.0",
|
|
43
|
-
"eslint-config-airbnb": "^19.0.1",
|
|
44
42
|
"eslint-config-next": "12.0.4",
|
|
45
43
|
"eslint-config-prettier": "^6.7.0",
|
|
46
44
|
"eslint-config-standard": "^14.1.0",
|
|
@@ -50,6 +48,7 @@
|
|
|
50
48
|
"eslint-plugin-prettier": "^3.1.1",
|
|
51
49
|
"eslint-plugin-promise": "^4.2.1",
|
|
52
50
|
"eslint-plugin-react": "^7.17.0",
|
|
51
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
53
52
|
"eslint-plugin-standard": "^4.0.1",
|
|
54
53
|
"gh-pages": "^2.2.0",
|
|
55
54
|
"microbundle-crl": "^0.13.10",
|
|
@@ -58,6 +57,7 @@
|
|
|
58
57
|
"prettier": "^2.0.4",
|
|
59
58
|
"react": "^16.13.1",
|
|
60
59
|
"react-dom": "^16.13.1",
|
|
60
|
+
"react-hooks": "^1.0.1",
|
|
61
61
|
"react-scripts": "^3.4.1",
|
|
62
62
|
"typescript": "^3.7.5"
|
|
63
63
|
},
|