@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,198 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Derived from sonner-native v0.26.4 — src/toaster.tsx
5
+ * (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
6
+ *
7
+ * Subscribes to the store, resolves the outlet configuration once, groups rows by
8
+ * position and renders each group through `Positioner` inside the platform
9
+ * `ToastHost`.
10
+ *
11
+ * W5 — ONE `AppState` subscription for the whole stack. Upstream subscribes per
12
+ * row, so N toasts meant N `visibilitychange` listeners all doing the same work;
13
+ * the store already exposes stack-wide `pauseAllTimers`/`resumeAllTimers`.
14
+ *
15
+ * `react-native-screens` is not imported here either — the platform wrapper is
16
+ * `ToastHost`'s concern (D6).
17
+ */
18
+ import * as React from 'react';
19
+ import { toastDefaults } from "./constants.js";
20
+ import { DynamicToastContext, ToastContext } from "./context.js";
21
+ import { getOrderedToastIds } from "./position-utils.js";
22
+ import { Positioner } from "./Positioner.js";
23
+ import { ToastHost } from './ToastHost';
24
+ import { ToastRow } from "./ToastRow.js";
25
+ import { toastStore } from "./toast-store.js";
26
+ import { useAppStateChange } from "./use-app-state.js";
27
+ import { jsx as _jsx } from "react/jsx-runtime";
28
+ const ALL_POSITIONS = ['top-center', 'bottom-center', 'center'];
29
+
30
+ // Stable identities so the context memos below do not invalidate every render.
31
+ const EMPTY_TOAST_OPTIONS = {};
32
+ const EMPTY_ICONS = {};
33
+ const EMPTY_ANIMATION = {};
34
+
35
+ /**
36
+ * A top-anchored stack grows downward from the newest toast, so its rows render
37
+ * in reverse order.
38
+ */
39
+ function orderToastsFromPosition(toasts, position) {
40
+ return position === 'top-center' ? toasts.slice().reverse() : toasts;
41
+ }
42
+ export const Toaster = ({
43
+ ToasterOverlayWrapper,
44
+ ToastWrapper,
45
+ duration = toastDefaults.duration,
46
+ position = toastDefaults.position,
47
+ offset = toastDefaults.offset,
48
+ visibleToasts = toastDefaults.visibleToasts,
49
+ swipeToDismissDirection = toastDefaults.swipeToDismissDirection,
50
+ closeButton = toastDefaults.closeButton,
51
+ gap = toastDefaults.gap,
52
+ theme = toastDefaults.theme,
53
+ invert = toastDefaults.invert,
54
+ richColors = toastDefaults.richColors,
55
+ enableStacking = toastDefaults.enableStacking,
56
+ autoWiggleOnUpdate = toastDefaults.autoWiggleOnUpdate,
57
+ pauseWhenPageIsHidden = toastDefaults.pauseWhenPageIsHidden,
58
+ allowFontScaling = toastDefaults.allowFontScaling,
59
+ maxFontSizeMultiplier,
60
+ toastOptions = EMPTY_TOAST_OPTIONS,
61
+ icons = EMPTY_ICONS,
62
+ animation = EMPTY_ANIMATION,
63
+ unstyled,
64
+ positionerStyle,
65
+ style,
66
+ styles: styleOverrides
67
+ }) => {
68
+ const {
69
+ toasts,
70
+ shouldShowOverlay,
71
+ toastHeights,
72
+ isExpanded
73
+ } = React.useSyncExternalStore(toastStore.subscribe, toastStore.getSnapshot, toastStore.getSnapshot);
74
+
75
+ // Runs even while idle: the store must know the outlet's limits BEFORE the
76
+ // first toast arrives, or that toast is resolved against the bare defaults.
77
+ React.useEffect(() => {
78
+ toastStore.setConfig({
79
+ autoWiggleOnUpdate,
80
+ visibleToasts,
81
+ duration,
82
+ pauseWhenPageIsHidden
83
+ });
84
+ }, [autoWiggleOnUpdate, visibleToasts, duration, pauseWhenPageIsHidden]);
85
+ const onBackground = React.useCallback(() => {
86
+ if (pauseWhenPageIsHidden) {
87
+ toastStore.pauseAllTimers();
88
+ }
89
+ }, [pauseWhenPageIsHidden]);
90
+ const onForeground = React.useCallback(() => {
91
+ if (pauseWhenPageIsHidden) {
92
+ toastStore.resumeAllTimers();
93
+ }
94
+ }, [pauseWhenPageIsHidden]);
95
+ useAppStateChange({
96
+ onBackground,
97
+ onForeground
98
+ });
99
+ const stableValue = React.useMemo(() => ({
100
+ duration,
101
+ position,
102
+ offset,
103
+ visibleToasts,
104
+ swipeToDismissDirection,
105
+ closeButton,
106
+ gap,
107
+ theme,
108
+ invert,
109
+ richColors,
110
+ enableStacking,
111
+ autoWiggleOnUpdate,
112
+ pauseWhenPageIsHidden,
113
+ allowFontScaling,
114
+ maxFontSizeMultiplier,
115
+ toastOptions,
116
+ icons,
117
+ animation,
118
+ unstyled: unstyled ?? toastOptions.unstyled ?? toastDefaults.unstyled
119
+ }), [duration, position, offset, visibleToasts, swipeToDismissDirection, closeButton, gap, theme, invert, richColors, enableStacking, autoWiggleOnUpdate, pauseWhenPageIsHidden, allowFontScaling, maxFontSizeMultiplier, toastOptions, icons, animation, unstyled]);
120
+ const dynamicValue = React.useMemo(() => ({
121
+ toastHeights,
122
+ isExpanded,
123
+ expand: toastStore.expand,
124
+ collapse: toastStore.collapse,
125
+ toggleExpand: toastStore.toggleExpand
126
+ }), [toastHeights, isExpanded]);
127
+
128
+ /**
129
+ * Rows grouped by their EFFECTIVE position, which for a toast with no explicit
130
+ * `position` is the outlet's configured one — the same resolution `ToastRow`
131
+ * itself does (`positionProp ?? positionCtx`).
132
+ *
133
+ * It must NOT be "whichever group happens to come first". Grouping a
134
+ * position-less row by index put it in the top-center group the moment any
135
+ * top-center toast existed, because `ALL_POSITIONS` starts with `top-center`:
136
+ * a plain `toast('Saved')` then rendered against the top inset (visible only as
137
+ * a sliver above the screen edge), and an already-placed one JUMPED there when a
138
+ * top-center toast arrived.
139
+ *
140
+ * The configured position is always kept, even with no rows in it, so
141
+ * position-less rows always have a home. Each group is ordered by its OWN
142
+ * position: a top-anchored stack renders in reverse, and applying the outlet's
143
+ * ordering to every group reversed the wrong ones.
144
+ */
145
+ const toastsByPosition = React.useMemo(() => {
146
+ const groups = new Map();
147
+ for (const candidate of ALL_POSITIONS) {
148
+ const group = toasts.filter(toast => (toast.position ?? position) === candidate);
149
+ if (candidate === position || group.length > 0) {
150
+ groups.set(candidate, orderToastsFromPosition(group, candidate));
151
+ }
152
+ }
153
+ return groups;
154
+ }, [toasts, position]);
155
+ const onDismiss = React.useCallback(id => {
156
+ toastStore.dismissToast(id, 'onDismiss');
157
+ }, []);
158
+
159
+ // Nothing to host while idle. `shouldShowOverlay` stays true for the length of
160
+ // the exit animation after the last dismissal, so this never cuts one short.
161
+ if (!shouldShowOverlay) {
162
+ return null;
163
+ }
164
+ return /*#__PURE__*/_jsx(ToastHost, {
165
+ ToasterOverlayWrapper: ToasterOverlayWrapper,
166
+ children: /*#__PURE__*/_jsx(ToastContext.Provider, {
167
+ value: stableValue,
168
+ children: /*#__PURE__*/_jsx(DynamicToastContext.Provider, {
169
+ value: dynamicValue,
170
+ children: Array.from(toastsByPosition, ([currentPosition, toastsForPosition]) => {
171
+ const orderedToastIds = getOrderedToastIds(toastsForPosition, currentPosition, enableStacking);
172
+ return /*#__PURE__*/_jsx(Positioner, {
173
+ position: currentPosition,
174
+ style: positionerStyle,
175
+ children: toastsForPosition.map((toast, index) => {
176
+ const row = /*#__PURE__*/_jsx(ToastRow, {
177
+ ...toast,
178
+ style: toast.style ?? style,
179
+ styles: toast.styles ?? styleOverrides,
180
+ index: index,
181
+ numberOfToasts: toastsForPosition.length,
182
+ orderedToastIds: orderedToastIds,
183
+ onDismiss: onDismiss,
184
+ ref: toastStore.getToastRef(toast.id)
185
+ }, toast.id);
186
+ return ToastWrapper ? /*#__PURE__*/_jsx(ToastWrapper, {
187
+ toastId: toast.id,
188
+ children: row
189
+ }, toast.id) : row;
190
+ })
191
+ }, currentPosition);
192
+ })
193
+ })
194
+ })
195
+ });
196
+ };
197
+ Toaster.displayName = 'Toaster';
198
+ //# sourceMappingURL=Toaster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","toastDefaults","DynamicToastContext","ToastContext","getOrderedToastIds","Positioner","ToastHost","ToastRow","toastStore","useAppStateChange","jsx","_jsx","ALL_POSITIONS","EMPTY_TOAST_OPTIONS","EMPTY_ICONS","EMPTY_ANIMATION","orderToastsFromPosition","toasts","position","slice","reverse","Toaster","ToasterOverlayWrapper","ToastWrapper","duration","offset","visibleToasts","swipeToDismissDirection","closeButton","gap","theme","invert","richColors","enableStacking","autoWiggleOnUpdate","pauseWhenPageIsHidden","allowFontScaling","maxFontSizeMultiplier","toastOptions","icons","animation","unstyled","positionerStyle","style","styles","styleOverrides","shouldShowOverlay","toastHeights","isExpanded","useSyncExternalStore","subscribe","getSnapshot","useEffect","setConfig","onBackground","useCallback","pauseAllTimers","onForeground","resumeAllTimers","stableValue","useMemo","dynamicValue","expand","collapse","toggleExpand","toastsByPosition","groups","Map","candidate","group","filter","toast","length","set","onDismiss","id","dismissToast","children","Provider","value","Array","from","currentPosition","toastsForPosition","orderedToastIds","map","index","row","numberOfToasts","ref","getToastRef","toastId","displayName"],"sourceRoot":"../../../src","sources":["toast/Toaster.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,aAAa,QAAQ,gBAAa;AAC3C,SAASC,mBAAmB,EAAEC,YAAY,QAAQ,cAAW;AAC7D,SAASC,kBAAkB,QAAQ,q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L,iBAAiB,CAACX,MAAO;gBACzCY,eAAe,EAAEA,eAAgB;gBACjCV,SAAS,EAAEA,SAAU;gBACrBe,GAAG,EAAEjF,UAAU,CAACkF,WAAW,CAACnB,KAAK,CAACI,EAAE;cAAE,GARjCJ,KAAK,CAACI,EASZ,CACF;cAED,OAAOpD,YAAY,gBACjBZ,IAAA,CAACY,YAAY;gBAAgBoE,OAAO,EAAEpB,KAAK,CAACI,EAAG;gBAAAE,QAAA,EAC5CU;cAAG,GADahB,KAAK,CAACI,EAEX,CAAC,GAEfY,GACD;YACH,CAAC;UAAC,GA1BGL,eA2BK,CAAC;QAEjB,CAAC;MAAC,CAC0B;IAAC,CACV;EAAC,CACf,CAAC;AAEhB,CAAC;AAED7D,OAAO,CAACuE,WAAW,GAAG,SAAS","ignoreList":[]}
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Derived from sonner-native v0.26.4 — src/animations.ts, src/animation-utils.ts
5
+ * and src/easings.ts (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
6
+ *
7
+ * W1 — THE EXIT DEFAULT IS A `Keyframe` INSTANCE, NOT A WORKLET BUILDER.
8
+ *
9
+ * Upstream returns a custom `EntryExitAnimationFunction` for both directions. On
10
+ * web that produces NO animation at all: reanimated's web layout-animation
11
+ * manager looks the builder up by preset name, finds none, logs a warning per
12
+ * toast and falls through to `makeElementVisible`, so a toast simply appears and
13
+ * disappears. A `ReanimatedKeyframe` compiles to a real CSS `@keyframes` rule on
14
+ * web and to the same interpolation on native, so one definition covers both
15
+ * platforms — which is what the exit default below is.
16
+ *
17
+ * ON WEB THE ENTER IS NOT A LAYOUT ANIMATION — NEVER HAND IT TO `entering`
18
+ * THERE. This is the fix for a blocker where a second toast landed exactly on top
19
+ * of the first, and it MUST NOT be undone by "simplifying" the web enter back
20
+ * into a `Keyframe`:
21
+ *
22
+ * reanimated's web ENTERING path calls `setElementAnimation(element, config,
23
+ * true)`, whose third argument is `shouldSavePosition`. For any animation name
24
+ * that is not one of its own predefined presets — which is every `Keyframe`,
25
+ * since those mint a fresh `REA-ENTERING-n` rule — it also schedules
26
+ * `scheduleAnimationCleanup(name, duration, cb)`, and that callback runs
27
+ * `setElementPosition(element, snapshot)`: `position: absolute`, an explicit
28
+ * `top`/`left`/`width`/`height` and `transform: ''`, taken from a snapshot
29
+ * captured when the enter animation ENDED. The timeout is `duration * 5`, so at
30
+ * Bloom's 300ms enter the row is frozen in VIEWPORT coordinates 1500ms after it
31
+ * appeared, and its parent collapses to `height: 0`. A row that moves inside
32
+ * that window — i.e. any row that is still on screen when the next toast
33
+ * arrives — has its stack translate exactly cancelled and redraws on top of the
34
+ * newcomer. It is completely silent: no error, no warning.
35
+ *
36
+ * So on web the enter is driven imperatively instead: `ToastRow` seeds a shared
37
+ * value at 0 and animates it to 1 (`useAnimatedTarget`'s `from`), interpolating
38
+ * opacity and `ENTER_TRANSLATE_Y` to the same distances and curve the `Keyframe`
39
+ * uses, without touching reanimated's web layout-animation machinery.
40
+ *
41
+ * NATIVE KEEPS THE `Keyframe` ON `entering`. `ENTER_DRIVER` below is the ONE
42
+ * switch: there is no `setElementPosition` on native — that whole pin is a web-DOM
43
+ * behaviour — so native pays nothing for the web bug, and driving the enter
44
+ * imperatively there instead regressed it hard (a `bottom-center` toast stopped
45
+ * painting altogether). Native runs the device-verified layout-animation path and
46
+ * never starts a mount-time `withTiming` for the enter at all.
47
+ *
48
+ * The EXIT goes through `exiting` on BOTH platforms, which is safe: reanimated
49
+ * pins the throwaway dummy clone it animates (`shouldSavePosition` is false for
50
+ * the real element), and it is what keeps a dismissed row mounted long enough to
51
+ * animate.
52
+ *
53
+ * Consumer-supplied *predefined* builders (`FadeIn`, `SlideInUp`) keep working on
54
+ * both platforms for both enter and exit, and always go through `entering` /
55
+ * `exiting`. A consumer's own custom worklet builder still animates on native and
56
+ * is silently ignored on web, and a consumer's custom `Keyframe` passed as
57
+ * `animation.enter` will hit the pin described above on web — both are reanimated
58
+ * limitations Bloom cannot bridge.
59
+ *
60
+ * Exit instances are cached per animation shape because building one is not free
61
+ * and, more importantly, because `Keyframe.parseDefinitions()` MUTATES the
62
+ * definition object it was constructed with (it rewrites `from`/`to` into
63
+ * `0`/`100` and deletes them). Each cached instance therefore owns its own
64
+ * definition object; sharing one definition across two instances would make the
65
+ * second throw "Please provide 0 or 'from' keyframe". Re-parsing a single
66
+ * instance is idempotent, so one instance is safely shared by every row of the
67
+ * same shape.
68
+ */
69
+ import { Platform } from 'react-native';
70
+ import { Easing, Keyframe, useReducedMotion } from 'react-native-reanimated';
71
+ import { ENTERING_ANIMATION_DURATION, toastDefaults } from "./constants.js";
72
+ import { useToastContext } from "./context.js";
73
+ /**
74
+ * `Easing.bezier()` (not `bezierFn`) returns an easing *factory*, which is what
75
+ * `Keyframe` accepts on both platforms — reanimated's dev-only worklet assertion
76
+ * short-circuits on the `.factory` property, so these pass without the worklets
77
+ * babel plugin too.
78
+ */
79
+ const EASE_OUT_QUART = Easing.bezier(0.165, 0.84, 0.44, 1);
80
+ const EASE_IN_OUT_CUBIC = Easing.bezier(0.645, 0.045, 0.355, 1);
81
+ /**
82
+ * THE one platform switch in the toast engine: which mechanism plays Bloom's
83
+ * DEFAULT enter animation. See the header for why the two platforms cannot share
84
+ * one mechanism.
85
+ */
86
+ export const TOAST_ENTER_DRIVER = Platform.OS === 'web' ? 'imperative' : 'layoutAnimation';
87
+
88
+ /** Worklet-callable easing for `withTiming` inside mappers and layout transitions. */
89
+ export const easeOutQuartFn = Easing.bezierFn(0.165, 0.84, 0.44, 1);
90
+ export const easeInOutCircFn = Easing.bezierFn(0.785, 0.135, 0.15, 0.86);
91
+
92
+ /** How far a row travels on the way in, per position. */
93
+ const ENTER_TRANSLATE_Y = {
94
+ 'top-center': -20,
95
+ 'bottom-center': 50,
96
+ center: 50
97
+ };
98
+
99
+ /** A lone row leaves the screen entirely; a stacked one only slides by `stackGap`. */
100
+ const EXIT_TRANSLATE_Y_SINGLE = 150;
101
+
102
+ /**
103
+ * Bounded so an animated `gap` cannot grow the cache without limit. The natural
104
+ * key space is 3 enter shapes + 3 positions x hidden x single x one stackGap = 15
105
+ * entries, so this leaves room for a few gap values while staying O(1) memory.
106
+ */
107
+ export const MAX_CACHED_ANIMATIONS = 32;
108
+ const animationCache = new Map();
109
+ function cachedAnimation(key, build) {
110
+ const hit = animationCache.get(key);
111
+ if (hit) {
112
+ return hit;
113
+ }
114
+ if (animationCache.size >= MAX_CACHED_ANIMATIONS) {
115
+ // Map iterates in insertion order, so this evicts the least recently added.
116
+ const oldest = animationCache.keys().next();
117
+ if (!oldest.done) {
118
+ animationCache.delete(oldest.value);
119
+ }
120
+ }
121
+ const built = build();
122
+ animationCache.set(key, built);
123
+ return built;
124
+ }
125
+
126
+ /** Exported so the bounded-growth invariant above is testable. */
127
+ export function toastAnimationCacheSize() {
128
+ return animationCache.size;
129
+ }
130
+
131
+ /** Native only — on web the same shape is played imperatively by `ToastRow`. */
132
+ export function getToastEnterAnimation(position) {
133
+ return cachedAnimation(`enter|${position}`, () => new Keyframe({
134
+ from: {
135
+ opacity: 0,
136
+ transform: [{
137
+ translateY: ENTER_TRANSLATE_Y[position]
138
+ }]
139
+ },
140
+ to: {
141
+ opacity: 1,
142
+ transform: [{
143
+ translateY: 0
144
+ }],
145
+ easing: EASE_OUT_QUART
146
+ }
147
+ }).duration(ENTERING_ANIMATION_DURATION));
148
+ }
149
+ export function getToastExitAnimation({
150
+ position,
151
+ isHiddenByLimit,
152
+ isSingle,
153
+ stackGap
154
+ }) {
155
+ return cachedAnimation(`exit|${position}|${isHiddenByLimit}|${isSingle}|${stackGap}`, () => {
156
+ // A row culled by `visibleToasts` is buried under the stack; sliding it
157
+ // would look wrong, so it only fades.
158
+ if (isHiddenByLimit) {
159
+ return new Keyframe({
160
+ from: {
161
+ opacity: 1
162
+ },
163
+ to: {
164
+ opacity: 0,
165
+ easing: EASE_IN_OUT_CUBIC
166
+ }
167
+ }).duration(ENTERING_ANIMATION_DURATION);
168
+ }
169
+ const distance = isSingle ? EXIT_TRANSLATE_Y_SINGLE : stackGap;
170
+ const translateY = position === 'top-center' ? -distance : distance;
171
+ return new Keyframe({
172
+ from: {
173
+ opacity: 1,
174
+ transform: [{
175
+ translateY: 0
176
+ }]
177
+ },
178
+ to: {
179
+ opacity: 0,
180
+ transform: [{
181
+ translateY
182
+ }],
183
+ easing: EASE_IN_OUT_CUBIC
184
+ }
185
+ })
186
+ // Matches the store's overlay teardown delay, which is also
187
+ // ENTERING_ANIMATION_DURATION — a longer exit would be cut off.
188
+ .duration(ENTERING_ANIMATION_DURATION);
189
+ });
190
+ }
191
+ /**
192
+ * Pure so the platform split is testable without a renderer.
193
+ *
194
+ * INVARIANT: exactly ONE of `entering` / `enterTranslateY` is ever set. Both
195
+ * would play the enter twice; neither would leave the row with no enter animation
196
+ * at all and — on the imperative path — parked at `opacity: 0`, one full
197
+ * `enterTranslateY` away from its slot. A consumer override always wins and always
198
+ * goes through `entering`, on both platforms.
199
+ */
200
+ export function resolveToastEnterAnimation({
201
+ position,
202
+ enterOverride,
203
+ driver
204
+ }) {
205
+ if (enterOverride !== undefined && enterOverride !== 'default') {
206
+ return {
207
+ entering: enterOverride,
208
+ enterTranslateY: undefined
209
+ };
210
+ }
211
+ return driver === 'imperative' ? {
212
+ entering: undefined,
213
+ enterTranslateY: ENTER_TRANSLATE_Y[position]
214
+ } : {
215
+ entering: getToastEnterAnimation(position),
216
+ enterTranslateY: undefined
217
+ };
218
+ }
219
+
220
+ /** Per-toast animation wins over the outlet's; `'default'` opts back in to Bloom's. */
221
+ export const resolveAnimationField = (toastValue, toasterValue, defaultValue) => {
222
+ const resolved = toastValue !== undefined ? toastValue : toasterValue;
223
+ if (resolved === undefined || resolved === 'default') {
224
+ return defaultValue;
225
+ }
226
+ return resolved;
227
+ };
228
+ export const useToastLayoutAnimations = (positionProp, animationProp, isHiddenByLimit, numberOfToasts) => {
229
+ const {
230
+ position: positionCtx,
231
+ gap,
232
+ animation: animationCtx
233
+ } = useToastContext();
234
+ const position = positionProp ?? positionCtx;
235
+ const stackGap = gap ?? toastDefaults.stackGap;
236
+ const reducedMotion = useReducedMotion();
237
+ if (reducedMotion) {
238
+ return {
239
+ entering: undefined,
240
+ exiting: undefined,
241
+ enterTranslateY: undefined
242
+ };
243
+ }
244
+ const defaultExiting = getToastExitAnimation({
245
+ position,
246
+ isHiddenByLimit,
247
+ isSingle: numberOfToasts <= 1,
248
+ stackGap
249
+ });
250
+ return {
251
+ ...resolveToastEnterAnimation({
252
+ position,
253
+ enterOverride: animationProp?.enter !== undefined ? animationProp.enter : animationCtx?.enter,
254
+ driver: TOAST_ENTER_DRIVER
255
+ }),
256
+ // An overflow-culled row always uses Bloom's fade: a consumer's custom exit
257
+ // would animate a row the user cannot even see.
258
+ exiting: isHiddenByLimit ? defaultExiting : resolveAnimationField(animationProp?.exit, animationCtx?.exit, defaultExiting)
259
+ };
260
+ };
261
+ //# sourceMappingURL=animations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","Easing","Keyframe","useReducedMotion","ENTERING_ANIMATION_DURATION","toastDefaults","useToastContext","EASE_OUT_QUART","bezier","EASE_IN_OUT_CUBIC","TOAST_ENTER_DRIVER","OS","easeOutQuartFn","bezierFn","easeInOutCircFn","ENTER_TRANSLATE_Y","center","EXIT_TRANSLATE_Y_SINGLE","MAX_CACHED_ANIMATIONS","animationCache","Map","cachedAnimation","key","build","hit","get","size","oldest","keys","next","done","delete","value","built","set","toastAnimationCacheSize","getToastEnterAnimation","position","from","opacity","transform","translateY","to","easing","duration","getToastExitAnimation","isHiddenByLimit","isSingle","stackGap","distance","resolveToastEnterAnimation","enterOverride","driver","undefined","entering","enterTranslateY","resolveAnimationField","toastValue","toasterValue","defaultValue","resolved","useToastLayoutAnimations","positionProp","animationProp","numberOfToasts","positionCtx","gap","animation","animationCtx","reducedMotion","exiting","defaultExiting","enter","exit"],"sourceRoot":"../../../src","sources":["toast/animations.ts"],"mappings":";;AAAA;AACA;A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AAK,GACnBJ,YAAY,EAAEI,KAAK;MACzBpB,MAAM,EAAE1C;IACV,CAAC,CAAC;IACF;IACA;IACA4D,OAAO,EAAExB,eAAe,GACpByB,cAAc,GACdf,qBAAqB,CACnBO,aAAa,EAAEU,IAAI,EACnBL,YAAY,EAAEK,IAAI,EAClBF,cACF;EACN,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Derived from sonner-native v0.26.4 — src/constants.ts and src/animations.ts
5
+ * (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
6
+ *
7
+ * The two animation durations live HERE rather than in `animations.ts` so
8
+ * `toast-store.ts` never has to import a Reanimated-dependent module: the store
9
+ * stays pure JS and its suite needs zero React Native mocks.
10
+ */
11
+
12
+ /** Fallback row height until a toast has been measured. */
13
+ export const ESTIMATED_TOAST_HEIGHT = 70;
14
+ export const CLOSE_BUTTON_HIT_AREA = 60;
15
+ export const OUTSIDE_PRESS_PADDING = 20;
16
+ /** However deep a stack gets, a buried row never narrows past this scale. */
17
+ export const MIN_STACK_SCALE_X = 0.8;
18
+
19
+ /** Enter animation length; also the auto-close timer's head start and the overlay teardown delay. */
20
+ export const ENTERING_ANIMATION_DURATION = 300;
21
+ export const STACKING_ANIMATION_DURATION = 600;
22
+ export const toastDefaults = {
23
+ duration: 3000,
24
+ position: 'bottom-center',
25
+ /**
26
+ * 0 means "derive from the safe-area inset" — `getInsetValues` then yields
27
+ * `inset + 8`, or 16 when there is no inset. A non-zero default would pin the
28
+ * stack to a fixed offset and ignore the notch / home indicator entirely.
29
+ */
30
+ offset: 0,
31
+ swipeToDismissDirection: 'left',
32
+ /**
33
+ * No default variant: a plain `toast('Saved')` must render neutral. Upstream
34
+ * defaults this to `'info'`, which silently gives every unqualified toast
35
+ * info styling.
36
+ */
37
+ variant: undefined,
38
+ visibleToasts: 3,
39
+ closeButton: false,
40
+ dismissible: true,
41
+ unstyled: false,
42
+ invert: false,
43
+ pauseWhenPageIsHidden: true,
44
+ gap: 8,
45
+ theme: 'system',
46
+ autoWiggleOnUpdate: 'never',
47
+ richColors: false,
48
+ enableStacking: false,
49
+ stackGap: 8,
50
+ allowFontScaling: true
51
+ };
52
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ESTIMATED_TOAST_HEIGHT","CLOSE_BUTTON_HIT_AREA","OUTSIDE_PRESS_PADDING","MIN_STACK_SCALE_X","ENTERING_ANIMATION_DURATION","STACKING_ANIMATION_DURATION","toastDefaults","duration","position","offset","swipeToDismissDirection","variant","undefined","visibleToasts","closeButton","dismissible","unstyled","invert","pauseWhenPageIsHidden","gap","theme","autoWiggleOnUpdate","richColors","enableStacking","stackGap","allowFontScaling"],"sourceRoot":"../../../src","sources":["toast/constants.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA,OAAO,MAAMA,sBAAsB,GAAG,EAAE;AACxC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC;AACA,OAAO,MAAMC,iBAAiB,GAAG,GAAG;;AAEpC;AACA,OAAO,MAAMC,2BAA2B,GAAG,GAAG;AAC9C,OAAO,MAAMC,2BAA2B,GAAG,GAAG;AAE9C,OAAO,MAAMC,aAmBZ,GAAG;EACFC,QAAQ,EAAE,IAAI;EACdC,QAAQ,EAAE,eAAe;EACzB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAE,CAAC;EACTC,uBAAuB,EAAE,MAAM;EAC/B;AACF;AACA;AACA;AACA;EACEC,OAAO,EAAEC,SAAS;EAClBC,aAAa,EAAE,CAAC;EAChBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,IAAI;EACjBC,QAAQ,EAAE,KAAK;EACfC,MAAM,EAAE,KAAK;EACbC,qBAAqB,EAAE,IAAI;EAC3BC,GAAG,EAAE,CAAC;EACNC,KAAK,EAAE,QAAQ;EACfC,kBAAkB,EAAE,OAAO;EAC3BC,UAAU,EAAE,KAAK;EACjBC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE,CAAC;EACXC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Derived from sonner-native v0.26.4 — src/context.tsx
5
+ * (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
6
+ *
7
+ * Two contexts, split by change frequency: the resolved `Toaster` configuration
8
+ * (stable for the lifetime of the outlet) and the live stack state (changes on
9
+ * every measurement). Splitting them keeps a height measurement from
10
+ * re-rendering every row's config-derived memo.
11
+ *
12
+ * Upstream also passes `addToast` through the stable context; Bloom's rows talk
13
+ * to `toastStore` directly, which is the single authority.
14
+ */
15
+ import * as React from 'react';
16
+ export const ToastContext = /*#__PURE__*/React.createContext(null);
17
+ ToastContext.displayName = 'BloomToastContext';
18
+ export const DynamicToastContext = /*#__PURE__*/React.createContext(null);
19
+ DynamicToastContext.displayName = 'BloomDynamicToastContext';
20
+ export const useToastContext = () => {
21
+ const context = React.useContext(ToastContext);
22
+ if (!context) {
23
+ throw new Error('useToastContext must be used within a <ToastOutlet>');
24
+ }
25
+ return context;
26
+ };
27
+ export const useDynamicToastContext = () => {
28
+ const context = React.useContext(DynamicToastContext);
29
+ if (!context) {
30
+ throw new Error('useDynamicToastContext must be used within a <ToastOutlet>');
31
+ }
32
+ return context;
33
+ };
34
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","ToastContext","createContext","displayName","DynamicToastContext","useToastContext","context","useContext","Error","useDynamicToastContext"],"sourceRoot":"../../../src","sources":["toast/context.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAM9B,OAAO,MAAMC,YAAY,gBAAGD,KAAK,CAACE,aAAa,CAC7C,IACF,CAAC;AACDD,YAAY,CAACE,WAAW,GAAG,mBAAmB;AAE9C,OAAO,MAAMC,mBAAmB,gBAC9BJ,KAAK,CAACE,aAAa,CAAiC,IAAI,CAAC;AAC3DE,mBAAmB,CAACD,WAAW,GAAG,0BAA0B;AAE5D,OAAO,MAAME,eAAe,GAAGA,CAAA,KAA8B;EAC3D,MAAMC,OAAO,GAAGN,KAAK,CAACO,UAAU,CAACN,YAAY,CAAC;EAC9C,IAAI,CAACK,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CAAC,qDAAqD,CAAC;EACxE;EACA,OAAOF,OAAO;AAChB,CAAC;AAED,OAAO,MAAMG,sBAAsB,GAAGA,CAAA,KAA+B;EACnE,MAAMH,OAAO,GAAGN,KAAK,CAACO,UAAU,CAACH,mBAAmB,CAAC;EACrD,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,4DACF,CAAC;EACH;EACA,OAAOF,OAAO;AAChB,CAAC","ignoreList":[]}