@oxyhq/bloom 0.50.2 → 0.51.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.
Files changed (567) hide show
  1. package/NOTICE +89 -0
  2. package/README.md +12 -7
  3. package/lib/commonjs/avatar-group/AvatarGroup.web.js +2 -1
  4. package/lib/commonjs/avatar-group/AvatarGroup.web.js.map +1 -1
  5. package/lib/commonjs/bottom-sheet/index.web.js +2 -1
  6. package/lib/commonjs/bottom-sheet/index.web.js.map +1 -1
  7. package/lib/commonjs/context-menu/index.web.js +3 -2
  8. package/lib/commonjs/context-menu/index.web.js.map +1 -1
  9. package/lib/commonjs/dialog/Dialog.web.js +4 -3
  10. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  11. package/lib/commonjs/frosted-icon-button/shared.js +1 -1
  12. package/lib/commonjs/index.js +90 -83
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/index.web.js +116 -109
  15. package/lib/commonjs/index.web.js.map +1 -1
  16. package/lib/commonjs/menu/index.web.js +2 -1
  17. package/lib/commonjs/menu/index.web.js.map +1 -1
  18. package/lib/commonjs/popover/index.web.js +3 -2
  19. package/lib/commonjs/popover/index.web.js.map +1 -1
  20. package/lib/commonjs/portal/index.js +4 -1
  21. package/lib/commonjs/portal/index.js.map +1 -1
  22. package/lib/commonjs/progressive-blur/index.js +79 -0
  23. package/lib/commonjs/progressive-blur/index.js.map +1 -0
  24. package/lib/commonjs/progressive-blur/index.web.js +67 -0
  25. package/lib/commonjs/progressive-blur/index.web.js.map +1 -0
  26. package/lib/commonjs/progressive-blur/shared.js +66 -0
  27. package/lib/commonjs/progressive-blur/shared.js.map +1 -0
  28. package/lib/commonjs/progressive-blur/types.js +6 -0
  29. package/lib/commonjs/progressive-blur/types.js.map +1 -0
  30. package/lib/commonjs/select/index.web.js +2 -1
  31. package/lib/commonjs/select/index.web.js.map +1 -1
  32. package/lib/commonjs/styles/web-view-style.js +26 -0
  33. package/lib/commonjs/styles/web-view-style.js.map +1 -0
  34. package/lib/commonjs/tab-bar/TabBarBase.js +415 -0
  35. package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -0
  36. package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js +83 -0
  37. package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js.map +1 -0
  38. package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js +119 -0
  39. package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
  40. package/lib/commonjs/tab-bar/expo-router/index.js +26 -0
  41. package/lib/commonjs/tab-bar/expo-router/index.js.map +1 -0
  42. package/lib/commonjs/tab-bar/glyph.js +43 -0
  43. package/lib/commonjs/tab-bar/glyph.js.map +1 -0
  44. package/lib/commonjs/tab-bar/glyph.native.js +55 -0
  45. package/lib/commonjs/tab-bar/glyph.native.js.map +1 -0
  46. package/lib/commonjs/tab-bar/index.js +65 -0
  47. package/lib/commonjs/tab-bar/index.js.map +1 -0
  48. package/lib/commonjs/tab-bar/index.web.js +67 -0
  49. package/lib/commonjs/tab-bar/index.web.js.map +1 -0
  50. package/lib/commonjs/tab-bar/minimize-context.js +127 -0
  51. package/lib/commonjs/tab-bar/minimize-context.js.map +1 -0
  52. package/lib/commonjs/tab-bar/shared.js +139 -0
  53. package/lib/commonjs/tab-bar/shared.js.map +1 -0
  54. package/lib/commonjs/tab-bar/surface-solid.js +43 -0
  55. package/lib/commonjs/tab-bar/surface-solid.js.map +1 -0
  56. package/lib/commonjs/tab-bar/surface.js +13 -0
  57. package/lib/commonjs/tab-bar/surface.js.map +1 -0
  58. package/lib/commonjs/tab-bar/surface.native.js +113 -0
  59. package/lib/commonjs/tab-bar/surface.native.js.map +1 -0
  60. package/lib/commonjs/tab-bar/surface.web.js +59 -0
  61. package/lib/commonjs/tab-bar/surface.web.js.map +1 -0
  62. package/lib/commonjs/tab-bar/types.js +6 -0
  63. package/lib/commonjs/tab-bar/types.js.map +1 -0
  64. package/lib/commonjs/toast/Positioner.js +117 -0
  65. package/lib/commonjs/toast/Positioner.js.map +1 -0
  66. package/lib/commonjs/toast/ToastContent.js +301 -0
  67. package/lib/commonjs/toast/ToastContent.js.map +1 -0
  68. package/lib/commonjs/toast/ToastHost.js +69 -0
  69. package/lib/commonjs/toast/ToastHost.js.map +1 -0
  70. package/lib/commonjs/toast/ToastHost.native.js +44 -0
  71. package/lib/commonjs/toast/ToastHost.native.js.map +1 -0
  72. package/lib/commonjs/toast/ToastIcon.js +57 -0
  73. package/lib/commonjs/toast/ToastIcon.js.map +1 -0
  74. package/lib/commonjs/toast/ToastRow.js +411 -0
  75. package/lib/commonjs/toast/ToastRow.js.map +1 -0
  76. package/lib/commonjs/toast/ToastSwipeHandler.js +189 -0
  77. package/lib/commonjs/toast/ToastSwipeHandler.js.map +1 -0
  78. package/lib/commonjs/toast/Toaster.js +205 -0
  79. package/lib/commonjs/toast/Toaster.js.map +1 -0
  80. package/lib/commonjs/toast/animations.js +274 -0
  81. package/lib/commonjs/toast/animations.js.map +1 -0
  82. package/lib/commonjs/toast/constants.js +56 -0
  83. package/lib/commonjs/toast/constants.js.map +1 -0
  84. package/lib/commonjs/toast/context.js +42 -0
  85. package/lib/commonjs/toast/context.js.map +1 -0
  86. package/lib/commonjs/toast/index.js +32 -126
  87. package/lib/commonjs/toast/index.js.map +1 -1
  88. package/lib/commonjs/toast/position-utils.js +115 -0
  89. package/lib/commonjs/toast/position-utils.js.map +1 -0
  90. package/lib/commonjs/toast/positioner-utils.js +141 -0
  91. package/lib/commonjs/toast/positioner-utils.js.map +1 -0
  92. package/lib/commonjs/toast/toast-comparator.js +28 -0
  93. package/lib/commonjs/toast/toast-comparator.js.map +1 -0
  94. package/lib/commonjs/toast/toast-fns.js +90 -0
  95. package/lib/commonjs/toast/toast-fns.js.map +1 -0
  96. package/lib/commonjs/toast/toast-store.js +352 -0
  97. package/lib/commonjs/toast/toast-store.js.map +1 -0
  98. package/lib/commonjs/toast/toast-timers.js +110 -0
  99. package/lib/commonjs/toast/toast-timers.js.map +1 -0
  100. package/lib/commonjs/toast/types.js +42 -0
  101. package/lib/commonjs/toast/types.js.map +1 -1
  102. package/lib/commonjs/toast/use-animated-target.js +57 -0
  103. package/lib/commonjs/toast/use-animated-target.js.map +1 -0
  104. package/lib/commonjs/toast/use-app-state.js +76 -0
  105. package/lib/commonjs/toast/use-app-state.js.map +1 -0
  106. package/lib/commonjs/toast/use-toast-colors.js +114 -0
  107. package/lib/commonjs/toast/use-toast-colors.js.map +1 -0
  108. package/lib/commonjs/toast/use-toast-position.js +40 -0
  109. package/lib/commonjs/toast/use-toast-position.js.map +1 -0
  110. package/lib/commonjs/tooltip/index.web.js +2 -1
  111. package/lib/commonjs/tooltip/index.web.js.map +1 -1
  112. package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
  113. package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
  114. package/lib/module/avatar-group/AvatarGroup.web.js +2 -1
  115. package/lib/module/avatar-group/AvatarGroup.web.js.map +1 -1
  116. package/lib/module/bottom-sheet/index.web.js +2 -1
  117. package/lib/module/bottom-sheet/index.web.js.map +1 -1
  118. package/lib/module/context-menu/index.web.js +3 -2
  119. package/lib/module/context-menu/index.web.js.map +1 -1
  120. package/lib/module/dialog/Dialog.web.js +4 -3
  121. package/lib/module/dialog/Dialog.web.js.map +1 -1
  122. package/lib/module/frosted-icon-button/shared.js +1 -1
  123. package/lib/module/index.js +3 -2
  124. package/lib/module/index.js.map +1 -1
  125. package/lib/module/index.web.js +3 -2
  126. package/lib/module/index.web.js.map +1 -1
  127. package/lib/module/menu/index.web.js +2 -1
  128. package/lib/module/menu/index.web.js.map +1 -1
  129. package/lib/module/popover/index.web.js +3 -2
  130. package/lib/module/popover/index.web.js.map +1 -1
  131. package/lib/module/portal/index.js +4 -1
  132. package/lib/module/portal/index.js.map +1 -1
  133. package/lib/module/progressive-blur/index.js +74 -0
  134. package/lib/module/progressive-blur/index.js.map +1 -0
  135. package/lib/module/progressive-blur/index.web.js +62 -0
  136. package/lib/module/progressive-blur/index.web.js.map +1 -0
  137. package/lib/module/progressive-blur/shared.js +60 -0
  138. package/lib/module/progressive-blur/shared.js.map +1 -0
  139. package/lib/module/progressive-blur/types.js +4 -0
  140. package/lib/module/progressive-blur/types.js.map +1 -0
  141. package/lib/module/select/index.web.js +2 -1
  142. package/lib/module/select/index.web.js.map +1 -1
  143. package/lib/module/styles/web-view-style.js +22 -0
  144. package/lib/module/styles/web-view-style.js.map +1 -0
  145. package/lib/module/tab-bar/TabBarBase.js +408 -0
  146. package/lib/module/tab-bar/TabBarBase.js.map +1 -0
  147. package/lib/module/tab-bar/expo-router/RouterTabBar.js +78 -0
  148. package/lib/module/tab-bar/expo-router/RouterTabBar.js.map +1 -0
  149. package/lib/module/tab-bar/expo-router/fading-tab-screen.js +113 -0
  150. package/lib/module/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
  151. package/lib/module/tab-bar/expo-router/index.js +15 -0
  152. package/lib/module/tab-bar/expo-router/index.js.map +1 -0
  153. package/lib/module/tab-bar/glyph.js +38 -0
  154. package/lib/module/tab-bar/glyph.js.map +1 -0
  155. package/lib/module/tab-bar/glyph.native.js +50 -0
  156. package/lib/module/tab-bar/glyph.native.js.map +1 -0
  157. package/lib/module/tab-bar/index.js +24 -0
  158. package/lib/module/tab-bar/index.js.map +1 -0
  159. package/lib/module/tab-bar/index.web.js +26 -0
  160. package/lib/module/tab-bar/index.web.js.map +1 -0
  161. package/lib/module/tab-bar/minimize-context.js +118 -0
  162. package/lib/module/tab-bar/minimize-context.js.map +1 -0
  163. package/lib/module/tab-bar/shared.js +132 -0
  164. package/lib/module/tab-bar/shared.js.map +1 -0
  165. package/lib/module/tab-bar/surface-solid.js +37 -0
  166. package/lib/module/tab-bar/surface-solid.js.map +1 -0
  167. package/lib/module/tab-bar/surface.js +31 -0
  168. package/lib/module/tab-bar/surface.js.map +1 -0
  169. package/lib/module/tab-bar/surface.native.js +109 -0
  170. package/lib/module/tab-bar/surface.native.js.map +1 -0
  171. package/lib/module/tab-bar/surface.web.js +53 -0
  172. package/lib/module/tab-bar/surface.web.js.map +1 -0
  173. package/lib/module/tab-bar/types.js +4 -0
  174. package/lib/module/tab-bar/types.js.map +1 -0
  175. package/lib/module/toast/Positioner.js +110 -0
  176. package/lib/module/toast/Positioner.js.map +1 -0
  177. package/lib/module/toast/ToastContent.js +295 -0
  178. package/lib/module/toast/ToastContent.js.map +1 -0
  179. package/lib/module/toast/ToastHost.js +63 -0
  180. package/lib/module/toast/ToastHost.js.map +1 -0
  181. package/lib/module/toast/ToastHost.native.js +38 -0
  182. package/lib/module/toast/ToastHost.native.js.map +1 -0
  183. package/lib/module/toast/ToastIcon.js +52 -0
  184. package/lib/module/toast/ToastIcon.js.map +1 -0
  185. package/lib/module/toast/ToastRow.js +407 -0
  186. package/lib/module/toast/ToastRow.js.map +1 -0
  187. package/lib/module/toast/ToastSwipeHandler.js +182 -0
  188. package/lib/module/toast/ToastSwipeHandler.js.map +1 -0
  189. package/lib/module/toast/Toaster.js +198 -0
  190. package/lib/module/toast/Toaster.js.map +1 -0
  191. package/lib/module/toast/animations.js +261 -0
  192. package/lib/module/toast/animations.js.map +1 -0
  193. package/lib/module/toast/constants.js +52 -0
  194. package/lib/module/toast/constants.js.map +1 -0
  195. package/lib/module/toast/context.js +34 -0
  196. package/lib/module/toast/context.js.map +1 -0
  197. package/lib/module/toast/index.js +27 -103
  198. package/lib/module/toast/index.js.map +1 -1
  199. package/lib/module/toast/position-utils.js +107 -0
  200. package/lib/module/toast/position-utils.js.map +1 -0
  201. package/lib/module/toast/positioner-utils.js +134 -0
  202. package/lib/module/toast/positioner-utils.js.map +1 -0
  203. package/lib/module/toast/toast-comparator.js +22 -0
  204. package/lib/module/toast/toast-comparator.js.map +1 -0
  205. package/lib/module/toast/toast-fns.js +85 -0
  206. package/lib/module/toast/toast-fns.js.map +1 -0
  207. package/lib/module/toast/toast-store.js +346 -0
  208. package/lib/module/toast/toast-store.js.map +1 -0
  209. package/lib/module/toast/toast-timers.js +104 -0
  210. package/lib/module/toast/toast-timers.js.map +1 -0
  211. package/lib/module/toast/types.js +38 -0
  212. package/lib/module/toast/types.js.map +1 -1
  213. package/lib/module/toast/use-animated-target.js +52 -0
  214. package/lib/module/toast/use-animated-target.js.map +1 -0
  215. package/lib/module/toast/use-app-state.js +70 -0
  216. package/lib/module/toast/use-app-state.js.map +1 -0
  217. package/lib/module/toast/use-toast-colors.js +109 -0
  218. package/lib/module/toast/use-toast-colors.js.map +1 -0
  219. package/lib/module/toast/use-toast-position.js +35 -0
  220. package/lib/module/toast/use-toast-position.js.map +1 -0
  221. package/lib/module/tooltip/index.web.js +2 -1
  222. package/lib/module/tooltip/index.web.js.map +1 -1
  223. package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
  224. package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
  225. package/lib/typescript/commonjs/avatar-group/AvatarGroup.web.d.ts.map +1 -1
  226. package/lib/typescript/commonjs/benefit-list/types.d.ts +2 -1
  227. package/lib/typescript/commonjs/benefit-list/types.d.ts.map +1 -1
  228. package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts.map +1 -1
  229. package/lib/typescript/commonjs/context-menu/index.web.d.ts.map +1 -1
  230. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  231. package/lib/typescript/commonjs/fab/types.d.ts +4 -2
  232. package/lib/typescript/commonjs/fab/types.d.ts.map +1 -1
  233. package/lib/typescript/commonjs/frosted-icon-button/shared.d.ts +1 -1
  234. package/lib/typescript/commonjs/frosted-icon-button/types.d.ts +2 -1
  235. package/lib/typescript/commonjs/frosted-icon-button/types.d.ts.map +1 -1
  236. package/lib/typescript/commonjs/index.d.ts +2 -1
  237. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  238. package/lib/typescript/commonjs/index.web.d.ts +2 -1
  239. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  240. package/lib/typescript/commonjs/menu/index.web.d.ts.map +1 -1
  241. package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
  242. package/lib/typescript/commonjs/portal/index.d.ts.map +1 -1
  243. package/lib/typescript/commonjs/progressive-blur/index.d.ts +23 -0
  244. package/lib/typescript/commonjs/progressive-blur/index.d.ts.map +1 -0
  245. package/lib/typescript/commonjs/progressive-blur/index.web.d.ts +30 -0
  246. package/lib/typescript/commonjs/progressive-blur/index.web.d.ts.map +1 -0
  247. package/lib/typescript/commonjs/progressive-blur/shared.d.ts +35 -0
  248. package/lib/typescript/commonjs/progressive-blur/shared.d.ts.map +1 -0
  249. package/lib/typescript/commonjs/progressive-blur/types.d.ts +21 -0
  250. package/lib/typescript/commonjs/progressive-blur/types.d.ts.map +1 -0
  251. package/lib/typescript/commonjs/select/index.web.d.ts.map +1 -1
  252. package/lib/typescript/commonjs/styles/web-view-style.d.ts +21 -0
  253. package/lib/typescript/commonjs/styles/web-view-style.d.ts.map +1 -0
  254. package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts +36 -0
  255. package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -0
  256. package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
  257. package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
  258. package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
  259. package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
  260. package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts +14 -0
  261. package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts.map +1 -0
  262. package/lib/typescript/commonjs/tab-bar/glyph.d.ts +6 -0
  263. package/lib/typescript/commonjs/tab-bar/glyph.d.ts.map +1 -0
  264. package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts +6 -0
  265. package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts.map +1 -0
  266. package/lib/typescript/commonjs/tab-bar/index.d.ts +12 -0
  267. package/lib/typescript/commonjs/tab-bar/index.d.ts.map +1 -0
  268. package/lib/typescript/commonjs/tab-bar/index.web.d.ts +12 -0
  269. package/lib/typescript/commonjs/tab-bar/index.web.d.ts.map +1 -0
  270. package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts +51 -0
  271. package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts.map +1 -0
  272. package/lib/typescript/commonjs/tab-bar/shared.d.ts +93 -0
  273. package/lib/typescript/commonjs/tab-bar/shared.d.ts.map +1 -0
  274. package/lib/typescript/commonjs/tab-bar/surface-solid.d.ts +6 -0
  275. package/lib/typescript/commonjs/tab-bar/surface-solid.d.ts.map +1 -0
  276. package/lib/typescript/commonjs/tab-bar/surface.d.ts +29 -0
  277. package/lib/typescript/commonjs/tab-bar/surface.d.ts.map +1 -0
  278. package/lib/typescript/commonjs/tab-bar/surface.native.d.ts +6 -0
  279. package/lib/typescript/commonjs/tab-bar/surface.native.d.ts.map +1 -0
  280. package/lib/typescript/commonjs/tab-bar/surface.web.d.ts +6 -0
  281. package/lib/typescript/commonjs/tab-bar/surface.web.d.ts.map +1 -0
  282. package/lib/typescript/commonjs/tab-bar/types.d.ts +88 -0
  283. package/lib/typescript/commonjs/tab-bar/types.d.ts.map +1 -0
  284. package/lib/typescript/commonjs/toast/Positioner.d.ts +21 -0
  285. package/lib/typescript/commonjs/toast/Positioner.d.ts.map +1 -0
  286. package/lib/typescript/commonjs/toast/ToastContent.d.ts +14 -0
  287. package/lib/typescript/commonjs/toast/ToastContent.d.ts.map +1 -0
  288. package/lib/typescript/commonjs/toast/ToastHost.d.ts +6 -0
  289. package/lib/typescript/commonjs/toast/ToastHost.d.ts.map +1 -0
  290. package/lib/typescript/commonjs/toast/ToastHost.native.d.ts +6 -0
  291. package/lib/typescript/commonjs/toast/ToastHost.native.d.ts.map +1 -0
  292. package/lib/typescript/commonjs/toast/ToastIcon.d.ts +9 -0
  293. package/lib/typescript/commonjs/toast/ToastIcon.d.ts.map +1 -0
  294. package/lib/typescript/commonjs/toast/ToastRow.d.ts +80 -0
  295. package/lib/typescript/commonjs/toast/ToastRow.d.ts.map +1 -0
  296. package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts +30 -0
  297. package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts.map +1 -0
  298. package/lib/typescript/commonjs/toast/Toaster.d.ts +19 -0
  299. package/lib/typescript/commonjs/toast/Toaster.d.ts.map +1 -0
  300. package/lib/typescript/commonjs/toast/animations.d.ts +62 -0
  301. package/lib/typescript/commonjs/toast/animations.d.ts.map +1 -0
  302. package/lib/typescript/commonjs/toast/constants.d.ts +39 -0
  303. package/lib/typescript/commonjs/toast/constants.d.ts.map +1 -0
  304. package/lib/typescript/commonjs/toast/context.d.ts +19 -0
  305. package/lib/typescript/commonjs/toast/context.d.ts.map +1 -0
  306. package/lib/typescript/commonjs/toast/index.d.ts +23 -76
  307. package/lib/typescript/commonjs/toast/index.d.ts.map +1 -1
  308. package/lib/typescript/commonjs/toast/position-utils.d.ts +30 -0
  309. package/lib/typescript/commonjs/toast/position-utils.d.ts.map +1 -0
  310. package/lib/typescript/commonjs/toast/positioner-utils.d.ts +72 -0
  311. package/lib/typescript/commonjs/toast/positioner-utils.d.ts.map +1 -0
  312. package/lib/typescript/commonjs/toast/toast-comparator.d.ts +12 -0
  313. package/lib/typescript/commonjs/toast/toast-comparator.d.ts.map +1 -0
  314. package/lib/typescript/commonjs/toast/toast-fns.d.ts +3 -0
  315. package/lib/typescript/commonjs/toast/toast-fns.d.ts.map +1 -0
  316. package/lib/typescript/commonjs/toast/toast-store.d.ts +52 -0
  317. package/lib/typescript/commonjs/toast/toast-store.d.ts.map +1 -0
  318. package/lib/typescript/commonjs/toast/toast-timers.d.ts +24 -0
  319. package/lib/typescript/commonjs/toast/toast-timers.d.ts.map +1 -0
  320. package/lib/typescript/commonjs/toast/types.d.ts +222 -5
  321. package/lib/typescript/commonjs/toast/types.d.ts.map +1 -1
  322. package/lib/typescript/commonjs/toast/use-animated-target.d.ts +7 -0
  323. package/lib/typescript/commonjs/toast/use-animated-target.d.ts.map +1 -0
  324. package/lib/typescript/commonjs/toast/use-app-state.d.ts +18 -0
  325. package/lib/typescript/commonjs/toast/use-app-state.d.ts.map +1 -0
  326. package/lib/typescript/commonjs/toast/use-toast-colors.d.ts +22 -0
  327. package/lib/typescript/commonjs/toast/use-toast-colors.d.ts.map +1 -0
  328. package/lib/typescript/commonjs/toast/use-toast-position.d.ts +37 -0
  329. package/lib/typescript/commonjs/toast/use-toast-position.d.ts.map +1 -0
  330. package/lib/typescript/commonjs/tooltip/index.web.d.ts.map +1 -1
  331. package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
  332. package/lib/typescript/module/avatar-group/AvatarGroup.web.d.ts.map +1 -1
  333. package/lib/typescript/module/benefit-list/types.d.ts +2 -1
  334. package/lib/typescript/module/benefit-list/types.d.ts.map +1 -1
  335. package/lib/typescript/module/bottom-sheet/index.web.d.ts.map +1 -1
  336. package/lib/typescript/module/context-menu/index.web.d.ts.map +1 -1
  337. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  338. package/lib/typescript/module/fab/types.d.ts +4 -2
  339. package/lib/typescript/module/fab/types.d.ts.map +1 -1
  340. package/lib/typescript/module/frosted-icon-button/shared.d.ts +1 -1
  341. package/lib/typescript/module/frosted-icon-button/types.d.ts +2 -1
  342. package/lib/typescript/module/frosted-icon-button/types.d.ts.map +1 -1
  343. package/lib/typescript/module/index.d.ts +2 -1
  344. package/lib/typescript/module/index.d.ts.map +1 -1
  345. package/lib/typescript/module/index.web.d.ts +2 -1
  346. package/lib/typescript/module/index.web.d.ts.map +1 -1
  347. package/lib/typescript/module/menu/index.web.d.ts.map +1 -1
  348. package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
  349. package/lib/typescript/module/portal/index.d.ts.map +1 -1
  350. package/lib/typescript/module/progressive-blur/index.d.ts +23 -0
  351. package/lib/typescript/module/progressive-blur/index.d.ts.map +1 -0
  352. package/lib/typescript/module/progressive-blur/index.web.d.ts +30 -0
  353. package/lib/typescript/module/progressive-blur/index.web.d.ts.map +1 -0
  354. package/lib/typescript/module/progressive-blur/shared.d.ts +35 -0
  355. package/lib/typescript/module/progressive-blur/shared.d.ts.map +1 -0
  356. package/lib/typescript/module/progressive-blur/types.d.ts +21 -0
  357. package/lib/typescript/module/progressive-blur/types.d.ts.map +1 -0
  358. package/lib/typescript/module/select/index.web.d.ts.map +1 -1
  359. package/lib/typescript/module/styles/web-view-style.d.ts +21 -0
  360. package/lib/typescript/module/styles/web-view-style.d.ts.map +1 -0
  361. package/lib/typescript/module/tab-bar/TabBarBase.d.ts +36 -0
  362. package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -0
  363. package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
  364. package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
  365. package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
  366. package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
  367. package/lib/typescript/module/tab-bar/expo-router/index.d.ts +14 -0
  368. package/lib/typescript/module/tab-bar/expo-router/index.d.ts.map +1 -0
  369. package/lib/typescript/module/tab-bar/glyph.d.ts +6 -0
  370. package/lib/typescript/module/tab-bar/glyph.d.ts.map +1 -0
  371. package/lib/typescript/module/tab-bar/glyph.native.d.ts +6 -0
  372. package/lib/typescript/module/tab-bar/glyph.native.d.ts.map +1 -0
  373. package/lib/typescript/module/tab-bar/index.d.ts +12 -0
  374. package/lib/typescript/module/tab-bar/index.d.ts.map +1 -0
  375. package/lib/typescript/module/tab-bar/index.web.d.ts +12 -0
  376. package/lib/typescript/module/tab-bar/index.web.d.ts.map +1 -0
  377. package/lib/typescript/module/tab-bar/minimize-context.d.ts +51 -0
  378. package/lib/typescript/module/tab-bar/minimize-context.d.ts.map +1 -0
  379. package/lib/typescript/module/tab-bar/shared.d.ts +93 -0
  380. package/lib/typescript/module/tab-bar/shared.d.ts.map +1 -0
  381. package/lib/typescript/module/tab-bar/surface-solid.d.ts +6 -0
  382. package/lib/typescript/module/tab-bar/surface-solid.d.ts.map +1 -0
  383. package/lib/typescript/module/tab-bar/surface.d.ts +29 -0
  384. package/lib/typescript/module/tab-bar/surface.d.ts.map +1 -0
  385. package/lib/typescript/module/tab-bar/surface.native.d.ts +6 -0
  386. package/lib/typescript/module/tab-bar/surface.native.d.ts.map +1 -0
  387. package/lib/typescript/module/tab-bar/surface.web.d.ts +6 -0
  388. package/lib/typescript/module/tab-bar/surface.web.d.ts.map +1 -0
  389. package/lib/typescript/module/tab-bar/types.d.ts +88 -0
  390. package/lib/typescript/module/tab-bar/types.d.ts.map +1 -0
  391. package/lib/typescript/module/toast/Positioner.d.ts +21 -0
  392. package/lib/typescript/module/toast/Positioner.d.ts.map +1 -0
  393. package/lib/typescript/module/toast/ToastContent.d.ts +14 -0
  394. package/lib/typescript/module/toast/ToastContent.d.ts.map +1 -0
  395. package/lib/typescript/module/toast/ToastHost.d.ts +6 -0
  396. package/lib/typescript/module/toast/ToastHost.d.ts.map +1 -0
  397. package/lib/typescript/module/toast/ToastHost.native.d.ts +6 -0
  398. package/lib/typescript/module/toast/ToastHost.native.d.ts.map +1 -0
  399. package/lib/typescript/module/toast/ToastIcon.d.ts +9 -0
  400. package/lib/typescript/module/toast/ToastIcon.d.ts.map +1 -0
  401. package/lib/typescript/module/toast/ToastRow.d.ts +80 -0
  402. package/lib/typescript/module/toast/ToastRow.d.ts.map +1 -0
  403. package/lib/typescript/module/toast/ToastSwipeHandler.d.ts +30 -0
  404. package/lib/typescript/module/toast/ToastSwipeHandler.d.ts.map +1 -0
  405. package/lib/typescript/module/toast/Toaster.d.ts +19 -0
  406. package/lib/typescript/module/toast/Toaster.d.ts.map +1 -0
  407. package/lib/typescript/module/toast/animations.d.ts +62 -0
  408. package/lib/typescript/module/toast/animations.d.ts.map +1 -0
  409. package/lib/typescript/module/toast/constants.d.ts +39 -0
  410. package/lib/typescript/module/toast/constants.d.ts.map +1 -0
  411. package/lib/typescript/module/toast/context.d.ts +19 -0
  412. package/lib/typescript/module/toast/context.d.ts.map +1 -0
  413. package/lib/typescript/module/toast/index.d.ts +23 -76
  414. package/lib/typescript/module/toast/index.d.ts.map +1 -1
  415. package/lib/typescript/module/toast/position-utils.d.ts +30 -0
  416. package/lib/typescript/module/toast/position-utils.d.ts.map +1 -0
  417. package/lib/typescript/module/toast/positioner-utils.d.ts +72 -0
  418. package/lib/typescript/module/toast/positioner-utils.d.ts.map +1 -0
  419. package/lib/typescript/module/toast/toast-comparator.d.ts +12 -0
  420. package/lib/typescript/module/toast/toast-comparator.d.ts.map +1 -0
  421. package/lib/typescript/module/toast/toast-fns.d.ts +3 -0
  422. package/lib/typescript/module/toast/toast-fns.d.ts.map +1 -0
  423. package/lib/typescript/module/toast/toast-store.d.ts +52 -0
  424. package/lib/typescript/module/toast/toast-store.d.ts.map +1 -0
  425. package/lib/typescript/module/toast/toast-timers.d.ts +24 -0
  426. package/lib/typescript/module/toast/toast-timers.d.ts.map +1 -0
  427. package/lib/typescript/module/toast/types.d.ts +222 -5
  428. package/lib/typescript/module/toast/types.d.ts.map +1 -1
  429. package/lib/typescript/module/toast/use-animated-target.d.ts +7 -0
  430. package/lib/typescript/module/toast/use-animated-target.d.ts.map +1 -0
  431. package/lib/typescript/module/toast/use-app-state.d.ts +18 -0
  432. package/lib/typescript/module/toast/use-app-state.d.ts.map +1 -0
  433. package/lib/typescript/module/toast/use-toast-colors.d.ts +22 -0
  434. package/lib/typescript/module/toast/use-toast-colors.d.ts.map +1 -0
  435. package/lib/typescript/module/toast/use-toast-position.d.ts +37 -0
  436. package/lib/typescript/module/toast/use-toast-position.d.ts.map +1 -0
  437. package/lib/typescript/module/tooltip/index.web.d.ts.map +1 -1
  438. package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
  439. package/package.json +58 -26
  440. package/src/__tests__/TabBar.test.tsx +342 -0
  441. package/src/__tests__/TabBarGlassFallback.test.tsx +234 -0
  442. package/src/__tests__/TabBarReanimatedDeps.test.ts +130 -0
  443. package/src/__tests__/TabBarWebFork.test.ts +243 -0
  444. package/src/__tests__/ToastContent.test.tsx +192 -0
  445. package/src/__tests__/ToastHostWebFork.test.ts +155 -0
  446. package/src/__tests__/Toaster.test.tsx +527 -0
  447. package/src/__tests__/animated-style-deps.test.ts +156 -0
  448. package/src/__tests__/icon-references.test.ts +243 -0
  449. package/src/__tests__/toast-animations.test.ts +98 -0
  450. package/src/__tests__/toast-comparator.test.ts +131 -0
  451. package/src/__tests__/toast-enter-driver.test.ts +147 -0
  452. package/src/__tests__/toast-fns.test.ts +240 -0
  453. package/src/__tests__/toast-position-utils.test.ts +259 -0
  454. package/src/__tests__/toast-positioner-utils.test.ts +214 -0
  455. package/src/__tests__/toast-store.test.ts +622 -0
  456. package/src/__tests__/toast-timers.test.ts +163 -0
  457. package/src/__tests__/use-animated-target.test.tsx +60 -0
  458. package/src/__tests__/use-app-state.test.tsx +127 -0
  459. package/src/__tests__/use-toast-colors.test.tsx +189 -0
  460. package/src/__tests__/web-position-fixed.test.ts +70 -0
  461. package/src/avatar-group/AvatarGroup.web.tsx +2 -1
  462. package/src/benefit-list/types.ts +2 -1
  463. package/src/bottom-sheet/index.web.tsx +3 -2
  464. package/src/context-menu/index.web.tsx +3 -2
  465. package/src/dialog/Dialog.web.tsx +4 -3
  466. package/src/fab/types.ts +4 -2
  467. package/src/frosted-icon-button/shared.ts +1 -1
  468. package/src/frosted-icon-button/types.ts +2 -1
  469. package/src/index.ts +4 -1
  470. package/src/index.web.ts +4 -1
  471. package/src/menu/index.web.tsx +2 -1
  472. package/src/popover/index.web.tsx +3 -2
  473. package/src/portal/index.tsx +4 -1
  474. package/src/progressive-blur/index.tsx +78 -0
  475. package/src/progressive-blur/index.web.tsx +65 -0
  476. package/src/progressive-blur/shared.ts +81 -0
  477. package/src/progressive-blur/types.ts +21 -0
  478. package/src/select/index.web.tsx +2 -1
  479. package/src/styles/web-view-style.ts +21 -0
  480. package/src/tab-bar/TabBar.stories.tsx +217 -0
  481. package/src/tab-bar/TabBarBase.tsx +517 -0
  482. package/src/tab-bar/expo-router/RouterTabBar.tsx +80 -0
  483. package/src/tab-bar/expo-router/fading-tab-screen.tsx +109 -0
  484. package/src/tab-bar/expo-router/index.ts +13 -0
  485. package/src/tab-bar/glyph.native.tsx +46 -0
  486. package/src/tab-bar/glyph.tsx +31 -0
  487. package/src/tab-bar/index.ts +32 -0
  488. package/src/tab-bar/index.web.tsx +34 -0
  489. package/src/tab-bar/minimize-context.tsx +117 -0
  490. package/src/tab-bar/shared.ts +159 -0
  491. package/src/tab-bar/surface-solid.tsx +40 -0
  492. package/src/tab-bar/surface.native.tsx +122 -0
  493. package/src/tab-bar/surface.tsx +28 -0
  494. package/src/tab-bar/surface.web.tsx +56 -0
  495. package/src/tab-bar/types.ts +91 -0
  496. package/src/toast/Positioner.tsx +121 -0
  497. package/src/toast/Toast.stories.tsx +292 -65
  498. package/src/toast/ToastContent.tsx +405 -0
  499. package/src/toast/ToastHost.native.tsx +31 -0
  500. package/src/toast/ToastHost.tsx +67 -0
  501. package/src/toast/ToastIcon.tsx +55 -0
  502. package/src/toast/ToastRow.tsx +485 -0
  503. package/src/toast/ToastSwipeHandler.tsx +222 -0
  504. package/src/toast/Toaster.tsx +259 -0
  505. package/src/toast/animations.ts +313 -0
  506. package/src/toast/constants.ts +76 -0
  507. package/src/toast/context.tsx +44 -0
  508. package/src/toast/index.tsx +47 -123
  509. package/src/toast/position-utils.ts +149 -0
  510. package/src/toast/positioner-utils.ts +142 -0
  511. package/src/toast/toast-comparator.ts +41 -0
  512. package/src/toast/toast-fns.ts +104 -0
  513. package/src/toast/toast-store.ts +432 -0
  514. package/src/toast/toast-timers.ts +124 -0
  515. package/src/toast/types.ts +301 -5
  516. package/src/toast/use-animated-target.ts +61 -0
  517. package/src/toast/use-app-state.ts +77 -0
  518. package/src/toast/use-toast-colors.ts +133 -0
  519. package/src/toast/use-toast-position.ts +46 -0
  520. package/src/tooltip/index.web.tsx +2 -1
  521. package/src/zoomable-image-gallery/ZoomableImageGallery.stories.tsx +134 -0
  522. package/src/zoomable-image-gallery/ZoomableImageGallery.tsx +50 -27
  523. package/lib/commonjs/toast/Toast.js +0 -267
  524. package/lib/commonjs/toast/Toast.js.map +0 -1
  525. package/lib/commonjs/toast/const.js +0 -8
  526. package/lib/commonjs/toast/const.js.map +0 -1
  527. package/lib/commonjs/toast/index.web.js +0 -114
  528. package/lib/commonjs/toast/index.web.js.map +0 -1
  529. package/lib/commonjs/toast/sonner/index.js +0 -9
  530. package/lib/commonjs/toast/sonner/index.js.map +0 -1
  531. package/lib/commonjs/toast/sonner/index.web.js +0 -9
  532. package/lib/commonjs/toast/sonner/index.web.js.map +0 -1
  533. package/lib/module/toast/Toast.js +0 -258
  534. package/lib/module/toast/Toast.js.map +0 -1
  535. package/lib/module/toast/const.js +0 -4
  536. package/lib/module/toast/const.js.map +0 -1
  537. package/lib/module/toast/index.web.js +0 -74
  538. package/lib/module/toast/index.web.js.map +0 -1
  539. package/lib/module/toast/sonner/index.js +0 -5
  540. package/lib/module/toast/sonner/index.js.map +0 -1
  541. package/lib/module/toast/sonner/index.web.js +0 -5
  542. package/lib/module/toast/sonner/index.web.js.map +0 -1
  543. package/lib/typescript/commonjs/toast/Toast.d.ts +0 -23
  544. package/lib/typescript/commonjs/toast/Toast.d.ts.map +0 -1
  545. package/lib/typescript/commonjs/toast/const.d.ts +0 -2
  546. package/lib/typescript/commonjs/toast/const.d.ts.map +0 -1
  547. package/lib/typescript/commonjs/toast/index.web.d.ts +0 -29
  548. package/lib/typescript/commonjs/toast/index.web.d.ts.map +0 -1
  549. package/lib/typescript/commonjs/toast/sonner/index.d.ts +0 -2
  550. package/lib/typescript/commonjs/toast/sonner/index.d.ts.map +0 -1
  551. package/lib/typescript/commonjs/toast/sonner/index.web.d.ts +0 -2
  552. package/lib/typescript/commonjs/toast/sonner/index.web.d.ts.map +0 -1
  553. package/lib/typescript/module/toast/Toast.d.ts +0 -23
  554. package/lib/typescript/module/toast/Toast.d.ts.map +0 -1
  555. package/lib/typescript/module/toast/const.d.ts +0 -2
  556. package/lib/typescript/module/toast/const.d.ts.map +0 -1
  557. package/lib/typescript/module/toast/index.web.d.ts +0 -29
  558. package/lib/typescript/module/toast/index.web.d.ts.map +0 -1
  559. package/lib/typescript/module/toast/sonner/index.d.ts +0 -2
  560. package/lib/typescript/module/toast/sonner/index.d.ts.map +0 -1
  561. package/lib/typescript/module/toast/sonner/index.web.d.ts +0 -2
  562. package/lib/typescript/module/toast/sonner/index.web.d.ts.map +0 -1
  563. package/src/toast/Toast.tsx +0 -269
  564. package/src/toast/const.ts +0 -1
  565. package/src/toast/index.web.tsx +0 -101
  566. package/src/toast/sonner/index.ts +0 -3
  567. package/src/toast/sonner/index.web.ts +0 -3
