stream-chat-react-native-core 10.0.0-rc.2 → 10.0.0-rc.4

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 (527) hide show
  1. package/lib/commonjs/ai-components/README.md +50 -2
  2. package/lib/commonjs/ai-components/index.js +24 -0
  3. package/lib/commonjs/ai-components/index.js.map +1 -1
  4. package/lib/commonjs/ai-components/message-composer/ComposerView.js +4 -2
  5. package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
  6. package/lib/commonjs/ai-components/message-composer/SpeechToTextButton.js +4 -1
  7. package/lib/commonjs/ai-components/message-composer/SpeechToTextButton.js.map +1 -1
  8. package/lib/commonjs/ai-components/native/AIDictation.js +6 -0
  9. package/lib/commonjs/ai-components/native/AIDictation.js.map +1 -1
  10. package/lib/commonjs/ai-components/store/dictation/store.js +4 -2
  11. package/lib/commonjs/ai-components/store/dictation/store.js.map +1 -1
  12. package/lib/commonjs/ai-components/store/dictation/useDictationState.js +4 -2
  13. package/lib/commonjs/ai-components/store/dictation/useDictationState.js.map +1 -1
  14. package/lib/commonjs/ai-components/store/index.js +22 -0
  15. package/lib/commonjs/ai-components/store/index.js.map +1 -1
  16. package/lib/commonjs/ai-components/theme.js +3 -0
  17. package/lib/commonjs/ai-components/theme.js.map +1 -1
  18. package/lib/commonjs/ai-components/transcription/useDictation.js +7 -3
  19. package/lib/commonjs/ai-components/transcription/useDictation.js.map +1 -1
  20. package/lib/commonjs/ai-components/transcription/useDictationAudioLevel.js +32 -0
  21. package/lib/commonjs/ai-components/transcription/useDictationAudioLevel.js.map +1 -0
  22. package/lib/commonjs/ai-components/voice-visualization/VoiceGlow.js +79 -0
  23. package/lib/commonjs/ai-components/voice-visualization/VoiceGlow.js.map +1 -0
  24. package/lib/commonjs/ai-components/voice-visualization/VoiceVisualizationView.js +147 -0
  25. package/lib/commonjs/ai-components/voice-visualization/VoiceVisualizationView.js.map +1 -0
  26. package/lib/commonjs/ai-components/voice-visualization/VoiceWave.js +58 -0
  27. package/lib/commonjs/ai-components/voice-visualization/VoiceWave.js.map +1 -0
  28. package/lib/commonjs/ai-components/voice-visualization/bounce.js +60 -0
  29. package/lib/commonjs/ai-components/voice-visualization/bounce.js.map +1 -0
  30. package/lib/commonjs/ai-components/voice-visualization/driver.js +208 -0
  31. package/lib/commonjs/ai-components/voice-visualization/driver.js.map +1 -0
  32. package/lib/commonjs/ai-components/voice-visualization/glowShader.js +218 -0
  33. package/lib/commonjs/ai-components/voice-visualization/glowShader.js.map +1 -0
  34. package/lib/commonjs/ai-components/voice-visualization/index.js +18 -0
  35. package/lib/commonjs/ai-components/voice-visualization/index.js.map +1 -0
  36. package/lib/commonjs/ai-components/voice-visualization/math.js +70 -0
  37. package/lib/commonjs/ai-components/voice-visualization/math.js.map +1 -0
  38. package/lib/commonjs/ai-components/voice-visualization/palette.js +47 -0
  39. package/lib/commonjs/ai-components/voice-visualization/palette.js.map +1 -0
  40. package/lib/commonjs/ai-components/voice-visualization/simplex.js +77 -0
  41. package/lib/commonjs/ai-components/voice-visualization/simplex.js.map +1 -0
  42. package/lib/commonjs/ai-components/voice-visualization/styles.js +33 -0
  43. package/lib/commonjs/ai-components/voice-visualization/styles.js.map +1 -0
  44. package/lib/commonjs/ai-components/voice-visualization/types.js +4 -0
  45. package/lib/commonjs/ai-components/voice-visualization/types.js.map +1 -0
  46. package/lib/commonjs/ai-components/voice-visualization/useReduceMotion.js +28 -0
  47. package/lib/commonjs/ai-components/voice-visualization/useReduceMotion.js.map +1 -0
  48. package/lib/commonjs/ai-components/voice-visualization/useVoiceVisualization.js +129 -0
  49. package/lib/commonjs/ai-components/voice-visualization/useVoiceVisualization.js.map +1 -0
  50. package/lib/commonjs/ai-components/voice-visualization/waveGeometry.js +124 -0
  51. package/lib/commonjs/ai-components/voice-visualization/waveGeometry.js.map +1 -0
  52. package/lib/commonjs/components/Channel/Channel.js +1 -0
  53. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  54. package/lib/commonjs/components/Channel/ChannelShell.js +8 -1
  55. package/lib/commonjs/components/Channel/ChannelShell.js.map +1 -1
  56. package/lib/commonjs/components/Channel/hooks/useChannelLifecycle.js +2 -1
  57. package/lib/commonjs/components/Channel/hooks/useChannelLifecycle.js.map +1 -1
  58. package/lib/commonjs/components/Channel/hooks/useJumpToLatestOnOpen.js +26 -0
  59. package/lib/commonjs/components/Channel/hooks/useJumpToLatestOnOpen.js.map +1 -0
  60. package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js +1 -1
  61. package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
  62. package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js +1 -1
  63. package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js.map +1 -1
  64. package/lib/commonjs/components/ChannelList/ChannelListView.js +0 -2
  65. package/lib/commonjs/components/ChannelList/ChannelListView.js.map +1 -1
  66. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +2 -2
  67. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  68. package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +1 -1
  69. package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
  70. package/lib/commonjs/components/ChannelPreview/ChannelLastMessagePreview.js +1 -0
  71. package/lib/commonjs/components/ChannelPreview/ChannelLastMessagePreview.js.map +1 -1
  72. package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +2 -0
  73. package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
  74. package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js +1 -0
  75. package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js.map +1 -1
  76. package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js +1 -1
  77. package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
  78. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +5 -5
  79. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
  80. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +1 -1
  81. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  82. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +1 -1
  83. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
  84. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +4 -1
  85. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
  86. package/lib/commonjs/components/Chat/hooks/useConnectionLifecycle.js +6 -2
  87. package/lib/commonjs/components/Chat/hooks/useConnectionLifecycle.js.map +1 -1
  88. package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js +5 -0
  89. package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js.map +1 -1
  90. package/lib/commonjs/components/Message/Message.js +1 -1
  91. package/lib/commonjs/components/Message/Message.js.map +1 -1
  92. package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js +4 -0
  93. package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js.map +1 -1
  94. package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js +7 -4
  95. package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
  96. package/lib/commonjs/components/Message/hooks/useCreateMessageActionHandlers.js +3 -3
  97. package/lib/commonjs/components/Message/hooks/useCreateMessageActionHandlers.js.map +1 -1
  98. package/lib/commonjs/components/Message/hooks/useProcessReactions.js +2 -2
  99. package/lib/commonjs/components/Message/hooks/useProcessReactions.js.map +1 -1
  100. package/lib/commonjs/components/Message/hooks/useUserMuteActive.js +1 -1
  101. package/lib/commonjs/components/Message/hooks/useUserMuteActive.js.map +1 -1
  102. package/lib/commonjs/components/MessageInput/MessageComposer.js +2 -1
  103. package/lib/commonjs/components/MessageInput/MessageComposer.js.map +1 -1
  104. package/lib/commonjs/components/MessageList/MessageFlashList.js +2 -2
  105. package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
  106. package/lib/commonjs/components/MessageList/MessageList.js +2 -2
  107. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  108. package/lib/commonjs/components/MessageList/hooks/useOwnUnreadCount.js +1 -1
  109. package/lib/commonjs/components/MessageList/hooks/useOwnUnreadCount.js.map +1 -1
  110. package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js +1 -1
  111. package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
  112. package/lib/commonjs/components/MessageMenu/hooks/useMessageOwnReactions.js +2 -2
  113. package/lib/commonjs/components/MessageMenu/hooks/useMessageOwnReactions.js.map +1 -1
  114. package/lib/commonjs/components/Poll/components/PollAnswersList.js +1 -1
  115. package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
  116. package/lib/commonjs/components/Poll/components/PollButtons.js +1 -1
  117. package/lib/commonjs/components/Poll/components/PollButtons.js.map +1 -1
  118. package/lib/commonjs/components/Poll/hook/useIsPollCreatedByCurrentUser.js +1 -1
  119. package/lib/commonjs/components/Poll/hook/useIsPollCreatedByCurrentUser.js.map +1 -1
  120. package/lib/commonjs/components/Thread/Thread.js +1 -1
  121. package/lib/commonjs/components/Thread/Thread.js.map +1 -1
  122. package/lib/commonjs/components/ThreadList/ThreadListItem.js +1 -1
  123. package/lib/commonjs/components/ThreadList/ThreadListItem.js.map +1 -1
  124. package/lib/commonjs/components/ThreadList/ThreadListUnreadBanner.js +9 -2
  125. package/lib/commonjs/components/ThreadList/ThreadListUnreadBanner.js.map +1 -1
  126. package/lib/commonjs/components/index.js +36 -0
  127. package/lib/commonjs/components/index.js.map +1 -1
  128. package/lib/commonjs/contexts/componentsContext/defaultComponents.js +0 -2
  129. package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
  130. package/lib/commonjs/contexts/liveLocationManagerContext/LiveLocationManagerContext.js +1 -1
  131. package/lib/commonjs/contexts/liveLocationManagerContext/LiveLocationManagerContext.js.map +1 -1
  132. package/lib/commonjs/hooks/actions/useChannelActionItems.js +1 -1
  133. package/lib/commonjs/hooks/actions/useChannelActionItems.js.map +1 -1
  134. package/lib/commonjs/hooks/actions/useChannelActions.js +2 -2
  135. package/lib/commonjs/hooks/actions/useChannelActions.js.map +1 -1
  136. package/lib/commonjs/hooks/actions/useChannelMemberActionItems.js +1 -1
  137. package/lib/commonjs/hooks/actions/useChannelMemberActionItems.js.map +1 -1
  138. package/lib/commonjs/hooks/index.js +11 -0
  139. package/lib/commonjs/hooks/index.js.map +1 -1
  140. package/lib/commonjs/hooks/messagePreview/useMessageDeliveryStatus.js +6 -6
  141. package/lib/commonjs/hooks/messagePreview/useMessageDeliveryStatus.js.map +1 -1
  142. package/lib/commonjs/hooks/useIsDirectChat.js +1 -1
  143. package/lib/commonjs/hooks/useIsDirectChat.js.map +1 -1
  144. package/lib/commonjs/i18n/runtimeDefaults.js +1 -0
  145. package/lib/commonjs/i18n/runtimeDefaults.js.map +1 -1
  146. package/lib/commonjs/store/apis/getChannelMessages.js +5 -3
  147. package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -1
  148. package/lib/commonjs/store/apis/getChannels.js +6 -3
  149. package/lib/commonjs/store/apis/getChannels.js.map +1 -1
  150. package/lib/commonjs/store/apis/getChannelsForFilterSort.js +2 -1
  151. package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -1
  152. package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +7 -5
  153. package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  154. package/lib/commonjs/utils/installNativeMultipartAdapter.js.map +1 -1
  155. package/lib/commonjs/utils/setupCommandUIMiddlewares.js +6 -3
  156. package/lib/commonjs/utils/setupCommandUIMiddlewares.js.map +1 -1
  157. package/lib/commonjs/version.json +1 -1
  158. package/lib/module/ai-components/README.md +50 -2
  159. package/lib/module/ai-components/index.js +24 -0
  160. package/lib/module/ai-components/index.js.map +1 -1
  161. package/lib/module/ai-components/message-composer/ComposerView.js +4 -2
  162. package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
  163. package/lib/module/ai-components/message-composer/SpeechToTextButton.js +4 -1
  164. package/lib/module/ai-components/message-composer/SpeechToTextButton.js.map +1 -1
  165. package/lib/module/ai-components/native/AIDictation.js +6 -0
  166. package/lib/module/ai-components/native/AIDictation.js.map +1 -1
  167. package/lib/module/ai-components/store/dictation/store.js +4 -2
  168. package/lib/module/ai-components/store/dictation/store.js.map +1 -1
  169. package/lib/module/ai-components/store/dictation/useDictationState.js +4 -2
  170. package/lib/module/ai-components/store/dictation/useDictationState.js.map +1 -1
  171. package/lib/module/ai-components/store/index.js +22 -0
  172. package/lib/module/ai-components/store/index.js.map +1 -1
  173. package/lib/module/ai-components/theme.js +3 -0
  174. package/lib/module/ai-components/theme.js.map +1 -1
  175. package/lib/module/ai-components/transcription/useDictation.js +7 -3
  176. package/lib/module/ai-components/transcription/useDictation.js.map +1 -1
  177. package/lib/module/ai-components/transcription/useDictationAudioLevel.js +32 -0
  178. package/lib/module/ai-components/transcription/useDictationAudioLevel.js.map +1 -0
  179. package/lib/module/ai-components/voice-visualization/VoiceGlow.js +79 -0
  180. package/lib/module/ai-components/voice-visualization/VoiceGlow.js.map +1 -0
  181. package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js +147 -0
  182. package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js.map +1 -0
  183. package/lib/module/ai-components/voice-visualization/VoiceWave.js +58 -0
  184. package/lib/module/ai-components/voice-visualization/VoiceWave.js.map +1 -0
  185. package/lib/module/ai-components/voice-visualization/bounce.js +60 -0
  186. package/lib/module/ai-components/voice-visualization/bounce.js.map +1 -0
  187. package/lib/module/ai-components/voice-visualization/driver.js +208 -0
  188. package/lib/module/ai-components/voice-visualization/driver.js.map +1 -0
  189. package/lib/module/ai-components/voice-visualization/glowShader.js +218 -0
  190. package/lib/module/ai-components/voice-visualization/glowShader.js.map +1 -0
  191. package/lib/module/ai-components/voice-visualization/index.js +18 -0
  192. package/lib/module/ai-components/voice-visualization/index.js.map +1 -0
  193. package/lib/module/ai-components/voice-visualization/math.js +70 -0
  194. package/lib/module/ai-components/voice-visualization/math.js.map +1 -0
  195. package/lib/module/ai-components/voice-visualization/palette.js +47 -0
  196. package/lib/module/ai-components/voice-visualization/palette.js.map +1 -0
  197. package/lib/module/ai-components/voice-visualization/simplex.js +77 -0
  198. package/lib/module/ai-components/voice-visualization/simplex.js.map +1 -0
  199. package/lib/module/ai-components/voice-visualization/styles.js +33 -0
  200. package/lib/module/ai-components/voice-visualization/styles.js.map +1 -0
  201. package/lib/module/ai-components/voice-visualization/types.js +4 -0
  202. package/lib/module/ai-components/voice-visualization/types.js.map +1 -0
  203. package/lib/module/ai-components/voice-visualization/useReduceMotion.js +28 -0
  204. package/lib/module/ai-components/voice-visualization/useReduceMotion.js.map +1 -0
  205. package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js +129 -0
  206. package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js.map +1 -0
  207. package/lib/module/ai-components/voice-visualization/waveGeometry.js +124 -0
  208. package/lib/module/ai-components/voice-visualization/waveGeometry.js.map +1 -0
  209. package/lib/module/components/Channel/Channel.js +1 -0
  210. package/lib/module/components/Channel/Channel.js.map +1 -1
  211. package/lib/module/components/Channel/ChannelShell.js +8 -1
  212. package/lib/module/components/Channel/ChannelShell.js.map +1 -1
  213. package/lib/module/components/Channel/hooks/useChannelLifecycle.js +2 -1
  214. package/lib/module/components/Channel/hooks/useChannelLifecycle.js.map +1 -1
  215. package/lib/module/components/Channel/hooks/useJumpToLatestOnOpen.js +26 -0
  216. package/lib/module/components/Channel/hooks/useJumpToLatestOnOpen.js.map +1 -0
  217. package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js +1 -1
  218. package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
  219. package/lib/module/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js +1 -1
  220. package/lib/module/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js.map +1 -1
  221. package/lib/module/components/ChannelList/ChannelListView.js +0 -2
  222. package/lib/module/components/ChannelList/ChannelListView.js.map +1 -1
  223. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +2 -2
  224. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  225. package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +1 -1
  226. package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
  227. package/lib/module/components/ChannelPreview/ChannelLastMessagePreview.js +1 -0
  228. package/lib/module/components/ChannelPreview/ChannelLastMessagePreview.js.map +1 -1
  229. package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +2 -0
  230. package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
  231. package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js +1 -0
  232. package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js.map +1 -1
  233. package/lib/module/components/ChannelPreview/ChannelPreviewView.js +1 -1
  234. package/lib/module/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
  235. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +5 -5
  236. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
  237. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +1 -1
  238. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  239. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +1 -1
  240. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
  241. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +4 -1
  242. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
  243. package/lib/module/components/Chat/hooks/useConnectionLifecycle.js +6 -2
  244. package/lib/module/components/Chat/hooks/useConnectionLifecycle.js.map +1 -1
  245. package/lib/module/components/Indicators/LoadingErrorIndicator.js +5 -0
  246. package/lib/module/components/Indicators/LoadingErrorIndicator.js.map +1 -1
  247. package/lib/module/components/Message/Message.js +1 -1
  248. package/lib/module/components/Message/Message.js.map +1 -1
  249. package/lib/module/components/Message/MessageItemView/MessageStatus.js +4 -0
  250. package/lib/module/components/Message/MessageItemView/MessageStatus.js.map +1 -1
  251. package/lib/module/components/Message/MessageItemView/MessageWrapper.js +7 -4
  252. package/lib/module/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
  253. package/lib/module/components/Message/hooks/useCreateMessageActionHandlers.js +3 -3
  254. package/lib/module/components/Message/hooks/useCreateMessageActionHandlers.js.map +1 -1
  255. package/lib/module/components/Message/hooks/useProcessReactions.js +2 -2
  256. package/lib/module/components/Message/hooks/useProcessReactions.js.map +1 -1
  257. package/lib/module/components/Message/hooks/useUserMuteActive.js +1 -1
  258. package/lib/module/components/Message/hooks/useUserMuteActive.js.map +1 -1
  259. package/lib/module/components/MessageInput/MessageComposer.js +2 -1
  260. package/lib/module/components/MessageInput/MessageComposer.js.map +1 -1
  261. package/lib/module/components/MessageList/MessageFlashList.js +2 -2
  262. package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
  263. package/lib/module/components/MessageList/MessageList.js +2 -2
  264. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  265. package/lib/module/components/MessageList/hooks/useOwnUnreadCount.js +1 -1
  266. package/lib/module/components/MessageList/hooks/useOwnUnreadCount.js.map +1 -1
  267. package/lib/module/components/MessageMenu/MessageUserReactionsItem.js +1 -1
  268. package/lib/module/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
  269. package/lib/module/components/MessageMenu/hooks/useMessageOwnReactions.js +2 -2
  270. package/lib/module/components/MessageMenu/hooks/useMessageOwnReactions.js.map +1 -1
  271. package/lib/module/components/Poll/components/PollAnswersList.js +1 -1
  272. package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
  273. package/lib/module/components/Poll/components/PollButtons.js +1 -1
  274. package/lib/module/components/Poll/components/PollButtons.js.map +1 -1
  275. package/lib/module/components/Poll/hook/useIsPollCreatedByCurrentUser.js +1 -1
  276. package/lib/module/components/Poll/hook/useIsPollCreatedByCurrentUser.js.map +1 -1
  277. package/lib/module/components/Thread/Thread.js +1 -1
  278. package/lib/module/components/Thread/Thread.js.map +1 -1
  279. package/lib/module/components/ThreadList/ThreadListItem.js +1 -1
  280. package/lib/module/components/ThreadList/ThreadListItem.js.map +1 -1
  281. package/lib/module/components/ThreadList/ThreadListUnreadBanner.js +9 -2
  282. package/lib/module/components/ThreadList/ThreadListUnreadBanner.js.map +1 -1
  283. package/lib/module/components/index.js +36 -0
  284. package/lib/module/components/index.js.map +1 -1
  285. package/lib/module/contexts/componentsContext/defaultComponents.js +0 -2
  286. package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
  287. package/lib/module/contexts/liveLocationManagerContext/LiveLocationManagerContext.js +1 -1
  288. package/lib/module/contexts/liveLocationManagerContext/LiveLocationManagerContext.js.map +1 -1
  289. package/lib/module/hooks/actions/useChannelActionItems.js +1 -1
  290. package/lib/module/hooks/actions/useChannelActionItems.js.map +1 -1
  291. package/lib/module/hooks/actions/useChannelActions.js +2 -2
  292. package/lib/module/hooks/actions/useChannelActions.js.map +1 -1
  293. package/lib/module/hooks/actions/useChannelMemberActionItems.js +1 -1
  294. package/lib/module/hooks/actions/useChannelMemberActionItems.js.map +1 -1
  295. package/lib/module/hooks/index.js +11 -0
  296. package/lib/module/hooks/index.js.map +1 -1
  297. package/lib/module/hooks/messagePreview/useMessageDeliveryStatus.js +6 -6
  298. package/lib/module/hooks/messagePreview/useMessageDeliveryStatus.js.map +1 -1
  299. package/lib/module/hooks/useIsDirectChat.js +1 -1
  300. package/lib/module/hooks/useIsDirectChat.js.map +1 -1
  301. package/lib/module/i18n/runtimeDefaults.js +1 -0
  302. package/lib/module/i18n/runtimeDefaults.js.map +1 -1
  303. package/lib/module/store/apis/getChannelMessages.js +5 -3
  304. package/lib/module/store/apis/getChannelMessages.js.map +1 -1
  305. package/lib/module/store/apis/getChannels.js +6 -3
  306. package/lib/module/store/apis/getChannels.js.map +1 -1
  307. package/lib/module/store/apis/getChannelsForFilterSort.js +2 -1
  308. package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -1
  309. package/lib/module/store/apis/queries/selectMessagesForChannels.js +7 -5
  310. package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  311. package/lib/module/utils/installNativeMultipartAdapter.js.map +1 -1
  312. package/lib/module/utils/setupCommandUIMiddlewares.js +6 -3
  313. package/lib/module/utils/setupCommandUIMiddlewares.js.map +1 -1
  314. package/lib/module/version.json +1 -1
  315. package/lib/typescript/ai-components/index.d.ts +3 -1
  316. package/lib/typescript/ai-components/index.d.ts.map +1 -1
  317. package/lib/typescript/ai-components/message-composer/ComposerView.d.ts.map +1 -1
  318. package/lib/typescript/ai-components/native/AIDictation.d.ts +6 -0
  319. package/lib/typescript/ai-components/native/AIDictation.d.ts.map +1 -1
  320. package/lib/typescript/ai-components/store/dictation/store.d.ts +7 -0
  321. package/lib/typescript/ai-components/store/dictation/store.d.ts.map +1 -1
  322. package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts +1 -0
  323. package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts.map +1 -1
  324. package/lib/typescript/ai-components/store/index.d.ts +2 -0
  325. package/lib/typescript/ai-components/store/index.d.ts.map +1 -1
  326. package/lib/typescript/ai-components/theme.d.ts +13 -0
  327. package/lib/typescript/ai-components/theme.d.ts.map +1 -1
  328. package/lib/typescript/ai-components/transcription/useDictation.d.ts +9 -1
  329. package/lib/typescript/ai-components/transcription/useDictation.d.ts.map +1 -1
  330. package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts +11 -0
  331. package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts.map +1 -0
  332. package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts +13 -0
  333. package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts.map +1 -0
  334. package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts +26 -0
  335. package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts.map +1 -0
  336. package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts +13 -0
  337. package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts.map +1 -0
  338. package/lib/typescript/ai-components/voice-visualization/bounce.d.ts +20 -0
  339. package/lib/typescript/ai-components/voice-visualization/bounce.d.ts.map +1 -0
  340. package/lib/typescript/ai-components/voice-visualization/driver.d.ts +96 -0
  341. package/lib/typescript/ai-components/voice-visualization/driver.d.ts.map +1 -0
  342. package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts +7 -0
  343. package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts.map +1 -0
  344. package/lib/typescript/ai-components/voice-visualization/index.d.ts +4 -0
  345. package/lib/typescript/ai-components/voice-visualization/index.d.ts.map +1 -0
  346. package/lib/typescript/ai-components/voice-visualization/math.d.ts +26 -0
  347. package/lib/typescript/ai-components/voice-visualization/math.d.ts.map +1 -0
  348. package/lib/typescript/ai-components/voice-visualization/palette.d.ts +18 -0
  349. package/lib/typescript/ai-components/voice-visualization/palette.d.ts.map +1 -0
  350. package/lib/typescript/ai-components/voice-visualization/simplex.d.ts +11 -0
  351. package/lib/typescript/ai-components/voice-visualization/simplex.d.ts.map +1 -0
  352. package/lib/typescript/ai-components/voice-visualization/styles.d.ts +24 -0
  353. package/lib/typescript/ai-components/voice-visualization/styles.d.ts.map +1 -0
  354. package/lib/typescript/ai-components/voice-visualization/types.d.ts +45 -0
  355. package/lib/typescript/ai-components/voice-visualization/types.d.ts.map +1 -0
  356. package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts +10 -0
  357. package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts.map +1 -0
  358. package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts +18 -0
  359. package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts.map +1 -0
  360. package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts +25 -0
  361. package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts.map +1 -0
  362. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  363. package/lib/typescript/components/Channel/ChannelShell.d.ts +2 -0
  364. package/lib/typescript/components/Channel/ChannelShell.d.ts.map +1 -1
  365. package/lib/typescript/components/Channel/hooks/useChannelLifecycle.d.ts.map +1 -1
  366. package/lib/typescript/components/Channel/hooks/useJumpToLatestOnOpen.d.ts +15 -0
  367. package/lib/typescript/components/Channel/hooks/useJumpToLatestOnOpen.d.ts.map +1 -0
  368. package/lib/typescript/components/ChannelList/ChannelListView.d.ts +1 -1
  369. package/lib/typescript/components/ChannelList/ChannelListView.d.ts.map +1 -1
  370. package/lib/typescript/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.d.ts.map +1 -1
  371. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -1
  372. package/lib/typescript/components/Chat/hooks/useConnectionLifecycle.d.ts +5 -4
  373. package/lib/typescript/components/Chat/hooks/useConnectionLifecycle.d.ts.map +1 -1
  374. package/lib/typescript/components/Indicators/LoadingErrorIndicator.d.ts +1 -1
  375. package/lib/typescript/components/Indicators/LoadingErrorIndicator.d.ts.map +1 -1
  376. package/lib/typescript/components/Message/MessageItemView/MessageStatus.d.ts.map +1 -1
  377. package/lib/typescript/components/Message/MessageItemView/MessageWrapper.d.ts.map +1 -1
  378. package/lib/typescript/components/MessageInput/MessageComposer.d.ts.map +1 -1
  379. package/lib/typescript/components/ThreadList/ThreadListUnreadBanner.d.ts.map +1 -1
  380. package/lib/typescript/components/index.d.ts +3 -0
  381. package/lib/typescript/components/index.d.ts.map +1 -1
  382. package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +0 -1
  383. package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
  384. package/lib/typescript/hooks/index.d.ts +1 -0
  385. package/lib/typescript/hooks/index.d.ts.map +1 -1
  386. package/lib/typescript/hooks/messagePreview/useMessageDeliveryStatus.d.ts +3 -0
  387. package/lib/typescript/hooks/messagePreview/useMessageDeliveryStatus.d.ts.map +1 -1
  388. package/lib/typescript/i18n/keys.d.ts +3 -1
  389. package/lib/typescript/i18n/keys.d.ts.map +1 -1
  390. package/lib/typescript/i18n/runtimeDefaults.d.ts +1 -0
  391. package/lib/typescript/i18n/runtimeDefaults.d.ts.map +1 -1
  392. package/lib/typescript/store/apis/getChannelMessages.d.ts +2 -1
  393. package/lib/typescript/store/apis/getChannelMessages.d.ts.map +1 -1
  394. package/lib/typescript/store/apis/getChannels.d.ts +3 -1
  395. package/lib/typescript/store/apis/getChannels.d.ts.map +1 -1
  396. package/lib/typescript/store/apis/getChannelsForFilterSort.d.ts.map +1 -1
  397. package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts +3 -1
  398. package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts.map +1 -1
  399. package/lib/typescript/utils/installNativeMultipartAdapter.d.ts +5 -3
  400. package/lib/typescript/utils/installNativeMultipartAdapter.d.ts.map +1 -1
  401. package/lib/typescript/utils/setupCommandUIMiddlewares.d.ts.map +1 -1
  402. package/package.json +4 -4
  403. package/src/__tests__/offline-support/offline-feature.tsx +7 -7
  404. package/src/__tests__/offline-support/optimistic-update.tsx +5 -5
  405. package/src/ai-components/README.md +50 -2
  406. package/src/ai-components/__tests__/VoiceVisualization.test.tsx +208 -0
  407. package/src/ai-components/__tests__/dictation.test.tsx +58 -1
  408. package/src/ai-components/__tests__/voiceDriver.test.ts +317 -0
  409. package/src/ai-components/__tests__/voicePalette.test.ts +124 -0
  410. package/src/ai-components/index.ts +3 -1
  411. package/src/ai-components/message-composer/ComposerView.tsx +6 -3
  412. package/src/ai-components/message-composer/SpeechToTextButton.tsx +5 -2
  413. package/src/ai-components/native/AIDictation.ts +11 -0
  414. package/src/ai-components/store/dictation/store.ts +9 -0
  415. package/src/ai-components/store/dictation/useDictationState.ts +2 -1
  416. package/src/ai-components/store/index.ts +2 -0
  417. package/src/ai-components/theme.ts +16 -0
  418. package/src/ai-components/transcription/useDictation.ts +16 -3
  419. package/src/ai-components/transcription/useDictationAudioLevel.ts +38 -0
  420. package/src/ai-components/voice-visualization/VoiceGlow.tsx +79 -0
  421. package/src/ai-components/voice-visualization/VoiceVisualizationView.tsx +179 -0
  422. package/src/ai-components/voice-visualization/VoiceWave.tsx +67 -0
  423. package/src/ai-components/voice-visualization/bounce.ts +61 -0
  424. package/src/ai-components/voice-visualization/driver.ts +240 -0
  425. package/src/ai-components/voice-visualization/glowShader.ts +227 -0
  426. package/src/ai-components/voice-visualization/index.ts +3 -0
  427. package/src/ai-components/voice-visualization/math.ts +73 -0
  428. package/src/ai-components/voice-visualization/palette.ts +59 -0
  429. package/src/ai-components/voice-visualization/simplex.ts +92 -0
  430. package/src/ai-components/voice-visualization/styles.ts +42 -0
  431. package/src/ai-components/voice-visualization/types.ts +44 -0
  432. package/src/ai-components/voice-visualization/useReduceMotion.ts +34 -0
  433. package/src/ai-components/voice-visualization/useVoiceVisualization.ts +153 -0
  434. package/src/ai-components/voice-visualization/waveGeometry.ts +137 -0
  435. package/src/components/Channel/Channel.tsx +1 -0
  436. package/src/components/Channel/ChannelShell.tsx +12 -0
  437. package/src/components/Channel/__tests__/Channel.test.tsx +146 -5
  438. package/src/components/Channel/hooks/useChannelLifecycle.ts +4 -1
  439. package/src/components/Channel/hooks/useJumpToLatestOnOpen.ts +42 -0
  440. package/src/components/ChannelDetails/__tests__/ChannelDetails.test.tsx +1 -1
  441. package/src/components/ChannelDetails/__tests__/ChannelDetailsActionsSection.test.tsx +1 -1
  442. package/src/components/ChannelDetails/__tests__/ChannelDetailsEditButton.test.tsx +1 -1
  443. package/src/components/ChannelDetails/__tests__/ChannelDetailsMemberSection.test.tsx +1 -1
  444. package/src/components/ChannelDetails/__tests__/ChannelDetailsNavHeader.test.tsx +1 -1
  445. package/src/components/ChannelDetails/__tests__/ChannelDetailsProfile.test.tsx +2 -2
  446. package/src/components/ChannelDetails/__tests__/ChannelEditDetailsForm.test.tsx +1 -1
  447. package/src/components/ChannelDetails/__tests__/ChannelEditDetailsFormContent.test.tsx +2 -2
  448. package/src/components/ChannelDetails/__tests__/ChannelEditName.test.tsx +1 -1
  449. package/src/components/ChannelDetails/__tests__/members/ChannelAddMembersForm.test.tsx +1 -1
  450. package/src/components/ChannelDetails/__tests__/members/ChannelMemberActionsSheet.test.tsx +2 -2
  451. package/src/components/ChannelDetails/__tests__/members/ChannelMemberItem.test.tsx +1 -1
  452. package/src/components/ChannelDetails/__tests__/useChannelDetailsMemberStatusText.test.tsx +1 -1
  453. package/src/components/ChannelDetails/components/members/ChannelMemberItem.tsx +1 -1
  454. package/src/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.ts +1 -1
  455. package/src/components/ChannelList/ChannelListView.tsx +1 -3
  456. package/src/components/ChannelList/__tests__/ChannelList.test.tsx +72 -0
  457. package/src/components/ChannelList/hooks/usePaginatedChannels.ts +2 -2
  458. package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +1 -1
  459. package/src/components/ChannelPreview/ChannelLastMessagePreview.tsx +1 -1
  460. package/src/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.tsx +8 -2
  461. package/src/components/ChannelPreview/ChannelPreviewTitle.tsx +1 -1
  462. package/src/components/ChannelPreview/ChannelPreviewView.tsx +1 -1
  463. package/src/components/ChannelPreview/__tests__/ChannelPreview.test.tsx +4 -4
  464. package/src/components/ChannelPreview/__tests__/ChannelPreviewView.test.tsx +40 -0
  465. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewData.test.tsx +51 -0
  466. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +1 -1
  467. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayPresence.test.tsx +1 -1
  468. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewPollLabel.test.tsx +87 -0
  469. package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +3 -4
  470. package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +1 -1
  471. package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.ts +1 -1
  472. package/src/components/ChannelPreview/hooks/useChannelPreviewPollLabel.ts +1 -1
  473. package/src/components/Chat/__tests__/Chat.test.tsx +31 -1
  474. package/src/components/Chat/hooks/useConnectionLifecycle.ts +12 -6
  475. package/src/components/Indicators/LoadingErrorIndicator.tsx +8 -1
  476. package/src/components/Message/Message.tsx +1 -1
  477. package/src/components/Message/MessageItemView/MessageStatus.tsx +16 -2
  478. package/src/components/Message/MessageItemView/MessageWrapper.tsx +14 -4
  479. package/src/components/Message/MessageItemView/__tests__/MessageStatus.test.tsx +21 -0
  480. package/src/components/Message/hooks/__tests__/useCreateMessageActionHandlers.test.tsx +1 -1
  481. package/src/components/Message/hooks/__tests__/useUserMuteActive.test.tsx +1 -1
  482. package/src/components/Message/hooks/useCreateMessageActionHandlers.ts +3 -3
  483. package/src/components/Message/hooks/useProcessReactions.ts +2 -2
  484. package/src/components/Message/hooks/useUserMuteActive.ts +1 -1
  485. package/src/components/MessageInput/MessageComposer.tsx +4 -2
  486. package/src/components/MessageList/MessageFlashList.tsx +2 -2
  487. package/src/components/MessageList/MessageList.tsx +2 -2
  488. package/src/components/MessageList/__tests__/MessageList.test.tsx +115 -14
  489. package/src/components/MessageList/__tests__/ScrollToBottomButton.test.tsx +3 -3
  490. package/src/components/MessageList/hooks/useOwnUnreadCount.ts +1 -1
  491. package/src/components/MessageMenu/MessageUserReactionsItem.tsx +1 -1
  492. package/src/components/MessageMenu/hooks/useMessageOwnReactions.ts +2 -2
  493. package/src/components/Poll/components/PollAnswersList.tsx +1 -1
  494. package/src/components/Poll/components/PollButtons.tsx +1 -1
  495. package/src/components/Poll/hook/useIsPollCreatedByCurrentUser.ts +1 -1
  496. package/src/components/Thread/Thread.tsx +1 -1
  497. package/src/components/Thread/__tests__/Thread.test.tsx +89 -2
  498. package/src/components/ThreadList/ThreadListItem.tsx +1 -1
  499. package/src/components/ThreadList/ThreadListUnreadBanner.tsx +6 -2
  500. package/src/components/ThreadList/__tests__/ThreadList.test.tsx +21 -0
  501. package/src/components/index.ts +3 -0
  502. package/src/contexts/componentsContext/defaultComponents.ts +0 -2
  503. package/src/contexts/liveLocationManagerContext/LiveLocationManagerContext.tsx +1 -1
  504. package/src/hooks/__tests__/useChannelMuteActive.test.tsx +1 -1
  505. package/src/hooks/__tests__/useIsDirectChat.test.tsx +1 -1
  506. package/src/hooks/actions/__tests__/useChannelActionItems.test.tsx +1 -1
  507. package/src/hooks/actions/__tests__/useChannelActions.test.tsx +1 -1
  508. package/src/hooks/actions/__tests__/useChannelMemberActionItems.test.tsx +6 -6
  509. package/src/hooks/actions/useChannelActionItems.tsx +1 -1
  510. package/src/hooks/actions/useChannelActions.ts +2 -2
  511. package/src/hooks/actions/useChannelMemberActionItems.tsx +1 -1
  512. package/src/hooks/index.ts +1 -0
  513. package/src/hooks/messagePreview/__tests__/useMessageDeliveryStatus.test.tsx +57 -32
  514. package/src/hooks/messagePreview/useMessageDeliveryStatus.ts +13 -7
  515. package/src/hooks/useIsDirectChat.ts +1 -1
  516. package/src/i18n/__tests__/catalog.fixture.json +2 -0
  517. package/src/i18n/keys.ts +3 -0
  518. package/src/i18n/runtimeDefaults.ts +1 -0
  519. package/src/store/__tests__/selectMessagesForChannels.test.ts +34 -12
  520. package/src/store/apis/getChannelMessages.ts +4 -1
  521. package/src/store/apis/getChannels.ts +5 -1
  522. package/src/store/apis/getChannelsForFilterSort.ts +1 -0
  523. package/src/store/apis/queries/selectMessagesForChannels.ts +7 -2
  524. package/src/utils/__tests__/setupCommandUIMiddlewares.test.ts +49 -0
  525. package/src/utils/installNativeMultipartAdapter.ts +5 -3
  526. package/src/utils/setupCommandUIMiddlewares.ts +3 -0
  527. package/src/version.json +1 -1
