@actioneer/ads 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/LICENSE +21 -0
  2. package/bin/ads-init.mjs +314 -0
  3. package/components/accordion.d.ts +13 -0
  4. package/components/accordion.js +91 -0
  5. package/components/agents-ui/agent-audio-visualizer-aura.d.ts +11 -0
  6. package/components/agents-ui/agent-audio-visualizer-aura.js +277 -0
  7. package/components/agents-ui/agent-audio-visualizer-wave.d.ts +12 -0
  8. package/components/agents-ui/agent-audio-visualizer-wave.js +203 -0
  9. package/components/agents-ui/react-shader-toy.d.ts +87 -0
  10. package/components/agents-ui/react-shader-toy.js +531 -0
  11. package/components/ai-elements/chain-of-thought.d.ts +30 -0
  12. package/components/ai-elements/chain-of-thought.js +182 -0
  13. package/components/ai-elements/index.d.ts +11 -0
  14. package/components/ai-elements/inline-citation.d.ts +44 -0
  15. package/components/ai-elements/inline-citation.js +314 -0
  16. package/components/ai-elements/message.d.ts +96 -0
  17. package/components/ai-elements/message.js +308 -0
  18. package/components/ai-elements/queue.d.ts +60 -0
  19. package/components/ai-elements/queue.js +193 -0
  20. package/components/ai-elements/reasoning.d.ts +26 -0
  21. package/components/ai-elements/reasoning.js +131 -0
  22. package/components/ai-elements/shimmer.d.ts +25 -0
  23. package/components/ai-elements/shimmer.js +44 -0
  24. package/components/ai-elements/speech-input.d.ts +16 -0
  25. package/components/ai-elements/speech-input.js +151 -0
  26. package/components/ai-elements/task-progress.d.ts +41 -0
  27. package/components/ai-elements/task-progress.js +211 -0
  28. package/components/ai-elements/task.d.ts +35 -0
  29. package/components/ai-elements/task.js +73 -0
  30. package/components/ai-elements/tool.d.ts +53 -0
  31. package/components/ai-elements/tool.js +116 -0
  32. package/components/ai-elements/voice.d.ts +74 -0
  33. package/components/ai-elements/voice.js +875 -0
  34. package/components/alert.d.ts +21 -0
  35. package/components/alert.js +76 -0
  36. package/components/answer.d.ts +984 -0
  37. package/components/answer.js +543 -0
  38. package/components/assistant-ui/action-bar.d.ts +3 -0
  39. package/components/assistant-ui/action-bar.js +57 -0
  40. package/components/assistant-ui/answer-tool-ui.d.ts +5 -0
  41. package/components/assistant-ui/answer-tool-ui.js +42 -0
  42. package/components/assistant-ui/attachment.d.ts +50 -0
  43. package/components/assistant-ui/attachment.js +353 -0
  44. package/components/assistant-ui/badge.d.ts +11 -0
  45. package/components/assistant-ui/badge.js +54 -0
  46. package/components/assistant-ui/branch-picker.d.ts +3 -0
  47. package/components/assistant-ui/branch-picker.js +36 -0
  48. package/components/assistant-ui/chain-of-thought.d.ts +46 -0
  49. package/components/assistant-ui/composer-add-context.d.ts +50 -0
  50. package/components/assistant-ui/composer-add-context.js +209 -0
  51. package/components/assistant-ui/composer-deep-research.d.ts +16 -0
  52. package/components/assistant-ui/composer-deep-research.js +38 -0
  53. package/components/assistant-ui/composer-harness.d.ts +18 -0
  54. package/components/assistant-ui/composer-harness.js +186 -0
  55. package/components/assistant-ui/composer-trigger-popover.d.ts +47 -0
  56. package/components/assistant-ui/composer-trigger-popover.js +147 -0
  57. package/components/assistant-ui/composer.d.ts +8 -0
  58. package/components/assistant-ui/composer.js +276 -0
  59. package/components/assistant-ui/directive-text.d.ts +16 -0
  60. package/components/assistant-ui/directive-text.js +40 -0
  61. package/components/assistant-ui/error.d.ts +6 -0
  62. package/components/assistant-ui/error.js +39 -0
  63. package/components/assistant-ui/file.d.ts +37 -0
  64. package/components/assistant-ui/file.js +159 -0
  65. package/components/assistant-ui/follow-up-suggestions.d.ts +7 -0
  66. package/components/assistant-ui/follow-up-suggestions.js +44 -0
  67. package/components/assistant-ui/image.d.ts +46 -0
  68. package/components/assistant-ui/image.js +351 -0
  69. package/components/assistant-ui/index.d.ts +28 -0
  70. package/components/assistant-ui/markdown-text.d.ts +1 -0
  71. package/components/assistant-ui/markdown-text.js +242 -0
  72. package/components/assistant-ui/message-timing.d.ts +25 -0
  73. package/components/assistant-ui/message-timing.js +56 -0
  74. package/components/assistant-ui/message.d.ts +4 -0
  75. package/components/assistant-ui/message.js +159 -0
  76. package/components/assistant-ui/primitives.d.ts +2 -0
  77. package/components/assistant-ui/quote.d.ts +37 -0
  78. package/components/assistant-ui/quote.js +150 -0
  79. package/components/assistant-ui/reasoning.d.ts +44 -0
  80. package/components/assistant-ui/reasoning.js +261 -0
  81. package/components/assistant-ui/selection-toolbar.d.ts +29 -0
  82. package/components/assistant-ui/selection-toolbar.js +91 -0
  83. package/components/assistant-ui/smart-message-text.d.ts +15 -0
  84. package/components/assistant-ui/smart-message-text.js +29 -0
  85. package/components/assistant-ui/sources.d.ts +17 -0
  86. package/components/assistant-ui/sources.js +121 -0
  87. package/components/assistant-ui/suggestions.d.ts +7 -0
  88. package/components/assistant-ui/suggestions.js +19 -0
  89. package/components/assistant-ui/thread-context.d.ts +37 -0
  90. package/components/assistant-ui/thread-context.js +8 -0
  91. package/components/assistant-ui/thread.d.ts +5 -0
  92. package/components/assistant-ui/thread.js +77 -0
  93. package/components/assistant-ui/tool-fallback.d.ts +36 -0
  94. package/components/assistant-ui/tool-fallback.js +428 -0
  95. package/components/assistant-ui/tool-group.d.ts +33 -0
  96. package/components/assistant-ui/tool-group.js +173 -0
  97. package/components/assistant-ui/tooltip-icon-button.d.ts +7 -0
  98. package/components/assistant-ui/tooltip-icon-button.js +31 -0
  99. package/components/assistant-ui/voice.d.ts +18 -0
  100. package/components/autocomplete.d.ts +18 -0
  101. package/components/autocomplete.js +162 -0
  102. package/components/avatar.d.ts +26 -0
  103. package/components/avatar.js +92 -0
  104. package/components/badge.d.ts +10 -0
  105. package/components/badge.js +83 -0
  106. package/components/brand-loader.d.ts +16 -0
  107. package/components/brand-loader.js +64 -0
  108. package/components/breadcrumbs.d.ts +8 -0
  109. package/components/breadcrumbs.js +58 -0
  110. package/components/button.d.ts +13 -0
  111. package/components/button.js +100 -0
  112. package/components/card.d.ts +19 -0
  113. package/components/card.js +82 -0
  114. package/components/carousel.d.ts +31 -0
  115. package/components/carousel.js +351 -0
  116. package/components/chart.d.ts +165 -0
  117. package/components/chart.js +841 -0
  118. package/components/checkbox.d.ts +13 -0
  119. package/components/checkbox.js +84 -0
  120. package/components/chip.d.ts +13 -0
  121. package/components/chip.js +112 -0
  122. package/components/collapsible.d.ts +5 -0
  123. package/components/collapsible.js +31 -0
  124. package/components/connector-card.d.ts +62 -0
  125. package/components/connector-card.js +154 -0
  126. package/components/divider.d.ts +23 -0
  127. package/components/divider.js +69 -0
  128. package/components/drawer.d.ts +45 -0
  129. package/components/drawer.js +234 -0
  130. package/components/dropdown.d.ts +33 -0
  131. package/components/dropdown.js +198 -0
  132. package/components/empty-state.d.ts +8 -0
  133. package/components/empty-state.js +30 -0
  134. package/components/field.d.ts +20 -0
  135. package/components/field.js +74 -0
  136. package/components/index.d.ts +56 -0
  137. package/components/index.js +444 -0
  138. package/components/input-field.d.ts +22 -0
  139. package/components/input-field.js +91 -0
  140. package/components/input.d.ts +8 -0
  141. package/components/input.js +61 -0
  142. package/components/kbd.d.ts +6 -0
  143. package/components/kbd.js +26 -0
  144. package/components/link.d.ts +14 -0
  145. package/components/link.js +72 -0
  146. package/components/modal.d.ts +18 -0
  147. package/components/modal.js +156 -0
  148. package/components/navbar.d.ts +15 -0
  149. package/components/navbar.js +68 -0
  150. package/components/number-field.d.ts +11 -0
  151. package/components/number-field.js +89 -0
  152. package/components/pagination.d.ts +28 -0
  153. package/components/pagination.js +179 -0
  154. package/components/panel.d.ts +14 -0
  155. package/components/panel.js +71 -0
  156. package/components/pixel-blast-svg.d.ts +22 -0
  157. package/components/pixel-blast-svg.js +154 -0
  158. package/components/popover.d.ts +20 -0
  159. package/components/popover.js +101 -0
  160. package/components/progress-circle.d.ts +11 -0
  161. package/components/progress-circle.js +75 -0
  162. package/components/progress.d.ts +22 -0
  163. package/components/progress.js +66 -0
  164. package/components/radio.d.ts +16 -0
  165. package/components/radio.js +101 -0
  166. package/components/segmented.d.ts +16 -0
  167. package/components/segmented.js +103 -0
  168. package/components/select.d.ts +28 -0
  169. package/components/select.js +180 -0
  170. package/components/selection-action-bar.d.ts +11 -0
  171. package/components/selection-action-bar.js +59 -0
  172. package/components/sidebar.d.ts +118 -0
  173. package/components/sidebar.js +375 -0
  174. package/components/skeleton.d.ts +6 -0
  175. package/components/skeleton.js +26 -0
  176. package/components/slider.d.ts +11 -0
  177. package/components/slider.js +62 -0
  178. package/components/spinner.d.ts +11 -0
  179. package/components/spinner.js +62 -0
  180. package/components/switch.d.ts +7 -0
  181. package/components/switch.js +61 -0
  182. package/components/table.d.ts +59 -0
  183. package/components/table.js +254 -0
  184. package/components/tabs.d.ts +29 -0
  185. package/components/tabs.js +371 -0
  186. package/components/textarea.d.ts +5 -0
  187. package/components/textarea.js +24 -0
  188. package/components/timeline.d.ts +7 -0
  189. package/components/timeline.js +47 -0
  190. package/components/toast.d.ts +74 -0
  191. package/components/toast.js +211 -0
  192. package/components/tooltip.d.ts +11 -0
  193. package/components/tooltip.js +143 -0
  194. package/components/tree.d.ts +42 -0
  195. package/components/tree.js +86 -0
  196. package/components/typography.d.ts +33 -0
  197. package/components/typography.js +65 -0
  198. package/components/ui/avatar.d.ts +11 -0
  199. package/components/ui/avatar.js +56 -0
  200. package/components/ui/button.d.ts +10 -0
  201. package/components/ui/button.js +57 -0
  202. package/components/ui/collapsible.d.ts +5 -0
  203. package/components/ui/collapsible.js +35 -0
  204. package/components/ui/dialog.d.ts +17 -0
  205. package/components/ui/dialog.js +93 -0
  206. package/components/ui/tabs.d.ts +22 -0
  207. package/components/ui/tooltip.d.ts +7 -0
  208. package/components/ui/tooltip.js +56 -0
  209. package/fonts/aribau-grotesk-400.otf +0 -0
  210. package/fonts/aribau-grotesk-700.otf +0 -0
  211. package/fonts.css +21 -0
  212. package/hooks/agents-ui/use-agent-audio-visualizer-aura.d.ts +8 -0
  213. package/hooks/agents-ui/use-agent-audio-visualizer-aura.js +62 -0
  214. package/hooks/agents-ui/use-agent-audio-visualizer-wave.d.ts +7 -0
  215. package/hooks/agents-ui/use-agent-audio-visualizer-wave.js +60 -0
  216. package/hooks/agents-ui/voice-visualizer-types.d.ts +9 -0
  217. package/lib/cn.d.ts +3 -0
  218. package/lib/cn.js +9 -0
  219. package/lib/icons.d.ts +378 -0
  220. package/lib/icons.js +119 -0
  221. package/lib/interactive.d.ts +24 -0
  222. package/lib/interactive.js +36 -0
  223. package/lib/motion.d.ts +58 -0
  224. package/lib/motion.js +70 -0
  225. package/lib/router.d.ts +3 -0
  226. package/lib/utils.d.ts +6 -0
  227. package/llms.txt +537 -0
  228. package/manifest.json +5085 -0
  229. package/package.json +60 -0
  230. package/styles.css +653 -0
  231. package/theme.css +273 -0
