stream-chat-react-native-core 9.10.2 → 9.11.0-beta.2

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 (184) 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/version.json +1 -1
  53. package/lib/module/ai-components/README.md +50 -2
  54. package/lib/module/ai-components/index.js +24 -0
  55. package/lib/module/ai-components/index.js.map +1 -1
  56. package/lib/module/ai-components/message-composer/ComposerView.js +4 -2
  57. package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
  58. package/lib/module/ai-components/message-composer/SpeechToTextButton.js +4 -1
  59. package/lib/module/ai-components/message-composer/SpeechToTextButton.js.map +1 -1
  60. package/lib/module/ai-components/native/AIDictation.js +6 -0
  61. package/lib/module/ai-components/native/AIDictation.js.map +1 -1
  62. package/lib/module/ai-components/store/dictation/store.js +4 -2
  63. package/lib/module/ai-components/store/dictation/store.js.map +1 -1
  64. package/lib/module/ai-components/store/dictation/useDictationState.js +4 -2
  65. package/lib/module/ai-components/store/dictation/useDictationState.js.map +1 -1
  66. package/lib/module/ai-components/store/index.js +22 -0
  67. package/lib/module/ai-components/store/index.js.map +1 -1
  68. package/lib/module/ai-components/theme.js +3 -0
  69. package/lib/module/ai-components/theme.js.map +1 -1
  70. package/lib/module/ai-components/transcription/useDictation.js +7 -3
  71. package/lib/module/ai-components/transcription/useDictation.js.map +1 -1
  72. package/lib/module/ai-components/transcription/useDictationAudioLevel.js +32 -0
  73. package/lib/module/ai-components/transcription/useDictationAudioLevel.js.map +1 -0
  74. package/lib/module/ai-components/voice-visualization/VoiceGlow.js +79 -0
  75. package/lib/module/ai-components/voice-visualization/VoiceGlow.js.map +1 -0
  76. package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js +147 -0
  77. package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js.map +1 -0
  78. package/lib/module/ai-components/voice-visualization/VoiceWave.js +58 -0
  79. package/lib/module/ai-components/voice-visualization/VoiceWave.js.map +1 -0
  80. package/lib/module/ai-components/voice-visualization/bounce.js +60 -0
  81. package/lib/module/ai-components/voice-visualization/bounce.js.map +1 -0
  82. package/lib/module/ai-components/voice-visualization/driver.js +208 -0
  83. package/lib/module/ai-components/voice-visualization/driver.js.map +1 -0
  84. package/lib/module/ai-components/voice-visualization/glowShader.js +218 -0
  85. package/lib/module/ai-components/voice-visualization/glowShader.js.map +1 -0
  86. package/lib/module/ai-components/voice-visualization/index.js +18 -0
  87. package/lib/module/ai-components/voice-visualization/index.js.map +1 -0
  88. package/lib/module/ai-components/voice-visualization/math.js +70 -0
  89. package/lib/module/ai-components/voice-visualization/math.js.map +1 -0
  90. package/lib/module/ai-components/voice-visualization/palette.js +47 -0
  91. package/lib/module/ai-components/voice-visualization/palette.js.map +1 -0
  92. package/lib/module/ai-components/voice-visualization/simplex.js +77 -0
  93. package/lib/module/ai-components/voice-visualization/simplex.js.map +1 -0
  94. package/lib/module/ai-components/voice-visualization/styles.js +33 -0
  95. package/lib/module/ai-components/voice-visualization/styles.js.map +1 -0
  96. package/lib/module/ai-components/voice-visualization/types.js +4 -0
  97. package/lib/module/ai-components/voice-visualization/types.js.map +1 -0
  98. package/lib/module/ai-components/voice-visualization/useReduceMotion.js +28 -0
  99. package/lib/module/ai-components/voice-visualization/useReduceMotion.js.map +1 -0
  100. package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js +129 -0
  101. package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js.map +1 -0
  102. package/lib/module/ai-components/voice-visualization/waveGeometry.js +124 -0
  103. package/lib/module/ai-components/voice-visualization/waveGeometry.js.map +1 -0
  104. package/lib/module/version.json +1 -1
  105. package/lib/typescript/ai-components/index.d.ts +3 -1
  106. package/lib/typescript/ai-components/index.d.ts.map +1 -1
  107. package/lib/typescript/ai-components/message-composer/ComposerView.d.ts.map +1 -1
  108. package/lib/typescript/ai-components/native/AIDictation.d.ts +6 -0
  109. package/lib/typescript/ai-components/native/AIDictation.d.ts.map +1 -1
  110. package/lib/typescript/ai-components/store/dictation/store.d.ts +7 -0
  111. package/lib/typescript/ai-components/store/dictation/store.d.ts.map +1 -1
  112. package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts +1 -0
  113. package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts.map +1 -1
  114. package/lib/typescript/ai-components/store/index.d.ts +2 -0
  115. package/lib/typescript/ai-components/store/index.d.ts.map +1 -1
  116. package/lib/typescript/ai-components/theme.d.ts +13 -0
  117. package/lib/typescript/ai-components/theme.d.ts.map +1 -1
  118. package/lib/typescript/ai-components/transcription/useDictation.d.ts +9 -1
  119. package/lib/typescript/ai-components/transcription/useDictation.d.ts.map +1 -1
  120. package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts +11 -0
  121. package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts.map +1 -0
  122. package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts +13 -0
  123. package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts.map +1 -0
  124. package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts +26 -0
  125. package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts.map +1 -0
  126. package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts +13 -0
  127. package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts.map +1 -0
  128. package/lib/typescript/ai-components/voice-visualization/bounce.d.ts +20 -0
  129. package/lib/typescript/ai-components/voice-visualization/bounce.d.ts.map +1 -0
  130. package/lib/typescript/ai-components/voice-visualization/driver.d.ts +96 -0
  131. package/lib/typescript/ai-components/voice-visualization/driver.d.ts.map +1 -0
  132. package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts +7 -0
  133. package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts.map +1 -0
  134. package/lib/typescript/ai-components/voice-visualization/index.d.ts +4 -0
  135. package/lib/typescript/ai-components/voice-visualization/index.d.ts.map +1 -0
  136. package/lib/typescript/ai-components/voice-visualization/math.d.ts +26 -0
  137. package/lib/typescript/ai-components/voice-visualization/math.d.ts.map +1 -0
  138. package/lib/typescript/ai-components/voice-visualization/palette.d.ts +18 -0
  139. package/lib/typescript/ai-components/voice-visualization/palette.d.ts.map +1 -0
  140. package/lib/typescript/ai-components/voice-visualization/simplex.d.ts +11 -0
  141. package/lib/typescript/ai-components/voice-visualization/simplex.d.ts.map +1 -0
  142. package/lib/typescript/ai-components/voice-visualization/styles.d.ts +24 -0
  143. package/lib/typescript/ai-components/voice-visualization/styles.d.ts.map +1 -0
  144. package/lib/typescript/ai-components/voice-visualization/types.d.ts +45 -0
  145. package/lib/typescript/ai-components/voice-visualization/types.d.ts.map +1 -0
  146. package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts +10 -0
  147. package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts.map +1 -0
  148. package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts +18 -0
  149. package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts.map +1 -0
  150. package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts +25 -0
  151. package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts.map +1 -0
  152. package/package.json +2 -2
  153. package/src/ai-components/README.md +50 -2
  154. package/src/ai-components/__tests__/VoiceVisualization.test.tsx +208 -0
  155. package/src/ai-components/__tests__/dictation.test.tsx +58 -1
  156. package/src/ai-components/__tests__/voiceDriver.test.ts +317 -0
  157. package/src/ai-components/__tests__/voicePalette.test.ts +124 -0
  158. package/src/ai-components/index.ts +3 -1
  159. package/src/ai-components/message-composer/ComposerView.tsx +6 -3
  160. package/src/ai-components/message-composer/SpeechToTextButton.tsx +5 -2
  161. package/src/ai-components/native/AIDictation.ts +11 -0
  162. package/src/ai-components/store/dictation/store.ts +9 -0
  163. package/src/ai-components/store/dictation/useDictationState.ts +2 -1
  164. package/src/ai-components/store/index.ts +2 -0
  165. package/src/ai-components/theme.ts +16 -0
  166. package/src/ai-components/transcription/useDictation.ts +16 -3
  167. package/src/ai-components/transcription/useDictationAudioLevel.ts +38 -0
  168. package/src/ai-components/voice-visualization/VoiceGlow.tsx +79 -0
  169. package/src/ai-components/voice-visualization/VoiceVisualizationView.tsx +179 -0
  170. package/src/ai-components/voice-visualization/VoiceWave.tsx +67 -0
  171. package/src/ai-components/voice-visualization/bounce.ts +61 -0
  172. package/src/ai-components/voice-visualization/driver.ts +240 -0
  173. package/src/ai-components/voice-visualization/glowShader.ts +227 -0
  174. package/src/ai-components/voice-visualization/index.ts +3 -0
  175. package/src/ai-components/voice-visualization/math.ts +73 -0
  176. package/src/ai-components/voice-visualization/palette.ts +59 -0
  177. package/src/ai-components/voice-visualization/simplex.ts +92 -0
  178. package/src/ai-components/voice-visualization/styles.ts +42 -0
  179. package/src/ai-components/voice-visualization/types.ts +44 -0
  180. package/src/ai-components/voice-visualization/useReduceMotion.ts +34 -0
  181. package/src/ai-components/voice-visualization/useVoiceVisualization.ts +153 -0
  182. package/src/ai-components/voice-visualization/waveGeometry.ts +137 -0
  183. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewPollLabel.test.tsx +1 -1
  184. package/src/version.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { type SharedValue } from 'react-native-reanimated';
