@oxy.so/bloom 6.0.0 → 6.2.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 (293) hide show
  1. package/README.md +1 -1
  2. package/docs/adoption-matrix.mdx +5 -3
  3. package/docs/chat-composer.mdx +5 -1
  4. package/docs/cover-header.mdx +56 -0
  5. package/docs/message-media.mdx +5 -0
  6. package/docs/sticker.mdx +64 -0
  7. package/lib/commonjs/ai-profile-card/AiProfileCard.js +186 -263
  8. package/lib/commonjs/ai-profile-card/AiProfileCard.js.map +1 -1
  9. package/lib/commonjs/chat-composer/SuggestionList.js +3 -1
  10. package/lib/commonjs/chat-composer/SuggestionList.js.map +1 -1
  11. package/lib/commonjs/chat-composer/SuggestionList.web.js +3 -1
  12. package/lib/commonjs/chat-composer/SuggestionList.web.js.map +1 -1
  13. package/lib/commonjs/chat-composer/create-suggestion-list.js +64 -10
  14. package/lib/commonjs/chat-composer/create-suggestion-list.js.map +1 -1
  15. package/lib/commonjs/chat-composer/messages.js +7 -0
  16. package/lib/commonjs/chat-composer/messages.js.map +1 -1
  17. package/lib/commonjs/cover-header/CoverHeader.js +83 -0
  18. package/lib/commonjs/cover-header/CoverHeader.js.map +1 -0
  19. package/lib/commonjs/cover-header/CoverImage.js +72 -0
  20. package/lib/commonjs/cover-header/CoverImage.js.map +1 -0
  21. package/lib/commonjs/cover-header/index.js +13 -0
  22. package/lib/commonjs/cover-header/index.js.map +1 -0
  23. package/lib/commonjs/cover-header/types.js +6 -0
  24. package/lib/commonjs/cover-header/types.js.map +1 -0
  25. package/lib/commonjs/index.js +972 -938
  26. package/lib/commonjs/index.js.map +1 -1
  27. package/lib/commonjs/index.web.js +982 -948
  28. package/lib/commonjs/index.web.js.map +1 -1
  29. package/lib/commonjs/locale/translations/ar.js +7 -0
  30. package/lib/commonjs/locale/translations/ar.js.map +1 -1
  31. package/lib/commonjs/locale/translations/bn.js +7 -0
  32. package/lib/commonjs/locale/translations/bn.js.map +1 -1
  33. package/lib/commonjs/locale/translations/ca.js +7 -0
  34. package/lib/commonjs/locale/translations/ca.js.map +1 -1
  35. package/lib/commonjs/locale/translations/de.js +7 -0
  36. package/lib/commonjs/locale/translations/de.js.map +1 -1
  37. package/lib/commonjs/locale/translations/es.js +7 -0
  38. package/lib/commonjs/locale/translations/es.js.map +1 -1
  39. package/lib/commonjs/locale/translations/fr.js +7 -0
  40. package/lib/commonjs/locale/translations/fr.js.map +1 -1
  41. package/lib/commonjs/locale/translations/hi.js +7 -0
  42. package/lib/commonjs/locale/translations/hi.js.map +1 -1
  43. package/lib/commonjs/locale/translations/id.js +7 -0
  44. package/lib/commonjs/locale/translations/id.js.map +1 -1
  45. package/lib/commonjs/locale/translations/it.js +7 -0
  46. package/lib/commonjs/locale/translations/it.js.map +1 -1
  47. package/lib/commonjs/locale/translations/ja.js +7 -0
  48. package/lib/commonjs/locale/translations/ja.js.map +1 -1
  49. package/lib/commonjs/locale/translations/pt.js +7 -0
  50. package/lib/commonjs/locale/translations/pt.js.map +1 -1
  51. package/lib/commonjs/locale/translations/ru.js +7 -0
  52. package/lib/commonjs/locale/translations/ru.js.map +1 -1
  53. package/lib/commonjs/locale/translations/tr.js +7 -0
  54. package/lib/commonjs/locale/translations/tr.js.map +1 -1
  55. package/lib/commonjs/locale/translations/zh.js +7 -0
  56. package/lib/commonjs/locale/translations/zh.js.map +1 -1
  57. package/lib/commonjs/message-media/StickerMessage.js +11 -2
  58. package/lib/commonjs/message-media/StickerMessage.js.map +1 -1
  59. package/lib/commonjs/sticker/Sticker.js +14 -0
  60. package/lib/commonjs/sticker/Sticker.js.map +1 -0
  61. package/lib/commonjs/sticker/Sticker.web.js +14 -0
  62. package/lib/commonjs/sticker/Sticker.web.js.map +1 -0
  63. package/lib/commonjs/sticker/create-sticker.js +118 -0
  64. package/lib/commonjs/sticker/create-sticker.js.map +1 -0
  65. package/lib/commonjs/sticker/index.js +26 -0
  66. package/lib/commonjs/sticker/index.js.map +1 -0
  67. package/lib/commonjs/sticker/index.web.js +26 -0
  68. package/lib/commonjs/sticker/index.web.js.map +1 -0
  69. package/lib/commonjs/sticker/lottie-module.js +97 -0
  70. package/lib/commonjs/sticker/lottie-module.js.map +1 -0
  71. package/lib/commonjs/sticker/lottie-module.web.js +96 -0
  72. package/lib/commonjs/sticker/lottie-module.web.js.map +1 -0
  73. package/lib/commonjs/sticker/types.js +6 -0
  74. package/lib/commonjs/sticker/types.js.map +1 -0
  75. package/lib/module/ai-profile-card/AiProfileCard.js +185 -262
  76. package/lib/module/ai-profile-card/AiProfileCard.js.map +1 -1
  77. package/lib/module/chat-composer/SuggestionList.js +3 -1
  78. package/lib/module/chat-composer/SuggestionList.js.map +1 -1
  79. package/lib/module/chat-composer/SuggestionList.web.js +3 -1
  80. package/lib/module/chat-composer/SuggestionList.web.js.map +1 -1
  81. package/lib/module/chat-composer/create-suggestion-list.js +64 -10
  82. package/lib/module/chat-composer/create-suggestion-list.js.map +1 -1
  83. package/lib/module/chat-composer/messages.js +7 -0
  84. package/lib/module/chat-composer/messages.js.map +1 -1
  85. package/lib/module/cover-header/CoverHeader.js +78 -0
  86. package/lib/module/cover-header/CoverHeader.js.map +1 -0
  87. package/lib/module/cover-header/CoverImage.js +68 -0
  88. package/lib/module/cover-header/CoverImage.js.map +1 -0
  89. package/lib/module/cover-header/index.js +4 -0
  90. package/lib/module/cover-header/index.js.map +1 -0
  91. package/lib/module/cover-header/types.js +4 -0
  92. package/lib/module/cover-header/types.js.map +1 -0
  93. package/lib/module/index.js +2 -0
  94. package/lib/module/index.js.map +1 -1
  95. package/lib/module/index.web.js +2 -0
  96. package/lib/module/index.web.js.map +1 -1
  97. package/lib/module/locale/translations/ar.js +7 -0
  98. package/lib/module/locale/translations/ar.js.map +1 -1
  99. package/lib/module/locale/translations/bn.js +7 -0
  100. package/lib/module/locale/translations/bn.js.map +1 -1
  101. package/lib/module/locale/translations/ca.js +7 -0
  102. package/lib/module/locale/translations/ca.js.map +1 -1
  103. package/lib/module/locale/translations/de.js +7 -0
  104. package/lib/module/locale/translations/de.js.map +1 -1
  105. package/lib/module/locale/translations/es.js +7 -0
  106. package/lib/module/locale/translations/es.js.map +1 -1
  107. package/lib/module/locale/translations/fr.js +7 -0
  108. package/lib/module/locale/translations/fr.js.map +1 -1
  109. package/lib/module/locale/translations/hi.js +7 -0
  110. package/lib/module/locale/translations/hi.js.map +1 -1
  111. package/lib/module/locale/translations/id.js +7 -0
  112. package/lib/module/locale/translations/id.js.map +1 -1
  113. package/lib/module/locale/translations/it.js +7 -0
  114. package/lib/module/locale/translations/it.js.map +1 -1
  115. package/lib/module/locale/translations/ja.js +7 -0
  116. package/lib/module/locale/translations/ja.js.map +1 -1
  117. package/lib/module/locale/translations/pt.js +7 -0
  118. package/lib/module/locale/translations/pt.js.map +1 -1
  119. package/lib/module/locale/translations/ru.js +7 -0
  120. package/lib/module/locale/translations/ru.js.map +1 -1
  121. package/lib/module/locale/translations/tr.js +7 -0
  122. package/lib/module/locale/translations/tr.js.map +1 -1
  123. package/lib/module/locale/translations/zh.js +7 -0
  124. package/lib/module/locale/translations/zh.js.map +1 -1
  125. package/lib/module/message-media/StickerMessage.js +11 -2
  126. package/lib/module/message-media/StickerMessage.js.map +1 -1
  127. package/lib/module/sticker/Sticker.js +11 -0
  128. package/lib/module/sticker/Sticker.js.map +1 -0
  129. package/lib/module/sticker/Sticker.web.js +11 -0
  130. package/lib/module/sticker/Sticker.web.js.map +1 -0
  131. package/lib/module/sticker/create-sticker.js +113 -0
  132. package/lib/module/sticker/create-sticker.js.map +1 -0
  133. package/lib/module/sticker/index.js +5 -0
  134. package/lib/module/sticker/index.js.map +1 -0
  135. package/lib/module/sticker/index.web.js +10 -0
  136. package/lib/module/sticker/index.web.js.map +1 -0
  137. package/lib/module/sticker/lottie-module.js +90 -0
  138. package/lib/module/sticker/lottie-module.js.map +1 -0
  139. package/lib/module/sticker/lottie-module.web.js +88 -0
  140. package/lib/module/sticker/lottie-module.web.js.map +1 -0
  141. package/lib/module/sticker/types.js +4 -0
  142. package/lib/module/sticker/types.js.map +1 -0
  143. package/lib/typescript/commonjs/ai-profile-card/AiProfileCard.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/chat-composer/SuggestionList.d.ts +1 -1
  145. package/lib/typescript/commonjs/chat-composer/SuggestionList.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/chat-composer/SuggestionList.web.d.ts +1 -1
  147. package/lib/typescript/commonjs/chat-composer/SuggestionList.web.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/chat-composer/create-suggestion-list.d.ts +4 -2
  149. package/lib/typescript/commonjs/chat-composer/create-suggestion-list.d.ts.map +1 -1
  150. package/lib/typescript/commonjs/chat-composer/messages.d.ts +6 -0
  151. package/lib/typescript/commonjs/chat-composer/messages.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/chat-composer/types.d.ts +17 -0
  153. package/lib/typescript/commonjs/chat-composer/types.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/cover-header/CoverHeader.d.ts +21 -0
  155. package/lib/typescript/commonjs/cover-header/CoverHeader.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/cover-header/CoverImage.d.ts +11 -0
  157. package/lib/typescript/commonjs/cover-header/CoverImage.d.ts.map +1 -0
  158. package/lib/typescript/commonjs/cover-header/index.d.ts +3 -0
  159. package/lib/typescript/commonjs/cover-header/index.d.ts.map +1 -0
  160. package/lib/typescript/commonjs/cover-header/types.d.ts +33 -0
  161. package/lib/typescript/commonjs/cover-header/types.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/index.d.ts +3 -0
  163. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  164. package/lib/typescript/commonjs/index.web.d.ts +3 -0
  165. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  166. package/lib/typescript/commonjs/locale/translations/ar.d.ts.map +1 -1
  167. package/lib/typescript/commonjs/locale/translations/bn.d.ts.map +1 -1
  168. package/lib/typescript/commonjs/locale/translations/ca.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/locale/translations/de.d.ts.map +1 -1
  170. package/lib/typescript/commonjs/locale/translations/es.d.ts.map +1 -1
  171. package/lib/typescript/commonjs/locale/translations/fr.d.ts.map +1 -1
  172. package/lib/typescript/commonjs/locale/translations/hi.d.ts.map +1 -1
  173. package/lib/typescript/commonjs/locale/translations/id.d.ts.map +1 -1
  174. package/lib/typescript/commonjs/locale/translations/it.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/locale/translations/ja.d.ts.map +1 -1
  176. package/lib/typescript/commonjs/locale/translations/pt.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/locale/translations/ru.d.ts.map +1 -1
  178. package/lib/typescript/commonjs/locale/translations/tr.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/locale/translations/zh.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/message-media/StickerMessage.d.ts +3 -2
  181. package/lib/typescript/commonjs/message-media/StickerMessage.d.ts.map +1 -1
  182. package/lib/typescript/commonjs/message-media/types.d.ts +3 -0
  183. package/lib/typescript/commonjs/message-media/types.d.ts.map +1 -1
  184. package/lib/typescript/commonjs/sticker/Sticker.d.ts +3 -0
  185. package/lib/typescript/commonjs/sticker/Sticker.d.ts.map +1 -0
  186. package/lib/typescript/commonjs/sticker/Sticker.web.d.ts +3 -0
  187. package/lib/typescript/commonjs/sticker/Sticker.web.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/sticker/create-sticker.d.ts +23 -0
  189. package/lib/typescript/commonjs/sticker/create-sticker.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/sticker/index.d.ts +4 -0
  191. package/lib/typescript/commonjs/sticker/index.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/sticker/index.web.d.ts +4 -0
  193. package/lib/typescript/commonjs/sticker/index.web.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/sticker/lottie-module.d.ts +23 -0
  195. package/lib/typescript/commonjs/sticker/lottie-module.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/sticker/lottie-module.web.d.ts +18 -0
  197. package/lib/typescript/commonjs/sticker/lottie-module.web.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/sticker/types.d.ts +43 -0
  199. package/lib/typescript/commonjs/sticker/types.d.ts.map +1 -0
  200. package/lib/typescript/module/ai-profile-card/AiProfileCard.d.ts.map +1 -1
  201. package/lib/typescript/module/chat-composer/SuggestionList.d.ts +1 -1
  202. package/lib/typescript/module/chat-composer/SuggestionList.d.ts.map +1 -1
  203. package/lib/typescript/module/chat-composer/SuggestionList.web.d.ts +1 -1
  204. package/lib/typescript/module/chat-composer/SuggestionList.web.d.ts.map +1 -1
  205. package/lib/typescript/module/chat-composer/create-suggestion-list.d.ts +4 -2
  206. package/lib/typescript/module/chat-composer/create-suggestion-list.d.ts.map +1 -1
  207. package/lib/typescript/module/chat-composer/messages.d.ts +6 -0
  208. package/lib/typescript/module/chat-composer/messages.d.ts.map +1 -1
  209. package/lib/typescript/module/chat-composer/types.d.ts +17 -0
  210. package/lib/typescript/module/chat-composer/types.d.ts.map +1 -1
  211. package/lib/typescript/module/cover-header/CoverHeader.d.ts +21 -0
  212. package/lib/typescript/module/cover-header/CoverHeader.d.ts.map +1 -0
  213. package/lib/typescript/module/cover-header/CoverImage.d.ts +11 -0
  214. package/lib/typescript/module/cover-header/CoverImage.d.ts.map +1 -0
  215. package/lib/typescript/module/cover-header/index.d.ts +3 -0
  216. package/lib/typescript/module/cover-header/index.d.ts.map +1 -0
  217. package/lib/typescript/module/cover-header/types.d.ts +33 -0
  218. package/lib/typescript/module/cover-header/types.d.ts.map +1 -0
  219. package/lib/typescript/module/index.d.ts +3 -0
  220. package/lib/typescript/module/index.d.ts.map +1 -1
  221. package/lib/typescript/module/index.web.d.ts +3 -0
  222. package/lib/typescript/module/index.web.d.ts.map +1 -1
  223. package/lib/typescript/module/locale/translations/ar.d.ts.map +1 -1
  224. package/lib/typescript/module/locale/translations/bn.d.ts.map +1 -1
  225. package/lib/typescript/module/locale/translations/ca.d.ts.map +1 -1
  226. package/lib/typescript/module/locale/translations/de.d.ts.map +1 -1
  227. package/lib/typescript/module/locale/translations/es.d.ts.map +1 -1
  228. package/lib/typescript/module/locale/translations/fr.d.ts.map +1 -1
  229. package/lib/typescript/module/locale/translations/hi.d.ts.map +1 -1
  230. package/lib/typescript/module/locale/translations/id.d.ts.map +1 -1
  231. package/lib/typescript/module/locale/translations/it.d.ts.map +1 -1
  232. package/lib/typescript/module/locale/translations/ja.d.ts.map +1 -1
  233. package/lib/typescript/module/locale/translations/pt.d.ts.map +1 -1
  234. package/lib/typescript/module/locale/translations/ru.d.ts.map +1 -1
  235. package/lib/typescript/module/locale/translations/tr.d.ts.map +1 -1
  236. package/lib/typescript/module/locale/translations/zh.d.ts.map +1 -1
  237. package/lib/typescript/module/message-media/StickerMessage.d.ts +3 -2
  238. package/lib/typescript/module/message-media/StickerMessage.d.ts.map +1 -1
  239. package/lib/typescript/module/message-media/types.d.ts +3 -0
  240. package/lib/typescript/module/message-media/types.d.ts.map +1 -1
  241. package/lib/typescript/module/sticker/Sticker.d.ts +3 -0
  242. package/lib/typescript/module/sticker/Sticker.d.ts.map +1 -0
  243. package/lib/typescript/module/sticker/Sticker.web.d.ts +3 -0
  244. package/lib/typescript/module/sticker/Sticker.web.d.ts.map +1 -0
  245. package/lib/typescript/module/sticker/create-sticker.d.ts +23 -0
  246. package/lib/typescript/module/sticker/create-sticker.d.ts.map +1 -0
  247. package/lib/typescript/module/sticker/index.d.ts +4 -0
  248. package/lib/typescript/module/sticker/index.d.ts.map +1 -0
  249. package/lib/typescript/module/sticker/index.web.d.ts +4 -0
  250. package/lib/typescript/module/sticker/index.web.d.ts.map +1 -0
  251. package/lib/typescript/module/sticker/lottie-module.d.ts +23 -0
  252. package/lib/typescript/module/sticker/lottie-module.d.ts.map +1 -0
  253. package/lib/typescript/module/sticker/lottie-module.web.d.ts +18 -0
  254. package/lib/typescript/module/sticker/lottie-module.web.d.ts.map +1 -0
  255. package/lib/typescript/module/sticker/types.d.ts +43 -0
  256. package/lib/typescript/module/sticker/types.d.ts.map +1 -0
  257. package/package.json +48 -1
  258. package/src/ai-profile-card/AiProfileCard.tsx +159 -241
  259. package/src/chat-composer/SuggestionList.tsx +2 -1
  260. package/src/chat-composer/SuggestionList.web.tsx +2 -1
  261. package/src/chat-composer/create-suggestion-list.tsx +54 -8
  262. package/src/chat-composer/messages.ts +9 -0
  263. package/src/chat-composer/types.ts +17 -0
  264. package/src/cover-header/CoverHeader.tsx +75 -0
  265. package/src/cover-header/CoverImage.tsx +60 -0
  266. package/src/cover-header/index.ts +3 -0
  267. package/src/cover-header/types.ts +30 -0
  268. package/src/index.ts +3 -0
  269. package/src/index.web.ts +3 -0
  270. package/src/locale/translations/ar.ts +3 -0
  271. package/src/locale/translations/bn.ts +3 -0
  272. package/src/locale/translations/ca.ts +3 -0
  273. package/src/locale/translations/de.ts +3 -0
  274. package/src/locale/translations/es.ts +3 -0
  275. package/src/locale/translations/fr.ts +3 -0
  276. package/src/locale/translations/hi.ts +3 -0
  277. package/src/locale/translations/id.ts +3 -0
  278. package/src/locale/translations/it.ts +3 -0
  279. package/src/locale/translations/ja.ts +3 -0
  280. package/src/locale/translations/pt.ts +3 -0
  281. package/src/locale/translations/ru.ts +3 -0
  282. package/src/locale/translations/tr.ts +3 -0
  283. package/src/locale/translations/zh.ts +3 -0
  284. package/src/message-media/StickerMessage.tsx +21 -8
  285. package/src/message-media/types.ts +3 -0
  286. package/src/sticker/Sticker.tsx +5 -0
  287. package/src/sticker/Sticker.web.tsx +5 -0
  288. package/src/sticker/create-sticker.tsx +129 -0
  289. package/src/sticker/index.ts +3 -0
  290. package/src/sticker/index.web.ts +8 -0
  291. package/src/sticker/lottie-module.ts +109 -0
  292. package/src/sticker/lottie-module.web.ts +107 -0
  293. package/src/sticker/types.ts +45 -0
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createSticker = createSticker;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeReanimated = require("react-native-reanimated");
10
+ var _messages = require("../locale/messages.js");
11
+ var _messages2 = require("../message-media/messages.js");
12
+ var _parts = require("../message-media/parts.js");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
+ /** A sticker's transparent parts must stay transparent: no placeholder colour. */
16
+ const TRANSPARENT = 'transparent';
17
+
18
+ /**
19
+ * A sticker, animated when it can be and still when it cannot.
20
+ *
21
+ * The still `fallback` is ALWAYS drawn first and stays until the animation
22
+ * reports it has loaded, so a sticker never flashes blank while its Lottie file
23
+ * arrives — and when the animation cannot play at all (no player installed on
24
+ * this platform, a failed load, a person who asked for reduced motion) the still
25
+ * is simply what remains. Every one of those outcomes looks like a sticker.
26
+ *
27
+ * Draws no surface: no background, no radius, no padding. A sticker with a
28
+ * bubble behind it is a picture of a sticker. `StickerMessage` is this plus the
29
+ * chat affordances (press, sending, failed).
30
+ */
31
+ function createSticker({
32
+ loadLottiePlayer,
33
+ warnLottieUnavailable
34
+ }) {
35
+ function StickerComponent({
36
+ animation,
37
+ fallback,
38
+ size = 128,
39
+ loop = true,
40
+ paused = false,
41
+ accessibilityLabel: accessibilityLabelProp,
42
+ decorative = false,
43
+ style,
44
+ testID
45
+ }) {
46
+ const {
47
+ messages
48
+ } = (0, _messages.useMessages)(_messages2.MESSAGE_MEDIA_MESSAGES);
49
+ const reducedMotion = (0, _reactNativeReanimated.useReducedMotion)();
50
+ const [loaded, setLoaded] = (0, _react.useState)(false);
51
+ const [failed, setFailed] = (0, _react.useState)(false);
52
+
53
+ // A new animation starts from its still again.
54
+ (0, _react.useEffect)(() => {
55
+ setLoaded(false);
56
+ setFailed(false);
57
+ }, [animation]);
58
+ const Player = animation && !reducedMotion && !failed ? loadLottiePlayer() : null;
59
+ (0, _react.useEffect)(() => {
60
+ if (animation && !reducedMotion && !Player) warnLottieUnavailable();
61
+ }, [animation, reducedMotion, Player]);
62
+ const onLoad = (0, _react.useCallback)(() => setLoaded(true), []);
63
+ const onError = (0, _react.useCallback)(() => setFailed(true), []);
64
+ const showStill = !Player || !loaded;
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
66
+ accessible: !decorative,
67
+ accessibilityRole: decorative ? undefined : 'image',
68
+ accessibilityLabel: decorative ? undefined : accessibilityLabelProp ?? messages.sticker,
69
+ "aria-hidden": decorative,
70
+ style: [{
71
+ width: size,
72
+ height: size,
73
+ position: 'relative'
74
+ }, style ?? null],
75
+ testID: testID,
76
+ children: [showStill ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
77
+ style: {
78
+ position: 'absolute',
79
+ top: 0,
80
+ left: 0,
81
+ width: size,
82
+ height: size
83
+ },
84
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_parts.MediaImage, {
85
+ source: fallback,
86
+ placeholder: TRANSPARENT,
87
+ resizeMode: "contain",
88
+ testID: testID ? `${testID}-still` : undefined
89
+ })
90
+ }) : null, Player && animation ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
91
+ style: {
92
+ position: 'absolute',
93
+ top: 0,
94
+ left: 0,
95
+ width: size,
96
+ height: size,
97
+ opacity: loaded ? 1 : 0
98
+ },
99
+ testID: testID ? `${testID}-animation` : undefined,
100
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Player, {
101
+ uri: animation,
102
+ loop: loop,
103
+ paused: paused,
104
+ onLoad: onLoad,
105
+ onError: onError,
106
+ style: {
107
+ width: size,
108
+ height: size
109
+ }
110
+ })
111
+ }) : null]
112
+ });
113
+ }
114
+ const Sticker = /*#__PURE__*/(0, _react.memo)(StickerComponent);
115
+ Sticker.displayName = 'Sticker';
116
+ return Sticker;
117
+ }
118
+ //# sourceMappingURL=create-sticker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_messages","_messages2","_parts","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TRANSPARENT","createSticker","loadLottiePlayer","warnLottieUnavailable","StickerComponent","animation","fallback","size","loop","paused","accessibilityLabel","accessibilityLabelProp","decorative","style","testID","messages","useMessages","MESSAGE_MEDIA_MESSAGES","reducedMotion","useReducedMotion","loaded","setLoaded","useState","failed","setFailed","useEffect","Player","onLoad","useCallback","onError","showStill","jsxs","View","accessible","accessibilityRole","undefined","sticker","width","height","position","children","jsx","top","left","MediaImage","source","placeholder","resizeMode","opacity","uri","Sticker","memo","displayName"],"sourceRoot":"../../../src","sources":["sticker/create-sticker.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAoD,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,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E+B,MAAM,EAAE/B;UAAK;QAAE,CACtC;MAAC,CACE,CAAC,GACL,IAAI;IAAA,CACJ,CAAC;EAEX;EAEA,MAAM2C,OAAO,gBAAG,IAAAC,WAAI,EAAC/C,gBAAgB,CAAC;EACtC8C,OAAO,CAACE,WAAW,GAAG,SAAS;EAC/B,OAAOF,OAAO;AAChB","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Sticker", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Sticker.Sticker;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "provideLottiePlayer", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _lottieModule.provideLottiePlayer;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "resetLottiePlayer", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _lottieModule.resetLottiePlayer;
22
+ }
23
+ });
24
+ var _Sticker = require("./Sticker");
25
+ var _lottieModule = require("./lottie-module");
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Sticker","require","_lottieModule"],"sourceRoot":"../../../src","sources":["sticker/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Sticker", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _StickerWeb.Sticker;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "provideLottiePlayer", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _lottieModuleWeb.provideLottiePlayer;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "resetLottiePlayer", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _lottieModuleWeb.resetLottiePlayer;
22
+ }
23
+ });
24
+ var _StickerWeb = require("./Sticker.web.js");
25
+ var _lottieModuleWeb = require("./lottie-module.web.js");
26
+ //# sourceMappingURL=index.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_StickerWeb","require","_lottieModuleWeb"],"sourceRoot":"../../../src","sources":["sticker/index.web.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA","ignoreList":[]}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadLottiePlayer = loadLottiePlayer;
7
+ exports.provideLottiePlayer = provideLottiePlayer;
8
+ exports.resetLottiePlayer = resetLottiePlayer;
9
+ exports.warnLottieUnavailable = warnLottieUnavailable;
10
+ var _react = require("react");
11
+ /**
12
+ * The optional-peer boundary for the NATIVE Lottie player, `lottie-react-native`.
13
+ *
14
+ * Same contract as `media-flight/expo-video-module.ts`, and for the same reason:
15
+ * Bloom ships no native code, so an app that shows no animated sticker must not
16
+ * be made to install a native module. The `require` is a string literal as a
17
+ * direct statement of a `try` block — the one shape Metro collects as an
18
+ * optional dependency — and the `typeof require` guard stays OUTSIDE the try.
19
+ *
20
+ * Whatever player loads is adapted to {@link LottiePlayerProps}, so `Sticker`
21
+ * drives the native and the web player (`lottie-module.web.ts`) the same way.
22
+ */
23
+
24
+ /** The slice of `lottie-react-native`'s `LottieView` Bloom depends on. */
25
+
26
+ let providedPlayer;
27
+ let loadedPlayer;
28
+ let hasWarned = false;
29
+
30
+ /** Tests (and an app with its own build of the player) hand one in here. */
31
+ function provideLottiePlayer(player) {
32
+ providedPlayer = player;
33
+ }
34
+
35
+ /** Forget the loaded player — for tests. */
36
+ function resetLottiePlayer() {
37
+ providedPlayer = undefined;
38
+ loadedPlayer = undefined;
39
+ hasWarned = false;
40
+ }
41
+ function isComponent(candidate) {
42
+ if (typeof candidate === 'function') return true;
43
+ return typeof candidate === 'object' && candidate !== null && '$$typeof' in candidate;
44
+ }
45
+ function adapt(LottieView) {
46
+ function NativeLottiePlayer({
47
+ uri,
48
+ loop,
49
+ paused,
50
+ onLoad,
51
+ onError,
52
+ style
53
+ }) {
54
+ const ref = (0, _react.useRef)(null);
55
+ (0, _react.useEffect)(() => {
56
+ if (paused) ref.current?.pause();else ref.current?.resume();
57
+ }, [paused]);
58
+ return /*#__PURE__*/(0, _react.createElement)(LottieView, {
59
+ ref,
60
+ source: {
61
+ uri
62
+ },
63
+ autoPlay: !paused,
64
+ loop,
65
+ resizeMode: 'contain',
66
+ onAnimationLoaded: onLoad,
67
+ onAnimationFailure: onError,
68
+ style
69
+ });
70
+ }
71
+ return NativeLottiePlayer;
72
+ }
73
+
74
+ /** The native player, adapted, or `null` when `lottie-react-native` is not installed. */
75
+ function loadLottiePlayer() {
76
+ if (providedPlayer !== undefined && providedPlayer !== null) return providedPlayer;
77
+ if (loadedPlayer !== undefined) return loadedPlayer;
78
+ loadedPlayer = null;
79
+ if (typeof require === 'undefined') return loadedPlayer;
80
+ try {
81
+ const loaded = require('lottie-react-native');
82
+ const view = isComponent(loaded) ? loaded : loaded?.default;
83
+ if (isComponent(view)) loadedPlayer = adapt(view);
84
+ } catch {
85
+ loadedPlayer = null;
86
+ }
87
+ return loadedPlayer;
88
+ }
89
+
90
+ /** One dev warning per module lifetime: a still sticker looks like a working one. */
91
+ function warnLottieUnavailable() {
92
+ if (process.env.NODE_ENV === 'production' || hasWarned) return;
93
+ hasWarned = true;
94
+ // eslint-disable-next-line no-console
95
+ console.warn('[Bloom] An animated Sticker fell back to its still image: the optional peer ' + '`lottie-react-native` could not be loaded. Install it (`npx expo install ' + 'lottie-react-native`) to animate stickers.');
96
+ }
97
+ //# sourceMappingURL=lottie-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","providedPlayer","loadedPlayer","hasWarned","provideLottiePlayer","player","resetLottiePlayer","undefined","isComponent","candidate","adapt","LottieView","NativeLottiePlayer","uri","loop","paused","onLoad","onError","style","ref","useRef","useEffect","current","pause","resume","createElement","source","autoPlay","resizeMode","onAnimationLoaded","onAnimationFailure","loadLottiePlayer","loaded","view","default","warnLottieUnavailable","process","env","NODE_ENV","console","warn"],"sourceRoot":"../../../src","sources":["sticker/lottie-module.ts"],"mappings":";;;;;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;;AAkBA,IAAIC,cAAmE;AACvE,IAAIC,YAAiE;AACrE,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACO,SAASC,mBAAmBA,CAACC,MAA+C,EAAQ;EACzFJ,cAAc,GAAGI,MAAM;AACzB;;AAEA;AACO,SAASC,iBAAiBA,CAAA,EAAS;EACxCL,cAAc,GAAGM,SAAS;EAC1BL,YAAY,GAAGK,SAAS;EACxBJ,SAAS,GAAG,KAAK;AACnB;AAEA,SAASK,WAAWA,CAACC,SAAkB,EAA+B;EACpE,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE,OAAO,IAAI;EAChD,OAAO,OAAOA,SAAS,KAAK,QAAQ,IAAIA,SAAS,KAAK,IAAI,IAAI,UAAU,IAAIA,SAAS;AACvF;AAEA,SAASC,KAAKA,CAACC,UAA0B,EAAoC;EAC3E,SAASC,kBAAkBA,CAAC;IAAEC,GAAG;IAAEC,IAAI;IAAEC,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC;EAAyB,CAAC,EAAE;IAC5F,MAAMC,GAAG,GAAG,IAAAC,aAAM,EAA0B,IAAI,CAAC;IACjD,IAAAC,gBAAS,EAAC,MAAM;MACd,IAAIN,MAAM,EAAEI,GAAG,CAACG,OAAO,EAAEC,KAAK,CAAC,CAAC,CAAC,KAC5BJ,GAAG,CAACG,OAAO,EAAEE,MAAM,CAAC,CAAC;IAC5B,CAAC,EAAE,CA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ayer = loadLottiePlayer;
7
+ exports.provideLottiePlayer = provideLottiePlayer;
8
+ exports.resetLottiePlayer = resetLottiePlayer;
9
+ exports.warnLottieUnavailable = warnLottieUnavailable;
10
+ var _react = require("react");
11
+ /**
12
+ * The optional-peer boundary for the WEB Lottie player,
13
+ * `@lottiefiles/dotlottie-react` — the web half of `lottie-module.ts`, with the
14
+ * same loading contract and the same adapted surface.
15
+ *
16
+ * dotLottie draws with ThorVG compiled to WebAssembly, which plays both `.lottie`
17
+ * archives and plain Lottie JSON, and exposes its instance through a ref
18
+ * callback rather than props: load, failure and pause all go through it.
19
+ */
20
+
21
+ let providedPlayer;
22
+ let loadedPlayer;
23
+ let hasWarned = false;
24
+ function provideLottiePlayer(player) {
25
+ providedPlayer = player;
26
+ }
27
+
28
+ /** Forget the loaded player — for tests. */
29
+ function resetLottiePlayer() {
30
+ providedPlayer = undefined;
31
+ loadedPlayer = undefined;
32
+ hasWarned = false;
33
+ }
34
+ function isComponent(candidate) {
35
+ if (typeof candidate === 'function') return true;
36
+ return typeof candidate === 'object' && candidate !== null && '$$typeof' in candidate;
37
+ }
38
+ function adapt(DotLottieReact) {
39
+ function WebLottiePlayer({
40
+ uri,
41
+ loop,
42
+ paused,
43
+ onLoad,
44
+ onError,
45
+ style
46
+ }) {
47
+ const instance = (0, _react.useRef)(null);
48
+ const callbacks = (0, _react.useRef)({
49
+ onLoad,
50
+ onError
51
+ });
52
+ callbacks.current = {
53
+ onLoad,
54
+ onError
55
+ };
56
+ (0, _react.useEffect)(() => {
57
+ if (paused) instance.current?.pause();else instance.current?.play();
58
+ }, [paused]);
59
+ return /*#__PURE__*/(0, _react.createElement)(DotLottieReact, {
60
+ src: uri,
61
+ autoplay: !paused,
62
+ loop,
63
+ style,
64
+ dotLottieRefCallback: next => {
65
+ if (instance.current === next) return;
66
+ instance.current = next;
67
+ if (!next) return;
68
+ next.addEventListener('load', () => callbacks.current.onLoad?.());
69
+ next.addEventListener('loadError', () => callbacks.current.onError?.('load failed'));
70
+ }
71
+ });
72
+ }
73
+ return WebLottiePlayer;
74
+ }
75
+
76
+ /** The web player, adapted, or `null` when `@lottiefiles/dotlottie-react` is not installed. */
77
+ function loadLottiePlayer() {
78
+ if (providedPlayer !== undefined && providedPlayer !== null) return providedPlayer;
79
+ if (loadedPlayer !== undefined) return loadedPlayer;
80
+ loadedPlayer = null;
81
+ if (typeof require === 'undefined') return loadedPlayer;
82
+ try {
83
+ const loaded = require('@lottiefiles/dotlottie-react');
84
+ if (isComponent(loaded?.DotLottieReact)) loadedPlayer = adapt(loaded.DotLottieReact);
85
+ } catch {
86
+ loadedPlayer = null;
87
+ }
88
+ return loadedPlayer;
89
+ }
90
+ function warnLottieUnavailable() {
91
+ if (process.env.NODE_ENV === 'production' || hasWarned) return;
92
+ hasWarned = true;
93
+ // eslint-disable-next-line no-console
94
+ console.warn('[Bloom] An animated Sticker fell back to its still image: the optional peer ' + '`@lottiefiles/dotlottie-react` could not be loaded. Install it to animate ' + 'stickers on the web.');
95
+ }
96
+ //# sourceMappingURL=lottie-module.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","providedPlayer","loadedPlayer","hasWarned","provideLottiePlayer","player","resetLottiePlayer","undefined","isComponent","candidate","adapt","DotLottieReact","WebLottiePlayer","uri","loop","paused","onLoad","onError","style","instance","useRef","callbacks","current","useEffect","pause","play","createElement","src","autoplay","dotLottieRefCallback","next","addEventListener","loadLottiePlayer","loaded","warnLottieUnavailable","process","env","NODE_ENV","console","warn"],"sourceRoot":"../../../src","sources":["sticker/lottie-module.web.ts"],"mappings":";;;;;;;;;AASA,IAAAA,MAAA,GAAAC,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA,IAAIC,cAAmE;AACvE,IAAIC,YAAiE;AACrE,IAAIC,SAAS,GAAG,KAAK;AAEd,SAASC,mBAAmBA,CAACC,MAA+C,EAAQ;EACzFJ,cAAc,GAAGI,MAAM;AACzB;;AAEA;AACO,SAASC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,CAACN,MAAM,GAAG,CAAC,CAAC;QACjEc,IAAI,CAACC,gBAAgB,CAAC,WAAW,EAAE,MAAMV,SAAS,CAACC,OAAO,CAACL,OAAO,GAAG,aAAa,CAAC,CAAC;MACtF;IACF,CAAC,CAAC;EACJ;EACA,OAAOL,eAAe;AACxB;;AAEA;AACO,SAASoB,gBAAgBA,CAAA,EAA4C;EAC1E,IAAI/B,cAAc,KAAKM,SAAS,IAAIN,cAAc,KAAK,IAAI,EAAE,OAAOA,cAAc;EAClF,IAAIC,YAAY,KAAKK,SAAS,EAAE,OAAOL,YAAY;EACnDA,YAAY,GAAG,IAAI;EAEnB,IAAI,OAAOF,OAAO,KAAK,WAAW,EAAE,OAAOE,YAAY;EAEvD,IAAI;IACF,MAAM+B,MAAM,GAAGjC,OAAO,CAAC,8BAA8B,CAAoD;IACzG,IAAIQ,WAAW,CAACyB,MAAM,EAAEtB,cAAc,CAAC,EAAET,YAAY,GAAGQ,KAAK,CAACuB,MAAM,CAACtB,cAAc,CAAC;EACtF,CAAC,CAAC,MAAM;IACNT,YAAY,GAAG,IAAI;EACrB;EACA,OAAOA,YAAY;AACrB;AAEO,SAASgC,qBAAqBA,CAAA,EAAS;EAC5C,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIlC,SAAS,EAAE;EACxDA,SAAS,GAAG,IAAI;EAChB;EACAmC,OAAO,CAACC,IAAI,CACV,8EAA8E,GAC5E,4EAA4E,GAC5E,sBACJ,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["sticker/types.ts"],"mappings":"","ignoreList":[]}