@tamagui/toast 2.0.0-rc.9 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/dist/cjs/Toast.cjs +149 -141
  2. package/dist/cjs/Toast.native.js +149 -142
  3. package/dist/cjs/Toast.native.js.map +1 -1
  4. package/dist/cjs/ToastAnnounce.cjs +78 -72
  5. package/dist/cjs/ToastAnnounce.native.js +85 -79
  6. package/dist/cjs/ToastAnnounce.native.js.map +1 -1
  7. package/dist/cjs/ToastComposable.cjs +780 -591
  8. package/dist/cjs/ToastComposable.native.js +863 -706
  9. package/dist/cjs/ToastComposable.native.js.map +1 -1
  10. package/dist/cjs/ToastImperative.cjs +99 -80
  11. package/dist/cjs/ToastImperative.native.js +104 -96
  12. package/dist/cjs/ToastImperative.native.js.map +1 -1
  13. package/dist/cjs/ToastImpl.cjs +300 -238
  14. package/dist/cjs/ToastImpl.native.js +309 -271
  15. package/dist/cjs/ToastImpl.native.js.map +1 -1
  16. package/dist/cjs/ToastItemFrame.cjs +143 -0
  17. package/dist/cjs/ToastItemFrame.native.js +148 -0
  18. package/dist/cjs/ToastItemFrame.native.js.map +1 -0
  19. package/dist/cjs/ToastPortal.cjs +23 -18
  20. package/dist/cjs/ToastPortal.native.js +27 -22
  21. package/dist/cjs/ToastPortal.native.js.map +1 -1
  22. package/dist/cjs/ToastProvider.cjs +102 -98
  23. package/dist/cjs/ToastProvider.native.js +108 -106
  24. package/dist/cjs/ToastProvider.native.js.map +1 -1
  25. package/dist/cjs/ToastState.cjs +218 -155
  26. package/dist/cjs/ToastState.native.js +270 -203
  27. package/dist/cjs/ToastState.native.js.map +1 -1
  28. package/dist/cjs/ToastViewport.cjs +274 -233
  29. package/dist/cjs/ToastViewport.native.js +301 -273
  30. package/dist/cjs/ToastViewport.native.js.map +1 -1
  31. package/dist/cjs/Toaster.cjs +71 -233
  32. package/dist/cjs/Toaster.native.js +72 -289
  33. package/dist/cjs/Toaster.native.js.map +1 -1
  34. package/dist/cjs/constants.cjs +14 -12
  35. package/dist/cjs/constants.native.js +14 -12
  36. package/dist/cjs/constants.native.js.map +1 -1
  37. package/dist/cjs/createNativeToast.cjs +43 -35
  38. package/dist/cjs/createNativeToast.native.js +42 -30
  39. package/dist/cjs/createNativeToast.native.js.map +1 -1
  40. package/dist/cjs/dispatchNativeToast.cjs +47 -0
  41. package/dist/cjs/dispatchNativeToast.native.js +52 -0
  42. package/dist/cjs/dispatchNativeToast.native.js.map +1 -0
  43. package/dist/cjs/index.cjs +7 -5
  44. package/dist/cjs/index.native.js +7 -5
  45. package/dist/cjs/index.native.js.map +1 -1
  46. package/dist/cjs/types.cjs +7 -5
  47. package/dist/cjs/types.native.js +7 -5
  48. package/dist/cjs/types.native.js.map +1 -1
  49. package/dist/cjs/useAnimatedDragGesture.cjs +184 -83
  50. package/dist/cjs/useAnimatedDragGesture.native.js +193 -79
  51. package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -1
  52. package/dist/cjs/useReducedMotion.cjs +44 -30
  53. package/dist/cjs/useReducedMotion.native.js +52 -43
  54. package/dist/cjs/useReducedMotion.native.js.map +1 -1
  55. package/dist/cjs/useToastAnimations.cjs +233 -155
  56. package/dist/cjs/useToastAnimations.native.js +246 -170
  57. package/dist/cjs/useToastAnimations.native.js.map +1 -1
  58. package/dist/cjs/v2.cjs +36 -0
  59. package/dist/cjs/v2.native.js +39 -0
  60. package/dist/cjs/v2.native.js.map +1 -0
  61. package/dist/esm/Toast.mjs +112 -106
  62. package/dist/esm/Toast.mjs.map +1 -1
  63. package/dist/esm/Toast.native.js +112 -107
  64. package/dist/esm/Toast.native.js.map +1 -1
  65. package/dist/esm/ToastAnnounce.mjs +46 -42
  66. package/dist/esm/ToastAnnounce.mjs.map +1 -1
  67. package/dist/esm/ToastAnnounce.native.js +52 -48
  68. package/dist/esm/ToastAnnounce.native.js.map +1 -1
  69. package/dist/esm/ToastComposable.mjs +742 -555
  70. package/dist/esm/ToastComposable.mjs.map +1 -1
  71. package/dist/esm/ToastComposable.native.js +825 -670
  72. package/dist/esm/ToastComposable.native.js.map +1 -1
  73. package/dist/esm/ToastImperative.mjs +71 -54
  74. package/dist/esm/ToastImperative.mjs.map +1 -1
  75. package/dist/esm/ToastImperative.native.js +76 -70
  76. package/dist/esm/ToastImperative.native.js.map +1 -1
  77. package/dist/esm/ToastImpl.mjs +261 -201
  78. package/dist/esm/ToastImpl.mjs.map +1 -1
  79. package/dist/esm/ToastImpl.native.js +270 -234
  80. package/dist/esm/ToastImpl.native.js.map +1 -1
  81. package/dist/esm/ToastItemFrame.mjs +114 -0
  82. package/dist/esm/ToastItemFrame.mjs.map +1 -0
  83. package/dist/esm/ToastItemFrame.native.js +116 -0
  84. package/dist/esm/ToastItemFrame.native.js.map +1 -0
  85. package/dist/esm/ToastPortal.mjs +8 -5
  86. package/dist/esm/ToastPortal.mjs.map +1 -1
  87. package/dist/esm/ToastPortal.native.js +12 -9
  88. package/dist/esm/ToastPortal.native.js.map +1 -1
  89. package/dist/esm/ToastProvider.mjs +71 -69
  90. package/dist/esm/ToastProvider.mjs.map +1 -1
  91. package/dist/esm/ToastProvider.native.js +77 -77
  92. package/dist/esm/ToastProvider.native.js.map +1 -1
  93. package/dist/esm/ToastState.mjs +205 -144
  94. package/dist/esm/ToastState.mjs.map +1 -1
  95. package/dist/esm/ToastState.native.js +258 -193
  96. package/dist/esm/ToastState.native.js.map +1 -1
  97. package/dist/esm/ToastViewport.mjs +238 -199
  98. package/dist/esm/ToastViewport.mjs.map +1 -1
  99. package/dist/esm/ToastViewport.native.js +265 -239
  100. package/dist/esm/ToastViewport.native.js.map +1 -1
  101. package/dist/esm/Toaster.mjs +45 -209
  102. package/dist/esm/Toaster.mjs.map +1 -1
  103. package/dist/esm/Toaster.native.js +46 -265
  104. package/dist/esm/Toaster.native.js.map +1 -1
  105. package/dist/esm/constants.mjs +2 -2
  106. package/dist/esm/constants.mjs.map +1 -1
  107. package/dist/esm/constants.native.js +2 -2
  108. package/dist/esm/constants.native.js.map +1 -1
  109. package/dist/esm/createNativeToast.mjs +29 -24
  110. package/dist/esm/createNativeToast.mjs.map +1 -1
  111. package/dist/esm/createNativeToast.native.js +27 -18
  112. package/dist/esm/createNativeToast.native.js.map +1 -1
  113. package/dist/esm/dispatchNativeToast.mjs +22 -0
  114. package/dist/esm/dispatchNativeToast.mjs.map +1 -0
  115. package/dist/esm/dispatchNativeToast.native.js +24 -0
  116. package/dist/esm/dispatchNativeToast.native.js.map +1 -0
  117. package/dist/esm/index.js +1 -1
  118. package/dist/esm/index.js.map +1 -6
  119. package/dist/esm/useAnimatedDragGesture.mjs +160 -61
  120. package/dist/esm/useAnimatedDragGesture.mjs.map +1 -1
  121. package/dist/esm/useAnimatedDragGesture.native.js +167 -55
  122. package/dist/esm/useAnimatedDragGesture.native.js.map +1 -1
  123. package/dist/esm/useReducedMotion.mjs +18 -6
  124. package/dist/esm/useReducedMotion.mjs.map +1 -1
  125. package/dist/esm/useReducedMotion.native.js +25 -18
  126. package/dist/esm/useReducedMotion.native.js.map +1 -1
  127. package/dist/esm/useToastAnimations.mjs +206 -130
  128. package/dist/esm/useToastAnimations.mjs.map +1 -1
  129. package/dist/esm/useToastAnimations.native.js +218 -144
  130. package/dist/esm/useToastAnimations.native.js.map +1 -1
  131. package/dist/esm/v2.mjs +6 -0
  132. package/dist/esm/v2.mjs.map +1 -0
  133. package/dist/esm/v2.native.js +6 -0
  134. package/dist/esm/v2.native.js.map +1 -0
  135. package/dist/jsx/Toast.mjs +112 -106
  136. package/dist/jsx/Toast.mjs.map +1 -1
  137. package/dist/jsx/Toast.native.js +149 -142
  138. package/dist/jsx/Toast.native.js.map +1 -1
  139. package/dist/jsx/ToastAnnounce.mjs +46 -42
  140. package/dist/jsx/ToastAnnounce.mjs.map +1 -1
  141. package/dist/jsx/ToastAnnounce.native.js +85 -79
  142. package/dist/jsx/ToastAnnounce.native.js.map +1 -1
  143. package/dist/jsx/ToastComposable.mjs +742 -555
  144. package/dist/jsx/ToastComposable.mjs.map +1 -1
  145. package/dist/jsx/ToastComposable.native.js +863 -706
  146. package/dist/jsx/ToastComposable.native.js.map +1 -1
  147. package/dist/jsx/ToastImperative.mjs +71 -54
  148. package/dist/jsx/ToastImperative.mjs.map +1 -1
  149. package/dist/jsx/ToastImperative.native.js +104 -96
  150. package/dist/jsx/ToastImperative.native.js.map +1 -1
  151. package/dist/jsx/ToastImpl.mjs +261 -201
  152. package/dist/jsx/ToastImpl.mjs.map +1 -1
  153. package/dist/jsx/ToastImpl.native.js +309 -271
  154. package/dist/jsx/ToastImpl.native.js.map +1 -1
  155. package/dist/jsx/ToastItemFrame.mjs +114 -0
  156. package/dist/jsx/ToastItemFrame.mjs.map +1 -0
  157. package/dist/jsx/ToastItemFrame.native.js +148 -0
  158. package/dist/jsx/ToastItemFrame.native.js.map +1 -0
  159. package/dist/jsx/ToastPortal.mjs +8 -5
  160. package/dist/jsx/ToastPortal.mjs.map +1 -1
  161. package/dist/jsx/ToastPortal.native.js +27 -22
  162. package/dist/jsx/ToastPortal.native.js.map +1 -1
  163. package/dist/jsx/ToastProvider.mjs +71 -69
  164. package/dist/jsx/ToastProvider.mjs.map +1 -1
  165. package/dist/jsx/ToastProvider.native.js +108 -106
  166. package/dist/jsx/ToastProvider.native.js.map +1 -1
  167. package/dist/jsx/ToastState.mjs +205 -144
  168. package/dist/jsx/ToastState.mjs.map +1 -1
  169. package/dist/jsx/ToastState.native.js +270 -203
  170. package/dist/jsx/ToastState.native.js.map +1 -1
  171. package/dist/jsx/ToastViewport.mjs +238 -199
  172. package/dist/jsx/ToastViewport.mjs.map +1 -1
  173. package/dist/jsx/ToastViewport.native.js +301 -273
  174. package/dist/jsx/ToastViewport.native.js.map +1 -1
  175. package/dist/jsx/Toaster.mjs +45 -209
  176. package/dist/jsx/Toaster.mjs.map +1 -1
  177. package/dist/jsx/Toaster.native.js +72 -289
  178. package/dist/jsx/Toaster.native.js.map +1 -1
  179. package/dist/jsx/constants.mjs +2 -2
  180. package/dist/jsx/constants.mjs.map +1 -1
  181. package/dist/jsx/constants.native.js +14 -12
  182. package/dist/jsx/constants.native.js.map +1 -1
  183. package/dist/jsx/createNativeToast.mjs +29 -24
  184. package/dist/jsx/createNativeToast.mjs.map +1 -1
  185. package/dist/jsx/createNativeToast.native.js +42 -30
  186. package/dist/jsx/createNativeToast.native.js.map +1 -1
  187. package/dist/jsx/dispatchNativeToast.mjs +22 -0
  188. package/dist/jsx/dispatchNativeToast.mjs.map +1 -0
  189. package/dist/jsx/dispatchNativeToast.native.js +52 -0
  190. package/dist/jsx/dispatchNativeToast.native.js.map +1 -0
  191. package/dist/jsx/index.js +1 -1
  192. package/dist/jsx/index.js.map +1 -6
  193. package/dist/jsx/index.native.js +7 -5
  194. package/dist/jsx/types.native.js +7 -5
  195. package/dist/jsx/useAnimatedDragGesture.mjs +160 -61
  196. package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -1
  197. package/dist/jsx/useAnimatedDragGesture.native.js +193 -79
  198. package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -1
  199. package/dist/jsx/useReducedMotion.mjs +18 -6
  200. package/dist/jsx/useReducedMotion.mjs.map +1 -1
  201. package/dist/jsx/useReducedMotion.native.js +52 -43
  202. package/dist/jsx/useReducedMotion.native.js.map +1 -1
  203. package/dist/jsx/useToastAnimations.mjs +206 -130
  204. package/dist/jsx/useToastAnimations.mjs.map +1 -1
  205. package/dist/jsx/useToastAnimations.native.js +246 -170
  206. package/dist/jsx/useToastAnimations.native.js.map +1 -1
  207. package/dist/jsx/v2.mjs +6 -0
  208. package/dist/jsx/v2.mjs.map +1 -0
  209. package/dist/jsx/v2.native.js +39 -0
  210. package/dist/jsx/v2.native.js.map +1 -0
  211. package/package.json +41 -24
  212. package/src/ToastComposable.tsx +1380 -0
  213. package/src/ToastImpl.tsx +14 -2
  214. package/src/ToastItemFrame.tsx +136 -0
  215. package/src/ToastPortal.tsx +2 -2
  216. package/src/ToastProvider.tsx +8 -1
  217. package/src/ToastState.ts +398 -0
  218. package/src/ToastViewport.tsx +4 -3
  219. package/src/Toaster.tsx +181 -0
  220. package/src/createNativeToast.native.tsx +4 -0
  221. package/src/createNativeToast.tsx +18 -24
  222. package/src/dispatchNativeToast.ts +43 -0
  223. package/src/useAnimatedDragGesture.native.ts +255 -0
  224. package/src/useAnimatedDragGesture.ts +319 -0
  225. package/src/useReducedMotion.ts +59 -0
  226. package/src/useToastAnimations.ts +372 -0
  227. package/src/v2.ts +31 -0
  228. package/types/ToastComposable.d.ts +199 -0
  229. package/types/ToastComposable.d.ts.map +1 -1
  230. package/types/ToastImpl.d.ts.map +1 -1
  231. package/types/ToastItemFrame.d.ts +25 -0
  232. package/types/ToastItemFrame.d.ts.map +1 -0
  233. package/types/ToastPortal.d.ts.map +1 -1
  234. package/types/ToastProvider.d.ts +1 -1
  235. package/types/ToastProvider.d.ts.map +1 -1
  236. package/types/ToastState.d.ts +179 -0
  237. package/types/ToastState.d.ts.map +1 -1
  238. package/types/ToastViewport.d.ts.map +1 -1
  239. package/types/Toaster.d.ts +112 -0
  240. package/types/Toaster.d.ts.map +1 -1
  241. package/types/createNativeToast.d.ts +5 -0
  242. package/types/createNativeToast.d.ts.map +1 -1
  243. package/types/createNativeToast.native.d.ts +1 -0
  244. package/types/createNativeToast.native.d.ts.map +1 -1
  245. package/types/dispatchNativeToast.d.ts +12 -0
  246. package/types/dispatchNativeToast.d.ts.map +1 -0
  247. package/types/useAnimatedDragGesture.d.ts +33 -0
  248. package/types/useAnimatedDragGesture.d.ts.map +1 -1
  249. package/types/useAnimatedDragGesture.native.d.ts +33 -0
  250. package/types/useAnimatedDragGesture.native.d.ts.map +1 -1
  251. package/types/useReducedMotion.d.ts +6 -0
  252. package/types/useToastAnimations.d.ts +50 -0
  253. package/types/useToastAnimations.d.ts.map +1 -1
  254. package/types/v2.d.ts +10 -0
  255. package/types/v2.d.ts.map +1 -0
  256. package/v2/index.cjs +2 -0
  257. package/v2/index.js +2 -0
  258. package/v2/index.native.cjs +2 -0
  259. package/v2/index.native.js +2 -0
  260. package/LICENSE +0 -21
  261. package/dist/cjs/Toast.js +0 -119
  262. package/dist/cjs/Toast.js.map +0 -6
  263. package/dist/cjs/ToastAnnounce.js +0 -72
  264. package/dist/cjs/ToastAnnounce.js.map +0 -6
  265. package/dist/cjs/ToastComposable.js +0 -548
  266. package/dist/cjs/ToastComposable.js.map +0 -6
  267. package/dist/cjs/ToastImperative.js +0 -71
  268. package/dist/cjs/ToastImperative.js.map +0 -6
  269. package/dist/cjs/ToastImpl.js +0 -227
  270. package/dist/cjs/ToastImpl.js.map +0 -6
  271. package/dist/cjs/ToastItem.cjs +0 -526
  272. package/dist/cjs/ToastItem.js +0 -409
  273. package/dist/cjs/ToastItem.js.map +0 -6
  274. package/dist/cjs/ToastItem.native.js +0 -614
  275. package/dist/cjs/ToastItem.native.js.map +0 -1
  276. package/dist/cjs/ToastPortal.js +0 -26
  277. package/dist/cjs/ToastPortal.js.map +0 -6
  278. package/dist/cjs/ToastProvider.js +0 -105
  279. package/dist/cjs/ToastProvider.js.map +0 -6
  280. package/dist/cjs/ToastState.js +0 -160
  281. package/dist/cjs/ToastState.js.map +0 -6
  282. package/dist/cjs/ToastViewport.js +0 -263
  283. package/dist/cjs/ToastViewport.js.map +0 -6
  284. package/dist/cjs/Toaster.js +0 -204
  285. package/dist/cjs/Toaster.js.map +0 -6
  286. package/dist/cjs/constants.js +0 -22
  287. package/dist/cjs/constants.js.map +0 -6
  288. package/dist/cjs/createNativeToast.js +0 -44
  289. package/dist/cjs/createNativeToast.js.map +0 -6
  290. package/dist/cjs/index.js +0 -15
  291. package/dist/cjs/index.js.map +0 -6
  292. package/dist/cjs/types.js +0 -14
  293. package/dist/cjs/types.js.map +0 -6
  294. package/dist/cjs/useAnimatedDragGesture.js +0 -97
  295. package/dist/cjs/useAnimatedDragGesture.js.map +0 -6
  296. package/dist/cjs/useDragGesture.cjs +0 -129
  297. package/dist/cjs/useDragGesture.js +0 -100
  298. package/dist/cjs/useDragGesture.js.map +0 -6
  299. package/dist/cjs/useDragGesture.native.js +0 -146
  300. package/dist/cjs/useDragGesture.native.js.map +0 -1
  301. package/dist/cjs/useReducedMotion.js +0 -53
  302. package/dist/cjs/useReducedMotion.js.map +0 -6
  303. package/dist/cjs/useToastAnimations.js +0 -144
  304. package/dist/cjs/useToastAnimations.js.map +0 -6
  305. package/dist/cjs/v1.cjs +0 -31
  306. package/dist/cjs/v1.js +0 -26
  307. package/dist/cjs/v1.js.map +0 -6
  308. package/dist/cjs/v1.native.js +0 -34
  309. package/dist/cjs/v1.native.js.map +0 -1
  310. package/dist/esm/Toast.js +0 -107
  311. package/dist/esm/Toast.js.map +0 -6
  312. package/dist/esm/ToastAnnounce.js +0 -55
  313. package/dist/esm/ToastAnnounce.js.map +0 -6
  314. package/dist/esm/ToastComposable.js +0 -543
  315. package/dist/esm/ToastComposable.js.map +0 -6
  316. package/dist/esm/ToastImperative.js +0 -50
  317. package/dist/esm/ToastImperative.js.map +0 -6
  318. package/dist/esm/ToastImpl.js +0 -225
  319. package/dist/esm/ToastImpl.js.map +0 -6
  320. package/dist/esm/ToastItem.js +0 -393
  321. package/dist/esm/ToastItem.js.map +0 -6
  322. package/dist/esm/ToastItem.mjs +0 -492
  323. package/dist/esm/ToastItem.mjs.map +0 -1
  324. package/dist/esm/ToastItem.native.js +0 -577
  325. package/dist/esm/ToastItem.native.js.map +0 -1
  326. package/dist/esm/ToastPortal.js +0 -13
  327. package/dist/esm/ToastPortal.js.map +0 -6
  328. package/dist/esm/ToastProvider.js +0 -87
  329. package/dist/esm/ToastProvider.js.map +0 -6
  330. package/dist/esm/ToastState.js +0 -144
  331. package/dist/esm/ToastState.js.map +0 -6
  332. package/dist/esm/ToastViewport.js +0 -250
  333. package/dist/esm/ToastViewport.js.map +0 -6
  334. package/dist/esm/Toaster.js +0 -188
  335. package/dist/esm/Toaster.js.map +0 -6
  336. package/dist/esm/constants.js +0 -6
  337. package/dist/esm/constants.js.map +0 -6
  338. package/dist/esm/createNativeToast.js +0 -28
  339. package/dist/esm/createNativeToast.js.map +0 -6
  340. package/dist/esm/types.js +0 -1
  341. package/dist/esm/types.js.map +0 -6
  342. package/dist/esm/useAnimatedDragGesture.js +0 -73
  343. package/dist/esm/useAnimatedDragGesture.js.map +0 -6
  344. package/dist/esm/useDragGesture.js +0 -76
  345. package/dist/esm/useDragGesture.js.map +0 -6
  346. package/dist/esm/useDragGesture.mjs +0 -95
  347. package/dist/esm/useDragGesture.mjs.map +0 -1
  348. package/dist/esm/useDragGesture.native.js +0 -109
  349. package/dist/esm/useDragGesture.native.js.map +0 -1
  350. package/dist/esm/useReducedMotion.js +0 -30
  351. package/dist/esm/useReducedMotion.js.map +0 -6
  352. package/dist/esm/useToastAnimations.js +0 -122
  353. package/dist/esm/useToastAnimations.js.map +0 -6
  354. package/dist/esm/v1.js +0 -17
  355. package/dist/esm/v1.js.map +0 -6
  356. package/dist/esm/v1.mjs +0 -3
  357. package/dist/esm/v1.mjs.map +0 -1
  358. package/dist/esm/v1.native.js +0 -3
  359. package/dist/esm/v1.native.js.map +0 -1
  360. package/dist/jsx/Toast.js +0 -107
  361. package/dist/jsx/Toast.js.map +0 -6
  362. package/dist/jsx/ToastAnnounce.js +0 -55
  363. package/dist/jsx/ToastAnnounce.js.map +0 -6
  364. package/dist/jsx/ToastComposable.js +0 -543
  365. package/dist/jsx/ToastComposable.js.map +0 -6
  366. package/dist/jsx/ToastImperative.js +0 -50
  367. package/dist/jsx/ToastImperative.js.map +0 -6
  368. package/dist/jsx/ToastImpl.js +0 -225
  369. package/dist/jsx/ToastImpl.js.map +0 -6
  370. package/dist/jsx/ToastItem.js +0 -393
  371. package/dist/jsx/ToastItem.js.map +0 -6
  372. package/dist/jsx/ToastItem.mjs +0 -492
  373. package/dist/jsx/ToastItem.mjs.map +0 -1
  374. package/dist/jsx/ToastItem.native.js +0 -614
  375. package/dist/jsx/ToastItem.native.js.map +0 -1
  376. package/dist/jsx/ToastPortal.js +0 -13
  377. package/dist/jsx/ToastPortal.js.map +0 -6
  378. package/dist/jsx/ToastProvider.js +0 -87
  379. package/dist/jsx/ToastProvider.js.map +0 -6
  380. package/dist/jsx/ToastState.js +0 -144
  381. package/dist/jsx/ToastState.js.map +0 -6
  382. package/dist/jsx/ToastViewport.js +0 -250
  383. package/dist/jsx/ToastViewport.js.map +0 -6
  384. package/dist/jsx/Toaster.js +0 -188
  385. package/dist/jsx/Toaster.js.map +0 -6
  386. package/dist/jsx/constants.js +0 -6
  387. package/dist/jsx/constants.js.map +0 -6
  388. package/dist/jsx/createNativeToast.js +0 -28
  389. package/dist/jsx/createNativeToast.js.map +0 -6
  390. package/dist/jsx/types.js +0 -1
  391. package/dist/jsx/types.js.map +0 -6
  392. package/dist/jsx/useAnimatedDragGesture.js +0 -73
  393. package/dist/jsx/useAnimatedDragGesture.js.map +0 -6
  394. package/dist/jsx/useDragGesture.js +0 -76
  395. package/dist/jsx/useDragGesture.js.map +0 -6
  396. package/dist/jsx/useDragGesture.mjs +0 -95
  397. package/dist/jsx/useDragGesture.mjs.map +0 -1
  398. package/dist/jsx/useDragGesture.native.js +0 -146
  399. package/dist/jsx/useDragGesture.native.js.map +0 -1
  400. package/dist/jsx/useReducedMotion.js +0 -30
  401. package/dist/jsx/useReducedMotion.js.map +0 -6
  402. package/dist/jsx/useToastAnimations.js +0 -122
  403. package/dist/jsx/useToastAnimations.js.map +0 -6
  404. package/dist/jsx/v1.js +0 -17
  405. package/dist/jsx/v1.js.map +0 -6
  406. package/dist/jsx/v1.mjs +0 -3
  407. package/dist/jsx/v1.mjs.map +0 -1
  408. package/dist/jsx/v1.native.js +0 -34
  409. package/dist/jsx/v1.native.js.map +0 -1
  410. package/types/ToastItem.d.ts.map +0 -1
  411. package/types/useDragGesture.d.ts.map +0 -1
  412. package/types/useDragGesture.native.d.ts.map +0 -1
  413. package/types/v1.d.ts.map +0 -1
