@oxyhq/bloom 0.50.2 → 0.51.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 (536) 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/index.js +90 -83
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/index.web.js +116 -109
  14. package/lib/commonjs/index.web.js.map +1 -1
  15. package/lib/commonjs/menu/index.web.js +2 -1
  16. package/lib/commonjs/menu/index.web.js.map +1 -1
  17. package/lib/commonjs/popover/index.web.js +3 -2
  18. package/lib/commonjs/popover/index.web.js.map +1 -1
  19. package/lib/commonjs/portal/index.js +4 -1
  20. package/lib/commonjs/portal/index.js.map +1 -1
  21. package/lib/commonjs/progressive-blur/index.js +79 -0
  22. package/lib/commonjs/progressive-blur/index.js.map +1 -0
  23. package/lib/commonjs/progressive-blur/index.web.js +67 -0
  24. package/lib/commonjs/progressive-blur/index.web.js.map +1 -0
  25. package/lib/commonjs/progressive-blur/shared.js +66 -0
  26. package/lib/commonjs/progressive-blur/shared.js.map +1 -0
  27. package/lib/commonjs/progressive-blur/types.js +6 -0
  28. package/lib/commonjs/progressive-blur/types.js.map +1 -0
  29. package/lib/commonjs/select/index.web.js +2 -1
  30. package/lib/commonjs/select/index.web.js.map +1 -1
  31. package/lib/commonjs/styles/web-view-style.js +26 -0
  32. package/lib/commonjs/styles/web-view-style.js.map +1 -0
  33. package/lib/commonjs/tab-bar/TabBarBase.js +415 -0
  34. package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -0
  35. package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js +83 -0
  36. package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js.map +1 -0
  37. package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js +119 -0
  38. package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
  39. package/lib/commonjs/tab-bar/expo-router/index.js +26 -0
  40. package/lib/commonjs/tab-bar/expo-router/index.js.map +1 -0
  41. package/lib/commonjs/tab-bar/glyph.js +43 -0
  42. package/lib/commonjs/tab-bar/glyph.js.map +1 -0
  43. package/lib/commonjs/tab-bar/glyph.native.js +55 -0
  44. package/lib/commonjs/tab-bar/glyph.native.js.map +1 -0
  45. package/lib/commonjs/tab-bar/index.js +65 -0
  46. package/lib/commonjs/tab-bar/index.js.map +1 -0
  47. package/lib/commonjs/tab-bar/index.web.js +67 -0
  48. package/lib/commonjs/tab-bar/index.web.js.map +1 -0
  49. package/lib/commonjs/tab-bar/minimize-context.js +127 -0
  50. package/lib/commonjs/tab-bar/minimize-context.js.map +1 -0
  51. package/lib/commonjs/tab-bar/shared.js +139 -0
  52. package/lib/commonjs/tab-bar/shared.js.map +1 -0
  53. package/lib/commonjs/tab-bar/surface.js +50 -0
  54. package/lib/commonjs/tab-bar/surface.js.map +1 -0
  55. package/lib/commonjs/tab-bar/surface.native.js +56 -0
  56. package/lib/commonjs/tab-bar/surface.native.js.map +1 -0
  57. package/lib/commonjs/tab-bar/surface.web.js +59 -0
  58. package/lib/commonjs/tab-bar/surface.web.js.map +1 -0
  59. package/lib/commonjs/tab-bar/types.js +6 -0
  60. package/lib/commonjs/tab-bar/types.js.map +1 -0
  61. package/lib/commonjs/toast/Positioner.js +117 -0
  62. package/lib/commonjs/toast/Positioner.js.map +1 -0
  63. package/lib/commonjs/toast/ToastContent.js +301 -0
  64. package/lib/commonjs/toast/ToastContent.js.map +1 -0
  65. package/lib/commonjs/toast/ToastHost.js +69 -0
  66. package/lib/commonjs/toast/ToastHost.js.map +1 -0
  67. package/lib/commonjs/toast/ToastHost.native.js +44 -0
  68. package/lib/commonjs/toast/ToastHost.native.js.map +1 -0
  69. package/lib/commonjs/toast/ToastIcon.js +57 -0
  70. package/lib/commonjs/toast/ToastIcon.js.map +1 -0
  71. package/lib/commonjs/toast/ToastRow.js +411 -0
  72. package/lib/commonjs/toast/ToastRow.js.map +1 -0
  73. package/lib/commonjs/toast/ToastSwipeHandler.js +189 -0
  74. package/lib/commonjs/toast/ToastSwipeHandler.js.map +1 -0
  75. package/lib/commonjs/toast/Toaster.js +205 -0
  76. package/lib/commonjs/toast/Toaster.js.map +1 -0
  77. package/lib/commonjs/toast/animations.js +274 -0
  78. package/lib/commonjs/toast/animations.js.map +1 -0
  79. package/lib/commonjs/toast/constants.js +56 -0
  80. package/lib/commonjs/toast/constants.js.map +1 -0
  81. package/lib/commonjs/toast/context.js +42 -0
  82. package/lib/commonjs/toast/context.js.map +1 -0
  83. package/lib/commonjs/toast/index.js +32 -126
  84. package/lib/commonjs/toast/index.js.map +1 -1
  85. package/lib/commonjs/toast/position-utils.js +115 -0
  86. package/lib/commonjs/toast/position-utils.js.map +1 -0
  87. package/lib/commonjs/toast/positioner-utils.js +141 -0
  88. package/lib/commonjs/toast/positioner-utils.js.map +1 -0
  89. package/lib/commonjs/toast/toast-comparator.js +28 -0
  90. package/lib/commonjs/toast/toast-comparator.js.map +1 -0
  91. package/lib/commonjs/toast/toast-fns.js +90 -0
  92. package/lib/commonjs/toast/toast-fns.js.map +1 -0
  93. package/lib/commonjs/toast/toast-store.js +352 -0
  94. package/lib/commonjs/toast/toast-store.js.map +1 -0
  95. package/lib/commonjs/toast/toast-timers.js +110 -0
  96. package/lib/commonjs/toast/toast-timers.js.map +1 -0
  97. package/lib/commonjs/toast/types.js +42 -0
  98. package/lib/commonjs/toast/types.js.map +1 -1
  99. package/lib/commonjs/toast/use-animated-target.js +57 -0
  100. package/lib/commonjs/toast/use-animated-target.js.map +1 -0
  101. package/lib/commonjs/toast/use-app-state.js +76 -0
  102. package/lib/commonjs/toast/use-app-state.js.map +1 -0
  103. package/lib/commonjs/toast/use-toast-colors.js +114 -0
  104. package/lib/commonjs/toast/use-toast-colors.js.map +1 -0
  105. package/lib/commonjs/toast/use-toast-position.js +40 -0
  106. package/lib/commonjs/toast/use-toast-position.js.map +1 -0
  107. package/lib/commonjs/tooltip/index.web.js +2 -1
  108. package/lib/commonjs/tooltip/index.web.js.map +1 -1
  109. package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
  110. package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
  111. package/lib/module/avatar-group/AvatarGroup.web.js +2 -1
  112. package/lib/module/avatar-group/AvatarGroup.web.js.map +1 -1
  113. package/lib/module/bottom-sheet/index.web.js +2 -1
  114. package/lib/module/bottom-sheet/index.web.js.map +1 -1
  115. package/lib/module/context-menu/index.web.js +3 -2
  116. package/lib/module/context-menu/index.web.js.map +1 -1
  117. package/lib/module/dialog/Dialog.web.js +4 -3
  118. package/lib/module/dialog/Dialog.web.js.map +1 -1
  119. package/lib/module/index.js +3 -2
  120. package/lib/module/index.js.map +1 -1
  121. package/lib/module/index.web.js +3 -2
  122. package/lib/module/index.web.js.map +1 -1
  123. package/lib/module/menu/index.web.js +2 -1
  124. package/lib/module/menu/index.web.js.map +1 -1
  125. package/lib/module/popover/index.web.js +3 -2
  126. package/lib/module/popover/index.web.js.map +1 -1
  127. package/lib/module/portal/index.js +4 -1
  128. package/lib/module/portal/index.js.map +1 -1
  129. package/lib/module/progressive-blur/index.js +74 -0
  130. package/lib/module/progressive-blur/index.js.map +1 -0
  131. package/lib/module/progressive-blur/index.web.js +62 -0
  132. package/lib/module/progressive-blur/index.web.js.map +1 -0
  133. package/lib/module/progressive-blur/shared.js +60 -0
  134. package/lib/module/progressive-blur/shared.js.map +1 -0
  135. package/lib/module/progressive-blur/types.js +4 -0
  136. package/lib/module/progressive-blur/types.js.map +1 -0
  137. package/lib/module/select/index.web.js +2 -1
  138. package/lib/module/select/index.web.js.map +1 -1
  139. package/lib/module/styles/web-view-style.js +22 -0
  140. package/lib/module/styles/web-view-style.js.map +1 -0
  141. package/lib/module/tab-bar/TabBarBase.js +408 -0
  142. package/lib/module/tab-bar/TabBarBase.js.map +1 -0
  143. package/lib/module/tab-bar/expo-router/RouterTabBar.js +78 -0
  144. package/lib/module/tab-bar/expo-router/RouterTabBar.js.map +1 -0
  145. package/lib/module/tab-bar/expo-router/fading-tab-screen.js +113 -0
  146. package/lib/module/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
  147. package/lib/module/tab-bar/expo-router/index.js +15 -0
  148. package/lib/module/tab-bar/expo-router/index.js.map +1 -0
  149. package/lib/module/tab-bar/glyph.js +38 -0
  150. package/lib/module/tab-bar/glyph.js.map +1 -0
  151. package/lib/module/tab-bar/glyph.native.js +50 -0
  152. package/lib/module/tab-bar/glyph.native.js.map +1 -0
  153. package/lib/module/tab-bar/index.js +24 -0
  154. package/lib/module/tab-bar/index.js.map +1 -0
  155. package/lib/module/tab-bar/index.web.js +26 -0
  156. package/lib/module/tab-bar/index.web.js.map +1 -0
  157. package/lib/module/tab-bar/minimize-context.js +118 -0
  158. package/lib/module/tab-bar/minimize-context.js.map +1 -0
  159. package/lib/module/tab-bar/shared.js +132 -0
  160. package/lib/module/tab-bar/shared.js.map +1 -0
  161. package/lib/module/tab-bar/surface.js +44 -0
  162. package/lib/module/tab-bar/surface.js.map +1 -0
  163. package/lib/module/tab-bar/surface.native.js +50 -0
  164. package/lib/module/tab-bar/surface.native.js.map +1 -0
  165. package/lib/module/tab-bar/surface.web.js +53 -0
  166. package/lib/module/tab-bar/surface.web.js.map +1 -0
  167. package/lib/module/tab-bar/types.js +4 -0
  168. package/lib/module/tab-bar/types.js.map +1 -0
  169. package/lib/module/toast/Positioner.js +110 -0
  170. package/lib/module/toast/Positioner.js.map +1 -0
  171. package/lib/module/toast/ToastContent.js +295 -0
  172. package/lib/module/toast/ToastContent.js.map +1 -0
  173. package/lib/module/toast/ToastHost.js +63 -0
  174. package/lib/module/toast/ToastHost.js.map +1 -0
  175. package/lib/module/toast/ToastHost.native.js +38 -0
  176. package/lib/module/toast/ToastHost.native.js.map +1 -0
  177. package/lib/module/toast/ToastIcon.js +52 -0
  178. package/lib/module/toast/ToastIcon.js.map +1 -0
  179. package/lib/module/toast/ToastRow.js +407 -0
  180. package/lib/module/toast/ToastRow.js.map +1 -0
  181. package/lib/module/toast/ToastSwipeHandler.js +182 -0
  182. package/lib/module/toast/ToastSwipeHandler.js.map +1 -0
  183. package/lib/module/toast/Toaster.js +198 -0
  184. package/lib/module/toast/Toaster.js.map +1 -0
  185. package/lib/module/toast/animations.js +261 -0
  186. package/lib/module/toast/animations.js.map +1 -0
  187. package/lib/module/toast/constants.js +52 -0
  188. package/lib/module/toast/constants.js.map +1 -0
  189. package/lib/module/toast/context.js +34 -0
  190. package/lib/module/toast/context.js.map +1 -0
  191. package/lib/module/toast/index.js +27 -103
  192. package/lib/module/toast/index.js.map +1 -1
  193. package/lib/module/toast/position-utils.js +107 -0
  194. package/lib/module/toast/position-utils.js.map +1 -0
  195. package/lib/module/toast/positioner-utils.js +134 -0
  196. package/lib/module/toast/positioner-utils.js.map +1 -0
  197. package/lib/module/toast/toast-comparator.js +22 -0
  198. package/lib/module/toast/toast-comparator.js.map +1 -0
  199. package/lib/module/toast/toast-fns.js +85 -0
  200. package/lib/module/toast/toast-fns.js.map +1 -0
  201. package/lib/module/toast/toast-store.js +346 -0
  202. package/lib/module/toast/toast-store.js.map +1 -0
  203. package/lib/module/toast/toast-timers.js +104 -0
  204. package/lib/module/toast/toast-timers.js.map +1 -0
  205. package/lib/module/toast/types.js +38 -0
  206. package/lib/module/toast/types.js.map +1 -1
  207. package/lib/module/toast/use-animated-target.js +52 -0
  208. package/lib/module/toast/use-animated-target.js.map +1 -0
  209. package/lib/module/toast/use-app-state.js +70 -0
  210. package/lib/module/toast/use-app-state.js.map +1 -0
  211. package/lib/module/toast/use-toast-colors.js +109 -0
  212. package/lib/module/toast/use-toast-colors.js.map +1 -0
  213. package/lib/module/toast/use-toast-position.js +35 -0
  214. package/lib/module/toast/use-toast-position.js.map +1 -0
  215. package/lib/module/tooltip/index.web.js +2 -1
  216. package/lib/module/tooltip/index.web.js.map +1 -1
  217. package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
  218. package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
  219. package/lib/typescript/commonjs/avatar-group/AvatarGroup.web.d.ts.map +1 -1
  220. package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts.map +1 -1
  221. package/lib/typescript/commonjs/context-menu/index.web.d.ts.map +1 -1
  222. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  223. package/lib/typescript/commonjs/index.d.ts +2 -1
  224. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  225. package/lib/typescript/commonjs/index.web.d.ts +2 -1
  226. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  227. package/lib/typescript/commonjs/menu/index.web.d.ts.map +1 -1
  228. package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
  229. package/lib/typescript/commonjs/portal/index.d.ts.map +1 -1
  230. package/lib/typescript/commonjs/progressive-blur/index.d.ts +23 -0
  231. package/lib/typescript/commonjs/progressive-blur/index.d.ts.map +1 -0
  232. package/lib/typescript/commonjs/progressive-blur/index.web.d.ts +30 -0
  233. package/lib/typescript/commonjs/progressive-blur/index.web.d.ts.map +1 -0
  234. package/lib/typescript/commonjs/progressive-blur/shared.d.ts +35 -0
  235. package/lib/typescript/commonjs/progressive-blur/shared.d.ts.map +1 -0
  236. package/lib/typescript/commonjs/progressive-blur/types.d.ts +21 -0
  237. package/lib/typescript/commonjs/progressive-blur/types.d.ts.map +1 -0
  238. package/lib/typescript/commonjs/select/index.web.d.ts.map +1 -1
  239. package/lib/typescript/commonjs/styles/web-view-style.d.ts +21 -0
  240. package/lib/typescript/commonjs/styles/web-view-style.d.ts.map +1 -0
  241. package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts +36 -0
  242. package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -0
  243. package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
  244. package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
  245. package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
  246. package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
  247. package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts +14 -0
  248. package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts.map +1 -0
  249. package/lib/typescript/commonjs/tab-bar/glyph.d.ts +6 -0
  250. package/lib/typescript/commonjs/tab-bar/glyph.d.ts.map +1 -0
  251. package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts +6 -0
  252. package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts.map +1 -0
  253. package/lib/typescript/commonjs/tab-bar/index.d.ts +12 -0
  254. package/lib/typescript/commonjs/tab-bar/index.d.ts.map +1 -0
  255. package/lib/typescript/commonjs/tab-bar/index.web.d.ts +12 -0
  256. package/lib/typescript/commonjs/tab-bar/index.web.d.ts.map +1 -0
  257. package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts +51 -0
  258. package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts.map +1 -0
  259. package/lib/typescript/commonjs/tab-bar/shared.d.ts +93 -0
  260. package/lib/typescript/commonjs/tab-bar/shared.d.ts.map +1 -0
  261. package/lib/typescript/commonjs/tab-bar/surface.d.ts +6 -0
  262. package/lib/typescript/commonjs/tab-bar/surface.d.ts.map +1 -0
  263. package/lib/typescript/commonjs/tab-bar/surface.native.d.ts +6 -0
  264. package/lib/typescript/commonjs/tab-bar/surface.native.d.ts.map +1 -0
  265. package/lib/typescript/commonjs/tab-bar/surface.web.d.ts +6 -0
  266. package/lib/typescript/commonjs/tab-bar/surface.web.d.ts.map +1 -0
  267. package/lib/typescript/commonjs/tab-bar/types.d.ts +85 -0
  268. package/lib/typescript/commonjs/tab-bar/types.d.ts.map +1 -0
  269. package/lib/typescript/commonjs/toast/Positioner.d.ts +21 -0
  270. package/lib/typescript/commonjs/toast/Positioner.d.ts.map +1 -0
  271. package/lib/typescript/commonjs/toast/ToastContent.d.ts +14 -0
  272. package/lib/typescript/commonjs/toast/ToastContent.d.ts.map +1 -0
  273. package/lib/typescript/commonjs/toast/ToastHost.d.ts +6 -0
  274. package/lib/typescript/commonjs/toast/ToastHost.d.ts.map +1 -0
  275. package/lib/typescript/commonjs/toast/ToastHost.native.d.ts +6 -0
  276. package/lib/typescript/commonjs/toast/ToastHost.native.d.ts.map +1 -0
  277. package/lib/typescript/commonjs/toast/ToastIcon.d.ts +9 -0
  278. package/lib/typescript/commonjs/toast/ToastIcon.d.ts.map +1 -0
  279. package/lib/typescript/commonjs/toast/ToastRow.d.ts +80 -0
  280. package/lib/typescript/commonjs/toast/ToastRow.d.ts.map +1 -0
  281. package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts +30 -0
  282. package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts.map +1 -0
  283. package/lib/typescript/commonjs/toast/Toaster.d.ts +19 -0
  284. package/lib/typescript/commonjs/toast/Toaster.d.ts.map +1 -0
  285. package/lib/typescript/commonjs/toast/animations.d.ts +62 -0
  286. package/lib/typescript/commonjs/toast/animations.d.ts.map +1 -0
  287. package/lib/typescript/commonjs/toast/constants.d.ts +39 -0
  288. package/lib/typescript/commonjs/toast/constants.d.ts.map +1 -0
  289. package/lib/typescript/commonjs/toast/context.d.ts +19 -0
  290. package/lib/typescript/commonjs/toast/context.d.ts.map +1 -0
  291. package/lib/typescript/commonjs/toast/index.d.ts +23 -76
  292. package/lib/typescript/commonjs/toast/index.d.ts.map +1 -1
  293. package/lib/typescript/commonjs/toast/position-utils.d.ts +30 -0
  294. package/lib/typescript/commonjs/toast/position-utils.d.ts.map +1 -0
  295. package/lib/typescript/commonjs/toast/positioner-utils.d.ts +72 -0
  296. package/lib/typescript/commonjs/toast/positioner-utils.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/toast/toast-comparator.d.ts +12 -0
  298. package/lib/typescript/commonjs/toast/toast-comparator.d.ts.map +1 -0
  299. package/lib/typescript/commonjs/toast/toast-fns.d.ts +3 -0
  300. package/lib/typescript/commonjs/toast/toast-fns.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/toast/toast-store.d.ts +52 -0
  302. package/lib/typescript/commonjs/toast/toast-store.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/toast/toast-timers.d.ts +24 -0
  304. package/lib/typescript/commonjs/toast/toast-timers.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/toast/types.d.ts +222 -5
  306. package/lib/typescript/commonjs/toast/types.d.ts.map +1 -1
  307. package/lib/typescript/commonjs/toast/use-animated-target.d.ts +7 -0
  308. package/lib/typescript/commonjs/toast/use-animated-target.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/toast/use-app-state.d.ts +18 -0
  310. package/lib/typescript/commonjs/toast/use-app-state.d.ts.map +1 -0
  311. package/lib/typescript/commonjs/toast/use-toast-colors.d.ts +22 -0
  312. package/lib/typescript/commonjs/toast/use-toast-colors.d.ts.map +1 -0
  313. package/lib/typescript/commonjs/toast/use-toast-position.d.ts +37 -0
  314. package/lib/typescript/commonjs/toast/use-toast-position.d.ts.map +1 -0
  315. package/lib/typescript/commonjs/tooltip/index.web.d.ts.map +1 -1
  316. package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
  317. package/lib/typescript/module/avatar-group/AvatarGroup.web.d.ts.map +1 -1
  318. package/lib/typescript/module/bottom-sheet/index.web.d.ts.map +1 -1
  319. package/lib/typescript/module/context-menu/index.web.d.ts.map +1 -1
  320. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  321. package/lib/typescript/module/index.d.ts +2 -1
  322. package/lib/typescript/module/index.d.ts.map +1 -1
  323. package/lib/typescript/module/index.web.d.ts +2 -1
  324. package/lib/typescript/module/index.web.d.ts.map +1 -1
  325. package/lib/typescript/module/menu/index.web.d.ts.map +1 -1
  326. package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
  327. package/lib/typescript/module/portal/index.d.ts.map +1 -1
  328. package/lib/typescript/module/progressive-blur/index.d.ts +23 -0
  329. package/lib/typescript/module/progressive-blur/index.d.ts.map +1 -0
  330. package/lib/typescript/module/progressive-blur/index.web.d.ts +30 -0
  331. package/lib/typescript/module/progressive-blur/index.web.d.ts.map +1 -0
  332. package/lib/typescript/module/progressive-blur/shared.d.ts +35 -0
  333. package/lib/typescript/module/progressive-blur/shared.d.ts.map +1 -0
  334. package/lib/typescript/module/progressive-blur/types.d.ts +21 -0
  335. package/lib/typescript/module/progressive-blur/types.d.ts.map +1 -0
  336. package/lib/typescript/module/select/index.web.d.ts.map +1 -1
  337. package/lib/typescript/module/styles/web-view-style.d.ts +21 -0
  338. package/lib/typescript/module/styles/web-view-style.d.ts.map +1 -0
  339. package/lib/typescript/module/tab-bar/TabBarBase.d.ts +36 -0
  340. package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -0
  341. package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
  342. package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
  343. package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
  344. package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
  345. package/lib/typescript/module/tab-bar/expo-router/index.d.ts +14 -0
  346. package/lib/typescript/module/tab-bar/expo-router/index.d.ts.map +1 -0
  347. package/lib/typescript/module/tab-bar/glyph.d.ts +6 -0
  348. package/lib/typescript/module/tab-bar/glyph.d.ts.map +1 -0
  349. package/lib/typescript/module/tab-bar/glyph.native.d.ts +6 -0
  350. package/lib/typescript/module/tab-bar/glyph.native.d.ts.map +1 -0
  351. package/lib/typescript/module/tab-bar/index.d.ts +12 -0
  352. package/lib/typescript/module/tab-bar/index.d.ts.map +1 -0
  353. package/lib/typescript/module/tab-bar/index.web.d.ts +12 -0
  354. package/lib/typescript/module/tab-bar/index.web.d.ts.map +1 -0
  355. package/lib/typescript/module/tab-bar/minimize-context.d.ts +51 -0
  356. package/lib/typescript/module/tab-bar/minimize-context.d.ts.map +1 -0
  357. package/lib/typescript/module/tab-bar/shared.d.ts +93 -0
  358. package/lib/typescript/module/tab-bar/shared.d.ts.map +1 -0
  359. package/lib/typescript/module/tab-bar/surface.d.ts +6 -0
  360. package/lib/typescript/module/tab-bar/surface.d.ts.map +1 -0
  361. package/lib/typescript/module/tab-bar/surface.native.d.ts +6 -0
  362. package/lib/typescript/module/tab-bar/surface.native.d.ts.map +1 -0
  363. package/lib/typescript/module/tab-bar/surface.web.d.ts +6 -0
  364. package/lib/typescript/module/tab-bar/surface.web.d.ts.map +1 -0
  365. package/lib/typescript/module/tab-bar/types.d.ts +85 -0
  366. package/lib/typescript/module/tab-bar/types.d.ts.map +1 -0
  367. package/lib/typescript/module/toast/Positioner.d.ts +21 -0
  368. package/lib/typescript/module/toast/Positioner.d.ts.map +1 -0
  369. package/lib/typescript/module/toast/ToastContent.d.ts +14 -0
  370. package/lib/typescript/module/toast/ToastContent.d.ts.map +1 -0
  371. package/lib/typescript/module/toast/ToastHost.d.ts +6 -0
  372. package/lib/typescript/module/toast/ToastHost.d.ts.map +1 -0
  373. package/lib/typescript/module/toast/ToastHost.native.d.ts +6 -0
  374. package/lib/typescript/module/toast/ToastHost.native.d.ts.map +1 -0
  375. package/lib/typescript/module/toast/ToastIcon.d.ts +9 -0
  376. package/lib/typescript/module/toast/ToastIcon.d.ts.map +1 -0
  377. package/lib/typescript/module/toast/ToastRow.d.ts +80 -0
  378. package/lib/typescript/module/toast/ToastRow.d.ts.map +1 -0
  379. package/lib/typescript/module/toast/ToastSwipeHandler.d.ts +30 -0
  380. package/lib/typescript/module/toast/ToastSwipeHandler.d.ts.map +1 -0
  381. package/lib/typescript/module/toast/Toaster.d.ts +19 -0
  382. package/lib/typescript/module/toast/Toaster.d.ts.map +1 -0
  383. package/lib/typescript/module/toast/animations.d.ts +62 -0
  384. package/lib/typescript/module/toast/animations.d.ts.map +1 -0
  385. package/lib/typescript/module/toast/constants.d.ts +39 -0
  386. package/lib/typescript/module/toast/constants.d.ts.map +1 -0
  387. package/lib/typescript/module/toast/context.d.ts +19 -0
  388. package/lib/typescript/module/toast/context.d.ts.map +1 -0
  389. package/lib/typescript/module/toast/index.d.ts +23 -76
  390. package/lib/typescript/module/toast/index.d.ts.map +1 -1
  391. package/lib/typescript/module/toast/position-utils.d.ts +30 -0
  392. package/lib/typescript/module/toast/position-utils.d.ts.map +1 -0
  393. package/lib/typescript/module/toast/positioner-utils.d.ts +72 -0
  394. package/lib/typescript/module/toast/positioner-utils.d.ts.map +1 -0
  395. package/lib/typescript/module/toast/toast-comparator.d.ts +12 -0
  396. package/lib/typescript/module/toast/toast-comparator.d.ts.map +1 -0
  397. package/lib/typescript/module/toast/toast-fns.d.ts +3 -0
  398. package/lib/typescript/module/toast/toast-fns.d.ts.map +1 -0
  399. package/lib/typescript/module/toast/toast-store.d.ts +52 -0
  400. package/lib/typescript/module/toast/toast-store.d.ts.map +1 -0
  401. package/lib/typescript/module/toast/toast-timers.d.ts +24 -0
  402. package/lib/typescript/module/toast/toast-timers.d.ts.map +1 -0
  403. package/lib/typescript/module/toast/types.d.ts +222 -5
  404. package/lib/typescript/module/toast/types.d.ts.map +1 -1
  405. package/lib/typescript/module/toast/use-animated-target.d.ts +7 -0
  406. package/lib/typescript/module/toast/use-animated-target.d.ts.map +1 -0
  407. package/lib/typescript/module/toast/use-app-state.d.ts +18 -0
  408. package/lib/typescript/module/toast/use-app-state.d.ts.map +1 -0
  409. package/lib/typescript/module/toast/use-toast-colors.d.ts +22 -0
  410. package/lib/typescript/module/toast/use-toast-colors.d.ts.map +1 -0
  411. package/lib/typescript/module/toast/use-toast-position.d.ts +37 -0
  412. package/lib/typescript/module/toast/use-toast-position.d.ts.map +1 -0
  413. package/lib/typescript/module/tooltip/index.web.d.ts.map +1 -1
  414. package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
  415. package/package.json +63 -25
  416. package/src/__tests__/TabBar.test.tsx +342 -0
  417. package/src/__tests__/TabBarReanimatedDeps.test.ts +130 -0
  418. package/src/__tests__/TabBarWebFork.test.ts +197 -0
  419. package/src/__tests__/ToastContent.test.tsx +192 -0
  420. package/src/__tests__/ToastHostWebFork.test.ts +155 -0
  421. package/src/__tests__/Toaster.test.tsx +527 -0
  422. package/src/__tests__/animated-style-deps.test.ts +156 -0
  423. package/src/__tests__/toast-animations.test.ts +98 -0
  424. package/src/__tests__/toast-comparator.test.ts +131 -0
  425. package/src/__tests__/toast-enter-driver.test.ts +147 -0
  426. package/src/__tests__/toast-fns.test.ts +240 -0
  427. package/src/__tests__/toast-position-utils.test.ts +259 -0
  428. package/src/__tests__/toast-positioner-utils.test.ts +214 -0
  429. package/src/__tests__/toast-store.test.ts +622 -0
  430. package/src/__tests__/toast-timers.test.ts +163 -0
  431. package/src/__tests__/use-animated-target.test.tsx +60 -0
  432. package/src/__tests__/use-app-state.test.tsx +127 -0
  433. package/src/__tests__/use-toast-colors.test.tsx +189 -0
  434. package/src/__tests__/web-position-fixed.test.ts +70 -0
  435. package/src/avatar-group/AvatarGroup.web.tsx +2 -1
  436. package/src/bottom-sheet/index.web.tsx +3 -2
  437. package/src/context-menu/index.web.tsx +3 -2
  438. package/src/dialog/Dialog.web.tsx +4 -3
  439. package/src/index.ts +4 -1
  440. package/src/index.web.ts +4 -1
  441. package/src/menu/index.web.tsx +2 -1
  442. package/src/popover/index.web.tsx +3 -2
  443. package/src/portal/index.tsx +4 -1
  444. package/src/progressive-blur/index.tsx +78 -0
  445. package/src/progressive-blur/index.web.tsx +65 -0
  446. package/src/progressive-blur/shared.ts +81 -0
  447. package/src/progressive-blur/types.ts +21 -0
  448. package/src/select/index.web.tsx +2 -1
  449. package/src/styles/web-view-style.ts +21 -0
  450. package/src/tab-bar/TabBar.stories.tsx +217 -0
  451. package/src/tab-bar/TabBarBase.tsx +517 -0
  452. package/src/tab-bar/expo-router/RouterTabBar.tsx +80 -0
  453. package/src/tab-bar/expo-router/fading-tab-screen.tsx +109 -0
  454. package/src/tab-bar/expo-router/index.ts +13 -0
  455. package/src/tab-bar/glyph.native.tsx +46 -0
  456. package/src/tab-bar/glyph.tsx +31 -0
  457. package/src/tab-bar/index.ts +32 -0
  458. package/src/tab-bar/index.web.tsx +34 -0
  459. package/src/tab-bar/minimize-context.tsx +117 -0
  460. package/src/tab-bar/shared.ts +159 -0
  461. package/src/tab-bar/surface.native.tsx +60 -0
  462. package/src/tab-bar/surface.tsx +47 -0
  463. package/src/tab-bar/surface.web.tsx +56 -0
  464. package/src/tab-bar/types.ts +88 -0
  465. package/src/toast/Positioner.tsx +121 -0
  466. package/src/toast/Toast.stories.tsx +292 -65
  467. package/src/toast/ToastContent.tsx +405 -0
  468. package/src/toast/ToastHost.native.tsx +31 -0
  469. package/src/toast/ToastHost.tsx +67 -0
  470. package/src/toast/ToastIcon.tsx +55 -0
  471. package/src/toast/ToastRow.tsx +485 -0
  472. package/src/toast/ToastSwipeHandler.tsx +222 -0
  473. package/src/toast/Toaster.tsx +259 -0
  474. package/src/toast/animations.ts +313 -0
  475. package/src/toast/constants.ts +76 -0
  476. package/src/toast/context.tsx +44 -0
  477. package/src/toast/index.tsx +47 -123
  478. package/src/toast/position-utils.ts +149 -0
  479. package/src/toast/positioner-utils.ts +142 -0
  480. package/src/toast/toast-comparator.ts +41 -0
  481. package/src/toast/toast-fns.ts +104 -0
  482. package/src/toast/toast-store.ts +432 -0
  483. package/src/toast/toast-timers.ts +124 -0
  484. package/src/toast/types.ts +301 -5
  485. package/src/toast/use-animated-target.ts +61 -0
  486. package/src/toast/use-app-state.ts +77 -0
  487. package/src/toast/use-toast-colors.ts +133 -0
  488. package/src/toast/use-toast-position.ts +46 -0
  489. package/src/tooltip/index.web.tsx +2 -1
  490. package/src/zoomable-image-gallery/ZoomableImageGallery.stories.tsx +134 -0
  491. package/src/zoomable-image-gallery/ZoomableImageGallery.tsx +50 -27
  492. package/lib/commonjs/toast/Toast.js +0 -267
  493. package/lib/commonjs/toast/Toast.js.map +0 -1
  494. package/lib/commonjs/toast/const.js +0 -8
  495. package/lib/commonjs/toast/const.js.map +0 -1
  496. package/lib/commonjs/toast/index.web.js +0 -114
  497. package/lib/commonjs/toast/index.web.js.map +0 -1
  498. package/lib/commonjs/toast/sonner/index.js +0 -9
  499. package/lib/commonjs/toast/sonner/index.js.map +0 -1
  500. package/lib/commonjs/toast/sonner/index.web.js +0 -9
  501. package/lib/commonjs/toast/sonner/index.web.js.map +0 -1
  502. package/lib/module/toast/Toast.js +0 -258
  503. package/lib/module/toast/Toast.js.map +0 -1
  504. package/lib/module/toast/const.js +0 -4
  505. package/lib/module/toast/const.js.map +0 -1
  506. package/lib/module/toast/index.web.js +0 -74
  507. package/lib/module/toast/index.web.js.map +0 -1
  508. package/lib/module/toast/sonner/index.js +0 -5
  509. package/lib/module/toast/sonner/index.js.map +0 -1
  510. package/lib/module/toast/sonner/index.web.js +0 -5
  511. package/lib/module/toast/sonner/index.web.js.map +0 -1
  512. package/lib/typescript/commonjs/toast/Toast.d.ts +0 -23
  513. package/lib/typescript/commonjs/toast/Toast.d.ts.map +0 -1
  514. package/lib/typescript/commonjs/toast/const.d.ts +0 -2
  515. package/lib/typescript/commonjs/toast/const.d.ts.map +0 -1
  516. package/lib/typescript/commonjs/toast/index.web.d.ts +0 -29
  517. package/lib/typescript/commonjs/toast/index.web.d.ts.map +0 -1
  518. package/lib/typescript/commonjs/toast/sonner/index.d.ts +0 -2
  519. package/lib/typescript/commonjs/toast/sonner/index.d.ts.map +0 -1
  520. package/lib/typescript/commonjs/toast/sonner/index.web.d.ts +0 -2
  521. package/lib/typescript/commonjs/toast/sonner/index.web.d.ts.map +0 -1
  522. package/lib/typescript/module/toast/Toast.d.ts +0 -23
  523. package/lib/typescript/module/toast/Toast.d.ts.map +0 -1
  524. package/lib/typescript/module/toast/const.d.ts +0 -2
  525. package/lib/typescript/module/toast/const.d.ts.map +0 -1
  526. package/lib/typescript/module/toast/index.web.d.ts +0 -29
  527. package/lib/typescript/module/toast/index.web.d.ts.map +0 -1
  528. package/lib/typescript/module/toast/sonner/index.d.ts +0 -2
  529. package/lib/typescript/module/toast/sonner/index.d.ts.map +0 -1
  530. package/lib/typescript/module/toast/sonner/index.web.d.ts +0 -2
  531. package/lib/typescript/module/toast/sonner/index.web.d.ts.map +0 -1
  532. package/src/toast/Toast.tsx +0 -269
  533. package/src/toast/const.ts +0 -1
  534. package/src/toast/index.web.tsx +0 -101
  535. package/src/toast/sonner/index.ts +0 -3
  536. package/src/toast/sonner/index.web.ts +0 -3
