@tamagui/toast 2.7.7 → 3.0.0-beta.643.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/cjs/ToastComposable.cjs +773 -882
- package/dist/cjs/ToastComposable.native.cjs +924 -0
- package/dist/cjs/ToastComposable.native.js +854 -966
- package/dist/cjs/ToastComposable.native.js.map +1 -1
- package/dist/cjs/ToastItemFrame.cjs +48 -119
- package/dist/cjs/ToastItemFrame.native.cjs +76 -0
- package/dist/cjs/ToastItemFrame.native.js +50 -120
- package/dist/cjs/ToastItemFrame.native.js.map +1 -1
- package/dist/cjs/ToastState.cjs +281 -290
- package/dist/cjs/ToastState.native.cjs +312 -0
- package/dist/cjs/ToastState.native.js +280 -290
- package/dist/cjs/ToastState.native.js.map +1 -1
- package/dist/cjs/createNativeToast.cjs +38 -44
- package/dist/cjs/createNativeToast.native.cjs +54 -0
- package/dist/cjs/createNativeToast.native.js +36 -40
- package/dist/cjs/createNativeToast.native.js.map +1 -1
- package/dist/cjs/dispatchNativeToast.cjs +32 -35
- package/dist/cjs/dispatchNativeToast.native.cjs +48 -0
- package/dist/cjs/dispatchNativeToast.native.js +34 -36
- package/dist/cjs/dispatchNativeToast.native.js.map +1 -1
- package/dist/cjs/index.cjs +25 -12
- package/dist/cjs/index.native.cjs +35 -0
- package/dist/cjs/index.native.js +26 -12
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +10 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useAnimatedDragGesture.cjs +197 -194
- package/dist/cjs/useAnimatedDragGesture.native.cjs +210 -0
- package/dist/cjs/useAnimatedDragGesture.native.js +179 -191
- package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/cjs/useReducedMotion.cjs +47 -55
- package/dist/cjs/useReducedMotion.native.cjs +74 -0
- package/dist/cjs/useReducedMotion.native.js +53 -60
- package/dist/cjs/useReducedMotion.native.js.map +1 -1
- package/dist/cjs/useToastAnimations.cjs +198 -270
- package/dist/cjs/useToastAnimations.native.cjs +229 -0
- package/dist/cjs/useToastAnimations.native.js +205 -276
- package/dist/cjs/useToastAnimations.native.js.map +1 -1
- package/dist/esm/ToastComposable.mjs +752 -854
- package/dist/esm/ToastComposable.mjs.map +1 -1
- package/dist/esm/ToastComposable.native.js +834 -940
- package/dist/esm/ToastComposable.native.js.map +1 -1
- package/dist/esm/ToastItemFrame.mjs +31 -99
- package/dist/esm/ToastItemFrame.mjs.map +1 -1
- package/dist/esm/ToastItemFrame.native.js +34 -102
- package/dist/esm/ToastItemFrame.native.js.map +1 -1
- package/dist/esm/ToastState.mjs +266 -273
- package/dist/esm/ToastState.mjs.map +1 -1
- package/dist/esm/ToastState.native.js +265 -274
- package/dist/esm/ToastState.native.js.map +1 -1
- package/dist/esm/createNativeToast.mjs +22 -26
- package/dist/esm/createNativeToast.mjs.map +1 -1
- package/dist/esm/createNativeToast.native.js +21 -23
- package/dist/esm/createNativeToast.native.js.map +1 -1
- package/dist/esm/dispatchNativeToast.mjs +19 -17
- package/dist/esm/dispatchNativeToast.mjs.map +1 -1
- package/dist/esm/dispatchNativeToast.native.js +21 -19
- package/dist/esm/dispatchNativeToast.native.js.map +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.mjs +5 -2
- package/dist/esm/index.native.js +5 -2
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/useAnimatedDragGesture.mjs +181 -168
- package/dist/esm/useAnimatedDragGesture.mjs.map +1 -1
- package/dist/esm/useAnimatedDragGesture.native.js +163 -166
- package/dist/esm/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/esm/useReducedMotion.mjs +31 -29
- package/dist/esm/useReducedMotion.mjs.map +1 -1
- package/dist/esm/useReducedMotion.native.js +37 -35
- package/dist/esm/useReducedMotion.native.js.map +1 -1
- package/dist/esm/useToastAnimations.mjs +183 -245
- package/dist/esm/useToastAnimations.mjs.map +1 -1
- package/dist/esm/useToastAnimations.native.js +190 -252
- package/dist/esm/useToastAnimations.native.js.map +1 -1
- package/dist/jsx/ToastComposable.mjs +752 -854
- package/dist/jsx/ToastComposable.mjs.map +1 -1
- package/dist/jsx/ToastComposable.native.cjs +924 -0
- package/dist/jsx/ToastComposable.native.js +854 -966
- package/dist/jsx/ToastComposable.native.js.map +1 -1
- package/dist/jsx/ToastItemFrame.mjs +31 -99
- package/dist/jsx/ToastItemFrame.mjs.map +1 -1
- package/dist/jsx/ToastItemFrame.native.cjs +76 -0
- package/dist/jsx/ToastItemFrame.native.js +50 -120
- package/dist/jsx/ToastItemFrame.native.js.map +1 -1
- package/dist/jsx/ToastState.mjs +266 -273
- package/dist/jsx/ToastState.mjs.map +1 -1
- package/dist/jsx/ToastState.native.cjs +312 -0
- package/dist/jsx/ToastState.native.js +280 -290
- package/dist/jsx/ToastState.native.js.map +1 -1
- package/dist/jsx/createNativeToast.mjs +22 -26
- package/dist/jsx/createNativeToast.mjs.map +1 -1
- package/dist/jsx/createNativeToast.native.cjs +54 -0
- package/dist/jsx/createNativeToast.native.js +36 -40
- package/dist/jsx/createNativeToast.native.js.map +1 -1
- package/dist/jsx/dispatchNativeToast.mjs +19 -17
- package/dist/jsx/dispatchNativeToast.mjs.map +1 -1
- package/dist/jsx/dispatchNativeToast.native.cjs +48 -0
- package/dist/jsx/dispatchNativeToast.native.js +34 -36
- package/dist/jsx/dispatchNativeToast.native.js.map +1 -1
- package/dist/jsx/index.js +5 -2
- package/dist/jsx/index.mjs +5 -2
- package/dist/jsx/index.native.cjs +35 -0
- package/dist/jsx/index.native.js +26 -12
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +19 -0
- package/dist/jsx/types.native.js +10 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/dist/jsx/useAnimatedDragGesture.mjs +181 -168
- package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -1
- package/dist/jsx/useAnimatedDragGesture.native.cjs +210 -0
- package/dist/jsx/useAnimatedDragGesture.native.js +179 -191
- package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/jsx/useReducedMotion.mjs +31 -29
- package/dist/jsx/useReducedMotion.mjs.map +1 -1
- package/dist/jsx/useReducedMotion.native.cjs +74 -0
- package/dist/jsx/useReducedMotion.native.js +53 -60
- package/dist/jsx/useReducedMotion.native.js.map +1 -1
- package/dist/jsx/useToastAnimations.mjs +183 -245
- package/dist/jsx/useToastAnimations.mjs.map +1 -1
- package/dist/jsx/useToastAnimations.native.cjs +229 -0
- package/dist/jsx/useToastAnimations.native.js +205 -276
- package/dist/jsx/useToastAnimations.native.js.map +1 -1
- package/package.json +20 -37
- package/src/ToastComposable.tsx +55 -97
- package/src/ToastItemFrame.tsx +22 -81
- package/src/ToastState.ts +1 -0
- package/src/index.ts +34 -2
- package/src/types.ts +11 -0
- package/src/useAnimatedDragGesture.native.ts +1 -1
- package/src/useAnimatedDragGesture.ts +1 -1
- package/src/useToastAnimations.ts +20 -36
- package/types/ToastComposable.d.ts +124 -47
- package/types/ToastComposable.d.ts.map +1 -1
- package/types/ToastItemFrame.d.ts +52 -21
- package/types/ToastItemFrame.d.ts.map +1 -1
- package/types/ToastState.d.ts +15 -11
- package/types/ToastState.d.ts.map +1 -1
- package/types/index.d.ts +6 -2
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +1 -0
- package/types/types.d.ts.map +1 -1
- package/types/useAnimatedDragGesture.d.ts +1 -1
- package/types/useAnimatedDragGesture.d.ts.map +1 -1
- package/types/useAnimatedDragGesture.native.d.ts +1 -1
- package/types/useAnimatedDragGesture.native.d.ts.map +1 -1
- package/types/useToastAnimations.d.ts +2 -8
- package/types/useToastAnimations.d.ts.map +1 -1
- package/dist/cjs/Toast.cjs +0 -178
- package/dist/cjs/Toast.native.js +0 -181
- package/dist/cjs/Toast.native.js.map +0 -1
- package/dist/cjs/ToastAnnounce.cjs +0 -103
- package/dist/cjs/ToastAnnounce.native.js +0 -111
- package/dist/cjs/ToastAnnounce.native.js.map +0 -1
- package/dist/cjs/ToastImperative.cjs +0 -119
- package/dist/cjs/ToastImperative.native.js +0 -130
- package/dist/cjs/ToastImperative.native.js.map +0 -1
- package/dist/cjs/ToastImpl.cjs +0 -354
- package/dist/cjs/ToastImpl.native.js +0 -364
- package/dist/cjs/ToastImpl.native.js.map +0 -1
- package/dist/cjs/ToastPortal.cjs +0 -49
- package/dist/cjs/ToastPortal.native.js +0 -52
- package/dist/cjs/ToastPortal.native.js.map +0 -1
- package/dist/cjs/ToastProvider.cjs +0 -150
- package/dist/cjs/ToastProvider.native.js +0 -161
- package/dist/cjs/ToastProvider.native.js.map +0 -1
- package/dist/cjs/ToastViewport.cjs +0 -319
- package/dist/cjs/ToastViewport.native.js +0 -343
- package/dist/cjs/ToastViewport.native.js.map +0 -1
- package/dist/cjs/Toaster.cjs +0 -87
- package/dist/cjs/Toaster.native.js +0 -91
- package/dist/cjs/Toaster.native.js.map +0 -1
- package/dist/cjs/constants.cjs +0 -30
- package/dist/cjs/constants.native.js +0 -33
- package/dist/cjs/constants.native.js.map +0 -1
- package/dist/cjs/v2.cjs +0 -36
- package/dist/cjs/v2.native.js +0 -39
- package/dist/cjs/v2.native.js.map +0 -1
- package/dist/esm/Toast.mjs +0 -137
- package/dist/esm/Toast.mjs.map +0 -1
- package/dist/esm/Toast.native.js +0 -137
- package/dist/esm/Toast.native.js.map +0 -1
- package/dist/esm/ToastAnnounce.mjs +0 -66
- package/dist/esm/ToastAnnounce.mjs.map +0 -1
- package/dist/esm/ToastAnnounce.native.js +0 -71
- package/dist/esm/ToastAnnounce.native.js.map +0 -1
- package/dist/esm/ToastImperative.mjs +0 -80
- package/dist/esm/ToastImperative.mjs.map +0 -1
- package/dist/esm/ToastImperative.native.js +0 -88
- package/dist/esm/ToastImperative.native.js.map +0 -1
- package/dist/esm/ToastImpl.mjs +0 -316
- package/dist/esm/ToastImpl.mjs.map +0 -1
- package/dist/esm/ToastImpl.native.js +0 -329
- package/dist/esm/ToastImpl.native.js.map +0 -1
- package/dist/esm/ToastPortal.mjs +0 -24
- package/dist/esm/ToastPortal.mjs.map +0 -1
- package/dist/esm/ToastPortal.native.js +0 -24
- package/dist/esm/ToastPortal.native.js.map +0 -1
- package/dist/esm/ToastProvider.mjs +0 -110
- package/dist/esm/ToastProvider.mjs.map +0 -1
- package/dist/esm/ToastProvider.native.js +0 -118
- package/dist/esm/ToastProvider.native.js.map +0 -1
- package/dist/esm/ToastViewport.mjs +0 -280
- package/dist/esm/ToastViewport.mjs.map +0 -1
- package/dist/esm/ToastViewport.native.js +0 -301
- package/dist/esm/ToastViewport.native.js.map +0 -1
- package/dist/esm/Toaster.mjs +0 -51
- package/dist/esm/Toaster.mjs.map +0 -1
- package/dist/esm/Toaster.native.js +0 -52
- package/dist/esm/Toaster.native.js.map +0 -1
- package/dist/esm/constants.mjs +0 -4
- package/dist/esm/constants.mjs.map +0 -1
- package/dist/esm/constants.native.js +0 -4
- package/dist/esm/constants.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/v2.mjs +0 -6
- package/dist/esm/v2.mjs.map +0 -1
- package/dist/esm/v2.native.js +0 -6
- package/dist/esm/v2.native.js.map +0 -1
- package/dist/jsx/Toast.mjs +0 -137
- package/dist/jsx/Toast.mjs.map +0 -1
- package/dist/jsx/Toast.native.js +0 -181
- package/dist/jsx/Toast.native.js.map +0 -1
- package/dist/jsx/ToastAnnounce.mjs +0 -66
- package/dist/jsx/ToastAnnounce.mjs.map +0 -1
- package/dist/jsx/ToastAnnounce.native.js +0 -111
- package/dist/jsx/ToastAnnounce.native.js.map +0 -1
- package/dist/jsx/ToastImperative.mjs +0 -80
- package/dist/jsx/ToastImperative.mjs.map +0 -1
- package/dist/jsx/ToastImperative.native.js +0 -130
- package/dist/jsx/ToastImperative.native.js.map +0 -1
- package/dist/jsx/ToastImpl.mjs +0 -316
- package/dist/jsx/ToastImpl.mjs.map +0 -1
- package/dist/jsx/ToastImpl.native.js +0 -364
- package/dist/jsx/ToastImpl.native.js.map +0 -1
- package/dist/jsx/ToastPortal.mjs +0 -24
- package/dist/jsx/ToastPortal.mjs.map +0 -1
- package/dist/jsx/ToastPortal.native.js +0 -52
- package/dist/jsx/ToastPortal.native.js.map +0 -1
- package/dist/jsx/ToastProvider.mjs +0 -110
- package/dist/jsx/ToastProvider.mjs.map +0 -1
- package/dist/jsx/ToastProvider.native.js +0 -161
- package/dist/jsx/ToastProvider.native.js.map +0 -1
- package/dist/jsx/ToastViewport.mjs +0 -280
- package/dist/jsx/ToastViewport.mjs.map +0 -1
- package/dist/jsx/ToastViewport.native.js +0 -343
- package/dist/jsx/ToastViewport.native.js.map +0 -1
- package/dist/jsx/Toaster.mjs +0 -51
- package/dist/jsx/Toaster.mjs.map +0 -1
- package/dist/jsx/Toaster.native.js +0 -91
- package/dist/jsx/Toaster.native.js.map +0 -1
- package/dist/jsx/constants.mjs +0 -4
- package/dist/jsx/constants.mjs.map +0 -1
- package/dist/jsx/constants.native.js +0 -33
- package/dist/jsx/constants.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/v2.mjs +0 -6
- package/dist/jsx/v2.mjs.map +0 -1
- package/dist/jsx/v2.native.js +0 -39
- package/dist/jsx/v2.native.js.map +0 -1
- package/src/Toast.tsx +0 -219
- package/src/ToastAnnounce.tsx +0 -103
- package/src/ToastImperative.tsx +0 -192
- package/src/ToastImpl.tsx +0 -514
- package/src/ToastPortal.tsx +0 -19
- package/src/ToastProvider.tsx +0 -204
- package/src/ToastViewport.tsx +0 -430
- package/src/Toaster.tsx +0 -181
- package/src/constants.ts +0 -2
- package/src/v2.ts +0 -31
- package/types/Toast.d.ts +0 -84
- package/types/Toast.d.ts.map +0 -1
- package/types/ToastAnnounce.d.ts +0 -18
- package/types/ToastAnnounce.d.ts.map +0 -1
- package/types/ToastImperative.d.ts +0 -95
- package/types/ToastImperative.d.ts.map +0 -1
- package/types/ToastImpl.d.ts +0 -109
- package/types/ToastImpl.d.ts.map +0 -1
- package/types/ToastPortal.d.ts +0 -8
- package/types/ToastPortal.d.ts.map +0 -1
- package/types/ToastProvider.d.ts +0 -92
- package/types/ToastProvider.d.ts.map +0 -1
- package/types/ToastViewport.d.ts +0 -75
- package/types/ToastViewport.d.ts.map +0 -1
- package/types/Toaster.d.ts +0 -112
- package/types/Toaster.d.ts.map +0 -1
- package/types/constants.d.ts +0 -3
- package/types/constants.d.ts.map +0 -1
- package/types/v2.d.ts +0 -10
- package/types/v2.d.ts.map +0 -1
- package/v2/index.cjs +0 -2
- package/v2/index.js +0 -2
- package/v2/index.native.cjs +0 -2
- package/v2/index.native.js +0 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var index_exports = {};
|
|
25
|
+
__export(index_exports, {
|
|
26
|
+
Toast: () => import_ToastComposable.Toast,
|
|
27
|
+
requestNotificationPermission: () => import_createNativeToast.requestNotificationPermission,
|
|
28
|
+
toast: () => import_ToastState.toast,
|
|
29
|
+
useToastItem: () => import_ToastComposable.useToastItem,
|
|
30
|
+
useToasts: () => import_ToastComposable.useToasts
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
33
|
+
var import_ToastComposable = require("./ToastComposable.native.js");
|
|
34
|
+
var import_ToastState = require("./ToastState.native.js");
|
|
35
|
+
var import_createNativeToast = require("./createNativeToast.native.js");
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
7
14
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
15
22
|
};
|
|
16
|
-
var
|
|
17
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
24
|
var index_exports = {};
|
|
25
|
+
__export(index_exports, {
|
|
26
|
+
Toast: () => import_ToastComposable.Toast,
|
|
27
|
+
requestNotificationPermission: () => import_createNativeToast.requestNotificationPermission,
|
|
28
|
+
toast: () => import_ToastState.toast,
|
|
29
|
+
useToastItem: () => import_ToastComposable.useToastItem,
|
|
30
|
+
useToasts: () => import_ToastComposable.useToasts
|
|
31
|
+
});
|
|
21
32
|
module.exports = __toCommonJS(index_exports);
|
|
22
|
-
|
|
33
|
+
var import_ToastComposable = require("./ToastComposable.native.js");
|
|
34
|
+
var import_ToastState = require("./ToastState.native.js");
|
|
35
|
+
var import_createNativeToast = require("./createNativeToast.native.js");
|
|
36
|
+
|
|
23
37
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n Toast: () => import_ToastComposable.Toast,\n requestNotificationPermission: () => import_createNativeToast.requestNotificationPermission,\n toast: () => import_ToastState.toast,\n useToastItem: () => import_ToastComposable.useToastItem,\n useToasts: () => import_ToastComposable.useToasts\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_ToastComposable = require(\"./ToastComposable\");\nvar import_ToastState = require(\"./ToastState\");\nvar import_createNativeToast = require(\"./createNativeToast\");\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe;CACtB,aAAa,uBAAuB;CACpC,qCAAqC,yBAAyB;CAC9D,aAAa,kBAAkB;CAC/B,oBAAoB,uBAAuB;CAC3C,iBAAiB,uBAAuB;AAC1C,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,IAAI,yBAAyB,QAAQ,6BAAmB;AACxD,IAAI,oBAAoB,QAAQ,wBAAc;AAC9C,IAAI,2BAA2B,QAAQ,+BAAqB"}
|
package/dist/cjs/types.cjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
13
14
|
};
|
|
14
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
}), mod);
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
17
16
|
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var types_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(types_exports);
|
package/dist/cjs/types.native.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
15
16
|
};
|
|
16
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
}), mod);
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
18
|
var types_exports = {};
|
|
20
19
|
module.exports = __toCommonJS(types_exports);
|
|
20
|
+
|
|
21
21
|
//# sourceMappingURL=types.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.native.js","names":[],"sources":["cjs/types.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar types_exports = {};\nmodule.exports = __toCommonJS(types_exports);\n//# sourceMappingURL=types.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -5,210 +6,212 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
30
26
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
28
|
var useAnimatedDragGesture_exports = {};
|
|
35
|
-
__export(useAnimatedDragGesture_exports, {
|
|
36
|
-
useAnimatedDragGesture: () => useAnimatedDragGesture
|
|
37
|
-
});
|
|
29
|
+
__export(useAnimatedDragGesture_exports, { useAnimatedDragGesture: () => useAnimatedDragGesture });
|
|
38
30
|
module.exports = __toCommonJS(useAnimatedDragGesture_exports);
|
|
39
31
|
var React = __toESM(require("react"), 1);
|
|
40
|
-
const VELOCITY_THRESHOLD =
|
|
32
|
+
const VELOCITY_THRESHOLD = .11;
|
|
41
33
|
function resisted(delta, maxResist = 25) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
if (delta >= 0) return delta;
|
|
35
|
+
const pastBoundary = Math.abs(delta);
|
|
36
|
+
const resistedDistance = Math.sqrt(pastBoundary) * 2;
|
|
37
|
+
return -Math.min(resistedDistance, maxResist);
|
|
46
38
|
}
|
|
47
39
|
const EXIT_DRAG_CAP = 80;
|
|
48
40
|
function cappedExit(delta) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
if (Math.abs(delta) <= EXIT_DRAG_CAP) return delta;
|
|
42
|
+
const sign = delta > 0 ? 1 : -1;
|
|
43
|
+
const overshoot = Math.abs(delta) - EXIT_DRAG_CAP;
|
|
44
|
+
return sign * (EXIT_DRAG_CAP + Math.sqrt(overshoot) * 2);
|
|
53
45
|
}
|
|
54
46
|
function useAnimatedDragGesture(options) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
47
|
+
const { direction, threshold, disabled, expanded, onDragMove, onDragStart, onDismiss, onCancel } = options;
|
|
48
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
49
|
+
const dragStartRef = React.useRef(null);
|
|
50
|
+
const lockedDirectionRef = React.useRef(null);
|
|
51
|
+
const captureElementRef = React.useRef(null);
|
|
52
|
+
const isHorizontal = direction === "left" || direction === "right" || direction === "horizontal";
|
|
53
|
+
const isVertical = direction === "up" || direction === "down" || direction === "vertical";
|
|
54
|
+
const preventSelectRef = React.useRef(null);
|
|
55
|
+
function startPreventingSelection() {
|
|
56
|
+
if (typeof document === "undefined") return;
|
|
57
|
+
window.getSelection()?.removeAllRanges();
|
|
58
|
+
const handler = (e) => e.preventDefault();
|
|
59
|
+
preventSelectRef.current = handler;
|
|
60
|
+
document.addEventListener("selectstart", handler, true);
|
|
61
|
+
}
|
|
62
|
+
function stopPreventingSelection() {
|
|
63
|
+
if (preventSelectRef.current) {
|
|
64
|
+
document.removeEventListener("selectstart", preventSelectRef.current, true);
|
|
65
|
+
preventSelectRef.current = null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const cleanup = React.useCallback(() => {
|
|
69
|
+
dragStartRef.current = null;
|
|
70
|
+
lockedDirectionRef.current = null;
|
|
71
|
+
setIsDragging(false);
|
|
72
|
+
stopPreventingSelection();
|
|
73
|
+
}, []);
|
|
74
|
+
React.useEffect(() => {
|
|
75
|
+
return () => {
|
|
76
|
+
if (dragStartRef.current) {
|
|
77
|
+
if (captureElementRef.current && dragStartRef.current.pointerId) {
|
|
78
|
+
try {
|
|
79
|
+
captureElementRef.current.releasePointerCapture(dragStartRef.current.pointerId);
|
|
80
|
+
} catch {}
|
|
81
|
+
}
|
|
82
|
+
cleanup();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, [cleanup]);
|
|
86
|
+
const handlePointerDown = React.useCallback((event) => {
|
|
87
|
+
if (disabled) return;
|
|
88
|
+
if (event.button !== 0) return;
|
|
89
|
+
const target = event.target;
|
|
90
|
+
if (target.closest("button, a, input, textarea, select, [role=\"button\"]")) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const hasSelection = (window.getSelection()?.toString().length ?? 0) > 0;
|
|
94
|
+
if (hasSelection) return;
|
|
95
|
+
const captureElement = event.currentTarget;
|
|
96
|
+
captureElementRef.current = captureElement;
|
|
97
|
+
captureElement.setPointerCapture(event.pointerId);
|
|
98
|
+
dragStartRef.current = {
|
|
99
|
+
startX: event.clientX,
|
|
100
|
+
startY: event.clientY,
|
|
101
|
+
startTime: Date.now(),
|
|
102
|
+
pointerId: event.pointerId
|
|
103
|
+
};
|
|
104
|
+
startPreventingSelection();
|
|
105
|
+
setIsDragging(true);
|
|
106
|
+
onDragStart?.();
|
|
107
|
+
}, [disabled, onDragStart]);
|
|
108
|
+
const handlePointerMove = React.useCallback((event) => {
|
|
109
|
+
if (!dragStartRef.current || disabled) return;
|
|
110
|
+
const deltaX = event.clientX - dragStartRef.current.startX;
|
|
111
|
+
const deltaY = event.clientY - dragStartRef.current.startY;
|
|
112
|
+
if (!lockedDirectionRef.current && (Math.abs(deltaX) > 1 || Math.abs(deltaY) > 1)) {
|
|
113
|
+
lockedDirectionRef.current = Math.abs(deltaX) > Math.abs(deltaY) ? "x" : "y";
|
|
114
|
+
}
|
|
115
|
+
let offsetX = 0;
|
|
116
|
+
let offsetY = 0;
|
|
117
|
+
if (direction === "right") {
|
|
118
|
+
offsetX = deltaX > 0 ? cappedExit(deltaX) : resisted(deltaX);
|
|
119
|
+
} else if (direction === "left") {
|
|
120
|
+
offsetX = deltaX < 0 ? cappedExit(deltaX) : -resisted(-deltaX);
|
|
121
|
+
} else if (direction === "down") {
|
|
122
|
+
offsetY = deltaY > 0 ? cappedExit(deltaY) : resisted(deltaY);
|
|
123
|
+
} else if (direction === "up") {
|
|
124
|
+
offsetY = deltaY < 0 ? cappedExit(deltaY) : -resisted(-deltaY);
|
|
125
|
+
} else if (direction === "horizontal") {
|
|
126
|
+
offsetX = cappedExit(deltaX);
|
|
127
|
+
} else if (direction === "vertical") {
|
|
128
|
+
offsetY = cappedExit(deltaY);
|
|
129
|
+
}
|
|
130
|
+
onDragMove(offsetX, offsetY);
|
|
131
|
+
}, [
|
|
132
|
+
disabled,
|
|
133
|
+
direction,
|
|
134
|
+
expanded,
|
|
135
|
+
isHorizontal,
|
|
136
|
+
isVertical,
|
|
137
|
+
onDragMove
|
|
138
|
+
]);
|
|
139
|
+
const handlePointerUp = React.useCallback((event) => {
|
|
140
|
+
if (!dragStartRef.current || disabled) return;
|
|
141
|
+
const deltaX = event.clientX - dragStartRef.current.startX;
|
|
142
|
+
const deltaY = event.clientY - dragStartRef.current.startY;
|
|
143
|
+
const timeTaken = Date.now() - dragStartRef.current.startTime;
|
|
144
|
+
const velocityX = Math.abs(deltaX) / timeTaken;
|
|
145
|
+
const velocityY = Math.abs(deltaY) / timeTaken;
|
|
146
|
+
const lockedDirection = lockedDirectionRef.current;
|
|
147
|
+
const isLockedToWrongAxis = lockedDirection === "y" && isHorizontal || lockedDirection === "x" && isVertical;
|
|
148
|
+
const relevantDelta = isHorizontal ? deltaX : deltaY;
|
|
149
|
+
const relevantVelocity = isHorizontal ? velocityX : velocityY;
|
|
150
|
+
const passedThreshold = Math.abs(relevantDelta) >= threshold;
|
|
151
|
+
const hasVelocity = relevantVelocity > VELOCITY_THRESHOLD;
|
|
152
|
+
let exitDirection = null;
|
|
153
|
+
if (!isLockedToWrongAxis) {
|
|
154
|
+
if (direction === "right" && deltaX > 0) exitDirection = "right";
|
|
155
|
+
else if (direction === "left" && deltaX < 0) exitDirection = "left";
|
|
156
|
+
else if (direction === "horizontal") {
|
|
157
|
+
if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
|
158
|
+
exitDirection = deltaX > 0 ? "right" : "left";
|
|
159
|
+
}
|
|
160
|
+
} else if (direction === "down" && deltaY > 0) exitDirection = "down";
|
|
161
|
+
else if (direction === "up" && deltaY < 0) exitDirection = "up";
|
|
162
|
+
else if (direction === "vertical") {
|
|
163
|
+
if (Math.abs(deltaY) > Math.abs(deltaX)) {
|
|
164
|
+
exitDirection = deltaY > 0 ? "down" : "up";
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const shouldDismiss = exitDirection && (passedThreshold || hasVelocity);
|
|
169
|
+
if (captureElementRef.current) {
|
|
170
|
+
try {
|
|
171
|
+
captureElementRef.current.releasePointerCapture(event.pointerId);
|
|
172
|
+
} catch {}
|
|
173
|
+
}
|
|
174
|
+
cleanup();
|
|
175
|
+
if (shouldDismiss && exitDirection) {
|
|
176
|
+
onDismiss(exitDirection, relevantVelocity);
|
|
177
|
+
} else {
|
|
178
|
+
onCancel();
|
|
179
|
+
}
|
|
180
|
+
}, [
|
|
181
|
+
disabled,
|
|
182
|
+
direction,
|
|
183
|
+
threshold,
|
|
184
|
+
isHorizontal,
|
|
185
|
+
isVertical,
|
|
186
|
+
onDismiss,
|
|
187
|
+
onCancel,
|
|
188
|
+
cleanup
|
|
189
|
+
]);
|
|
190
|
+
const handlePointerCancel = React.useCallback((event) => {
|
|
191
|
+
if (captureElementRef.current) {
|
|
192
|
+
try {
|
|
193
|
+
captureElementRef.current.releasePointerCapture(event.pointerId);
|
|
194
|
+
} catch {}
|
|
195
|
+
}
|
|
196
|
+
cleanup();
|
|
197
|
+
onCancel();
|
|
198
|
+
}, [onCancel, cleanup]);
|
|
199
|
+
const handleLostPointerCapture = React.useCallback(() => {
|
|
200
|
+
if (dragStartRef.current) {
|
|
201
|
+
cleanup();
|
|
202
|
+
onCancel();
|
|
203
|
+
}
|
|
204
|
+
}, [onCancel, cleanup]);
|
|
205
|
+
const gestureHandlers = {
|
|
206
|
+
onPointerDown: handlePointerDown,
|
|
207
|
+
onPointerMove: handlePointerMove,
|
|
208
|
+
onPointerUp: handlePointerUp,
|
|
209
|
+
onPointerCancel: handlePointerCancel,
|
|
210
|
+
onLostPointerCapture: handleLostPointerCapture
|
|
211
|
+
};
|
|
212
|
+
return {
|
|
213
|
+
isDragging,
|
|
214
|
+
gestureHandlers,
|
|
215
|
+
gesture: null
|
|
216
|
+
};
|
|
217
|
+
}
|