2
+ /**
3
+ * The microphone's live level while dictation listens, from 0 to 1, for the `audioLevel` of
4
+ * `VoiceWave` and `VoiceGlow`. It is `null` while dictation is not listening, which lets a
5
+ * visualization animate speech on its own.
6
+ *
7
+ * The level is a shared value rather than state, so a level changing many times a second
8
+ * re-renders nothing: the visualizations read it once a frame on the UI thread.
9
+ */
10
+ export declare const useDictationAudioLevel: () => SharedValue<number | null>;
11
+ //# sourceMappingURL=useDictationAudioLevel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDictationAudioLevel.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/transcription/useDictationAudioLevel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,yBAAyB,CAAC;AAI3E;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,QAAO,WAAW,CAAC,MAAM,GAAG,IAAI,CAuBlE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { VoiceVisualizationProps } from './types';
3
+ export type VoiceGlowProps = VoiceVisualizationProps;
4
+ /**
5
+ * A voice agent as a soft, airy globe: color masses orbit inside it and swell with speech, and the
6
+ * gaps between them let the background show through. Tapping the globe bounces it and ripples it
7
+ * from the touch, and so does a hovering mouse or pen.
8
+ *
9
+ * It has no size of its own and draws in the middle of the view it is given, about half as wide
10
+ * as its shorter side, so give it a square.
11
+ */
12
+ export declare const VoiceGlow: (props: VoiceGlowProps) => React.JSX.Element;
13
+ //# sourceMappingURL=VoiceGlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VoiceGlow.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/VoiceGlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIvD,MAAM,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAuDrD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,sBAE9C,CAAC"}
@@ -0,0 +1,26 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import type { VoiceVisualizationStyle } from './styles';
3
+ import type { VoiceVisualizationProps } from './types';
4
+ import { type VoiceVisualization } from './useVoiceVisualization';
5
+ /** What the renderer draws in: the canvas size, in its own units, and the screen's pixels per unit. */
6
+ export type VoiceCanvasSize = {
7
+ height: number;
8
+ pixelRatio: number;
9
+ width: number;
10
+ };
11
+ type ViewProps = VoiceVisualizationProps & {
12
+ /** Draws the visualization into a canvas of the given size. */
13
+ renderCanvas: (visualization: VoiceVisualization, size: VoiceCanvasSize) => ReactNode;
14
+ visualStyle: VoiceVisualizationStyle;
15
+ };
16
+ /**
17
+ * What VoiceWave and VoiceGlow share: the motion, the canvas kept at the view's size and at most
18
+ * the style's density, reduced motion, taps and hover, and accessibility.
19
+ *
20
+ * It names itself "Voice agent" with its state as the value, as on iOS and Android. Touches are
21
+ * only watched, never claimed, so a press handler on the view or a parent still gets them, and
22
+ * only the shape takes them: around it they reach whatever is behind.
23
+ */
24
+ export declare const VoiceVisualizationView: ({ accessibilityLabel, accessibilityValue, audioLevel, colors, expressivity, onLayout, pointerEvents, renderCanvas, state, stateLabels, style, visualStyle, ...restProps }: ViewProps) => React.JSX.Element;
25
+ export {};
26
+ //# sourceMappingURL=VoiceVisualizationView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VoiceVisualizationView.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/VoiceVisualizationView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAY9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAmB,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEzF,uGAAuG;AACvG,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpF,KAAK,SAAS,GAAG,uBAAuB,GAAG;IACzC,+DAA+D;IAC/D,YAAY,EAAE,CAAC,aAAa,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,KAAK,SAAS,CAAC;IACtF,WAAW,EAAE,uBAAuB,CAAC;CACtC,CAAC;AAUF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,2KAcpC,SAAS,sBAsHX,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { VoiceVisualizationProps } from './types';
3
+ export type VoiceWaveProps = VoiceVisualizationProps;
4
+ /**
5
+ * A voice agent as a single string, flat at its ends, carrying a wave packet that erupts with
6
+ * speech while its colors flow along it. Tapping the string ripples it from the touch, and so does
7
+ * a hovering mouse or pen.
8
+ *
9
+ * It has no size of its own and draws in the middle of the view it is given, about 80% as wide as
10
+ * its shorter side, so give it a square or a wide box.
11
+ */
12
+ export declare const VoiceWave: (props: VoiceWaveProps) => React.JSX.Element;
13
+ //# sourceMappingURL=VoiceWave.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VoiceWave.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/VoiceWave.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAYvD,MAAM,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAqCrD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,sBAE9C,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The bounce of a tap: a dip to 93% and an overshoot to 103% before settling, over 340 ms.
3
+ *
4
+ * These are authored keyframes rather than a spring: the ease-out curve times the whole run and
5
+ * the keyframes are linear between their stops.
6
+ */
7
+ export declare const BOUNCE_DURATION = 0.34;
8
+ /** How long ago the last bounce started, in seconds; infinite before the first. */
9
+ export type BounceState = {
10
+ age: number;
11
+ };
12
+ export declare const createBounce: () => BounceState;
13
+ export declare const startBounce: (bounce: BounceState) => void;
14
+ export declare const advanceBounce: (bounce: BounceState, seconds: number) => void;
15
+ /** CSS `ease-out`, `cubic-bezier(0, 0, 0.58, 1)`. */
16
+ export declare const easeOut: (x: number) => number;
17
+ /** The keyframed scale at `progress`, from 0 to 1. */
18
+ export declare const scaleAt: (progress: number) => number;
19
+ export declare const bounceScale: (bounce: BounceState) => number;
20
+ //# sourceMappingURL=bounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounce.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/bounce.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AAKpC,mFAAmF;AACnF,MAAM,MAAM,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,eAAO,MAAM,YAAY,QAAO,WAAkD,CAAC;AAEnF,eAAO,MAAM,WAAW,GAAI,QAAQ,WAAW,SAG9C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,WAAW,EAAE,SAAS,MAAM,SAGjE,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,WAehC,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,WASvC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,WAAW,WAI9C,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { type BounceState } from './bounce';
2
+ import type { Hsv, VoiceAgentState } from './types';
3
+ /**
4
+ * The share of the way the live level moves each frame at 60 Hz, toward a louder or a quieter
5
+ * level.
6
+ */
7
+ export type LevelResponse = {
8
+ rise: number;
9
+ fall: number;
10
+ };
11
+ export declare const LEVEL_RESPONSE: {
12
+ /** Follows the level closely, both ways. The glow's. */
13
+ steady: {
14
+ fall: number;
15
+ rise: number;
16
+ };
17
+ /**
18
+ * Follows the level like a VU meter: about 0.1 s up to a louder reading, about 0.3 s down from
19
+ * it, so a meter's per-syllable jumps swell with the phrase instead. The wave's.
20
+ */
21
+ smooth: {
22
+ fall: number;
23
+ rise: number;
24
+ };
25
+ };
26
+ export type VoiceDriverInput = {
27
+ state: VoiceAgentState;
28
+ /** One to five colors. */
29
+ colors: Hsv[];
30
+ /** From 0 to 2. */
31
+ expressivity: number;
32
+ /** From 0 to 1, or null when no live audio drives the motion. */
33
+ audioLevel: number | null;
34
+ reduceMotion: boolean;
35
+ };
36
+ /**
37
+ * The motion of a voice visualization: where it is in time, how it moves, and its colors. A plain
38
+ * object rather than a class, so it can live in a shared value and be advanced on the UI thread.
39
+ */
40
+ export type VoiceDriverState = {
41
+ speed: number;
42
+ bright: number;
43
+ sat: number;
44
+ load: number;
45
+ flow: number;
46
+ baseReact: number;
47
+ expressivity: number;
48
+ time: number;
49
+ flowSpin: number;
50
+ orbSpin: number;
51
+ count: number;
52
+ tapX: number;
53
+ tapY: number;
54
+ tapAge: number;
55
+ hoverX: number;
56
+ hoverY: number;
57
+ hoverAmount: number;
58
+ isHovering: boolean;
59
+ mic: number;
60
+ voice: number;
61
+ /** The colors drawn, eased in place toward the input's color slots. */
62
+ colors: Hsv[];
63
+ bounce: BounceState;
64
+ levelResponse: LevelResponse;
65
+ };
66
+ export declare const NO_TAP = 100;
67
+ /** How fast time runs under reduced motion. */
68
+ export declare const REDUCED = 0.07;
69
+ /** Expressivity scales amplitude and speed, each with a floor so the motion breathes at 0. */
70
+ export declare const scales: (expressivity: number) => {
71
+ amplitude: number;
72
+ speed: number;
73
+ };
74
+ /**
75
+ * The share of the way a value moves in `dt` seconds when it moves `perFrame` of the way each
76
+ * frame at 60 Hz.
77
+ */
78
+ export declare const ease: (perFrame: number, dt: number) => number;
79
+ /** The five color slots the renderers read; past the palette they repeat its first color. */
80
+ export declare const slots: (colors: Hsv[]) => Hsv[];
81
+ /** A driver settled on `input`, so the first frame shows it rather than easing into it. */
82
+ export declare const createDriverState: (input: VoiceDriverInput, levelResponse?: LevelResponse) => VoiceDriverState;
83
+ /** Live audio lifts the motion to its level, whatever the state. */
84
+ export declare const driverReact: (d: VoiceDriverState) => number;
85
+ /** The scale of a tap's bounce. */
86
+ export declare const driverScale: (d: VoiceDriverState) => number;
87
+ /** A tap at (x, y), centred and normalized to the shorter side with y up. */
88
+ export declare const tapDriver: (d: VoiceDriverState, input: VoiceDriverInput, x: number, y: number) => void;
89
+ /** Where a pointer hovers, or null once it has left. */
90
+ export declare const hoverDriver: (d: VoiceDriverState, input: VoiceDriverInput, x: number | null, y: number | null) => void;
91
+ /**
92
+ * Advances the motion by `seconds`, easing each value toward the input's motion by a fixed share
93
+ * per frame at 60 Hz, converted to time, so it moves the same at any refresh rate.
94
+ */
95
+ export declare const advanceDriver: (d: VoiceDriverState, input: VoiceDriverInput, seconds: number) => void;
96
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAA0C,MAAM,UAAU,CAAC;AAEnG,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,cAAc;IACzB,wDAAwD;;;;;IAExD;;;OAGG;;;;;CAEoC,CAAC;AAE1C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,eAAe,CAAC;IACvB,0BAA0B;IAC1B,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,mBAAmB;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAuBF,eAAO,MAAM,MAAM,MAAM,CAAC;AAE1B,+CAA+C;AAC/C,eAAO,MAAM,OAAO,OAAO,CAAC;AAK5B,8FAA8F;AAC9F,eAAO,MAAM,MAAM,GAAI,cAAc,MAAM;;;CAG1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,GAAI,UAAU,MAAM,EAAE,IAAI,MAAM,WAGhD,CAAC;AAgBF,6FAA6F;AAC7F,eAAO,MAAM,KAAK,GAAI,QAAQ,GAAG,EAAE,KAAG,GAAG,EAMxC,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB,GAC5B,OAAO,gBAAgB,EACvB,gBAAe,aAAqC,KACnD,gBA6BF,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,WAAW,GAAI,GAAG,gBAAgB,WAG9C,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,WAAW,GAAI,GAAG,gBAAgB,WAG9C,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,SAAS,GAAI,GAAG,gBAAgB,EAAE,OAAO,gBAAgB,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,SAO3F,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,WAAW,GACtB,GAAG,gBAAgB,EACnB,OAAO,gBAAgB,EACvB,GAAG,MAAM,GAAG,IAAI,EAChB,GAAG,MAAM,GAAG,IAAI,SAUjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,gBAAgB,EAAE,OAAO,gBAAgB,EAAE,SAAS,MAAM,SAgC1F,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type SkRuntimeEffect } from '@shopify/react-native-skia';
2
+ /**
3
+ * The compiled shader, shared by every glow: it compiles once, the first time a glow draws. Null
4
+ * if Skia cannot compile it, in which case the glow draws nothing.
5
+ */
6
+ export declare const getGlowEffect: () => SkRuntimeEffect | null;
7
+ //# sourceMappingURL=glowShader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glowShader.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/glowShader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAoNxE;;;GAGG;AACH,eAAO,MAAM,aAAa,8BAUzB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { VoiceGlow, type VoiceGlowProps } from './VoiceGlow';
2
+ export { VoiceWave, type VoiceWaveProps } from './VoiceWave';
3
+ export type { VoiceAgentState, VoiceVisualizationProps } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,26 @@
1
+ /** The shader math the wave runs on the CPU, once per frame, on the UI thread. */
2
+ export declare const mix: (a: number, b: number, t: number) => number;
3
+ export declare const fract: (x: number) => number;
4
+ export declare const clamp: (x: number, low: number, high: number) => number;
5
+ /** GLSL's smoothstep, evaluated the same with its edges either way round. */
6
+ export declare const smoothstep: (edge0: number, edge1: number, x: number) => number;
7
+ /** HSV, hue a fraction of a turn, into `out` as RGB. */
8
+ export declare const hsvToRgb: (hue: number, saturation: number, value: number, out: number[]) => void;
9
+ /** A palette color as is; dark mode lifts saturation a touch so it stays vivid on black. */
10
+ export declare const vivid: (color: {
11
+ hue: number;
12
+ saturation: number;
13
+ value: number;
14
+ }, dark: number, out: number[]) => void;
15
+ /** Pushes `c` away from its luminance by `amount`; below 1 desaturates. */
16
+ export declare const saturate: (c: number[], amount: number) => void;
17
+ /**
18
+ * How much the agent is talking, 0 to 1: a slow phrase gate times a faster syllable wobble. The
19
+ * shader's own envelope, on the same simplex noise, so the wave and the glow speak alike.
20
+ */
21
+ export declare const speechEnv: (t: number) => number;
22
+ /** `expressivity` from 0 to 2; one that is not a number gets the default, 1. */
23
+ export declare const expressivityInput: (expressivity: number | undefined) => number;
24
+ /** `level` from 0 to 1; one that is not a number counts as no live audio, so it can't stall the motion. */
25
+ export declare const audioLevelInput: (level: number | null | undefined) => number | null;
26
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/math.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAElF,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,WAGlD,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,WAG9B,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,WAGzD,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,GAAG,MAAM,WAIjE,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,EAAE,YAAY,MAAM,EAAE,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,SAOrF,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,KAAK,GAChB,OAAO;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EACzD,MAAM,MAAM,EACZ,KAAK,MAAM,EAAE,SAId,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,EAAE,QAAQ,MAAM,SAInD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,WAKlC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,GAAI,cAAc,MAAM,GAAG,SAAS,WACiC,CAAC;AAEpG,2GAA2G;AAC3G,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,GAAG,IAAI,GAAG,SAAS,kBAG/D,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { Hsv } from './types';
2
+ export declare const MAXIMUM_COLORS = 5;
3
+ export type Rgb = [number, number, number];
4
+ /** Used when neither the `colors` prop nor the theme gives a readable color. */
5
+ export declare const FALLBACK_COLOR = "#005fff";
6
+ /**
7
+ * Reads any color React Native understands (names, `#rgb[a]`, `#rrggbb[aa]`, `rgb()`, `hsl()`, ...)
8
+ * into sRGB channels from 0 to 1, or null when it cannot be read. Platform colors have no
9
+ * channels to read and count as unreadable.
10
+ */
11
+ export declare const parseColor: (color: string) => Rgb | null;
12
+ /** RGB channels from 0 to 1 as HSV, keeping full saturation and value so muted colors render true. */
13
+ export declare const rgbToHsv: ([r, g, b]: Rgb) => Hsv;
14
+ /** Colors as the HSV the renderers read, at most five; colors that cannot be read are skipped. */
15
+ export declare const toHsvPalette: (colors: readonly string[]) => Hsv[];
16
+ /** Relative luminance of a color, or null when it cannot be read. */
17
+ export declare const luminance: (color: string) => number | null;
18
+ //# sourceMappingURL=palette.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/palette.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,gFAAgF;AAChF,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,GAAG,GAAG,IAQhD,CAAC;AAEF,sGAAsG;AACtG,eAAO,MAAM,QAAQ,GAAI,WAAW,GAAG,KAAG,GAezC,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,YAAY,GAAI,QAAQ,SAAS,MAAM,EAAE,KAAG,GAAG,EAK1C,CAAC;AAEnB,qEAAqE;AACrE,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,kBAKtC,CAAC"}
@@ -0,0 +1,11 @@
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
+ /** Simplex noise at (x, y, z), from about -1 to 1. */
10
+ export declare const snoise: (inX: number, inY: number, inZ: number) => number;
11
+ //# sourceMappingURL=simplex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simplex.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/simplex.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA6CH,sDAAsD;AACtD,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,WAsC3D,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type LevelResponse } from './driver';
2
+ /**
3
+ * What tells the glow and the wave apart besides how they draw, as on iOS.
4
+ *
5
+ * - `levelResponse`: the wave's height tracks the level directly, so it follows it smoothly;
6
+ * per-syllable jumps would make it jitter. The glow follows it closely.
7
+ * - `maxScale`: the densest it renders. The glow is soft all over, so 2x is enough; the wave's
8
+ * thin line is drawn at the screen's own scale, up to 3x, to stay crisp.
9
+ * - `contains`: whether a point, centred and normalized to the shorter side with y up, is on the
10
+ * shape rather than the empty space around it.
11
+ */
12
+ export type VoiceVisualizationStyle = {
13
+ contains: (x: number, y: number) => boolean;
14
+ /** The shape's bounds as a share of the shorter side, for the area that takes touches. */
15
+ hitArea: {
16
+ width: number;
17
+ height: number;
18
+ };
19
+ levelResponse: LevelResponse;
20
+ maxScale: number;
21
+ };
22
+ export declare const GLOW_STYLE: VoiceVisualizationStyle;
23
+ export declare const WAVE_STYLE: VoiceVisualizationStyle;
24
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,0FAA0F;IAC1F,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF,eAAO,MAAM,UAAU,EAAE,uBAQxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,uBAQxB,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import type { SharedValue } from 'react-native-reanimated';
3
+ /**
4
+ * What a voice agent is doing, which a voice visualization shows as motion.
5
+ *
6
+ * The states differ only in how a visualization moves, never in its colors, and changing the
7
+ * state eases from one motion into the next.
8
+ *
9
+ * - `idle`: waiting to be spoken to, a calm, barely-there shimmer.
10
+ * - `connecting`: not ready yet, a loader sweep with a pulsing breath.
11
+ * - `listening`: hearing somebody, a gentle expand and contract.
12
+ * - `thinking`: working on an answer, a slow turn or a travelling wave.
13
+ * - `speaking`: talking, strong motion that ebbs and pauses like speech.
14
+ */
15
+ export type VoiceAgentState = 'idle' | 'connecting' | 'listening' | 'thinking' | 'speaking';
16
+ export type VoiceVisualizationProps = Omit<ViewProps, 'children'> & {
17
+ /** What the agent is doing, which sets how the visualization moves. */
18
+ state: VoiceAgentState;
19
+ /**
20
+ * The level of whoever is talking, from 0 to 1, read once a frame on the UI thread. Feed it at
21
+ * 15 Hz or more for the visualization to move with the words; `null` animates speech on its own.
22
+ * See `useDictationAudioLevel` for the level of the microphone while dictating.
23
+ */
24
+ audioLevel?: SharedValue<number | null>;
25
+ /**
26
+ * One to five colors. Past five are ignored, and colors that cannot be read are skipped. When
27
+ * omitted or empty, the theme's `voiceVisualization.colors` are used.
28
+ */
29
+ colors?: string[];
30
+ /** From 0 to 2: how far and how fast it moves. Colors never change with it. Defaults to 1. */
31
+ expressivity?: number;
32
+ /**
33
+ * What screen readers read as the value for each state, for example to translate them. Defaults
34
+ * to "Ready", "Connecting", "Listening", "Thinking" and "Speaking". The label, "Voice agent", is
35
+ * `accessibilityLabel`.
36
+ */
37
+ stateLabels?: Partial<Record<VoiceAgentState, string>>;
38
+ };
39
+ /** A color as hue (a fraction of a turn), saturation and value, each from 0 to 1. */
40
+ export type Hsv = {
41
+ hue: number;
42
+ saturation: number;
43
+ value: number;
44
+ };
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5F,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IAClE,uEAAuE;IACvE,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,8FAA8F;IAC9F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;CACxD,CAAC;AAEF,qFAAqF;AACrF,MAAM,MAAM,GAAG,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether the system asks for less motion: Reduce Motion on iOS, animations off on Android. It
3
+ * follows the setting while mounted.
4
+ *
5
+ * The AI entry point cannot reach the core SDK's own hook, which also only applies once its
6
+ * accessibility layer is enabled; the voice visualizations always honour the setting, as on iOS
7
+ * and Android.
8
+ */
9
+ export declare const useReduceMotion: () => boolean;
10
+ //# sourceMappingURL=useReduceMotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReduceMotion.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/useReduceMotion.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,eAsB3B,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { VoiceVisualizationStyle } from './styles';
2
+ import type { VoiceVisualizationProps } from './types';
3
+ /**
4
+ * A voice visualization's motion, advanced once a frame on the UI thread.
5
+ *
6
+ * The driver lives in a shared value the renderers derive from, so a frame redraws without
7
+ * re-rendering React, and `audioLevel` is read in the frame callback, so a level changing many
8
+ * times a second re-renders nothing either.
9
+ */
10
+ export declare const useVoiceVisualization: ({ audioLevel, colors, expressivity, state }: VoiceVisualizationProps, style: VoiceVisualizationStyle) => {
11
+ dark: import("react-native-reanimated").SharedValue<number>;
12
+ driver: import("react-native-reanimated").SharedValue<import("./driver").VoiceDriverState>;
13
+ hover: (x: number | null, y: number | null) => void;
14
+ opacity: import("react-native-reanimated").SharedValue<number>;
15
+ tap: (x: number, y: number) => void;
16
+ };
17
+ export type VoiceVisualization = ReturnType<typeof useVoiceVisualization>;
18
+ //# sourceMappingURL=useVoiceVisualization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVoiceVisualization.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/useVoiceVisualization.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAkBvD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,6CAA6C,uBAAuB,EACpE,OAAO,uBAAuB;;;eAwFxB,MAAM,GAAG,IAAI,KAAK,MAAM,GAAG,IAAI;;aAf/B,MAAM,KAAK,MAAM;CA6BxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type SkPath } from '@shopify/react-native-skia';
2
+ import { type VoiceDriverState } from './driver';
3
+ export declare const WAVE_STOPS = 13;
4
+ export declare const WAVE_START = -0.42;
5
+ export declare const WAVE_END = 0.42;
6
+ /** The stops' positions along the gradient, evenly spaced. */
7
+ export declare const WAVE_POSITIONS: number[];
8
+ /** The string's height above its centre line at each point, centred and normalized, y up. */
9
+ export declare const waveHeights: (d: VoiceDriverState) => {
10
+ xs: number[];
11
+ ys: number[];
12
+ };
13
+ /**
14
+ * The wave as a path in a `width` by `height` canvas. Newer Skia versions build immutable paths with
15
+ * `PathBuilder`; earlier 2.x versions mutate `SkPath` itself.
16
+ */
17
+ export declare const wavePath: (d: VoiceDriverState, width: number, height: number) => SkPath;
18
+ /**
19
+ * The string's colors at its gradient stops, as RGBA from 0 to 1: up to five bands drifting along
20
+ * it, weighed by how near their centres are, its ends fading out.
21
+ */
22
+ export declare const waveColors: (d: VoiceDriverState, dark: number) => Float32Array<ArrayBufferLike>[];
23
+ /** The line is 0.6% of the shorter side, and never under 1.5 device pixels, as on Android and iOS. */
24
+ export declare const waveStrokeWidth: (width: number, height: number, pixelRatio: number) => number;
25
+ //# sourceMappingURL=waveGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waveGeometry.d.ts","sourceRoot":"","sources":["../../../../src/ai-components/voice-visualization/waveGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI3E,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,UAAU,QAAQ,CAAC;AAChC,eAAO,MAAM,QAAQ,OAAO,CAAC;AAE7B,8DAA8D;AAC9D,eAAO,MAAM,cAAc,UAAqE,CAAC;AAuBjG,6FAA6F;AAC7F,eAAO,MAAM,WAAW,GAAI,GAAG,gBAAgB;;;CAkC9C,CAAC;AAOF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,gBAAgB,EAAE,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAiB7E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,gBAAgB,EAAE,MAAM,MAAM,oCA6B3D,CAAC;AAEF,sGAAsG;AACtG,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,EAAE,YAAY,MAAM,WACpB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native-core",
3
3
  "description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4