@@ -5,44 +5,56 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var createNativeToast_native_exports = {};
24
26
  __export(createNativeToast_native_exports, {
25
27
  createNativeToast: () => createNativeToast,
26
- hideNativeToast: () => hideNativeToast
28
+ hideNativeToast: () => hideNativeToast,
29
+ requestNotificationPermission: () => requestNotificationPermission
27
30
  });
28
31
  module.exports = __toCommonJS(createNativeToast_native_exports);
29
- var import_native = require("@tamagui/native"),
30
- createNativeToast = function (title, param) {
31
- var {
32
- message,
33
- duration,
34
- burntOptions
35
- } = param,
36
- burnt = (0, import_native.getBurnt)();
37
- return burnt.isEnabled ? (burnt.state.toast({
38
- title,
39
- message,
40
- duration: duration ? duration / 1e3 : void 0,
41
- ...burntOptions
42
- }), !0) : (console.warn("Warning: Must call import '@tamagui/native/setup-burnt' at your app entry point to use native toasts"), !1);
43
- },
44
- hideNativeToast = function () {
45
- var burnt = (0, import_native.getBurnt)();
46
- burnt.isEnabled && burnt.state.dismissAllAlerts();
47
- };
32
+ var import_native = require("@tamagui/native");
33
+ var createNativeToast = function (title, param) {
34
+ var {
35
+ message,
36
+ duration,
37
+ burntOptions
38
+ } = param;
39
+ var burnt = (0, import_native.getBurnt)();
40
+ if (!burnt.isEnabled) {
41
+ console.warn(`Warning: Must call import '@tamagui/native/setup-burnt' at your app entry point to use native toasts`);
42
+ return false;
43
+ }
44
+ burnt.state.toast({
45
+ title,
46
+ message,
47
+ duration: duration ? duration / 1e3 : void 0,
48
+ ...burntOptions
49
+ });
50
+ return true;
51
+ };
52
+ var hideNativeToast = function () {
53
+ var burnt = (0, import_native.getBurnt)();
54
+ if (!burnt.isEnabled) return;
55
+ burnt.state.dismissAllAlerts();
56
+ };
57
+ async function requestNotificationPermission() {
58
+ return null;
59
+ }
48
60
  //# sourceMappingURL=createNativeToast.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createNativeToast_native_exports","__export","createNativeToast","hideNativeToast","module","exports","__toCommonJS","import_native","require","title","param","message","duration","burntOptions","burnt","getBurnt","isEnabled","state","toast","console","warn","dismissAllAlerts"],"sources":["../../src/createNativeToast.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gCAAA;AAAAC,QAAA,CAAAD,gCAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAN,gCAAA;AAAA,IAAAO,aAAA,GAAyBC,OAAA;EACdN,iBAAA,GAAoB,SAAAA,CAASO,KAAA,EAAOC,KAAA,EAAO;IAClD,IAAI;QAAEC,OAAA;QAASC,QAAA;QAAUC;MAAa,IAAIH,KAAA;MACtCI,KAAA,OAAQP,aAAA,CAAAQ,QAAA,EAAS;IACrB,OAAKD,KAAA,CAAME,SAAA,IAIXF,KAAA,CAAMG,KAAA,CAAMC,KAAA,CAAM;MACdT,KAAA;MACAE,OAAA;MACAC,QAAA,EAAUA,QAAA,GAAWA,QAAA,GAAW,MAAO;MACvC,GAAGC;IACP,CAAC,GACM,OATHM,OAAA,CAAQC,IAAA,CAAK,sGAAsG,GAC5G;EASf;EACWjB,eAAA,GAAkB,SAAAA,CAAA,EAAW;IACpC,IAAIW,KAAA,OAAQP,aAAA,CAAAQ,QAAA,EAAS;IAChBD,KAAA,CAAME,SAAA,IACXF,KAAA,CAAMG,KAAA,CAAMI,gBAAA,CAAiB;EACjC","ignoreList":[]}