@@ -0,0 +1,622 @@
1
+ import { ENTERING_ANIMATION_DURATION, toastDefaults } from '../toast/constants';
2
+ import { toastStore } from '../toast/toast-store';
3
+
4
+ /**
5
+ * The store is deliberately free of React Native / Reanimated imports, so this
6
+ * suite needs no platform mocks — see the header of `toast/toast-store.ts`.
7
+ */
8
+ const flushMicrotasks = async () => {
9
+ await Promise.resolve();
10
+ await Promise.resolve();
11
+ };
12
+
13
+ describe('toastStore', () => {
14
+ beforeEach(() => {
15
+ jest.useFakeTimers();
16
+ toastStore.setConfig({});
17
+ });
18
+
19
+ afterEach(() => {
20
+ toastStore.dismissToast(undefined);
21
+ // Drains the hide-overlay timeout so the next test starts from a clean state.
22
+ jest.runOnlyPendingTimers();
23
+ jest.useRealTimers();
24
+ });
25
+
26
+ describe('enqueue', () => {
27
+ it('appends toasts in call order and hands back incrementing ids', () => {
28
+ const first = toastStore.addToast({ title: 'first' });
29
+ const second = toastStore.addToast({ title: 'second' });
30
+
31
+ expect([first, second]).toEqual([1, 2]);
32
+ expect(toastStore.getSnapshot().toasts.map((t) => t.title)).toEqual([
33
+ 'first',
34
+ 'second',
35
+ ]);
36
+ });
37
+
38
+ it('returns the caller-supplied id instead of a counter value', () => {
39
+ expect(toastStore.addToast({ title: 'x', id: 'my-id' })).toBe('my-id');
40
+ // A supplied id must not burn a counter value.
41
+ expect(toastStore.addToast({ title: 'y' })).toBe(1);
42
+ });
43
+
44
+ it('falls back to the counter for an empty-string id', () => {
45
+ expect(toastStore.addToast({ title: 'x', id: '' })).toBe(1);
46
+ });
47
+
48
+ it('applies the configured duration, then the default', () => {
49
+ toastStore.setConfig({ duration: 9000 });
50
+ toastStore.addToast({ title: 'configured' });
51
+ expect(toastStore.getSnapshot().toasts[0]?.duration).toBe(9000);
52
+
53
+ toastStore.addToast({ title: 'explicit', duration: 100 });
54
+ expect(toastStore.getSnapshot().toasts[1]?.duration).toBe(100);
55
+
56
+ toastStore.setConfig({});
57
+ toastStore.addToast({ title: 'default' });
58
+ expect(toastStore.getSnapshot().toasts[2]?.duration).toBe(
59
+ toastDefaults.duration,
60
+ );
61
+ });
62
+
63
+ it('leaves the variant absent unless one was asked for', () => {
64
+ toastStore.addToast({ title: 'plain' });
65
+ expect(toastStore.getSnapshot().toasts[0]?.variant).toBeUndefined();
66
+
67
+ toastStore.addToast({ title: 'loud', variant: 'error' });
68
+ expect(toastStore.getSnapshot().toasts[1]?.variant).toBe('error');
69
+ });
70
+
71
+ it('creates one ref per toast', () => {
72
+ const id = toastStore.addToast({ title: 'x' });
73
+ expect(toastStore.getToastRef(id)).toBeDefined();
74
+ expect(toastStore.getToastRef('nope')).toBeUndefined();
75
+ });
76
+
77
+ it('auto-closes after the enter animation plus the duration', () => {
78
+ const onAutoClose = jest.fn();
79
+ toastStore.addToast({ title: 'x', duration: 1000, onAutoClose });
80
+
81
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION + 999);
82
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
83
+
84
+ jest.advanceTimersByTime(1);
85
+ expect(toastStore.getSnapshot().toasts).toHaveLength(0);
86
+ expect(onAutoClose).toHaveBeenCalledWith(1);
87
+ });
88
+ });
89
+
90
+ describe('visibleToasts cap', () => {
91
+ it('drops the oldest toast once the cap is exceeded', () => {
92
+ toastStore.setConfig({ visibleToasts: 2 });
93
+ toastStore.addToast({ title: 'a' });
94
+ toastStore.addToast({ title: 'b' });
95
+ toastStore.addToast({ title: 'c' });
96
+
97
+ const state = toastStore.getSnapshot();
98
+ expect(state.toasts.map((t) => t.title)).toEqual(['b', 'c']);
99
+ expect([...state.toastsById.keys()]).toEqual([2, 3]);
100
+ expect(state.toastRefs[1]).toBeUndefined();
101
+ });
102
+
103
+ it('defaults the cap to toastDefaults.visibleToasts', () => {
104
+ for (let i = 0; i < toastDefaults.visibleToasts + 2; i++) {
105
+ toastStore.addToast({ title: `t${i}` });
106
+ }
107
+ expect(toastStore.getSnapshot().toasts).toHaveLength(
108
+ toastDefaults.visibleToasts,
109
+ );
110
+ });
111
+
112
+ it('stops the evicted toast auto-closing a survivor', () => {
113
+ toastStore.setConfig({ visibleToasts: 1 });
114
+ const onAutoClose = jest.fn();
115
+ toastStore.addToast({ title: 'a', duration: 1000, onAutoClose });
116
+ toastStore.addToast({ title: 'b', duration: 50_000 });
117
+
118
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION + 1000);
119
+ expect(onAutoClose).not.toHaveBeenCalled();
120
+ expect(toastStore.getSnapshot().toasts.map((t) => t.title)).toEqual(['b']);
121
+ });
122
+
123
+ it('replaces toastHeights when eviction discards a measured height', () => {
124
+ toastStore.setConfig({ visibleToasts: 1 });
125
+ const id = toastStore.addToast({ title: 'a' });
126
+ toastStore.setToastHeight(id, 70);
127
+ const heights = toastStore.getSnapshot().toastHeights;
128
+
129
+ toastStore.addToast({ title: 'b' });
130
+
131
+ const state = toastStore.getSnapshot();
132
+ expect(state.toastHeights[id]).toBeUndefined();
133
+ expect(state.toastHeights).not.toBe(heights);
134
+ });
135
+ });
136
+
137
+ describe('update by id', () => {
138
+ it('updates in place instead of appending', () => {
139
+ toastStore.addToast({ title: 'first' });
140
+ toastStore.addToast({ title: 'pending', id: 'job' });
141
+ toastStore.addToast({ title: 'last' });
142
+
143
+ toastStore.addToast({ title: 'done', id: 'job', variant: 'success' });
144
+
145
+ const state = toastStore.getSnapshot();
146
+ expect(state.toasts.map((t) => t.title)).toEqual([
147
+ 'first',
148
+ 'done',
149
+ 'last',
150
+ ]);
151
+ expect(state.toastsById.get('job')?.variant).toBe('success');
152
+ });
153
+
154
+ it('keeps the same ref across an update', () => {
155
+ const id = toastStore.addToast({ title: 'a', id: 'stable' });
156
+ const ref = toastStore.getToastRef(id);
157
+ toastStore.addToast({ title: 'b', id: 'stable' });
158
+ expect(toastStore.getToastRef(id)).toBe(ref);
159
+ });
160
+
161
+ it('restarts the auto-close timer with the updated duration', () => {
162
+ toastStore.addToast({ title: 'a', id: 'job', duration: 1000 });
163
+ jest.advanceTimersByTime(1000);
164
+
165
+ toastStore.addToast({ title: 'b', id: 'job', duration: 5000 });
166
+
167
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION + 4999);
168
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
169
+ jest.advanceTimersByTime(1);
170
+ expect(toastStore.getSnapshot().toasts).toHaveLength(0);
171
+ });
172
+
173
+ it("wiggles on every update when autoWiggleOnUpdate is 'always'", () => {
174
+ toastStore.setConfig({ autoWiggleOnUpdate: 'always' });
175
+ const id = toastStore.addToast({ title: 'same', id: 'job' });
176
+ const wiggle = jest.fn();
177
+ const ref = toastStore.getToastRef(id);
178
+ if (ref) ref.current = { wiggle };
179
+
180
+ toastStore.addToast({ title: 'same', id: 'job' });
181
+ expect(wiggle).toHaveBeenCalledTimes(1);
182
+ });
183
+
184
+ it("wiggles only on a visible change when autoWiggleOnUpdate is 'toast-change'", () => {
185
+ toastStore.setConfig({ autoWiggleOnUpdate: 'toast-change' });
186
+ const id = toastStore.addToast({ title: 'same', id: 'job' });
187
+ const wiggle = jest.fn();
188
+ const ref = toastStore.getToastRef(id);
189
+ if (ref) ref.current = { wiggle };
190
+
191
+ toastStore.addToast({ title: 'same', id: 'job' });
192
+ expect(wiggle).not.toHaveBeenCalled();
193
+
194
+ toastStore.addToast({ title: 'changed', id: 'job' });
195
+ expect(wiggle).toHaveBeenCalledTimes(1);
196
+ });
197
+
198
+ it("never wiggles when autoWiggleOnUpdate is left at 'never'", () => {
199
+ const id = toastStore.addToast({ title: 'a', id: 'job' });
200
+ const wiggle = jest.fn();
201
+ const ref = toastStore.getToastRef(id);
202
+ if (ref) ref.current = { wiggle };
203
+
204
+ toastStore.addToast({ title: 'b', id: 'job' });
205
+ expect(wiggle).not.toHaveBeenCalled();
206
+ });
207
+ });
208
+
209
+ describe('dismiss', () => {
210
+ it('removes one toast by id and reports the id back', () => {
211
+ const kept = toastStore.addToast({ title: 'keep' });
212
+ const dropped = toastStore.addToast({ title: 'drop' });
213
+
214
+ expect(toastStore.dismissToast(dropped)).toBe(dropped);
215
+
216
+ const state = toastStore.getSnapshot();
217
+ expect(state.toasts.map((t) => t.id)).toEqual([kept]);
218
+ expect(state.toastsById.has(dropped)).toBe(false);
219
+ expect(state.toastRefs[dropped]).toBeUndefined();
220
+ });
221
+
222
+ it('calls onDismiss for a user dismissal and onAutoClose otherwise', () => {
223
+ const onDismiss = jest.fn();
224
+ const onAutoClose = jest.fn();
225
+ const id = toastStore.addToast({ title: 'a', onDismiss, onAutoClose });
226
+
227
+ toastStore.dismissToast(id, 'onDismiss');
228
+ expect(onDismiss).toHaveBeenCalledWith(id);
229
+ expect(onAutoClose).not.toHaveBeenCalled();
230
+ });
231
+
232
+ it('cancels the auto-close timer of a dismissed toast', () => {
233
+ const onAutoClose = jest.fn();
234
+ const id = toastStore.addToast({ title: 'a', duration: 1000, onAutoClose });
235
+ toastStore.dismissToast(id, 'onDismiss');
236
+
237
+ jest.advanceTimersByTime(1_000_000);
238
+ expect(onAutoClose).not.toHaveBeenCalled();
239
+ });
240
+
241
+ it('clears everything and resets the counter on dismiss-all', () => {
242
+ const onDismiss = jest.fn();
243
+ toastStore.addToast({ title: 'a', onDismiss });
244
+ toastStore.addToast({ title: 'b', onDismiss });
245
+
246
+ expect(toastStore.dismissToast(undefined, 'onDismiss')).toBeUndefined();
247
+
248
+ const state = toastStore.getSnapshot();
249
+ expect(state.toasts).toHaveLength(0);
250
+ expect(state.toastsById.size).toBe(0);
251
+ expect(state.toastsCounter).toBe(1);
252
+ expect(state.toastRefs).toEqual({});
253
+ expect(state.toastHeights).toEqual({});
254
+ expect(state.isExpanded).toBe(false);
255
+ expect(onDismiss).toHaveBeenCalledTimes(2);
256
+ });
257
+
258
+ it('stops pending auto-closes on dismiss-all', () => {
259
+ const onAutoClose = jest.fn();
260
+ toastStore.addToast({ title: 'a', duration: 1000, onAutoClose });
261
+ toastStore.dismissToast(undefined, 'onDismiss');
262
+
263
+ jest.advanceTimersByTime(1_000_000);
264
+ expect(onAutoClose).not.toHaveBeenCalled();
265
+ });
266
+
267
+ it('dismissing an unknown id leaves the queue untouched', () => {
268
+ toastStore.addToast({ title: 'a' });
269
+ expect(toastStore.dismissToast('ghost')).toBe('ghost');
270
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
271
+ });
272
+ });
273
+
274
+ describe('shouldShowOverlay', () => {
275
+ it('turns on with the first toast and off only after the exit animation', () => {
276
+ expect(toastStore.getSnapshot().shouldShowOverlay).toBe(false);
277
+
278
+ const id = toastStore.addToast({ title: 'a' });
279
+ expect(toastStore.getSnapshot().shouldShowOverlay).toBe(true);
280
+
281
+ toastStore.dismissToast(id, 'onDismiss');
282
+ // Still on — the row is mid-exit.
283
+ expect(toastStore.getSnapshot().shouldShowOverlay).toBe(true);
284
+
285
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION - 1);
286
+ expect(toastStore.getSnapshot().shouldShowOverlay).toBe(true);
287
+
288
+ jest.advanceTimersByTime(1);
289
+ expect(toastStore.getSnapshot().shouldShowOverlay).toBe(false);
290
+ });
291
+
292
+ it('stays on while other toasts remain', () => {
293
+ const first = toastStore.addToast({ title: 'a' });
294
+ toastStore.addToast({ title: 'b' });
295
+
296
+ toastStore.dismissToast(first, 'onDismiss');
297
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION * 2);
298
+
299
+ expect(toastStore.getSnapshot().shouldShowOverlay).toBe(true);
300
+ });
301
+
302
+ it('cancels a scheduled hide when a new toast arrives first', () => {
303
+ const id = toastStore.addToast({ title: 'a' });
304
+ toastStore.dismissToast(id, 'onDismiss');
305
+
306
+ toastStore.addToast({ title: 'b' });
307
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION * 2);
308
+
309
+ expect(toastStore.getSnapshot().shouldShowOverlay).toBe(true);
310
+ });
311
+ });
312
+
313
+ /**
314
+ * Row offsets are recomputed in React from `toastHeights` (see
315
+ * `use-toast-position.ts`), so a mutation MUST produce a new object or the
316
+ * recompute never happens and the stack overlaps itself. This replaces the
317
+ * hand-rolled `toastHeightsVersion` counter upstream needs for its worklet.
318
+ */
319
+ describe('toastHeights identity', () => {
320
+ it('replaces the object on every height mutation', () => {
321
+ const id = toastStore.addToast({ title: 'a' });
322
+ const initial = toastStore.getSnapshot().toastHeights;
323
+
324
+ toastStore.setToastHeight(id, 70);
325
+ const afterFirst = toastStore.getSnapshot().toastHeights;
326
+ expect(afterFirst).not.toBe(initial);
327
+ expect(afterFirst[id]).toBe(70);
328
+
329
+ toastStore.setToastHeight(id, 84);
330
+ const afterSecond = toastStore.getSnapshot().toastHeights;
331
+ expect(afterSecond).not.toBe(afterFirst);
332
+ expect(afterSecond[id]).toBe(84);
333
+ });
334
+
335
+ it('never mutates a previously handed-out object', () => {
336
+ const id = toastStore.addToast({ title: 'a' });
337
+ toastStore.setToastHeight(id, 70);
338
+ const snapshot = toastStore.getSnapshot().toastHeights;
339
+
340
+ const second = toastStore.addToast({ title: 'b' });
341
+ toastStore.setToastHeight(second, 40);
342
+
343
+ // The object a previous render captured must still read as it did then.
344
+ expect(snapshot[second]).toBeUndefined();
345
+ expect(Object.keys(snapshot)).toEqual([String(id)]);
346
+ });
347
+
348
+ it('keeps the same object when the height is unchanged', () => {
349
+ const id = toastStore.addToast({ title: 'a' });
350
+ toastStore.setToastHeight(id, 70);
351
+ const heights = toastStore.getSnapshot().toastHeights;
352
+
353
+ toastStore.setToastHeight(id, 70);
354
+ expect(toastStore.getSnapshot().toastHeights).toBe(heights);
355
+ });
356
+
357
+ it('replaces the object when a dismissal drops a height', () => {
358
+ const id = toastStore.addToast({ title: 'a' });
359
+ toastStore.setToastHeight(id, 70);
360
+ const heights = toastStore.getSnapshot().toastHeights;
361
+
362
+ toastStore.dismissToast(id, 'onDismiss');
363
+ expect(toastStore.getSnapshot().toastHeights).not.toBe(heights);
364
+ expect(toastStore.getSnapshot().toastHeights[id]).toBeUndefined();
365
+ });
366
+
367
+ it('replaces the object on dismiss-all', () => {
368
+ const id = toastStore.addToast({ title: 'a' });
369
+ toastStore.setToastHeight(id, 70);
370
+ const heights = toastStore.getSnapshot().toastHeights;
371
+
372
+ toastStore.dismissToast(undefined, 'onDismiss');
373
+ expect(toastStore.getSnapshot().toastHeights).not.toBe(heights);
374
+ expect(toastStore.getSnapshot().toastHeights).toEqual({});
375
+ });
376
+ });
377
+
378
+ describe('promise lifecycle', () => {
379
+ it('starts pending, then swaps in the resolved title', async () => {
380
+ const id = toastStore.addToast({
381
+ title: 'Saving…',
382
+ variant: 'loading',
383
+ promiseOptions: {
384
+ promise: Promise.resolve('Saved'),
385
+ loading: 'Saving…',
386
+ error: 'Failed',
387
+ },
388
+ });
389
+
390
+ expect(toastStore.getSnapshot().toasts[0]).toMatchObject({
391
+ title: 'Saving…',
392
+ variant: 'loading',
393
+ });
394
+
395
+ await flushMicrotasks();
396
+
397
+ const settled = toastStore.getSnapshot().toastsById.get(id);
398
+ expect(settled).toMatchObject({ title: 'Saved', variant: 'success' });
399
+ expect(settled?.promiseOptions).toBeUndefined();
400
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
401
+ });
402
+
403
+ it('swaps in the rejected title from an error formatter', async () => {
404
+ const id = toastStore.addToast({
405
+ title: 'Saving…',
406
+ variant: 'loading',
407
+ promiseOptions: {
408
+ promise: Promise.reject(new Error('offline')),
409
+ loading: 'Saving…',
410
+ error: (error: unknown) =>
411
+ `Failed: ${error instanceof Error ? error.message : 'unknown'}`,
412
+ },
413
+ });
414
+
415
+ await flushMicrotasks();
416
+
417
+ expect(toastStore.getSnapshot().toastsById.get(id)).toMatchObject({
418
+ title: 'Failed: offline',
419
+ variant: 'error',
420
+ });
421
+ });
422
+
423
+ it('accepts a plain string as the rejected title', async () => {
424
+ const id = toastStore.addToast({
425
+ title: 'Saving…',
426
+ variant: 'loading',
427
+ promiseOptions: {
428
+ promise: Promise.reject(new Error('offline')),
429
+ loading: 'Saving…',
430
+ error: 'Could not save',
431
+ },
432
+ });
433
+
434
+ await flushMicrotasks();
435
+
436
+ expect(toastStore.getSnapshot().toastsById.get(id)?.title).toBe(
437
+ 'Could not save',
438
+ );
439
+ });
440
+
441
+ it('does not auto-close while the promise is pending', () => {
442
+ let resolvePromise: ((value: string) => void) | undefined;
443
+ toastStore.addToast({
444
+ title: 'Saving…',
445
+ duration: 1000,
446
+ promiseOptions: {
447
+ promise: new Promise<string>((resolve) => {
448
+ resolvePromise = resolve;
449
+ }),
450
+ loading: 'Saving…',
451
+ error: 'Failed',
452
+ },
453
+ });
454
+
455
+ jest.advanceTimersByTime(1_000_000);
456
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
457
+ resolvePromise?.('Saved');
458
+ });
459
+
460
+ it('auto-closes once the promise has settled', async () => {
461
+ toastStore.addToast({
462
+ title: 'Saving…',
463
+ duration: 1000,
464
+ promiseOptions: {
465
+ promise: Promise.resolve('Saved'),
466
+ loading: 'Saving…',
467
+ error: 'Failed',
468
+ },
469
+ });
470
+
471
+ await flushMicrotasks();
472
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION + 1000);
473
+
474
+ expect(toastStore.getSnapshot().toasts).toHaveLength(0);
475
+ });
476
+
477
+ it('drops the result of a promise whose toast was already dismissed', async () => {
478
+ const id = toastStore.addToast({
479
+ title: 'Saving…',
480
+ promiseOptions: {
481
+ promise: Promise.resolve('Saved'),
482
+ loading: 'Saving…',
483
+ error: 'Failed',
484
+ },
485
+ });
486
+
487
+ toastStore.dismissToast(id, 'onDismiss');
488
+ await flushMicrotasks();
489
+
490
+ expect(toastStore.getSnapshot().toasts).toHaveLength(0);
491
+ });
492
+
493
+ it('applies the per-phase styles', async () => {
494
+ const loadingStyles = { title: { fontSize: 10 } };
495
+ const successStyles = { title: { fontSize: 20 } };
496
+ const id = toastStore.addToast({
497
+ title: 'Saving…',
498
+ styles: loadingStyles,
499
+ promiseOptions: {
500
+ promise: Promise.resolve('Saved'),
501
+ loading: 'Saving…',
502
+ error: 'Failed',
503
+ styles: { loading: loadingStyles, success: successStyles },
504
+ },
505
+ });
506
+
507
+ expect(toastStore.getSnapshot().toastsById.get(id)?.styles).toBe(
508
+ loadingStyles,
509
+ );
510
+
511
+ await flushMicrotasks();
512
+ expect(toastStore.getSnapshot().toastsById.get(id)?.styles).toBe(
513
+ successStyles,
514
+ );
515
+ });
516
+ });
517
+
518
+ describe('wiggle', () => {
519
+ it('calls the row ref and restarts the auto-close timer', () => {
520
+ const id = toastStore.addToast({ title: 'a', duration: 1000 });
521
+ const wiggle = jest.fn();
522
+ const ref = toastStore.getToastRef(id);
523
+ if (ref) ref.current = { wiggle };
524
+
525
+ jest.advanceTimersByTime(1000);
526
+ toastStore.wiggleToast(id);
527
+ expect(wiggle).toHaveBeenCalledTimes(1);
528
+
529
+ jest.advanceTimersByTime(ENTERING_ANIMATION_DURATION + 999);
530
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
531
+ jest.advanceTimersByTime(1);
532
+ expect(toastStore.getSnapshot().toasts).toHaveLength(0);
533
+ });
534
+
535
+ it('ignores an unknown id', () => {
536
+ expect(() => toastStore.wiggleToast('ghost')).not.toThrow();
537
+ });
538
+
539
+ it('never starts a timer for a toast that should stay up forever', () => {
540
+ const id = toastStore.addToast({ title: 'a', duration: Infinity });
541
+ toastStore.wiggleToast(id);
542
+
543
+ jest.advanceTimersByTime(1_000_000);
544
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
545
+ });
546
+ });
547
+
548
+ describe('expand / collapse', () => {
549
+ it('pauses timers while expanded and resumes them on collapse', () => {
550
+ toastStore.addToast({ title: 'a', duration: 1000 });
551
+
552
+ toastStore.expand();
553
+ expect(toastStore.getSnapshot().isExpanded).toBe(true);
554
+ jest.advanceTimersByTime(1_000_000);
555
+ expect(toastStore.getSnapshot().toasts).toHaveLength(1);
556
+
557
+ toastStore.collapse();
558
+ expect(toastStore.getSnapshot().isExpanded).toBe(false);
559
+ jest.advanceTimersByTime(1000);
560
+ expect(toastStore.getSnapshot().toasts).toHaveLength(0);
561
+ });
562
+
563
+ it('ignores a re-expand inside the collapse cooldown', () => {
564
+ toastStore.addToast({ title: 'a' });
565
+ toastStore.expand();
566
+ toastStore.collapse();
567
+
568
+ toastStore.toggleExpand();
569
+ expect(toastStore.getSnapshot().isExpanded).toBe(false);
570
+
571
+ jest.advanceTimersByTime(100);
572
+ toastStore.toggleExpand();
573
+ expect(toastStore.getSnapshot().isExpanded).toBe(true);
574
+ });
575
+
576
+ it('auto-collapses once only one toast is left', () => {
577
+ const first = toastStore.addToast({ title: 'a' });
578
+ toastStore.addToast({ title: 'b' });
579
+ toastStore.expand();
580
+
581
+ toastStore.dismissToast(first, 'onDismiss');
582
+ expect(toastStore.getSnapshot().isExpanded).toBe(false);
583
+ });
584
+ });
585
+
586
+ describe('subscription', () => {
587
+ it('keeps the snapshot referentially stable while nothing changes', () => {
588
+ const snapshot = toastStore.getSnapshot();
589
+ expect(toastStore.getSnapshot()).toBe(snapshot);
590
+
591
+ const id = toastStore.addToast({ title: 'a' });
592
+ const afterAdd = toastStore.getSnapshot();
593
+ expect(afterAdd).not.toBe(snapshot);
594
+ expect(toastStore.getSnapshot()).toBe(afterAdd);
595
+
596
+ // A no-op height write must not invalidate the snapshot.
597
+ toastStore.setToastHeight(id, 70);
598
+ const afterHeight = toastStore.getSnapshot();
599
+ toastStore.setToastHeight(id, 70);
600
+ expect(toastStore.getSnapshot()).toBe(afterHeight);
601
+ });
602
+
603
+ it('notifies subscribers on mutation and stops after unsubscribe', () => {
604
+ const listener = jest.fn();
605
+ const unsubscribe = toastStore.subscribe(listener);
606
+
607
+ const id = toastStore.addToast({ title: 'a' });
608
+ expect(listener).toHaveBeenCalledTimes(1);
609
+
610
+ toastStore.setToastHeight(id, 70);
611
+ expect(listener).toHaveBeenCalledTimes(2);
612
+
613
+ // Unchanged height — no notification.
614
+ toastStore.setToastHeight(id, 70);
615
+ expect(listener).toHaveBeenCalledTimes(2);
616
+
617
+ unsubscribe();
618
+ toastStore.addToast({ title: 'b' });
619
+ expect(listener).toHaveBeenCalledTimes(2);
620
+ });
621
+ });
622
+ });