@@ -0,0 +1,227 @@
1
+ import { Skia, type SkRuntimeEffect } from '@shopify/react-native-skia';
2
+
3
+ /**
4
+ * The glow's shader, SkSL: the AGSL glow of stream-chat-android (itself ported from the iOS Metal
5
+ * glow) as is, since AGSL is SkSL, so the platforms look alike. Every pixel is computed on the
6
+ * GPU: color masses warped by simplex noise, concentric waves, ripples from a tap or a hovering
7
+ * pointer, light and a halo. Pixels past the halo return at once, so only the glow itself costs.
8
+ */
9
+ const SOURCE = `
10
+ uniform float2 resolution;
11
+ uniform float4 col0;
12
+ uniform float4 col1;
13
+ uniform float4 col2;
14
+ uniform float4 col3;
15
+ uniform float4 col4;
16
+ uniform float time;
17
+ uniform float count;
18
+ uniform float bright;
19
+ uniform float sat;
20
+ uniform float load;
21
+ uniform float flow;
22
+ uniform float flowSpin;
23
+ uniform float orbSpin;
24
+ uniform float react;
25
+ uniform float dark;
26
+ uniform float mic;
27
+ uniform float voice;
28
+ uniform float scale;
29
+ uniform float2 tap;
30
+ uniform float tapTime;
31
+ uniform float2 hover;
32
+ uniform float hoverAmt;
33
+
34
+ float sq(float x) { return x * x; }
35
+ float ss(float e0, float e1, float x) {
36
+ float t = clamp((x - e0) / (e1 - e0), 0.0, 1.0);
37
+ return t * t * (3.0 - 2.0 * t);
38
+ }
39
+ float3 hsv2rgb(float3 c) {
40
+ float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
41
+ float3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
42
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
43
+ }
44
+ float3 desat(float3 c, float s) {
45
+ float l = dot(c, float3(0.299, 0.587, 0.114));
46
+ return mix(float3(l), c, s);
47
+ }
48
+ float3 saturate3(float3 c, float s) {
49
+ float l = dot(c, float3(0.299, 0.587, 0.114));
50
+ return clamp(mix(float3(l), c, s), 0.0, 1.0);
51
+ }
52
+ float2 rot2(float2 p, float a) {
53
+ float s = sin(a); float c = cos(a);
54
+ return float2(c * p.x + s * p.y, -s * p.x + c * p.y);
55
+ }
56
+ float3 vivid(float4 hsv) {
57
+ return hsv2rgb(float3(hsv.x, clamp(hsv.y + dark * 0.06, 0.0, 1.0), hsv.z));
58
+ }
59
+ // Waves spreading out from the last tap, fading within a second and a half.
60
+ float tapRipple(float2 p) {
61
+ float age = tapTime;
62
+ if (age > 1.5) return 0.0;
63
+ float d = distance(p, tap);
64
+ float front = age * 0.75;
65
+ float env = exp(-sq((d - front) / 0.14));
66
+ float decay = exp(-age * 2.6);
67
+ return sin(d * 34.0 - age * 24.0) * env * decay;
68
+ }
69
+ // A gentle ripple following a hovering pointer.
70
+ float hoverRipple(float2 p) {
71
+ if (hoverAmt <= 0.001) return 0.0;
72
+ float d = distance(p, hover);
73
+ float env = exp(-sq(d / 0.22));
74
+ return sin(d * 30.0 - time * 7.0) * env * hoverAmt * 0.6;
75
+ }
76
+ float4 permute(float4 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }
77
+ float4 taylorInvSqrt(float4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
78
+ float snoise(float3 v) {
79
+ const float2 C = float2(1.0 / 6.0, 1.0 / 3.0);
80
+ const float4 D = float4(0.0, 0.5, 1.0, 2.0);
81
+ float3 i = floor(v + dot(v, C.yyy));
82
+ float3 x0 = v - i + dot(i, C.xxx);
83
+ float3 g = step(x0.yzx, x0.xyz);
84
+ float3 l = 1.0 - g;
85
+ float3 i1 = min(g.xyz, l.zxy);
86
+ float3 i2 = max(g.xyz, l.zxy);
87
+ float3 x1 = x0 - i1 + 1.0 * C.xxx;
88
+ float3 x2 = x0 - i2 + 2.0 * C.xxx;
89
+ float3 x3 = x0 - 1.0 + 3.0 * C.xxx;
90
+ i = mod(i, 289.0);
91
+ float4 p = permute(permute(permute(
92
+ i.z + float4(0.0, i1.z, i2.z, 1.0))
93
+ + i.y + float4(0.0, i1.y, i2.y, 1.0))
94
+ + i.x + float4(0.0, i1.x, i2.x, 1.0));
95
+ float n_ = 1.0 / 7.0;
96
+ float3 ns = n_ * D.wyz - D.xzx;
97
+ float4 j = p - 49.0 * floor(p * ns.z * ns.z);
98
+ float4 x_ = floor(j * ns.z);
99
+ float4 y_ = floor(j - 7.0 * x_);
100
+ float4 x = x_ * ns.x + ns.yyyy;
101
+ float4 y = y_ * ns.x + ns.yyyy;
102
+ float4 h = 1.0 - abs(x) - abs(y);
103
+ float4 b0 = float4(x.xy, y.xy);
104
+ float4 b1 = float4(x.zw, y.zw);
105
+ float4 s0 = floor(b0) * 2.0 + 1.0;
106
+ float4 s1 = floor(b1) * 2.0 + 1.0;
107
+ float4 sh = -step(h, float4(0.0));
108
+ float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
109
+ float4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
110
+ float3 p0 = float3(a0.xy, h.x);
111
+ float3 p1 = float3(a0.zw, h.y);
112
+ float3 p2 = float3(a1.xy, h.z);
113
+ float3 p3 = float3(a1.zw, h.w);
114
+ float4 norm = taylorInvSqrt(float4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
115
+ p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;
116
+ float4 m = max(0.6 - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);
117
+ m = m * m;
118
+ return 42.0 * dot(m * m, float4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
119
+ }
120
+ float speechEnv(float t) {
121
+ float gate = ss(-0.25, 0.35, snoise(float3(t * 0.6, 21.0, 0.0)));
122
+ float syl = 0.55 + 0.45 * snoise(float3(t * 3.0, 5.0, 0.0));
123
+ return clamp(gate * syl, 0.0, 1.0);
124
+ }
125
+ float2 coords(float2 pos) {
126
+ float m = min(resolution.x, resolution.y);
127
+ return float2(pos.x - 0.5 * resolution.x, 0.5 * resolution.y - pos.y) / m / scale;
128
+ }
129
+
130
+ half4 main(float2 fragCoord) {
131
+ float2 q = coords(fragCoord);
132
+ float t = time;
133
+ float r = length(q);
134
+
135
+ float speak = ss(0.6, 1.0, react);
136
+ float speech = react * mix(0.55 + 0.25 * sin(t * 1.6), speechEnv(t), speak);
137
+ speech = mix(speech, mic, voice);
138
+ float speechSmooth = mix(speech, react * (0.55 + 0.25 * sin(t * 1.6)), 0.5 * speak);
139
+ float energy = 0.12 + 0.30 * react + 0.18 * flow + 0.28 * load + 0.06 * speechSmooth;
140
+ float R = 0.24 * (1.0 + speechSmooth * 0.20 + load * 0.05 * sin(t * 2.0) + react * 0.04 * sin(t * 1.6));
141
+ float p = r / R;
142
+ if (p > 2.2) return half4(0.0);
143
+
144
+ float core = exp(-2.0 * p * p);
145
+ float body = ss(1.06, 0.62, p);
146
+
147
+ float2 P = q / R;
148
+ float pl = length(P);
149
+ float nt = t * 0.15 + flowSpin * 0.05;
150
+ float nAmp = 0.20 + 0.28 * energy;
151
+ float2 sp = P + nAmp * float2(snoise(float3(P * 0.7, nt)), snoise(float3(P * 0.7 + 4.7, nt)));
152
+ float ang = atan(P.y, P.x);
153
+ float wave = (0.018 + 0.025 * energy) * sin(pl * 5.0 - t * 2.0) * ss(0.0, 0.4, pl);
154
+ sp += wave * float2(-sin(ang), cos(ang));
155
+ sp = rot2(sp, flowSpin * 0.30);
156
+ float2 gtoP = q - (hoverAmt > 0.001 ? hover : tap);
157
+ sp += (gtoP / (length(gtoP) + 1e-4)) * (tapRipple(q) + hoverRipple(q)) * 0.5;
158
+ float bt = t;
159
+ float a0 = orbSpin * 0.42 + 2.0 * snoise(float3(bt * 0.12, 0.0, 0.0));
160
+ float a1 = -orbSpin * 0.34 + 2.0 * snoise(float3(bt * 0.10, 5.0, 0.0)) + 2.0;
161
+ float a2 = orbSpin * 0.30 + 2.0 * snoise(float3(bt * 0.11, 9.0, 0.0)) + 1.0;
162
+ float a3 = -orbSpin * 0.26 + 2.0 * snoise(float3(bt * 0.09, 14.0, 0.0)) + 3.5;
163
+ float2 c0 = 0.40 * float2(cos(a0), sin(a0));
164
+ float2 c1 = 0.38 * float2(cos(a1), sin(a1));
165
+ float2 c2c = 0.36 * float2(cos(a2), sin(a2));
166
+ float2 c3c = 0.34 * float2(cos(a3), sin(a3));
167
+ float b0 = ss(1.15, 0.1, length(sp - c0));
168
+ float b1 = ss(1.30, 0.1, length(sp - c1));
169
+ float b2 = ss(1.20, 0.1, length(sp - c2c));
170
+ float b3 = ss(1.25, 0.1, length(sp - c3c));
171
+
172
+ float3 k0 = saturate3(vivid(col0), 1.7);
173
+ float3 kL = saturate3(clamp(vivid(col0) * 1.18, 0.0, 1.0), 1.3);
174
+ float3 kD = saturate3(vivid(col0) * 0.85, 1.3);
175
+ float3 colB = mix(kL, saturate3(vivid(col1), 1.7), clamp(count - 1.0, 0.0, 1.0));
176
+ float3 colC = mix(kD, saturate3(vivid(col2), 1.7), clamp(count - 2.0, 0.0, 1.0));
177
+ float3 colD = saturate3(vivid(col3), 1.7);
178
+ float3 colE = saturate3(vivid(col4), 1.7);
179
+ float3 base = saturate3(mix(vivid(col0), float3(1.0), 0.06), 1.3);
180
+ float3 col = base;
181
+ col = mix(col, k0, b0);
182
+ col = mix(col, colB, b1);
183
+ col = mix(col, colC, b0 * 0.5);
184
+ col = mix(col, colD, b2 * clamp(count - 3.0, 0.0, 1.0));
185
+ col = mix(col, colE, b3 * clamp(count - 4.0, 0.0, 1.0));
186
+ col = saturate3(col, 1.15);
187
+ col = clamp(col * 1.12, 0.0, 1.0);
188
+ col = desat(col, sat);
189
+
190
+ float z = sqrt(max(1.0 - p * p, 0.0));
191
+ float3 nrm = normalize(float3(q / R, z + 1e-4));
192
+ float3 Ld = normalize(float3(-0.35, 0.45, 0.85));
193
+ float diff = clamp(dot(nrm, Ld), 0.0, 1.0);
194
+ col *= 0.80 + 0.20 * diff;
195
+ float fres = pow(1.0 - clamp(nrm.z, 0.0, 1.0), 2.5);
196
+ col += fres * 0.10 * mix(float3(1.0), k0, 0.6);
197
+
198
+ float3 haloCol = mix(mix(vivid(col0), float3(1.0), 0.75), mix(vivid(col0), float3(1.0), 0.32), dark);
199
+ float halo = exp(-sq(max(r - R * 0.8, 0.0) / 0.09));
200
+ float haloA = halo * (mix(0.05, 0.10, dark) + 0.05 * react);
201
+ float waves = clamp(b0 + 0.8 * b1, 0.0, 1.0);
202
+ float bodyA = clamp(body * (0.15 + 0.60 * waves + 0.06 * core) * (0.92 + 0.08 * fres), 0.0, 1.0);
203
+ float fade = mix(1.0, 0.45 + 0.35 * sin(t * 2.0), load);
204
+ float3 pm = col * bodyA + haloCol * haloA * (1.0 - bodyA);
205
+ float al = bodyA + haloA * (1.0 - bodyA);
206
+ float gain = bright * fade;
207
+ return half4(half3(pm * gain), half(al * gain));
208
+ }
209
+ `;
210
+
211
+ let effect: SkRuntimeEffect | null | undefined;
212
+
213
+ /**
214
+ * The compiled shader, shared by every glow: it compiles once, the first time a glow draws. Null
215
+ * if Skia cannot compile it, in which case the glow draws nothing.
216
+ */
217
+ export const getGlowEffect = () => {
218
+ if (effect === undefined) {
219
+ effect = Skia.RuntimeEffect.Make(SOURCE);
220
+ if (!effect && __DEV__) {
221
+ console.warn(
222
+ '[stream-chat-react-native/ai-components] VoiceGlow could not compile its shader, so it draws nothing. Please report this with your @shopify/react-native-skia version.',
223
+ );
224
+ }
225
+ }
226
+ return effect;
227
+ };
@@ -0,0 +1,3 @@
1
+ export { VoiceGlow, type VoiceGlowProps } from './VoiceGlow';
2
+ export { VoiceWave, type VoiceWaveProps } from './VoiceWave';
3
+ export type { VoiceAgentState, VoiceVisualizationProps } from './types';
@@ -0,0 +1,73 @@
1
+ import { snoise } from './simplex';
2
+
3
+ /** The shader math the wave runs on the CPU, once per frame, on the UI thread. */
4
+
5
+ export const mix = (a: number, b: number, t: number) => {
6
+ 'worklet';
7
+ return a + (b - a) * t;
8
+ };
9
+
10
+ export const fract = (x: number) => {
11
+ 'worklet';
12
+ return x - Math.floor(x);
13
+ };
14
+
15
+ export const clamp = (x: number, low: number, high: number) => {
16
+ 'worklet';
17
+ return Math.min(Math.max(x, low), high);
18
+ };
19
+
20
+ /** GLSL's smoothstep, evaluated the same with its edges either way round. */
21
+ export const smoothstep = (edge0: number, edge1: number, x: number) => {
22
+ 'worklet';
23
+ const t = clamp((x - edge0) / (edge1 - edge0), 0, 1);
24
+ return t * t * (3 - 2 * t);
25
+ };
26
+
27
+ /** HSV, hue a fraction of a turn, into `out` as RGB. */
28
+ export const hsvToRgb = (hue: number, saturation: number, value: number, out: number[]) => {
29
+ 'worklet';
30
+ for (let i = 0; i < 3; i++) {
31
+ const k = i === 0 ? 1 : i === 1 ? 2 / 3 : 1 / 3;
32
+ const p = Math.abs(fract(hue + k) * 6 - 3);
33
+ out[i] = value * mix(1, clamp(p - 1, 0, 1), saturation);
34
+ }
35
+ };
36
+
37
+ /** A palette color as is; dark mode lifts saturation a touch so it stays vivid on black. */
38
+ export const vivid = (
39
+ color: { hue: number; saturation: number; value: number },
40
+ dark: number,
41
+ out: number[],
42
+ ) => {
43
+ 'worklet';
44
+ hsvToRgb(color.hue, clamp(color.saturation + dark * 0.06, 0, 1), color.value, out);
45
+ };
46
+
47
+ /** Pushes `c` away from its luminance by `amount`; below 1 desaturates. */
48
+ export const saturate = (c: number[], amount: number) => {
49
+ 'worklet';
50
+ const l = 0.299 * c[0] + 0.587 * c[1] + 0.114 * c[2];
51
+ for (let i = 0; i < 3; i++) c[i] = clamp(mix(l, c[i], amount), 0, 1);
52
+ };
53
+
54
+ /**
55
+ * How much the agent is talking, 0 to 1: a slow phrase gate times a faster syllable wobble. The
56
+ * shader's own envelope, on the same simplex noise, so the wave and the glow speak alike.
57
+ */
58
+ export const speechEnv = (t: number) => {
59
+ 'worklet';
60
+ const gate = smoothstep(-0.25, 0.35, snoise(t * 0.6, 21, 0));
61
+ const syllable = 0.55 + 0.45 * snoise(t * 3, 5, 0);
62
+ return clamp(gate * syllable, 0, 1);
63
+ };
64
+
65
+ /** `expressivity` from 0 to 2; one that is not a number gets the default, 1. */
66
+ export const expressivityInput = (expressivity: number | undefined) =>
67
+ typeof expressivity === 'number' && Number.isFinite(expressivity) ? clamp(expressivity, 0, 2) : 1;
68
+
69
+ /** `level` from 0 to 1; one that is not a number counts as no live audio, so it can't stall the motion. */
70
+ export const audioLevelInput = (level: number | null | undefined) => {
71
+ 'worklet';
72
+ return typeof level === 'number' && Number.isFinite(level) ? clamp(level, 0, 1) : null;
73
+ };
@@ -0,0 +1,59 @@
1
+ import { processColor } from 'react-native';
2
+
3
+ import type { Hsv } from './types';
4
+
5
+ export const MAXIMUM_COLORS = 5;
6
+
7
+ export type Rgb = [number, number, number];
8
+
9
+ /** Used when neither the `colors` prop nor the theme gives a readable color. */
10
+ export const FALLBACK_COLOR = '#005fff';
11
+
12
+ /**
13
+ * Reads any color React Native understands (names, `#rgb[a]`, `#rrggbb[aa]`, `rgb()`, `hsl()`, ...)
14
+ * into sRGB channels from 0 to 1, or null when it cannot be read. Platform colors have no
15
+ * channels to read and count as unreadable.
16
+ */
17
+ export const parseColor = (color: string): Rgb | null => {
18
+ if (typeof color !== 'string' || !color.trim()) return null;
19
+ const processed = processColor(color.trim());
20
+ if (typeof processed !== 'number') return null;
21
+ // 0xAARRGGBB, signed on Android.
22
+ const argb = processed < 0 ? processed + 2 ** 32 : processed;
23
+ const channel = (shift: number) => (Math.floor(argb / 2 ** shift) % 256) / 255;
24
+ return [channel(16), channel(8), channel(0)];
25
+ };
26
+
27
+ /** RGB channels from 0 to 1 as HSV, keeping full saturation and value so muted colors render true. */
28
+ export const rgbToHsv = ([r, g, b]: Rgb): Hsv => {
29
+ const high = Math.max(r, g, b);
30
+ const low = Math.min(r, g, b);
31
+ const delta = high - low;
32
+ let hue = 0;
33
+ if (delta !== 0) {
34
+ if (high === r) hue = ((((g - b) / delta) % 6) + 6) % 6;
35
+ else if (high === g) hue = (b - r) / delta + 2;
36
+ else hue = (r - g) / delta + 4;
37
+ }
38
+ return {
39
+ hue: (((hue / 6) % 1) + 1) % 1,
40
+ saturation: high === 0 ? 0 : Math.min(Math.max(delta / high, 0), 1),
41
+ value: Math.min(Math.max(high, 0), 1),
42
+ };
43
+ };
44
+
45
+ /** Colors as the HSV the renderers read, at most five; colors that cannot be read are skipped. */
46
+ export const toHsvPalette = (colors: readonly string[]): Hsv[] =>
47
+ colors
48
+ .map(parseColor)
49
+ .filter((rgb): rgb is Rgb => rgb !== null)
50
+ .slice(0, MAXIMUM_COLORS)
51
+ .map(rgbToHsv);
52
+
53
+ /** Relative luminance of a color, or null when it cannot be read. */
54
+ export const luminance = (color: string) => {
55
+ const rgb = parseColor(color);
56
+ if (!rgb) return null;
57
+ const [r, g, b] = rgb.map((c) => (c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4)));
58
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
59
+ };
@@ -0,0 +1,92 @@
1
+ /**
2
+ * 3-D simplex noise, a port of the glow shader's `snoise` (Ashima Arts / Stefan Gustavson), so the
3
+ * wave drawn on the CPU moves with the same speech rhythm as the shader, as on iOS and the web.
4
+ *
5
+ * It runs in float32 like a GPU, with `mod` as a multiply by a float32 reciprocal, because the
6
+ * hash is sensitive to rounding: in exact arithmetic some inputs hash to a neighbouring gradient.
7
+ * Every function is a worklet, as the motion runs on the UI thread.
8
+ */
9
+
10
+ const INV_289 = Math.fround(1 / 289);
11
+ const ONE_THIRD = Math.fround(1 / 3);
12
+ const ONE_SIXTH = Math.fround(1 / 6);
13
+ const NS_X = Math.fround(2 / 7);
14
+ const NS_Y = Math.fround(Math.fround(0.5 * Math.fround(1 / 7)) - 1);
15
+ const NS_Z = Math.fround(1 / 7);
16
+
17
+ const mod289 = (x: number) => {
18
+ 'worklet';
19
+ const f = Math.fround;
20
+ return f(x - f(289 * Math.floor(f(x * INV_289))));
21
+ };
22
+
23
+ const permute = (x: number) => {
24
+ 'worklet';
25
+ const f = Math.fround;
26
+ return mod289(f(f(f(x * 34) + 1) * x));
27
+ };
28
+
29
+ const taylorInvSqrt = (r: number) => {
30
+ 'worklet';
31
+ const f = Math.fround;
32
+ return f(1.79284291400159 - f(0.85373472095314 * r));
33
+ };
34
+
35
+ /** A corner's contribution, its gradient from its hash as the shader's x_/y_/h/sh steps compute it. */
36
+ const corner = (p: number, x: number, y: number, z: number) => {
37
+ 'worklet';
38
+ const f = Math.fround;
39
+ const j = f(p - f(49 * Math.floor(f(f(p * NS_Z) * NS_Z))));
40
+ const xi = Math.floor(f(j * NS_Z));
41
+ const yi = Math.floor(f(j - f(7 * xi)));
42
+ const gx0 = f(f(xi * NS_X) + NS_Y);
43
+ const gy0 = f(f(yi * NS_X) + NS_Y);
44
+ const gz = f(f(1 - Math.abs(gx0)) - Math.abs(gy0));
45
+ const sh = gz <= 0 ? -1 : 0;
46
+ const gx = f(gx0 + f((Math.floor(gx0) * 2 + 1) * sh));
47
+ const gy = f(gy0 + f((Math.floor(gy0) * 2 + 1) * sh));
48
+ const norm = taylorInvSqrt(gx * gx + gy * gy + gz * gz);
49
+ const m = Math.max(0.6 - (x * x + y * y + z * z), 0);
50
+ return m * m * m * m * (gx * norm * x + gy * norm * y + gz * norm * z);
51
+ };
52
+
53
+ /** Simplex noise at (x, y, z), from about -1 to 1. */
54
+ export const snoise = (inX: number, inY: number, inZ: number) => {
55
+ 'worklet';
56
+ const f = Math.fround;
57
+ const vx = f(inX);
58
+ const vy = f(inY);
59
+ const vz = f(inZ);
60
+ const s = f(f(vx + vy + vz) * ONE_THIRD);
61
+ const ix = Math.floor(f(vx + s));
62
+ const iy = Math.floor(f(vy + s));
63
+ const iz = Math.floor(f(vz + s));
64
+ const t = f(f(ix + iy + iz) * ONE_SIXTH);
65
+ const x0 = f(f(vx - ix) + t);
66
+ const y0 = f(f(vy - iy) + t);
67
+ const z0 = f(f(vz - iz) + t);
68
+
69
+ const gx = x0 >= y0 ? 1 : 0;
70
+ const gy = y0 >= z0 ? 1 : 0;
71
+ const gz = z0 >= x0 ? 1 : 0;
72
+ const i1x = Math.min(gx, 1 - gz);
73
+ const i1y = Math.min(gy, 1 - gx);
74
+ const i1z = Math.min(gz, 1 - gy);
75
+ const i2x = Math.max(gx, 1 - gz);
76
+ const i2y = Math.max(gy, 1 - gx);
77
+ const i2z = Math.max(gz, 1 - gy);
78
+
79
+ const mx = mod289(ix);
80
+ const my = mod289(iy);
81
+ const mz = mod289(iz);
82
+ const hash = (dx: number, dy: number, dz: number) =>
83
+ permute(f(f(permute(f(f(permute(f(mz + dz)) + my) + dy)) + mx) + dx));
84
+
85
+ return (
86
+ 42 *
87
+ (corner(hash(0, 0, 0), x0, y0, z0) +
88
+ corner(hash(i1x, i1y, i1z), x0 - i1x + 1 / 6, y0 - i1y + 1 / 6, z0 - i1z + 1 / 6) +
89
+ corner(hash(i2x, i2y, i2z), x0 - i2x + 1 / 3, y0 - i2y + 1 / 3, z0 - i2z + 1 / 3) +
90
+ corner(hash(1, 1, 1), x0 - 0.5, y0 - 0.5, z0 - 0.5))
91
+ );
92
+ };
@@ -0,0 +1,42 @@
1
+ import { LEVEL_RESPONSE, type LevelResponse } from './driver';
2
+
3
+ /**
4
+ * What tells the glow and the wave apart besides how they draw, as on iOS.
5
+ *
6
+ * - `levelResponse`: the wave's height tracks the level directly, so it follows it smoothly;
7
+ * per-syllable jumps would make it jitter. The glow follows it closely.
8
+ * - `maxScale`: the densest it renders. The glow is soft all over, so 2x is enough; the wave's
9
+ * thin line is drawn at the screen's own scale, up to 3x, to stay crisp.
10
+ * - `contains`: whether a point, centred and normalized to the shorter side with y up, is on the
11
+ * shape rather than the empty space around it.
12
+ */
13
+ export type VoiceVisualizationStyle = {
14
+ contains: (x: number, y: number) => boolean;
15
+ /** The shape's bounds as a share of the shorter side, for the area that takes touches. */
16
+ hitArea: { width: number; height: number };
17
+ levelResponse: LevelResponse;
18
+ maxScale: number;
19
+ };
20
+
21
+ /** How far from the centre a tap still lands on the globe, as a share of the shorter side. */
22
+ const GLOBE_REACH = 0.32;
23
+
24
+ export const GLOW_STYLE: VoiceVisualizationStyle = {
25
+ contains: (x, y) => {
26
+ 'worklet';
27
+ return Math.hypot(x, y) < GLOBE_REACH;
28
+ },
29
+ hitArea: { height: 2 * GLOBE_REACH, width: 2 * GLOBE_REACH },
30
+ levelResponse: LEVEL_RESPONSE.steady,
31
+ maxScale: 2,
32
+ };
33
+
34
+ export const WAVE_STYLE: VoiceVisualizationStyle = {
35
+ contains: (x, y) => {
36
+ 'worklet';
37
+ return Math.abs(x) < 0.5 && Math.abs(y) < 0.14;
38
+ },
39
+ hitArea: { height: 0.28, width: 1 },
40
+ levelResponse: LEVEL_RESPONSE.smooth,
41
+ maxScale: 3,
42
+ };
@@ -0,0 +1,44 @@
1
+ import type { ViewProps } from 'react-native';
2
+
3
+ import type { SharedValue } from 'react-native-reanimated';
4
+
5
+ /**
6
+ * What a voice agent is doing, which a voice visualization shows as motion.
7
+ *
8
+ * The states differ only in how a visualization moves, never in its colors, and changing the
9
+ * state eases from one motion into the next.
10
+ *
11
+ * - `idle`: waiting to be spoken to, a calm, barely-there shimmer.
12
+ * - `connecting`: not ready yet, a loader sweep with a pulsing breath.
13
+ * - `listening`: hearing somebody, a gentle expand and contract.
14
+ * - `thinking`: working on an answer, a slow turn or a travelling wave.
15
+ * - `speaking`: talking, strong motion that ebbs and pauses like speech.
16
+ */
17
+ export type VoiceAgentState = 'idle' | 'connecting' | 'listening' | 'thinking' | 'speaking';
18
+
19
+ export type VoiceVisualizationProps = Omit<ViewProps, 'children'> & {
20
+ /** What the agent is doing, which sets how the visualization moves. */
21
+ state: VoiceAgentState;
22
+ /**
23
+ * The level of whoever is talking, from 0 to 1, read once a frame on the UI thread. Feed it at
24
+ * 15 Hz or more for the visualization to move with the words; `null` animates speech on its own.
25
+ * See `useDictationAudioLevel` for the level of the microphone while dictating.
26
+ */
27
+ audioLevel?: SharedValue<number | null>;
28
+ /**
29
+ * One to five colors. Past five are ignored, and colors that cannot be read are skipped. When
30
+ * omitted or empty, the theme's `voiceVisualization.colors` are used.
31
+ */
32
+ colors?: string[];
33
+ /** From 0 to 2: how far and how fast it moves. Colors never change with it. Defaults to 1. */
34
+ expressivity?: number;
35
+ /**
36
+ * What screen readers read as the value for each state, for example to translate them. Defaults
37
+ * to "Ready", "Connecting", "Listening", "Thinking" and "Speaking". The label, "Voice agent", is
38
+ * `accessibilityLabel`.
39
+ */
40
+ stateLabels?: Partial<Record<VoiceAgentState, string>>;
41
+ };
42
+
43
+ /** A color as hue (a fraction of a turn), saturation and value, each from 0 to 1. */
44
+ export type Hsv = { hue: number; saturation: number; value: number };
@@ -0,0 +1,34 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { AccessibilityInfo } from 'react-native';
3
+
4
+ /**
5
+ * Whether the system asks for less motion: Reduce Motion on iOS, animations off on Android. It
6
+ * follows the setting while mounted.
7
+ *
8
+ * The AI entry point cannot reach the core SDK's own hook, which also only applies once its
9
+ * accessibility layer is enabled; the voice visualizations always honour the setting, as on iOS
10
+ * and Android.
11
+ */
12
+ export const useReduceMotion = () => {
13
+ const [reduceMotion, setReduceMotion] = useState(false);
14
+
15
+ useEffect(() => {
16
+ let mounted = true;
17
+ AccessibilityInfo.isReduceMotionEnabled?.()
18
+ .then((enabled) => {
19
+ // It starts off; only turning it on needs a render.
20
+ if (mounted && enabled) setReduceMotion(true);
21
+ })
22
+ .catch(() => undefined);
23
+ const subscription = AccessibilityInfo.addEventListener?.(
24
+ 'reduceMotionChanged',
25
+ setReduceMotion,
26
+ );
27
+ return () => {
28
+ mounted = false;
29
+ subscription?.remove();
30
+ };
31
+ }, []);
32
+
33
+ return reduceMotion;
34
+ };