- "version": "9.10.2",
4
+ "version": "9.11.0-beta.2",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -84,7 +84,7 @@
84
84
  "react-native-markdown-package": "1.8.2",
85
85
  "react-native-url-polyfill": "^2.0.0",
86
86
  "react-syntax-highlighter": "^16.1.0",
87
- "stream-chat": "^9.54.1",
87
+ "stream-chat": "^9.54.2",
88
88
  "use-sync-external-store": "^1.5.0",
89
89
  "zod": "^4.1.12"
90
90
  },
@@ -22,12 +22,12 @@ These components used to ship as the standalone `@stream-io/chat-react-native-ai
22
22
 
23
23
  2. Dictation is now opt-in on iOS (see [Dictation](#dictation-speech-to-text)): add `$StreamChatEnableDictation = true` to your `Podfile`, or, with Expo, replace the `@stream-io/chat-react-native-ai` config plugin with `stream-chat-expo`.
24
24
  3. Keep the `export-namespace-from` Babel plugin (see [Installation](#️-installation)); it is needed by the `zod` dependency.
25
- 4. `ShimmeringView` and `toHexFromRNColor` were removed. `AITypingIndicatorView` now uses the SDK's native shimmer, so `@shopify/react-native-skia` is only needed for charts.
25
+ 4. `ShimmeringView` and `toHexFromRNColor` were removed. `AITypingIndicatorView` now uses the SDK's native shimmer, so `@shopify/react-native-skia` is only needed for charts and the voice visualizations.
26
26
  5. `SpeechToTextButton` and `isDictationAvailable` are now exported.
27
27
 
28
28
  ## 🛠️ Installation
29
29
 
30
- The AI components ship with `stream-chat-react-native` and `stream-chat-expo`; their JavaScript dependencies are installed with them. Charts additionally need the following peer dependencies, which only apps using the AI components have to install:
30
+ The AI components ship with `stream-chat-react-native` and `stream-chat-expo`; their JavaScript dependencies are installed with them. Charts and the voice visualizations (`VoiceGlow`, `VoiceWave`) additionally need the following peer dependencies, which only apps using the AI components have to install:
31
31
 
32
32
  ```bash