@@ -0,0 +1,352 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toastStore = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _constants = require("./constants.js");
9
+ var _toastComparator = require("./toast-comparator.js");
10
+ var _toastTimers = require("./toast-timers.js");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /**
13
+ * Derived from sonner-native v0.26.4 — src/toast-store.ts
14
+ * (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
15
+ *
16
+ * The auto-close timers were lifted out into `toast-timers.ts`. Everything this
17
+ * module touches is pure JavaScript — `react` (for `createRef`), `./constants`,
18
+ * `./toast-comparator`, `./toast-timers` and type-only `./types`. Keep it that
19
+ * way: nothing here may reach React Native or Reanimated, or the store stops
20
+ * being testable without a platform.
21
+ */
22
+
23
+ /** How long the collapse gesture stays latched, so the same tap cannot re-expand. */
24
+ const COLLAPSE_COOLDOWN = 100;
25
+ class ToastStore {
26
+ state = {
27
+ toasts: [],
28
+ toastsById: new Map(),
29
+ toastsCounter: 1,
30
+ toastRefs: {},
31
+ shouldShowOverlay: false,
32
+ toastHeights: {},
33
+ isExpanded: false
34
+ };
35
+ subscribers = new Set();
36
+ config = {};
37
+ timers = new _toastTimers.ToastTimerRegistry();
38
+ hideOverlayTimeout = null;
39
+ pendingPromises = new Set();
40
+ collapseCooldown = false;
41
+ collapseCooldownTimeout = null;
42
+ subscribe = callback => {
43
+ this.subscribers.add(callback);
44
+ return () => {
45
+ this.subscribers.delete(callback);
46
+ };
47
+ };
48
+
49
+ /** Stable while nothing has changed — safe as a `useSyncExternalStore` snapshot. */
50
+ getSnapshot = () => {
51
+ return this.state;
52
+ };
53
+ setConfig = config => {
54
+ this.config = config;
55
+ };
56
+ notify = () => {
57
+ this.subscribers.forEach(callback => callback());
58
+ };
59
+ cloneIndex = () => {
60
+ return new Map(this.state.toastsById);
61
+ };
62
+ resolveDuration = duration => {
63
+ return duration ?? this.config.duration ?? _constants.toastDefaults.duration;
64
+ };
65
+ scheduleAutoClose = (id, duration) => {
66
+ this.timers.start({
67
+ id,
68
+ duration,
69
+ onComplete: () => {
70
+ this.dismissToast(id, 'onAutoClose');
71
+ }
72
+ });
73
+ };
74
+ pauseTimer = id => {
75
+ this.timers.pause(id);
76
+ };
77
+ resumeTimer = id => {
78
+ this.timers.resume(id);
79
+ };
80
+ pauseAllTimers = () => {
81
+ this.timers.pauseAll();
82
+ };
83
+ resumeAllTimers = () => {
84
+ this.timers.resumeAll();
85
+ };
86
+ handlePromise = async toast => {
87
+ const {
88
+ id,
89
+ promiseOptions
90
+ } = toast;
91
+ if (!promiseOptions || this.pendingPromises.has(id)) {
92
+ return;
93
+ }
94
+ this.pendingPromises.add(id);
95
+ try {
96
+ // Already the success title — see `PromiseOptions`.
97
+ const title = await promiseOptions.promise;
98
+ if (!this.state.toastsById.has(id)) return;
99
+ this.addToast({
100
+ title,
101
+ id,
102
+ variant: 'success',
103
+ promiseOptions: undefined,
104
+ duration: toast.duration,
105
+ styles: promiseOptions.styles?.success
106
+ });
107
+ } catch (error) {
108
+ if (!this.state.toastsById.has(id)) return;
109
+ this.addToast({
110
+ title: typeof promiseOptions.error === 'function' ? promiseOptions.error(error) : promiseOptions.error,
111
+ id,
112
+ variant: 'error',
113
+ promiseOptions: undefined,
114
+ duration: toast.duration,
115
+ styles: promiseOptions.styles?.error
116
+ });
117
+ } finally {
118
+ this.pendingPromises.delete(id);
119
+ }
120
+ };
121
+ addToast = options => {
122
+ const providedId = typeof options.id === 'number' || typeof options.id === 'string' && options.id.length > 0 ? options.id : undefined;
123
+ const id = providedId ?? this.state.toastsCounter;
124
+ const nextCounter = providedId === undefined ? this.state.toastsCounter + 1 : this.state.toastsCounter;
125
+ const duration = this.resolveDuration(options.duration);
126
+ const newToast = {
127
+ ...options,
128
+ id,
129
+ variant: options.variant ?? _constants.toastDefaults.variant,
130
+ duration,
131
+ // Assigned by the Toaster at render time from the live position group.
132
+ numberOfToasts: 0,
133
+ index: 0,
134
+ orderedToastIds: []
135
+ };
136
+ const existingToast = this.state.toastsById.get(id);
137
+ if (existingToast && providedId !== undefined) {
138
+ const shouldWiggle = this.config.autoWiggleOnUpdate === 'always' || this.config.autoWiggleOnUpdate === 'toast-change' && !(0, _toastComparator.areToastsEqual)(newToast, existingToast);
139
+ if (shouldWiggle) {
140
+ this.wiggleToast(providedId);
141
+ }
142
+ const updatedToasts = this.state.toasts.map(currentToast => currentToast.id === providedId ? {
143
+ ...currentToast,
144
+ ...newToast
145
+ } : currentToast);
146
+
147
+ // The update may have changed the duration, so the timer restarts.
148
+ if (!newToast.promiseOptions) {
149
+ this.scheduleAutoClose(id, duration);
150
+ }
151
+ const updatedIndex = this.cloneIndex();
152
+ const updatedEntry = updatedToasts.find(t => t.id === providedId);
153
+ if (updatedEntry) {
154
+ updatedIndex.set(providedId, updatedEntry);
155
+ }
156
+ this.state = {
157
+ ...this.state,
158
+ toasts: updatedToasts,
159
+ toastsById: updatedIndex,
160
+ shouldShowOverlay: true
161
+ };
162
+ } else {
163
+ const newToasts = [...this.state.toasts, newToast];
164
+ const newToastRefs = {
165
+ ...this.state.toastRefs
166
+ };
167
+ if (!(id in newToastRefs)) {
168
+ newToastRefs[id] = /*#__PURE__*/React.createRef();
169
+ }
170
+ const visibleToasts = this.config.visibleToasts ?? _constants.toastDefaults.visibleToasts;
171
+ const newIndex = this.cloneIndex();
172
+ newIndex.set(id, newToast);
173
+ const updatedHeights = {
174
+ ...this.state.toastHeights
175
+ };
176
+ let heightsChanged = false;
177
+ if (newToasts.length > visibleToasts) {
178
+ const removedToast = newToasts.shift();
179
+ if (removedToast) {
180
+ this.timers.clear(removedToast.id);
181
+ newIndex.delete(removedToast.id);
182
+ delete newToastRefs[removedToast.id];
183
+ if (removedToast.id in updatedHeights) {
184
+ delete updatedHeights[removedToast.id];
185
+ heightsChanged = true;
186
+ }
187
+ }
188
+ }
189
+ this.state = {
190
+ ...this.state,
191
+ toasts: newToasts,
192
+ toastsById: newIndex,
193
+ toastRefs: newToastRefs,
194
+ toastHeights: heightsChanged ? updatedHeights : this.state.toastHeights,
195
+ toastsCounter: nextCounter,
196
+ shouldShowOverlay: true
197
+ };
198
+ if (newToast.promiseOptions) {
199
+ // A promise toast has no auto-close timer until it settles.
200
+ void this.handlePromise(newToast);
201
+ } else {
202
+ this.scheduleAutoClose(id, duration);
203
+ }
204
+ }
205
+ if (this.hideOverlayTimeout) {
206
+ clearTimeout(this.hideOverlayTimeout);
207
+ this.hideOverlayTimeout = null;
208
+ }
209
+ this.notify();
210
+ return id;
211
+ };
212
+
213
+ /** Omit `id` to dismiss every toast. */
214
+ dismissToast = (id, origin) => {
215
+ if (id == null) {
216
+ this.timers.clearAll();
217
+ this.state.toasts.forEach(currentToast => {
218
+ if (origin === 'onDismiss') {
219
+ currentToast.onDismiss?.(currentToast.id);
220
+ } else {
221
+ currentToast.onAutoClose?.(currentToast.id);
222
+ }
223
+ });
224
+ this.state = {
225
+ ...this.state,
226
+ toasts: [],
227
+ toastsById: new Map(),
228
+ toastsCounter: 1,
229
+ toastRefs: {},
230
+ toastHeights: {},
231
+ isExpanded: false
232
+ };
233
+ this.scheduleHideOverlay();
234
+ this.notify();
235
+ return undefined;
236
+ }
237
+ this.timers.clear(id);
238
+ const toastForCallback = this.state.toastsById.get(id);
239
+ const filteredToasts = this.state.toasts.filter(currentToast => currentToast.id !== id);
240
+ const updatedHeights = {
241
+ ...this.state.toastHeights
242
+ };
243
+ delete updatedHeights[id];
244
+ const updatedRefs = {
245
+ ...this.state.toastRefs
246
+ };
247
+ delete updatedRefs[id];
248
+ const shouldAutoCollapse = filteredToasts.length <= 1 && this.state.isExpanded;
249
+ const updatedIndex = this.cloneIndex();
250
+ updatedIndex.delete(id);
251
+ this.state = {
252
+ ...this.state,
253
+ toasts: filteredToasts,
254
+ toastsById: updatedIndex,
255
+ toastRefs: updatedRefs,
256
+ toastHeights: updatedHeights,
257
+ isExpanded: shouldAutoCollapse ? false : this.state.isExpanded
258
+ };
259
+ if (shouldAutoCollapse) {
260
+ this.timers.resumeAll();
261
+ }
262
+ if (origin === 'onDismiss') {
263
+ toastForCallback?.onDismiss?.(id);
264
+ } else {
265
+ toastForCallback?.onAutoClose?.(id);
266
+ }
267
+ if (filteredToasts.length === 0) {
268
+ this.scheduleHideOverlay();
269
+ }
270
+ this.notify();
271
+ return id;
272
+ };
273
+
274
+ /** Keeps the overlay mounted until the last exit animation has finished. */
275
+ scheduleHideOverlay = () => {
276
+ if (this.hideOverlayTimeout) {
277
+ clearTimeout(this.hideOverlayTimeout);
278
+ }
279
+ this.hideOverlayTimeout = setTimeout(() => {
280
+ this.state = {
281
+ ...this.state,
282
+ shouldShowOverlay: false
283
+ };
284
+ this.hideOverlayTimeout = null;
285
+ this.notify();
286
+ }, _constants.ENTERING_ANIMATION_DURATION);
287
+ };
288
+ wiggleToast = id => {
289
+ const toast = this.state.toastsById.get(id);
290
+ if (!toast) {
291
+ return;
292
+ }
293
+ this.state.toastRefs[id]?.current?.wiggle();
294
+
295
+ // A wiggle re-draws attention, so the reading time starts over — except for
296
+ // toasts that never auto-close.
297
+ if (!toast.promiseOptions) {
298
+ this.scheduleAutoClose(id, this.resolveDuration(toast.duration));
299
+ }
300
+ };
301
+ getToastRef = id => {
302
+ return this.state.toastRefs[id];
303
+ };
304
+ setToastHeight = (id, height) => {
305
+ if (this.state.toastHeights[id] === height) return;
306
+ // A NEW object, never an in-place write — see `ToastStoreState.toastHeights`.
307
+ this.state = {
308
+ ...this.state,
309
+ toastHeights: {
310
+ ...this.state.toastHeights,
311
+ [id]: height
312
+ }
313
+ };
314
+ this.notify();
315
+ };
316
+ expand = () => {
317
+ this.state = {
318
+ ...this.state,
319
+ isExpanded: true
320
+ };
321
+ this.timers.pauseAll();
322
+ this.notify();
323
+ };
324
+ collapse = () => {
325
+ this.state = {
326
+ ...this.state,
327
+ isExpanded: false
328
+ };
329
+ this.collapseCooldown = true;
330
+ if (this.collapseCooldownTimeout) {
331
+ clearTimeout(this.collapseCooldownTimeout);
332
+ }
333
+ this.collapseCooldownTimeout = setTimeout(() => {
334
+ this.collapseCooldown = false;
335
+ this.collapseCooldownTimeout = null;
336
+ }, COLLAPSE_COOLDOWN);
337
+ this.timers.resumeAll();
338
+ this.notify();
339
+ };
340
+ toggleExpand = () => {
341
+ if (!this.state.isExpanded && this.collapseCooldown) {
342
+ return;
343
+ }
344
+ if (this.state.isExpanded) {
345
+ this.collapse();
346
+ } else {
347
+ this.expand();
348
+ }
349
+ };
350
+ }
351
+ const toastStore = exports.toastStore = new ToastStore();
352
+ //# sourceMappingURL=toast-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","_interopRequireWildcard","require","_constants","_toastComparator","_toastTimers","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","COLLAPSE_COOLDOWN","ToastStore","state","toasts","toastsById","Map","toastsCounter","toastRefs","shouldShowOverlay","toastHeights","isExpanded","subscribers","Set","config","timers","ToastTimerRegistry","hideOverlayTimeout","pendingPromises","collapseCooldown","collapseCooldownTimeout","subscribe","callback","add","delete","getSnapshot","setConfig","notify","forEach","cloneIndex","resolveDuration","duration","toastDefaults","scheduleAutoClose","id","start","onComplete","dismissToast","pauseTimer","pause","resumeTimer","resume","pauseAllTimers","pauseAll","resumeAllTimers","resumeAll","handlePromise","toast","promiseOptions","title","promise","addToast","variant","undefined","styles","success","error","options","providedId","length","nextCounter","newToast","numberOfToasts","index","orderedToastIds","existingToast","shouldWiggle","autoWiggleOnUpdate","areToastsEqual","wiggleToast","updatedToasts","map","currentToast","updatedIndex","updatedEntry","find","newToasts","newToastRefs","createRef","visibleToasts","newIndex","updatedHeights","heightsChanged","removedToast","shift","clear","clearTimeout","origin","clearAll","onDismiss","onAutoClose","scheduleHideOverlay","toastForCallback","filteredToasts","filter","updatedRefs","shouldAutoCollapse","setTimeout","ENTERING_ANIMATION_DURATION","current","wiggle","getToastRef","setToastHeight","height","expand","collapse","toggleExpand","toastStore","exports"],"sourceRoot":"../../../src","sources":["toast/toast-store.ts"],"mappings":";;;;;;AAUA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAAoD,SAAAD,wBAAAK,CAAA,EAAAC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AAA,CAAAD,UAAA,GAAG,IAAIzG,UAAU,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ToastTimerRegistry = void 0;
7
+ var _constants = require("./constants.js");
8
+ /**
9
+ * Derived from sonner-native v0.26.4 — src/toast-store.ts:78-154
10
+ * (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
11
+ *
12
+ * Upstream keeps auto-close timers inside the store's React state even though no
13
+ * renderer ever reads them. Extracting them keeps the store's snapshot free of
14
+ * mutable side-channel data and makes the timing rules testable on their own.
15
+ */
16
+
17
+ /**
18
+ * A toast resumed after the app came back to the foreground always gets at least
19
+ * this long on screen — whatever was left of its duration when it was paused is
20
+ * usually too short to read on re-entry.
21
+ */
22
+ const MIN_RESUMED_DURATION = 1000;
23
+ class ToastTimerRegistry {
24
+ timers = new Map();
25
+
26
+ /**
27
+ * Non-finite durations (`Infinity`, `NaN`) mean "never auto-close" — starting a
28
+ * timer for them would either be pointless or fire immediately.
29
+ */
30
+ start = ({
31
+ id,
32
+ duration,
33
+ onComplete
34
+ }) => {
35
+ if (!Number.isFinite(duration)) {
36
+ return;
37
+ }
38
+ this.clear(id);
39
+
40
+ // The toast is not fully on screen until the enter animation lands, so the
41
+ // readable duration starts there.
42
+ const timeout = setTimeout(() => {
43
+ this.timers.delete(id);
44
+ onComplete();
45
+ }, _constants.ENTERING_ANIMATION_DURATION + duration);
46
+ this.timers.set(id, {
47
+ timeout,
48
+ startTime: Date.now(),
49
+ remainingTime: duration,
50
+ isPaused: false,
51
+ onComplete
52
+ });
53
+ };
54
+ clear = id => {
55
+ const timer = this.timers.get(id);
56
+ if (!timer) {
57
+ return;
58
+ }
59
+ clearTimeout(timer.timeout);
60
+ this.timers.delete(id);
61
+ };
62
+ clearAll = () => {
63
+ for (const timer of this.timers.values()) {
64
+ clearTimeout(timer.timeout);
65
+ }
66
+ this.timers.clear();
67
+ };
68
+
69
+ /**
70
+ * Banks the time left. The enter animation's head start is intentionally not
71
+ * subtracted, so a paused toast keeps up to `ENTERING_ANIMATION_DURATION` of
72
+ * slack — the same as upstream.
73
+ */
74
+ pause = id => {
75
+ const timer = this.timers.get(id);
76
+ if (!timer || timer.isPaused) {
77
+ return;
78
+ }
79
+ clearTimeout(timer.timeout);
80
+ timer.remainingTime = timer.remainingTime - (Date.now() - timer.startTime);
81
+ timer.isPaused = true;
82
+ };
83
+ resume = id => {
84
+ const timer = this.timers.get(id);
85
+ if (!timer || !timer.isPaused) {
86
+ return;
87
+ }
88
+ const {
89
+ onComplete
90
+ } = timer;
91
+ timer.isPaused = false;
92
+ timer.startTime = Date.now();
93
+ timer.timeout = setTimeout(() => {
94
+ this.timers.delete(id);
95
+ onComplete();
96
+ }, Math.max(timer.remainingTime, MIN_RESUMED_DURATION));
97
+ };
98
+ pauseAll = () => {
99
+ for (const id of [...this.timers.keys()]) {
100
+ this.pause(id);
101
+ }
102
+ };
103
+ resumeAll = () => {
104
+ for (const id of [...this.timers.keys()]) {
105
+ this.resume(id);
106
+ }
107
+ };
108
+ }
109
+ exports.ToastTimerRegistry = ToastTimerRegistry;
110
+ //# sourceMappingURL=toast-timers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_constants","require","MIN_RESUMED_DURATION","ToastTimerRegistry","timers","Map","start","id","duration","onComplete","Number","isFinite","clear","timeout","setTimeout","delete","ENTERING_ANIMATION_DURATION","set","startTime","Date","now","remainingTime","isPaused","timer","get","clearTimeout","clearAll","values","pause","resume","Math","max","pauseAll","keys","resumeAll","exports"],"sourceRoot":"../../../src","sources":["toast/toast-timers.ts"],"mappings":";;;;;;AAQA,IAAAA,UAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAG,IAAI;AAE1B,MAAMC,kBAAkB,CAAC;EACtBC,MAAM,GAAG,IA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B,EAAE,CAAC;IACjB;EACF,CAAC;AACH;AAAC4B,OAAA,CAAAhC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,2 +1,44 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isToastAction = isToastAction;
7
+ /**
8
+ * Derived from sonner-native v0.26.4 — src/types.ts
9
+ * (MIT © Gunnar Torfi Steinarsson), absorbed into Bloom's own toast API.
10
+ * See the top-level NOTICE for full attribution.
11
+ */
12
+
13
+ /**
14
+ * Engine-internal variant. The PUBLIC knob is `ToastOptions['type']`; the single
15
+ * translation between the two lives in `toast-fns.ts`. `undefined` means "no
16
+ * variant" — a plain `toast('Saved')` renders with neutral surface colors.
17
+ */
18
+
19
+ /** Public variant knob. `'default'` maps to an ABSENT `ToastVariant`. */
20
+
21
+ /**
22
+ * Light/dark is owned by `BloomThemeProvider`/`BloomColorScope`, so this is
23
+ * accepted and documented as a no-op rather than dropped from the surface.
24
+ */
25
+
26
+ /**
27
+ * The store's view of a pending promise toast. Non-generic on purpose: `promise`
28
+ * already resolves to the SUCCESS TITLE because `toast.promise` maps the caller's
29
+ * promise through their `success` formatter at the boundary. That is what lets
30
+ * the store await it without casting an `unknown` result back to the caller's
31
+ * type (upstream keeps `success` here and casts).
32
+ */
33
+
34
+ /** Everything a caller may pass alongside the toast content. */
35
+
36
+ /** The subset of `ToasterProps` the store needs to resolve a new toast. */
37
+
38
+ function isToastAction(action) {
39
+ if (typeof action !== 'object' || action === null) {
40
+ return false;
41
+ }
42
+ return 'label' in action && 'onClick' in action && typeof action.label === 'string' && typeof action.onClick === 'function';
43
+ }
2
44
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["toast/types.ts"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":["isToastAction","action","label","onClick"],"sourceRoot":"../../../src","sources":["toast/types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;;AAGA;;AASA;AACA;AACA;AACA;;AAwCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqDA;;AAqGA;;AAyDO,SAASA,aAAaA,CAC3BC,MAAqC,EACd;EACvB,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACjD,OAAO,KAAK;EACd;EACA,OACE,OAAO,IAAIA,MAAM,IACjB,SAAS,IAAIA,MAAM,IACnB,OAAOA,MAAM,CAACC,KAAK,KAAK,QAAQ,IAChC,OAAOD,MAAM,CAACE,OAAO,KAAK,UAAU;AAExC","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useAnimatedTarget = useAnimatedTarget;
7
+ var _react = require("react");
8
+ var _reactNativeReanimated = require("react-native-reanimated");
9
+ /**
10
+ * Bloom-original — drives a shared value toward a plain-JS target.
11
+ *
12
+ * WHY THIS IS IMPERATIVE, AND MUST STAY THAT WAY.
13
+ *
14
+ * The obvious shape is `useDerivedValue(() => withTiming(target))`, which is what
15
+ * sonner-native does for both the stack offset and the stack scale. Returning an
16
+ * animation from a mapper does not tick on WEB (`~/Oxy/AGENTS.md`, reanimated web
17
+ * failure mode A): the value jumps to or freezes at a static frame, so the stack
18
+ * lands on the right numbers without ever animating. The pattern that works on
19
+ * every platform is to assign the animation from JS — `sv.value = withTiming(…)`
20
+ * — and to let `useAnimatedStyle` only READ shared values.
21
+ *
22
+ * A `useAnimatedReaction` keyed on the target would also fire (without the
23
+ * worklets plugin its inputs come from its own deps array, so keying it on a JS
24
+ * value works where keying it on a shared value would not), but a layout effect
25
+ * needs no reanimated machinery at all to be correct, so it is the smaller bet.
26
+ * It runs before paint, so a target change never shows a stale frame first.
27
+ * Precedent for the imperative drive: `bottom-sheet/BottomSheetBase.tsx`.
28
+ *
29
+ * By default the first render is seeded rather than animated: a row must appear
30
+ * AT its position, not fly in from zero. Pass `from` when the FIRST render is
31
+ * itself the animation — the value is then seeded at `from` and animated to
32
+ * `target` on mount. That is how the enter animation is driven; see the
33
+ * "Bloom owns the enter animation" note in `animations.ts`.
34
+ */
35
+
36
+ function useAnimatedTarget(target, {
37
+ duration,
38
+ easing,
39
+ from
40
+ }) {
41
+ const value = (0, _reactNativeReanimated.useSharedValue)(from ?? target);
42
+ const isSeeded = (0, _react.useRef)(false);
43
+ (0, _react.useLayoutEffect)(() => {
44
+ if (!isSeeded.current) {
45
+ isSeeded.current = true;
46
+ if (from === undefined) {
47
+ return;
48
+ }
49
+ }
50
+ value.value = (0, _reactNativeReanimated.withTiming)(target, {
51
+ duration,
52
+ easing
53
+ });
54
+ }, [target, value, duration, easing, from]);
55
+ return value;
56
+ }
57
+ //# sourceMappingURL=use-animated-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNativeReanimated","useAnimatedTarget","target","duration","easing","from","value","useSharedValue","isSeeded","useRef","useLayoutEffect","current","undefined","withTiming"],"sourceRoot":"../../../src","sources":["toast/use-animated-target.ts"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AA3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASO,SAASE,iBAAiBA,CAC/BC,MAAc,EACd;EACEC,QAAQ;EACRC,MAAM;EACNC;AAKF,CAAC,EACoB;EACrB,MAAMC,KAAK,GAAG,IAAAC,qCAAc,EAACF,IAAI,IAAIH,MAAM,CAAC;EAC5C,MAAMM,QAAQ,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAE9B,IAAAC,sBAAe,EAAC,MAAM;IACpB,IAAI,CAACF,QAAQ,CAACG,OAAO,EAAE;MACrBH,QAAQ,CAACG,OAAO,GAAG,IAAI;MACvB,IAAIN,IAAI,KAAKO,SAAS,EAAE;QACtB;MACF;IACF;IACAN,KAAK,CAACA,KAAK,GAAG,IAAAO,iCAAU,EAACX,MAAM,EAAE;MAAEC,QAAQ;MAAEC;IAAO,CAAC,CAAC;EACxD,CAAC,EAAE,CAACF,MAAM,EAAEI,KAAK,EAAEH,QAAQ,EAAEC,MAAM,EAAEC,IAAI,CAAC,CAAC;EAE3C,OAAOC,KAAK;AACd","ignoreList":[]}