1
+ {"version":3,"names":["createNativeToast_native_exports","__export","createNativeToast","hideNativeToast","requestNotificationPermission","module","exports","__toCommonJS","import_native","require","title","param","message","duration","burntOptions","burnt","getBurnt","isEnabled","console","warn","state","toast","dismissAllAlerts"],"sources":["../../src/createNativeToast.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gCAAA;AAAAC,QAAA,CAAAD,gCAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,eAAA,EAAAA,CAAA,KAAAA,eAAA;EAAAC,6BAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAP,gCAAA;AAAA,IAAAQ,aAAA,GAAyBC,OAAA;AAClB,IAAIP,iBAAA,GAAoB,SAAAA,CAASQ,KAAA,EAAOC,KAAA,EAAO;EAClD,IAAI;IAAEC,OAAA;IAASC,QAAA;IAAUC;EAAa,IAAIH,KAAA;EAC1C,IAAII,KAAA,OAAQP,aAAA,CAAAQ,QAAA,EAAS;EACrB,IAAI,CAACD,KAAA,CAAME,SAAA,EAAW;IAClBC,OAAA,CAAQC,IAAA,CAAK,sGAAsG;IACnH,OAAO;EACX;EACAJ,KAAA,CAAMK,KAAA,CAAMC,KAAA,CAAM;IACdX,KAAA;IACAE,OAAA;IACAC,QAAA,EAAUA,QAAA,GAAWA,QAAA,GAAW,MAAO;IACvC,GAAGC;EACP,CAAC;EACD,OAAO;AACX;AACO,IAAIX,eAAA,GAAkB,SAAAA,CAAA,EAAW;EACpC,IAAIY,KAAA,OAAQP,aAAA,CAAAQ,QAAA,EAAS;EACrB,IAAI,CAACD,KAAA,CAAME,SAAA,EAAW;EACtBF,KAAA,CAAMK,KAAA,CAAME,gBAAA,CAAiB;AACjC;AACA,eAAsBlB,8BAAA,EAAgC;EAClD,OAAO;AACX","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var dispatchNativeToast_exports = {};
24
+ __export(dispatchNativeToast_exports, {
25
+ dispatchNativeToast: () => dispatchNativeToast
26
+ });
27
+ module.exports = __toCommonJS(dispatchNativeToast_exports);
28
+ var import_createNativeToast = require("./createNativeToast.cjs");
29
+ function dispatchNativeToast(toast, opts) {
30
+ const titleText = typeof toast.title === "function" ? toast.title() : toast.title;
31
+ if (typeof titleText !== "string") return false;
32
+ const descText = typeof toast.description === "function" ? toast.description() : toast.description;
33
+ const toastType = toast.type ?? "default";
34
+ const preset = toastType === "error" ? "error" : toastType === "success" ? "done" : "none";
35
+ const haptic = toastType === "error" ? "error" : toastType === "success" ? "success" : toastType === "warning" ? "warning" : "none";
36
+ const result = (0, import_createNativeToast.createNativeToast)(titleText, {
37
+ message: typeof descText === "string" ? descText : void 0,
38
+ duration: toast.duration ?? opts.duration,
39
+ burntOptions: {
40
+ preset,
41
+ haptic,
42
+ ...opts.burntOptions
43
+ },
44
+ notificationOptions: opts.notificationOptions
45
+ });
46
+ return result !== false;
47
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var dispatchNativeToast_exports = {};
26
+ __export(dispatchNativeToast_exports, {
27
+ dispatchNativeToast: () => dispatchNativeToast
28
+ });
29
+ module.exports = __toCommonJS(dispatchNativeToast_exports);
30
+ var import_createNativeToast = require("./createNativeToast.native.js");
31
+ function dispatchNativeToast(toast, opts) {
32
+ var titleText = typeof toast.title === "function" ? toast.title() : toast.title;
33
+ if (typeof titleText !== "string") return false;
34
+ var descText = typeof toast.description === "function" ? toast.description() : toast.description;
35
+ var _toast_type;
36
+ var toastType = (_toast_type = toast.type) !== null && _toast_type !== void 0 ? _toast_type : "default";
37
+ var preset = toastType === "error" ? "error" : toastType === "success" ? "done" : "none";
38
+ var haptic = toastType === "error" ? "error" : toastType === "success" ? "success" : toastType === "warning" ? "warning" : "none";
39
+ var _toast_duration;
40
+ var result = (0, import_createNativeToast.createNativeToast)(titleText, {
41
+ message: typeof descText === "string" ? descText : void 0,
42
+ duration: (_toast_duration = toast.duration) !== null && _toast_duration !== void 0 ? _toast_duration : opts.duration,
43
+ burntOptions: {
44
+ preset,
45
+ haptic,
46
+ ...opts.burntOptions
47
+ },
48
+ notificationOptions: opts.notificationOptions
49
+ });
50
+ return result !== false;
51
+ }
52
+ //# sourceMappingURL=dispatchNativeToast.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","dispatchNativeToast_exports","__export","dispatchNativeToast","module","exports","import_createNativeToast","require","toast","opts","titleText","title","descText","description","_toast_type","toastType","type","preset","haptic","_toast_duration","result","createNativeToast","message","duration","burntOptions"],"sources":["../../src/dispatchNativeToast.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,2BAAA;AAAAC,QAAA,CAAAD,2BAAA;EAAAE,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAAAK,2BAAkC;AAM3B,IAAAK,wBAAS,GACdC,OACA,gCAKS;AACT,SAAMJ,mBAAmBA,CAAAK,KAAM,EAAAC,IAAA;EAC/B,IAAIC,SAAO,UAAAF,KAAc,CAAAG,KAAU,eAAO,GAAAH,KAAA,CAAAG,KAAA,KAAAH,KAAA,CAAAG,KAAA;EAE1C,WAAMD,SACJ,KAAO,QAAM,cAAgB;EAC/B,IAAAE,QAAM,UAAYJ,KAAM,CAAAK,WAAQ,kBAAAL,KAAA,CAAAK,WAAA,KAAAL,KAAA,CAAAK,WAAA;EAEhC,IAAAC,WACE;EACF,IAAAC,SAAM,GACJ,CAAAD,WAAA,GAAcN,KAAA,CAAAQ,IACV,UACA,IAAAF,WAAc,UACZ,IAAAA,WACA,YAAc;EAItB,IAAAG,MAAM,GAAAF,SAAS,yBAAAA,SAAA,cAAkB,SAAW;EAAA,IAC1CG,MAAA,GAASH,SAAO,YAAa,UAAW,GAAAA,SAAW,6BAAAA,SAAA;EAAA,IACnDI,eAAgB;EAAiB,IACjCC,MAAA,OAAcd,wBAAqB,CAAKe,iBAAa,EAAAX,SAAA;IACrDY,OAAA,SAAAV,QAAqB,KAAK,WAAAA,QAAA;IAC3BW,QAAA,GAAAJ,eAAA,GAAAX,KAAA,CAAAe,QAAA,cAAAJ,eAAA,cAAAA,eAAA,GAAAV,IAAA,CAAAc,QAAA;IAEDC,YAAO;MACTP,MAAA","ignoreList":[]}
@@ -3,15 +3,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
7
8
  get: () => from[key],
8
9
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
10
  });
10
- return to;
11
- },
12
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
15
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
- value: !0
16
+ value: true
15
17
  }), mod);
