@functionalui/functionalui 0.1.8 → 0.2.3
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/Avatar-BK9MFMsZ.cjs +1 -0
- package/dist/Avatar-CQA0mEVW.js +118 -0
- package/dist/Button-CpTXDsI7.js +215 -0
- package/dist/Button-rg5gSHcQ.cjs +1 -0
- package/dist/Checkbox-BHpT6PHl.cjs +1 -0
- package/dist/Checkbox-C29jP71p.js +96 -0
- package/dist/GlobalEventContext-D9ug9s1O.cjs +1 -0
- package/dist/GlobalEventContext-DUmT3Vay.js +49 -0
- package/dist/GlobalEventPortal-BIdCGd-m.cjs +1 -0
- package/dist/GlobalEventPortal-GjfUDr2B.js +17 -0
- package/dist/LabelText-BUslE9cx.cjs +1 -0
- package/dist/LabelText-D7QIWtWj.js +35 -0
- package/dist/Modal-BRIYhcOg.cjs +3 -0
- package/dist/Modal-DXLyt-j4.js +1290 -0
- package/dist/SpringEnterOffsetBy-BVN6rm57.cjs +1 -0
- package/dist/SpringEnterOffsetBy-DMSIQgV3.js +56 -0
- package/dist/TableHeader-BAdYoCbb.cjs +1 -0
- package/dist/TableHeader-Da0XxILB.js +103 -0
- package/dist/TableRow-BlJSvake.js +90 -0
- package/dist/TableRow-Bq58CTbU.cjs +1 -0
- package/dist/TagColor-BYKxfOU6.js +957 -0
- package/dist/TagColor-QGINp77p.cjs +1 -0
- package/dist/UIcon-B5rpDmHC.cjs +1 -0
- package/dist/UIcon-BHzbeYWw.js +245 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
- package/dist/admonition/index.cjs +1 -0
- package/dist/admonition/index.d.ts +27 -0
- package/dist/admonition/index.mjs +88 -0
- package/dist/avatar/index.cjs +1 -0
- package/dist/avatar/index.d.ts +115 -0
- package/dist/avatar/index.mjs +4 -0
- package/dist/avatar-group/index.cjs +1 -0
- package/dist/avatar-group/index.d.ts +120 -0
- package/dist/avatar-group/index.mjs +52 -0
- package/dist/button/index.cjs +1 -0
- package/dist/button/index.d.ts +249 -0
- package/dist/button/index.mjs +4 -0
- package/dist/checkbox/index.cjs +1 -0
- package/dist/checkbox/index.d.ts +32 -0
- package/dist/checkbox/index.mjs +4 -0
- package/dist/checkboxes/index.cjs +1 -0
- package/dist/checkboxes/index.d.ts +38 -0
- package/dist/checkboxes/index.mjs +80 -0
- package/dist/chip/index.cjs +1 -0
- package/dist/chip/index.d.ts +159 -0
- package/dist/chip/index.mjs +132 -0
- package/dist/classes-CBD1K4L1.js +779 -0
- package/dist/classes-CVxy1f4M.js +137 -0
- package/dist/classes-CtwIjJdw.cjs +1 -0
- package/dist/classes-HsjFV5aN.cjs +1 -0
- package/dist/color-picker/index.cjs +1 -0
- package/dist/color-picker/index.d.ts +14 -0
- package/dist/color-picker/index.mjs +234 -0
- package/dist/component-B1mkowwk.cjs +1 -0
- package/dist/component-B6F6g6i4.cjs +1 -0
- package/dist/component-BbvCmqLI.cjs +1 -0
- package/dist/component-Bh3EPTN0.cjs +1 -0
- package/dist/component-BvHdlcdE.js +9 -0
- package/dist/component-C1Gs4nVu.js +55 -0
- package/dist/component-CBIQe7z5.js +29 -0
- package/dist/component-CW2JPBAq.js +59 -0
- package/dist/component-D-EEi7NI.cjs +1 -0
- package/dist/component-D0wwK4KY.js +9 -0
- package/dist/component-D5nxKQnT.js +55 -0
- package/dist/component-D92LT0Mq.cjs +1 -0
- package/dist/component-DCHO9d6d.js +55 -0
- package/dist/component-DRXQXr2G.js +36 -0
- package/dist/component-D_igOAz3.cjs +1 -0
- package/dist/component-DdQu0mLI.js +31 -0
- package/dist/component-FS_2VwVz.cjs +1 -0
- package/dist/component-JigdcRMd.cjs +1 -0
- package/dist/container/index.cjs +1 -0
- package/dist/container/index.d.ts +238 -0
- package/dist/container/index.mjs +4 -0
- package/dist/contexts/notifications/index.cjs +1 -0
- package/dist/contexts/notifications/index.d.ts +2 -0
- package/dist/contexts/notifications/index.mjs +6 -0
- package/dist/contexts/ui/index.cjs +1 -0
- package/dist/contexts/ui/index.d.ts +2 -0
- package/dist/contexts/ui/index.mjs +35 -0
- package/dist/createTextElement-Cgrvdwvh.js +32 -0
- package/dist/createTextElement-DITFvK9p.cjs +1 -0
- package/dist/css/index.cjs +1 -0
- package/dist/css/index.css +1 -0
- package/dist/css/index.d.ts +1 -0
- package/dist/css/index.mjs +1 -0
- package/dist/div-measure/index.cjs +1 -0
- package/dist/div-measure/index.d.ts +13 -0
- package/dist/div-measure/index.mjs +26 -0
- package/dist/feather-sprite.svg +1 -0
- package/dist/gallery-modal/index.cjs +1 -0
- package/dist/gallery-modal/index.d.ts +11 -0
- package/dist/gallery-modal/index.mjs +464 -0
- package/dist/generics-9F1CmKPb.cjs +1 -0
- package/dist/generics-BrMr2-Gs.js +5 -0
- package/dist/generics-C-WSPclF.js +19 -0
- package/dist/generics-D33J7ILI.js +5 -0
- package/dist/generics-DE1oV0MV.cjs +1 -0
- package/dist/generics-nyvJhwQE.cjs +1 -0
- package/dist/global-event-portal/index.cjs +1 -0
- package/dist/global-event-portal/index.d.ts +8 -0
- package/dist/global-event-portal/index.mjs +4 -0
- package/dist/icons/index.cjs +1 -0
- package/dist/icons/index.d.ts +457 -0
- package/dist/icons/index.mjs +5 -0
- package/dist/icons-B8R1UT86.js +147 -0
- package/dist/icons-DSpaHhtT.cjs +1 -0
- package/dist/input-image/index.cjs +1 -0
- package/dist/input-image/index.d.ts +18 -0
- package/dist/input-image/index.mjs +106 -0
- package/dist/input-text/index.cjs +1 -0
- package/dist/input-text/index.d.ts +199 -0
- package/dist/input-text/index.mjs +246 -0
- package/dist/inset-group/index.cjs +1 -0
- package/dist/inset-group/index.d.ts +33 -0
- package/dist/inset-group/index.mjs +105 -0
- package/dist/label-text/index.cjs +1 -0
- package/dist/label-text/index.d.ts +11 -0
- package/dist/label-text/index.mjs +4 -0
- package/dist/layout/index.cjs +1 -0
- package/dist/layout/index.d.ts +163 -0
- package/dist/layout/index.mjs +4 -0
- package/dist/loading-spinner/index.cjs +1 -0
- package/dist/loading-spinner/index.d.ts +33 -0
- package/dist/loading-spinner/index.mjs +101 -0
- package/dist/modal/index.cjs +1 -0
- package/dist/modal/index.d.ts +105 -0
- package/dist/modal/index.mjs +4 -0
- package/dist/notification-system/index.cjs +1 -0
- package/dist/notification-system/index.d.ts +5 -0
- package/dist/notification-system/index.mjs +158 -0
- package/dist/portals/index.cjs +1 -0
- package/dist/portals/index.d.ts +10 -0
- package/dist/portals/index.mjs +4 -0
- package/dist/radio/index.cjs +1 -0
- package/dist/radio/index.d.ts +36 -0
- package/dist/radio/index.mjs +121 -0
- package/dist/react-spring_web.modern-DgQDaJ06.js +2304 -0
- package/dist/react-spring_web.modern-W3Nkoq_6.cjs +1 -0
- package/dist/select-spring/index.cjs +1 -0
- package/dist/select-spring/index.d.ts +70 -0
- package/dist/select-spring/index.mjs +471 -0
- package/dist/spring-enter/index.cjs +1 -0
- package/dist/spring-enter/index.d.ts +16 -0
- package/dist/spring-enter/index.mjs +45 -0
- package/dist/spring-enter-offset-by/index.cjs +1 -0
- package/dist/spring-enter-offset-by/index.d.ts +17 -0
- package/dist/spring-enter-offset-by/index.mjs +5 -0
- package/dist/spring-menu-transition/index.cjs +1 -0
- package/dist/spring-menu-transition/index.d.ts +15 -0
- package/dist/spring-menu-transition/index.mjs +43 -0
- package/dist/spring-open-close-height/index.cjs +1 -0
- package/dist/spring-open-close-height/index.d.ts +9 -0
- package/dist/spring-open-close-height/index.mjs +19 -0
- package/dist/styled/button/index.cjs +1 -0
- package/dist/styled/button/index.d.ts +2 -0
- package/dist/styled/button/index.mjs +4 -0
- package/dist/styled/inputs/text/index.cjs +1 -0
- package/dist/styled/inputs/text/index.d.ts +2 -0
- package/dist/styled/inputs/text/index.mjs +4 -0
- package/dist/styled/inputs/text-area/index.cjs +1 -0
- package/dist/styled/inputs/text-area/index.d.ts +2 -0
- package/dist/styled/inputs/text-area/index.mjs +4 -0
- package/dist/styled/li/index.cjs +1 -0
- package/dist/styled/li/index.d.ts +2 -0
- package/dist/styled/li/index.mjs +4 -0
- package/dist/styled/ul/index.cjs +1 -0
- package/dist/styled/ul/index.d.ts +2 -0
- package/dist/styled/ul/index.mjs +4 -0
- package/dist/table-grid/index.cjs +1 -0
- package/dist/table-grid/index.d.ts +70 -0
- package/dist/table-grid/index.mjs +49 -0
- package/dist/table-header/index.cjs +1 -0
- package/dist/table-header/index.d.ts +53 -0
- package/dist/table-header/index.mjs +4 -0
- package/dist/table-row/index.cjs +1 -0
- package/dist/table-row/index.d.ts +54 -0
- package/dist/table-row/index.mjs +4 -0
- package/dist/tabs/index.cjs +1 -0
- package/dist/tabs/index.d.ts +21 -0
- package/dist/tabs/index.mjs +134 -0
- package/dist/tag-color/index.cjs +1 -0
- package/dist/tag-color/index.d.ts +104 -0
- package/dist/tag-color/index.mjs +4 -0
- package/dist/text-area/index.cjs +1 -0
- package/dist/text-area/index.d.ts +212 -0
- package/dist/text-area/index.mjs +160 -0
- package/dist/texts/header/index.cjs +1 -0
- package/dist/texts/header/index.d.ts +2 -0
- package/dist/texts/header/index.mjs +28 -0
- package/dist/texts/p/index.cjs +1 -0
- package/dist/texts/p/index.d.ts +2 -0
- package/dist/texts/p/index.mjs +4 -0
- package/dist/texts/span/index.cjs +1 -0
- package/dist/texts/span/index.d.ts +2 -0
- package/dist/texts/span/index.mjs +4 -0
- package/dist/toggle-switch/index.cjs +1 -0
- package/dist/toggle-switch/index.d.ts +35 -0
- package/dist/toggle-switch/index.mjs +100 -0
- package/dist/types-34thzuQ5.js +134 -0
- package/dist/types-B3Ew5Ber.cjs +1 -0
- package/dist/types-B6XaG3V2.js +65 -0
- package/dist/types-BL1gBa8J.cjs +1 -0
- package/dist/types-BNUi2DUD.js +234 -0
- package/dist/types-BWsKfOhf.js +76 -0
- package/dist/types-BXyuQRbv.js +52 -0
- package/dist/types-BciByhvn.cjs +1 -0
- package/dist/types-BhBb436R.cjs +1 -0
- package/dist/types-Bh_j-nXM.js +168 -0
- package/dist/types-BnEsY_pc.cjs +1 -0
- package/dist/types-BuixDDod.js +12 -0
- package/dist/types-BzOxElrp.cjs +1 -0
- package/dist/types-CQP0_A_u.cjs +1 -0
- package/dist/types-Cev70RJC.cjs +1 -0
- package/dist/types-Cj8dOa0j.cjs +1 -0
- package/dist/types-CyVpnRmY.cjs +1 -0
- package/dist/types-DDcRx4Wz.cjs +1 -0
- package/dist/types-DNLw5jE2.js +151 -0
- package/dist/types-DZ_qlO_d.cjs +1 -0
- package/dist/types-DamZRbFt.js +4 -0
- package/dist/types-DevrYOgX.cjs +1 -0
- package/dist/types-DgSz2H9f.js +14 -0
- package/dist/types-DmnAtXuW.js +17 -0
- package/dist/types-Dyu7oUOO.js +4 -0
- package/dist/types-OOX58qQg.js +17 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +2062 -0
- package/dist/types.mjs +177 -0
- package/dist/useClickOutsideDOM-CBmttEFU.js +16 -0
- package/dist/useClickOutsideDOM-Dd6ewH8B.cjs +1 -0
- package/dist/useCombinedRef-COuiqHjO.js +14 -0
- package/dist/useCombinedRef-DZxHQ7PL.cjs +1 -0
- package/dist/values-B5r2bYNJ.js +75 -0
- package/dist/values-C40_Fyfk.cjs +1 -0
- package/dist/values-CSE3dLnv.js +200 -0
- package/dist/values-D-Y_dNaF.cjs +1 -0
- package/dist/web-B_p0FWHf.js +132 -0
- package/dist/web-yC_cLoAC.cjs +1 -0
- package/package.json +372 -9
|
@@ -0,0 +1,1290 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _, jsxs as gt } from "react/jsx-runtime";
|
|
3
|
+
import { L as _t } from "./component-DRXQXr2G.js";
|
|
4
|
+
import { h as yt, j as vt, b as bt } from "./classes-CVxy1f4M.js";
|
|
5
|
+
import { M as R } from "./types-Dyu7oUOO.js";
|
|
6
|
+
import P, { useEffect as tt, useState as wt } from "react";
|
|
7
|
+
import { S as Et } from "./SpringEnterOffsetBy-DMSIQgV3.js";
|
|
8
|
+
import { P as Tt } from "./types-DamZRbFt.js";
|
|
9
|
+
import { createPortal as St } from "react-dom";
|
|
10
|
+
import { P as At } from "./types-DgSz2H9f.js";
|
|
11
|
+
import { d as et, u as Dt } from "./react-spring_web.modern-DgQDaJ06.js";
|
|
12
|
+
import { C as V } from "./component-C1Gs4nVu.js";
|
|
13
|
+
import { a as It, C as Ot, b as kt } from "./values-CSE3dLnv.js";
|
|
14
|
+
import { u as xt } from "./useClickOutsideDOM-CBmttEFU.js";
|
|
15
|
+
function Ct(s, t = () => {
|
|
16
|
+
}, e = "keydown") {
|
|
17
|
+
const i = (n) => {
|
|
18
|
+
n.key === s && t();
|
|
19
|
+
};
|
|
20
|
+
tt(() => (document && document.addEventListener(e, i, !1), () => {
|
|
21
|
+
document && document.removeEventListener(e, i, !1);
|
|
22
|
+
}), [e]);
|
|
23
|
+
}
|
|
24
|
+
const Pt = ({ children: s }) => {
|
|
25
|
+
const [t, e] = wt(!1);
|
|
26
|
+
return tt(() => (e(!0), () => {
|
|
27
|
+
e(!1);
|
|
28
|
+
}), []), t ? St(
|
|
29
|
+
s,
|
|
30
|
+
document.querySelector(At[Tt.Modals].id) || document.body
|
|
31
|
+
) : null;
|
|
32
|
+
}, Mt = "_modalBgAnimated_o2uzj_11", Lt = "_modalCardCopyOriAnimated_o2uzj_18", Nt = "_wrapperContainer_o2uzj_49", w = {
|
|
33
|
+
modalBgAnimated: Mt,
|
|
34
|
+
modalCardCopyOriAnimated: Lt,
|
|
35
|
+
"no-card": "_no-card_o2uzj_38",
|
|
36
|
+
wrapperContainer: Nt
|
|
37
|
+
}, Rt = ({ isShown: s, modalBackground: t }) => et(s, {
|
|
38
|
+
from: { opacity: 0 },
|
|
39
|
+
enter: { opacity: 1 },
|
|
40
|
+
leave: { opacity: 0 }
|
|
41
|
+
})(
|
|
42
|
+
(i, n) => n && /* @__PURE__ */ _(
|
|
43
|
+
V,
|
|
44
|
+
{
|
|
45
|
+
className: w.modalBgAnimated,
|
|
46
|
+
style: {
|
|
47
|
+
...i,
|
|
48
|
+
backgroundColor: t ? `${It[t]}${Ot[kt.Dark3]}` : "#0000007f"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
function Vt(s, t, e) {
|
|
54
|
+
return Math.max(t, Math.min(s, e));
|
|
55
|
+
}
|
|
56
|
+
const h = {
|
|
57
|
+
toVector(s, t) {
|
|
58
|
+
return s === void 0 && (s = t), Array.isArray(s) ? s : [s, s];
|
|
59
|
+
},
|
|
60
|
+
add(s, t) {
|
|
61
|
+
return [s[0] + t[0], s[1] + t[1]];
|
|
62
|
+
},
|
|
63
|
+
sub(s, t) {
|
|
64
|
+
return [s[0] - t[0], s[1] - t[1]];
|
|
65
|
+
},
|
|
66
|
+
addTo(s, t) {
|
|
67
|
+
s[0] += t[0], s[1] += t[1];
|
|
68
|
+
},
|
|
69
|
+
subTo(s, t) {
|
|
70
|
+
s[0] -= t[0], s[1] -= t[1];
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function K(s, t, e) {
|
|
74
|
+
return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(s, e * 5) : s * t * e / (t + e * s);
|
|
75
|
+
}
|
|
76
|
+
function U(s, t, e, i = 0.15) {
|
|
77
|
+
return i === 0 ? Vt(s, t, e) : s < t ? -K(t - s, e - t, i) + t : s > e ? +K(s - e, e - t, i) + e : s;
|
|
78
|
+
}
|
|
79
|
+
function Bt(s, [t, e], [i, n]) {
|
|
80
|
+
const [[r, o], [c, f]] = s;
|
|
81
|
+
return [U(t, r, o, i), U(e, c, f, n)];
|
|
82
|
+
}
|
|
83
|
+
function jt(s, t) {
|
|
84
|
+
if (typeof s != "object" || s === null) return s;
|
|
85
|
+
var e = s[Symbol.toPrimitive];
|
|
86
|
+
if (e !== void 0) {
|
|
87
|
+
var i = e.call(s, t);
|
|
88
|
+
if (typeof i != "object") return i;
|
|
89
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
90
|
+
}
|
|
91
|
+
return (t === "string" ? String : Number)(s);
|
|
92
|
+
}
|
|
93
|
+
function Kt(s) {
|
|
94
|
+
var t = jt(s, "string");
|
|
95
|
+
return typeof t == "symbol" ? t : String(t);
|
|
96
|
+
}
|
|
97
|
+
function p(s, t, e) {
|
|
98
|
+
return t = Kt(t), t in s ? Object.defineProperty(s, t, {
|
|
99
|
+
value: e,
|
|
100
|
+
enumerable: !0,
|
|
101
|
+
configurable: !0,
|
|
102
|
+
writable: !0
|
|
103
|
+
}) : s[t] = e, s;
|
|
104
|
+
}
|
|
105
|
+
function H(s, t) {
|
|
106
|
+
var e = Object.keys(s);
|
|
107
|
+
if (Object.getOwnPropertySymbols) {
|
|
108
|
+
var i = Object.getOwnPropertySymbols(s);
|
|
109
|
+
t && (i = i.filter(function(n) {
|
|
110
|
+
return Object.getOwnPropertyDescriptor(s, n).enumerable;
|
|
111
|
+
})), e.push.apply(e, i);
|
|
112
|
+
}
|
|
113
|
+
return e;
|
|
114
|
+
}
|
|
115
|
+
function l(s) {
|
|
116
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
117
|
+
var e = arguments[t] != null ? arguments[t] : {};
|
|
118
|
+
t % 2 ? H(Object(e), !0).forEach(function(i) {
|
|
119
|
+
p(s, i, e[i]);
|
|
120
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(e)) : H(Object(e)).forEach(function(i) {
|
|
121
|
+
Object.defineProperty(s, i, Object.getOwnPropertyDescriptor(e, i));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return s;
|
|
125
|
+
}
|
|
126
|
+
const st = {
|
|
127
|
+
pointer: {
|
|
128
|
+
start: "down",
|
|
129
|
+
change: "move",
|
|
130
|
+
end: "up"
|
|
131
|
+
},
|
|
132
|
+
mouse: {
|
|
133
|
+
start: "down",
|
|
134
|
+
change: "move",
|
|
135
|
+
end: "up"
|
|
136
|
+
},
|
|
137
|
+
touch: {
|
|
138
|
+
start: "start",
|
|
139
|
+
change: "move",
|
|
140
|
+
end: "end"
|
|
141
|
+
},
|
|
142
|
+
gesture: {
|
|
143
|
+
start: "start",
|
|
144
|
+
change: "change",
|
|
145
|
+
end: "end"
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function Y(s) {
|
|
149
|
+
return s ? s[0].toUpperCase() + s.slice(1) : "";
|
|
150
|
+
}
|
|
151
|
+
const Ut = ["enter", "leave"];
|
|
152
|
+
function Ht(s = !1, t) {
|
|
153
|
+
return s && !Ut.includes(t);
|
|
154
|
+
}
|
|
155
|
+
function Yt(s, t = "", e = !1) {
|
|
156
|
+
const i = st[s], n = i && i[t] || t;
|
|
157
|
+
return "on" + Y(s) + Y(n) + (Ht(e, n) ? "Capture" : "");
|
|
158
|
+
}
|
|
159
|
+
const Gt = ["gotpointercapture", "lostpointercapture"];
|
|
160
|
+
function Wt(s) {
|
|
161
|
+
let t = s.substring(2).toLowerCase();
|
|
162
|
+
const e = !!~t.indexOf("passive");
|
|
163
|
+
e && (t = t.replace("passive", ""));
|
|
164
|
+
const i = Gt.includes(t) ? "capturecapture" : "capture", n = !!~t.indexOf(i);
|
|
165
|
+
return n && (t = t.replace("capture", "")), {
|
|
166
|
+
device: t,
|
|
167
|
+
capture: n,
|
|
168
|
+
passive: e
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function $t(s, t = "") {
|
|
172
|
+
const e = st[s], i = e && e[t] || t;
|
|
173
|
+
return s + i;
|
|
174
|
+
}
|
|
175
|
+
function x(s) {
|
|
176
|
+
return "touches" in s;
|
|
177
|
+
}
|
|
178
|
+
function it(s) {
|
|
179
|
+
return x(s) ? "touch" : "pointerType" in s ? s.pointerType : "mouse";
|
|
180
|
+
}
|
|
181
|
+
function zt(s) {
|
|
182
|
+
return Array.from(s.touches).filter((t) => {
|
|
183
|
+
var e, i;
|
|
184
|
+
return t.target === s.currentTarget || ((e = s.currentTarget) === null || e === void 0 || (i = e.contains) === null || i === void 0 ? void 0 : i.call(e, t.target));
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function Xt(s) {
|
|
188
|
+
return s.type === "touchend" || s.type === "touchcancel" ? s.changedTouches : s.targetTouches;
|
|
189
|
+
}
|
|
190
|
+
function nt(s) {
|
|
191
|
+
return x(s) ? Xt(s)[0] : s;
|
|
192
|
+
}
|
|
193
|
+
function L(s, t) {
|
|
194
|
+
try {
|
|
195
|
+
const e = t.clientX - s.clientX, i = t.clientY - s.clientY, n = (t.clientX + s.clientX) / 2, r = (t.clientY + s.clientY) / 2, o = Math.hypot(e, i);
|
|
196
|
+
return {
|
|
197
|
+
angle: -(Math.atan2(e, i) * 180) / Math.PI,
|
|
198
|
+
distance: o,
|
|
199
|
+
origin: [n, r]
|
|
200
|
+
};
|
|
201
|
+
} catch {
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
function Ft(s) {
|
|
206
|
+
return zt(s).map((t) => t.identifier);
|
|
207
|
+
}
|
|
208
|
+
function G(s, t) {
|
|
209
|
+
const [e, i] = Array.from(s.touches).filter((n) => t.includes(n.identifier));
|
|
210
|
+
return L(e, i);
|
|
211
|
+
}
|
|
212
|
+
function M(s) {
|
|
213
|
+
const t = nt(s);
|
|
214
|
+
return x(s) ? t.identifier : t.pointerId;
|
|
215
|
+
}
|
|
216
|
+
function W(s) {
|
|
217
|
+
const t = nt(s);
|
|
218
|
+
return [t.clientX, t.clientY];
|
|
219
|
+
}
|
|
220
|
+
const $ = 40, z = 800;
|
|
221
|
+
function qt(s) {
|
|
222
|
+
let {
|
|
223
|
+
deltaX: t,
|
|
224
|
+
deltaY: e,
|
|
225
|
+
deltaMode: i
|
|
226
|
+
} = s;
|
|
227
|
+
return i === 1 ? (t *= $, e *= $) : i === 2 && (t *= z, e *= z), [t, e];
|
|
228
|
+
}
|
|
229
|
+
function Jt(s) {
|
|
230
|
+
const t = {};
|
|
231
|
+
if ("buttons" in s && (t.buttons = s.buttons), "shiftKey" in s) {
|
|
232
|
+
const {
|
|
233
|
+
shiftKey: e,
|
|
234
|
+
altKey: i,
|
|
235
|
+
metaKey: n,
|
|
236
|
+
ctrlKey: r
|
|
237
|
+
} = s;
|
|
238
|
+
Object.assign(t, {
|
|
239
|
+
shiftKey: e,
|
|
240
|
+
altKey: i,
|
|
241
|
+
metaKey: n,
|
|
242
|
+
ctrlKey: r
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
return t;
|
|
246
|
+
}
|
|
247
|
+
function k(s, ...t) {
|
|
248
|
+
return typeof s == "function" ? s(...t) : s;
|
|
249
|
+
}
|
|
250
|
+
function Qt() {
|
|
251
|
+
}
|
|
252
|
+
function Zt(...s) {
|
|
253
|
+
return s.length === 0 ? Qt : s.length === 1 ? s[0] : function() {
|
|
254
|
+
let t;
|
|
255
|
+
for (const e of s)
|
|
256
|
+
t = e.apply(this, arguments) || t;
|
|
257
|
+
return t;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function X(s, t) {
|
|
261
|
+
return Object.assign({}, t, s || {});
|
|
262
|
+
}
|
|
263
|
+
const te = 32;
|
|
264
|
+
class rt {
|
|
265
|
+
constructor(t, e, i) {
|
|
266
|
+
this.ctrl = t, this.args = e, this.key = i, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
|
|
267
|
+
}
|
|
268
|
+
get state() {
|
|
269
|
+
return this.ctrl.state[this.key];
|
|
270
|
+
}
|
|
271
|
+
set state(t) {
|
|
272
|
+
this.ctrl.state[this.key] = t;
|
|
273
|
+
}
|
|
274
|
+
get shared() {
|
|
275
|
+
return this.ctrl.state.shared;
|
|
276
|
+
}
|
|
277
|
+
get eventStore() {
|
|
278
|
+
return this.ctrl.gestureEventStores[this.key];
|
|
279
|
+
}
|
|
280
|
+
get timeoutStore() {
|
|
281
|
+
return this.ctrl.gestureTimeoutStores[this.key];
|
|
282
|
+
}
|
|
283
|
+
get config() {
|
|
284
|
+
return this.ctrl.config[this.key];
|
|
285
|
+
}
|
|
286
|
+
get sharedConfig() {
|
|
287
|
+
return this.ctrl.config.shared;
|
|
288
|
+
}
|
|
289
|
+
get handler() {
|
|
290
|
+
return this.ctrl.handlers[this.key];
|
|
291
|
+
}
|
|
292
|
+
reset() {
|
|
293
|
+
const {
|
|
294
|
+
state: t,
|
|
295
|
+
shared: e,
|
|
296
|
+
ingKey: i,
|
|
297
|
+
args: n
|
|
298
|
+
} = this;
|
|
299
|
+
e[i] = t._active = t.active = t._blocked = t._force = !1, t._step = [!1, !1], t.intentional = !1, t._movement = [0, 0], t._distance = [0, 0], t._direction = [0, 0], t._delta = [0, 0], t._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], t.args = n, t.axis = void 0, t.memo = void 0, t.elapsedTime = t.timeDelta = 0, t.direction = [0, 0], t.distance = [0, 0], t.overflow = [0, 0], t._movementBound = [!1, !1], t.velocity = [0, 0], t.movement = [0, 0], t.delta = [0, 0], t.timeStamp = 0;
|
|
300
|
+
}
|
|
301
|
+
start(t) {
|
|
302
|
+
const e = this.state, i = this.config;
|
|
303
|
+
e._active || (this.reset(), this.computeInitial(), e._active = !0, e.target = t.target, e.currentTarget = t.currentTarget, e.lastOffset = i.from ? k(i.from, e) : e.offset, e.offset = e.lastOffset, e.startTime = e.timeStamp = t.timeStamp);
|
|
304
|
+
}
|
|
305
|
+
computeValues(t) {
|
|
306
|
+
const e = this.state;
|
|
307
|
+
e._values = t, e.values = this.config.transform(t);
|
|
308
|
+
}
|
|
309
|
+
computeInitial() {
|
|
310
|
+
const t = this.state;
|
|
311
|
+
t._initial = t._values, t.initial = t.values;
|
|
312
|
+
}
|
|
313
|
+
compute(t) {
|
|
314
|
+
const {
|
|
315
|
+
state: e,
|
|
316
|
+
config: i,
|
|
317
|
+
shared: n
|
|
318
|
+
} = this;
|
|
319
|
+
e.args = this.args;
|
|
320
|
+
let r = 0;
|
|
321
|
+
if (t && (e.event = t, i.preventDefault && t.cancelable && e.event.preventDefault(), e.type = t.type, n.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, n.locked = !!document.pointerLockElement, Object.assign(n, Jt(t)), n.down = n.pressed = n.buttons % 2 === 1 || n.touches > 0, r = t.timeStamp - e.timeStamp, e.timeStamp = t.timeStamp, e.elapsedTime = e.timeStamp - e.startTime), e._active) {
|
|
322
|
+
const y = e._delta.map(Math.abs);
|
|
323
|
+
h.addTo(e._distance, y);
|
|
324
|
+
}
|
|
325
|
+
this.axisIntent && this.axisIntent(t);
|
|
326
|
+
const [o, c] = e._movement, [f, u] = i.threshold, {
|
|
327
|
+
_step: a,
|
|
328
|
+
values: m
|
|
329
|
+
} = e;
|
|
330
|
+
if (i.hasCustomTransform ? (a[0] === !1 && (a[0] = Math.abs(o) >= f && m[0]), a[1] === !1 && (a[1] = Math.abs(c) >= u && m[1])) : (a[0] === !1 && (a[0] = Math.abs(o) >= f && Math.sign(o) * f), a[1] === !1 && (a[1] = Math.abs(c) >= u && Math.sign(c) * u)), e.intentional = a[0] !== !1 || a[1] !== !1, !e.intentional) return;
|
|
331
|
+
const d = [0, 0];
|
|
332
|
+
if (i.hasCustomTransform) {
|
|
333
|
+
const [y, mt] = m;
|
|
334
|
+
d[0] = a[0] !== !1 ? y - a[0] : 0, d[1] = a[1] !== !1 ? mt - a[1] : 0;
|
|
335
|
+
} else
|
|
336
|
+
d[0] = a[0] !== !1 ? o - a[0] : 0, d[1] = a[1] !== !1 ? c - a[1] : 0;
|
|
337
|
+
this.restrictToAxis && !e._blocked && this.restrictToAxis(d);
|
|
338
|
+
const S = e.offset, A = e._active && !e._blocked || e.active;
|
|
339
|
+
A && (e.first = e._active && !e.active, e.last = !e._active && e.active, e.active = n[this.ingKey] = e._active, t && (e.first && ("bounds" in i && (e._bounds = k(i.bounds, e)), this.setup && this.setup()), e.movement = d, this.computeOffset()));
|
|
340
|
+
const [D, I] = e.offset, [[C, lt], [ht, dt]] = e._bounds;
|
|
341
|
+
e.overflow = [D < C ? -1 : D > lt ? 1 : 0, I < ht ? -1 : I > dt ? 1 : 0], e._movementBound[0] = e.overflow[0] ? e._movementBound[0] === !1 ? e._movement[0] : e._movementBound[0] : !1, e._movementBound[1] = e.overflow[1] ? e._movementBound[1] === !1 ? e._movement[1] : e._movementBound[1] : !1;
|
|
342
|
+
const pt = e._active ? i.rubberband || [0, 0] : [0, 0];
|
|
343
|
+
if (e.offset = Bt(e._bounds, e.offset, pt), e.delta = h.sub(e.offset, S), this.computeMovement(), A && (!e.last || r > te)) {
|
|
344
|
+
e.delta = h.sub(e.offset, S);
|
|
345
|
+
const y = e.delta.map(Math.abs);
|
|
346
|
+
h.addTo(e.distance, y), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && r > 0 && (e.velocity = [y[0] / r, y[1] / r], e.timeDelta = r);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
emit() {
|
|
350
|
+
const t = this.state, e = this.shared, i = this.config;
|
|
351
|
+
if (t._active || this.clean(), (t._blocked || !t.intentional) && !t._force && !i.triggerAllEvents) return;
|
|
352
|
+
const n = this.handler(l(l(l({}, e), t), {}, {
|
|
353
|
+
[this.aliasKey]: t.values
|
|
354
|
+
}));
|
|
355
|
+
n !== void 0 && (t.memo = n);
|
|
356
|
+
}
|
|
357
|
+
clean() {
|
|
358
|
+
this.eventStore.clean(), this.timeoutStore.clean();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function ee([s, t], e) {
|
|
362
|
+
const i = Math.abs(s), n = Math.abs(t);
|
|
363
|
+
if (i > n && i > e)
|
|
364
|
+
return "x";
|
|
365
|
+
if (n > i && n > e)
|
|
366
|
+
return "y";
|
|
367
|
+
}
|
|
368
|
+
class se extends rt {
|
|
369
|
+
constructor(...t) {
|
|
370
|
+
super(...t), p(this, "aliasKey", "xy");
|
|
371
|
+
}
|
|
372
|
+
reset() {
|
|
373
|
+
super.reset(), this.state.axis = void 0;
|
|
374
|
+
}
|
|
375
|
+
init() {
|
|
376
|
+
this.state.offset = [0, 0], this.state.lastOffset = [0, 0];
|
|
377
|
+
}
|
|
378
|
+
computeOffset() {
|
|
379
|
+
this.state.offset = h.add(this.state.lastOffset, this.state.movement);
|
|
380
|
+
}
|
|
381
|
+
computeMovement() {
|
|
382
|
+
this.state.movement = h.sub(this.state.offset, this.state.lastOffset);
|
|
383
|
+
}
|
|
384
|
+
axisIntent(t) {
|
|
385
|
+
const e = this.state, i = this.config;
|
|
386
|
+
if (!e.axis && t) {
|
|
387
|
+
const n = typeof i.axisThreshold == "object" ? i.axisThreshold[it(t)] : i.axisThreshold;
|
|
388
|
+
e.axis = ee(e._movement, n);
|
|
389
|
+
}
|
|
390
|
+
e._blocked = (i.lockDirection || !!i.axis) && !e.axis || !!i.axis && i.axis !== e.axis;
|
|
391
|
+
}
|
|
392
|
+
restrictToAxis(t) {
|
|
393
|
+
if (this.config.axis || this.config.lockDirection)
|
|
394
|
+
switch (this.state.axis) {
|
|
395
|
+
case "x":
|
|
396
|
+
t[1] = 0;
|
|
397
|
+
break;
|
|
398
|
+
case "y":
|
|
399
|
+
t[0] = 0;
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
const F = (s) => s, q = 0.15, B = {
|
|
405
|
+
enabled(s = !0) {
|
|
406
|
+
return s;
|
|
407
|
+
},
|
|
408
|
+
eventOptions(s, t, e) {
|
|
409
|
+
return l(l({}, e.shared.eventOptions), s);
|
|
410
|
+
},
|
|
411
|
+
preventDefault(s = !1) {
|
|
412
|
+
return s;
|
|
413
|
+
},
|
|
414
|
+
triggerAllEvents(s = !1) {
|
|
415
|
+
return s;
|
|
416
|
+
},
|
|
417
|
+
rubberband(s = 0) {
|
|
418
|
+
switch (s) {
|
|
419
|
+
case !0:
|
|
420
|
+
return [q, q];
|
|
421
|
+
case !1:
|
|
422
|
+
return [0, 0];
|
|
423
|
+
default:
|
|
424
|
+
return h.toVector(s);
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
from(s) {
|
|
428
|
+
if (typeof s == "function") return s;
|
|
429
|
+
if (s != null) return h.toVector(s);
|
|
430
|
+
},
|
|
431
|
+
transform(s, t, e) {
|
|
432
|
+
const i = s || e.shared.transform;
|
|
433
|
+
if (this.hasCustomTransform = !!i, process.env.NODE_ENV === "development") {
|
|
434
|
+
const n = i || F;
|
|
435
|
+
return (r) => {
|
|
436
|
+
const o = n(r);
|
|
437
|
+
return (!isFinite(o[0]) || !isFinite(o[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${o[0]},${[1]}]`), o;
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
return i || F;
|
|
441
|
+
},
|
|
442
|
+
threshold(s) {
|
|
443
|
+
return h.toVector(s, 0);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
process.env.NODE_ENV === "development" && Object.assign(B, {
|
|
447
|
+
domTarget(s) {
|
|
448
|
+
if (s !== void 0)
|
|
449
|
+
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
450
|
+
return NaN;
|
|
451
|
+
},
|
|
452
|
+
lockDirection(s) {
|
|
453
|
+
if (s !== void 0)
|
|
454
|
+
throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");
|
|
455
|
+
return NaN;
|
|
456
|
+
},
|
|
457
|
+
initial(s) {
|
|
458
|
+
if (s !== void 0)
|
|
459
|
+
throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");
|
|
460
|
+
return NaN;
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
const ie = 0, E = l(l({}, B), {}, {
|
|
464
|
+
axis(s, t, {
|
|
465
|
+
axis: e
|
|
466
|
+
}) {
|
|
467
|
+
if (this.lockDirection = e === "lock", !this.lockDirection) return e;
|
|
468
|
+
},
|
|
469
|
+
axisThreshold(s = ie) {
|
|
470
|
+
return s;
|
|
471
|
+
},
|
|
472
|
+
bounds(s = {}) {
|
|
473
|
+
if (typeof s == "function")
|
|
474
|
+
return (r) => E.bounds(s(r));
|
|
475
|
+
if ("current" in s)
|
|
476
|
+
return () => s.current;
|
|
477
|
+
if (typeof HTMLElement == "function" && s instanceof HTMLElement)
|
|
478
|
+
return s;
|
|
479
|
+
const {
|
|
480
|
+
left: t = -1 / 0,
|
|
481
|
+
right: e = 1 / 0,
|
|
482
|
+
top: i = -1 / 0,
|
|
483
|
+
bottom: n = 1 / 0
|
|
484
|
+
} = s;
|
|
485
|
+
return [[t, e], [i, n]];
|
|
486
|
+
}
|
|
487
|
+
}), J = {
|
|
488
|
+
ArrowRight: (s, t = 1) => [s * t, 0],
|
|
489
|
+
ArrowLeft: (s, t = 1) => [-1 * s * t, 0],
|
|
490
|
+
ArrowUp: (s, t = 1) => [0, -1 * s * t],
|
|
491
|
+
ArrowDown: (s, t = 1) => [0, s * t]
|
|
492
|
+
};
|
|
493
|
+
class ne extends se {
|
|
494
|
+
constructor(...t) {
|
|
495
|
+
super(...t), p(this, "ingKey", "dragging");
|
|
496
|
+
}
|
|
497
|
+
reset() {
|
|
498
|
+
super.reset();
|
|
499
|
+
const t = this.state;
|
|
500
|
+
t._pointerId = void 0, t._pointerActive = !1, t._keyboardActive = !1, t._preventScroll = !1, t._delayed = !1, t.swipe = [0, 0], t.tap = !1, t.canceled = !1, t.cancel = this.cancel.bind(this);
|
|
501
|
+
}
|
|
502
|
+
setup() {
|
|
503
|
+
const t = this.state;
|
|
504
|
+
if (t._bounds instanceof HTMLElement) {
|
|
505
|
+
const e = t._bounds.getBoundingClientRect(), i = t.currentTarget.getBoundingClientRect(), n = {
|
|
506
|
+
left: e.left - i.left + t.offset[0],
|
|
507
|
+
right: e.right - i.right + t.offset[0],
|
|
508
|
+
top: e.top - i.top + t.offset[1],
|
|
509
|
+
bottom: e.bottom - i.bottom + t.offset[1]
|
|
510
|
+
};
|
|
511
|
+
t._bounds = E.bounds(n);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
cancel() {
|
|
515
|
+
const t = this.state;
|
|
516
|
+
t.canceled || (t.canceled = !0, t._active = !1, setTimeout(() => {
|
|
517
|
+
this.compute(), this.emit();
|
|
518
|
+
}, 0));
|
|
519
|
+
}
|
|
520
|
+
setActive() {
|
|
521
|
+
this.state._active = this.state._pointerActive || this.state._keyboardActive;
|
|
522
|
+
}
|
|
523
|
+
clean() {
|
|
524
|
+
this.pointerClean(), this.state._pointerActive = !1, this.state._keyboardActive = !1, super.clean();
|
|
525
|
+
}
|
|
526
|
+
pointerDown(t) {
|
|
527
|
+
const e = this.config, i = this.state;
|
|
528
|
+
if (t.buttons != null && (Array.isArray(e.pointerButtons) ? !e.pointerButtons.includes(t.buttons) : e.pointerButtons !== -1 && e.pointerButtons !== t.buttons)) return;
|
|
529
|
+
const n = this.ctrl.setEventIds(t);
|
|
530
|
+
e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(n && n.size > 1 && i._pointerActive) && (this.start(t), this.setupPointer(t), i._pointerId = M(t), i._pointerActive = !0, this.computeValues(W(t)), this.computeInitial(), e.preventScrollAxis && it(t) !== "mouse" ? (i._active = !1, this.setupScrollPrevention(t)) : e.delay > 0 ? (this.setupDelayTrigger(t), e.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
|
|
531
|
+
}
|
|
532
|
+
startPointerDrag(t) {
|
|
533
|
+
const e = this.state;
|
|
534
|
+
e._active = !0, e._preventScroll = !0, e._delayed = !1, this.compute(t), this.emit();
|
|
535
|
+
}
|
|
536
|
+
pointerMove(t) {
|
|
537
|
+
const e = this.state, i = this.config;
|
|
538
|
+
if (!e._pointerActive) return;
|
|
539
|
+
const n = M(t);
|
|
540
|
+
if (e._pointerId !== void 0 && n !== e._pointerId) return;
|
|
541
|
+
const r = W(t);
|
|
542
|
+
if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = h.sub(r, e._values), this.computeValues(r)), h.addTo(e._movement, e._delta), this.compute(t), e._delayed && e.intentional) {
|
|
543
|
+
this.timeoutStore.remove("dragDelay"), e.active = !1, this.startPointerDrag(t);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (i.preventScrollAxis && !e._preventScroll)
|
|
547
|
+
if (e.axis)
|
|
548
|
+
if (e.axis === i.preventScrollAxis || i.preventScrollAxis === "xy") {
|
|
549
|
+
e._active = !1, this.clean();
|
|
550
|
+
return;
|
|
551
|
+
} else {
|
|
552
|
+
this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(t);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
else
|
|
556
|
+
return;
|
|
557
|
+
this.emit();
|
|
558
|
+
}
|
|
559
|
+
pointerUp(t) {
|
|
560
|
+
this.ctrl.setEventIds(t);
|
|
561
|
+
try {
|
|
562
|
+
this.config.pointerCapture && t.target.hasPointerCapture(t.pointerId) && t.target.releasePointerCapture(t.pointerId);
|
|
563
|
+
} catch {
|
|
564
|
+
process.env.NODE_ENV === "development" && console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.");
|
|
565
|
+
}
|
|
566
|
+
const e = this.state, i = this.config;
|
|
567
|
+
if (!e._active || !e._pointerActive) return;
|
|
568
|
+
const n = M(t);
|
|
569
|
+
if (e._pointerId !== void 0 && n !== e._pointerId) return;
|
|
570
|
+
this.state._pointerActive = !1, this.setActive(), this.compute(t);
|
|
571
|
+
const [r, o] = e._distance;
|
|
572
|
+
if (e.tap = r <= i.tapsThreshold && o <= i.tapsThreshold, e.tap && i.filterTaps)
|
|
573
|
+
e._force = !0;
|
|
574
|
+
else {
|
|
575
|
+
const [c, f] = e._delta, [u, a] = e._movement, [m, d] = i.swipe.velocity, [S, A] = i.swipe.distance, D = i.swipe.duration;
|
|
576
|
+
if (e.elapsedTime < D) {
|
|
577
|
+
const I = Math.abs(c / e.timeDelta), C = Math.abs(f / e.timeDelta);
|
|
578
|
+
I > m && Math.abs(u) > S && (e.swipe[0] = Math.sign(c)), C > d && Math.abs(a) > A && (e.swipe[1] = Math.sign(f));
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
this.emit();
|
|
582
|
+
}
|
|
583
|
+
pointerClick(t) {
|
|
584
|
+
!this.state.tap && t.detail > 0 && (t.preventDefault(), t.stopPropagation());
|
|
585
|
+
}
|
|
586
|
+
setupPointer(t) {
|
|
587
|
+
const e = this.config, i = e.device;
|
|
588
|
+
if (process.env.NODE_ENV === "development")
|
|
589
|
+
try {
|
|
590
|
+
if (i === "pointer" && e.preventScrollDelay === void 0) {
|
|
591
|
+
const n = "uv" in t ? t.sourceEvent.currentTarget : t.currentTarget;
|
|
592
|
+
window.getComputedStyle(n).touchAction === "auto" && console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.", n);
|
|
593
|
+
}
|
|
594
|
+
} catch {
|
|
595
|
+
}
|
|
596
|
+
e.pointerLock && t.currentTarget.requestPointerLock(), e.pointerCapture || (this.eventStore.add(this.sharedConfig.window, i, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, i, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, i, "cancel", this.pointerUp.bind(this)));
|
|
597
|
+
}
|
|
598
|
+
pointerClean() {
|
|
599
|
+
this.config.pointerLock && document.pointerLockElement === this.state.currentTarget && document.exitPointerLock();
|
|
600
|
+
}
|
|
601
|
+
preventScroll(t) {
|
|
602
|
+
this.state._preventScroll && t.cancelable && t.preventDefault();
|
|
603
|
+
}
|
|
604
|
+
setupScrollPrevention(t) {
|
|
605
|
+
this.state._preventScroll = !1, re(t);
|
|
606
|
+
const e = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
|
|
607
|
+
passive: !1
|
|
608
|
+
});
|
|
609
|
+
this.eventStore.add(this.sharedConfig.window, "touch", "end", e), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", e), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, t);
|
|
610
|
+
}
|
|
611
|
+
setupDelayTrigger(t) {
|
|
612
|
+
this.state._delayed = !0, this.timeoutStore.add("dragDelay", () => {
|
|
613
|
+
this.state._step = [0, 0], this.startPointerDrag(t);
|
|
614
|
+
}, this.config.delay);
|
|
615
|
+
}
|
|
616
|
+
keyDown(t) {
|
|
617
|
+
const e = J[t.key];
|
|
618
|
+
if (e) {
|
|
619
|
+
const i = this.state, n = t.shiftKey ? 10 : t.altKey ? 0.1 : 1;
|
|
620
|
+
this.start(t), i._delta = e(this.config.keyboardDisplacement, n), i._keyboardActive = !0, h.addTo(i._movement, i._delta), this.compute(t), this.emit();
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
keyUp(t) {
|
|
624
|
+
t.key in J && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
|
|
625
|
+
}
|
|
626
|
+
bind(t) {
|
|
627
|
+
const e = this.config.device;
|
|
628
|
+
t(e, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (t(e, "change", this.pointerMove.bind(this)), t(e, "end", this.pointerUp.bind(this)), t(e, "cancel", this.pointerUp.bind(this)), t("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (t("key", "down", this.keyDown.bind(this)), t("key", "up", this.keyUp.bind(this))), this.config.filterTaps && t("click", "", this.pointerClick.bind(this), {
|
|
629
|
+
capture: !0,
|
|
630
|
+
passive: !1
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function re(s) {
|
|
635
|
+
"persist" in s && typeof s.persist == "function" && s.persist();
|
|
636
|
+
}
|
|
637
|
+
const T = typeof window < "u" && window.document && window.document.createElement;
|
|
638
|
+
function ot() {
|
|
639
|
+
return T && "ontouchstart" in window;
|
|
640
|
+
}
|
|
641
|
+
function oe() {
|
|
642
|
+
return ot() || T && window.navigator.maxTouchPoints > 1;
|
|
643
|
+
}
|
|
644
|
+
function ae() {
|
|
645
|
+
return T && "onpointerdown" in window;
|
|
646
|
+
}
|
|
647
|
+
function ce() {
|
|
648
|
+
return T && "exitPointerLock" in window.document;
|
|
649
|
+
}
|
|
650
|
+
function ue() {
|
|
651
|
+
try {
|
|
652
|
+
return "constructor" in GestureEvent;
|
|
653
|
+
} catch {
|
|
654
|
+
return !1;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
const g = {
|
|
658
|
+
isBrowser: T,
|
|
659
|
+
gesture: ue(),
|
|
660
|
+
touch: ot(),
|
|
661
|
+
touchscreen: oe(),
|
|
662
|
+
pointer: ae(),
|
|
663
|
+
pointerLock: ce()
|
|
664
|
+
}, fe = 250, le = 180, he = 0.5, de = 50, pe = 250, me = 10, Q = {
|
|
665
|
+
mouse: 0,
|
|
666
|
+
touch: 0,
|
|
667
|
+
pen: 8
|
|
668
|
+
}, at = l(l({}, E), {}, {
|
|
669
|
+
device(s, t, {
|
|
670
|
+
pointer: {
|
|
671
|
+
touch: e = !1,
|
|
672
|
+
lock: i = !1,
|
|
673
|
+
mouse: n = !1
|
|
674
|
+
} = {}
|
|
675
|
+
}) {
|
|
676
|
+
return this.pointerLock = i && g.pointerLock, g.touch && e ? "touch" : this.pointerLock ? "mouse" : g.pointer && !n ? "pointer" : g.touch ? "touch" : "mouse";
|
|
677
|
+
},
|
|
678
|
+
preventScrollAxis(s, t, {
|
|
679
|
+
preventScroll: e
|
|
680
|
+
}) {
|
|
681
|
+
if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && s ? fe : void 0, !(!g.touchscreen || e === !1))
|
|
682
|
+
return s || (e !== void 0 ? "y" : void 0);
|
|
683
|
+
},
|
|
684
|
+
pointerCapture(s, t, {
|
|
685
|
+
pointer: {
|
|
686
|
+
capture: e = !0,
|
|
687
|
+
buttons: i = 1,
|
|
688
|
+
keys: n = !0
|
|
689
|
+
} = {}
|
|
690
|
+
}) {
|
|
691
|
+
return this.pointerButtons = i, this.keys = n, !this.pointerLock && this.device === "pointer" && e;
|
|
692
|
+
},
|
|
693
|
+
threshold(s, t, {
|
|
694
|
+
filterTaps: e = !1,
|
|
695
|
+
tapsThreshold: i = 3,
|
|
696
|
+
axis: n = void 0
|
|
697
|
+
}) {
|
|
698
|
+
const r = h.toVector(s, e ? i : n ? 1 : 0);
|
|
699
|
+
return this.filterTaps = e, this.tapsThreshold = i, r;
|
|
700
|
+
},
|
|
701
|
+
swipe({
|
|
702
|
+
velocity: s = he,
|
|
703
|
+
distance: t = de,
|
|
704
|
+
duration: e = pe
|
|
705
|
+
} = {}) {
|
|
706
|
+
return {
|
|
707
|
+
velocity: this.transform(h.toVector(s)),
|
|
708
|
+
distance: this.transform(h.toVector(t)),
|
|
709
|
+
duration: e
|
|
710
|
+
};
|
|
711
|
+
},
|
|
712
|
+
delay(s = 0) {
|
|
713
|
+
switch (s) {
|
|
714
|
+
case !0:
|
|
715
|
+
return le;
|
|
716
|
+
case !1:
|
|
717
|
+
return 0;
|
|
718
|
+
default:
|
|
719
|
+
return s;
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
axisThreshold(s) {
|
|
723
|
+
return s ? l(l({}, Q), s) : Q;
|
|
724
|
+
},
|
|
725
|
+
keyboardDisplacement(s = me) {
|
|
726
|
+
return s;
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
process.env.NODE_ENV === "development" && Object.assign(at, {
|
|
730
|
+
useTouch(s) {
|
|
731
|
+
if (s !== void 0)
|
|
732
|
+
throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
|
|
733
|
+
return NaN;
|
|
734
|
+
},
|
|
735
|
+
experimental_preventWindowScrollY(s) {
|
|
736
|
+
if (s !== void 0)
|
|
737
|
+
throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");
|
|
738
|
+
return NaN;
|
|
739
|
+
},
|
|
740
|
+
swipeVelocity(s) {
|
|
741
|
+
if (s !== void 0)
|
|
742
|
+
throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");
|
|
743
|
+
return NaN;
|
|
744
|
+
},
|
|
745
|
+
swipeDistance(s) {
|
|
746
|
+
if (s !== void 0)
|
|
747
|
+
throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");
|
|
748
|
+
return NaN;
|
|
749
|
+
},
|
|
750
|
+
swipeDuration(s) {
|
|
751
|
+
if (s !== void 0)
|
|
752
|
+
throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");
|
|
753
|
+
return NaN;
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
function ge(s) {
|
|
757
|
+
const [t, e] = s.overflow, [i, n] = s._delta, [r, o] = s._direction;
|
|
758
|
+
(t < 0 && i > 0 && r < 0 || t > 0 && i < 0 && r > 0) && (s._movement[0] = s._movementBound[0]), (e < 0 && n > 0 && o < 0 || e > 0 && n < 0 && o > 0) && (s._movement[1] = s._movementBound[1]);
|
|
759
|
+
}
|
|
760
|
+
const _e = 30, ye = 100;
|
|
761
|
+
class ve extends rt {
|
|
762
|
+
constructor(...t) {
|
|
763
|
+
super(...t), p(this, "ingKey", "pinching"), p(this, "aliasKey", "da");
|
|
764
|
+
}
|
|
765
|
+
init() {
|
|
766
|
+
this.state.offset = [1, 0], this.state.lastOffset = [1, 0], this.state._pointerEvents = /* @__PURE__ */ new Map();
|
|
767
|
+
}
|
|
768
|
+
reset() {
|
|
769
|
+
super.reset();
|
|
770
|
+
const t = this.state;
|
|
771
|
+
t._touchIds = [], t.canceled = !1, t.cancel = this.cancel.bind(this), t.turns = 0;
|
|
772
|
+
}
|
|
773
|
+
computeOffset() {
|
|
774
|
+
const {
|
|
775
|
+
type: t,
|
|
776
|
+
movement: e,
|
|
777
|
+
lastOffset: i
|
|
778
|
+
} = this.state;
|
|
779
|
+
t === "wheel" ? this.state.offset = h.add(e, i) : this.state.offset = [(1 + e[0]) * i[0], e[1] + i[1]];
|
|
780
|
+
}
|
|
781
|
+
computeMovement() {
|
|
782
|
+
const {
|
|
783
|
+
offset: t,
|
|
784
|
+
lastOffset: e
|
|
785
|
+
} = this.state;
|
|
786
|
+
this.state.movement = [t[0] / e[0], t[1] - e[1]];
|
|
787
|
+
}
|
|
788
|
+
axisIntent() {
|
|
789
|
+
const t = this.state, [e, i] = t._movement;
|
|
790
|
+
if (!t.axis) {
|
|
791
|
+
const n = Math.abs(e) * _e - Math.abs(i);
|
|
792
|
+
n < 0 ? t.axis = "angle" : n > 0 && (t.axis = "scale");
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
restrictToAxis(t) {
|
|
796
|
+
this.config.lockDirection && (this.state.axis === "scale" ? t[1] = 0 : this.state.axis === "angle" && (t[0] = 0));
|
|
797
|
+
}
|
|
798
|
+
cancel() {
|
|
799
|
+
const t = this.state;
|
|
800
|
+
t.canceled || setTimeout(() => {
|
|
801
|
+
t.canceled = !0, t._active = !1, this.compute(), this.emit();
|
|
802
|
+
}, 0);
|
|
803
|
+
}
|
|
804
|
+
touchStart(t) {
|
|
805
|
+
this.ctrl.setEventIds(t);
|
|
806
|
+
const e = this.state, i = this.ctrl.touchIds;
|
|
807
|
+
if (e._active && e._touchIds.every((r) => i.has(r)) || i.size < 2) return;
|
|
808
|
+
this.start(t), e._touchIds = Array.from(i).slice(0, 2);
|
|
809
|
+
const n = G(t, e._touchIds);
|
|
810
|
+
n && this.pinchStart(t, n);
|
|
811
|
+
}
|
|
812
|
+
pointerStart(t) {
|
|
813
|
+
if (t.buttons != null && t.buttons % 2 !== 1) return;
|
|
814
|
+
this.ctrl.setEventIds(t), t.target.setPointerCapture(t.pointerId);
|
|
815
|
+
const e = this.state, i = e._pointerEvents, n = this.ctrl.pointerIds;
|
|
816
|
+
if (e._active && Array.from(i.keys()).every((o) => n.has(o)) || (i.size < 2 && i.set(t.pointerId, t), e._pointerEvents.size < 2)) return;
|
|
817
|
+
this.start(t);
|
|
818
|
+
const r = L(...Array.from(i.values()));
|
|
819
|
+
r && this.pinchStart(t, r);
|
|
820
|
+
}
|
|
821
|
+
pinchStart(t, e) {
|
|
822
|
+
const i = this.state;
|
|
823
|
+
i.origin = e.origin, this.computeValues([e.distance, e.angle]), this.computeInitial(), this.compute(t), this.emit();
|
|
824
|
+
}
|
|
825
|
+
touchMove(t) {
|
|
826
|
+
if (!this.state._active) return;
|
|
827
|
+
const e = G(t, this.state._touchIds);
|
|
828
|
+
e && this.pinchMove(t, e);
|
|
829
|
+
}
|
|
830
|
+
pointerMove(t) {
|
|
831
|
+
const e = this.state._pointerEvents;
|
|
832
|
+
if (e.has(t.pointerId) && e.set(t.pointerId, t), !this.state._active) return;
|
|
833
|
+
const i = L(...Array.from(e.values()));
|
|
834
|
+
i && this.pinchMove(t, i);
|
|
835
|
+
}
|
|
836
|
+
pinchMove(t, e) {
|
|
837
|
+
const i = this.state, n = i._values[1], r = e.angle - n;
|
|
838
|
+
let o = 0;
|
|
839
|
+
Math.abs(r) > 270 && (o += Math.sign(r)), this.computeValues([e.distance, e.angle - 360 * o]), i.origin = e.origin, i.turns = o, i._movement = [i._values[0] / i._initial[0] - 1, i._values[1] - i._initial[1]], this.compute(t), this.emit();
|
|
840
|
+
}
|
|
841
|
+
touchEnd(t) {
|
|
842
|
+
this.ctrl.setEventIds(t), this.state._active && this.state._touchIds.some((e) => !this.ctrl.touchIds.has(e)) && (this.state._active = !1, this.compute(t), this.emit());
|
|
843
|
+
}
|
|
844
|
+
pointerEnd(t) {
|
|
845
|
+
const e = this.state;
|
|
846
|
+
this.ctrl.setEventIds(t);
|
|
847
|
+
try {
|
|
848
|
+
t.target.releasePointerCapture(t.pointerId);
|
|
849
|
+
} catch {
|
|
850
|
+
}
|
|
851
|
+
e._pointerEvents.has(t.pointerId) && e._pointerEvents.delete(t.pointerId), e._active && e._pointerEvents.size < 2 && (e._active = !1, this.compute(t), this.emit());
|
|
852
|
+
}
|
|
853
|
+
gestureStart(t) {
|
|
854
|
+
t.cancelable && t.preventDefault();
|
|
855
|
+
const e = this.state;
|
|
856
|
+
e._active || (this.start(t), this.computeValues([t.scale, t.rotation]), e.origin = [t.clientX, t.clientY], this.compute(t), this.emit());
|
|
857
|
+
}
|
|
858
|
+
gestureMove(t) {
|
|
859
|
+
if (t.cancelable && t.preventDefault(), !this.state._active) return;
|
|
860
|
+
const e = this.state;
|
|
861
|
+
this.computeValues([t.scale, t.rotation]), e.origin = [t.clientX, t.clientY];
|
|
862
|
+
const i = e._movement;
|
|
863
|
+
e._movement = [t.scale - 1, t.rotation], e._delta = h.sub(e._movement, i), this.compute(t), this.emit();
|
|
864
|
+
}
|
|
865
|
+
gestureEnd(t) {
|
|
866
|
+
this.state._active && (this.state._active = !1, this.compute(t), this.emit());
|
|
867
|
+
}
|
|
868
|
+
wheel(t) {
|
|
869
|
+
const e = this.config.modifierKey;
|
|
870
|
+
e && (Array.isArray(e) ? !e.find((i) => t[i]) : !t[e]) || (this.state._active ? this.wheelChange(t) : this.wheelStart(t), this.timeoutStore.add("wheelEnd", this.wheelEnd.bind(this)));
|
|
871
|
+
}
|
|
872
|
+
wheelStart(t) {
|
|
873
|
+
this.start(t), this.wheelChange(t);
|
|
874
|
+
}
|
|
875
|
+
wheelChange(t) {
|
|
876
|
+
"uv" in t || (t.cancelable && t.preventDefault(), process.env.NODE_ENV === "development" && !t.defaultPrevented && console.warn("[@use-gesture]: To properly support zoom on trackpads, try using the `target` option.\n\nThis message will only appear in development mode."));
|
|
877
|
+
const i = this.state;
|
|
878
|
+
i._delta = [-qt(t)[1] / ye * i.offset[0], 0], h.addTo(i._movement, i._delta), ge(i), this.state.origin = [t.clientX, t.clientY], this.compute(t), this.emit();
|
|
879
|
+
}
|
|
880
|
+
wheelEnd() {
|
|
881
|
+
this.state._active && (this.state._active = !1, this.compute(), this.emit());
|
|
882
|
+
}
|
|
883
|
+
bind(t) {
|
|
884
|
+
const e = this.config.device;
|
|
885
|
+
e && (t(e, "start", this[e + "Start"].bind(this)), t(e, "change", this[e + "Move"].bind(this)), t(e, "end", this[e + "End"].bind(this)), t(e, "cancel", this[e + "End"].bind(this)), t("lostPointerCapture", "", this[e + "End"].bind(this))), this.config.pinchOnWheel && t("wheel", "", this.wheel.bind(this), {
|
|
886
|
+
passive: !1
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
const be = l(l({}, B), {}, {
|
|
891
|
+
device(s, t, {
|
|
892
|
+
shared: e,
|
|
893
|
+
pointer: {
|
|
894
|
+
touch: i = !1
|
|
895
|
+
} = {}
|
|
896
|
+
}) {
|
|
897
|
+
if (e.target && !g.touch && g.gesture) return "gesture";
|
|
898
|
+
if (g.touch && i) return "touch";
|
|
899
|
+
if (g.touchscreen) {
|
|
900
|
+
if (g.pointer) return "pointer";
|
|
901
|
+
if (g.touch) return "touch";
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
bounds(s, t, {
|
|
905
|
+
scaleBounds: e = {},
|
|
906
|
+
angleBounds: i = {}
|
|
907
|
+
}) {
|
|
908
|
+
const n = (o) => {
|
|
909
|
+
const c = X(k(e, o), {
|
|
910
|
+
min: -1 / 0,
|
|
911
|
+
max: 1 / 0
|
|
912
|
+
});
|
|
913
|
+
return [c.min, c.max];
|
|
914
|
+
}, r = (o) => {
|
|
915
|
+
const c = X(k(i, o), {
|
|
916
|
+
min: -1 / 0,
|
|
917
|
+
max: 1 / 0
|
|
918
|
+
});
|
|
919
|
+
return [c.min, c.max];
|
|
920
|
+
};
|
|
921
|
+
return typeof e != "function" && typeof i != "function" ? [n(), r()] : (o) => [n(o), r(o)];
|
|
922
|
+
},
|
|
923
|
+
threshold(s, t, e) {
|
|
924
|
+
return this.lockDirection = e.axis === "lock", h.toVector(s, this.lockDirection ? [0.1, 3] : 0);
|
|
925
|
+
},
|
|
926
|
+
modifierKey(s) {
|
|
927
|
+
return s === void 0 ? "ctrlKey" : s;
|
|
928
|
+
},
|
|
929
|
+
pinchOnWheel(s = !0) {
|
|
930
|
+
return s;
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
l(l({}, E), {}, {
|
|
934
|
+
mouseOnly: (s = !0) => s
|
|
935
|
+
});
|
|
936
|
+
l(l({}, E), {}, {
|
|
937
|
+
mouseOnly: (s = !0) => s
|
|
938
|
+
});
|
|
939
|
+
const j = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
|
|
940
|
+
function ct(s) {
|
|
941
|
+
j.set(s.key, s.engine), N.set(s.key, s.resolver);
|
|
942
|
+
}
|
|
943
|
+
const we = {
|
|
944
|
+
key: "drag",
|
|
945
|
+
engine: ne,
|
|
946
|
+
resolver: at
|
|
947
|
+
}, qe = {
|
|
948
|
+
key: "pinch",
|
|
949
|
+
engine: ve,
|
|
950
|
+
resolver: be
|
|
951
|
+
};
|
|
952
|
+
function Ee(s, t) {
|
|
953
|
+
if (s == null) return {};
|
|
954
|
+
var e = {}, i = Object.keys(s), n, r;
|
|
955
|
+
for (r = 0; r < i.length; r++)
|
|
956
|
+
n = i[r], !(t.indexOf(n) >= 0) && (e[n] = s[n]);
|
|
957
|
+
return e;
|
|
958
|
+
}
|
|
959
|
+
function Te(s, t) {
|
|
960
|
+
if (s == null) return {};
|
|
961
|
+
var e = Ee(s, t), i, n;
|
|
962
|
+
if (Object.getOwnPropertySymbols) {
|
|
963
|
+
var r = Object.getOwnPropertySymbols(s);
|
|
964
|
+
for (n = 0; n < r.length; n++)
|
|
965
|
+
i = r[n], !(t.indexOf(i) >= 0) && Object.prototype.propertyIsEnumerable.call(s, i) && (e[i] = s[i]);
|
|
966
|
+
}
|
|
967
|
+
return e;
|
|
968
|
+
}
|
|
969
|
+
const Se = {
|
|
970
|
+
target(s) {
|
|
971
|
+
if (s)
|
|
972
|
+
return () => "current" in s ? s.current : s;
|
|
973
|
+
},
|
|
974
|
+
enabled(s = !0) {
|
|
975
|
+
return s;
|
|
976
|
+
},
|
|
977
|
+
window(s = g.isBrowser ? window : void 0) {
|
|
978
|
+
return s;
|
|
979
|
+
},
|
|
980
|
+
eventOptions({
|
|
981
|
+
passive: s = !0,
|
|
982
|
+
capture: t = !1
|
|
983
|
+
} = {}) {
|
|
984
|
+
return {
|
|
985
|
+
passive: s,
|
|
986
|
+
capture: t
|
|
987
|
+
};
|
|
988
|
+
},
|
|
989
|
+
transform(s) {
|
|
990
|
+
return s;
|
|
991
|
+
}
|
|
992
|
+
}, Ae = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
993
|
+
function O(s = {}, t) {
|
|
994
|
+
const e = {};
|
|
995
|
+
for (const [i, n] of Object.entries(t))
|
|
996
|
+
switch (typeof n) {
|
|
997
|
+
case "function":
|
|
998
|
+
if (process.env.NODE_ENV === "development") {
|
|
999
|
+
const r = n.call(e, s[i], i, s);
|
|
1000
|
+
Number.isNaN(r) || (e[i] = r);
|
|
1001
|
+
} else
|
|
1002
|
+
e[i] = n.call(e, s[i], i, s);
|
|
1003
|
+
break;
|
|
1004
|
+
case "object":
|
|
1005
|
+
e[i] = O(s[i], n);
|
|
1006
|
+
break;
|
|
1007
|
+
case "boolean":
|
|
1008
|
+
n && (e[i] = s[i]);
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
return e;
|
|
1012
|
+
}
|
|
1013
|
+
function De(s, t, e = {}) {
|
|
1014
|
+
const i = s, {
|
|
1015
|
+
target: n,
|
|
1016
|
+
eventOptions: r,
|
|
1017
|
+
window: o,
|
|
1018
|
+
enabled: c,
|
|
1019
|
+
transform: f
|
|
1020
|
+
} = i, u = Te(i, Ae);
|
|
1021
|
+
if (e.shared = O({
|
|
1022
|
+
target: n,
|
|
1023
|
+
eventOptions: r,
|
|
1024
|
+
window: o,
|
|
1025
|
+
enabled: c,
|
|
1026
|
+
transform: f
|
|
1027
|
+
}, Se), t) {
|
|
1028
|
+
const a = N.get(t);
|
|
1029
|
+
e[t] = O(l({
|
|
1030
|
+
shared: e.shared
|
|
1031
|
+
}, u), a);
|
|
1032
|
+
} else
|
|
1033
|
+
for (const a in u) {
|
|
1034
|
+
const m = N.get(a);
|
|
1035
|
+
if (m)
|
|
1036
|
+
e[a] = O(l({
|
|
1037
|
+
shared: e.shared
|
|
1038
|
+
}, u[a]), m);
|
|
1039
|
+
else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(a)) {
|
|
1040
|
+
if (a === "domTarget")
|
|
1041
|
+
throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
1042
|
+
console.warn(`[@use-gesture]: Unknown config key \`${a}\` was used. Please read the documentation for further information.`);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
return e;
|
|
1046
|
+
}
|
|
1047
|
+
class ut {
|
|
1048
|
+
constructor(t, e) {
|
|
1049
|
+
p(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
|
|
1050
|
+
}
|
|
1051
|
+
add(t, e, i, n, r) {
|
|
1052
|
+
const o = this._listeners, c = $t(e, i), f = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, u = l(l({}, f), r);
|
|
1053
|
+
t.addEventListener(c, n, u);
|
|
1054
|
+
const a = () => {
|
|
1055
|
+
t.removeEventListener(c, n, u), o.delete(a);
|
|
1056
|
+
};
|
|
1057
|
+
return o.add(a), a;
|
|
1058
|
+
}
|
|
1059
|
+
clean() {
|
|
1060
|
+
this._listeners.forEach((t) => t()), this._listeners.clear();
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
class Ie {
|
|
1064
|
+
constructor() {
|
|
1065
|
+
p(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
1066
|
+
}
|
|
1067
|
+
add(t, e, i = 140, ...n) {
|
|
1068
|
+
this.remove(t), this._timeouts.set(t, window.setTimeout(e, i, ...n));
|
|
1069
|
+
}
|
|
1070
|
+
remove(t) {
|
|
1071
|
+
const e = this._timeouts.get(t);
|
|
1072
|
+
e && window.clearTimeout(e);
|
|
1073
|
+
}
|
|
1074
|
+
clean() {
|
|
1075
|
+
this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
class Oe {
|
|
1079
|
+
constructor(t) {
|
|
1080
|
+
p(this, "gestures", /* @__PURE__ */ new Set()), p(this, "_targetEventStore", new ut(this)), p(this, "gestureEventStores", {}), p(this, "gestureTimeoutStores", {}), p(this, "handlers", {}), p(this, "config", {}), p(this, "pointerIds", /* @__PURE__ */ new Set()), p(this, "touchIds", /* @__PURE__ */ new Set()), p(this, "state", {
|
|
1081
|
+
shared: {
|
|
1082
|
+
shiftKey: !1,
|
|
1083
|
+
metaKey: !1,
|
|
1084
|
+
ctrlKey: !1,
|
|
1085
|
+
altKey: !1
|
|
1086
|
+
}
|
|
1087
|
+
}), ke(this, t);
|
|
1088
|
+
}
|
|
1089
|
+
setEventIds(t) {
|
|
1090
|
+
if (x(t))
|
|
1091
|
+
return this.touchIds = new Set(Ft(t)), this.touchIds;
|
|
1092
|
+
if ("pointerId" in t)
|
|
1093
|
+
return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
|
|
1094
|
+
}
|
|
1095
|
+
applyHandlers(t, e) {
|
|
1096
|
+
this.handlers = t, this.nativeHandlers = e;
|
|
1097
|
+
}
|
|
1098
|
+
applyConfig(t, e) {
|
|
1099
|
+
this.config = De(t, e, this.config);
|
|
1100
|
+
}
|
|
1101
|
+
clean() {
|
|
1102
|
+
this._targetEventStore.clean();
|
|
1103
|
+
for (const t of this.gestures)
|
|
1104
|
+
this.gestureEventStores[t].clean(), this.gestureTimeoutStores[t].clean();
|
|
1105
|
+
}
|
|
1106
|
+
effect() {
|
|
1107
|
+
return this.config.shared.target && this.bind(), () => this._targetEventStore.clean();
|
|
1108
|
+
}
|
|
1109
|
+
bind(...t) {
|
|
1110
|
+
const e = this.config.shared, i = {};
|
|
1111
|
+
let n;
|
|
1112
|
+
if (!(e.target && (n = e.target(), !n))) {
|
|
1113
|
+
if (e.enabled) {
|
|
1114
|
+
for (const o of this.gestures) {
|
|
1115
|
+
const c = this.config[o], f = Z(i, c.eventOptions, !!n);
|
|
1116
|
+
if (c.enabled) {
|
|
1117
|
+
const u = j.get(o);
|
|
1118
|
+
new u(this, t, o).bind(f);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
const r = Z(i, e.eventOptions, !!n);
|
|
1122
|
+
for (const o in this.nativeHandlers)
|
|
1123
|
+
r(o, "", (c) => this.nativeHandlers[o](l(l({}, this.state.shared), {}, {
|
|
1124
|
+
event: c,
|
|
1125
|
+
args: t
|
|
1126
|
+
})), void 0, !0);
|
|
1127
|
+
}
|
|
1128
|
+
for (const r in i)
|
|
1129
|
+
i[r] = Zt(...i[r]);
|
|
1130
|
+
if (!n) return i;
|
|
1131
|
+
for (const r in i) {
|
|
1132
|
+
const {
|
|
1133
|
+
device: o,
|
|
1134
|
+
capture: c,
|
|
1135
|
+
passive: f
|
|
1136
|
+
} = Wt(r);
|
|
1137
|
+
this._targetEventStore.add(n, o, "", i[r], {
|
|
1138
|
+
capture: c,
|
|
1139
|
+
passive: f
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
function v(s, t) {
|
|
1146
|
+
s.gestures.add(t), s.gestureEventStores[t] = new ut(s, t), s.gestureTimeoutStores[t] = new Ie();
|
|
1147
|
+
}
|
|
1148
|
+
function ke(s, t) {
|
|
1149
|
+
t.drag && v(s, "drag"), t.wheel && v(s, "wheel"), t.scroll && v(s, "scroll"), t.move && v(s, "move"), t.pinch && v(s, "pinch"), t.hover && v(s, "hover");
|
|
1150
|
+
}
|
|
1151
|
+
const Z = (s, t, e) => (i, n, r, o = {}, c = !1) => {
|
|
1152
|
+
var f, u;
|
|
1153
|
+
const a = (f = o.capture) !== null && f !== void 0 ? f : t.capture, m = (u = o.passive) !== null && u !== void 0 ? u : t.passive;
|
|
1154
|
+
let d = c ? i : Yt(i, n, a);
|
|
1155
|
+
e && m && (d += "Passive"), s[d] = s[d] || [], s[d].push(r);
|
|
1156
|
+
}, xe = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
|
|
1157
|
+
function Ce(s) {
|
|
1158
|
+
const t = {}, e = {}, i = /* @__PURE__ */ new Set();
|
|
1159
|
+
for (let n in s)
|
|
1160
|
+
xe.test(n) ? (i.add(RegExp.lastMatch), e[n] = s[n]) : t[n] = s[n];
|
|
1161
|
+
return [e, t, i];
|
|
1162
|
+
}
|
|
1163
|
+
function b(s, t, e, i, n, r) {
|
|
1164
|
+
if (!s.has(e)) return;
|
|
1165
|
+
if (!j.has(i)) {
|
|
1166
|
+
process.env.NODE_ENV === "development" && console.warn(`[@use-gesture]: You've created a custom handler that that uses the \`${i}\` gesture but isn't properly configured.
|
|
1167
|
+
|
|
1168
|
+
Please add \`${i}Action\` when creating your handler.`);
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
const o = e + "Start", c = e + "End", f = (u) => {
|
|
1172
|
+
let a;
|
|
1173
|
+
return u.first && o in t && t[o](u), e in t && (a = t[e](u)), u.last && c in t && t[c](u), a;
|
|
1174
|
+
};
|
|
1175
|
+
n[i] = f, r[i] = r[i] || {};
|
|
1176
|
+
}
|
|
1177
|
+
function Pe(s, t) {
|
|
1178
|
+
const [e, i, n] = Ce(s), r = {};
|
|
1179
|
+
return b(n, e, "onDrag", "drag", r, t), b(n, e, "onWheel", "wheel", r, t), b(n, e, "onScroll", "scroll", r, t), b(n, e, "onPinch", "pinch", r, t), b(n, e, "onMove", "move", r, t), b(n, e, "onHover", "hover", r, t), {
|
|
1180
|
+
handlers: r,
|
|
1181
|
+
config: t,
|
|
1182
|
+
nativeHandlers: i
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
function ft(s, t = {}, e, i) {
|
|
1186
|
+
const n = P.useMemo(() => new Oe(s), []);
|
|
1187
|
+
if (n.applyHandlers(s, i), n.applyConfig(t, e), P.useEffect(n.effect.bind(n)), P.useEffect(() => n.clean.bind(n), []), t.target === void 0)
|
|
1188
|
+
return n.bind.bind(n);
|
|
1189
|
+
}
|
|
1190
|
+
function Me(s, t) {
|
|
1191
|
+
return ct(we), ft({
|
|
1192
|
+
drag: s
|
|
1193
|
+
}, t || {}, "drag");
|
|
1194
|
+
}
|
|
1195
|
+
function Je(s) {
|
|
1196
|
+
return s.forEach(ct), function(e, i) {
|
|
1197
|
+
const {
|
|
1198
|
+
handlers: n,
|
|
1199
|
+
nativeHandlers: r,
|
|
1200
|
+
config: o
|
|
1201
|
+
} = Pe(e, i || {});
|
|
1202
|
+
return ft(n, o, void 0, r);
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
const Le = ({ closeModal: s, modalStyles: t, children: e }) => {
|
|
1206
|
+
const i = xt(() => s()), [n, r] = Dt(() => ({ y: 0 })), o = Me(
|
|
1207
|
+
({ velocity: [, c], last: f, down: u, movement: [, a], cancel: m, type: d }) => {
|
|
1208
|
+
typeof d == "string" && (d.includes("pointer") || d.includes("mouse")) || (f && c < 0.3 ? m() : f && c > 0.3 && s(), a < -1e-3 ? m() : a > 450 && s(), r.start({ y: u ? a : 0, immediate: u }));
|
|
1209
|
+
},
|
|
1210
|
+
{ axis: "y", filterTaps: !0, pointer: { touch: !0 } }
|
|
1211
|
+
);
|
|
1212
|
+
return /* @__PURE__ */ _(
|
|
1213
|
+
V,
|
|
1214
|
+
{
|
|
1215
|
+
className: t === R.Nocard ? `${w.modalCardCopyOriAnimated} ${w["no-card"]}` : `${w.modalCardCopyOriAnimated}`,
|
|
1216
|
+
...o(),
|
|
1217
|
+
style: { ...n, touchAction: "none" },
|
|
1218
|
+
ref: i,
|
|
1219
|
+
children: e
|
|
1220
|
+
}
|
|
1221
|
+
);
|
|
1222
|
+
}, Ne = ({ isShown: s, children: t }) => et(s, {
|
|
1223
|
+
from: { opacity: 0 },
|
|
1224
|
+
enter: { opacity: 1 },
|
|
1225
|
+
leave: { opacity: 0 }
|
|
1226
|
+
})(
|
|
1227
|
+
(i, n) => n && /* @__PURE__ */ _(V, { className: w.wrapperContainer, style: i, children: t })
|
|
1228
|
+
), Qe = ({
|
|
1229
|
+
showModal: s,
|
|
1230
|
+
closeModal: t,
|
|
1231
|
+
modalStyles: e = R.Default,
|
|
1232
|
+
modalBackground: i,
|
|
1233
|
+
children: n
|
|
1234
|
+
}) => (Ct("Escape", () => {
|
|
1235
|
+
t();
|
|
1236
|
+
}), /* @__PURE__ */ _(
|
|
1237
|
+
Re,
|
|
1238
|
+
{
|
|
1239
|
+
closeModal: t,
|
|
1240
|
+
showModal: s,
|
|
1241
|
+
modalStyles: e,
|
|
1242
|
+
modalBackground: i,
|
|
1243
|
+
children: n
|
|
1244
|
+
}
|
|
1245
|
+
)), Re = ({
|
|
1246
|
+
showModal: s,
|
|
1247
|
+
closeModal: t,
|
|
1248
|
+
children: e,
|
|
1249
|
+
modalStyles: i = R.Default,
|
|
1250
|
+
modalBackground: n
|
|
1251
|
+
}) => /* @__PURE__ */ _(Pt, { children: /* @__PURE__ */ gt(Ne, { isShown: s, children: [
|
|
1252
|
+
/* @__PURE__ */ _(Rt, { isShown: s, modalBackground: n }),
|
|
1253
|
+
/* @__PURE__ */ _(
|
|
1254
|
+
Et,
|
|
1255
|
+
{
|
|
1256
|
+
direction: "vertical",
|
|
1257
|
+
isShown: s,
|
|
1258
|
+
enterOffsetBy: 3,
|
|
1259
|
+
children: /* @__PURE__ */ _(
|
|
1260
|
+
_t,
|
|
1261
|
+
{
|
|
1262
|
+
display: bt.Flex,
|
|
1263
|
+
flexJustifyContent: vt.Center,
|
|
1264
|
+
flexAlignItem: yt.FlexStart,
|
|
1265
|
+
style: {
|
|
1266
|
+
position: "absolute",
|
|
1267
|
+
minHeight: "100vh",
|
|
1268
|
+
minWidth: "100%",
|
|
1269
|
+
top: 0
|
|
1270
|
+
},
|
|
1271
|
+
children: /* @__PURE__ */ _(
|
|
1272
|
+
Le,
|
|
1273
|
+
{
|
|
1274
|
+
closeModal: t,
|
|
1275
|
+
modalStyles: i,
|
|
1276
|
+
children: e
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
}
|
|
1280
|
+
)
|
|
1281
|
+
}
|
|
1282
|
+
)
|
|
1283
|
+
] }) });
|
|
1284
|
+
export {
|
|
1285
|
+
Qe as M,
|
|
1286
|
+
Je as c,
|
|
1287
|
+
we as d,
|
|
1288
|
+
qe as p,
|
|
1289
|
+
Me as u
|
|
1290
|
+
};
|