@@ -0,0 +1,277 @@
1
+ "use client";
2
+ import { jsx as d } from "react/jsx-runtime";
3
+ import * as x from "react";
4
+ import { ReactShaderToy as y } from "./react-shader-toy.js";
5
+ import { useAgentAudioVisualizerAura as b } from "../../hooks/agents-ui/use-agent-audio-visualizer-aura.js";
6
+ import { cn as S } from "../../lib/cn.js";
7
+ const h = [0.122, 0.835, 0.976], A = `
8
+ const float TAU = 6.283185;
9
+
10
+ // Noise for dithering
11
+ vec2 randFibo(vec2 p) {
12
+ p = fract(p * vec2(443.897, 441.423));
13
+ p += dot(p, p.yx + 19.19);
14
+ return fract((p.xx + p.yx) * p.xy);
15
+ }
16
+
17
+ // Tonemap
18
+ vec3 Tonemap(vec3 x) {
19
+ x *= 4.0;
20
+ return x / (1.0 + x);
21
+ }
22
+
23
+ // Luma for alpha
24
+ float luma(vec3 color) {
25
+ return dot(color, vec3(0.299, 0.587, 0.114));
26
+ }
27
+
28
+ // RGB to HSV
29
+ vec3 rgb2hsv(vec3 c) {
30
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
31
+ vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
32
+ vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
33
+ float d = q.x - min(q.w, q.y);
34
+ float e = 1.0e-10;
35
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
36
+ }
37
+
38
+ // HSV to RGB
39
+ vec3 hsv2rgb(vec3 c) {
40
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
41
+ vec3 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
+
45
+ // SDF shapes
46
+ float sdCircle(vec2 st, float r) {
47
+ return length(st) - r;
48
+ }
49
+
50
+ float sdLine(vec2 p, float r) {
51
+ float halfLen = r * 2.0;
52
+ vec2 a = vec2(-halfLen, 0.0);
53
+ vec2 b = vec2(halfLen, 0.0);
54
+ vec2 pa = p - a;
55
+ vec2 ba = b - a;
56
+ float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);
57
+ return length(pa - ba * h);
58
+ }
59
+
60
+ float getSdf(vec2 st) {
61
+ if(uShape == 1.0) return sdCircle(st, uScale);
62
+ else if(uShape == 2.0) return sdLine(st, uScale);
63
+ return sdCircle(st, uScale); // Default
64
+ }
65
+
66
+ vec2 turb(vec2 pos, float t, float it) {
67
+ // Initial rotation matrix for swirl direction
68
+ mat2 rotation = mat2(0.6, -0.25, 0.25, 0.9);
69
+ // Secondary rotation applied each iteration (approx 53 degree rotation)
70
+ mat2 layerRotation = mat2(0.6, -0.8, 0.8, 0.6);
71
+
72
+ float frequency = mix(2.0, 15.0, uFrequency);
73
+ float amplitude = uAmplitude;
74
+ float frequencyGrowth = 1.4;
75
+ float animTime = t * 0.1 * uSpeed;
76
+
77
+ const int LAYERS = 4;
78
+ for(int i = 0; i < LAYERS; i++) {
79
+ // Calculate wave displacement for this layer
80
+ vec2 rotatedPos = pos * rotation;
81
+ vec2 wave = sin(frequency * rotatedPos + float(i) * animTime + it);
82
+
83
+ // Apply displacement along rotation direction
84
+ pos += (amplitude / frequency) * rotation[0] * wave;
85
+
86
+ // Evolve parameters for next layer
87
+ rotation *= layerRotation;
88
+ amplitude *= mix(1.0, max(wave.x, wave.y), uVariance);
89
+ frequency *= frequencyGrowth;
90
+ }
91
+
92
+ return pos;
93
+ }
94
+
95
+ const float ITERATIONS = 36.0;
96
+
97
+ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
98
+ vec2 uv = fragCoord / iResolution.xy;
99
+
100
+ vec3 pp = vec3(0.0);
101
+ vec3 bloom = vec3(0.0);
102
+ float t = iTime * 0.5;
103
+ vec2 pos = uv - 0.5;
104
+
105
+ vec2 prevPos = turb(pos, t, 0.0 - 1.0 / ITERATIONS);
106
+ float spacing = mix(1.0, TAU, uSpacing);
107
+
108
+ for(float i = 1.0; i < ITERATIONS + 1.0; i++) {
109
+ float iter = i / ITERATIONS;
110
+ vec2 st = turb(pos, t, iter * spacing);
111
+ float d = abs(getSdf(st));
112
+ float pd = distance(st, prevPos);
113
+ prevPos = st;
114
+ float dynamicBlur = exp2(pd * 2.0 * 1.4426950408889634) - 1.0;
115
+ float ds = smoothstep(0.0, uBlur * 0.05 + max(dynamicBlur * uSmoothing, 0.001), d);
116
+
117
+ // Shift color based on iteration using uColorScale
118
+ vec3 color = uColor;
119
+ if(uColorShift > 0.01) {
120
+ vec3 hsv = rgb2hsv(color);
121
+ // Shift hue by iteration
122
+ hsv.x = fract(hsv.x + (1.0 - iter) * uColorShift * 0.3);
123
+ color = hsv2rgb(hsv);
124
+ }
125
+
126
+ float invd = 1.0 / max(d + dynamicBlur, 0.001);
127
+ pp += (ds - 1.0) * color;
128
+ bloom += clamp(invd, 0.0, 250.0) * color;
129
+ }
130
+
131
+ pp *= 1.0 / ITERATIONS;
132
+
133
+ vec3 color;
134
+
135
+ // Dark mode (default)
136
+ if(uMode < 0.5) {
137
+ // use bloom effect
138
+ bloom = bloom / (bloom + 2e4);
139
+ color = (-pp + bloom * 3.0 * uBloom) * 1.2;
140
+ color += (randFibo(fragCoord).x - 0.5) / 255.0;
141
+ color = Tonemap(color);
142
+ float alpha = luma(color) * uMix;
143
+ fragColor = vec4(color * uMix, alpha);
144
+ }
145
+
146
+ // Light mode
147
+ else {
148
+ // no bloom effect
149
+ color = -pp;
150
+ color += (randFibo(fragCoord).x - 0.5) / 255.0;
151
+
152
+ // Preserve hue by tone mapping brightness only
153
+ float brightness = length(color);
154
+ vec3 direction = brightness > 0.0 ? color / brightness : color;
155
+
156
+ // Reinhard on brightness
157
+ float factor = 2.0;
158
+ float mappedBrightness = (brightness * factor) / (1.0 + brightness * factor);
159
+ color = direction * mappedBrightness;
160
+
161
+ // Boost saturation to compensate for white background bleed-through
162
+ // When alpha < 1.0, white bleeds through making colors look desaturated
163
+ // So we increase saturation to maintain vibrant appearance
164
+ float gray = dot(color, vec3(0.2, 0.5, 0.1));
165
+ float saturationBoost = 3.0;
166
+ color = mix(vec3(gray), color, saturationBoost);
167
+
168
+ // Clamp between 0-1
169
+ color = clamp(color, 0.0, 1.0);
170
+
171
+ float alpha = mappedBrightness * clamp(uMix, 1.0, 2.0);
172
+ fragColor = vec4(color, alpha);
173
+ }
174
+ }`;
175
+ function g({
176
+ shape: m = 1,
177
+ speed: e = 1,
178
+ amplitude: t = 0.5,
179
+ frequency: a = 0.5,
180
+ scale: r = 0.2,
181
+ blur: l = 1,
182
+ color: i = h,
183
+ colorShift: c = 1,
184
+ brightness: n = 1,
185
+ themeMode: u = "light",
186
+ reduced: s = !1,
187
+ ref: p,
188
+ className: f,
189
+ ...v
190
+ }) {
191
+ return /* @__PURE__ */ d("div", { ref: p, className: f, ...v, children: /* @__PURE__ */ d(
192
+ y,
193
+ {
194
+ fs: A,
195
+ className: "size-full",
196
+ devicePixelRatio: 1,
197
+ paused: s || e === 0,
198
+ uniforms: {
199
+ // Aurora wave speed
200
+ uSpeed: { type: "1f", value: e },
201
+ // Edge blur/softness
202
+ uBlur: { type: "1f", value: l },
203
+ // Shape scale
204
+ uScale: { type: "1f", value: r },
205
+ // Shape type: 1=circle, 2=line
206
+ uShape: { type: "1f", value: m },
207
+ // Wave frequency and complexity
208
+ uFrequency: { type: "1f", value: a },
209
+ // Turbulence amplitude
210
+ uAmplitude: { type: "1f", value: t },
211
+ // Light intensity (bloom)
212
+ uBloom: { type: "1f", value: 0 },
213
+ // Brightness of the aurora (0-1)
214
+ uMix: { type: "1f", value: n },
215
+ // Color variation across layers (0-1)
216
+ uSpacing: { type: "1f", value: 0.5 },
217
+ // Color palette offset - shifts colors along the gradient (0-1)
218
+ uColorShift: { type: "1f", value: c },
219
+ // Color variation across layers (0-1)
220
+ uVariance: { type: "1f", value: 0.1 },
221
+ // Smoothing of the aurora (0-1)
222
+ uSmoothing: { type: "1f", value: 1 },
223
+ // Display mode: 0=dark background, 1=light background
224
+ uMode: { type: "1f", value: u === "light" ? 1 : 0 },
225
+ // Color
226
+ uColor: { type: "3fv", value: i }
227
+ },
228
+ onError: (o) => {
229
+ console.error("Shader error:", o);
230
+ },
231
+ onWarning: (o) => {
232
+ console.warn("Shader warning:", o);
233
+ }
234
+ }
235
+ ) });
236
+ }
237
+ g.displayName = "AuraShader";
238
+ const w = x.forwardRef(function({
239
+ state: e = "idle",
240
+ volume: t = 0,
241
+ reduced: a = !1,
242
+ color: r = h,
243
+ colorShift: l = 0.05,
244
+ themeMode: i = "light",
245
+ className: c,
246
+ ...n
247
+ }, u) {
248
+ const { speed: s, scale: p, amplitude: f, frequency: v, brightness: o } = b({
249
+ state: e,
250
+ volume: t,
251
+ reduced: a
252
+ });
253
+ return /* @__PURE__ */ d(
254
+ g,
255
+ {
256
+ ref: u,
257
+ "aria-hidden": !0,
258
+ "data-state": e,
259
+ blur: 0.2,
260
+ color: r,
261
+ colorShift: l,
262
+ speed: s,
263
+ scale: p,
264
+ themeMode: i,
265
+ amplitude: f,
266
+ frequency: v,
267
+ brightness: o,
268
+ reduced: a,
269
+ className: S("size-full", c),
270
+ ...n
271
+ }
272
+ );
273
+ });
274
+ w.displayName = "AgentAudioVisualizerAura";
275
+ export {
276
+ w as AgentAudioVisualizerAura
277
+ };
@@ -0,0 +1,12 @@
1
+ import { VoiceVisualizerColor, VoiceVisualizerDriver } from '../../hooks/agents-ui/voice-visualizer-types';
2
+ import * as React from "react";
3
+ export interface AgentAudioVisualizerWaveProps extends Omit<React.ComponentPropsWithoutRef<"div">, "color">, VoiceVisualizerDriver {
4
+ /** Normalized RGB shader color. */
5
+ color?: VoiceVisualizerColor;
6
+ /** Hue variation toward the outside of the wave. */
7
+ colorShift?: number;
8
+ lineWidth?: number;
9
+ blur?: number;
10
+ }
11
+ /** Internal ADS port of LiveKit Agents UI's Wave visualizer. */
12
+ export declare const AgentAudioVisualizerWave: React.ForwardRefExoticComponent<AgentAudioVisualizerWaveProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,203 @@
1
+ "use client";
2
+ import { jsx as v } from "react/jsx-runtime";
3
+ import * as g from "react";
4
+ import { ReactShaderToy as y } from "./react-shader-toy.js";
5
+ import { useAgentAudioVisualizerWave as w } from "../../hooks/agents-ui/use-agent-audio-visualizer-wave.js";
6
+ import { cn as b } from "../../lib/cn.js";
7
+ const p = [0.122, 0.835, 0.976], S = `
8
+ const float TAU = 6.28318530718;
9
+
10
+ // Noise for dithering
11
+ vec2 randFibo(vec2 p) {
12
+ p = fract(p * vec2(443.897, 441.423));
13
+ p += dot(p, p.yx + 19.19);
14
+ return fract((p.xx + p.yx) * p.xy);
15
+ }
16
+
17
+ // Luma for alpha
18
+ float luma(vec3 color) {
19
+ return dot(color, vec3(0.299, 0.587, 0.114));
20
+ }
21
+
22
+ // RGB to HSV
23
+ vec3 rgb2hsv(vec3 c) {
24
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
25
+ vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
26
+ vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
27
+ float d = q.x - min(q.w, q.y);
28
+ float e = 1.0e-10;
29
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
30
+ }
31
+
32
+ // HSV to RGB
33
+ vec3 hsv2rgb(vec3 c) {
34
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
35
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
36
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
37
+ }
38
+
39
+ // Bell curve function for attenuation from center with rounded top
40
+ float bellCurve(float distanceFromCenter, float maxDistance) {
41
+ float normalizedDistance = distanceFromCenter / maxDistance;
42
+ // Use cosine with high power for smooth rounded top
43
+ return pow(cos(normalizedDistance * (3.14159265359 / 4.0)), 16.0);
44
+ }
45
+
46
+ // Calculate the sine wave
47
+ float oscilloscopeWave(float x, float centerX, float time) {
48
+ float relativeX = x - centerX;
49
+ float maxDistance = centerX;
50
+ float distanceFromCenter = abs(relativeX);
51
+
52
+ // Apply bell curve for amplitude attenuation
53
+ float bell = bellCurve(distanceFromCenter, maxDistance);
54
+
55
+ // Calculate wave with uniforms and bell curve attenuation
56
+ float wave = sin(relativeX * uFrequency + time * uSpeed) * uAmplitude * bell;
57
+
58
+ return wave;
59
+ }
60
+
61
+ void mainImage(out vec4 fragColor, in vec2 fragCoord) {
62
+ vec2 uv = fragCoord / iResolution.xy;
63
+ vec2 pos = uv - 0.5;
64
+
65
+ // Calculate center and positions
66
+ float centerX = 0.5;
67
+ float centerY = 0.5;
68
+ float x = uv.x;
69
+ float y = uv.y;
70
+
71
+ // Convert line width from pixels to UV space
72
+ // Use the average of width and height to handle aspect ratio
73
+ float pixelSize = 2.0 / (iResolution.x + iResolution.y);
74
+ float lineWidthUV = uLineWidth * pixelSize;
75
+ float smoothingUV = uSmoothing * pixelSize;
76
+
77
+ // Find minimum distance to the wave by sampling nearby points
78
+ // This gives us consistent line width without high-frequency artifacts
79
+ const int NUM_SAMPLES = 50; // Must be const for GLSL loop
80
+ float minDist = 1000.0;
81
+ float sampleRange = 0.02; // Range to search for closest point
82
+
83
+ for(int i = 0; i < NUM_SAMPLES; i++) {
84
+ float offset = (float(i) / float(NUM_SAMPLES - 1) - 0.5) * sampleRange;
85
+ float sampleX = x + offset;
86
+ float waveY = centerY + oscilloscopeWave(sampleX, centerX, iTime);
87
+
88
+ // Calculate distance from current pixel to this point on the wave
89
+ vec2 wavePoint = vec2(sampleX, waveY);
90
+ vec2 currentPoint = vec2(x, y);
91
+ float dist = distance(currentPoint, wavePoint);
92
+
93
+ minDist = min(minDist, dist);
94
+ }
95
+
96
+ // Solid line with smooth edges using minimum distance
97
+ float line = smoothstep(lineWidthUV + smoothingUV, lineWidthUV - smoothingUV, minDist);
98
+
99
+ vec3 color = uColor;
100
+ if(abs(uColorShift) > 0.01) {
101
+ // Keep the center 50% at base color, then ramp shift across outer 25% on each side.
102
+ float centerBandHalfWidth = 0.2;
103
+ float edgeBandWidth = 0.5;
104
+ float distanceFromCenter = abs(x - centerX);
105
+ float edgeFactor = clamp((distanceFromCenter - centerBandHalfWidth) / edgeBandWidth, 0.0, 1.0);
106
+ vec3 hsv = rgb2hsv(color);
107
+ // Hue shift is zero in the center band and strongest at far edges.
108
+ hsv.x = fract(hsv.x + edgeFactor * uColorShift * 0.3);
109
+ color = hsv2rgb(hsv);
110
+ }
111
+
112
+ // Apply line intensity
113
+ color *= line;
114
+
115
+ // Add dithering for smoother gradients
116
+ // color += (randFibo(fragCoord).x - 0.5) / 255.0;
117
+
118
+ // Calculate alpha based on line intensity
119
+ float alpha = line * uMix;
120
+
121
+ fragColor = vec4(color * uMix, alpha);
122
+ }`;
123
+ function m({
124
+ speed: a = 10,
125
+ color: t = p,
126
+ colorShift: i = 0.05,
127
+ mix: o = 1,
128
+ amplitude: n = 0.02,
129
+ frequency: r = 20,
130
+ lineWidth: l = 2,
131
+ blur: c = 0.5,
132
+ reduced: s = !1,
133
+ ref: f,
134
+ className: u,
135
+ ...d
136
+ }) {
137
+ return /* @__PURE__ */ v("div", { ref: f, className: u, ...d, children: /* @__PURE__ */ v(
138
+ y,
139
+ {
140
+ fs: S,
141
+ className: "size-full",
142
+ devicePixelRatio: 1,
143
+ paused: s || a === 0,
144
+ uniforms: {
145
+ uSpeed: { type: "1f", value: a },
146
+ uAmplitude: { type: "1f", value: n },
147
+ uFrequency: { type: "1f", value: r },
148
+ uMix: { type: "1f", value: o },
149
+ uLineWidth: { type: "1f", value: l },
150
+ uSmoothing: { type: "1f", value: c },
151
+ uColor: { type: "3fv", value: t },
152
+ uColorShift: { type: "1f", value: i }
153
+ },
154
+ onError: (e) => {
155
+ console.error("Shader error:", e);
156
+ },
157
+ onWarning: (e) => {
158
+ console.warn("Shader warning:", e);
159
+ }
160
+ }
161
+ ) });
162
+ }
163
+ m.displayName = "WaveShader";
164
+ const C = g.forwardRef(function({
165
+ state: t = "idle",
166
+ volume: i = 0,
167
+ reduced: o = !1,
168
+ color: n = p,
169
+ colorShift: r = 0.05,
170
+ lineWidth: l = 1.5,
171
+ blur: c = 0.5,
172
+ className: s,
173
+ ...f
174
+ }, u) {
175
+ const { speed: d, amplitude: e, frequency: h, opacity: x } = w({
176
+ state: t,
177
+ volume: i,
178
+ reduced: o
179
+ });
180
+ return /* @__PURE__ */ v(
181
+ m,
182
+ {
183
+ ref: u,
184
+ "aria-hidden": !0,
185
+ "data-state": t,
186
+ speed: d,
187
+ color: n,
188
+ colorShift: r,
189
+ mix: x,
190
+ amplitude: e,
191
+ frequency: h,
192
+ lineWidth: l,
193
+ blur: c,
194
+ reduced: o,
195
+ className: b("size-full", s),
196
+ ...f
197
+ }
198
+ );
199
+ });
200
+ C.displayName = "AgentAudioVisualizerWave";
201
+ export {
202
+ C as AgentAudioVisualizerWave
203
+ };
@@ -0,0 +1,87 @@
1
+ import { default as React, ComponentPropsWithoutRef } from 'react';
2
+ type Vector4<T = number> = [T, T, T, T];
3
+ type Uniform = {
4
+ type: string;
5
+ value: number[] | number;
6
+ };
7
+ type Uniforms = Record<string, Uniform>;
8
+ type TextureParams = {
9
+ url: string;
10
+ wrapS?: number;
11
+ wrapT?: number;
12
+ minFilter?: number;
13
+ magFilter?: number;
14
+ flipY?: number;
15
+ };
16
+ export interface ReactShaderToyProps {
17
+ /** Fragment shader GLSL code. */
18
+ fs: string;
19
+ /** Vertex shader GLSL code. */
20
+ vs?: string;
21
+ /**
22
+ * Textures to be passed to the shader. Textures need to be squared or will be
23
+ * automatically resized.
24
+ *
25
+ * Options default to:
26
+ *
27
+ * ```js
28
+ * {
29
+ * minFilter: LinearMipMapLinearFilter,
30
+ * magFilter: LinearFilter,
31
+ * wrapS: RepeatWrapping,
32
+ * wrapT: RepeatWrapping,
33
+ * }
34
+ * ```
35
+ *
36
+ * See [textures in the docs](https://rysana.com/docs/react-shaders#textures)
37
+ * for details.
38
+ */
39
+ textures?: TextureParams[];
40
+ /**
41
+ * Custom uniforms to be passed to the shader.
42
+ *
43
+ * See [custom uniforms in the
44
+ * docs](https://rysana.com/docs/react-shaders#custom-uniforms) for details.
45
+ */
46
+ uniforms?: Uniforms;
47
+ /**
48
+ * Color used when clearing the canvas.
49
+ *
50
+ * See [the WebGL
51
+ * docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/clearColor)
52
+ * for details.
53
+ */
54
+ clearColor?: Vector4;
55
+ /**
56
+ * GLSL precision qualifier. Defaults to `'highp'`. Balance between
57
+ * performance and quality.
58
+ */
59
+ precision?: 'highp' | 'lowp' | 'mediump';
60
+ /** Custom inline style for canvas. */
61
+ style?: React.CSSProperties;
62
+ /** Customize WebGL context attributes. See [the WebGL docs](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getContextAttributes) for details. */
63
+ contextAttributes?: Record<string, unknown>;
64
+ /** Lerp value for `iMouse` built-in uniform. Must be between 0 and 1. */
65
+ lerp?: number;
66
+ /** Device pixel ratio. */
67
+ devicePixelRatio?: number;
68
+ /**
69
+ * Callback for when the textures are done loading. Useful if you want to do
70
+ * something like e.g. hide the canvas until textures are done loading.
71
+ */
72
+ onDoneLoadingTextures?: () => void;
73
+ /** Custom callback to handle errors. Defaults to `console.error`. */
74
+ onError?: (error: string) => void;
75
+ /** Custom callback to handle warnings. Defaults to `console.warn`. */
76
+ onWarning?: (warning: string) => void;
77
+ /**
78
+ * When true, the animation loop runs even when the canvas is not visible in the viewport.
79
+ * When false (default), animation runs only while visible (uses Intersection Observer),
80
+ * reducing CPU/GPU usage when the shader is off-screen.
81
+ */
82
+ animateWhenNotVisible?: boolean;
83
+ /** Draw the current frame but freeze shader time until resumed. */
84
+ paused?: boolean;
85
+ }
86
+ export declare function ReactShaderToy({ fs, vs, textures, uniforms: propUniforms, clearColor, precision, style, contextAttributes, lerp, devicePixelRatio, onDoneLoadingTextures, onError, onWarning, animateWhenNotVisible, paused, ...canvasProps }: ReactShaderToyProps & ComponentPropsWithoutRef<'canvas'>): React.JSX.Element;
87
+ export {};