16
18
  var index_exports = {};
17
19
  module.exports = __toCommonJS(index_exports);
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
10
  get: () => from[key],
10
11
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
12
  });
12
- return to;
13
- },
14
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
17
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: !0
18
+ value: true
17
19
  }), mod);
18
20
  var index_exports = {};
19
21
  module.exports = __toCommonJS(index_exports);
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
@@ -3,14 +3,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
10
12
  return to;
11
13
  };
12
14
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
- value: !0
15
+ value: true
14
16
  }), mod);
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
@@ -5,14 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
12
14
  return to;
13
15
  };
14
16
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: !0
17
+ value: true
16
18
  }), mod);
17
19
  var types_exports = {};
18
20
  module.exports = __toCommonJS(types_exports);
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
@@ -2,33 +2,35 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
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
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var useAnimatedDragGesture_exports = {};
33
35
  __export(useAnimatedDragGesture_exports, {
34
36
  useAnimatedDragGesture: () => useAnimatedDragGesture
@@ -38,76 +40,175 @@ var React = __toESM(require("react"), 1);
38
40
  const VELOCITY_THRESHOLD = 0.11;
39
41
  function resisted(delta, maxResist = 25) {
40
42
  if (delta >= 0) return delta;
41
- const pastBoundary = Math.abs(delta),
42
- resistedDistance = Math.sqrt(pastBoundary) * 2;
43
+ const pastBoundary = Math.abs(delta);
44
+ const resistedDistance = Math.sqrt(pastBoundary) * 2;
43
45
  return -Math.min(resistedDistance, maxResist);
44
46
  }
47
+ const EXIT_DRAG_CAP = 80;
48
+ function cappedExit(delta) {
49
+ if (Math.abs(delta) <= EXIT_DRAG_CAP) return delta;
50
+ const sign = delta > 0 ? 1 : -1;
51
+ const overshoot = Math.abs(delta) - EXIT_DRAG_CAP;
52
+ return sign * (EXIT_DRAG_CAP + Math.sqrt(overshoot) * 2);
53
+ }
45
54
  function useAnimatedDragGesture(options) {
46
55
  const {
47
- direction,
48
- threshold,
49
- disabled,
50
- expanded,
51
- onDragMove,
52
- onDragStart,
53
- onDismiss,
54
- onCancel
55
- } = options,
56
- [isDragging, setIsDragging] = React.useState(!1),
57
- dragStartRef = React.useRef(null),
58
- lockedDirectionRef = React.useRef(null),
59
- isHorizontal = direction === "left" || direction === "right" || direction === "horizontal",
60
- isVertical = direction === "up" || direction === "down" || direction === "vertical",
61
- handlePointerDown = React.useCallback(event => {
62
- disabled || event.button !== 0 || (window.getSelection()?.toString().length ?? 0) > 0 || (event.target.setPointerCapture(event.pointerId), dragStartRef.current = {
63
- startX: event.clientX,
64
- startY: event.clientY,
65
- startTime: Date.now()
66
- }, setIsDragging(!0), onDragStart?.());
67
- }, [disabled, onDragStart]),
68
- handlePointerMove = React.useCallback(event => {
69
- if (!dragStartRef.current || disabled) return;
70
- const deltaX = event.clientX - dragStartRef.current.startX,
71
- deltaY = event.clientY - dragStartRef.current.startY;
72
- !lockedDirectionRef.current && (Math.abs(deltaX) > 1 || Math.abs(deltaY) > 1) && (lockedDirectionRef.current = Math.abs(deltaX) > Math.abs(deltaY) ? "x" : "y");
73
- let offsetX = 0,
74
- offsetY = 0;
75
- expanded ? lockedDirectionRef.current === "x" && isHorizontal ? direction === "right" ? offsetX = deltaX > 0 ? deltaX : resisted(deltaX) : direction === "left" ? offsetX = deltaX < 0 ? deltaX : -resisted(-deltaX) : offsetX = deltaX : lockedDirectionRef.current === "y" && isVertical && (direction === "down" ? offsetY = deltaY > 0 ? deltaY : resisted(deltaY) : direction === "up" ? offsetY = deltaY < 0 ? deltaY : -resisted(-deltaY) : offsetY = deltaY) : direction === "right" ? (offsetX = deltaX > 0 ? deltaX : resisted(deltaX), offsetY = deltaY > 0 ? -resisted(-deltaY) : resisted(deltaY)) : direction === "left" ? (offsetX = deltaX < 0 ? deltaX : -resisted(-deltaX), offsetY = deltaY > 0 ? -resisted(-deltaY) : resisted(deltaY)) : direction === "down" ? (offsetY = deltaY > 0 ? deltaY : resisted(deltaY), offsetX = deltaX > 0 ? -resisted(-deltaX) : resisted(deltaX)) : direction === "up" ? (offsetY = deltaY < 0 ? deltaY : -resisted(-deltaY), offsetX = deltaX > 0 ? -resisted(-deltaX) : resisted(deltaX)) : direction === "horizontal" ? (offsetX = deltaX, offsetY = deltaY > 0 ? -resisted(-deltaY) : resisted(deltaY)) : direction === "vertical" && (offsetY = deltaY, offsetX = deltaX > 0 ? -resisted(-deltaX) : resisted(deltaX)), onDragMove(offsetX, offsetY);
76
- }, [disabled, direction, expanded, isHorizontal, isVertical, onDragMove]),
77
- handlePointerUp = React.useCallback(event => {
78
- if (!dragStartRef.current || disabled) return;
79
- const deltaX = event.clientX - dragStartRef.current.startX,
80
- deltaY = event.clientY - dragStartRef.current.startY,
81
- timeTaken = Date.now() - dragStartRef.current.startTime,
82
- velocityX = Math.abs(deltaX) / timeTaken,
83
- velocityY = Math.abs(deltaY) / timeTaken,
84
- lockedDirection = lockedDirectionRef.current,
85
- isLockedToWrongAxis = lockedDirection === "y" && isHorizontal || lockedDirection === "x" && isVertical,
86
- relevantDelta = isHorizontal ? deltaX : deltaY,
87
- relevantVelocity = isHorizontal ? velocityX : velocityY,
88
- passedThreshold = Math.abs(relevantDelta) >= threshold,
89
- hasVelocity = relevantVelocity > VELOCITY_THRESHOLD;
90
- let exitDirection = null;
91
- isLockedToWrongAxis || (direction === "right" && deltaX > 0 ? exitDirection = "right" : direction === "left" && deltaX < 0 ? exitDirection = "left" : direction === "horizontal" ? Math.abs(deltaX) > Math.abs(deltaY) && (exitDirection = deltaX > 0 ? "right" : "left") : direction === "down" && deltaY > 0 ? exitDirection = "down" : direction === "up" && deltaY < 0 ? exitDirection = "up" : direction === "vertical" && Math.abs(deltaY) > Math.abs(deltaX) && (exitDirection = deltaY > 0 ? "down" : "up"));
92
- const shouldDismiss = exitDirection && (passedThreshold || hasVelocity);
56
+ direction,
57
+ threshold,
58
+ disabled,
59
+ expanded,
60
+ onDragMove,
61
+ onDragStart,
62
+ onDismiss,
63
+ onCancel
64
+ } = options;
65
+ const [isDragging, setIsDragging] = React.useState(false);
66
+ const dragStartRef = React.useRef(null);
67
+ const lockedDirectionRef = React.useRef(null);
68
+ const captureElementRef = React.useRef(null);
69
+ const isHorizontal = direction === "left" || direction === "right" || direction === "horizontal";
70
+ const isVertical = direction === "up" || direction === "down" || direction === "vertical";
71
+ const preventSelectRef = React.useRef(null);
72
+ function startPreventingSelection() {
73
+ if (typeof document === "undefined") return;
74
+ window.getSelection()?.removeAllRanges();
75
+ const handler = e => e.preventDefault();
76
+ preventSelectRef.current = handler;
77
+ document.addEventListener("selectstart", handler, true);
78
+ }
79
+ function stopPreventingSelection() {
80
+ if (preventSelectRef.current) {
81
+ document.removeEventListener("selectstart", preventSelectRef.current, true);
82
+ preventSelectRef.current = null;
83
+ }
84
+ }
85
+ const cleanup = React.useCallback(() => {
86
+ dragStartRef.current = null;
87
+ lockedDirectionRef.current = null;
88
+ setIsDragging(false);
89
+ stopPreventingSelection();
90
+ }, []);
91
+ React.useEffect(() => {
92
+ return () => {
93
+ if (dragStartRef.current) {
94
+ if (captureElementRef.current && dragStartRef.current.pointerId) {
95
+ try {
96
+ captureElementRef.current.releasePointerCapture(dragStartRef.current.pointerId);
97
+ } catch {}
98
+ }
99
+ cleanup();
100
+ }
101
+ };
102
+ }, [cleanup]);
103
+ const handlePointerDown = React.useCallback(event => {
104
+ if (disabled) return;
105
+ if (event.button !== 0) return;
106
+ const target = event.target;
107
+ if (target.closest('button, a, input, textarea, select, [role="button"]')) {
108
+ return;
109
+ }
110
+ const hasSelection = (window.getSelection()?.toString().length ?? 0) > 0;
111
+ if (hasSelection) return;
112
+ const captureElement = event.currentTarget;
113
+ captureElementRef.current = captureElement;
114
+ captureElement.setPointerCapture(event.pointerId);
115
+ dragStartRef.current = {
116
+ startX: event.clientX,
117
+ startY: event.clientY,
118
+ startTime: Date.now(),
119
+ pointerId: event.pointerId
120
+ };
121
+ startPreventingSelection();
122
+ setIsDragging(true);
123
+ onDragStart?.();
124
+ }, [disabled, onDragStart]);
125
+ const handlePointerMove = React.useCallback(event => {
126
+ if (!dragStartRef.current || disabled) return;
127
+ const deltaX = event.clientX - dragStartRef.current.startX;
128
+ const deltaY = event.clientY - dragStartRef.current.startY;
129
+ if (!lockedDirectionRef.current && (Math.abs(deltaX) > 1 || Math.abs(deltaY) > 1)) {
130
+ lockedDirectionRef.current = Math.abs(deltaX) > Math.abs(deltaY) ? "x" : "y";
131
+ }
132
+ let offsetX = 0;
133
+ let offsetY = 0;
134
+ if (direction === "right") {
135
+ offsetX = deltaX > 0 ? cappedExit(deltaX) : resisted(deltaX);
136
+ } else if (direction === "left") {
137
+ offsetX = deltaX < 0 ? cappedExit(deltaX) : -resisted(-deltaX);
138
+ } else if (direction === "down") {
139
+ offsetY = deltaY > 0 ? cappedExit(deltaY) : resisted(deltaY);
140
+ } else if (direction === "up") {
141
+ offsetY = deltaY < 0 ? cappedExit(deltaY) : -resisted(-deltaY);
142
+ } else if (direction === "horizontal") {
143
+ offsetX = cappedExit(deltaX);
144
+ } else if (direction === "vertical") {
145
+ offsetY = cappedExit(deltaY);
146
+ }
147
+ onDragMove(offsetX, offsetY);
148
+ }, [disabled, direction, expanded, isHorizontal, isVertical, onDragMove]);
149
+ const handlePointerUp = React.useCallback(event => {
150
+ if (!dragStartRef.current || disabled) return;
151
+ const deltaX = event.clientX - dragStartRef.current.startX;
152
+ const deltaY = event.clientY - dragStartRef.current.startY;
153
+ const timeTaken = Date.now() - dragStartRef.current.startTime;
154
+ const velocityX = Math.abs(deltaX) / timeTaken;
155
+ const velocityY = Math.abs(deltaY) / timeTaken;
156
+ const lockedDirection = lockedDirectionRef.current;
157
+ const isLockedToWrongAxis = lockedDirection === "y" && isHorizontal || lockedDirection === "x" && isVertical;
158
+ const relevantDelta = isHorizontal ? deltaX : deltaY;
159
+ const relevantVelocity = isHorizontal ? velocityX : velocityY;
160
+ const passedThreshold = Math.abs(relevantDelta) >= threshold;
161
+ const hasVelocity = relevantVelocity > VELOCITY_THRESHOLD;
162
+ let exitDirection = null;
163
+ if (!isLockedToWrongAxis) {
164
+ if (direction === "right" && deltaX > 0) exitDirection = "right";else if (direction === "left" && deltaX < 0) exitDirection = "left";else if (direction === "horizontal") {
165
+ if (Math.abs(deltaX) > Math.abs(deltaY)) {
166
+ exitDirection = deltaX > 0 ? "right" : "left";
167
+ }
168
+ } else if (direction === "down" && deltaY > 0) exitDirection = "down";else if (direction === "up" && deltaY < 0) exitDirection = "up";else if (direction === "vertical") {
169
+ if (Math.abs(deltaY) > Math.abs(deltaX)) {
170
+ exitDirection = deltaY > 0 ? "down" : "up";
171
+ }
172
+ }
173
+ }
174
+ const shouldDismiss = exitDirection && (passedThreshold || hasVelocity);
175
+ if (captureElementRef.current) {
93
176
  try {
94
- event.target.releasePointerCapture(event.pointerId);
177
+ captureElementRef.current.releasePointerCapture(event.pointerId);
95
178
  } catch {}
96
- dragStartRef.current = null, lockedDirectionRef.current = null, setIsDragging(!1), shouldDismiss && exitDirection ? onDismiss(exitDirection, relevantVelocity) : onCancel();
97
- }, [disabled, direction, threshold, isHorizontal, isVertical, onDismiss, onCancel]),
98
- handlePointerCancel = React.useCallback(event => {
179
+ }
180
+ cleanup();
181
+ if (shouldDismiss && exitDirection) {
182
+ onDismiss(exitDirection, relevantVelocity);
183
+ } else {
184
+ onCancel();
185
+ }
186
+ }, [disabled, direction, threshold, isHorizontal, isVertical, onDismiss, onCancel, cleanup]);
187
+ const handlePointerCancel = React.useCallback(event => {
188
+ if (captureElementRef.current) {
99
189
  try {
100
- event.target.releasePointerCapture(event.pointerId);
190
+ captureElementRef.current.releasePointerCapture(event.pointerId);
101
191
  } catch {}
102
- dragStartRef.current = null, lockedDirectionRef.current = null, setIsDragging(!1), onCancel();
103
- }, [onCancel]);
192
+ }
193
+ cleanup();
194
+ onCancel();
195
+ }, [onCancel, cleanup]);
196
+ const handleLostPointerCapture = React.useCallback(() => {
197
+ if (dragStartRef.current) {
198
+ cleanup();
199
+ onCancel();
200
+ }
201
+ }, [onCancel, cleanup]);
202
+ const gestureHandlers = {
203
+ onPointerDown: handlePointerDown,
204
+ onPointerMove: handlePointerMove,
205
+ onPointerUp: handlePointerUp,
206
+ onPointerCancel: handlePointerCancel,
207
+ onLostPointerCapture: handleLostPointerCapture
208
+ };
104
209
  return {
105
210
  isDragging,
106
- gestureHandlers: {
107
- onPointerDown: handlePointerDown,
108
- onPointerMove: handlePointerMove,
109
- onPointerUp: handlePointerUp,
110
- onPointerCancel: handlePointerCancel
111
- }
211
+ gestureHandlers,
212
+ gesture: null
112
213
  };
113
214
  }