33
33
  yarn add victory-native @shopify/react-native-skia
@@ -244,6 +244,54 @@ const options = {
244
244
 
245
245
  The `SpeechToTextButton` is already integrated within the `ComposerView`, however feel free to use it elsewhere as well. It renders nothing when dictation is not part of the build (see [Dictation](#dictation-speech-to-text)); `isDictationAvailable()` tells you whether it is.
246
246
 
247
+ ### `VoiceGlow` and `VoiceWave`
248
+
249
+ Two visualizations of a voice agent, alike on iOS, Android, the web and React Native:
250
+
251
+ - `VoiceGlow`: a soft, airy globe whose color masses orbit inside it and swell with speech. It is drawn by a Skia shader, every pixel on the GPU.
252
+ - `VoiceWave`: a single string carrying a wave packet that erupts with speech, its colors flowing along it.
253
+
254
+ Neither has a size of its own: each draws in the middle of the view it is given, the glow about half as wide as its shorter side and the wave about 80% as wide, so give the glow a square and the wave a square or a wide box. Both take the same props, and any other `View` prop goes to their root:
255
+
256
+ | Name | Type | Required | Description |
257
+ | -------------- | ------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
258
+ | `state` | `'idle' \| 'connecting' \| 'listening' \| 'thinking' \| 'speaking'` | yes | What the agent is doing. The states differ only in how it moves, never in its colors, and changing the state eases from one motion into the next. |
259
+ | `audioLevel` | `SharedValue<number \| null>` | no | The level of whoever is talking, from 0 to 1, read once a frame on the UI thread. Feed it at 15 Hz or more for the motion to follow the words. While it is `null` or absent, speech animates on its own. |
260
+ | `colors` | `string[]` | no | One to five colors. Past five are ignored, and colors that cannot be read are skipped. Defaults to the theme's `voiceVisualization.colors`. |
261
+ | `expressivity` | `number` | no | From 0 to 2: how far and how fast it moves. Colors never change with it. Defaults to `1`. |
262
+ | `stateLabels` | `Partial<Record<VoiceAgentState, string>>` | no | What screen readers read as the value for each state, for example to translate them. Defaults to "Ready", "Connecting", "Listening", "Thinking" and "Speaking". |
263
+
264
+ ```tsx
265
+ import { useDictationAudioLevel, VoiceGlow, VoiceWave } from 'stream-chat-react-native/ai-components';
266
+
267
+ const VoiceAgent = ({ agentState, isListening }) => {
268
+ const micLevel = useDictationAudioLevel();
269
+
270
+ return (
271
+ <>
272
+ <VoiceGlow state={agentState} style={{ width: 320, height: 320 }} />
273
+ <VoiceWave
274
+ audioLevel={micLevel}
275
+ state={isListening ? 'listening' : 'idle'}
276
+ style={{ width: '100%', height: 120 }}
277
+ />
278
+ </>
279
+ );
280
+ };
281
+ ```
282
+
283
+ The motion runs entirely on the UI thread with Reanimated and Skia, so the visualizations stay smooth while the JS thread is busy streaming a reply, and a changing `audioLevel` re-renders nothing.
284
+
285
+ **Audio level.** `useDictationAudioLevel()` gives the microphone's level while `useDictation` (or the `SpeechToTextButton`) is listening, and `null` otherwise. For any other source, such as a remote participant's audio level from Stream Video, keep a shared value of your own and write to it: `const level = useSharedValue<number | null>(null)`, then `level.value = participant.audioLevel`.
286
+
287
+ **Interaction.** Tapping the shape bounces it and sends out a ripple, and a hovering mouse or pen ripples it too. Touches are only observed, never claimed, so a `Pressable` around the visualization still gets its press; touches beside the shape reach whatever is behind it.
288
+
289
+ **Theming.** The theme's `voiceVisualization.colors` are the default palette (the accent color unless you set them). The visualizations draw for a light or a dark background following `voiceVisualization.backdropColor` when you set it, and the system color scheme otherwise.
290
+
291
+ **Accessibility.** Each is an image named "Voice agent" with its state as the value ("Ready", "Connecting", "Listening", "Thinking", "Speaking"), as on iOS and Android. Pass `stateLabels` to translate the state values, `accessibilityLabel` to change the label, or `accessibilityValue` to replace the value outright. Under the system's Reduce Motion (animations off on Android), they barely move and ignore taps.
292
+
293
+ **Differences from the native SDKs.** The glow has no `rendering` option: the shader runs on every Android version through Skia, so there is no Canvas fallback, and it does not switch to a cheaper look in battery saver as on Android. A visualization keeps animating while it is mounted, even when scrolled off screen; it pauses only while the app is in the background.
294
+
247
295
  ### Theming
248
296
 
249
297
  Each one of the components in the SDK is fully theme-compatible. The `StreamTheme` provider takes care of this for you.